
com.azure.resourcemanager.billing.models.BillingProfilePolicyProperties 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;
/**
* A policy at billing profile scope.
*/
@Fluent
public final class BillingProfilePolicyProperties implements JsonSerializable {
/*
* The provisioning state of the resource during a long-running operation.
*/
private ProvisioningState provisioningState;
/*
* The policies for Enterprise Agreement enrollments.
*/
private BillingProfilePolicyPropertiesEnterpriseAgreementPolicies enterpriseAgreementPolicies;
/*
* The policy that controls invoice section label management at invoice section scope. This is allowed by default.
*/
private InvoiceSectionLabelManagementPolicy invoiceSectionLabelManagement;
/*
* The policy that controls whether Azure marketplace purchases are allowed.
*/
private MarketplacePurchasesPolicy marketplacePurchases;
/*
* The policy that controls whether Azure reservation purchases are allowed.
*/
private ReservationPurchasesPolicy reservationPurchases;
/*
* The policy that controls whether users with Azure savings plan purchase are allowed.
*/
private SavingsPlanPurchasesPolicy savingsPlanPurchases;
/*
* The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices.
*/
private ViewChargesPolicy viewCharges;
/*
* List of all policies defined at the billing scope.
*/
private List policies;
/**
* Creates an instance of BillingProfilePolicyProperties class.
*/
public BillingProfilePolicyProperties() {
}
/**
* Get the provisioningState property: The provisioning state of the resource during a long-running operation.
*
* @return the provisioningState value.
*/
public ProvisioningState provisioningState() {
return this.provisioningState;
}
/**
* Get the enterpriseAgreementPolicies property: The policies for Enterprise Agreement enrollments.
*
* @return the enterpriseAgreementPolicies value.
*/
public BillingProfilePolicyPropertiesEnterpriseAgreementPolicies enterpriseAgreementPolicies() {
return this.enterpriseAgreementPolicies;
}
/**
* Set the enterpriseAgreementPolicies property: The policies for Enterprise Agreement enrollments.
*
* @param enterpriseAgreementPolicies the enterpriseAgreementPolicies value to set.
* @return the BillingProfilePolicyProperties object itself.
*/
public BillingProfilePolicyProperties withEnterpriseAgreementPolicies(
BillingProfilePolicyPropertiesEnterpriseAgreementPolicies enterpriseAgreementPolicies) {
this.enterpriseAgreementPolicies = enterpriseAgreementPolicies;
return this;
}
/**
* Get the invoiceSectionLabelManagement property: The policy that controls invoice section label management at
* invoice section scope. This is allowed by default.
*
* @return the invoiceSectionLabelManagement value.
*/
public InvoiceSectionLabelManagementPolicy invoiceSectionLabelManagement() {
return this.invoiceSectionLabelManagement;
}
/**
* Set the invoiceSectionLabelManagement property: The policy that controls invoice section label management at
* invoice section scope. This is allowed by default.
*
* @param invoiceSectionLabelManagement the invoiceSectionLabelManagement value to set.
* @return the BillingProfilePolicyProperties object itself.
*/
public BillingProfilePolicyProperties
withInvoiceSectionLabelManagement(InvoiceSectionLabelManagementPolicy invoiceSectionLabelManagement) {
this.invoiceSectionLabelManagement = invoiceSectionLabelManagement;
return this;
}
/**
* Get the marketplacePurchases property: The policy that controls whether Azure marketplace purchases are allowed.
*
* @return the marketplacePurchases value.
*/
public MarketplacePurchasesPolicy marketplacePurchases() {
return this.marketplacePurchases;
}
/**
* Set the marketplacePurchases property: The policy that controls whether Azure marketplace purchases are allowed.
*
* @param marketplacePurchases the marketplacePurchases value to set.
* @return the BillingProfilePolicyProperties object itself.
*/
public BillingProfilePolicyProperties withMarketplacePurchases(MarketplacePurchasesPolicy marketplacePurchases) {
this.marketplacePurchases = marketplacePurchases;
return this;
}
/**
* Get the reservationPurchases property: The policy that controls whether Azure reservation purchases are allowed.
*
* @return the reservationPurchases value.
*/
public ReservationPurchasesPolicy reservationPurchases() {
return this.reservationPurchases;
}
/**
* Set the reservationPurchases property: The policy that controls whether Azure reservation purchases are allowed.
*
* @param reservationPurchases the reservationPurchases value to set.
* @return the BillingProfilePolicyProperties object itself.
*/
public BillingProfilePolicyProperties withReservationPurchases(ReservationPurchasesPolicy reservationPurchases) {
this.reservationPurchases = reservationPurchases;
return this;
}
/**
* Get the savingsPlanPurchases property: The policy that controls whether users with Azure savings plan purchase
* are allowed.
*
* @return the savingsPlanPurchases value.
*/
public SavingsPlanPurchasesPolicy savingsPlanPurchases() {
return this.savingsPlanPurchases;
}
/**
* Set the savingsPlanPurchases property: The policy that controls whether users with Azure savings plan purchase
* are allowed.
*
* @param savingsPlanPurchases the savingsPlanPurchases value to set.
* @return the BillingProfilePolicyProperties object itself.
*/
public BillingProfilePolicyProperties withSavingsPlanPurchases(SavingsPlanPurchasesPolicy savingsPlanPurchases) {
this.savingsPlanPurchases = savingsPlanPurchases;
return this;
}
/**
* Get the viewCharges property: The policy that controls whether the users in customer's organization can view
* charges at pay-as-you-go prices.
*
* @return the viewCharges value.
*/
public ViewChargesPolicy viewCharges() {
return this.viewCharges;
}
/**
* Set the viewCharges property: The policy that controls whether the users in customer's organization can view
* charges at pay-as-you-go prices.
*
* @param viewCharges the viewCharges value to set.
* @return the BillingProfilePolicyProperties object itself.
*/
public BillingProfilePolicyProperties withViewCharges(ViewChargesPolicy viewCharges) {
this.viewCharges = viewCharges;
return this;
}
/**
* Get the policies property: List of all policies defined at the billing scope.
*
* @return the policies value.
*/
public List policies() {
return this.policies;
}
/**
* Set the policies property: List of all policies defined at the billing scope.
*
* @param policies the policies value to set.
* @return the BillingProfilePolicyProperties object itself.
*/
public BillingProfilePolicyProperties withPolicies(List policies) {
this.policies = policies;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (enterpriseAgreementPolicies() != null) {
enterpriseAgreementPolicies().validate();
}
if (policies() != null) {
policies().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("enterpriseAgreementPolicies", this.enterpriseAgreementPolicies);
jsonWriter.writeStringField("invoiceSectionLabelManagement",
this.invoiceSectionLabelManagement == null ? null : this.invoiceSectionLabelManagement.toString());
jsonWriter.writeStringField("marketplacePurchases",
this.marketplacePurchases == null ? null : this.marketplacePurchases.toString());
jsonWriter.writeStringField("reservationPurchases",
this.reservationPurchases == null ? null : this.reservationPurchases.toString());
jsonWriter.writeStringField("savingsPlanPurchases",
this.savingsPlanPurchases == null ? null : this.savingsPlanPurchases.toString());
jsonWriter.writeStringField("viewCharges", this.viewCharges == null ? null : this.viewCharges.toString());
jsonWriter.writeArrayField("policies", this.policies, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of BillingProfilePolicyProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of BillingProfilePolicyProperties 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 BillingProfilePolicyProperties.
*/
public static BillingProfilePolicyProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
BillingProfilePolicyProperties deserializedBillingProfilePolicyProperties
= new BillingProfilePolicyProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("provisioningState".equals(fieldName)) {
deserializedBillingProfilePolicyProperties.provisioningState
= ProvisioningState.fromString(reader.getString());
} else if ("enterpriseAgreementPolicies".equals(fieldName)) {
deserializedBillingProfilePolicyProperties.enterpriseAgreementPolicies
= BillingProfilePolicyPropertiesEnterpriseAgreementPolicies.fromJson(reader);
} else if ("invoiceSectionLabelManagement".equals(fieldName)) {
deserializedBillingProfilePolicyProperties.invoiceSectionLabelManagement
= InvoiceSectionLabelManagementPolicy.fromString(reader.getString());
} else if ("marketplacePurchases".equals(fieldName)) {
deserializedBillingProfilePolicyProperties.marketplacePurchases
= MarketplacePurchasesPolicy.fromString(reader.getString());
} else if ("reservationPurchases".equals(fieldName)) {
deserializedBillingProfilePolicyProperties.reservationPurchases
= ReservationPurchasesPolicy.fromString(reader.getString());
} else if ("savingsPlanPurchases".equals(fieldName)) {
deserializedBillingProfilePolicyProperties.savingsPlanPurchases
= SavingsPlanPurchasesPolicy.fromString(reader.getString());
} else if ("viewCharges".equals(fieldName)) {
deserializedBillingProfilePolicyProperties.viewCharges
= ViewChargesPolicy.fromString(reader.getString());
} else if ("policies".equals(fieldName)) {
List policies = reader.readArray(reader1 -> PolicySummary.fromJson(reader1));
deserializedBillingProfilePolicyProperties.policies = policies;
} else {
reader.skipChildren();
}
}
return deserializedBillingProfilePolicyProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy