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

com.azure.resourcemanager.billing.implementation.AssociatedTenantsImpl 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.AssociatedTenantsClient;
import com.azure.resourcemanager.billing.fluent.models.AssociatedTenantInner;
import com.azure.resourcemanager.billing.models.AssociatedTenant;
import com.azure.resourcemanager.billing.models.AssociatedTenants;

public final class AssociatedTenantsImpl implements AssociatedTenants {
    private static final ClientLogger LOGGER = new ClientLogger(AssociatedTenantsImpl.class);

    private final AssociatedTenantsClient innerClient;

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

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

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

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

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

    public AssociatedTenant get(String billingAccountName, String associatedTenantName) {
        AssociatedTenantInner inner = this.serviceClient().get(billingAccountName, associatedTenantName);
        if (inner != null) {
            return new AssociatedTenantImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public AssociatedTenant createOrUpdate(String billingAccountName, String associatedTenantName,
        AssociatedTenantInner parameters) {
        AssociatedTenantInner inner
            = this.serviceClient().createOrUpdate(billingAccountName, associatedTenantName, parameters);
        if (inner != null) {
            return new AssociatedTenantImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public AssociatedTenant createOrUpdate(String billingAccountName, String associatedTenantName,
        AssociatedTenantInner parameters, Context context) {
        AssociatedTenantInner inner
            = this.serviceClient().createOrUpdate(billingAccountName, associatedTenantName, parameters, context);
        if (inner != null) {
            return new AssociatedTenantImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy