![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.securityinsights.models.FileMetadata 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Represents a file.
*/
@Fluent
public final class FileMetadata implements JsonSerializable {
/*
* The format of the file
*/
private FileFormat fileFormat;
/*
* The name of the file.
*/
private String fileName;
/*
* The size of the file.
*/
private Integer fileSize;
/*
* A URI with a valid SAS token to allow uploading / downloading the file.
*/
private String fileContentUri;
/*
* Indicates whether the file was deleted from the storage account.
*/
private DeleteStatus deleteStatus;
/**
* Creates an instance of FileMetadata class.
*/
public FileMetadata() {
}
/**
* Get the fileFormat property: The format of the file.
*
* @return the fileFormat value.
*/
public FileFormat fileFormat() {
return this.fileFormat;
}
/**
* Set the fileFormat property: The format of the file.
*
* @param fileFormat the fileFormat value to set.
* @return the FileMetadata object itself.
*/
public FileMetadata withFileFormat(FileFormat fileFormat) {
this.fileFormat = fileFormat;
return this;
}
/**
* Get the fileName property: The name of the file.
*
* @return the fileName value.
*/
public String fileName() {
return this.fileName;
}
/**
* Set the fileName property: The name of the file.
*
* @param fileName the fileName value to set.
* @return the FileMetadata object itself.
*/
public FileMetadata withFileName(String fileName) {
this.fileName = fileName;
return this;
}
/**
* Get the fileSize property: The size of the file.
*
* @return the fileSize value.
*/
public Integer fileSize() {
return this.fileSize;
}
/**
* Set the fileSize property: The size of the file.
*
* @param fileSize the fileSize value to set.
* @return the FileMetadata object itself.
*/
public FileMetadata withFileSize(Integer fileSize) {
this.fileSize = fileSize;
return this;
}
/**
* Get the fileContentUri property: A URI with a valid SAS token to allow uploading / downloading the file.
*
* @return the fileContentUri value.
*/
public String fileContentUri() {
return this.fileContentUri;
}
/**
* Get the deleteStatus property: Indicates whether the file was deleted from the storage account.
*
* @return the deleteStatus value.
*/
public DeleteStatus deleteStatus() {
return this.deleteStatus;
}
/**
* 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("fileFormat", this.fileFormat == null ? null : this.fileFormat.toString());
jsonWriter.writeStringField("fileName", this.fileName);
jsonWriter.writeNumberField("fileSize", this.fileSize);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of FileMetadata from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of FileMetadata 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 FileMetadata.
*/
public static FileMetadata fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
FileMetadata deserializedFileMetadata = new FileMetadata();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("fileFormat".equals(fieldName)) {
deserializedFileMetadata.fileFormat = FileFormat.fromString(reader.getString());
} else if ("fileName".equals(fieldName)) {
deserializedFileMetadata.fileName = reader.getString();
} else if ("fileSize".equals(fieldName)) {
deserializedFileMetadata.fileSize = reader.getNullable(JsonReader::getInt);
} else if ("fileContentUri".equals(fieldName)) {
deserializedFileMetadata.fileContentUri = reader.getString();
} else if ("deleteStatus".equals(fieldName)) {
deserializedFileMetadata.deleteStatus = DeleteStatus.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedFileMetadata;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy