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

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

/**
 * An invoice section.
 */
@Fluent
public final class InvoiceSectionProperties implements JsonSerializable {
    /*
     * The provisioning state of the resource during a long-running operation.
     */
    private ProvisioningState provisioningState;

    /*
     * The name of the invoice section.
     */
    private String displayName;

    /*
     * Identifies the status of an invoice section.
     */
    private InvoiceSectionState state;

    /*
     * Reason for the specified invoice section status.
     */
    private InvoiceSectionStateReasonCode reasonCode;

    /*
     * The system generated unique identifier for an invoice section.
     */
    private String systemId;

    /*
     * Identifies the cloud environments that are associated with an invoice section. This is a system managed optional
     * field and gets updated as the invoice section gets associated with accounts in various clouds.
     */
    private String targetCloud;

    /*
     * Dictionary of metadata associated with the resource. Maximum key/value length supported of 256 characters.
     * Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /
     */
    private Map tags;

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

    /**
     * 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 displayName property: The name of the invoice section.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The name of the invoice section.
     * 
     * @param displayName the displayName value to set.
     * @return the InvoiceSectionProperties object itself.
     */
    public InvoiceSectionProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the state property: Identifies the status of an invoice section.
     * 
     * @return the state value.
     */
    public InvoiceSectionState state() {
        return this.state;
    }

    /**
     * Set the state property: Identifies the status of an invoice section.
     * 
     * @param state the state value to set.
     * @return the InvoiceSectionProperties object itself.
     */
    public InvoiceSectionProperties withState(InvoiceSectionState state) {
        this.state = state;
        return this;
    }

    /**
     * Get the reasonCode property: Reason for the specified invoice section status.
     * 
     * @return the reasonCode value.
     */
    public InvoiceSectionStateReasonCode reasonCode() {
        return this.reasonCode;
    }

    /**
     * Set the reasonCode property: Reason for the specified invoice section status.
     * 
     * @param reasonCode the reasonCode value to set.
     * @return the InvoiceSectionProperties object itself.
     */
    public InvoiceSectionProperties withReasonCode(InvoiceSectionStateReasonCode reasonCode) {
        this.reasonCode = reasonCode;
        return this;
    }

    /**
     * Get the systemId property: The system generated unique identifier for an invoice section.
     * 
     * @return the systemId value.
     */
    public String systemId() {
        return this.systemId;
    }

    /**
     * Get the targetCloud property: Identifies the cloud environments that are associated with an invoice section. This
     * is a system managed optional field and gets updated as the invoice section gets associated with accounts in
     * various clouds.
     * 
     * @return the targetCloud value.
     */
    public String targetCloud() {
        return this.targetCloud;
    }

    /**
     * Set the targetCloud property: Identifies the cloud environments that are associated with an invoice section. This
     * is a system managed optional field and gets updated as the invoice section gets associated with accounts in
     * various clouds.
     * 
     * @param targetCloud the targetCloud value to set.
     * @return the InvoiceSectionProperties object itself.
     */
    public InvoiceSectionProperties withTargetCloud(String targetCloud) {
        this.targetCloud = targetCloud;
        return this;
    }

    /**
     * Get the tags property: Dictionary of metadata associated with the resource. Maximum key/value length supported of
     * 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /.
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Dictionary of metadata associated with the resource. Maximum key/value length supported of
     * 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /.
     * 
     * @param tags the tags value to set.
     * @return the InvoiceSectionProperties object itself.
     */
    public InvoiceSectionProperties withTags(Map tags) {
        this.tags = tags;
        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("displayName", this.displayName);
        jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString());
        jsonWriter.writeStringField("reasonCode", this.reasonCode == null ? null : this.reasonCode.toString());
        jsonWriter.writeStringField("targetCloud", this.targetCloud);
        jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("provisioningState".equals(fieldName)) {
                    deserializedInvoiceSectionProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("displayName".equals(fieldName)) {
                    deserializedInvoiceSectionProperties.displayName = reader.getString();
                } else if ("state".equals(fieldName)) {
                    deserializedInvoiceSectionProperties.state = InvoiceSectionState.fromString(reader.getString());
                } else if ("reasonCode".equals(fieldName)) {
                    deserializedInvoiceSectionProperties.reasonCode
                        = InvoiceSectionStateReasonCode.fromString(reader.getString());
                } else if ("systemId".equals(fieldName)) {
                    deserializedInvoiceSectionProperties.systemId = reader.getString();
                } else if ("targetCloud".equals(fieldName)) {
                    deserializedInvoiceSectionProperties.targetCloud = reader.getString();
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedInvoiceSectionProperties.tags = tags;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedInvoiceSectionProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy