com.azure.resourcemanager.dnsresolver.implementation.DnsResolverDomainListImpl 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.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.dnsresolver.fluent.models.DnsResolverDomainListInner;
import com.azure.resourcemanager.dnsresolver.models.DnsResolverDomainList;
import com.azure.resourcemanager.dnsresolver.models.DnsResolverDomainListPatch;
import com.azure.resourcemanager.dnsresolver.models.ProvisioningState;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public final class DnsResolverDomainListImpl
implements DnsResolverDomainList, DnsResolverDomainList.Definition, DnsResolverDomainList.Update {
private DnsResolverDomainListInner 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 domains() {
List inner = this.innerModel().domains();
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 DnsResolverDomainListInner innerModel() {
return this.innerObject;
}
private com.azure.resourcemanager.dnsresolver.DnsResolverManager manager() {
return this.serviceManager;
}
private String resourceGroupName;
private String dnsResolverDomainListName;
private String createIfMatch;
private String createIfNoneMatch;
private String updateIfMatch;
private DnsResolverDomainListPatch updateParameters;
public DnsResolverDomainListImpl withExistingResourceGroup(String resourceGroupName) {
this.resourceGroupName = resourceGroupName;
return this;
}
public DnsResolverDomainList create() {
this.innerObject = serviceManager.serviceClient()
.getDnsResolverDomainLists()
.createOrUpdate(resourceGroupName, dnsResolverDomainListName, this.innerModel(), createIfMatch,
createIfNoneMatch, Context.NONE);
return this;
}
public DnsResolverDomainList create(Context context) {
this.innerObject = serviceManager.serviceClient()
.getDnsResolverDomainLists()
.createOrUpdate(resourceGroupName, dnsResolverDomainListName, this.innerModel(), createIfMatch,
createIfNoneMatch, context);
return this;
}
DnsResolverDomainListImpl(String name, com.azure.resourcemanager.dnsresolver.DnsResolverManager serviceManager) {
this.innerObject = new DnsResolverDomainListInner();
this.serviceManager = serviceManager;
this.dnsResolverDomainListName = name;
this.createIfMatch = null;
this.createIfNoneMatch = null;
}
public DnsResolverDomainListImpl update() {
this.updateIfMatch = null;
this.updateParameters = new DnsResolverDomainListPatch();
return this;
}
public DnsResolverDomainList apply() {
this.innerObject = serviceManager.serviceClient()
.getDnsResolverDomainLists()
.update(resourceGroupName, dnsResolverDomainListName, updateParameters, updateIfMatch, Context.NONE);
return this;
}
public DnsResolverDomainList apply(Context context) {
this.innerObject = serviceManager.serviceClient()
.getDnsResolverDomainLists()
.update(resourceGroupName, dnsResolverDomainListName, updateParameters, updateIfMatch, context);
return this;
}
DnsResolverDomainListImpl(DnsResolverDomainListInner innerObject,
com.azure.resourcemanager.dnsresolver.DnsResolverManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.dnsResolverDomainListName
= ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "dnsResolverDomainLists");
}
public DnsResolverDomainList refresh() {
this.innerObject = serviceManager.serviceClient()
.getDnsResolverDomainLists()
.getByResourceGroupWithResponse(resourceGroupName, dnsResolverDomainListName, Context.NONE)
.getValue();
return this;
}
public DnsResolverDomainList refresh(Context context) {
this.innerObject = serviceManager.serviceClient()
.getDnsResolverDomainLists()
.getByResourceGroupWithResponse(resourceGroupName, dnsResolverDomainListName, context)
.getValue();
return this;
}
public DnsResolverDomainListImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
}
public DnsResolverDomainListImpl withRegion(String location) {
this.innerModel().withLocation(location);
return this;
}
public DnsResolverDomainListImpl withDomains(List domains) {
if (isInCreateMode()) {
this.innerModel().withDomains(domains);
return this;
} else {
this.updateParameters.withDomains(domains);
return this;
}
}
public DnsResolverDomainListImpl withTags(Map tags) {
if (isInCreateMode()) {
this.innerModel().withTags(tags);
return this;
} else {
this.updateParameters.withTags(tags);
return this;
}
}
public DnsResolverDomainListImpl withIfMatch(String ifMatch) {
if (isInCreateMode()) {
this.createIfMatch = ifMatch;
return this;
} else {
this.updateIfMatch = ifMatch;
return this;
}
}
public DnsResolverDomainListImpl withIfNoneMatch(String ifNoneMatch) {
this.createIfNoneMatch = ifNoneMatch;
return this;
}
private boolean isInCreateMode() {
return this.innerModel().id() == null;
}
}