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

com.azure.resourcemanager.billing.implementation.InvoiceSectionsImpl 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.InvoiceSectionsClient;
import com.azure.resourcemanager.billing.fluent.models.DeleteInvoiceSectionEligibilityResultInner;
import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner;
import com.azure.resourcemanager.billing.models.DeleteInvoiceSectionEligibilityResult;
import com.azure.resourcemanager.billing.models.InvoiceSection;
import com.azure.resourcemanager.billing.models.InvoiceSections;

public final class InvoiceSectionsImpl implements InvoiceSections {
    private static final ClientLogger LOGGER = new ClientLogger(InvoiceSectionsImpl.class);

    private final InvoiceSectionsClient innerClient;

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

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

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

    public DeleteInvoiceSectionEligibilityResult validateDeleteEligibility(String billingAccountName,
        String billingProfileName, String invoiceSectionName) {
        DeleteInvoiceSectionEligibilityResultInner inner = this.serviceClient()
            .validateDeleteEligibility(billingAccountName, billingProfileName, invoiceSectionName);
        if (inner != null) {
            return new DeleteInvoiceSectionEligibilityResultImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public void delete(String billingAccountName, String billingProfileName, String invoiceSectionName) {
        this.serviceClient().delete(billingAccountName, billingProfileName, invoiceSectionName);
    }

    public void delete(String billingAccountName, String billingProfileName, String invoiceSectionName,
        Context context) {
        this.serviceClient().delete(billingAccountName, billingProfileName, invoiceSectionName, context);
    }

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

    public InvoiceSection get(String billingAccountName, String billingProfileName, String invoiceSectionName) {
        InvoiceSectionInner inner
            = this.serviceClient().get(billingAccountName, billingProfileName, invoiceSectionName);
        if (inner != null) {
            return new InvoiceSectionImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public InvoiceSection createOrUpdate(String billingAccountName, String billingProfileName,
        String invoiceSectionName, InvoiceSectionInner parameters) {
        InvoiceSectionInner inner = this.serviceClient()
            .createOrUpdate(billingAccountName, billingProfileName, invoiceSectionName, parameters);
        if (inner != null) {
            return new InvoiceSectionImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public InvoiceSection createOrUpdate(String billingAccountName, String billingProfileName,
        String invoiceSectionName, InvoiceSectionInner parameters, Context context) {
        InvoiceSectionInner inner = this.serviceClient()
            .createOrUpdate(billingAccountName, billingProfileName, invoiceSectionName, parameters, context);
        if (inner != null) {
            return new InvoiceSectionImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName,
        Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search,
        Context context) {
        PagedIterable inner = this.serviceClient()
            .listByBillingProfile(billingAccountName, billingProfileName, includeDeleted, filter, orderBy, top, skip,
                count, search, context);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new InvoiceSectionImpl(inner1, this.manager()));
    }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy