com.azure.security.keyvault.administration.implementation.models.Permission Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-security-keyvault-administration Show documentation
Show all versions of azure-security-keyvault-administration Show documentation
This module contains client library for Microsoft Azure KeyVault Administration.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.security.keyvault.administration.implementation.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 com.azure.security.keyvault.administration.models.KeyVaultDataAction;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
/**
* Role definition permissions.
*/
@Fluent
public final class Permission implements JsonSerializable {
/*
* Action permissions that are granted.
*/
private List actions;
/*
* Action permissions that are excluded but not denied. They may be granted by other role definitions assigned to a
* principal.
*/
private List notActions;
/*
* Data action permissions that are granted.
*/
private List dataActions;
/*
* Data action permissions that are excluded but not denied. They may be granted by other role definitions assigned
* to a principal.
*/
private List notDataActions;
/**
* Creates an instance of Permission class.
*/
public Permission() {
}
/**
* Get the actions property: Action permissions that are granted.
*
* @return the actions value.
*/
public List getActions() {
return this.actions;
}
/**
* Set the actions property: Action permissions that are granted.
*
* @param actions the actions value to set.
* @return the Permission object itself.
*/
public Permission setActions(List actions) {
this.actions = actions;
return this;
}
/**
* Get the notActions property: Action permissions that are excluded but not denied. They may be granted by other
* role definitions assigned to a principal.
*
* @return the notActions value.
*/
public List getNotActions() {
return this.notActions;
}
/**
* Set the notActions property: Action permissions that are excluded but not denied. They may be granted by other
* role definitions assigned to a principal.
*
* @param notActions the notActions value to set.
* @return the Permission object itself.
*/
public Permission setNotActions(List notActions) {
this.notActions = notActions;
return this;
}
/**
* Get the dataActions property: Data action permissions that are granted.
*
* @return the dataActions value.
*/
public List getDataActions() {
return this.dataActions;
}
/**
* Set the dataActions property: Data action permissions that are granted.
*
* @param dataActions the dataActions value to set.
* @return the Permission object itself.
*/
public Permission setDataActions(List dataActions) {
this.dataActions = dataActions;
return this;
}
/**
* Get the notDataActions property: Data action permissions that are excluded but not denied. They may be granted
* by other role definitions assigned to a principal.
*
* @return the notDataActions value.
*/
public List getNotDataActions() {
return this.notDataActions;
}
/**
* Set the notDataActions property: Data action permissions that are excluded but not denied. They may be granted
* by other role definitions assigned to a principal.
*
* @param notDataActions the notDataActions value to set.
* @return the Permission object itself.
*/
public Permission setNotDataActions(List notDataActions) {
this.notDataActions = notDataActions;
return this;
}
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("actions", this.actions, (writer, element) -> writer.writeString(element));
jsonWriter.writeArrayField("notActions", this.notActions, (writer, element) -> writer.writeString(element));
jsonWriter.writeArrayField("dataActions", this.dataActions,
(writer, element) -> writer.writeString(Objects.toString(element, null)));
jsonWriter.writeArrayField("notDataActions", this.notDataActions,
(writer, element) -> writer.writeString(Objects.toString(element, null)));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of Permission from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of Permission 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 Permission.
*/
public static Permission fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Permission deserializedPermission = new Permission();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("actions".equals(fieldName)) {
List actions = reader.readArray(reader1 -> reader1.getString());
deserializedPermission.actions = actions;
} else if ("notActions".equals(fieldName)) {
List notActions = reader.readArray(reader1 -> reader1.getString());
deserializedPermission.notActions = notActions;
} else if ("dataActions".equals(fieldName)) {
List dataActions
= reader.readArray(reader1 -> KeyVaultDataAction.fromString(reader1.getString()));
deserializedPermission.dataActions = dataActions;
} else if ("notDataActions".equals(fieldName)) {
List notDataActions
= reader.readArray(reader1 -> KeyVaultDataAction.fromString(reader1.getString()));
deserializedPermission.notDataActions = notDataActions;
} else {
reader.skipChildren();
}
}
return deserializedPermission;
});
}
}