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

com.azure.resourcemanager.billing.implementation.BillingPermissionsImpl 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.BillingPermissionsClient;
import com.azure.resourcemanager.billing.fluent.models.BillingPermissionInner;
import com.azure.resourcemanager.billing.fluent.models.CheckAccessResponseInner;
import com.azure.resourcemanager.billing.models.BillingPermission;
import com.azure.resourcemanager.billing.models.BillingPermissions;
import com.azure.resourcemanager.billing.models.CheckAccessRequest;
import com.azure.resourcemanager.billing.models.CheckAccessResponse;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public final class BillingPermissionsImpl implements BillingPermissions {
    private static final ClientLogger LOGGER = new ClientLogger(BillingPermissionsImpl.class);

    private final BillingPermissionsClient innerClient;

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

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

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

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

    public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) {
        PagedIterable inner
            = this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new BillingPermissionImpl(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 BillingPermissionImpl(inner1, this.manager()));
    }

    public Response> checkAccessByBillingProfileWithResponse(String billingAccountName,
        String billingProfileName, CheckAccessRequest parameters, Context context) {
        Response> inner = this.serviceClient()
            .checkAccessByBillingProfileWithResponse(billingAccountName, billingProfileName, parameters, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                inner.getValue()
                    .stream()
                    .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                    .collect(Collectors.toList()));
        } else {
            return null;
        }
    }

    public List checkAccessByBillingProfile(String billingAccountName, String billingProfileName,
        CheckAccessRequest parameters) {
        List inner
            = this.serviceClient().checkAccessByBillingProfile(billingAccountName, billingProfileName, parameters);
        if (inner != null) {
            return Collections.unmodifiableList(inner.stream()
                .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                .collect(Collectors.toList()));
        } else {
            return Collections.emptyList();
        }
    }

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

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

    public Response> checkAccessByCustomerWithResponse(String billingAccountName,
        String billingProfileName, String customerName, CheckAccessRequest parameters, Context context) {
        Response> inner = this.serviceClient()
            .checkAccessByCustomerWithResponse(billingAccountName, billingProfileName, customerName, parameters,
                context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                inner.getValue()
                    .stream()
                    .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                    .collect(Collectors.toList()));
        } else {
            return null;
        }
    }

    public List checkAccessByCustomer(String billingAccountName, String billingProfileName,
        String customerName, CheckAccessRequest parameters) {
        List inner = this.serviceClient()
            .checkAccessByCustomer(billingAccountName, billingProfileName, customerName, parameters);
        if (inner != null) {
            return Collections.unmodifiableList(inner.stream()
                .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                .collect(Collectors.toList()));
        } else {
            return Collections.emptyList();
        }
    }

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

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

    public Response> checkAccessByInvoiceSectionWithResponse(String billingAccountName,
        String billingProfileName, String invoiceSectionName, CheckAccessRequest parameters, Context context) {
        Response> inner = this.serviceClient()
            .checkAccessByInvoiceSectionWithResponse(billingAccountName, billingProfileName, invoiceSectionName,
                parameters, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                inner.getValue()
                    .stream()
                    .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                    .collect(Collectors.toList()));
        } else {
            return null;
        }
    }

    public List checkAccessByInvoiceSection(String billingAccountName, String billingProfileName,
        String invoiceSectionName, CheckAccessRequest parameters) {
        List inner = this.serviceClient()
            .checkAccessByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, parameters);
        if (inner != null) {
            return Collections.unmodifiableList(inner.stream()
                .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                .collect(Collectors.toList()));
        } else {
            return Collections.emptyList();
        }
    }

    public Response> checkAccessByBillingAccountWithResponse(String billingAccountName,
        CheckAccessRequest parameters, Context context) {
        Response> inner
            = this.serviceClient().checkAccessByBillingAccountWithResponse(billingAccountName, parameters, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                inner.getValue()
                    .stream()
                    .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                    .collect(Collectors.toList()));
        } else {
            return null;
        }
    }

    public List checkAccessByBillingAccount(String billingAccountName,
        CheckAccessRequest parameters) {
        List inner
            = this.serviceClient().checkAccessByBillingAccount(billingAccountName, parameters);
        if (inner != null) {
            return Collections.unmodifiableList(inner.stream()
                .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                .collect(Collectors.toList()));
        } else {
            return Collections.emptyList();
        }
    }

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

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

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

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

    public Response> checkAccessByDepartmentWithResponse(String billingAccountName,
        String departmentName, CheckAccessRequest parameters, Context context) {
        Response> inner = this.serviceClient()
            .checkAccessByDepartmentWithResponse(billingAccountName, departmentName, parameters, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                inner.getValue()
                    .stream()
                    .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                    .collect(Collectors.toList()));
        } else {
            return null;
        }
    }

    public List checkAccessByDepartment(String billingAccountName, String departmentName,
        CheckAccessRequest parameters) {
        List inner
            = this.serviceClient().checkAccessByDepartment(billingAccountName, departmentName, parameters);
        if (inner != null) {
            return Collections.unmodifiableList(inner.stream()
                .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                .collect(Collectors.toList()));
        } else {
            return Collections.emptyList();
        }
    }

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

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

    public Response> checkAccessByEnrollmentAccountWithResponse(String billingAccountName,
        String enrollmentAccountName, CheckAccessRequest parameters, Context context) {
        Response> inner = this.serviceClient()
            .checkAccessByEnrollmentAccountWithResponse(billingAccountName, enrollmentAccountName, parameters, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                inner.getValue()
                    .stream()
                    .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                    .collect(Collectors.toList()));
        } else {
            return null;
        }
    }

    public List checkAccessByEnrollmentAccount(String billingAccountName,
        String enrollmentAccountName, CheckAccessRequest parameters) {
        List inner = this.serviceClient()
            .checkAccessByEnrollmentAccount(billingAccountName, enrollmentAccountName, parameters);
        if (inner != null) {
            return Collections.unmodifiableList(inner.stream()
                .map(inner1 -> new CheckAccessResponseImpl(inner1, this.manager()))
                .collect(Collectors.toList()));
        } else {
            return Collections.emptyList();
        }
    }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy