![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.securityinsights.models.MetadataSource 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-2021-09.
// 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.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;
/**
* The original source of the content item, where it comes from.
*/
@Fluent
public final class MetadataSource implements JsonSerializable {
/*
* Source type of the content
*/
private SourceKind kind;
/*
* Name of the content source. The repo name, solution name, LA workspace name etc.
*/
private String name;
/*
* ID of the content source. The solution ID, workspace ID, etc
*/
private String sourceId;
/**
* Creates an instance of MetadataSource class.
*/
public MetadataSource() {
}
/**
* Get the kind property: Source type of the content.
*
* @return the kind value.
*/
public SourceKind kind() {
return this.kind;
}
/**
* Set the kind property: Source type of the content.
*
* @param kind the kind value to set.
* @return the MetadataSource object itself.
*/
public MetadataSource withKind(SourceKind kind) {
this.kind = kind;
return this;
}
/**
* Get the name property: Name of the content source. The repo name, solution name, LA workspace name etc.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Name of the content source. The repo name, solution name, LA workspace name etc.
*
* @param name the name value to set.
* @return the MetadataSource object itself.
*/
public MetadataSource withName(String name) {
this.name = name;
return this;
}
/**
* Get the sourceId property: ID of the content source. The solution ID, workspace ID, etc.
*
* @return the sourceId value.
*/
public String sourceId() {
return this.sourceId;
}
/**
* Set the sourceId property: ID of the content source. The solution ID, workspace ID, etc.
*
* @param sourceId the sourceId value to set.
* @return the MetadataSource object itself.
*/
public MetadataSource withSourceId(String sourceId) {
this.sourceId = sourceId;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (kind() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property kind in model MetadataSource"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(MetadataSource.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString());
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeStringField("sourceId", this.sourceId);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MetadataSource from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MetadataSource 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 MetadataSource.
*/
public static MetadataSource fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MetadataSource deserializedMetadataSource = new MetadataSource();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("kind".equals(fieldName)) {
deserializedMetadataSource.kind = SourceKind.fromString(reader.getString());
} else if ("name".equals(fieldName)) {
deserializedMetadataSource.name = reader.getString();
} else if ("sourceId".equals(fieldName)) {
deserializedMetadataSource.sourceId = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedMetadataSource;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy