com.azure.resourcemanager.hybridcompute.implementation.LicenseImpl 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.LicenseInner;
import com.azure.resourcemanager.hybridcompute.models.License;
import com.azure.resourcemanager.hybridcompute.models.LicenseCoreType;
import com.azure.resourcemanager.hybridcompute.models.LicenseDetails;
import com.azure.resourcemanager.hybridcompute.models.LicenseEdition;
import com.azure.resourcemanager.hybridcompute.models.LicenseState;
import com.azure.resourcemanager.hybridcompute.models.LicenseTarget;
import com.azure.resourcemanager.hybridcompute.models.LicenseType;
import com.azure.resourcemanager.hybridcompute.models.LicenseUpdate;
import com.azure.resourcemanager.hybridcompute.models.ProvisioningState;
import java.util.Collections;
import java.util.Map;
public final class LicenseImpl implements License, License.Definition, License.Update {
private LicenseInner 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 tenantId() {
return this.innerModel().tenantId();
}
public LicenseType licenseType() {
return this.innerModel().licenseType();
}
public LicenseDetails licenseDetails() {
return this.innerModel().licenseDetails();
}
public Region region() {
return Region.fromName(this.regionName());
}
public String regionName() {
return this.location();
}
public String resourceGroupName() {
return resourceGroupName;
}
public LicenseInner innerModel() {
return this.innerObject;
}
private com.azure.resourcemanager.hybridcompute.HybridComputeManager manager() {
return this.serviceManager;
}
private String resourceGroupName;
private String licenseName;
private LicenseUpdate updateParameters;
public LicenseImpl withExistingResourceGroup(String resourceGroupName) {
this.resourceGroupName = resourceGroupName;
return this;
}
public License create() {
this.innerObject = serviceManager.serviceClient()
.getLicenses()
.createOrUpdate(resourceGroupName, licenseName, this.innerModel(), Context.NONE);
return this;
}
public License create(Context context) {
this.innerObject = serviceManager.serviceClient()
.getLicenses()
.createOrUpdate(resourceGroupName, licenseName, this.innerModel(), context);
return this;
}
LicenseImpl(String name, com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) {
this.innerObject = new LicenseInner();
this.serviceManager = serviceManager;
this.licenseName = name;
}
public LicenseImpl update() {
this.updateParameters = new LicenseUpdate();
return this;
}
public License apply() {
this.innerObject = serviceManager.serviceClient()
.getLicenses()
.update(resourceGroupName, licenseName, updateParameters, Context.NONE);
return this;
}
public License apply(Context context) {
this.innerObject = serviceManager.serviceClient()
.getLicenses()
.update(resourceGroupName, licenseName, updateParameters, context);
return this;
}
LicenseImpl(LicenseInner innerObject, com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.licenseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "licenses");
}
public License refresh() {
this.innerObject = serviceManager.serviceClient()
.getLicenses()
.getByResourceGroupWithResponse(resourceGroupName, licenseName, Context.NONE)
.getValue();
return this;
}
public License refresh(Context context) {
this.innerObject = serviceManager.serviceClient()
.getLicenses()
.getByResourceGroupWithResponse(resourceGroupName, licenseName, context)
.getValue();
return this;
}
public LicenseImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
}
public LicenseImpl withRegion(String location) {
this.innerModel().withLocation(location);
return this;
}
public LicenseImpl withTags(Map tags) {
if (isInCreateMode()) {
this.innerModel().withTags(tags);
return this;
} else {
this.updateParameters.withTags(tags);
return this;
}
}
public LicenseImpl withTenantId(String tenantId) {
this.innerModel().withTenantId(tenantId);
return this;
}
public LicenseImpl withLicenseType(LicenseType licenseType) {
if (isInCreateMode()) {
this.innerModel().withLicenseType(licenseType);
return this;
} else {
this.updateParameters.withLicenseType(licenseType);
return this;
}
}
public LicenseImpl withLicenseDetails(LicenseDetails licenseDetails) {
this.innerModel().withLicenseDetails(licenseDetails);
return this;
}
public LicenseImpl withState(LicenseState state) {
this.updateParameters.withState(state);
return this;
}
public LicenseImpl withTarget(LicenseTarget target) {
this.updateParameters.withTarget(target);
return this;
}
public LicenseImpl withEdition(LicenseEdition edition) {
this.updateParameters.withEdition(edition);
return this;
}
public LicenseImpl withType(LicenseCoreType type) {
this.updateParameters.withType(type);
return this;
}
public LicenseImpl withProcessors(Integer processors) {
this.updateParameters.withProcessors(processors);
return this;
}
private boolean isInCreateMode() {
return this.innerModel().id() == null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy