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

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

// 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 Log Analytics Workspace to which event data will be exported. Security alerts data will reside in the
 * 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the
 * 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center
 * Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Microsoft Defender
 * for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore.
 */
@Fluent
public final class AutomationActionWorkspace extends AutomationAction {
    /*
     * The type of the action that will be triggered by the Automation
     */
    private ActionType actionType = ActionType.WORKSPACE;

    /*
     * The fully qualified Log Analytics Workspace Azure Resource ID.
     */
    private String workspaceResourceId;

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

    /**
     * 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 workspaceResourceId property: The fully qualified Log Analytics Workspace Azure Resource ID.
     * 
     * @return the workspaceResourceId value.
     */
    public String workspaceResourceId() {
        return this.workspaceResourceId;
    }

    /**
     * Set the workspaceResourceId property: The fully qualified Log Analytics Workspace Azure Resource ID.
     * 
     * @param workspaceResourceId the workspaceResourceId value to set.
     * @return the AutomationActionWorkspace object itself.
     */
    public AutomationActionWorkspace withWorkspaceResourceId(String workspaceResourceId) {
        this.workspaceResourceId = workspaceResourceId;
        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("workspaceResourceId", this.workspaceResourceId);
        return jsonWriter.writeEndObject();
    }

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

                if ("actionType".equals(fieldName)) {
                    deserializedAutomationActionWorkspace.actionType = ActionType.fromString(reader.getString());
                } else if ("workspaceResourceId".equals(fieldName)) {
                    deserializedAutomationActionWorkspace.workspaceResourceId = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAutomationActionWorkspace;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy