Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* FINBOURNE Scheduler API
*
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.finbourne.scheduler.model;
import java.util.Objects;
import com.finbourne.scheduler.model.Link;
import com.finbourne.scheduler.model.ScanSummary;
import com.finbourne.scheduler.model.Tag;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.openapitools.jackson.nullable.JsonNullable;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.finbourne.scheduler.JSON;
/**
* Represents the metadata of an image
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ImageSummary {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public static final String SERIALIZED_NAME_PUSH_TIME = "pushTime";
@SerializedName(SERIALIZED_NAME_PUSH_TIME)
private OffsetDateTime pushTime;
public static final String SERIALIZED_NAME_PULL_TIME = "pullTime";
@SerializedName(SERIALIZED_NAME_PULL_TIME)
private OffsetDateTime pullTime;
public static final String SERIALIZED_NAME_DIGEST = "digest";
@SerializedName(SERIALIZED_NAME_DIGEST)
private String digest;
public static final String SERIALIZED_NAME_SIZE = "size";
@SerializedName(SERIALIZED_NAME_SIZE)
private Long size;
public static final String SERIALIZED_NAME_TAGS = "tags";
@SerializedName(SERIALIZED_NAME_TAGS)
private List tags;
public static final String SERIALIZED_NAME_SCAN_STATUS = "scanStatus";
@SerializedName(SERIALIZED_NAME_SCAN_STATUS)
private String scanStatus;
public static final String SERIALIZED_NAME_SCAN_SUMMARY = "scanSummary";
@SerializedName(SERIALIZED_NAME_SCAN_SUMMARY)
private ScanSummary scanSummary;
public static final String SERIALIZED_NAME_LINK = "link";
@SerializedName(SERIALIZED_NAME_LINK)
private Link link;
public ImageSummary() {
}
public ImageSummary name(String name) {
this.name = name;
return this;
}
/**
* Name of the image
* @return name
**/
@jakarta.annotation.Nullable
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ImageSummary pushTime(OffsetDateTime pushTime) {
this.pushTime = pushTime;
return this;
}
/**
* The push time of the image
* @return pushTime
**/
@jakarta.annotation.Nullable
public OffsetDateTime getPushTime() {
return pushTime;
}
public void setPushTime(OffsetDateTime pushTime) {
this.pushTime = pushTime;
}
public ImageSummary pullTime(OffsetDateTime pullTime) {
this.pullTime = pullTime;
return this;
}
/**
* The latest pull time of the image
* @return pullTime
**/
@jakarta.annotation.Nullable
public OffsetDateTime getPullTime() {
return pullTime;
}
public void setPullTime(OffsetDateTime pullTime) {
this.pullTime = pullTime;
}
public ImageSummary digest(String digest) {
this.digest = digest;
return this;
}
/**
* The digest of the image
* @return digest
**/
@jakarta.annotation.Nullable
public String getDigest() {
return digest;
}
public void setDigest(String digest) {
this.digest = digest;
}
public ImageSummary size(Long size) {
this.size = size;
return this;
}
/**
* The size of the image (in bytes)
* @return size
**/
@jakarta.annotation.Nullable
public Long getSize() {
return size;
}
public void setSize(Long size) {
this.size = size;
}
public ImageSummary tags(List tags) {
this.tags = tags;
return this;
}
public ImageSummary addTagsItem(Tag tagsItem) {
if (this.tags == null) {
this.tags = new ArrayList<>();
}
this.tags.add(tagsItem);
return this;
}
/**
* The tags of the image
* @return tags
**/
@jakarta.annotation.Nullable
public List getTags() {
return tags;
}
public void setTags(List tags) {
this.tags = tags;
}
public ImageSummary scanStatus(String scanStatus) {
this.scanStatus = scanStatus;
return this;
}
/**
* The Scan Status of the stated image
* @return scanStatus
**/
@jakarta.annotation.Nullable
public String getScanStatus() {
return scanStatus;
}
public void setScanStatus(String scanStatus) {
this.scanStatus = scanStatus;
}
public ImageSummary scanSummary(ScanSummary scanSummary) {
this.scanSummary = scanSummary;
return this;
}
/**
* Get scanSummary
* @return scanSummary
**/
@jakarta.annotation.Nullable
public ScanSummary getScanSummary() {
return scanSummary;
}
public void setScanSummary(ScanSummary scanSummary) {
this.scanSummary = scanSummary;
}
public ImageSummary link(Link link) {
this.link = link;
return this;
}
/**
* Get link
* @return link
**/
@jakarta.annotation.Nullable
public Link getLink() {
return link;
}
public void setLink(Link link) {
this.link = link;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ImageSummary imageSummary = (ImageSummary) o;
return Objects.equals(this.name, imageSummary.name) &&
Objects.equals(this.pushTime, imageSummary.pushTime) &&
Objects.equals(this.pullTime, imageSummary.pullTime) &&
Objects.equals(this.digest, imageSummary.digest) &&
Objects.equals(this.size, imageSummary.size) &&
Objects.equals(this.tags, imageSummary.tags) &&
Objects.equals(this.scanStatus, imageSummary.scanStatus) &&
Objects.equals(this.scanSummary, imageSummary.scanSummary) &&
Objects.equals(this.link, imageSummary.link);
}
private static boolean equalsNullable(JsonNullable a, JsonNullable b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(name, pushTime, pullTime, digest, size, tags, scanStatus, scanSummary, link);
}
private static int hashCodeNullable(JsonNullable a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ImageSummary {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" pushTime: ").append(toIndentedString(pushTime)).append("\n");
sb.append(" pullTime: ").append(toIndentedString(pullTime)).append("\n");
sb.append(" digest: ").append(toIndentedString(digest)).append("\n");
sb.append(" size: ").append(toIndentedString(size)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" scanStatus: ").append(toIndentedString(scanStatus)).append("\n");
sb.append(" scanSummary: ").append(toIndentedString(scanSummary)).append("\n");
sb.append(" link: ").append(toIndentedString(link)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public static HashSet openapiFields;
public static HashSet openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet();
openapiFields.add("name");
openapiFields.add("pushTime");
openapiFields.add("pullTime");
openapiFields.add("digest");
openapiFields.add("size");
openapiFields.add("tags");
openapiFields.add("scanStatus");
openapiFields.add("scanSummary");
openapiFields.add("link");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
}
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to ImageSummary
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ImageSummary.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in ImageSummary is not found in the empty JSON string", ImageSummary.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("digest") != null && !jsonObj.get("digest").isJsonNull()) && !jsonObj.get("digest").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `digest` to be a primitive type in the JSON string but got `%s`", jsonObj.get("digest").toString()));
}
if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) {
JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags");
if (jsonArraytags != null) {
// ensure the json data is an array
if (!jsonObj.get("tags").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString()));
}
// validate the optional field `tags` (array)
for (int i = 0; i < jsonArraytags.size(); i++) {
Tag.validateJsonElement(jsonArraytags.get(i));
};
}
}
if ((jsonObj.get("scanStatus") != null && !jsonObj.get("scanStatus").isJsonNull()) && !jsonObj.get("scanStatus").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `scanStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scanStatus").toString()));
}
// validate the optional field `scanSummary`
if (jsonObj.get("scanSummary") != null && !jsonObj.get("scanSummary").isJsonNull()) {
ScanSummary.validateJsonElement(jsonObj.get("scanSummary"));
}
// validate the optional field `link`
if (jsonObj.get("link") != null && !jsonObj.get("link").isJsonNull()) {
Link.validateJsonElement(jsonObj.get("link"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!ImageSummary.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ImageSummary' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ImageSummary.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, ImageSummary value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public ImageSummary read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of ImageSummary given an JSON string
*
* @param jsonString JSON string
* @return An instance of ImageSummary
* @throws IOException if the JSON string is invalid with respect to ImageSummary
*/
public static ImageSummary fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ImageSummary.class);
}
/**
* Convert an instance of ImageSummary to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}