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

com.azure.resourcemanager.securityinsights.models.InstructionStepsInstructionsItem Maven / Gradle / Ivy

Go to download

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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * The InstructionStepsInstructionsItem model.
 */
@Fluent
public final class InstructionStepsInstructionsItem extends ConnectorInstructionModelBase {
    /**
     * Creates an instance of InstructionStepsInstructionsItem class.
     */
    public InstructionStepsInstructionsItem() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public InstructionStepsInstructionsItem withParameters(Object parameters) {
        super.withParameters(parameters);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public InstructionStepsInstructionsItem withType(SettingType type) {
        super.withType(type);
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("type", type() == null ? null : type().toString());
        jsonWriter.writeUntypedField("parameters", parameters());
        return jsonWriter.writeEndObject();
    }

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

                if ("type".equals(fieldName)) {
                    deserializedInstructionStepsInstructionsItem.withType(SettingType.fromString(reader.getString()));
                } else if ("parameters".equals(fieldName)) {
                    deserializedInstructionStepsInstructionsItem.withParameters(reader.readUntyped());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedInstructionStepsInstructionsItem;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy