/
ContainerServiceManagedClusterData.cs
83 lines (78 loc) · 3.89 KB
/
ContainerServiceManagedClusterData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Azure.Core;
using Azure.ResourceManager.ContainerService.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources.Models;
namespace Azure.ResourceManager.ContainerService
{
/// <summary> A class representing the ContainerServiceManagedCluster data model. </summary>
public partial class ContainerServiceManagedClusterData
{
/// <summary> Azure Defender settings for the security profile. </summary>
[Obsolete("This property is obsolete and will be removed in a future release", false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public ManagedClusterSecurityProfileAzureDefender SecurityAzureDefender
{
get
{
if (SecurityProfile != null && SecurityProfile.Defender != null)
{
return new ManagedClusterSecurityProfileAzureDefender
{
IsEnabled = SecurityProfile.Defender.IsSecurityMonitoringEnabled,
LogAnalyticsWorkspaceResourceId = SecurityProfile.Defender.LogAnalyticsWorkspaceResourceId
};
}
return default;
}
set
{
if (SecurityProfile is null)
SecurityProfile = new ManagedClusterSecurityProfile();
SecurityProfile.Defender = new ManagedClusterSecurityProfileDefender()
{
LogAnalyticsWorkspaceResourceId = value.LogAnalyticsWorkspaceResourceId,
IsSecurityMonitoringEnabled = value.IsEnabled
};
}
}
/// <summary> For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). </summary>
[Obsolete("This property is obsolete and will be removed in a future release", false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public UpgradeChannel? UpgradeChannel
{
get => AutoUpgradeProfile is null ? default : AutoUpgradeProfile.UpgradeChannel;
set
{
if (AutoUpgradeProfile is null)
AutoUpgradeProfile = new ManagedClusterAutoUpgradeProfile();
AutoUpgradeProfile.UpgradeChannel = value;
}
}
/// <summary> The identity of the managed cluster, if configured. Current supported identity types: None, SystemAssigned, UserAssigned. </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public ManagedServiceIdentity Identity
{
//get; set;
// Update get once Azure.ResourceManager provide model factory method for ManagedServiceIdentity
get => ClusterIdentity is null ? default : new ManagedServiceIdentity(ClusterIdentity.ResourceIdentityType);
set
{
if (value is null)
ClusterIdentity = null;
else
{
IDictionary<ResourceIdentifier, UserAssignedIdentity> userAssignedIdentities = new ChangeTrackingDictionary<ResourceIdentifier, UserAssignedIdentity>();
if (value.ManagedServiceIdentityType == ManagedServiceIdentityType.UserAssigned || value.ManagedServiceIdentityType == ManagedServiceIdentityType.SystemAssignedUserAssigned)
userAssignedIdentities = value.UserAssignedIdentities;
ClusterIdentity = new ManagedClusterIdentity(value.PrincipalId, value.TenantId, value.ManagedServiceIdentityType, new ChangeTrackingDictionary<string, ManagedClusterDelegatedIdentity>(), userAssignedIdentities, null);
}
}
}
}
}