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

com.azure.resourcemanager.billing.models.InitiateTransferRequest 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 com.azure.resourcemanager.billing.fluent.models.InitiateTransferProperties;
import java.io.IOException;

/**
 * Request parameters to initiate transfer.
 */
@Fluent
public final class InitiateTransferRequest implements JsonSerializable {
    /*
     * Request parameters to initiate transfer.
     */
    private InitiateTransferProperties innerProperties;

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

    /**
     * Get the innerProperties property: Request parameters to initiate transfer.
     * 
     * @return the innerProperties value.
     */
    private InitiateTransferProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the recipientEmailId property: The email ID of the recipient to whom the transfer request is sent.
     * 
     * @return the recipientEmailId value.
     */
    public String recipientEmailId() {
        return this.innerProperties() == null ? null : this.innerProperties().recipientEmailId();
    }

    /**
     * Set the recipientEmailId property: The email ID of the recipient to whom the transfer request is sent.
     * 
     * @param recipientEmailId the recipientEmailId value to set.
     * @return the InitiateTransferRequest object itself.
     */
    public InitiateTransferRequest withRecipientEmailId(String recipientEmailId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new InitiateTransferProperties();
        }
        this.innerProperties().withRecipientEmailId(recipientEmailId);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("properties".equals(fieldName)) {
                    deserializedInitiateTransferRequest.innerProperties = InitiateTransferProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedInitiateTransferRequest;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy