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

com.azure.resourcemanager.securityinsights.models.RequiredPermissions 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Required permissions for the connector.
 */
@Fluent
public final class RequiredPermissions implements JsonSerializable {
    /*
     * action permission
     */
    private Boolean action;

    /*
     * write permission
     */
    private Boolean write;

    /*
     * read permission
     */
    private Boolean read;

    /*
     * delete permission
     */
    private Boolean delete;

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

    /**
     * Get the action property: action permission.
     * 
     * @return the action value.
     */
    public Boolean action() {
        return this.action;
    }

    /**
     * Set the action property: action permission.
     * 
     * @param action the action value to set.
     * @return the RequiredPermissions object itself.
     */
    public RequiredPermissions withAction(Boolean action) {
        this.action = action;
        return this;
    }

    /**
     * Get the write property: write permission.
     * 
     * @return the write value.
     */
    public Boolean write() {
        return this.write;
    }

    /**
     * Set the write property: write permission.
     * 
     * @param write the write value to set.
     * @return the RequiredPermissions object itself.
     */
    public RequiredPermissions withWrite(Boolean write) {
        this.write = write;
        return this;
    }

    /**
     * Get the read property: read permission.
     * 
     * @return the read value.
     */
    public Boolean read() {
        return this.read;
    }

    /**
     * Set the read property: read permission.
     * 
     * @param read the read value to set.
     * @return the RequiredPermissions object itself.
     */
    public RequiredPermissions withRead(Boolean read) {
        this.read = read;
        return this;
    }

    /**
     * Get the delete property: delete permission.
     * 
     * @return the delete value.
     */
    public Boolean delete() {
        return this.delete;
    }

    /**
     * Set the delete property: delete permission.
     * 
     * @param delete the delete value to set.
     * @return the RequiredPermissions object itself.
     */
    public RequiredPermissions withDelete(Boolean delete) {
        this.delete = delete;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeBooleanField("action", this.action);
        jsonWriter.writeBooleanField("write", this.write);
        jsonWriter.writeBooleanField("read", this.read);
        jsonWriter.writeBooleanField("delete", this.delete);
        return jsonWriter.writeEndObject();
    }

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

                if ("action".equals(fieldName)) {
                    deserializedRequiredPermissions.action = reader.getNullable(JsonReader::getBoolean);
                } else if ("write".equals(fieldName)) {
                    deserializedRequiredPermissions.write = reader.getNullable(JsonReader::getBoolean);
                } else if ("read".equals(fieldName)) {
                    deserializedRequiredPermissions.read = reader.getNullable(JsonReader::getBoolean);
                } else if ("delete".equals(fieldName)) {
                    deserializedRequiredPermissions.delete = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRequiredPermissions;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy