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

com.azure.resourcemanager.dataprotection.implementation.ResourceGuardProxyBaseResourceImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for DataProtection 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 Data Protection service. Package tag package-2024-04.

The 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.dataprotection.implementation;

import com.azure.core.http.rest.Response;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.dataprotection.fluent.models.ResourceGuardProxyBaseResourceInner;
import com.azure.resourcemanager.dataprotection.models.ResourceGuardProxyBase;
import com.azure.resourcemanager.dataprotection.models.ResourceGuardProxyBaseResource;
import com.azure.resourcemanager.dataprotection.models.UnlockDeleteRequest;
import com.azure.resourcemanager.dataprotection.models.UnlockDeleteResponse;

public final class ResourceGuardProxyBaseResourceImpl implements ResourceGuardProxyBaseResource,
    ResourceGuardProxyBaseResource.Definition, ResourceGuardProxyBaseResource.Update {
    private ResourceGuardProxyBaseResourceInner innerObject;

    private final com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager;

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

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

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

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

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

    public String resourceGroupName() {
        return resourceGroupName;
    }

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

    private com.azure.resourcemanager.dataprotection.DataProtectionManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String vaultName;

    private String resourceGuardProxyName;

    public ResourceGuardProxyBaseResourceImpl withExistingBackupVault(String resourceGroupName, String vaultName) {
        this.resourceGroupName = resourceGroupName;
        this.vaultName = vaultName;
        return this;
    }

    public ResourceGuardProxyBaseResource create() {
        this.innerObject = serviceManager.serviceClient()
            .getDppResourceGuardProxies()
            .createOrUpdateWithResponse(resourceGroupName, vaultName, resourceGuardProxyName, this.innerModel(),
                Context.NONE)
            .getValue();
        return this;
    }

    public ResourceGuardProxyBaseResource create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getDppResourceGuardProxies()
            .createOrUpdateWithResponse(resourceGroupName, vaultName, resourceGuardProxyName, this.innerModel(),
                context)
            .getValue();
        return this;
    }

    ResourceGuardProxyBaseResourceImpl(String name,
        com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) {
        this.innerObject = new ResourceGuardProxyBaseResourceInner();
        this.serviceManager = serviceManager;
        this.resourceGuardProxyName = name;
    }

    public ResourceGuardProxyBaseResourceImpl update() {
        return this;
    }

    public ResourceGuardProxyBaseResource apply() {
        this.innerObject = serviceManager.serviceClient()
            .getDppResourceGuardProxies()
            .createOrUpdateWithResponse(resourceGroupName, vaultName, resourceGuardProxyName, this.innerModel(),
                Context.NONE)
            .getValue();
        return this;
    }

    public ResourceGuardProxyBaseResource apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getDppResourceGuardProxies()
            .createOrUpdateWithResponse(resourceGroupName, vaultName, resourceGuardProxyName, this.innerModel(),
                context)
            .getValue();
        return this;
    }

    ResourceGuardProxyBaseResourceImpl(ResourceGuardProxyBaseResourceInner innerObject,
        com.azure.resourcemanager.dataprotection.DataProtectionManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.vaultName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "backupVaults");
        this.resourceGuardProxyName
            = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "backupResourceGuardProxies");
    }

    public ResourceGuardProxyBaseResource refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getDppResourceGuardProxies()
            .getWithResponse(resourceGroupName, vaultName, resourceGuardProxyName, Context.NONE)
            .getValue();
        return this;
    }

    public ResourceGuardProxyBaseResource refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getDppResourceGuardProxies()
            .getWithResponse(resourceGroupName, vaultName, resourceGuardProxyName, context)
            .getValue();
        return this;
    }

    public Response unlockDeleteWithResponse(UnlockDeleteRequest parameters, Context context) {
        return serviceManager.dppResourceGuardProxies()
            .unlockDeleteWithResponse(resourceGroupName, vaultName, resourceGuardProxyName, parameters, context);
    }

    public UnlockDeleteResponse unlockDelete(UnlockDeleteRequest parameters) {
        return serviceManager.dppResourceGuardProxies()
            .unlockDelete(resourceGroupName, vaultName, resourceGuardProxyName, parameters);
    }

    public ResourceGuardProxyBaseResourceImpl withProperties(ResourceGuardProxyBase properties) {
        this.innerModel().withProperties(properties);
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy