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

com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphPermissionScope 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.authorization.fluent.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.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;

/**
 * permissionScope.
 */
@Fluent
public final class MicrosoftGraphPermissionScope implements JsonSerializable {
    /*
     * A description of the delegated permissions, intended to be read by an administrator granting the permission on
     * behalf of all users. This text appears in tenant-wide admin consent experiences.
     */
    private String adminConsentDescription;

    /*
     * The permission's title, intended to be read by an administrator granting the permission on behalf of all users.
     */
    private String adminConsentDisplayName;

    /*
     * Unique delegated permission identifier inside the collection of delegated permissions defined for a resource
     * application.
     */
    private UUID id;

    /*
     * When creating or updating a permission, this property must be set to true (which is the default). To delete a
     * permission, this property must first be set to false. At that point, in a subsequent call, the permission may be
     * removed.
     */
    private Boolean isEnabled;

    /*
     * The origin property.
     */
    private String origin;

    /*
     * Specifies whether this delegated permission should be considered safe for non-admin users to consent to on behalf
     * of themselves, or whether an administrator should be required for consent to the permissions. This will be the
     * default behavior, but each customer can choose to customize the behavior in their organization (by allowing,
     * restricting or limiting user consent to this delegated permission.)
     */
    private String type;

    /*
     * A description of the delegated permissions, intended to be read by a user granting the permission on their own
     * behalf. This text appears in consent experiences where the user is consenting only on behalf of themselves.
     */
    private String userConsentDescription;

    /*
     * A title for the permission, intended to be read by a user granting the permission on their own behalf. This text
     * appears in consent experiences where the user is consenting only on behalf of themselves.
     */
    private String userConsentDisplayName;

    /*
     * Specifies the value to include in the scp (scope) claim in access tokens. Must not exceed 120 characters in
     * length. Allowed characters are : ! # $ % & ' ( ) * + , - . / : ; = ? @ [ ] ^ + _ { } ~, as well as characters in
     * the ranges 0-9, A-Z and a-z. Any other character, including the space character, are not allowed.
     */
    private String value;

    /*
     * permissionScope
     */
    private Map additionalProperties;

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

    /**
     * Get the adminConsentDescription property: A description of the delegated permissions, intended to be read by an
     * administrator granting the permission on behalf of all users. This text appears in tenant-wide admin consent
     * experiences.
     * 
     * @return the adminConsentDescription value.
     */
    public String adminConsentDescription() {
        return this.adminConsentDescription;
    }

    /**
     * Set the adminConsentDescription property: A description of the delegated permissions, intended to be read by an
     * administrator granting the permission on behalf of all users. This text appears in tenant-wide admin consent
     * experiences.
     * 
     * @param adminConsentDescription the adminConsentDescription value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withAdminConsentDescription(String adminConsentDescription) {
        this.adminConsentDescription = adminConsentDescription;
        return this;
    }

    /**
     * Get the adminConsentDisplayName property: The permission's title, intended to be read by an administrator
     * granting the permission on behalf of all users.
     * 
     * @return the adminConsentDisplayName value.
     */
    public String adminConsentDisplayName() {
        return this.adminConsentDisplayName;
    }

    /**
     * Set the adminConsentDisplayName property: The permission's title, intended to be read by an administrator
     * granting the permission on behalf of all users.
     * 
     * @param adminConsentDisplayName the adminConsentDisplayName value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withAdminConsentDisplayName(String adminConsentDisplayName) {
        this.adminConsentDisplayName = adminConsentDisplayName;
        return this;
    }

    /**
     * Get the id property: Unique delegated permission identifier inside the collection of delegated permissions
     * defined for a resource application.
     * 
     * @return the id value.
     */
    public UUID id() {
        return this.id;
    }

    /**
     * Set the id property: Unique delegated permission identifier inside the collection of delegated permissions
     * defined for a resource application.
     * 
     * @param id the id value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withId(UUID id) {
        this.id = id;
        return this;
    }

    /**
     * Get the isEnabled property: When creating or updating a permission, this property must be set to true (which is
     * the default). To delete a permission, this property must first be set to false. At that point, in a subsequent
     * call, the permission may be removed.
     * 
     * @return the isEnabled value.
     */
    public Boolean isEnabled() {
        return this.isEnabled;
    }

    /**
     * Set the isEnabled property: When creating or updating a permission, this property must be set to true (which is
     * the default). To delete a permission, this property must first be set to false. At that point, in a subsequent
     * call, the permission may be removed.
     * 
     * @param isEnabled the isEnabled value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withIsEnabled(Boolean isEnabled) {
        this.isEnabled = isEnabled;
        return this;
    }

    /**
     * Get the origin property: The origin property.
     * 
     * @return the origin value.
     */
    public String origin() {
        return this.origin;
    }

    /**
     * Set the origin property: The origin property.
     * 
     * @param origin the origin value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withOrigin(String origin) {
        this.origin = origin;
        return this;
    }

    /**
     * Get the type property: Specifies whether this delegated permission should be considered safe for non-admin users
     * to consent to on behalf of themselves, or whether an administrator should be required for consent to the
     * permissions. This will be the default behavior, but each customer can choose to customize the behavior in their
     * organization (by allowing, restricting or limiting user consent to this delegated permission.).
     * 
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Set the type property: Specifies whether this delegated permission should be considered safe for non-admin users
     * to consent to on behalf of themselves, or whether an administrator should be required for consent to the
     * permissions. This will be the default behavior, but each customer can choose to customize the behavior in their
     * organization (by allowing, restricting or limiting user consent to this delegated permission.).
     * 
     * @param type the type value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * Get the userConsentDescription property: A description of the delegated permissions, intended to be read by a
     * user granting the permission on their own behalf. This text appears in consent experiences where the user is
     * consenting only on behalf of themselves.
     * 
     * @return the userConsentDescription value.
     */
    public String userConsentDescription() {
        return this.userConsentDescription;
    }

    /**
     * Set the userConsentDescription property: A description of the delegated permissions, intended to be read by a
     * user granting the permission on their own behalf. This text appears in consent experiences where the user is
     * consenting only on behalf of themselves.
     * 
     * @param userConsentDescription the userConsentDescription value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withUserConsentDescription(String userConsentDescription) {
        this.userConsentDescription = userConsentDescription;
        return this;
    }

    /**
     * Get the userConsentDisplayName property: A title for the permission, intended to be read by a user granting the
     * permission on their own behalf. This text appears in consent experiences where the user is consenting only on
     * behalf of themselves.
     * 
     * @return the userConsentDisplayName value.
     */
    public String userConsentDisplayName() {
        return this.userConsentDisplayName;
    }

    /**
     * Set the userConsentDisplayName property: A title for the permission, intended to be read by a user granting the
     * permission on their own behalf. This text appears in consent experiences where the user is consenting only on
     * behalf of themselves.
     * 
     * @param userConsentDisplayName the userConsentDisplayName value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withUserConsentDisplayName(String userConsentDisplayName) {
        this.userConsentDisplayName = userConsentDisplayName;
        return this;
    }

    /**
     * Get the value property: Specifies the value to include in the scp (scope) claim in access tokens. Must not exceed
     * 120 characters in length. Allowed characters are : ! # $ % & ' ( ) * + , - . / : ; = ? @ [ ] ^ + _ { }
     * ~, as well as characters in the ranges 0-9, A-Z and a-z. Any other character, including the space character, are
     * not allowed.
     * 
     * @return the value value.
     */
    public String value() {
        return this.value;
    }

    /**
     * Set the value property: Specifies the value to include in the scp (scope) claim in access tokens. Must not exceed
     * 120 characters in length. Allowed characters are : ! # $ % & ' ( ) * + , - . / : ; = ? @ [ ] ^ + _ { }
     * ~, as well as characters in the ranges 0-9, A-Z and a-z. Any other character, including the space character, are
     * not allowed.
     * 
     * @param value the value value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withValue(String value) {
        this.value = value;
        return this;
    }

    /**
     * Get the additionalProperties property: permissionScope.
     * 
     * @return the additionalProperties value.
     */
    public Map additionalProperties() {
        return this.additionalProperties;
    }

    /**
     * Set the additionalProperties property: permissionScope.
     * 
     * @param additionalProperties the additionalProperties value to set.
     * @return the MicrosoftGraphPermissionScope object itself.
     */
    public MicrosoftGraphPermissionScope withAdditionalProperties(Map additionalProperties) {
        this.additionalProperties = additionalProperties;
        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.writeStringField("adminConsentDescription", this.adminConsentDescription);
        jsonWriter.writeStringField("adminConsentDisplayName", this.adminConsentDisplayName);
        jsonWriter.writeStringField("id", Objects.toString(this.id, null));
        jsonWriter.writeBooleanField("isEnabled", this.isEnabled);
        jsonWriter.writeStringField("origin", this.origin);
        jsonWriter.writeStringField("type", this.type);
        jsonWriter.writeStringField("userConsentDescription", this.userConsentDescription);
        jsonWriter.writeStringField("userConsentDisplayName", this.userConsentDisplayName);
        jsonWriter.writeStringField("value", this.value);
        if (additionalProperties != null) {
            for (Map.Entry additionalProperty : additionalProperties.entrySet()) {
                jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
            }
        }
        return jsonWriter.writeEndObject();
    }

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

                if ("adminConsentDescription".equals(fieldName)) {
                    deserializedMicrosoftGraphPermissionScope.adminConsentDescription = reader.getString();
                } else if ("adminConsentDisplayName".equals(fieldName)) {
                    deserializedMicrosoftGraphPermissionScope.adminConsentDisplayName = reader.getString();
                } else if ("id".equals(fieldName)) {
                    deserializedMicrosoftGraphPermissionScope.id
                        = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
                } else if ("isEnabled".equals(fieldName)) {
                    deserializedMicrosoftGraphPermissionScope.isEnabled = reader.getNullable(JsonReader::getBoolean);
                } else if ("origin".equals(fieldName)) {
                    deserializedMicrosoftGraphPermissionScope.origin = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedMicrosoftGraphPermissionScope.type = reader.getString();
                } else if ("userConsentDescription".equals(fieldName)) {
                    deserializedMicrosoftGraphPermissionScope.userConsentDescription = reader.getString();
                } else if ("userConsentDisplayName".equals(fieldName)) {
                    deserializedMicrosoftGraphPermissionScope.userConsentDisplayName = reader.getString();
                } else if ("value".equals(fieldName)) {
                    deserializedMicrosoftGraphPermissionScope.value = reader.getString();
                } else {
                    if (additionalProperties == null) {
                        additionalProperties = new LinkedHashMap<>();
                    }

                    additionalProperties.put(fieldName, reader.readUntyped());
                }
            }
            deserializedMicrosoftGraphPermissionScope.additionalProperties = additionalProperties;

            return deserializedMicrosoftGraphPermissionScope;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy