
com.azure.resourcemanager.billing.models.CheckAccessRequest 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.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;
import java.util.List;
/**
* Request to check access.
*/
@Fluent
public final class CheckAccessRequest implements JsonSerializable {
/*
* List of actions passed in the request body against which the permissions will be checked.
*/
private List actions;
/**
* Creates an instance of CheckAccessRequest class.
*/
public CheckAccessRequest() {
}
/**
* Get the actions property: List of actions passed in the request body against which the permissions will be
* checked.
*
* @return the actions value.
*/
public List actions() {
return this.actions;
}
/**
* Set the actions property: List of actions passed in the request body against which the permissions will be
* checked.
*
* @param actions the actions value to set.
* @return the CheckAccessRequest object itself.
*/
public CheckAccessRequest withActions(List actions) {
this.actions = actions;
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.writeArrayField("actions", this.actions, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of CheckAccessRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CheckAccessRequest 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 CheckAccessRequest.
*/
public static CheckAccessRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
CheckAccessRequest deserializedCheckAccessRequest = new CheckAccessRequest();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("actions".equals(fieldName)) {
List actions = reader.readArray(reader1 -> reader1.getString());
deserializedCheckAccessRequest.actions = actions;
} else {
reader.skipChildren();
}
}
return deserializedCheckAccessRequest;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy