com.azure.resourcemanager.azurestackhci.fluent.models.SkuProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-azurestackhci Show documentation
Show all versions of azure-resourcemanager-azurestackhci Show documentation
This package contains Microsoft Azure SDK for AzureStackHci Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management service. Package tag package-2024-04.
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.azurestackhci.fluent.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 com.azure.resourcemanager.azurestackhci.models.SkuMappings;
import java.io.IOException;
import java.util.List;
/**
* SKU properties.
*/
@Fluent
public final class SkuProperties implements JsonSerializable {
/*
* Provisioning State
*/
private String provisioningState;
/*
* Identifier of the Publisher for the offer
*/
private String publisherId;
/*
* Identifier of the Offer for the sku
*/
private String offerId;
/*
* JSON serialized catalog content of the sku offer
*/
private String content;
/*
* The API version of the catalog service used to serve the catalog content
*/
private String contentVersion;
/*
* Array of SKU mappings
*/
private List skuMappings;
/**
* Creates an instance of SkuProperties class.
*/
public SkuProperties() {
}
/**
* Get the provisioningState property: Provisioning State.
*
* @return the provisioningState value.
*/
public String provisioningState() {
return this.provisioningState;
}
/**
* Get the publisherId property: Identifier of the Publisher for the offer.
*
* @return the publisherId value.
*/
public String publisherId() {
return this.publisherId;
}
/**
* Set the publisherId property: Identifier of the Publisher for the offer.
*
* @param publisherId the publisherId value to set.
* @return the SkuProperties object itself.
*/
public SkuProperties withPublisherId(String publisherId) {
this.publisherId = publisherId;
return this;
}
/**
* Get the offerId property: Identifier of the Offer for the sku.
*
* @return the offerId value.
*/
public String offerId() {
return this.offerId;
}
/**
* Set the offerId property: Identifier of the Offer for the sku.
*
* @param offerId the offerId value to set.
* @return the SkuProperties object itself.
*/
public SkuProperties withOfferId(String offerId) {
this.offerId = offerId;
return this;
}
/**
* Get the content property: JSON serialized catalog content of the sku offer.
*
* @return the content value.
*/
public String content() {
return this.content;
}
/**
* Set the content property: JSON serialized catalog content of the sku offer.
*
* @param content the content value to set.
* @return the SkuProperties object itself.
*/
public SkuProperties withContent(String content) {
this.content = content;
return this;
}
/**
* Get the contentVersion property: The API version of the catalog service used to serve the catalog content.
*
* @return the contentVersion value.
*/
public String contentVersion() {
return this.contentVersion;
}
/**
* Set the contentVersion property: The API version of the catalog service used to serve the catalog content.
*
* @param contentVersion the contentVersion value to set.
* @return the SkuProperties object itself.
*/
public SkuProperties withContentVersion(String contentVersion) {
this.contentVersion = contentVersion;
return this;
}
/**
* Get the skuMappings property: Array of SKU mappings.
*
* @return the skuMappings value.
*/
public List skuMappings() {
return this.skuMappings;
}
/**
* Set the skuMappings property: Array of SKU mappings.
*
* @param skuMappings the skuMappings value to set.
* @return the SkuProperties object itself.
*/
public SkuProperties withSkuMappings(List skuMappings) {
this.skuMappings = skuMappings;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (skuMappings() != null) {
skuMappings().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("publisherId", this.publisherId);
jsonWriter.writeStringField("offerId", this.offerId);
jsonWriter.writeStringField("content", this.content);
jsonWriter.writeStringField("contentVersion", this.contentVersion);
jsonWriter.writeArrayField("skuMappings", this.skuMappings, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SkuProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SkuProperties 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 SkuProperties.
*/
public static SkuProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SkuProperties deserializedSkuProperties = new SkuProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("provisioningState".equals(fieldName)) {
deserializedSkuProperties.provisioningState = reader.getString();
} else if ("publisherId".equals(fieldName)) {
deserializedSkuProperties.publisherId = reader.getString();
} else if ("offerId".equals(fieldName)) {
deserializedSkuProperties.offerId = reader.getString();
} else if ("content".equals(fieldName)) {
deserializedSkuProperties.content = reader.getString();
} else if ("contentVersion".equals(fieldName)) {
deserializedSkuProperties.contentVersion = reader.getString();
} else if ("skuMappings".equals(fieldName)) {
List skuMappings = reader.readArray(reader1 -> SkuMappings.fromJson(reader1));
deserializedSkuProperties.skuMappings = skuMappings;
} else {
reader.skipChildren();
}
}
return deserializedSkuProperties;
});
}
}