com.azure.resourcemanager.hybridcompute.implementation.GatewayImpl 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-07.
// 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.GatewayInner;
import com.azure.resourcemanager.hybridcompute.models.Gateway;
import com.azure.resourcemanager.hybridcompute.models.GatewayType;
import com.azure.resourcemanager.hybridcompute.models.GatewayUpdate;
import com.azure.resourcemanager.hybridcompute.models.ProvisioningState;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public final class GatewayImpl implements Gateway, Gateway.Definition, Gateway.Update {
private GatewayInner 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 SystemData systemData() {
return this.innerModel().systemData();
}
public ProvisioningState provisioningState() {
return this.innerModel().provisioningState();
}
public String gatewayId() {
return this.innerModel().gatewayId();
}
public GatewayType gatewayType() {
return this.innerModel().gatewayType();
}
public String gatewayEndpoint() {
return this.innerModel().gatewayEndpoint();
}
public List allowedFeatures() {
List inner = this.innerModel().allowedFeatures();
if (inner != null) {
return Collections.unmodifiableList(inner);
} else {
return Collections.emptyList();
}
}
public Region region() {
return Region.fromName(this.regionName());
}
public String regionName() {
return this.location();
}
public String resourceGroupName() {
return resourceGroupName;
}
public GatewayInner innerModel() {
return this.innerObject;
}
private com.azure.resourcemanager.hybridcompute.HybridComputeManager manager() {
return this.serviceManager;
}
private String resourceGroupName;
private String gatewayName;
private GatewayUpdate updateParameters;
public GatewayImpl withExistingResourceGroup(String resourceGroupName) {
this.resourceGroupName = resourceGroupName;
return this;
}
public Gateway create() {
this.innerObject = serviceManager.serviceClient()
.getGateways()
.createOrUpdate(resourceGroupName, gatewayName, this.innerModel(), Context.NONE);
return this;
}
public Gateway create(Context context) {
this.innerObject = serviceManager.serviceClient()
.getGateways()
.createOrUpdate(resourceGroupName, gatewayName, this.innerModel(), context);
return this;
}
GatewayImpl(String name, com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) {
this.innerObject = new GatewayInner();
this.serviceManager = serviceManager;
this.gatewayName = name;
}
public GatewayImpl update() {
this.updateParameters = new GatewayUpdate();
return this;
}
public Gateway apply() {
this.innerObject = serviceManager.serviceClient()
.getGateways()
.updateWithResponse(resourceGroupName, gatewayName, updateParameters, Context.NONE)
.getValue();
return this;
}
public Gateway apply(Context context) {
this.innerObject = serviceManager.serviceClient()
.getGateways()
.updateWithResponse(resourceGroupName, gatewayName, updateParameters, context)
.getValue();
return this;
}
GatewayImpl(GatewayInner innerObject, com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.gatewayName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "gateways");
}
public Gateway refresh() {
this.innerObject = serviceManager.serviceClient()
.getGateways()
.getByResourceGroupWithResponse(resourceGroupName, gatewayName, Context.NONE)
.getValue();
return this;
}
public Gateway refresh(Context context) {
this.innerObject = serviceManager.serviceClient()
.getGateways()
.getByResourceGroupWithResponse(resourceGroupName, gatewayName, context)
.getValue();
return this;
}
public GatewayImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
}
public GatewayImpl withRegion(String location) {
this.innerModel().withLocation(location);
return this;
}
public GatewayImpl withTags(Map tags) {
if (isInCreateMode()) {
this.innerModel().withTags(tags);
return this;
} else {
this.updateParameters.withTags(tags);
return this;
}
}
public GatewayImpl withGatewayType(GatewayType gatewayType) {
this.innerModel().withGatewayType(gatewayType);
return this;
}
public GatewayImpl withAllowedFeatures(List allowedFeatures) {
if (isInCreateMode()) {
this.innerModel().withAllowedFeatures(allowedFeatures);
return this;
} else {
this.updateParameters.withAllowedFeatures(allowedFeatures);
return this;
}
}
private boolean isInCreateMode() {
return this.innerModel().id() == null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy