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

com.microsoft.azure.management.batch.implementation.ApplicationsImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Batch Account Management SDK. This package has been deprecated. A replacement package com.azure.resourcemanager:azure-resourcemanager-batch is available as of 31-March-2022. We strongly encourage you to upgrade to continue receiving updates. See Migration Guide https://aka.ms/java-track2-migration-guide for guidance on upgrading. Refer to our deprecation policy https://azure.github.io/azure-sdk/policies_support.html for more details.

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.batch.implementation;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.batch.Application;
import com.microsoft.azure.management.batch.BatchAccount;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.ExternalChildResourcesImpl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Represents a application collection associated with a batch account.
 */
@LangDefinition
class ApplicationsImpl extends
        ExternalChildResourcesImpl {
    private final ApplicationsInner client;
    private ApplicationPackagesInner applicationPackagesClient;

    ApplicationsImpl(ApplicationsInner client, ApplicationPackagesInner applicationPackagesClient, BatchAccountImpl parent) {
        super(parent, "Application");
        this.client = client;
        this.applicationPackagesClient = applicationPackagesClient;
        this.initializeCollection();
    }

    public Map asMap() {
        Map result = new HashMap<>();
        for (Map.Entry entry : this.collection().entrySet()) {
            ApplicationImpl application = entry.getValue();
            result.put(entry.getKey(), application);
        }
        return Collections.unmodifiableMap(result);
    }

    public ApplicationImpl define(String name) {
        return this.prepareDefine(name);
    }

    public ApplicationImpl update(String name) {
        return this.prepareUpdate(name);
    }

    public void remove(String name) {
        this.prepareRemove(name);
    }

    public void addApplication(ApplicationImpl application) {
        this.addChildResource(application);
    }

    @Override
    protected List listChildResources() {
        List childResources = new ArrayList<>();
        if (this.parent().inner().id() == null || this.parent().inner().autoStorage() == null) {
            return childResources;
        }

        PagedList applicationList = this.client.list(this.parent().resourceGroupName(), this.parent().name());

        for (ApplicationInner application: applicationList) {
            childResources.add(new ApplicationImpl(application.id(), this.parent(), application, this.client, this.applicationPackagesClient));
        }

        return childResources;
    }

    @Override
    protected ApplicationImpl newChildResource(String name) {
        ApplicationImpl application = ApplicationImpl
                .newApplication(name, this.parent(), this.client, this.applicationPackagesClient);
        return application;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy