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

com.azure.resourcemanager.devcenter.models.EnvironmentRole 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.devcenter.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;

/**
 * A role that can be assigned to a user.
 */
@Immutable
public final class EnvironmentRole implements JsonSerializable {
    /*
     * The common name of the Role Assignment. This is a descriptive name such as 'AcrPush'.
     */
    private String roleName;

    /*
     * This is a description of the Role Assignment.
     */
    private String description;

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

    /**
     * Get the roleName property: The common name of the Role Assignment. This is a descriptive name such as 'AcrPush'.
     * 
     * @return the roleName value.
     */
    public String roleName() {
        return this.roleName;
    }

    /**
     * Get the description property: This is a description of the Role Assignment.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

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

                if ("roleName".equals(fieldName)) {
                    deserializedEnvironmentRole.roleName = reader.getString();
                } else if ("description".equals(fieldName)) {
                    deserializedEnvironmentRole.description = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEnvironmentRole;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy