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

com.azure.resourcemanager.billing.implementation.PaymentMethodsImpl 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.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.billing.fluent.PaymentMethodsClient;
import com.azure.resourcemanager.billing.fluent.models.PaymentMethodInner;
import com.azure.resourcemanager.billing.fluent.models.PaymentMethodLinkInner;
import com.azure.resourcemanager.billing.models.PaymentMethod;
import com.azure.resourcemanager.billing.models.PaymentMethodLink;
import com.azure.resourcemanager.billing.models.PaymentMethods;

public final class PaymentMethodsImpl implements PaymentMethods {
    private static final ClientLogger LOGGER = new ClientLogger(PaymentMethodsImpl.class);

    private final PaymentMethodsClient innerClient;

    private final com.azure.resourcemanager.billing.BillingManager serviceManager;

    public PaymentMethodsImpl(PaymentMethodsClient innerClient,
        com.azure.resourcemanager.billing.BillingManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) {
        PagedIterable inner
            = this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new PaymentMethodLinkImpl(inner1, this.manager()));
    }

    public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName,
        Context context) {
        PagedIterable inner
            = this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName, context);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new PaymentMethodLinkImpl(inner1, this.manager()));
    }

    public Response getByBillingProfileWithResponse(String billingAccountName,
        String billingProfileName, String paymentMethodName, Context context) {
        Response inner = this.serviceClient()
            .getByBillingProfileWithResponse(billingAccountName, billingProfileName, paymentMethodName, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                new PaymentMethodLinkImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public PaymentMethodLink getByBillingProfile(String billingAccountName, String billingProfileName,
        String paymentMethodName) {
        PaymentMethodLinkInner inner
            = this.serviceClient().getByBillingProfile(billingAccountName, billingProfileName, paymentMethodName);
        if (inner != null) {
            return new PaymentMethodLinkImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public PagedIterable listByBillingAccount(String billingAccountName) {
        PagedIterable inner = this.serviceClient().listByBillingAccount(billingAccountName);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new PaymentMethodImpl(inner1, this.manager()));
    }

    public PagedIterable listByBillingAccount(String billingAccountName, Context context) {
        PagedIterable inner
            = this.serviceClient().listByBillingAccount(billingAccountName, context);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new PaymentMethodImpl(inner1, this.manager()));
    }

    public Response getByBillingAccountWithResponse(String billingAccountName, String paymentMethodName,
        Context context) {
        Response inner
            = this.serviceClient().getByBillingAccountWithResponse(billingAccountName, paymentMethodName, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                new PaymentMethodImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public PaymentMethod getByBillingAccount(String billingAccountName, String paymentMethodName) {
        PaymentMethodInner inner = this.serviceClient().getByBillingAccount(billingAccountName, paymentMethodName);
        if (inner != null) {
            return new PaymentMethodImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public PagedIterable listByUser() {
        PagedIterable inner = this.serviceClient().listByUser();
        return ResourceManagerUtils.mapPage(inner, inner1 -> new PaymentMethodImpl(inner1, this.manager()));
    }

    public PagedIterable listByUser(Context context) {
        PagedIterable inner = this.serviceClient().listByUser(context);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new PaymentMethodImpl(inner1, this.manager()));
    }

    public Response deleteByUserWithResponse(String paymentMethodName, Context context) {
        return this.serviceClient().deleteByUserWithResponse(paymentMethodName, context);
    }

    public void deleteByUser(String paymentMethodName) {
        this.serviceClient().deleteByUser(paymentMethodName);
    }

    public Response getByUserWithResponse(String paymentMethodName, Context context) {
        Response inner = this.serviceClient().getByUserWithResponse(paymentMethodName, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                new PaymentMethodImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public PaymentMethod getByUser(String paymentMethodName) {
        PaymentMethodInner inner = this.serviceClient().getByUser(paymentMethodName);
        if (inner != null) {
            return new PaymentMethodImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    private PaymentMethodsClient serviceClient() {
        return this.innerClient;
    }

    private com.azure.resourcemanager.billing.BillingManager manager() {
        return this.serviceManager;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy