All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.advisor.fluent.models.RecommendationProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Advisor Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST APIs for Azure Advisor. Package tag package-2020-01.

There is a newer version: 1.0.0
Show 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.advisor.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.advisor.models.Category;
import com.azure.resourcemanager.advisor.models.Impact;
import com.azure.resourcemanager.advisor.models.ResourceMetadata;
import com.azure.resourcemanager.advisor.models.ShortDescription;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;

/**
 * The properties of the recommendation.
 */
@Fluent
public final class RecommendationProperties implements JsonSerializable {
    /*
     * The category of the recommendation.
     */
    private Category category;

    /*
     * The business impact of the recommendation.
     */
    private Impact impact;

    /*
     * The resource type identified by Advisor.
     */
    private String impactedField;

    /*
     * The resource identified by Advisor.
     */
    private String impactedValue;

    /*
     * The most recent time that Advisor checked the validity of the recommendation.
     */
    private OffsetDateTime lastUpdated;

    /*
     * The recommendation metadata.
     */
    private Map metadata;

    /*
     * The recommendation-type GUID.
     */
    private String recommendationTypeId;

    /*
     * A summary of the recommendation.
     */
    private ShortDescription shortDescription;

    /*
     * The list of snoozed and dismissed rules for the recommendation.
     */
    private List suppressionIds;

    /*
     * Extended properties
     */
    private Map extendedProperties;

    /*
     * Metadata of resource that was assessed
     */
    private ResourceMetadata resourceMetadata;

    /*
     * The detailed description of recommendation.
     */
    private String description;

    /*
     * The label of recommendation.
     */
    private String label;

    /*
     * The link to learn more about recommendation and generation logic.
     */
    private String learnMoreLink;

    /*
     * The potential benefit of implementing recommendation.
     */
    private String potentialBenefits;

    /*
     * The list of recommended actions to implement recommendation.
     */
    private List> actions;

    /*
     * The automated way to apply recommendation.
     */
    private Map remediation;

    /*
     * The recommendation metadata properties exposed to customer to provide additional information.
     */
    private Map exposedMetadataProperties;

    /**
     * Creates an instance of RecommendationProperties class.
     */
    public RecommendationProperties() {
    }

    /**
     * Get the category property: The category of the recommendation.
     * 
     * @return the category value.
     */
    public Category category() {
        return this.category;
    }

    /**
     * Set the category property: The category of the recommendation.
     * 
     * @param category the category value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withCategory(Category category) {
        this.category = category;
        return this;
    }

    /**
     * Get the impact property: The business impact of the recommendation.
     * 
     * @return the impact value.
     */
    public Impact impact() {
        return this.impact;
    }

    /**
     * Set the impact property: The business impact of the recommendation.
     * 
     * @param impact the impact value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withImpact(Impact impact) {
        this.impact = impact;
        return this;
    }

    /**
     * Get the impactedField property: The resource type identified by Advisor.
     * 
     * @return the impactedField value.
     */
    public String impactedField() {
        return this.impactedField;
    }

    /**
     * Set the impactedField property: The resource type identified by Advisor.
     * 
     * @param impactedField the impactedField value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withImpactedField(String impactedField) {
        this.impactedField = impactedField;
        return this;
    }

    /**
     * Get the impactedValue property: The resource identified by Advisor.
     * 
     * @return the impactedValue value.
     */
    public String impactedValue() {
        return this.impactedValue;
    }

    /**
     * Set the impactedValue property: The resource identified by Advisor.
     * 
     * @param impactedValue the impactedValue value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withImpactedValue(String impactedValue) {
        this.impactedValue = impactedValue;
        return this;
    }

    /**
     * Get the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation.
     * 
     * @return the lastUpdated value.
     */
    public OffsetDateTime lastUpdated() {
        return this.lastUpdated;
    }

    /**
     * Set the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation.
     * 
     * @param lastUpdated the lastUpdated value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withLastUpdated(OffsetDateTime lastUpdated) {
        this.lastUpdated = lastUpdated;
        return this;
    }

    /**
     * Get the metadata property: The recommendation metadata.
     * 
     * @return the metadata value.
     */
    public Map metadata() {
        return this.metadata;
    }

    /**
     * Set the metadata property: The recommendation metadata.
     * 
     * @param metadata the metadata value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withMetadata(Map metadata) {
        this.metadata = metadata;
        return this;
    }

    /**
     * Get the recommendationTypeId property: The recommendation-type GUID.
     * 
     * @return the recommendationTypeId value.
     */
    public String recommendationTypeId() {
        return this.recommendationTypeId;
    }

    /**
     * Set the recommendationTypeId property: The recommendation-type GUID.
     * 
     * @param recommendationTypeId the recommendationTypeId value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withRecommendationTypeId(String recommendationTypeId) {
        this.recommendationTypeId = recommendationTypeId;
        return this;
    }

    /**
     * Get the shortDescription property: A summary of the recommendation.
     * 
     * @return the shortDescription value.
     */
    public ShortDescription shortDescription() {
        return this.shortDescription;
    }

    /**
     * Set the shortDescription property: A summary of the recommendation.
     * 
     * @param shortDescription the shortDescription value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withShortDescription(ShortDescription shortDescription) {
        this.shortDescription = shortDescription;
        return this;
    }

    /**
     * Get the suppressionIds property: The list of snoozed and dismissed rules for the recommendation.
     * 
     * @return the suppressionIds value.
     */
    public List suppressionIds() {
        return this.suppressionIds;
    }

    /**
     * Set the suppressionIds property: The list of snoozed and dismissed rules for the recommendation.
     * 
     * @param suppressionIds the suppressionIds value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withSuppressionIds(List suppressionIds) {
        this.suppressionIds = suppressionIds;
        return this;
    }

    /**
     * Get the extendedProperties property: Extended properties.
     * 
     * @return the extendedProperties value.
     */
    public Map extendedProperties() {
        return this.extendedProperties;
    }

    /**
     * Set the extendedProperties property: Extended properties.
     * 
     * @param extendedProperties the extendedProperties value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withExtendedProperties(Map extendedProperties) {
        this.extendedProperties = extendedProperties;
        return this;
    }

    /**
     * Get the resourceMetadata property: Metadata of resource that was assessed.
     * 
     * @return the resourceMetadata value.
     */
    public ResourceMetadata resourceMetadata() {
        return this.resourceMetadata;
    }

    /**
     * Set the resourceMetadata property: Metadata of resource that was assessed.
     * 
     * @param resourceMetadata the resourceMetadata value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withResourceMetadata(ResourceMetadata resourceMetadata) {
        this.resourceMetadata = resourceMetadata;
        return this;
    }

    /**
     * Get the description property: The detailed description of recommendation.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: The detailed description of recommendation.
     * 
     * @param description the description value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the label property: The label of recommendation.
     * 
     * @return the label value.
     */
    public String label() {
        return this.label;
    }

    /**
     * Set the label property: The label of recommendation.
     * 
     * @param label the label value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withLabel(String label) {
        this.label = label;
        return this;
    }

    /**
     * Get the learnMoreLink property: The link to learn more about recommendation and generation logic.
     * 
     * @return the learnMoreLink value.
     */
    public String learnMoreLink() {
        return this.learnMoreLink;
    }

    /**
     * Set the learnMoreLink property: The link to learn more about recommendation and generation logic.
     * 
     * @param learnMoreLink the learnMoreLink value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withLearnMoreLink(String learnMoreLink) {
        this.learnMoreLink = learnMoreLink;
        return this;
    }

    /**
     * Get the potentialBenefits property: The potential benefit of implementing recommendation.
     * 
     * @return the potentialBenefits value.
     */
    public String potentialBenefits() {
        return this.potentialBenefits;
    }

    /**
     * Set the potentialBenefits property: The potential benefit of implementing recommendation.
     * 
     * @param potentialBenefits the potentialBenefits value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withPotentialBenefits(String potentialBenefits) {
        this.potentialBenefits = potentialBenefits;
        return this;
    }

    /**
     * Get the actions property: The list of recommended actions to implement recommendation.
     * 
     * @return the actions value.
     */
    public List> actions() {
        return this.actions;
    }

    /**
     * Set the actions property: The list of recommended actions to implement recommendation.
     * 
     * @param actions the actions value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withActions(List> actions) {
        this.actions = actions;
        return this;
    }

    /**
     * Get the remediation property: The automated way to apply recommendation.
     * 
     * @return the remediation value.
     */
    public Map remediation() {
        return this.remediation;
    }

    /**
     * Set the remediation property: The automated way to apply recommendation.
     * 
     * @param remediation the remediation value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withRemediation(Map remediation) {
        this.remediation = remediation;
        return this;
    }

    /**
     * Get the exposedMetadataProperties property: The recommendation metadata properties exposed to customer to provide
     * additional information.
     * 
     * @return the exposedMetadataProperties value.
     */
    public Map exposedMetadataProperties() {
        return this.exposedMetadataProperties;
    }

    /**
     * Set the exposedMetadataProperties property: The recommendation metadata properties exposed to customer to provide
     * additional information.
     * 
     * @param exposedMetadataProperties the exposedMetadataProperties value to set.
     * @return the RecommendationProperties object itself.
     */
    public RecommendationProperties withExposedMetadataProperties(Map exposedMetadataProperties) {
        this.exposedMetadataProperties = exposedMetadataProperties;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (shortDescription() != null) {
            shortDescription().validate();
        }
        if (resourceMetadata() != null) {
            resourceMetadata().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("category", this.category == null ? null : this.category.toString());
        jsonWriter.writeStringField("impact", this.impact == null ? null : this.impact.toString());
        jsonWriter.writeStringField("impactedField", this.impactedField);
        jsonWriter.writeStringField("impactedValue", this.impactedValue);
        jsonWriter.writeStringField("lastUpdated",
            this.lastUpdated == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdated));
        jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeUntyped(element));
        jsonWriter.writeStringField("recommendationTypeId", this.recommendationTypeId);
        jsonWriter.writeJsonField("shortDescription", this.shortDescription);
        jsonWriter.writeArrayField("suppressionIds", this.suppressionIds,
            (writer, element) -> writer.writeString(Objects.toString(element, null)));
        jsonWriter.writeMapField("extendedProperties", this.extendedProperties,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("resourceMetadata", this.resourceMetadata);
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeStringField("label", this.label);
        jsonWriter.writeStringField("learnMoreLink", this.learnMoreLink);
        jsonWriter.writeStringField("potentialBenefits", this.potentialBenefits);
        jsonWriter.writeArrayField("actions", this.actions,
            (writer, element) -> writer.writeMap(element, (writer1, element1) -> writer1.writeUntyped(element1)));
        jsonWriter.writeMapField("remediation", this.remediation, (writer, element) -> writer.writeUntyped(element));
        jsonWriter.writeMapField("exposedMetadataProperties", this.exposedMetadataProperties,
            (writer, element) -> writer.writeUntyped(element));
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of RecommendationProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of RecommendationProperties 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 RecommendationProperties.
     */
    public static RecommendationProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            RecommendationProperties deserializedRecommendationProperties = new RecommendationProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("category".equals(fieldName)) {
                    deserializedRecommendationProperties.category = Category.fromString(reader.getString());
                } else if ("impact".equals(fieldName)) {
                    deserializedRecommendationProperties.impact = Impact.fromString(reader.getString());
                } else if ("impactedField".equals(fieldName)) {
                    deserializedRecommendationProperties.impactedField = reader.getString();
                } else if ("impactedValue".equals(fieldName)) {
                    deserializedRecommendationProperties.impactedValue = reader.getString();
                } else if ("lastUpdated".equals(fieldName)) {
                    deserializedRecommendationProperties.lastUpdated = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("metadata".equals(fieldName)) {
                    Map metadata = reader.readMap(reader1 -> reader1.readUntyped());
                    deserializedRecommendationProperties.metadata = metadata;
                } else if ("recommendationTypeId".equals(fieldName)) {
                    deserializedRecommendationProperties.recommendationTypeId = reader.getString();
                } else if ("shortDescription".equals(fieldName)) {
                    deserializedRecommendationProperties.shortDescription = ShortDescription.fromJson(reader);
                } else if ("suppressionIds".equals(fieldName)) {
                    List suppressionIds = reader.readArray(
                        reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())));
                    deserializedRecommendationProperties.suppressionIds = suppressionIds;
                } else if ("extendedProperties".equals(fieldName)) {
                    Map extendedProperties = reader.readMap(reader1 -> reader1.getString());
                    deserializedRecommendationProperties.extendedProperties = extendedProperties;
                } else if ("resourceMetadata".equals(fieldName)) {
                    deserializedRecommendationProperties.resourceMetadata = ResourceMetadata.fromJson(reader);
                } else if ("description".equals(fieldName)) {
                    deserializedRecommendationProperties.description = reader.getString();
                } else if ("label".equals(fieldName)) {
                    deserializedRecommendationProperties.label = reader.getString();
                } else if ("learnMoreLink".equals(fieldName)) {
                    deserializedRecommendationProperties.learnMoreLink = reader.getString();
                } else if ("potentialBenefits".equals(fieldName)) {
                    deserializedRecommendationProperties.potentialBenefits = reader.getString();
                } else if ("actions".equals(fieldName)) {
                    List> actions
                        = reader.readArray(reader1 -> reader1.readMap(reader2 -> reader2.readUntyped()));
                    deserializedRecommendationProperties.actions = actions;
                } else if ("remediation".equals(fieldName)) {
                    Map remediation = reader.readMap(reader1 -> reader1.readUntyped());
                    deserializedRecommendationProperties.remediation = remediation;
                } else if ("exposedMetadataProperties".equals(fieldName)) {
                    Map exposedMetadataProperties = reader.readMap(reader1 -> reader1.readUntyped());
                    deserializedRecommendationProperties.exposedMetadataProperties = exposedMetadataProperties;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRecommendationProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy