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

com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionProperties Maven / Gradle / Ivy

// 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.fluent.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 com.azure.resourcemanager.security.models.SecurityFamily;
import java.io.IOException;

/**
 * The DiscoveredSecuritySolutionProperties model.
 */
@Fluent
public final class DiscoveredSecuritySolutionProperties
    implements JsonSerializable {
    /*
     * The security family of the discovered solution
     */
    private SecurityFamily securityFamily;

    /*
     * The security solutions' image offer
     */
    private String offer;

    /*
     * The security solutions' image publisher
     */
    private String publisher;

    /*
     * The security solutions' image sku
     */
    private String sku;

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

    /**
     * Get the securityFamily property: The security family of the discovered solution.
     * 
     * @return the securityFamily value.
     */
    public SecurityFamily securityFamily() {
        return this.securityFamily;
    }

    /**
     * Set the securityFamily property: The security family of the discovered solution.
     * 
     * @param securityFamily the securityFamily value to set.
     * @return the DiscoveredSecuritySolutionProperties object itself.
     */
    public DiscoveredSecuritySolutionProperties withSecurityFamily(SecurityFamily securityFamily) {
        this.securityFamily = securityFamily;
        return this;
    }

    /**
     * Get the offer property: The security solutions' image offer.
     * 
     * @return the offer value.
     */
    public String offer() {
        return this.offer;
    }

    /**
     * Set the offer property: The security solutions' image offer.
     * 
     * @param offer the offer value to set.
     * @return the DiscoveredSecuritySolutionProperties object itself.
     */
    public DiscoveredSecuritySolutionProperties withOffer(String offer) {
        this.offer = offer;
        return this;
    }

    /**
     * Get the publisher property: The security solutions' image publisher.
     * 
     * @return the publisher value.
     */
    public String publisher() {
        return this.publisher;
    }

    /**
     * Set the publisher property: The security solutions' image publisher.
     * 
     * @param publisher the publisher value to set.
     * @return the DiscoveredSecuritySolutionProperties object itself.
     */
    public DiscoveredSecuritySolutionProperties withPublisher(String publisher) {
        this.publisher = publisher;
        return this;
    }

    /**
     * Get the sku property: The security solutions' image sku.
     * 
     * @return the sku value.
     */
    public String sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The security solutions' image sku.
     * 
     * @param sku the sku value to set.
     * @return the DiscoveredSecuritySolutionProperties object itself.
     */
    public DiscoveredSecuritySolutionProperties withSku(String sku) {
        this.sku = sku;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("securityFamily",
            this.securityFamily == null ? null : this.securityFamily.toString());
        jsonWriter.writeStringField("offer", this.offer);
        jsonWriter.writeStringField("publisher", this.publisher);
        jsonWriter.writeStringField("sku", this.sku);
        return jsonWriter.writeEndObject();
    }

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

                if ("securityFamily".equals(fieldName)) {
                    deserializedDiscoveredSecuritySolutionProperties.securityFamily
                        = SecurityFamily.fromString(reader.getString());
                } else if ("offer".equals(fieldName)) {
                    deserializedDiscoveredSecuritySolutionProperties.offer = reader.getString();
                } else if ("publisher".equals(fieldName)) {
                    deserializedDiscoveredSecuritySolutionProperties.publisher = reader.getString();
                } else if ("sku".equals(fieldName)) {
                    deserializedDiscoveredSecuritySolutionProperties.sku = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDiscoveredSecuritySolutionProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy