com.azure.resourcemanager.automation.fluent.models.DscNodeReportInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
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.automation.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.automation.models.DscMetaConfiguration;
import com.azure.resourcemanager.automation.models.DscReportError;
import com.azure.resourcemanager.automation.models.DscReportResource;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* Definition of the dsc node report type.
*/
@Fluent
public final class DscNodeReportInner implements JsonSerializable {
/*
* Gets or sets the end time of the node report.
*/
private OffsetDateTime endTime;
/*
* Gets or sets the lastModifiedTime of the node report.
*/
private OffsetDateTime lastModifiedTime;
/*
* Gets or sets the start time of the node report.
*/
private OffsetDateTime startTime;
/*
* Gets or sets the type of the node report.
*/
private String type;
/*
* Gets or sets the id of the node report.
*/
private String reportId;
/*
* Gets or sets the status of the node report.
*/
private String status;
/*
* Gets or sets the refreshMode of the node report.
*/
private String refreshMode;
/*
* Gets or sets the rebootRequested of the node report.
*/
private String rebootRequested;
/*
* Gets or sets the reportFormatVersion of the node report.
*/
private String reportFormatVersion;
/*
* Gets or sets the configurationVersion of the node report.
*/
private String configurationVersion;
/*
* Gets or sets the id.
*/
private String id;
/*
* Gets or sets the errors for the node report.
*/
private List errors;
/*
* Gets or sets the resource for the node report.
*/
private List resources;
/*
* Gets or sets the metaConfiguration of the node at the time of the report.
*/
private DscMetaConfiguration metaConfiguration;
/*
* Gets or sets the hostname of the node that sent the report.
*/
private String hostname;
/*
* Gets or sets the IPv4 address of the node that sent the report.
*/
private List iPV4Addresses;
/*
* Gets or sets the IPv6 address of the node that sent the report.
*/
private List iPV6Addresses;
/*
* Gets or sets the number of resource in the node report.
*/
private Integer numberOfResources;
/*
* Gets or sets the unparsed errors for the node report.
*/
private String rawErrors;
/**
* Creates an instance of DscNodeReportInner class.
*/
public DscNodeReportInner() {
}
/**
* Get the endTime property: Gets or sets the end time of the node report.
*
* @return the endTime value.
*/
public OffsetDateTime endTime() {
return this.endTime;
}
/**
* Set the endTime property: Gets or sets the end time of the node report.
*
* @param endTime the endTime value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withEndTime(OffsetDateTime endTime) {
this.endTime = endTime;
return this;
}
/**
* Get the lastModifiedTime property: Gets or sets the lastModifiedTime of the node report.
*
* @return the lastModifiedTime value.
*/
public OffsetDateTime lastModifiedTime() {
return this.lastModifiedTime;
}
/**
* Set the lastModifiedTime property: Gets or sets the lastModifiedTime of the node report.
*
* @param lastModifiedTime the lastModifiedTime value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
return this;
}
/**
* Get the startTime property: Gets or sets the start time of the node report.
*
* @return the startTime value.
*/
public OffsetDateTime startTime() {
return this.startTime;
}
/**
* Set the startTime property: Gets or sets the start time of the node report.
*
* @param startTime the startTime value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withStartTime(OffsetDateTime startTime) {
this.startTime = startTime;
return this;
}
/**
* Get the type property: Gets or sets the type of the node report.
*
* @return the type value.
*/
public String type() {
return this.type;
}
/**
* Set the type property: Gets or sets the type of the node report.
*
* @param type the type value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withType(String type) {
this.type = type;
return this;
}
/**
* Get the reportId property: Gets or sets the id of the node report.
*
* @return the reportId value.
*/
public String reportId() {
return this.reportId;
}
/**
* Set the reportId property: Gets or sets the id of the node report.
*
* @param reportId the reportId value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withReportId(String reportId) {
this.reportId = reportId;
return this;
}
/**
* Get the status property: Gets or sets the status of the node report.
*
* @return the status value.
*/
public String status() {
return this.status;
}
/**
* Set the status property: Gets or sets the status of the node report.
*
* @param status the status value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withStatus(String status) {
this.status = status;
return this;
}
/**
* Get the refreshMode property: Gets or sets the refreshMode of the node report.
*
* @return the refreshMode value.
*/
public String refreshMode() {
return this.refreshMode;
}
/**
* Set the refreshMode property: Gets or sets the refreshMode of the node report.
*
* @param refreshMode the refreshMode value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withRefreshMode(String refreshMode) {
this.refreshMode = refreshMode;
return this;
}
/**
* Get the rebootRequested property: Gets or sets the rebootRequested of the node report.
*
* @return the rebootRequested value.
*/
public String rebootRequested() {
return this.rebootRequested;
}
/**
* Set the rebootRequested property: Gets or sets the rebootRequested of the node report.
*
* @param rebootRequested the rebootRequested value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withRebootRequested(String rebootRequested) {
this.rebootRequested = rebootRequested;
return this;
}
/**
* Get the reportFormatVersion property: Gets or sets the reportFormatVersion of the node report.
*
* @return the reportFormatVersion value.
*/
public String reportFormatVersion() {
return this.reportFormatVersion;
}
/**
* Set the reportFormatVersion property: Gets or sets the reportFormatVersion of the node report.
*
* @param reportFormatVersion the reportFormatVersion value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withReportFormatVersion(String reportFormatVersion) {
this.reportFormatVersion = reportFormatVersion;
return this;
}
/**
* Get the configurationVersion property: Gets or sets the configurationVersion of the node report.
*
* @return the configurationVersion value.
*/
public String configurationVersion() {
return this.configurationVersion;
}
/**
* Set the configurationVersion property: Gets or sets the configurationVersion of the node report.
*
* @param configurationVersion the configurationVersion value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withConfigurationVersion(String configurationVersion) {
this.configurationVersion = configurationVersion;
return this;
}
/**
* Get the id property: Gets or sets the id.
*
* @return the id value.
*/
public String id() {
return this.id;
}
/**
* Set the id property: Gets or sets the id.
*
* @param id the id value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withId(String id) {
this.id = id;
return this;
}
/**
* Get the errors property: Gets or sets the errors for the node report.
*
* @return the errors value.
*/
public List errors() {
return this.errors;
}
/**
* Set the errors property: Gets or sets the errors for the node report.
*
* @param errors the errors value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withErrors(List errors) {
this.errors = errors;
return this;
}
/**
* Get the resources property: Gets or sets the resource for the node report.
*
* @return the resources value.
*/
public List resources() {
return this.resources;
}
/**
* Set the resources property: Gets or sets the resource for the node report.
*
* @param resources the resources value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withResources(List resources) {
this.resources = resources;
return this;
}
/**
* Get the metaConfiguration property: Gets or sets the metaConfiguration of the node at the time of the report.
*
* @return the metaConfiguration value.
*/
public DscMetaConfiguration metaConfiguration() {
return this.metaConfiguration;
}
/**
* Set the metaConfiguration property: Gets or sets the metaConfiguration of the node at the time of the report.
*
* @param metaConfiguration the metaConfiguration value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withMetaConfiguration(DscMetaConfiguration metaConfiguration) {
this.metaConfiguration = metaConfiguration;
return this;
}
/**
* Get the hostname property: Gets or sets the hostname of the node that sent the report.
*
* @return the hostname value.
*/
public String hostname() {
return this.hostname;
}
/**
* Set the hostname property: Gets or sets the hostname of the node that sent the report.
*
* @param hostname the hostname value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withHostname(String hostname) {
this.hostname = hostname;
return this;
}
/**
* Get the iPV4Addresses property: Gets or sets the IPv4 address of the node that sent the report.
*
* @return the iPV4Addresses value.
*/
public List iPV4Addresses() {
return this.iPV4Addresses;
}
/**
* Set the iPV4Addresses property: Gets or sets the IPv4 address of the node that sent the report.
*
* @param iPV4Addresses the iPV4Addresses value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withIPV4Addresses(List iPV4Addresses) {
this.iPV4Addresses = iPV4Addresses;
return this;
}
/**
* Get the iPV6Addresses property: Gets or sets the IPv6 address of the node that sent the report.
*
* @return the iPV6Addresses value.
*/
public List iPV6Addresses() {
return this.iPV6Addresses;
}
/**
* Set the iPV6Addresses property: Gets or sets the IPv6 address of the node that sent the report.
*
* @param iPV6Addresses the iPV6Addresses value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withIPV6Addresses(List iPV6Addresses) {
this.iPV6Addresses = iPV6Addresses;
return this;
}
/**
* Get the numberOfResources property: Gets or sets the number of resource in the node report.
*
* @return the numberOfResources value.
*/
public Integer numberOfResources() {
return this.numberOfResources;
}
/**
* Set the numberOfResources property: Gets or sets the number of resource in the node report.
*
* @param numberOfResources the numberOfResources value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withNumberOfResources(Integer numberOfResources) {
this.numberOfResources = numberOfResources;
return this;
}
/**
* Get the rawErrors property: Gets or sets the unparsed errors for the node report.
*
* @return the rawErrors value.
*/
public String rawErrors() {
return this.rawErrors;
}
/**
* Set the rawErrors property: Gets or sets the unparsed errors for the node report.
*
* @param rawErrors the rawErrors value to set.
* @return the DscNodeReportInner object itself.
*/
public DscNodeReportInner withRawErrors(String rawErrors) {
this.rawErrors = rawErrors;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (errors() != null) {
errors().forEach(e -> e.validate());
}
if (resources() != null) {
resources().forEach(e -> e.validate());
}
if (metaConfiguration() != null) {
metaConfiguration().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("endTime",
this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime));
jsonWriter.writeStringField("lastModifiedTime",
this.lastModifiedTime == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedTime));
jsonWriter.writeStringField("startTime",
this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime));
jsonWriter.writeStringField("type", this.type);
jsonWriter.writeStringField("reportId", this.reportId);
jsonWriter.writeStringField("status", this.status);
jsonWriter.writeStringField("refreshMode", this.refreshMode);
jsonWriter.writeStringField("rebootRequested", this.rebootRequested);
jsonWriter.writeStringField("reportFormatVersion", this.reportFormatVersion);
jsonWriter.writeStringField("configurationVersion", this.configurationVersion);
jsonWriter.writeStringField("id", this.id);
jsonWriter.writeArrayField("errors", this.errors, (writer, element) -> writer.writeJson(element));
jsonWriter.writeArrayField("resources", this.resources, (writer, element) -> writer.writeJson(element));
jsonWriter.writeJsonField("metaConfiguration", this.metaConfiguration);
jsonWriter.writeStringField("hostName", this.hostname);
jsonWriter.writeArrayField("iPV4Addresses", this.iPV4Addresses,
(writer, element) -> writer.writeString(element));
jsonWriter.writeArrayField("iPV6Addresses", this.iPV6Addresses,
(writer, element) -> writer.writeString(element));
jsonWriter.writeNumberField("numberOfResources", this.numberOfResources);
jsonWriter.writeStringField("rawErrors", this.rawErrors);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DscNodeReportInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DscNodeReportInner 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 DscNodeReportInner.
*/
public static DscNodeReportInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DscNodeReportInner deserializedDscNodeReportInner = new DscNodeReportInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("endTime".equals(fieldName)) {
deserializedDscNodeReportInner.endTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("lastModifiedTime".equals(fieldName)) {
deserializedDscNodeReportInner.lastModifiedTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("startTime".equals(fieldName)) {
deserializedDscNodeReportInner.startTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("type".equals(fieldName)) {
deserializedDscNodeReportInner.type = reader.getString();
} else if ("reportId".equals(fieldName)) {
deserializedDscNodeReportInner.reportId = reader.getString();
} else if ("status".equals(fieldName)) {
deserializedDscNodeReportInner.status = reader.getString();
} else if ("refreshMode".equals(fieldName)) {
deserializedDscNodeReportInner.refreshMode = reader.getString();
} else if ("rebootRequested".equals(fieldName)) {
deserializedDscNodeReportInner.rebootRequested = reader.getString();
} else if ("reportFormatVersion".equals(fieldName)) {
deserializedDscNodeReportInner.reportFormatVersion = reader.getString();
} else if ("configurationVersion".equals(fieldName)) {
deserializedDscNodeReportInner.configurationVersion = reader.getString();
} else if ("id".equals(fieldName)) {
deserializedDscNodeReportInner.id = reader.getString();
} else if ("errors".equals(fieldName)) {
List errors = reader.readArray(reader1 -> DscReportError.fromJson(reader1));
deserializedDscNodeReportInner.errors = errors;
} else if ("resources".equals(fieldName)) {
List resources
= reader.readArray(reader1 -> DscReportResource.fromJson(reader1));
deserializedDscNodeReportInner.resources = resources;
} else if ("metaConfiguration".equals(fieldName)) {
deserializedDscNodeReportInner.metaConfiguration = DscMetaConfiguration.fromJson(reader);
} else if ("hostName".equals(fieldName)) {
deserializedDscNodeReportInner.hostname = reader.getString();
} else if ("iPV4Addresses".equals(fieldName)) {
List iPV4Addresses = reader.readArray(reader1 -> reader1.getString());
deserializedDscNodeReportInner.iPV4Addresses = iPV4Addresses;
} else if ("iPV6Addresses".equals(fieldName)) {
List iPV6Addresses = reader.readArray(reader1 -> reader1.getString());
deserializedDscNodeReportInner.iPV6Addresses = iPV6Addresses;
} else if ("numberOfResources".equals(fieldName)) {
deserializedDscNodeReportInner.numberOfResources = reader.getNullable(JsonReader::getInt);
} else if ("rawErrors".equals(fieldName)) {
deserializedDscNodeReportInner.rawErrors = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedDscNodeReportInner;
});
}
}