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

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

/**
 * Describe the request properties needed to successfully pull from the server.
 */
@Fluent
public final class CodelessConnectorPollingRequestProperties
    implements JsonSerializable {
    /*
     * Describe the endpoint we should pull the data from
     */
    private String apiEndpoint;

    /*
     * Defines the rate limit QPS
     */
    private Integer rateLimitQps;

    /*
     * The window interval we will use the pull the data
     */
    private int queryWindowInMin;

    /*
     * The http method type we will use in the poll request, GET or POST
     */
    private String httpMethod;

    /*
     * The time format will be used the query events in a specific window
     */
    private String queryTimeFormat;

    /*
     * Describe the amount of time we should try and poll the data in case of failure
     */
    private Integer retryCount;

    /*
     * The number of seconds we will consider as a request timeout
     */
    private Integer timeoutInSeconds;

    /*
     * Describe the headers sent in the poll request
     */
    private Object headers;

    /*
     * Describe the query parameters sent in the poll request
     */
    private Object queryParameters;

    /*
     * For advanced scenarios for example user name/password embedded in nested JSON payload
     */
    private String queryParametersTemplate;

    /*
     * This will be used the query events from a start of the time window
     */
    private String startTimeAttributeName;

    /*
     * This will be used the query events from the end of the time window
     */
    private String endTimeAttributeName;

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

    /**
     * Get the apiEndpoint property: Describe the endpoint we should pull the data from.
     * 
     * @return the apiEndpoint value.
     */
    public String apiEndpoint() {
        return this.apiEndpoint;
    }

    /**
     * Set the apiEndpoint property: Describe the endpoint we should pull the data from.
     * 
     * @param apiEndpoint the apiEndpoint value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withApiEndpoint(String apiEndpoint) {
        this.apiEndpoint = apiEndpoint;
        return this;
    }

    /**
     * Get the rateLimitQps property: Defines the rate limit QPS.
     * 
     * @return the rateLimitQps value.
     */
    public Integer rateLimitQps() {
        return this.rateLimitQps;
    }

    /**
     * Set the rateLimitQps property: Defines the rate limit QPS.
     * 
     * @param rateLimitQps the rateLimitQps value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withRateLimitQps(Integer rateLimitQps) {
        this.rateLimitQps = rateLimitQps;
        return this;
    }

    /**
     * Get the queryWindowInMin property: The window interval we will use the pull the data.
     * 
     * @return the queryWindowInMin value.
     */
    public int queryWindowInMin() {
        return this.queryWindowInMin;
    }

    /**
     * Set the queryWindowInMin property: The window interval we will use the pull the data.
     * 
     * @param queryWindowInMin the queryWindowInMin value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withQueryWindowInMin(int queryWindowInMin) {
        this.queryWindowInMin = queryWindowInMin;
        return this;
    }

    /**
     * Get the httpMethod property: The http method type we will use in the poll request, GET or POST.
     * 
     * @return the httpMethod value.
     */
    public String httpMethod() {
        return this.httpMethod;
    }

    /**
     * Set the httpMethod property: The http method type we will use in the poll request, GET or POST.
     * 
     * @param httpMethod the httpMethod value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withHttpMethod(String httpMethod) {
        this.httpMethod = httpMethod;
        return this;
    }

    /**
     * Get the queryTimeFormat property: The time format will be used the query events in a specific window.
     * 
     * @return the queryTimeFormat value.
     */
    public String queryTimeFormat() {
        return this.queryTimeFormat;
    }

    /**
     * Set the queryTimeFormat property: The time format will be used the query events in a specific window.
     * 
     * @param queryTimeFormat the queryTimeFormat value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withQueryTimeFormat(String queryTimeFormat) {
        this.queryTimeFormat = queryTimeFormat;
        return this;
    }

    /**
     * Get the retryCount property: Describe the amount of time we should try and poll the data in case of failure.
     * 
     * @return the retryCount value.
     */
    public Integer retryCount() {
        return this.retryCount;
    }

    /**
     * Set the retryCount property: Describe the amount of time we should try and poll the data in case of failure.
     * 
     * @param retryCount the retryCount value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withRetryCount(Integer retryCount) {
        this.retryCount = retryCount;
        return this;
    }

    /**
     * Get the timeoutInSeconds property: The number of seconds we will consider as a request timeout.
     * 
     * @return the timeoutInSeconds value.
     */
    public Integer timeoutInSeconds() {
        return this.timeoutInSeconds;
    }

    /**
     * Set the timeoutInSeconds property: The number of seconds we will consider as a request timeout.
     * 
     * @param timeoutInSeconds the timeoutInSeconds value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withTimeoutInSeconds(Integer timeoutInSeconds) {
        this.timeoutInSeconds = timeoutInSeconds;
        return this;
    }

    /**
     * Get the headers property: Describe the headers sent in the poll request.
     * 
     * @return the headers value.
     */
    public Object headers() {
        return this.headers;
    }

    /**
     * Set the headers property: Describe the headers sent in the poll request.
     * 
     * @param headers the headers value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withHeaders(Object headers) {
        this.headers = headers;
        return this;
    }

    /**
     * Get the queryParameters property: Describe the query parameters sent in the poll request.
     * 
     * @return the queryParameters value.
     */
    public Object queryParameters() {
        return this.queryParameters;
    }

    /**
     * Set the queryParameters property: Describe the query parameters sent in the poll request.
     * 
     * @param queryParameters the queryParameters value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withQueryParameters(Object queryParameters) {
        this.queryParameters = queryParameters;
        return this;
    }

    /**
     * Get the queryParametersTemplate property: For advanced scenarios for example user name/password embedded in
     * nested JSON payload.
     * 
     * @return the queryParametersTemplate value.
     */
    public String queryParametersTemplate() {
        return this.queryParametersTemplate;
    }

    /**
     * Set the queryParametersTemplate property: For advanced scenarios for example user name/password embedded in
     * nested JSON payload.
     * 
     * @param queryParametersTemplate the queryParametersTemplate value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withQueryParametersTemplate(String queryParametersTemplate) {
        this.queryParametersTemplate = queryParametersTemplate;
        return this;
    }

    /**
     * Get the startTimeAttributeName property: This will be used the query events from a start of the time window.
     * 
     * @return the startTimeAttributeName value.
     */
    public String startTimeAttributeName() {
        return this.startTimeAttributeName;
    }

    /**
     * Set the startTimeAttributeName property: This will be used the query events from a start of the time window.
     * 
     * @param startTimeAttributeName the startTimeAttributeName value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withStartTimeAttributeName(String startTimeAttributeName) {
        this.startTimeAttributeName = startTimeAttributeName;
        return this;
    }

    /**
     * Get the endTimeAttributeName property: This will be used the query events from the end of the time window.
     * 
     * @return the endTimeAttributeName value.
     */
    public String endTimeAttributeName() {
        return this.endTimeAttributeName;
    }

    /**
     * Set the endTimeAttributeName property: This will be used the query events from the end of the time window.
     * 
     * @param endTimeAttributeName the endTimeAttributeName value to set.
     * @return the CodelessConnectorPollingRequestProperties object itself.
     */
    public CodelessConnectorPollingRequestProperties withEndTimeAttributeName(String endTimeAttributeName) {
        this.endTimeAttributeName = endTimeAttributeName;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("apiEndpoint", this.apiEndpoint);
        jsonWriter.writeIntField("queryWindowInMin", this.queryWindowInMin);
        jsonWriter.writeStringField("httpMethod", this.httpMethod);
        jsonWriter.writeStringField("queryTimeFormat", this.queryTimeFormat);
        jsonWriter.writeNumberField("rateLimitQps", this.rateLimitQps);
        jsonWriter.writeNumberField("retryCount", this.retryCount);
        jsonWriter.writeNumberField("timeoutInSeconds", this.timeoutInSeconds);
        jsonWriter.writeUntypedField("headers", this.headers);
        jsonWriter.writeUntypedField("queryParameters", this.queryParameters);
        jsonWriter.writeStringField("queryParametersTemplate", this.queryParametersTemplate);
        jsonWriter.writeStringField("startTimeAttributeName", this.startTimeAttributeName);
        jsonWriter.writeStringField("endTimeAttributeName", this.endTimeAttributeName);
        return jsonWriter.writeEndObject();
    }

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

                if ("apiEndpoint".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.apiEndpoint = reader.getString();
                } else if ("queryWindowInMin".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.queryWindowInMin = reader.getInt();
                } else if ("httpMethod".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.httpMethod = reader.getString();
                } else if ("queryTimeFormat".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.queryTimeFormat = reader.getString();
                } else if ("rateLimitQps".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.rateLimitQps
                        = reader.getNullable(JsonReader::getInt);
                } else if ("retryCount".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.retryCount
                        = reader.getNullable(JsonReader::getInt);
                } else if ("timeoutInSeconds".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.timeoutInSeconds
                        = reader.getNullable(JsonReader::getInt);
                } else if ("headers".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.headers = reader.readUntyped();
                } else if ("queryParameters".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.queryParameters = reader.readUntyped();
                } else if ("queryParametersTemplate".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.queryParametersTemplate = reader.getString();
                } else if ("startTimeAttributeName".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.startTimeAttributeName = reader.getString();
                } else if ("endTimeAttributeName".equals(fieldName)) {
                    deserializedCodelessConnectorPollingRequestProperties.endTimeAttributeName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCodelessConnectorPollingRequestProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy