
com.azure.resourcemanager.billing.implementation.PartnerTransfersClientImpl 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.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.billing.fluent.PartnerTransfersClient;
import com.azure.resourcemanager.billing.fluent.models.PartnerTransferDetailsInner;
import com.azure.resourcemanager.billing.models.PartnerInitiateTransferRequest;
import com.azure.resourcemanager.billing.models.PartnerTransferDetailsListResult;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in PartnerTransfersClient.
*/
public final class PartnerTransfersClientImpl implements PartnerTransfersClient {
/**
* The proxy service used to perform REST calls.
*/
private final PartnerTransfersService service;
/**
* The service client containing this operation class.
*/
private final BillingManagementClientImpl client;
/**
* Initializes an instance of PartnerTransfersClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
PartnerTransfersClientImpl(BillingManagementClientImpl client) {
this.service
= RestProxy.create(PartnerTransfersService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for BillingManagementClientPartnerTransfers to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "BillingManagementCli")
public interface PartnerTransfersService {
@Headers({ "Content-Type: application/json" })
@Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("billingAccountName") String billingAccountName,
@PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName,
@PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> initiate(@HostParam("$host") String endpoint,
@PathParam("billingAccountName") String billingAccountName,
@PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName,
@PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion,
@BodyParam("application/json") PartnerInitiateTransferRequest parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}/cancel")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> cancel(@HostParam("$host") String endpoint,
@PathParam("billingAccountName") String billingAccountName,
@PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName,
@PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("billingAccountName") String billingAccountName,
@PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a transfer request by ID along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String billingAccountName,
String billingProfileName, String customerName, String transferName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (billingAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."));
}
if (billingProfileName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."));
}
if (customerName == null) {
return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null."));
}
if (transferName == null) {
return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), billingAccountName, billingProfileName,
customerName, transferName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a transfer request by ID along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String billingAccountName,
String billingProfileName, String customerName, String transferName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (billingAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."));
}
if (billingProfileName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."));
}
if (customerName == null) {
return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null."));
}
if (transferName == null) {
return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName,
transferName, this.client.getApiVersion(), accept, context);
}
/**
* Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a transfer request by ID on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String billingAccountName, String billingProfileName,
String customerName, String transferName) {
return getWithResponseAsync(billingAccountName, billingProfileName, customerName, transferName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a transfer request by ID along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String billingAccountName, String billingProfileName,
String customerName, String transferName, Context context) {
return getWithResponseAsync(billingAccountName, billingProfileName, customerName, transferName, context)
.block();
}
/**
* Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a transfer request by ID.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PartnerTransferDetailsInner get(String billingAccountName, String billingProfileName, String customerName,
String transferName) {
return getWithResponse(billingAccountName, billingProfileName, customerName, transferName, Context.NONE)
.getValue();
}
/**
* Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions.
* The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @param parameters Request parameters that are provided to the initiate transfer operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> initiateWithResponseAsync(String billingAccountName,
String billingProfileName, String customerName, String transferName,
PartnerInitiateTransferRequest parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (billingAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."));
}
if (billingProfileName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."));
}
if (customerName == null) {
return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null."));
}
if (transferName == null) {
return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.initiate(this.client.getEndpoint(), billingAccountName, billingProfileName,
customerName, transferName, this.client.getApiVersion(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions.
* The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @param parameters Request parameters that are provided to the initiate transfer operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> initiateWithResponseAsync(String billingAccountName,
String billingProfileName, String customerName, String transferName, PartnerInitiateTransferRequest parameters,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (billingAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."));
}
if (billingProfileName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."));
}
if (customerName == null) {
return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null."));
}
if (transferName == null) {
return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.initiate(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName,
transferName, this.client.getApiVersion(), parameters, accept, context);
}
/**
* Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions.
* The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @param parameters Request parameters that are provided to the initiate transfer operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono initiateAsync(String billingAccountName, String billingProfileName,
String customerName, String transferName, PartnerInitiateTransferRequest parameters) {
return initiateWithResponseAsync(billingAccountName, billingProfileName, customerName, transferName, parameters)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions.
* The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @param parameters Request parameters that are provided to the initiate transfer operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response initiateWithResponse(String billingAccountName,
String billingProfileName, String customerName, String transferName, PartnerInitiateTransferRequest parameters,
Context context) {
return initiateWithResponseAsync(billingAccountName, billingProfileName, customerName, transferName, parameters,
context).block();
}
/**
* Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions.
* The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @param parameters Request parameters that are provided to the initiate transfer operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PartnerTransferDetailsInner initiate(String billingAccountName, String billingProfileName,
String customerName, String transferName, PartnerInitiateTransferRequest parameters) {
return initiateWithResponse(billingAccountName, billingProfileName, customerName, transferName, parameters,
Context.NONE).getValue();
}
/**
* Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> cancelWithResponseAsync(String billingAccountName,
String billingProfileName, String customerName, String transferName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (billingAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."));
}
if (billingProfileName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."));
}
if (customerName == null) {
return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null."));
}
if (transferName == null) {
return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.cancel(this.client.getEndpoint(), billingAccountName, billingProfileName,
customerName, transferName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> cancelWithResponseAsync(String billingAccountName,
String billingProfileName, String customerName, String transferName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (billingAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."));
}
if (billingProfileName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."));
}
if (customerName == null) {
return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null."));
}
if (transferName == null) {
return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.cancel(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName,
transferName, this.client.getApiVersion(), accept, context);
}
/**
* Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono cancelAsync(String billingAccountName, String billingProfileName,
String customerName, String transferName) {
return cancelWithResponseAsync(billingAccountName, billingProfileName, customerName, transferName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response cancelWithResponse(String billingAccountName,
String billingProfileName, String customerName, String transferName, Context context) {
return cancelWithResponseAsync(billingAccountName, billingProfileName, customerName, transferName, context)
.block();
}
/**
* Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft
* Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param transferName The ID that uniquely identifies a transfer request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return details of the transfer.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PartnerTransferDetailsInner cancel(String billingAccountName, String billingProfileName, String customerName,
String transferName) {
return cancelWithResponse(billingAccountName, billingProfileName, customerName, transferName, Context.NONE)
.getValue();
}
/**
* Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with
* agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of transfers initiated by partner along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String billingAccountName,
String billingProfileName, String customerName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (billingAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."));
}
if (billingProfileName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."));
}
if (customerName == null) {
return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), billingAccountName, billingProfileName,
customerName, this.client.getApiVersion(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with
* agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of transfers initiated by partner along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String billingAccountName,
String billingProfileName, String customerName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (billingAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."));
}
if (billingProfileName == null) {
return Mono
.error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."));
}
if (customerName == null) {
return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName,
this.client.getApiVersion(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with
* agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of transfers initiated by partner as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String billingAccountName, String billingProfileName,
String customerName) {
return new PagedFlux<>(() -> listSinglePageAsync(billingAccountName, billingProfileName, customerName),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with
* agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of transfers initiated by partner as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String billingAccountName, String billingProfileName,
String customerName, Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(billingAccountName, billingProfileName, customerName, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with
* agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of transfers initiated by partner as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String billingAccountName, String billingProfileName,
String customerName) {
return new PagedIterable<>(listAsync(billingAccountName, billingProfileName, customerName));
}
/**
* Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with
* agreement type Microsoft Partner Agreement.
*
* @param billingAccountName The ID that uniquely identifies a billing account.
* @param billingProfileName The ID that uniquely identifies a billing profile.
* @param customerName The ID that uniquely identifies a customer.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of transfers initiated by partner as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String billingAccountName, String billingProfileName,
String customerName, Context context) {
return new PagedIterable<>(listAsync(billingAccountName, billingProfileName, customerName, context));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of transfers initiated by partner along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of transfers initiated by partner along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy