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

com.azure.resourcemanager.security.models.Issue Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.

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.security.models;

import com.azure.core.annotation.Fluent;
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 java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * The issue that caused the resource to by unhealthy.
 */
@Fluent
public final class Issue implements JsonSerializable {
    /*
     * The unique issue key
     */
    private String issueKey;

    /*
     * The issue name
     */
    private String issueName;

    /*
     * The affected security values that MDC offers that will be affected by the issue, for example: recommendations,
     * alerts, etc
     */
    private List securityValues;

    /*
     * The issue description
     */
    private String issueDescription;

    /*
     * Human readable description of what you should do to mitigate this health issue
     */
    private String remediationSteps;

    /*
     * The remediation script to solve this issue
     */
    private String remediationScript;

    /*
     * Additional data for the given issue. The additional data depends on the issue type
     */
    private Map issueAdditionalData;

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

    /**
     * Get the issueKey property: The unique issue key.
     * 
     * @return the issueKey value.
     */
    public String issueKey() {
        return this.issueKey;
    }

    /**
     * Set the issueKey property: The unique issue key.
     * 
     * @param issueKey the issueKey value to set.
     * @return the Issue object itself.
     */
    public Issue withIssueKey(String issueKey) {
        this.issueKey = issueKey;
        return this;
    }

    /**
     * Get the issueName property: The issue name.
     * 
     * @return the issueName value.
     */
    public String issueName() {
        return this.issueName;
    }

    /**
     * Set the issueName property: The issue name.
     * 
     * @param issueName the issueName value to set.
     * @return the Issue object itself.
     */
    public Issue withIssueName(String issueName) {
        this.issueName = issueName;
        return this;
    }

    /**
     * Get the securityValues property: The affected security values that MDC offers that will be affected by the issue,
     * for example: recommendations, alerts, etc.
     * 
     * @return the securityValues value.
     */
    public List securityValues() {
        return this.securityValues;
    }

    /**
     * Set the securityValues property: The affected security values that MDC offers that will be affected by the issue,
     * for example: recommendations, alerts, etc.
     * 
     * @param securityValues the securityValues value to set.
     * @return the Issue object itself.
     */
    public Issue withSecurityValues(List securityValues) {
        this.securityValues = securityValues;
        return this;
    }

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

    /**
     * Set the issueDescription property: The issue description.
     * 
     * @param issueDescription the issueDescription value to set.
     * @return the Issue object itself.
     */
    public Issue withIssueDescription(String issueDescription) {
        this.issueDescription = issueDescription;
        return this;
    }

    /**
     * Get the remediationSteps property: Human readable description of what you should do to mitigate this health
     * issue.
     * 
     * @return the remediationSteps value.
     */
    public String remediationSteps() {
        return this.remediationSteps;
    }

    /**
     * Set the remediationSteps property: Human readable description of what you should do to mitigate this health
     * issue.
     * 
     * @param remediationSteps the remediationSteps value to set.
     * @return the Issue object itself.
     */
    public Issue withRemediationSteps(String remediationSteps) {
        this.remediationSteps = remediationSteps;
        return this;
    }

    /**
     * Get the remediationScript property: The remediation script to solve this issue.
     * 
     * @return the remediationScript value.
     */
    public String remediationScript() {
        return this.remediationScript;
    }

    /**
     * Set the remediationScript property: The remediation script to solve this issue.
     * 
     * @param remediationScript the remediationScript value to set.
     * @return the Issue object itself.
     */
    public Issue withRemediationScript(String remediationScript) {
        this.remediationScript = remediationScript;
        return this;
    }

    /**
     * Get the issueAdditionalData property: Additional data for the given issue. The additional data depends on the
     * issue type.
     * 
     * @return the issueAdditionalData value.
     */
    public Map issueAdditionalData() {
        return this.issueAdditionalData;
    }

    /**
     * Set the issueAdditionalData property: Additional data for the given issue. The additional data depends on the
     * issue type.
     * 
     * @param issueAdditionalData the issueAdditionalData value to set.
     * @return the Issue object itself.
     */
    public Issue withIssueAdditionalData(Map issueAdditionalData) {
        this.issueAdditionalData = issueAdditionalData;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (issueKey() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property issueKey in model Issue"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(Issue.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("issueKey", this.issueKey);
        jsonWriter.writeStringField("issueName", this.issueName);
        jsonWriter.writeArrayField("securityValues", this.securityValues,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("issueDescription", this.issueDescription);
        jsonWriter.writeStringField("remediationSteps", this.remediationSteps);
        jsonWriter.writeStringField("remediationScript", this.remediationScript);
        jsonWriter.writeMapField("issueAdditionalData", this.issueAdditionalData,
            (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("issueKey".equals(fieldName)) {
                    deserializedIssue.issueKey = reader.getString();
                } else if ("issueName".equals(fieldName)) {
                    deserializedIssue.issueName = reader.getString();
                } else if ("securityValues".equals(fieldName)) {
                    List securityValues = reader.readArray(reader1 -> reader1.getString());
                    deserializedIssue.securityValues = securityValues;
                } else if ("issueDescription".equals(fieldName)) {
                    deserializedIssue.issueDescription = reader.getString();
                } else if ("remediationSteps".equals(fieldName)) {
                    deserializedIssue.remediationSteps = reader.getString();
                } else if ("remediationScript".equals(fieldName)) {
                    deserializedIssue.remediationScript = reader.getString();
                } else if ("issueAdditionalData".equals(fieldName)) {
                    Map issueAdditionalData = reader.readMap(reader1 -> reader1.getString());
                    deserializedIssue.issueAdditionalData = issueAdditionalData;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIssue;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy