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

com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainerResourceImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for RecoveryServicesBackup Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open API 2.0 Specs for Azure RecoveryServices Backup service. Package tag package-2024-04.

There is a newer version: 1.5.0
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.recoveryservicesbackup.implementation;

import com.azure.core.http.rest.Response;
import com.azure.core.management.Region;
import com.azure.core.util.Context;
import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionContainerResourceInner;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainer;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerResource;
import java.util.Collections;
import java.util.Map;

public final class ProtectionContainerResourceImpl
    implements ProtectionContainerResource, ProtectionContainerResource.Definition, ProtectionContainerResource.Update {
    private ProtectionContainerResourceInner innerObject;

    private final com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager serviceManager;

    public String id() {
        return this.innerModel().id();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public String location() {
        return this.innerModel().location();
    }

    public Map tags() {
        Map inner = this.innerModel().tags();
        if (inner != null) {
            return Collections.unmodifiableMap(inner);
        } else {
            return Collections.emptyMap();
        }
    }

    public ProtectionContainer properties() {
        return this.innerModel().properties();
    }

    public String etag() {
        return this.innerModel().etag();
    }

    public Region region() {
        return Region.fromName(this.regionName());
    }

    public String regionName() {
        return this.location();
    }

    public String resourceGroupName() {
        return resourceGroupName;
    }

    public ProtectionContainerResourceInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager() {
        return this.serviceManager;
    }

    private String vaultName;

    private String resourceGroupName;

    private String fabricName;

    private String containerName;

    public ProtectionContainerResourceImpl withExistingBackupFabric(String vaultName, String resourceGroupName,
        String fabricName) {
        this.vaultName = vaultName;
        this.resourceGroupName = resourceGroupName;
        this.fabricName = fabricName;
        return this;
    }

    public ProtectionContainerResource create() {
        this.innerObject = serviceManager.serviceClient().getProtectionContainers().register(vaultName,
            resourceGroupName, fabricName, containerName, this.innerModel(), Context.NONE);
        return this;
    }

    public ProtectionContainerResource create(Context context) {
        this.innerObject = serviceManager.serviceClient().getProtectionContainers().register(vaultName,
            resourceGroupName, fabricName, containerName, this.innerModel(), context);
        return this;
    }

    ProtectionContainerResourceImpl(String name,
        com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager serviceManager) {
        this.innerObject = new ProtectionContainerResourceInner();
        this.serviceManager = serviceManager;
        this.containerName = name;
    }

    public ProtectionContainerResourceImpl update() {
        return this;
    }

    public ProtectionContainerResource apply() {
        this.innerObject = serviceManager.serviceClient().getProtectionContainers().register(vaultName,
            resourceGroupName, fabricName, containerName, this.innerModel(), Context.NONE);
        return this;
    }

    public ProtectionContainerResource apply(Context context) {
        this.innerObject = serviceManager.serviceClient().getProtectionContainers().register(vaultName,
            resourceGroupName, fabricName, containerName, this.innerModel(), context);
        return this;
    }

    ProtectionContainerResourceImpl(ProtectionContainerResourceInner innerObject,
        com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.vaultName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "vaults");
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.fabricName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "backupFabrics");
        this.containerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "protectionContainers");
    }

    public ProtectionContainerResource refresh() {
        this.innerObject = serviceManager.serviceClient().getProtectionContainers()
            .getWithResponse(vaultName, resourceGroupName, fabricName, containerName, Context.NONE).getValue();
        return this;
    }

    public ProtectionContainerResource refresh(Context context) {
        this.innerObject = serviceManager.serviceClient().getProtectionContainers()
            .getWithResponse(vaultName, resourceGroupName, fabricName, containerName, context).getValue();
        return this;
    }

    public Response inquireWithResponse(String filter, Context context) {
        return serviceManager.protectionContainers().inquireWithResponse(vaultName, resourceGroupName, fabricName,
            containerName, filter, context);
    }

    public void inquire() {
        serviceManager.protectionContainers().inquire(vaultName, resourceGroupName, fabricName, containerName);
    }

    public ProtectionContainerResourceImpl withRegion(Region location) {
        this.innerModel().withLocation(location.toString());
        return this;
    }

    public ProtectionContainerResourceImpl withRegion(String location) {
        this.innerModel().withLocation(location);
        return this;
    }

    public ProtectionContainerResourceImpl withTags(Map tags) {
        this.innerModel().withTags(tags);
        return this;
    }

    public ProtectionContainerResourceImpl withProperties(ProtectionContainer properties) {
        this.innerModel().withProperties(properties);
        return this;
    }

    public ProtectionContainerResourceImpl withEtag(String etag) {
        this.innerModel().withEtag(etag);
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy