com.azure.resourcemanager.migrationdiscoverysap.implementation.SapDiscoverySiteImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-migrationdiscoverysap Show documentation
Show all versions of azure-resourcemanager-migrationdiscoverysap Show documentation
This package contains Microsoft Azure SDK for MigrationDiscoverySap Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Migration Discovery SAP Client. Package tag package-preview-2023-10.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.migrationdiscoverysap.implementation;
import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.migrationdiscoverysap.fluent.models.SapDiscoverySiteInner;
import com.azure.resourcemanager.migrationdiscoverysap.models.ExtendedLocation;
import com.azure.resourcemanager.migrationdiscoverysap.models.OperationStatusResult;
import com.azure.resourcemanager.migrationdiscoverysap.models.SapDiscoverySite;
import com.azure.resourcemanager.migrationdiscoverysap.models.SapDiscoverySiteProperties;
import com.azure.resourcemanager.migrationdiscoverysap.models.SapDiscoverySiteTagsUpdate;
import java.util.Collections;
import java.util.Map;
public final class SapDiscoverySiteImpl
implements SapDiscoverySite, SapDiscoverySite.Definition, SapDiscoverySite.Update {
private SapDiscoverySiteInner innerObject;
private final com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager 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 SapDiscoverySiteProperties properties() {
return this.innerModel().properties();
}
public ExtendedLocation extendedLocation() {
return this.innerModel().extendedLocation();
}
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 SapDiscoverySiteInner innerModel() {
return this.innerObject;
}
private com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager() {
return this.serviceManager;
}
private String resourceGroupName;
private String sapDiscoverySiteName;
private SapDiscoverySiteTagsUpdate updateProperties;
public SapDiscoverySiteImpl withExistingResourceGroup(String resourceGroupName) {
this.resourceGroupName = resourceGroupName;
return this;
}
public SapDiscoverySite create() {
this.innerObject = serviceManager.serviceClient().getSapDiscoverySites().create(resourceGroupName,
sapDiscoverySiteName, this.innerModel(), Context.NONE);
return this;
}
public SapDiscoverySite create(Context context) {
this.innerObject = serviceManager.serviceClient().getSapDiscoverySites().create(resourceGroupName,
sapDiscoverySiteName, this.innerModel(), context);
return this;
}
SapDiscoverySiteImpl(String name,
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager serviceManager) {
this.innerObject = new SapDiscoverySiteInner();
this.serviceManager = serviceManager;
this.sapDiscoverySiteName = name;
}
public SapDiscoverySiteImpl update() {
this.updateProperties = new SapDiscoverySiteTagsUpdate();
return this;
}
public SapDiscoverySite apply() {
this.innerObject = serviceManager.serviceClient().getSapDiscoverySites()
.updateWithResponse(resourceGroupName, sapDiscoverySiteName, updateProperties, Context.NONE).getValue();
return this;
}
public SapDiscoverySite apply(Context context) {
this.innerObject = serviceManager.serviceClient().getSapDiscoverySites()
.updateWithResponse(resourceGroupName, sapDiscoverySiteName, updateProperties, context).getValue();
return this;
}
SapDiscoverySiteImpl(SapDiscoverySiteInner innerObject,
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.sapDiscoverySiteName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sapDiscoverySites");
}
public SapDiscoverySite refresh() {
this.innerObject = serviceManager.serviceClient().getSapDiscoverySites()
.getByResourceGroupWithResponse(resourceGroupName, sapDiscoverySiteName, Context.NONE).getValue();
return this;
}
public SapDiscoverySite refresh(Context context) {
this.innerObject = serviceManager.serviceClient().getSapDiscoverySites()
.getByResourceGroupWithResponse(resourceGroupName, sapDiscoverySiteName, context).getValue();
return this;
}
public OperationStatusResult importEntities() {
return serviceManager.sapDiscoverySites().importEntities(resourceGroupName, sapDiscoverySiteName);
}
public OperationStatusResult importEntities(Context context) {
return serviceManager.sapDiscoverySites().importEntities(resourceGroupName, sapDiscoverySiteName, context);
}
public SapDiscoverySiteImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
}
public SapDiscoverySiteImpl withRegion(String location) {
this.innerModel().withLocation(location);
return this;
}
public SapDiscoverySiteImpl withTags(Map tags) {
if (isInCreateMode()) {
this.innerModel().withTags(tags);
return this;
} else {
this.updateProperties.withTags(tags);
return this;
}
}
public SapDiscoverySiteImpl withProperties(SapDiscoverySiteProperties properties) {
this.innerModel().withProperties(properties);
return this;
}
public SapDiscoverySiteImpl withExtendedLocation(ExtendedLocation extendedLocation) {
this.innerModel().withExtendedLocation(extendedLocation);
return this;
}
private boolean isInCreateMode() {
return this.innerModel().id() == null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy