All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.hybridcompute.implementation.LicenseProfileImpl Maven / Gradle / Ivy

Go to download

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.

The newest version!
// 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.management.exception.ManagementError;
import com.azure.core.util.Context;
import com.azure.resourcemanager.hybridcompute.fluent.models.LicenseProfileInner;
import com.azure.resourcemanager.hybridcompute.models.EsuEligibility;
import com.azure.resourcemanager.hybridcompute.models.EsuKey;
import com.azure.resourcemanager.hybridcompute.models.EsuKeyState;
import com.azure.resourcemanager.hybridcompute.models.EsuServerType;
import com.azure.resourcemanager.hybridcompute.models.LicenseProfile;
import com.azure.resourcemanager.hybridcompute.models.LicenseProfileProductType;
import com.azure.resourcemanager.hybridcompute.models.LicenseProfileSubscriptionStatus;
import com.azure.resourcemanager.hybridcompute.models.LicenseProfileSubscriptionStatusUpdate;
import com.azure.resourcemanager.hybridcompute.models.LicenseProfileUpdate;
import com.azure.resourcemanager.hybridcompute.models.ProductFeature;
import com.azure.resourcemanager.hybridcompute.models.ProductFeatureUpdate;
import com.azure.resourcemanager.hybridcompute.models.ProvisioningState;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public final class LicenseProfileImpl implements LicenseProfile, LicenseProfile.Definition, LicenseProfile.Update {
    private LicenseProfileInner 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 Boolean softwareAssuranceCustomer() {
        return this.innerModel().softwareAssuranceCustomer();
    }

    public String assignedLicense() {
        return this.innerModel().assignedLicense();
    }

    public EsuServerType serverType() {
        return this.innerModel().serverType();
    }

    public EsuEligibility esuEligibility() {
        return this.innerModel().esuEligibility();
    }

    public EsuKeyState esuKeyState() {
        return this.innerModel().esuKeyState();
    }

    public String assignedLicenseImmutableId() {
        return this.innerModel().assignedLicenseImmutableId();
    }

    public List esuKeys() {
        List inner = this.innerModel().esuKeys();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public LicenseProfileSubscriptionStatus subscriptionStatus() {
        return this.innerModel().subscriptionStatus();
    }

    public LicenseProfileProductType productType() {
        return this.innerModel().productType();
    }

    public OffsetDateTime enrollmentDate() {
        return this.innerModel().enrollmentDate();
    }

    public OffsetDateTime billingStartDate() {
        return this.innerModel().billingStartDate();
    }

    public OffsetDateTime disenrollmentDate() {
        return this.innerModel().disenrollmentDate();
    }

    public OffsetDateTime billingEndDate() {
        return this.innerModel().billingEndDate();
    }

    public ManagementError error() {
        return this.innerModel().error();
    }

    public List productFeatures() {
        List inner = this.innerModel().productFeatures();
        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 LicenseProfileInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.hybridcompute.HybridComputeManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String machineName;

    private LicenseProfileUpdate updateParameters;

    public LicenseProfileImpl withExistingMachine(String resourceGroupName, String machineName) {
        this.resourceGroupName = resourceGroupName;
        this.machineName = machineName;
        return this;
    }

    public LicenseProfile create() {
        this.innerObject = serviceManager.serviceClient()
            .getLicenseProfiles()
            .createOrUpdate(resourceGroupName, machineName, this.innerModel(), Context.NONE);
        return this;
    }

    public LicenseProfile create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getLicenseProfiles()
            .createOrUpdate(resourceGroupName, machineName, this.innerModel(), context);
        return this;
    }

    LicenseProfileImpl(com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) {
        this.innerObject = new LicenseProfileInner();
        this.serviceManager = serviceManager;
    }

    public LicenseProfileImpl update() {
        this.updateParameters = new LicenseProfileUpdate();
        return this;
    }

    public LicenseProfile apply() {
        this.innerObject = serviceManager.serviceClient()
            .getLicenseProfiles()
            .update(resourceGroupName, machineName, updateParameters, Context.NONE);
        return this;
    }

    public LicenseProfile apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getLicenseProfiles()
            .update(resourceGroupName, machineName, updateParameters, context);
        return this;
    }

    LicenseProfileImpl(LicenseProfileInner innerObject,
        com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.machineName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "machines");
    }

    public LicenseProfile refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getLicenseProfiles()
            .getWithResponse(resourceGroupName, machineName, Context.NONE)
            .getValue();
        return this;
    }

    public LicenseProfile refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getLicenseProfiles()
            .getWithResponse(resourceGroupName, machineName, context)
            .getValue();
        return this;
    }

    public LicenseProfileImpl withRegion(Region location) {
        this.innerModel().withLocation(location.toString());
        return this;
    }

    public LicenseProfileImpl withRegion(String location) {
        this.innerModel().withLocation(location);
        return this;
    }

    public LicenseProfileImpl withTags(Map tags) {
        if (isInCreateMode()) {
            this.innerModel().withTags(tags);
            return this;
        } else {
            this.updateParameters.withTags(tags);
            return this;
        }
    }

    public LicenseProfileImpl withSoftwareAssuranceCustomer(Boolean softwareAssuranceCustomer) {
        if (isInCreateMode()) {
            this.innerModel().withSoftwareAssuranceCustomer(softwareAssuranceCustomer);
            return this;
        } else {
            this.updateParameters.withSoftwareAssuranceCustomer(softwareAssuranceCustomer);
            return this;
        }
    }

    public LicenseProfileImpl withAssignedLicense(String assignedLicense) {
        if (isInCreateMode()) {
            this.innerModel().withAssignedLicense(assignedLicense);
            return this;
        } else {
            this.updateParameters.withAssignedLicense(assignedLicense);
            return this;
        }
    }

    public LicenseProfileImpl withSubscriptionStatus(LicenseProfileSubscriptionStatus subscriptionStatus) {
        this.innerModel().withSubscriptionStatus(subscriptionStatus);
        return this;
    }

    public LicenseProfileImpl withProductType(LicenseProfileProductType productType) {
        if (isInCreateMode()) {
            this.innerModel().withProductType(productType);
            return this;
        } else {
            this.updateParameters.withProductType(productType);
            return this;
        }
    }

    public LicenseProfileImpl withProductFeatures(List productFeatures) {
        this.innerModel().withProductFeatures(productFeatures);
        return this;
    }

    public LicenseProfileImpl withSubscriptionStatus(LicenseProfileSubscriptionStatusUpdate subscriptionStatus) {
        this.updateParameters.withSubscriptionStatus(subscriptionStatus);
        return this;
    }

    public LicenseProfileImpl withProductFeaturesForUpdate(List productFeatures) {
        this.updateParameters.withProductFeatures(productFeatures);
        return this;
    }

    private boolean isInCreateMode() {
        return this.innerModel().id() == null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy