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

com.azure.resourcemanager.securityinsights.models.ConnectorInstructionModelBase 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-2021-09.

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

/**
 * Instruction step details.
 */
@Fluent
public class ConnectorInstructionModelBase implements JsonSerializable {
    /*
     * The parameters for the setting
     */
    private Object parameters;

    /*
     * The kind of the setting
     */
    private SettingType type;

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

    /**
     * Get the parameters property: The parameters for the setting.
     * 
     * @return the parameters value.
     */
    public Object parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: The parameters for the setting.
     * 
     * @param parameters the parameters value to set.
     * @return the ConnectorInstructionModelBase object itself.
     */
    public ConnectorInstructionModelBase withParameters(Object parameters) {
        this.parameters = parameters;
        return this;
    }

    /**
     * Get the type property: The kind of the setting.
     * 
     * @return the type value.
     */
    public SettingType type() {
        return this.type;
    }

    /**
     * Set the type property: The kind of the setting.
     * 
     * @param type the type value to set.
     * @return the ConnectorInstructionModelBase object itself.
     */
    public ConnectorInstructionModelBase withType(SettingType type) {
        this.type = type;
        return this;
    }

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

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

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

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

                if ("type".equals(fieldName)) {
                    deserializedConnectorInstructionModelBase.type = SettingType.fromString(reader.getString());
                } else if ("parameters".equals(fieldName)) {
                    deserializedConnectorInstructionModelBase.parameters = reader.readUntyped();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedConnectorInstructionModelBase;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy