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

com.azure.resourcemanager.security.fluent.models.AutomationInner 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.security.models.AutomationAction;
import com.azure.resourcemanager.security.models.AutomationScope;
import com.azure.resourcemanager.security.models.AutomationSource;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * The security automation resource.
 */
@Fluent
public final class AutomationInner extends Resource {
    /*
     * Security automation data
     */
    private AutomationProperties innerProperties;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

    /**
     * Get the innerProperties property: Security automation data.
     * 
     * @return the innerProperties value.
     */
    private AutomationProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AutomationInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AutomationInner withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the description property: The security automation description.
     * 
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: The security automation description.
     * 
     * @param description the description value to set.
     * @return the AutomationInner object itself.
     */
    public AutomationInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the isEnabled property: Indicates whether the security automation is enabled.
     * 
     * @return the isEnabled value.
     */
    public Boolean isEnabled() {
        return this.innerProperties() == null ? null : this.innerProperties().isEnabled();
    }

    /**
     * Set the isEnabled property: Indicates whether the security automation is enabled.
     * 
     * @param isEnabled the isEnabled value to set.
     * @return the AutomationInner object itself.
     */
    public AutomationInner withIsEnabled(Boolean isEnabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationProperties();
        }
        this.innerProperties().withIsEnabled(isEnabled);
        return this;
    }

    /**
     * Get the scopes property: A collection of scopes on which the security automations logic is applied. Supported
     * scopes are the subscription itself or a resource group under that subscription. The automation will only apply on
     * defined scopes.
     * 
     * @return the scopes value.
     */
    public List scopes() {
        return this.innerProperties() == null ? null : this.innerProperties().scopes();
    }

    /**
     * Set the scopes property: A collection of scopes on which the security automations logic is applied. Supported
     * scopes are the subscription itself or a resource group under that subscription. The automation will only apply on
     * defined scopes.
     * 
     * @param scopes the scopes value to set.
     * @return the AutomationInner object itself.
     */
    public AutomationInner withScopes(List scopes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationProperties();
        }
        this.innerProperties().withScopes(scopes);
        return this;
    }

    /**
     * Get the sources property: A collection of the source event types which evaluate the security automation set of
     * rules.
     * 
     * @return the sources value.
     */
    public List sources() {
        return this.innerProperties() == null ? null : this.innerProperties().sources();
    }

    /**
     * Set the sources property: A collection of the source event types which evaluate the security automation set of
     * rules.
     * 
     * @param sources the sources value to set.
     * @return the AutomationInner object itself.
     */
    public AutomationInner withSources(List sources) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationProperties();
        }
        this.innerProperties().withSources(sources);
        return this;
    }

    /**
     * Get the actions property: A collection of the actions which are triggered if all the configured rules
     * evaluations, within at least one rule set, are true.
     * 
     * @return the actions value.
     */
    public List actions() {
        return this.innerProperties() == null ? null : this.innerProperties().actions();
    }

    /**
     * Set the actions property: A collection of the actions which are triggered if all the configured rules
     * evaluations, within at least one rule set, are true.
     * 
     * @param actions the actions value to set.
     * @return the AutomationInner object itself.
     */
    public AutomationInner withActions(List actions) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationProperties();
        }
        this.innerProperties().withActions(actions);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("location", location());
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedAutomationInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedAutomationInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedAutomationInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedAutomationInner.withLocation(reader.getString());
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedAutomationInner.withTags(tags);
                } else if ("properties".equals(fieldName)) {
                    deserializedAutomationInner.innerProperties = AutomationProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAutomationInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy