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

com.microsoft.azure.management.batch.implementation.ApplicationPackageImpl 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.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.batch.Application;
import com.microsoft.azure.management.batch.ApplicationPackage;
import com.microsoft.azure.management.batch.PackageState;
import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.ExternalChildResourceImpl;
import org.joda.time.DateTime;
import rx.Observable;
import rx.functions.Func1;

/**
 * Implementation for BatchAccount Application Package and its parent interfaces.
 */
@LangDefinition
public class ApplicationPackageImpl
        extends ExternalChildResourceImpl
        implements ApplicationPackage {
    private final ApplicationPackagesInner client;

    protected ApplicationPackageImpl(String name, ApplicationImpl parent, ApplicationPackageInner inner, ApplicationPackagesInner client) {
        super(name, parent, inner);

        this.client = client;
    }

    protected static ApplicationPackageImpl newApplicationPackage(String name, ApplicationImpl parent, ApplicationPackagesInner client) {
        ApplicationPackageInner inner = new ApplicationPackageInner();
        inner.withVersion(name);
        return new ApplicationPackageImpl(name, parent, inner, client);
    }

    @Override
    public PackageState state() {
        return this.inner().state();
    }

    @Override
    public String id() {
        return this.parent().parent().id() + "/applications/" + this.parent().name() + "/versions/" + this.name();
    }

    @Override
    public String name() {
        return this.inner().version();
    }

    @Override
    public Observable createAsync() {
        final ApplicationPackageImpl self = this;
        return this.client.createAsync(this.parent().parent().resourceGroupName(), this.parent().parent().name(), this.parent().name(), this.name())
                .map(new Func1() {

                    @Override
                    public ApplicationPackage call(ApplicationPackageInner applicationPackageInner) {
                        self.setInner(applicationPackageInner);
                        return self;
                    }
                });
    }

    @Override
    public Observable updateAsync() {
        throw new UnsupportedOperationException();
    }

    @Override
    public Observable deleteAsync() {
        return this.client.deleteAsync(this.parent().parent().resourceGroupName(), this.parent().parent().name(), this.parent().name(), this.name());
    }

    @Override
    public String format() {
        return this.inner().format();
    }

    @Override
    public String storageUrl() {
        return this.inner().storageUrl();
    }

    @Override
    public DateTime storageUrlExpiry() {
        return this.inner().storageUrlExpiry();
    }

    @Override
    public DateTime lastActivationTime() {
        return this.inner().lastActivationTime();
    }

    @Override
    public void activate(String format) {
        this.client.activate(this.parent().parent().resourceGroupName(), this.parent().parent().name(), this.parent().name(), this.name(), format);
    }

    @Override
    public void delete() {
        this.client.delete(this.parent().parent().resourceGroupName(), this.parent().parent().name(), this.parent().name(), this.name());
    }

    @Override
    public ApplicationPackage refresh() {
        ApplicationPackageInner inner =
                this.client.get(this.parent().parent().resourceGroupName(), this.parent().parent().name(), this.parent().name(), this.name());
        this.setInner(inner);
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy