com.azure.resourcemanager.automation.fluent.models.SoftwareUpdateConfigurationProperties 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.management.exception.ManagementError;
import com.azure.core.util.CoreUtils;
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 com.azure.resourcemanager.automation.models.SoftwareUpdateConfigurationTasks;
import com.azure.resourcemanager.automation.models.SucScheduleProperties;
import com.azure.resourcemanager.automation.models.UpdateConfiguration;
import java.io.IOException;
import java.time.OffsetDateTime;
/**
* Software update configuration properties.
*/
@Fluent
public final class SoftwareUpdateConfigurationProperties
implements JsonSerializable {
/*
* update specific properties for the Software update configuration
*/
private UpdateConfiguration updateConfiguration;
/*
* Schedule information for the Software update configuration
*/
private SucScheduleProperties scheduleInfo;
/*
* Provisioning state for the software update configuration, which only appears in the response.
*/
private String provisioningState;
/*
* Details of provisioning error
*/
private ManagementError error;
/*
* Creation time of the resource, which only appears in the response.
*/
private OffsetDateTime creationTime;
/*
* CreatedBy property, which only appears in the response.
*/
private String createdBy;
/*
* Last time resource was modified, which only appears in the response.
*/
private OffsetDateTime lastModifiedTime;
/*
* LastModifiedBy property, which only appears in the response.
*/
private String lastModifiedBy;
/*
* Tasks information for the Software update configuration.
*/
private SoftwareUpdateConfigurationTasks tasks;
/**
* Creates an instance of SoftwareUpdateConfigurationProperties class.
*/
public SoftwareUpdateConfigurationProperties() {
}
/**
* Get the updateConfiguration property: update specific properties for the Software update configuration.
*
* @return the updateConfiguration value.
*/
public UpdateConfiguration updateConfiguration() {
return this.updateConfiguration;
}
/**
* Set the updateConfiguration property: update specific properties for the Software update configuration.
*
* @param updateConfiguration the updateConfiguration value to set.
* @return the SoftwareUpdateConfigurationProperties object itself.
*/
public SoftwareUpdateConfigurationProperties withUpdateConfiguration(UpdateConfiguration updateConfiguration) {
this.updateConfiguration = updateConfiguration;
return this;
}
/**
* Get the scheduleInfo property: Schedule information for the Software update configuration.
*
* @return the scheduleInfo value.
*/
public SucScheduleProperties scheduleInfo() {
return this.scheduleInfo;
}
/**
* Set the scheduleInfo property: Schedule information for the Software update configuration.
*
* @param scheduleInfo the scheduleInfo value to set.
* @return the SoftwareUpdateConfigurationProperties object itself.
*/
public SoftwareUpdateConfigurationProperties withScheduleInfo(SucScheduleProperties scheduleInfo) {
this.scheduleInfo = scheduleInfo;
return this;
}
/**
* Get the provisioningState property: Provisioning state for the software update configuration, which only appears
* in the response.
*
* @return the provisioningState value.
*/
public String provisioningState() {
return this.provisioningState;
}
/**
* Get the error property: Details of provisioning error.
*
* @return the error value.
*/
public ManagementError error() {
return this.error;
}
/**
* Set the error property: Details of provisioning error.
*
* @param error the error value to set.
* @return the SoftwareUpdateConfigurationProperties object itself.
*/
public SoftwareUpdateConfigurationProperties withError(ManagementError error) {
this.error = error;
return this;
}
/**
* Get the creationTime property: Creation time of the resource, which only appears in the response.
*
* @return the creationTime value.
*/
public OffsetDateTime creationTime() {
return this.creationTime;
}
/**
* Get the createdBy property: CreatedBy property, which only appears in the response.
*
* @return the createdBy value.
*/
public String createdBy() {
return this.createdBy;
}
/**
* Get the lastModifiedTime property: Last time resource was modified, which only appears in the response.
*
* @return the lastModifiedTime value.
*/
public OffsetDateTime lastModifiedTime() {
return this.lastModifiedTime;
}
/**
* Get the lastModifiedBy property: LastModifiedBy property, which only appears in the response.
*
* @return the lastModifiedBy value.
*/
public String lastModifiedBy() {
return this.lastModifiedBy;
}
/**
* Get the tasks property: Tasks information for the Software update configuration.
*
* @return the tasks value.
*/
public SoftwareUpdateConfigurationTasks tasks() {
return this.tasks;
}
/**
* Set the tasks property: Tasks information for the Software update configuration.
*
* @param tasks the tasks value to set.
* @return the SoftwareUpdateConfigurationProperties object itself.
*/
public SoftwareUpdateConfigurationProperties withTasks(SoftwareUpdateConfigurationTasks tasks) {
this.tasks = tasks;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (updateConfiguration() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property updateConfiguration in model SoftwareUpdateConfigurationProperties"));
} else {
updateConfiguration().validate();
}
if (scheduleInfo() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property scheduleInfo in model SoftwareUpdateConfigurationProperties"));
} else {
scheduleInfo().validate();
}
if (tasks() != null) {
tasks().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(SoftwareUpdateConfigurationProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("updateConfiguration", this.updateConfiguration);
jsonWriter.writeJsonField("scheduleInfo", this.scheduleInfo);
jsonWriter.writeJsonField("error", this.error);
jsonWriter.writeJsonField("tasks", this.tasks);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SoftwareUpdateConfigurationProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SoftwareUpdateConfigurationProperties 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 SoftwareUpdateConfigurationProperties.
*/
public static SoftwareUpdateConfigurationProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SoftwareUpdateConfigurationProperties deserializedSoftwareUpdateConfigurationProperties
= new SoftwareUpdateConfigurationProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("updateConfiguration".equals(fieldName)) {
deserializedSoftwareUpdateConfigurationProperties.updateConfiguration
= UpdateConfiguration.fromJson(reader);
} else if ("scheduleInfo".equals(fieldName)) {
deserializedSoftwareUpdateConfigurationProperties.scheduleInfo
= SucScheduleProperties.fromJson(reader);
} else if ("provisioningState".equals(fieldName)) {
deserializedSoftwareUpdateConfigurationProperties.provisioningState = reader.getString();
} else if ("error".equals(fieldName)) {
deserializedSoftwareUpdateConfigurationProperties.error = ManagementError.fromJson(reader);
} else if ("creationTime".equals(fieldName)) {
deserializedSoftwareUpdateConfigurationProperties.creationTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("createdBy".equals(fieldName)) {
deserializedSoftwareUpdateConfigurationProperties.createdBy = reader.getString();
} else if ("lastModifiedTime".equals(fieldName)) {
deserializedSoftwareUpdateConfigurationProperties.lastModifiedTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("lastModifiedBy".equals(fieldName)) {
deserializedSoftwareUpdateConfigurationProperties.lastModifiedBy = reader.getString();
} else if ("tasks".equals(fieldName)) {
deserializedSoftwareUpdateConfigurationProperties.tasks
= SoftwareUpdateConfigurationTasks.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedSoftwareUpdateConfigurationProperties;
});
}
}