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

com.azure.resourcemanager.billing.fluent.models.BillingPermissionInner 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.billing.fluent.models;

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * The set of allowed action and not allowed actions a caller has on a resource.
 */
@Immutable
public final class BillingPermissionInner implements JsonSerializable {
    /*
     * The set of actions that the caller is allowed to perform.
     */
    private List actions;

    /*
     * The set of actions that the caller is not allowed to perform.
     */
    private List notActions;

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

    /**
     * Get the actions property: The set of actions that the caller is allowed to perform.
     * 
     * @return the actions value.
     */
    public List actions() {
        return this.actions;
    }

    /**
     * Get the notActions property: The set of actions that the caller is not allowed to perform.
     * 
     * @return the notActions value.
     */
    public List notActions() {
        return this.notActions;
    }

    /**
     * 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();
        return jsonWriter.writeEndObject();
    }

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

                if ("actions".equals(fieldName)) {
                    List actions = reader.readArray(reader1 -> reader1.getString());
                    deserializedBillingPermissionInner.actions = actions;
                } else if ("notActions".equals(fieldName)) {
                    List notActions = reader.readArray(reader1 -> reader1.getString());
                    deserializedBillingPermissionInner.notActions = notActions;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedBillingPermissionInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy