com.azure.resourcemanager.hybridcompute.implementation.HybridComputePrivateLinkScopeImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hybridcompute Show documentation
Show all versions of azure-resourcemanager-hybridcompute Show documentation
This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-05.
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.hybridcompute.implementation;
import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.hybridcompute.fluent.models.HybridComputePrivateLinkScopeInner;
import com.azure.resourcemanager.hybridcompute.models.HybridComputePrivateLinkScope;
import com.azure.resourcemanager.hybridcompute.models.HybridComputePrivateLinkScopeProperties;
import com.azure.resourcemanager.hybridcompute.models.TagsResource;
import java.util.Collections;
import java.util.Map;
public final class HybridComputePrivateLinkScopeImpl implements HybridComputePrivateLinkScope,
HybridComputePrivateLinkScope.Definition, HybridComputePrivateLinkScope.Update {
private HybridComputePrivateLinkScopeInner innerObject;
private final com.azure.resourcemanager.hybridcompute.HybridComputeManager 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 HybridComputePrivateLinkScopeProperties properties() {
return this.innerModel().properties();
}
public SystemData systemData() {
return this.innerModel().systemData();
}
public Region region() {
return Region.fromName(this.regionName());
}
public String regionName() {
return this.location();
}
public String resourceGroupName() {
return resourceGroupName;
}
public HybridComputePrivateLinkScopeInner innerModel() {
return this.innerObject;
}
private com.azure.resourcemanager.hybridcompute.HybridComputeManager manager() {
return this.serviceManager;
}
private String resourceGroupName;
private String scopeName;
private TagsResource updatePrivateLinkScopeTags;
public HybridComputePrivateLinkScopeImpl withExistingResourceGroup(String resourceGroupName) {
this.resourceGroupName = resourceGroupName;
return this;
}
public HybridComputePrivateLinkScope create() {
this.innerObject = serviceManager.serviceClient()
.getPrivateLinkScopes()
.createOrUpdateWithResponse(resourceGroupName, scopeName, this.innerModel(), Context.NONE)
.getValue();
return this;
}
public HybridComputePrivateLinkScope create(Context context) {
this.innerObject = serviceManager.serviceClient()
.getPrivateLinkScopes()
.createOrUpdateWithResponse(resourceGroupName, scopeName, this.innerModel(), context)
.getValue();
return this;
}
HybridComputePrivateLinkScopeImpl(String name,
com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) {
this.innerObject = new HybridComputePrivateLinkScopeInner();
this.serviceManager = serviceManager;
this.scopeName = name;
}
public HybridComputePrivateLinkScopeImpl update() {
this.updatePrivateLinkScopeTags = new TagsResource();
return this;
}
public HybridComputePrivateLinkScope apply() {
this.innerObject = serviceManager.serviceClient()
.getPrivateLinkScopes()
.updateTagsWithResponse(resourceGroupName, scopeName, updatePrivateLinkScopeTags, Context.NONE)
.getValue();
return this;
}
public HybridComputePrivateLinkScope apply(Context context) {
this.innerObject = serviceManager.serviceClient()
.getPrivateLinkScopes()
.updateTagsWithResponse(resourceGroupName, scopeName, updatePrivateLinkScopeTags, context)
.getValue();
return this;
}
HybridComputePrivateLinkScopeImpl(HybridComputePrivateLinkScopeInner innerObject,
com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.scopeName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateLinkScopes");
}
public HybridComputePrivateLinkScope refresh() {
this.innerObject = serviceManager.serviceClient()
.getPrivateLinkScopes()
.getByResourceGroupWithResponse(resourceGroupName, scopeName, Context.NONE)
.getValue();
return this;
}
public HybridComputePrivateLinkScope refresh(Context context) {
this.innerObject = serviceManager.serviceClient()
.getPrivateLinkScopes()
.getByResourceGroupWithResponse(resourceGroupName, scopeName, context)
.getValue();
return this;
}
public HybridComputePrivateLinkScopeImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
}
public HybridComputePrivateLinkScopeImpl withRegion(String location) {
this.innerModel().withLocation(location);
return this;
}
public HybridComputePrivateLinkScopeImpl withTags(Map tags) {
if (isInCreateMode()) {
this.innerModel().withTags(tags);
return this;
} else {
this.updatePrivateLinkScopeTags.withTags(tags);
return this;
}
}
public HybridComputePrivateLinkScopeImpl withProperties(HybridComputePrivateLinkScopeProperties properties) {
this.innerModel().withProperties(properties);
return this;
}
private boolean isInCreateMode() {
return this.innerModel().id() == null;
}
}