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

com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingConfigProperties 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.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Config to describe the polling config for API poller connector.
 */
@Fluent
public final class CodelessConnectorPollingConfigProperties
    implements JsonSerializable {
    /*
     * The poller active status
     */
    private Boolean isActive;

    /*
     * Describe the authentication type of the poller
     */
    private CodelessConnectorPollingAuthProperties auth;

    /*
     * Describe the poll request config parameters of the poller
     */
    private CodelessConnectorPollingRequestProperties request;

    /*
     * Describe the poll request paging config of the poller
     */
    private CodelessConnectorPollingPagingProperties paging;

    /*
     * Describe the response config parameters of the poller
     */
    private CodelessConnectorPollingResponseProperties response;

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

    /**
     * Get the isActive property: The poller active status.
     * 
     * @return the isActive value.
     */
    public Boolean isActive() {
        return this.isActive;
    }

    /**
     * Set the isActive property: The poller active status.
     * 
     * @param isActive the isActive value to set.
     * @return the CodelessConnectorPollingConfigProperties object itself.
     */
    public CodelessConnectorPollingConfigProperties withIsActive(Boolean isActive) {
        this.isActive = isActive;
        return this;
    }

    /**
     * Get the auth property: Describe the authentication type of the poller.
     * 
     * @return the auth value.
     */
    public CodelessConnectorPollingAuthProperties auth() {
        return this.auth;
    }

    /**
     * Set the auth property: Describe the authentication type of the poller.
     * 
     * @param auth the auth value to set.
     * @return the CodelessConnectorPollingConfigProperties object itself.
     */
    public CodelessConnectorPollingConfigProperties withAuth(CodelessConnectorPollingAuthProperties auth) {
        this.auth = auth;
        return this;
    }

    /**
     * Get the request property: Describe the poll request config parameters of the poller.
     * 
     * @return the request value.
     */
    public CodelessConnectorPollingRequestProperties request() {
        return this.request;
    }

    /**
     * Set the request property: Describe the poll request config parameters of the poller.
     * 
     * @param request the request value to set.
     * @return the CodelessConnectorPollingConfigProperties object itself.
     */
    public CodelessConnectorPollingConfigProperties withRequest(CodelessConnectorPollingRequestProperties request) {
        this.request = request;
        return this;
    }

    /**
     * Get the paging property: Describe the poll request paging config of the poller.
     * 
     * @return the paging value.
     */
    public CodelessConnectorPollingPagingProperties paging() {
        return this.paging;
    }

    /**
     * Set the paging property: Describe the poll request paging config of the poller.
     * 
     * @param paging the paging value to set.
     * @return the CodelessConnectorPollingConfigProperties object itself.
     */
    public CodelessConnectorPollingConfigProperties withPaging(CodelessConnectorPollingPagingProperties paging) {
        this.paging = paging;
        return this;
    }

    /**
     * Get the response property: Describe the response config parameters of the poller.
     * 
     * @return the response value.
     */
    public CodelessConnectorPollingResponseProperties response() {
        return this.response;
    }

    /**
     * Set the response property: Describe the response config parameters of the poller.
     * 
     * @param response the response value to set.
     * @return the CodelessConnectorPollingConfigProperties object itself.
     */
    public CodelessConnectorPollingConfigProperties withResponse(CodelessConnectorPollingResponseProperties response) {
        this.response = response;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (auth() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property auth in model CodelessConnectorPollingConfigProperties"));
        } else {
            auth().validate();
        }
        if (request() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property request in model CodelessConnectorPollingConfigProperties"));
        } else {
            request().validate();
        }
        if (paging() != null) {
            paging().validate();
        }
        if (response() != null) {
            response().validate();
        }
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("auth", this.auth);
        jsonWriter.writeJsonField("request", this.request);
        jsonWriter.writeBooleanField("isActive", this.isActive);
        jsonWriter.writeJsonField("paging", this.paging);
        jsonWriter.writeJsonField("response", this.response);
        return jsonWriter.writeEndObject();
    }

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

                if ("auth".equals(fieldName)) {
                    deserializedCodelessConnectorPollingConfigProperties.auth
                        = CodelessConnectorPollingAuthProperties.fromJson(reader);
                } else if ("request".equals(fieldName)) {
                    deserializedCodelessConnectorPollingConfigProperties.request
                        = CodelessConnectorPollingRequestProperties.fromJson(reader);
                } else if ("isActive".equals(fieldName)) {
                    deserializedCodelessConnectorPollingConfigProperties.isActive
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("paging".equals(fieldName)) {
                    deserializedCodelessConnectorPollingConfigProperties.paging
                        = CodelessConnectorPollingPagingProperties.fromJson(reader);
                } else if ("response".equals(fieldName)) {
                    deserializedCodelessConnectorPollingConfigProperties.response
                        = CodelessConnectorPollingResponseProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCodelessConnectorPollingConfigProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy