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

com.azure.resourcemanager.securityinsights.fluent.models.ApiPollingParameters 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingConfigProperties;
import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigProperties;
import java.io.IOException;

/**
 * Represents Codeless API Polling data connector.
 */
@Fluent
public final class ApiPollingParameters implements JsonSerializable {
    /*
     * Config to describe the instructions blade
     */
    private CodelessUiConnectorConfigProperties connectorUiConfig;

    /*
     * Config to describe the polling instructions
     */
    private CodelessConnectorPollingConfigProperties pollingConfig;

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

    /**
     * Get the connectorUiConfig property: Config to describe the instructions blade.
     * 
     * @return the connectorUiConfig value.
     */
    public CodelessUiConnectorConfigProperties connectorUiConfig() {
        return this.connectorUiConfig;
    }

    /**
     * Set the connectorUiConfig property: Config to describe the instructions blade.
     * 
     * @param connectorUiConfig the connectorUiConfig value to set.
     * @return the ApiPollingParameters object itself.
     */
    public ApiPollingParameters withConnectorUiConfig(CodelessUiConnectorConfigProperties connectorUiConfig) {
        this.connectorUiConfig = connectorUiConfig;
        return this;
    }

    /**
     * Get the pollingConfig property: Config to describe the polling instructions.
     * 
     * @return the pollingConfig value.
     */
    public CodelessConnectorPollingConfigProperties pollingConfig() {
        return this.pollingConfig;
    }

    /**
     * Set the pollingConfig property: Config to describe the polling instructions.
     * 
     * @param pollingConfig the pollingConfig value to set.
     * @return the ApiPollingParameters object itself.
     */
    public ApiPollingParameters withPollingConfig(CodelessConnectorPollingConfigProperties pollingConfig) {
        this.pollingConfig = pollingConfig;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("connectorUiConfig", this.connectorUiConfig);
        jsonWriter.writeJsonField("pollingConfig", this.pollingConfig);
        return jsonWriter.writeEndObject();
    }

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

                if ("connectorUiConfig".equals(fieldName)) {
                    deserializedApiPollingParameters.connectorUiConfig
                        = CodelessUiConnectorConfigProperties.fromJson(reader);
                } else if ("pollingConfig".equals(fieldName)) {
                    deserializedApiPollingParameters.pollingConfig
                        = CodelessConnectorPollingConfigProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedApiPollingParameters;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy