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

com.azure.resourcemanager.security.models.AutomationActionEventHub Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.

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.security.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * The target Event Hub to which event data will be exported. To learn more about Microsoft Defender for Cloud
 * continuous export capabilities, visit https://aka.ms/ASCExportLearnMore.
 */
@Fluent
public final class AutomationActionEventHub extends AutomationAction {
    /*
     * The type of the action that will be triggered by the Automation
     */
    private ActionType actionType = ActionType.EVENT_HUB;

    /*
     * The target Event Hub Azure Resource ID.
     */
    private String eventHubResourceId;

    /*
     * The target Event Hub SAS policy name.
     */
    private String sasPolicyName;

    /*
     * The target Event Hub connection string (it will not be included in any response).
     */
    private String connectionString;

    /*
     * Indicates whether the trusted service is enabled or not.
     */
    private Boolean isTrustedServiceEnabled;

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

    /**
     * Get the actionType property: The type of the action that will be triggered by the Automation.
     * 
     * @return the actionType value.
     */
    @Override
    public ActionType actionType() {
        return this.actionType;
    }

    /**
     * Get the eventHubResourceId property: The target Event Hub Azure Resource ID.
     * 
     * @return the eventHubResourceId value.
     */
    public String eventHubResourceId() {
        return this.eventHubResourceId;
    }

    /**
     * Set the eventHubResourceId property: The target Event Hub Azure Resource ID.
     * 
     * @param eventHubResourceId the eventHubResourceId value to set.
     * @return the AutomationActionEventHub object itself.
     */
    public AutomationActionEventHub withEventHubResourceId(String eventHubResourceId) {
        this.eventHubResourceId = eventHubResourceId;
        return this;
    }

    /**
     * Get the sasPolicyName property: The target Event Hub SAS policy name.
     * 
     * @return the sasPolicyName value.
     */
    public String sasPolicyName() {
        return this.sasPolicyName;
    }

    /**
     * Get the connectionString property: The target Event Hub connection string (it will not be included in any
     * response).
     * 
     * @return the connectionString value.
     */
    public String connectionString() {
        return this.connectionString;
    }

    /**
     * Set the connectionString property: The target Event Hub connection string (it will not be included in any
     * response).
     * 
     * @param connectionString the connectionString value to set.
     * @return the AutomationActionEventHub object itself.
     */
    public AutomationActionEventHub withConnectionString(String connectionString) {
        this.connectionString = connectionString;
        return this;
    }

    /**
     * Get the isTrustedServiceEnabled property: Indicates whether the trusted service is enabled or not.
     * 
     * @return the isTrustedServiceEnabled value.
     */
    public Boolean isTrustedServiceEnabled() {
        return this.isTrustedServiceEnabled;
    }

    /**
     * Set the isTrustedServiceEnabled property: Indicates whether the trusted service is enabled or not.
     * 
     * @param isTrustedServiceEnabled the isTrustedServiceEnabled value to set.
     * @return the AutomationActionEventHub object itself.
     */
    public AutomationActionEventHub withIsTrustedServiceEnabled(Boolean isTrustedServiceEnabled) {
        this.isTrustedServiceEnabled = isTrustedServiceEnabled;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("actionType", this.actionType == null ? null : this.actionType.toString());
        jsonWriter.writeStringField("eventHubResourceId", this.eventHubResourceId);
        jsonWriter.writeStringField("connectionString", this.connectionString);
        jsonWriter.writeBooleanField("isTrustedServiceEnabled", this.isTrustedServiceEnabled);
        return jsonWriter.writeEndObject();
    }

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

                if ("actionType".equals(fieldName)) {
                    deserializedAutomationActionEventHub.actionType = ActionType.fromString(reader.getString());
                } else if ("eventHubResourceId".equals(fieldName)) {
                    deserializedAutomationActionEventHub.eventHubResourceId = reader.getString();
                } else if ("sasPolicyName".equals(fieldName)) {
                    deserializedAutomationActionEventHub.sasPolicyName = reader.getString();
                } else if ("connectionString".equals(fieldName)) {
                    deserializedAutomationActionEventHub.connectionString = reader.getString();
                } else if ("isTrustedServiceEnabled".equals(fieldName)) {
                    deserializedAutomationActionEventHub.isTrustedServiceEnabled
                        = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAutomationActionEventHub;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy