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

com.azure.resourcemanager.billing.implementation.SavingsPlanOrdersImpl 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.SavingsPlanOrdersClient;
import com.azure.resourcemanager.billing.fluent.models.SavingsPlanOrderModelInner;
import com.azure.resourcemanager.billing.models.SavingsPlanOrderModel;
import com.azure.resourcemanager.billing.models.SavingsPlanOrders;

public final class SavingsPlanOrdersImpl implements SavingsPlanOrders {
    private static final ClientLogger LOGGER = new ClientLogger(SavingsPlanOrdersImpl.class);

    private final SavingsPlanOrdersClient innerClient;

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

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

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

    public SavingsPlanOrderModel getByBillingAccount(String billingAccountName, String savingsPlanOrderId) {
        SavingsPlanOrderModelInner inner
            = this.serviceClient().getByBillingAccount(billingAccountName, savingsPlanOrderId);
        if (inner != null) {
            return new SavingsPlanOrderModelImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy