com.azure.resourcemanager.dnsresolver.implementation.DnsForwardingRulesetImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-dnsresolver Show documentation
Show all versions of azure-resourcemanager-dnsresolver Show documentation
This package contains Microsoft Azure SDK for DnsResolver Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The DNS Resolver Management Client. Package tag package-2022-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.dnsresolver.implementation;
import com.azure.core.management.Region;
import com.azure.core.management.SubResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.dnsresolver.fluent.models.DnsForwardingRulesetInner;
import com.azure.resourcemanager.dnsresolver.models.DnsForwardingRuleset;
import com.azure.resourcemanager.dnsresolver.models.DnsForwardingRulesetPatch;
import com.azure.resourcemanager.dnsresolver.models.ProvisioningState;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public final class DnsForwardingRulesetImpl
implements DnsForwardingRuleset, DnsForwardingRuleset.Definition, DnsForwardingRuleset.Update {
private DnsForwardingRulesetInner innerObject;
private final com.azure.resourcemanager.dnsresolver.DnsResolverManager 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 String etag() {
return this.innerModel().etag();
}
public SystemData systemData() {
return this.innerModel().systemData();
}
public List dnsResolverOutboundEndpoints() {
List inner = this.innerModel().dnsResolverOutboundEndpoints();
if (inner != null) {
return Collections.unmodifiableList(inner);
} else {
return Collections.emptyList();
}
}
public ProvisioningState provisioningState() {
return this.innerModel().provisioningState();
}
public String resourceGuid() {
return this.innerModel().resourceGuid();
}
public Region region() {
return Region.fromName(this.regionName());
}
public String regionName() {
return this.location();
}
public String resourceGroupName() {
return resourceGroupName;
}
public DnsForwardingRulesetInner innerModel() {
return this.innerObject;
}
private com.azure.resourcemanager.dnsresolver.DnsResolverManager manager() {
return this.serviceManager;
}
private String resourceGroupName;
private String dnsForwardingRulesetName;
private String createIfMatch;
private String createIfNoneMatch;
private String updateIfMatch;
private DnsForwardingRulesetPatch updateParameters;
public DnsForwardingRulesetImpl withExistingResourceGroup(String resourceGroupName) {
this.resourceGroupName = resourceGroupName;
return this;
}
public DnsForwardingRuleset create() {
this.innerObject = serviceManager.serviceClient()
.getDnsForwardingRulesets()
.createOrUpdate(resourceGroupName, dnsForwardingRulesetName, this.innerModel(), createIfMatch,
createIfNoneMatch, Context.NONE);
return this;
}
public DnsForwardingRuleset create(Context context) {
this.innerObject = serviceManager.serviceClient()
.getDnsForwardingRulesets()
.createOrUpdate(resourceGroupName, dnsForwardingRulesetName, this.innerModel(), createIfMatch,
createIfNoneMatch, context);
return this;
}
DnsForwardingRulesetImpl(String name, com.azure.resourcemanager.dnsresolver.DnsResolverManager serviceManager) {
this.innerObject = new DnsForwardingRulesetInner();
this.serviceManager = serviceManager;
this.dnsForwardingRulesetName = name;
this.createIfMatch = null;
this.createIfNoneMatch = null;
}
public DnsForwardingRulesetImpl update() {
this.updateIfMatch = null;
this.updateParameters = new DnsForwardingRulesetPatch();
return this;
}
public DnsForwardingRuleset apply() {
this.innerObject = serviceManager.serviceClient()
.getDnsForwardingRulesets()
.update(resourceGroupName, dnsForwardingRulesetName, updateParameters, updateIfMatch, Context.NONE);
return this;
}
public DnsForwardingRuleset apply(Context context) {
this.innerObject = serviceManager.serviceClient()
.getDnsForwardingRulesets()
.update(resourceGroupName, dnsForwardingRulesetName, updateParameters, updateIfMatch, context);
return this;
}
DnsForwardingRulesetImpl(DnsForwardingRulesetInner innerObject,
com.azure.resourcemanager.dnsresolver.DnsResolverManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.dnsForwardingRulesetName
= ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "dnsForwardingRulesets");
}
public DnsForwardingRuleset refresh() {
this.innerObject = serviceManager.serviceClient()
.getDnsForwardingRulesets()
.getByResourceGroupWithResponse(resourceGroupName, dnsForwardingRulesetName, Context.NONE)
.getValue();
return this;
}
public DnsForwardingRuleset refresh(Context context) {
this.innerObject = serviceManager.serviceClient()
.getDnsForwardingRulesets()
.getByResourceGroupWithResponse(resourceGroupName, dnsForwardingRulesetName, context)
.getValue();
return this;
}
public DnsForwardingRulesetImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
}
public DnsForwardingRulesetImpl withRegion(String location) {
this.innerModel().withLocation(location);
return this;
}
public DnsForwardingRulesetImpl withDnsResolverOutboundEndpoints(List dnsResolverOutboundEndpoints) {
if (isInCreateMode()) {
this.innerModel().withDnsResolverOutboundEndpoints(dnsResolverOutboundEndpoints);
return this;
} else {
this.updateParameters.withDnsResolverOutboundEndpoints(dnsResolverOutboundEndpoints);
return this;
}
}
public DnsForwardingRulesetImpl withTags(Map tags) {
if (isInCreateMode()) {
this.innerModel().withTags(tags);
return this;
} else {
this.updateParameters.withTags(tags);
return this;
}
}
public DnsForwardingRulesetImpl withIfMatch(String ifMatch) {
if (isInCreateMode()) {
this.createIfMatch = ifMatch;
return this;
} else {
this.updateIfMatch = ifMatch;
return this;
}
}
public DnsForwardingRulesetImpl withIfNoneMatch(String ifNoneMatch) {
this.createIfNoneMatch = ifNoneMatch;
return this;
}
private boolean isInCreateMode() {
return this.innerModel().id() == null;
}
}