com.azure.resourcemanager.hybridcompute.models.ProductFeature 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.core.management.exception.ManagementError;
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 java.io.IOException;
import java.time.OffsetDateTime;
/**
* Product Feature.
*/
@Fluent
public final class ProductFeature implements JsonSerializable {
/*
* Product feature name.
*/
private String name;
/*
* Indicates the current status of the product features.
*/
private LicenseProfileSubscriptionStatus subscriptionStatus;
/*
* The timestamp in UTC when the user enrolls the feature.
*/
private OffsetDateTime enrollmentDate;
/*
* The timestamp in UTC when the billing starts.
*/
private OffsetDateTime billingStartDate;
/*
* The timestamp in UTC when the user disenrolled the feature.
*/
private OffsetDateTime disenrollmentDate;
/*
* The timestamp in UTC when the billing ends.
*/
private OffsetDateTime billingEndDate;
/*
* The errors that were encountered during the feature enrollment or disenrollment.
*/
private ManagementError error;
/**
* Creates an instance of ProductFeature class.
*/
public ProductFeature() {
}
/**
* Get the name property: Product feature name.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Product feature name.
*
* @param name the name value to set.
* @return the ProductFeature object itself.
*/
public ProductFeature withName(String name) {
this.name = name;
return this;
}
/**
* Get the subscriptionStatus property: Indicates the current status of the product features.
*
* @return the subscriptionStatus value.
*/
public LicenseProfileSubscriptionStatus subscriptionStatus() {
return this.subscriptionStatus;
}
/**
* Set the subscriptionStatus property: Indicates the current status of the product features.
*
* @param subscriptionStatus the subscriptionStatus value to set.
* @return the ProductFeature object itself.
*/
public ProductFeature withSubscriptionStatus(LicenseProfileSubscriptionStatus subscriptionStatus) {
this.subscriptionStatus = subscriptionStatus;
return this;
}
/**
* Get the enrollmentDate property: The timestamp in UTC when the user enrolls the feature.
*
* @return the enrollmentDate value.
*/
public OffsetDateTime enrollmentDate() {
return this.enrollmentDate;
}
/**
* Get the billingStartDate property: The timestamp in UTC when the billing starts.
*
* @return the billingStartDate value.
*/
public OffsetDateTime billingStartDate() {
return this.billingStartDate;
}
/**
* Get the disenrollmentDate property: The timestamp in UTC when the user disenrolled the feature.
*
* @return the disenrollmentDate value.
*/
public OffsetDateTime disenrollmentDate() {
return this.disenrollmentDate;
}
/**
* Get the billingEndDate property: The timestamp in UTC when the billing ends.
*
* @return the billingEndDate value.
*/
public OffsetDateTime billingEndDate() {
return this.billingEndDate;
}
/**
* Get the error property: The errors that were encountered during the feature enrollment or disenrollment.
*
* @return the error value.
*/
public ManagementError error() {
return this.error;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeStringField("subscriptionStatus",
this.subscriptionStatus == null ? null : this.subscriptionStatus.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ProductFeature from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ProductFeature 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 ProductFeature.
*/
public static ProductFeature fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ProductFeature deserializedProductFeature = new ProductFeature();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedProductFeature.name = reader.getString();
} else if ("subscriptionStatus".equals(fieldName)) {
deserializedProductFeature.subscriptionStatus
= LicenseProfileSubscriptionStatus.fromString(reader.getString());
} else if ("enrollmentDate".equals(fieldName)) {
deserializedProductFeature.enrollmentDate = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("billingStartDate".equals(fieldName)) {
deserializedProductFeature.billingStartDate = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("disenrollmentDate".equals(fieldName)) {
deserializedProductFeature.disenrollmentDate = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("billingEndDate".equals(fieldName)) {
deserializedProductFeature.billingEndDate = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("error".equals(fieldName)) {
deserializedProductFeature.error = ManagementError.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedProductFeature;
});
}
}