com.azure.resourcemanager.hybridcompute.models.LicenseUpdate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hybridcompute Show documentation
Show all versions of azure-resourcemanager-hybridcompute Show documentation
This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-05.
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.hybridcompute.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.hybridcompute.fluent.models.LicenseUpdateProperties;
import java.io.IOException;
import java.util.Map;
/**
* Describes a License Update.
*/
@Fluent
public final class LicenseUpdate extends ResourceUpdate {
/*
* License Update properties
*/
private LicenseUpdateProperties innerProperties;
/**
* Creates an instance of LicenseUpdate class.
*/
public LicenseUpdate() {
}
/**
* Get the innerProperties property: License Update properties.
*
* @return the innerProperties value.
*/
private LicenseUpdateProperties innerProperties() {
return this.innerProperties;
}
/**
* {@inheritDoc}
*/
@Override
public LicenseUpdate withTags(Map tags) {
super.withTags(tags);
return this;
}
/**
* Get the licenseType property: The type of the license resource.
*
* @return the licenseType value.
*/
public LicenseType licenseType() {
return this.innerProperties() == null ? null : this.innerProperties().licenseType();
}
/**
* Set the licenseType property: The type of the license resource.
*
* @param licenseType the licenseType value to set.
* @return the LicenseUpdate object itself.
*/
public LicenseUpdate withLicenseType(LicenseType licenseType) {
if (this.innerProperties() == null) {
this.innerProperties = new LicenseUpdateProperties();
}
this.innerProperties().withLicenseType(licenseType);
return this;
}
/**
* Get the state property: Describes the state of the license.
*
* @return the state value.
*/
public LicenseState state() {
return this.innerProperties() == null ? null : this.innerProperties().state();
}
/**
* Set the state property: Describes the state of the license.
*
* @param state the state value to set.
* @return the LicenseUpdate object itself.
*/
public LicenseUpdate withState(LicenseState state) {
if (this.innerProperties() == null) {
this.innerProperties = new LicenseUpdateProperties();
}
this.innerProperties().withState(state);
return this;
}
/**
* Get the target property: Describes the license target server.
*
* @return the target value.
*/
public LicenseTarget target() {
return this.innerProperties() == null ? null : this.innerProperties().target();
}
/**
* Set the target property: Describes the license target server.
*
* @param target the target value to set.
* @return the LicenseUpdate object itself.
*/
public LicenseUpdate withTarget(LicenseTarget target) {
if (this.innerProperties() == null) {
this.innerProperties = new LicenseUpdateProperties();
}
this.innerProperties().withTarget(target);
return this;
}
/**
* Get the edition property: Describes the edition of the license. The values are either Standard or Datacenter.
*
* @return the edition value.
*/
public LicenseEdition edition() {
return this.innerProperties() == null ? null : this.innerProperties().edition();
}
/**
* Set the edition property: Describes the edition of the license. The values are either Standard or Datacenter.
*
* @param edition the edition value to set.
* @return the LicenseUpdate object itself.
*/
public LicenseUpdate withEdition(LicenseEdition edition) {
if (this.innerProperties() == null) {
this.innerProperties = new LicenseUpdateProperties();
}
this.innerProperties().withEdition(edition);
return this;
}
/**
* Get the type property: Describes the license core type (pCore or vCore).
*
* @return the type value.
*/
public LicenseCoreType type() {
return this.innerProperties() == null ? null : this.innerProperties().type();
}
/**
* Set the type property: Describes the license core type (pCore or vCore).
*
* @param type the type value to set.
* @return the LicenseUpdate object itself.
*/
public LicenseUpdate withType(LicenseCoreType type) {
if (this.innerProperties() == null) {
this.innerProperties = new LicenseUpdateProperties();
}
this.innerProperties().withType(type);
return this;
}
/**
* Get the processors property: Describes the number of processors.
*
* @return the processors value.
*/
public Integer processors() {
return this.innerProperties() == null ? null : this.innerProperties().processors();
}
/**
* Set the processors property: Describes the number of processors.
*
* @param processors the processors value to set.
* @return the LicenseUpdate object itself.
*/
public LicenseUpdate withProcessors(Integer processors) {
if (this.innerProperties() == null) {
this.innerProperties = new LicenseUpdateProperties();
}
this.innerProperties().withProcessors(processors);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of LicenseUpdate from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of LicenseUpdate 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 LicenseUpdate.
*/
public static LicenseUpdate fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
LicenseUpdate deserializedLicenseUpdate = new LicenseUpdate();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedLicenseUpdate.withTags(tags);
} else if ("properties".equals(fieldName)) {
deserializedLicenseUpdate.innerProperties = LicenseUpdateProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedLicenseUpdate;
});
}
}