// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.containerservice.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.containerservice.models.ContainerServiceLinuxProfile;
import com.azure.resourcemanager.containerservice.models.ContainerServiceNetworkProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterAadProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterAddonProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterAgentPoolProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterApiServerAccessProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterAutoUpgradeProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterIdentity;
import com.azure.resourcemanager.containerservice.models.ManagedClusterPodIdentityProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterPropertiesAutoScalerProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterPropertiesIdentityProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterServicePrincipalProfile;
import com.azure.resourcemanager.containerservice.models.ManagedClusterSku;
import com.azure.resourcemanager.containerservice.models.ManagedClusterWindowsProfile;
import com.azure.resourcemanager.containerservice.models.PowerState;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Managed cluster. */
@Fluent
public final class ManagedClusterInner extends Resource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedClusterInner.class);

    /*
     * The managed cluster SKU.
     */
    @JsonProperty(value = "sku")
    private ManagedClusterSku sku;

    /*
     * Properties of a managed cluster.
     */
    @JsonProperty(value = "properties")
    private ManagedClusterProperties innerProperties;

    /*
     * The identity of the managed cluster, if configured.
     */
    @JsonProperty(value = "identity")
    private ManagedClusterIdentity identity;

    /**
     * Get the sku property: The managed cluster SKU.
     *
     * @return the sku value.
     */
    public ManagedClusterSku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The managed cluster SKU.
     *
     * @param sku the sku value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withSku(ManagedClusterSku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the innerProperties property: Properties of a managed cluster.
     *
     * @return the innerProperties value.
     */
    private ManagedClusterProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the identity property: The identity of the managed cluster, if configured.
     *
     * @return the identity value.
     */
    public ManagedClusterIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: The identity of the managed cluster, if configured.
     *
     * @param identity the identity value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withIdentity(ManagedClusterIdentity identity) {
        this.identity = identity;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ManagedClusterInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ManagedClusterInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the provisioningState property: The current deployment or provisioning state, which only appears in the
     * response.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the powerState property: Represents the Power State of the cluster.
     *
     * @return the powerState value.
     */
    public PowerState powerState() {
        return this.innerProperties() == null ? null : this.innerProperties().powerState();
    }

    /**
     * Get the maxAgentPools property: The max number of agent pools for the managed cluster.
     *
     * @return the maxAgentPools value.
     */
    public Integer maxAgentPools() {
        return this.innerProperties() == null ? null : this.innerProperties().maxAgentPools();
    }

    /**
     * Get the kubernetesVersion property: Version of Kubernetes specified when creating the managed cluster.
     *
     * @return the kubernetesVersion value.
     */
    public String kubernetesVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().kubernetesVersion();
    }

    /**
     * Set the kubernetesVersion property: Version of Kubernetes specified when creating the managed cluster.
     *
     * @param kubernetesVersion the kubernetesVersion value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withKubernetesVersion(String kubernetesVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withKubernetesVersion(kubernetesVersion);
        return this;
    }

    /**
     * Get the dnsPrefix property: DNS prefix specified when creating the managed cluster.
     *
     * @return the dnsPrefix value.
     */
    public String dnsPrefix() {
        return this.innerProperties() == null ? null : this.innerProperties().dnsPrefix();
    }

    /**
     * Set the dnsPrefix property: DNS prefix specified when creating the managed cluster.
     *
     * @param dnsPrefix the dnsPrefix value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withDnsPrefix(String dnsPrefix) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withDnsPrefix(dnsPrefix);
        return this;
    }

    /**
     * Get the fqdn property: FQDN for the master pool.
     *
     * @return the fqdn value.
     */
    public String fqdn() {
        return this.innerProperties() == null ? null : this.innerProperties().fqdn();
    }

    /**
     * Get the privateFqdn property: FQDN of private cluster.
     *
     * @return the privateFqdn value.
     */
    public String privateFqdn() {
        return this.innerProperties() == null ? null : this.innerProperties().privateFqdn();
    }

    /**
     * Get the agentPoolProfiles property: Properties of the agent pool.
     *
     * @return the agentPoolProfiles value.
     */
    public List<ManagedClusterAgentPoolProfile> agentPoolProfiles() {
        return this.innerProperties() == null ? null : this.innerProperties().agentPoolProfiles();
    }

    /**
     * Set the agentPoolProfiles property: Properties of the agent pool.
     *
     * @param agentPoolProfiles the agentPoolProfiles value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withAgentPoolProfiles(List<ManagedClusterAgentPoolProfile> agentPoolProfiles) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withAgentPoolProfiles(agentPoolProfiles);
        return this;
    }

    /**
     * Get the linuxProfile property: Profile for Linux VMs in the container service cluster.
     *
     * @return the linuxProfile value.
     */
    public ContainerServiceLinuxProfile linuxProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().linuxProfile();
    }

    /**
     * Set the linuxProfile property: Profile for Linux VMs in the container service cluster.
     *
     * @param linuxProfile the linuxProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withLinuxProfile(ContainerServiceLinuxProfile linuxProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withLinuxProfile(linuxProfile);
        return this;
    }

    /**
     * Get the windowsProfile property: Profile for Windows VMs in the container service cluster.
     *
     * @return the windowsProfile value.
     */
    public ManagedClusterWindowsProfile windowsProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().windowsProfile();
    }

    /**
     * Set the windowsProfile property: Profile for Windows VMs in the container service cluster.
     *
     * @param windowsProfile the windowsProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withWindowsProfile(ManagedClusterWindowsProfile windowsProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withWindowsProfile(windowsProfile);
        return this;
    }

    /**
     * Get the servicePrincipalProfile property: Information about a service principal identity for the cluster to use
     * for manipulating Azure APIs.
     *
     * @return the servicePrincipalProfile value.
     */
    public ManagedClusterServicePrincipalProfile servicePrincipalProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().servicePrincipalProfile();
    }

    /**
     * Set the servicePrincipalProfile property: Information about a service principal identity for the cluster to use
     * for manipulating Azure APIs.
     *
     * @param servicePrincipalProfile the servicePrincipalProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withServicePrincipalProfile(
        ManagedClusterServicePrincipalProfile servicePrincipalProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withServicePrincipalProfile(servicePrincipalProfile);
        return this;
    }

    /**
     * Get the addonProfiles property: Profile of managed cluster add-on.
     *
     * @return the addonProfiles value.
     */
    public Map<String, ManagedClusterAddonProfile> addonProfiles() {
        return this.innerProperties() == null ? null : this.innerProperties().addonProfiles();
    }

    /**
     * Set the addonProfiles property: Profile of managed cluster add-on.
     *
     * @param addonProfiles the addonProfiles value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withAddonProfiles(Map<String, ManagedClusterAddonProfile> addonProfiles) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withAddonProfiles(addonProfiles);
        return this;
    }

    /**
     * Get the podIdentityProfile property: Profile of managed cluster pod identity.
     *
     * @return the podIdentityProfile value.
     */
    public ManagedClusterPodIdentityProfile podIdentityProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().podIdentityProfile();
    }

    /**
     * Set the podIdentityProfile property: Profile of managed cluster pod identity.
     *
     * @param podIdentityProfile the podIdentityProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withPodIdentityProfile(ManagedClusterPodIdentityProfile podIdentityProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withPodIdentityProfile(podIdentityProfile);
        return this;
    }

    /**
     * Get the nodeResourceGroup property: Name of the resource group containing agent pool nodes.
     *
     * @return the nodeResourceGroup value.
     */
    public String nodeResourceGroup() {
        return this.innerProperties() == null ? null : this.innerProperties().nodeResourceGroup();
    }

    /**
     * Set the nodeResourceGroup property: Name of the resource group containing agent pool nodes.
     *
     * @param nodeResourceGroup the nodeResourceGroup value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withNodeResourceGroup(String nodeResourceGroup) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withNodeResourceGroup(nodeResourceGroup);
        return this;
    }

    /**
     * Get the enableRbac property: Whether to enable Kubernetes Role-Based Access Control.
     *
     * @return the enableRbac value.
     */
    public Boolean enableRbac() {
        return this.innerProperties() == null ? null : this.innerProperties().enableRbac();
    }

    /**
     * Set the enableRbac property: Whether to enable Kubernetes Role-Based Access Control.
     *
     * @param enableRbac the enableRbac value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withEnableRbac(Boolean enableRbac) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withEnableRbac(enableRbac);
        return this;
    }

    /**
     * Get the enablePodSecurityPolicy property: (DEPRECATING) Whether to enable Kubernetes pod security policy
     * (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy.
     *
     * @return the enablePodSecurityPolicy value.
     */
    public Boolean enablePodSecurityPolicy() {
        return this.innerProperties() == null ? null : this.innerProperties().enablePodSecurityPolicy();
    }

    /**
     * Set the enablePodSecurityPolicy property: (DEPRECATING) Whether to enable Kubernetes pod security policy
     * (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy.
     *
     * @param enablePodSecurityPolicy the enablePodSecurityPolicy value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withEnablePodSecurityPolicy(Boolean enablePodSecurityPolicy) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withEnablePodSecurityPolicy(enablePodSecurityPolicy);
        return this;
    }

    /**
     * Get the networkProfile property: Profile of network configuration.
     *
     * @return the networkProfile value.
     */
    public ContainerServiceNetworkProfile networkProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().networkProfile();
    }

    /**
     * Set the networkProfile property: Profile of network configuration.
     *
     * @param networkProfile the networkProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withNetworkProfile(ContainerServiceNetworkProfile networkProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withNetworkProfile(networkProfile);
        return this;
    }

    /**
     * Get the aadProfile property: Profile of Azure Active Directory configuration.
     *
     * @return the aadProfile value.
     */
    public ManagedClusterAadProfile aadProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().aadProfile();
    }

    /**
     * Set the aadProfile property: Profile of Azure Active Directory configuration.
     *
     * @param aadProfile the aadProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withAadProfile(ManagedClusterAadProfile aadProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withAadProfile(aadProfile);
        return this;
    }

    /**
     * Get the autoUpgradeProfile property: Profile of auto upgrade configuration.
     *
     * @return the autoUpgradeProfile value.
     */
    public ManagedClusterAutoUpgradeProfile autoUpgradeProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeProfile();
    }

    /**
     * Set the autoUpgradeProfile property: Profile of auto upgrade configuration.
     *
     * @param autoUpgradeProfile the autoUpgradeProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withAutoUpgradeProfile(ManagedClusterAutoUpgradeProfile autoUpgradeProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withAutoUpgradeProfile(autoUpgradeProfile);
        return this;
    }

    /**
     * Get the autoScalerProfile property: Parameters to be applied to the cluster-autoscaler when enabled.
     *
     * @return the autoScalerProfile value.
     */
    public ManagedClusterPropertiesAutoScalerProfile autoScalerProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().autoScalerProfile();
    }

    /**
     * Set the autoScalerProfile property: Parameters to be applied to the cluster-autoscaler when enabled.
     *
     * @param autoScalerProfile the autoScalerProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withAutoScalerProfile(ManagedClusterPropertiesAutoScalerProfile autoScalerProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withAutoScalerProfile(autoScalerProfile);
        return this;
    }

    /**
     * Get the apiServerAccessProfile property: Access profile for managed cluster API server.
     *
     * @return the apiServerAccessProfile value.
     */
    public ManagedClusterApiServerAccessProfile apiServerAccessProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().apiServerAccessProfile();
    }

    /**
     * Set the apiServerAccessProfile property: Access profile for managed cluster API server.
     *
     * @param apiServerAccessProfile the apiServerAccessProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withApiServerAccessProfile(ManagedClusterApiServerAccessProfile apiServerAccessProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withApiServerAccessProfile(apiServerAccessProfile);
        return this;
    }

    /**
     * Get the diskEncryptionSetId property: ResourceId of the disk encryption set to use for enabling encryption at
     * rest.
     *
     * @return the diskEncryptionSetId value.
     */
    public String diskEncryptionSetId() {
        return this.innerProperties() == null ? null : this.innerProperties().diskEncryptionSetId();
    }

    /**
     * Set the diskEncryptionSetId property: ResourceId of the disk encryption set to use for enabling encryption at
     * rest.
     *
     * @param diskEncryptionSetId the diskEncryptionSetId value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withDiskEncryptionSetId(String diskEncryptionSetId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withDiskEncryptionSetId(diskEncryptionSetId);
        return this;
    }

    /**
     * Get the identityProfile property: Identities associated with the cluster.
     *
     * @return the identityProfile value.
     */
    public Map<String, ManagedClusterPropertiesIdentityProfile> identityProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().identityProfile();
    }

    /**
     * Set the identityProfile property: Identities associated with the cluster.
     *
     * @param identityProfile the identityProfile value to set.
     * @return the ManagedClusterInner object itself.
     */
    public ManagedClusterInner withIdentityProfile(
        Map<String, ManagedClusterPropertiesIdentityProfile> identityProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ManagedClusterProperties();
        }
        this.innerProperties().withIdentityProfile(identityProfile);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sku() != null) {
            sku().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
        if (identity() != null) {
            identity().validate();
        }
    }
}
