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

com.azure.resourcemanager.billing.implementation.SavingsPlansImpl 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.SavingsPlansClient;
import com.azure.resourcemanager.billing.fluent.models.SavingsPlanModelInner;
import com.azure.resourcemanager.billing.fluent.models.SavingsPlanValidateResponseInner;
import com.azure.resourcemanager.billing.models.SavingsPlanModel;
import com.azure.resourcemanager.billing.models.SavingsPlans;
import com.azure.resourcemanager.billing.models.SavingsPlanUpdateRequest;
import com.azure.resourcemanager.billing.models.SavingsPlanUpdateValidateRequest;
import com.azure.resourcemanager.billing.models.SavingsPlanValidateResponse;

public final class SavingsPlansImpl implements SavingsPlans {
    private static final ClientLogger LOGGER = new ClientLogger(SavingsPlansImpl.class);

    private final SavingsPlansClient innerClient;

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

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

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

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

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

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

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

    public SavingsPlanModel getByBillingAccount(String billingAccountName, String savingsPlanOrderId,
        String savingsPlanId) {
        SavingsPlanModelInner inner
            = this.serviceClient().getByBillingAccount(billingAccountName, savingsPlanOrderId, savingsPlanId);
        if (inner != null) {
            return new SavingsPlanModelImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public SavingsPlanModel updateByBillingAccount(String billingAccountName, String savingsPlanOrderId,
        String savingsPlanId, SavingsPlanUpdateRequest body) {
        SavingsPlanModelInner inner
            = this.serviceClient().updateByBillingAccount(billingAccountName, savingsPlanOrderId, savingsPlanId, body);
        if (inner != null) {
            return new SavingsPlanModelImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public SavingsPlanModel updateByBillingAccount(String billingAccountName, String savingsPlanOrderId,
        String savingsPlanId, SavingsPlanUpdateRequest body, Context context) {
        SavingsPlanModelInner inner = this.serviceClient()
            .updateByBillingAccount(billingAccountName, savingsPlanOrderId, savingsPlanId, body, context);
        if (inner != null) {
            return new SavingsPlanModelImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    public SavingsPlanValidateResponse validateUpdateByBillingAccount(String billingAccountName,
        String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateValidateRequest body) {
        SavingsPlanValidateResponseInner inner = this.serviceClient()
            .validateUpdateByBillingAccount(billingAccountName, savingsPlanOrderId, savingsPlanId, body);
        if (inner != null) {
            return new SavingsPlanValidateResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy