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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId;
import com.azure.resourcemanager.securityinsights.models.PollingFrequency;
import com.azure.resourcemanager.securityinsights.models.TiTaxiiDataConnectorDataTypes;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Threat Intelligence TAXII data connector properties.
 */
@Fluent
public final class TiTaxiiDataConnectorProperties extends DataConnectorTenantId {
    /*
     * The workspace id.
     */
    private String workspaceId;

    /*
     * The friendly name for the TAXII server.
     */
    private String friendlyName;

    /*
     * The API root for the TAXII server.
     */
    private String taxiiServer;

    /*
     * The collection id of the TAXII server.
     */
    private String collectionId;

    /*
     * The userName for the TAXII server.
     */
    private String username;

    /*
     * The password for the TAXII server.
     */
    private String password;

    /*
     * The lookback period for the TAXII server.
     */
    private OffsetDateTime taxiiLookbackPeriod;

    /*
     * The polling frequency for the TAXII server.
     */
    private PollingFrequency pollingFrequency;

    /*
     * The available data types for Threat Intelligence TAXII data connector.
     */
    private TiTaxiiDataConnectorDataTypes dataTypes;

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

    /**
     * Get the workspaceId property: The workspace id.
     * 
     * @return the workspaceId value.
     */
    public String workspaceId() {
        return this.workspaceId;
    }

    /**
     * Set the workspaceId property: The workspace id.
     * 
     * @param workspaceId the workspaceId value to set.
     * @return the TiTaxiiDataConnectorProperties object itself.
     */
    public TiTaxiiDataConnectorProperties withWorkspaceId(String workspaceId) {
        this.workspaceId = workspaceId;
        return this;
    }

    /**
     * Get the friendlyName property: The friendly name for the TAXII server.
     * 
     * @return the friendlyName value.
     */
    public String friendlyName() {
        return this.friendlyName;
    }

    /**
     * Set the friendlyName property: The friendly name for the TAXII server.
     * 
     * @param friendlyName the friendlyName value to set.
     * @return the TiTaxiiDataConnectorProperties object itself.
     */
    public TiTaxiiDataConnectorProperties withFriendlyName(String friendlyName) {
        this.friendlyName = friendlyName;
        return this;
    }

    /**
     * Get the taxiiServer property: The API root for the TAXII server.
     * 
     * @return the taxiiServer value.
     */
    public String taxiiServer() {
        return this.taxiiServer;
    }

    /**
     * Set the taxiiServer property: The API root for the TAXII server.
     * 
     * @param taxiiServer the taxiiServer value to set.
     * @return the TiTaxiiDataConnectorProperties object itself.
     */
    public TiTaxiiDataConnectorProperties withTaxiiServer(String taxiiServer) {
        this.taxiiServer = taxiiServer;
        return this;
    }

    /**
     * Get the collectionId property: The collection id of the TAXII server.
     * 
     * @return the collectionId value.
     */
    public String collectionId() {
        return this.collectionId;
    }

    /**
     * Set the collectionId property: The collection id of the TAXII server.
     * 
     * @param collectionId the collectionId value to set.
     * @return the TiTaxiiDataConnectorProperties object itself.
     */
    public TiTaxiiDataConnectorProperties withCollectionId(String collectionId) {
        this.collectionId = collectionId;
        return this;
    }

    /**
     * Get the username property: The userName for the TAXII server.
     * 
     * @return the username value.
     */
    public String username() {
        return this.username;
    }

    /**
     * Set the username property: The userName for the TAXII server.
     * 
     * @param username the username value to set.
     * @return the TiTaxiiDataConnectorProperties object itself.
     */
    public TiTaxiiDataConnectorProperties withUsername(String username) {
        this.username = username;
        return this;
    }

    /**
     * Get the password property: The password for the TAXII server.
     * 
     * @return the password value.
     */
    public String password() {
        return this.password;
    }

    /**
     * Set the password property: The password for the TAXII server.
     * 
     * @param password the password value to set.
     * @return the TiTaxiiDataConnectorProperties object itself.
     */
    public TiTaxiiDataConnectorProperties withPassword(String password) {
        this.password = password;
        return this;
    }

    /**
     * Get the taxiiLookbackPeriod property: The lookback period for the TAXII server.
     * 
     * @return the taxiiLookbackPeriod value.
     */
    public OffsetDateTime taxiiLookbackPeriod() {
        return this.taxiiLookbackPeriod;
    }

    /**
     * Set the taxiiLookbackPeriod property: The lookback period for the TAXII server.
     * 
     * @param taxiiLookbackPeriod the taxiiLookbackPeriod value to set.
     * @return the TiTaxiiDataConnectorProperties object itself.
     */
    public TiTaxiiDataConnectorProperties withTaxiiLookbackPeriod(OffsetDateTime taxiiLookbackPeriod) {
        this.taxiiLookbackPeriod = taxiiLookbackPeriod;
        return this;
    }

    /**
     * Get the pollingFrequency property: The polling frequency for the TAXII server.
     * 
     * @return the pollingFrequency value.
     */
    public PollingFrequency pollingFrequency() {
        return this.pollingFrequency;
    }

    /**
     * Set the pollingFrequency property: The polling frequency for the TAXII server.
     * 
     * @param pollingFrequency the pollingFrequency value to set.
     * @return the TiTaxiiDataConnectorProperties object itself.
     */
    public TiTaxiiDataConnectorProperties withPollingFrequency(PollingFrequency pollingFrequency) {
        this.pollingFrequency = pollingFrequency;
        return this;
    }

    /**
     * Get the dataTypes property: The available data types for Threat Intelligence TAXII data connector.
     * 
     * @return the dataTypes value.
     */
    public TiTaxiiDataConnectorDataTypes dataTypes() {
        return this.dataTypes;
    }

    /**
     * Set the dataTypes property: The available data types for Threat Intelligence TAXII data connector.
     * 
     * @param dataTypes the dataTypes value to set.
     * @return the TiTaxiiDataConnectorProperties object itself.
     */
    public TiTaxiiDataConnectorProperties withDataTypes(TiTaxiiDataConnectorDataTypes dataTypes) {
        this.dataTypes = dataTypes;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public TiTaxiiDataConnectorProperties withTenantId(String tenantId) {
        super.withTenantId(tenantId);
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("tenantId", tenantId());
        jsonWriter.writeStringField("pollingFrequency",
            this.pollingFrequency == null ? null : this.pollingFrequency.toString());
        jsonWriter.writeJsonField("dataTypes", this.dataTypes);
        jsonWriter.writeStringField("workspaceId", this.workspaceId);
        jsonWriter.writeStringField("friendlyName", this.friendlyName);
        jsonWriter.writeStringField("taxiiServer", this.taxiiServer);
        jsonWriter.writeStringField("collectionId", this.collectionId);
        jsonWriter.writeStringField("userName", this.username);
        jsonWriter.writeStringField("password", this.password);
        jsonWriter.writeStringField("taxiiLookbackPeriod",
            this.taxiiLookbackPeriod == null
                ? null
                : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.taxiiLookbackPeriod));
        return jsonWriter.writeEndObject();
    }

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

                if ("tenantId".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.withTenantId(reader.getString());
                } else if ("pollingFrequency".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.pollingFrequency
                        = PollingFrequency.fromString(reader.getString());
                } else if ("dataTypes".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.dataTypes
                        = TiTaxiiDataConnectorDataTypes.fromJson(reader);
                } else if ("workspaceId".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.workspaceId = reader.getString();
                } else if ("friendlyName".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.friendlyName = reader.getString();
                } else if ("taxiiServer".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.taxiiServer = reader.getString();
                } else if ("collectionId".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.collectionId = reader.getString();
                } else if ("userName".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.username = reader.getString();
                } else if ("password".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.password = reader.getString();
                } else if ("taxiiLookbackPeriod".equals(fieldName)) {
                    deserializedTiTaxiiDataConnectorProperties.taxiiLookbackPeriod = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedTiTaxiiDataConnectorProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy