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

com.azure.resourcemanager.billing.implementation.BillingProfilesImpl 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.BillingProfilesClient;
import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner;
import com.azure.resourcemanager.billing.fluent.models.DeleteBillingProfileEligibilityResultInner;
import com.azure.resourcemanager.billing.models.BillingProfile;
import com.azure.resourcemanager.billing.models.BillingProfiles;
import com.azure.resourcemanager.billing.models.DeleteBillingProfileEligibilityResult;

public final class BillingProfilesImpl implements BillingProfiles {
    private static final ClientLogger LOGGER = new ClientLogger(BillingProfilesImpl.class);

    private final BillingProfilesClient innerClient;

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

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

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

    public DeleteBillingProfileEligibilityResult validateDeleteEligibility(String billingAccountName,
        String billingProfileName) {
        DeleteBillingProfileEligibilityResultInner inner
            = this.serviceClient().validateDeleteEligibility(billingAccountName, billingProfileName);
        if (inner != null) {
            return new DeleteBillingProfileEligibilityResultImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

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

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

    public BillingProfile get(String billingAccountName, String billingProfileName) {
        BillingProfileInner inner = this.serviceClient().get(billingAccountName, billingProfileName);
        if (inner != null) {
            return new BillingProfileImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public BillingProfile createOrUpdate(String billingAccountName, String billingProfileName,
        BillingProfileInner parameters) {
        BillingProfileInner inner
            = this.serviceClient().createOrUpdate(billingAccountName, billingProfileName, parameters);
        if (inner != null) {
            return new BillingProfileImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public BillingProfile createOrUpdate(String billingAccountName, String billingProfileName,
        BillingProfileInner parameters, Context context) {
        BillingProfileInner inner
            = this.serviceClient().createOrUpdate(billingAccountName, billingProfileName, parameters, context);
        if (inner != null) {
            return new BillingProfileImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy