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

com.azure.resourcemanager.azurestackhci.implementation.ArcSettingImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for AzureStackHci Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management service. Package tag package-2024-04.

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.azurestackhci.implementation;

import com.azure.core.http.rest.Response;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.azurestackhci.fluent.models.ArcSettingInner;
import com.azure.resourcemanager.azurestackhci.models.ArcIdentityResponse;
import com.azure.resourcemanager.azurestackhci.models.ArcSetting;
import com.azure.resourcemanager.azurestackhci.models.ArcSettingAggregateState;
import com.azure.resourcemanager.azurestackhci.models.ArcSettingsPatch;
import com.azure.resourcemanager.azurestackhci.models.DefaultExtensionDetails;
import com.azure.resourcemanager.azurestackhci.models.PasswordCredential;
import com.azure.resourcemanager.azurestackhci.models.PerNodeState;
import com.azure.resourcemanager.azurestackhci.models.ProvisioningState;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public final class ArcSettingImpl implements ArcSetting, ArcSetting.Definition, ArcSetting.Update {
    private ArcSettingInner innerObject;

    private final com.azure.resourcemanager.azurestackhci.AzureStackHciManager serviceManager;

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

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

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

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public ProvisioningState provisioningState() {
        return this.innerModel().provisioningState();
    }

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

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

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

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

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

    public ArcSettingAggregateState aggregateState() {
        return this.innerModel().aggregateState();
    }

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

    public Object connectivityProperties() {
        return this.innerModel().connectivityProperties();
    }

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

    public String resourceGroupName() {
        return resourceGroupName;
    }

    public ArcSettingInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.azurestackhci.AzureStackHciManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String clusterName;

    private String arcSettingName;

    private ArcSettingsPatch updateArcSetting;

    public ArcSettingImpl withExistingCluster(String resourceGroupName, String clusterName) {
        this.resourceGroupName = resourceGroupName;
        this.clusterName = clusterName;
        return this;
    }

    public ArcSetting create() {
        this.innerObject = serviceManager.serviceClient()
            .getArcSettings()
            .createWithResponse(resourceGroupName, clusterName, arcSettingName, this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public ArcSetting create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getArcSettings()
            .createWithResponse(resourceGroupName, clusterName, arcSettingName, this.innerModel(), context)
            .getValue();
        return this;
    }

    ArcSettingImpl(String name, com.azure.resourcemanager.azurestackhci.AzureStackHciManager serviceManager) {
        this.innerObject = new ArcSettingInner();
        this.serviceManager = serviceManager;
        this.arcSettingName = name;
    }

    public ArcSettingImpl update() {
        this.updateArcSetting = new ArcSettingsPatch();
        return this;
    }

    public ArcSetting apply() {
        this.innerObject = serviceManager.serviceClient()
            .getArcSettings()
            .updateWithResponse(resourceGroupName, clusterName, arcSettingName, updateArcSetting, Context.NONE)
            .getValue();
        return this;
    }

    public ArcSetting apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getArcSettings()
            .updateWithResponse(resourceGroupName, clusterName, arcSettingName, updateArcSetting, context)
            .getValue();
        return this;
    }

    ArcSettingImpl(ArcSettingInner innerObject,
        com.azure.resourcemanager.azurestackhci.AzureStackHciManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.clusterName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "clusters");
        this.arcSettingName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "arcSettings");
    }

    public ArcSetting refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getArcSettings()
            .getWithResponse(resourceGroupName, clusterName, arcSettingName, Context.NONE)
            .getValue();
        return this;
    }

    public ArcSetting refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getArcSettings()
            .getWithResponse(resourceGroupName, clusterName, arcSettingName, context)
            .getValue();
        return this;
    }

    public Response generatePasswordWithResponse(Context context) {
        return serviceManager.arcSettings()
            .generatePasswordWithResponse(resourceGroupName, clusterName, arcSettingName, context);
    }

    public PasswordCredential generatePassword() {
        return serviceManager.arcSettings().generatePassword(resourceGroupName, clusterName, arcSettingName);
    }

    public ArcIdentityResponse createIdentity() {
        return serviceManager.arcSettings().createIdentity(resourceGroupName, clusterName, arcSettingName);
    }

    public ArcIdentityResponse createIdentity(Context context) {
        return serviceManager.arcSettings().createIdentity(resourceGroupName, clusterName, arcSettingName, context);
    }

    public Response consentAndInstallDefaultExtensionsWithResponse(Context context) {
        return serviceManager.arcSettings()
            .consentAndInstallDefaultExtensionsWithResponse(resourceGroupName, clusterName, arcSettingName, context);
    }

    public ArcSetting consentAndInstallDefaultExtensions() {
        return serviceManager.arcSettings()
            .consentAndInstallDefaultExtensions(resourceGroupName, clusterName, arcSettingName);
    }

    public void initializeDisableProcess() {
        serviceManager.arcSettings().initializeDisableProcess(resourceGroupName, clusterName, arcSettingName);
    }

    public void initializeDisableProcess(Context context) {
        serviceManager.arcSettings().initializeDisableProcess(resourceGroupName, clusterName, arcSettingName, context);
    }

    public ArcSettingImpl withArcInstanceResourceGroup(String arcInstanceResourceGroup) {
        this.innerModel().withArcInstanceResourceGroup(arcInstanceResourceGroup);
        return this;
    }

    public ArcSettingImpl withArcApplicationClientId(String arcApplicationClientId) {
        this.innerModel().withArcApplicationClientId(arcApplicationClientId);
        return this;
    }

    public ArcSettingImpl withArcApplicationTenantId(String arcApplicationTenantId) {
        this.innerModel().withArcApplicationTenantId(arcApplicationTenantId);
        return this;
    }

    public ArcSettingImpl withArcServicePrincipalObjectId(String arcServicePrincipalObjectId) {
        this.innerModel().withArcServicePrincipalObjectId(arcServicePrincipalObjectId);
        return this;
    }

    public ArcSettingImpl withArcApplicationObjectId(String arcApplicationObjectId) {
        this.innerModel().withArcApplicationObjectId(arcApplicationObjectId);
        return this;
    }

    public ArcSettingImpl withConnectivityProperties(Object connectivityProperties) {
        if (isInCreateMode()) {
            this.innerModel().withConnectivityProperties(connectivityProperties);
            return this;
        } else {
            this.updateArcSetting.withConnectivityProperties(connectivityProperties);
            return this;
        }
    }

    public ArcSettingImpl withTags(Map tags) {
        this.updateArcSetting.withTags(tags);
        return this;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy