com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemResourceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-recoveryservicesbackup Show documentation
Show all versions of azure-resourcemanager-recoveryservicesbackup Show documentation
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.
// 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.management.Region;
import com.azure.core.util.Context;
import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectedItemResourceInner;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItem;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemResource;
import java.util.Collections;
import java.util.Map;
public final class ProtectedItemResourceImpl
implements ProtectedItemResource, ProtectedItemResource.Definition, ProtectedItemResource.Update {
private ProtectedItemResourceInner 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 ProtectedItem 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 ProtectedItemResourceInner 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;
private String protectedItemName;
public ProtectedItemResourceImpl withExistingProtectionContainer(String vaultName, String resourceGroupName,
String fabricName, String containerName) {
this.vaultName = vaultName;
this.resourceGroupName = resourceGroupName;
this.fabricName = fabricName;
this.containerName = containerName;
return this;
}
public ProtectedItemResource create() {
this.innerObject = serviceManager.serviceClient().getProtectedItems().createOrUpdateWithResponse(vaultName,
resourceGroupName, fabricName, containerName, protectedItemName, this.innerModel(), Context.NONE)
.getValue();
return this;
}
public ProtectedItemResource create(Context context) {
this.innerObject = serviceManager.serviceClient().getProtectedItems().createOrUpdateWithResponse(vaultName,
resourceGroupName, fabricName, containerName, protectedItemName, this.innerModel(), context).getValue();
return this;
}
ProtectedItemResourceImpl(String name,
com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager serviceManager) {
this.innerObject = new ProtectedItemResourceInner();
this.serviceManager = serviceManager;
this.protectedItemName = name;
}
public ProtectedItemResourceImpl update() {
return this;
}
public ProtectedItemResource apply() {
this.innerObject = serviceManager.serviceClient().getProtectedItems().createOrUpdateWithResponse(vaultName,
resourceGroupName, fabricName, containerName, protectedItemName, this.innerModel(), Context.NONE)
.getValue();
return this;
}
public ProtectedItemResource apply(Context context) {
this.innerObject = serviceManager.serviceClient().getProtectedItems().createOrUpdateWithResponse(vaultName,
resourceGroupName, fabricName, containerName, protectedItemName, this.innerModel(), context).getValue();
return this;
}
ProtectedItemResourceImpl(ProtectedItemResourceInner 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");
this.protectedItemName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "protectedItems");
}
public ProtectedItemResource refresh() {
String localFilter = null;
this.innerObject = serviceManager.serviceClient().getProtectedItems().getWithResponse(vaultName,
resourceGroupName, fabricName, containerName, protectedItemName, localFilter, Context.NONE).getValue();
return this;
}
public ProtectedItemResource refresh(Context context) {
String localFilter = null;
this.innerObject = serviceManager.serviceClient().getProtectedItems().getWithResponse(vaultName,
resourceGroupName, fabricName, containerName, protectedItemName, localFilter, context).getValue();
return this;
}
public ProtectedItemResourceImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
}
public ProtectedItemResourceImpl withRegion(String location) {
this.innerModel().withLocation(location);
return this;
}
public ProtectedItemResourceImpl withTags(Map tags) {
this.innerModel().withTags(tags);
return this;
}
public ProtectedItemResourceImpl withProperties(ProtectedItem properties) {
this.innerModel().withProperties(properties);
return this;
}
public ProtectedItemResourceImpl withEtag(String etag) {
this.innerModel().withEtag(etag);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy