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

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

/**
 * The policies for Enterprise Agreement enrollments.
 */
@Fluent
public class EnterpriseAgreementPolicies implements JsonSerializable {
    /*
     * The state showing the enrollment auth level.
     */
    private EnrollmentAuthLevelState authenticationType;

    /*
     * The policy that controls whether account owner can view charges.
     */
    private EnrollmentAccountOwnerViewCharges accountOwnerViewCharges;

    /*
     * The policy that controls whether department admin can view charges.
     */
    private EnrollmentDepartmentAdminViewCharges departmentAdminViewCharges;

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

    /**
     * Get the authenticationType property: The state showing the enrollment auth level.
     * 
     * @return the authenticationType value.
     */
    public EnrollmentAuthLevelState authenticationType() {
        return this.authenticationType;
    }

    /**
     * Set the authenticationType property: The state showing the enrollment auth level.
     * 
     * @param authenticationType the authenticationType value to set.
     * @return the EnterpriseAgreementPolicies object itself.
     */
    public EnterpriseAgreementPolicies withAuthenticationType(EnrollmentAuthLevelState authenticationType) {
        this.authenticationType = authenticationType;
        return this;
    }

    /**
     * Get the accountOwnerViewCharges property: The policy that controls whether account owner can view charges.
     * 
     * @return the accountOwnerViewCharges value.
     */
    public EnrollmentAccountOwnerViewCharges accountOwnerViewCharges() {
        return this.accountOwnerViewCharges;
    }

    /**
     * Set the accountOwnerViewCharges property: The policy that controls whether account owner can view charges.
     * 
     * @param accountOwnerViewCharges the accountOwnerViewCharges value to set.
     * @return the EnterpriseAgreementPolicies object itself.
     */
    public EnterpriseAgreementPolicies
        withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges accountOwnerViewCharges) {
        this.accountOwnerViewCharges = accountOwnerViewCharges;
        return this;
    }

    /**
     * Get the departmentAdminViewCharges property: The policy that controls whether department admin can view charges.
     * 
     * @return the departmentAdminViewCharges value.
     */
    public EnrollmentDepartmentAdminViewCharges departmentAdminViewCharges() {
        return this.departmentAdminViewCharges;
    }

    /**
     * Set the departmentAdminViewCharges property: The policy that controls whether department admin can view charges.
     * 
     * @param departmentAdminViewCharges the departmentAdminViewCharges value to set.
     * @return the EnterpriseAgreementPolicies object itself.
     */
    public EnterpriseAgreementPolicies
        withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges departmentAdminViewCharges) {
        this.departmentAdminViewCharges = departmentAdminViewCharges;
        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("authenticationType",
            this.authenticationType == null ? null : this.authenticationType.toString());
        jsonWriter.writeStringField("accountOwnerViewCharges",
            this.accountOwnerViewCharges == null ? null : this.accountOwnerViewCharges.toString());
        jsonWriter.writeStringField("departmentAdminViewCharges",
            this.departmentAdminViewCharges == null ? null : this.departmentAdminViewCharges.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("authenticationType".equals(fieldName)) {
                    deserializedEnterpriseAgreementPolicies.authenticationType
                        = EnrollmentAuthLevelState.fromString(reader.getString());
                } else if ("accountOwnerViewCharges".equals(fieldName)) {
                    deserializedEnterpriseAgreementPolicies.accountOwnerViewCharges
                        = EnrollmentAccountOwnerViewCharges.fromString(reader.getString());
                } else if ("departmentAdminViewCharges".equals(fieldName)) {
                    deserializedEnterpriseAgreementPolicies.departmentAdminViewCharges
                        = EnrollmentDepartmentAdminViewCharges.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEnterpriseAgreementPolicies;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy