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

com.microsoft.azure.management.resources.implementation.TenantsImpl Maven / Gradle / Ivy

There is a newer version: 1.41.4
Show newest version
/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 */

package com.microsoft.azure.management.resources.implementation;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.management.resources.Tenant;
import com.microsoft.azure.management.resources.Tenants;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.ReadableWrappersImpl;
import com.microsoft.azure.management.resources.fluentcore.utils.PagedListConverter;
import rx.Observable;
import rx.functions.Func1;

/**
 * Implementation for {@link Tenants}.
 */
final class TenantsImpl
        implements Tenants {
    private final TenantsInner client;

    TenantsImpl(final TenantsInner client) {
        this.client = client;
    }

    @Override
    public PagedList list() {
        PagedListConverter converter = new PagedListConverter() {
            @Override
            public Observable typeConvertAsync(TenantIdDescriptionInner tenantInner) {
                return Observable.just((Tenant) new TenantImpl(tenantInner));
            }
        };
        return converter.convert(client.list());
    }

    @Override
    public Observable listAsync() {
        return ReadableWrappersImpl.convertPageToInnerAsync(client.listAsync()).map(new Func1() {
            @Override
            public Tenant call(TenantIdDescriptionInner tenantIdDescriptionInners) {
                return new TenantImpl(tenantIdDescriptionInners);
            }
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy