|
| 1 | +private import bicep |
| 2 | +private import codeql.bicep.Concepts |
| 3 | + |
| 4 | +module ManagedContainers { |
| 5 | + /** |
| 6 | + * Represents a Microsoft.ContainerService/managedClusters resource (AKS) in a Bicep file. |
| 7 | + * See: https://learn.microsoft.com/en-us/azure/templates/microsoft.containerservice/managedclusters |
| 8 | + */ |
| 9 | + class ManagedContainerResource extends Resource { |
| 10 | + /** |
| 11 | + * Constructs a ManagedContainerResource for Microsoft.ContainerService/managedClusters resources. |
| 12 | + */ |
| 13 | + ManagedContainerResource() { |
| 14 | + this.getResourceType().regexpMatch("^Microsoft.ContainerService/managedClusters@.*") |
| 15 | + } |
| 16 | + |
| 17 | + /** |
| 18 | + * Returns the properties object for the AKS resource. |
| 19 | + */ |
| 20 | + ManagedContainerProperties::Properties getProperties() { |
| 21 | + result = this.getProperty("properties") |
| 22 | + } |
| 23 | + |
| 24 | + /** |
| 25 | + * Returns the kubernetesVersion property. |
| 26 | + */ |
| 27 | + StringLiteral getKubernetesVersion() { result = this.getProperties().getKubernetesVersion() } |
| 28 | + |
| 29 | + /** |
| 30 | + * Returns the dnsPrefix property. |
| 31 | + */ |
| 32 | + StringLiteral getDnsPrefix() { result = this.getProperties().getDnsPrefix() } |
| 33 | + |
| 34 | + /** |
| 35 | + * Returns the agentPoolProfiles property. |
| 36 | + */ |
| 37 | + ManagedContainerProperties::AgentPoolProfiles getAgentPoolProfiles() { |
| 38 | + result = this.getProperties().getAgentPoolProfiles() |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Returns the networkProfile property. |
| 43 | + */ |
| 44 | + Network::NetworkProfile getNetworkProfile() { |
| 45 | + result = this.getProperties().getNetworkProfile() |
| 46 | + } |
| 47 | + |
| 48 | + override string toString() { result = "ManagedContainerResource" } |
| 49 | + } |
| 50 | + |
| 51 | + module ManagedContainerProperties { |
| 52 | + /** |
| 53 | + * Represents the properties object for a Kubernetes (AKS) resource. |
| 54 | + */ |
| 55 | + class Properties extends Object { |
| 56 | + private ManagedContainerResource resource; |
| 57 | + |
| 58 | + Properties() { this = resource.getProperty("properties") } |
| 59 | + |
| 60 | + ManagedContainerResource getManagedContainerResource() { result = resource } |
| 61 | + |
| 62 | + StringLiteral getKubernetesVersion() { result = this.getProperty("kubernetesVersion") } |
| 63 | + |
| 64 | + StringLiteral getDnsPrefix() { result = this.getProperty("dnsPrefix") } |
| 65 | + |
| 66 | + AgentPoolProfiles getAgentPoolProfiles() { |
| 67 | + result = this.getProperty("agentPoolProfiles").(Array).getElements() |
| 68 | + } |
| 69 | + |
| 70 | + Network::NetworkProfile getNetworkProfile() { result = this.getProperty("networkProfile") } |
| 71 | + |
| 72 | + ApiServerAccessProfile getApiServerAccessProfile() { |
| 73 | + result = this.getProperty("apiServerAccessProfile") |
| 74 | + } |
| 75 | + |
| 76 | + AddonProfiles getAddonProfiles() { result = this.getProperty("addonProfiles") } |
| 77 | + |
| 78 | + Expr getIdentity() { result = this.getProperty("identity") } |
| 79 | + |
| 80 | + Expr getLinuxProfile() { result = this.getProperty("linuxProfile") } |
| 81 | + |
| 82 | + Expr getWindowsProfile() { result = this.getProperty("windowsProfile") } |
| 83 | + |
| 84 | + Expr getServicePrincipalProfile() { result = this.getProperty("servicePrincipalProfile") } |
| 85 | + |
| 86 | + Expr getAadProfile() { result = this.getProperty("aadProfile") } |
| 87 | + |
| 88 | + Expr getAutoScalerProfile() { result = this.getProperty("autoScalerProfile") } |
| 89 | + |
| 90 | + Expr getHttpProxyConfig() { result = this.getProperty("httpProxyConfig") } |
| 91 | + |
| 92 | + Expr getPodIdentityProfile() { result = this.getProperty("podIdentityProfile") } |
| 93 | + |
| 94 | + Expr getWorkloadAutoScalerProfile() { result = this.getProperty("workloadAutoScalerProfile") } |
| 95 | + |
| 96 | + Expr getStorageProfile() { result = this.getProperty("storageProfile") } |
| 97 | + |
| 98 | + Sku getSku() { result = this.getProperty("sku") } |
| 99 | + |
| 100 | + Tags getTags() { result = this.getProperty("tags") } |
| 101 | + |
| 102 | + string toString() { result = "ManagedContainerProperties" } |
| 103 | + } |
| 104 | + |
| 105 | + class AgentPoolProfiles extends Object { |
| 106 | + private Properties properties; |
| 107 | + |
| 108 | + AgentPoolProfiles() { |
| 109 | + this = properties.getProperty("agentPoolProfiles").(Array).getElements() |
| 110 | + } |
| 111 | + |
| 112 | + StringLiteral getName() { result = this.getProperty("name") } |
| 113 | + |
| 114 | + StringLiteral getVmSize() { result = this.getProperty("vmSize") } |
| 115 | + |
| 116 | + Expr getCount() { result = this.getProperty("count") } |
| 117 | + |
| 118 | + Expr getOsType() { result = this.getProperty("osType") } |
| 119 | + |
| 120 | + Expr getMode() { result = this.getProperty("mode") } |
| 121 | + |
| 122 | + string toString() { result = "AgentPoolProfiles" } |
| 123 | + } |
| 124 | + |
| 125 | + class ApiServerAccessProfile extends Object { |
| 126 | + private Properties properties; |
| 127 | + |
| 128 | + ApiServerAccessProfile() { this = properties.getProperty("apiServerAccessProfile") } |
| 129 | + |
| 130 | + StringLiteral getEnablePrivateCluster() { result = this.getProperty("enablePrivateCluster") } |
| 131 | + |
| 132 | + StringLiteral getPrivateDnsZone() { result = this.getProperty("privateDnsZone") } |
| 133 | + |
| 134 | + string toString() { result = "ApiServerAccessProfile" } |
| 135 | + } |
| 136 | + |
| 137 | + class AddonProfiles extends Object { |
| 138 | + private Properties properties; |
| 139 | + |
| 140 | + AddonProfiles() { this = properties.getProperty("addonProfiles") } |
| 141 | + |
| 142 | + AddonKubeDashboard getKubeDashboard() { result = this.getProperty("kubeDashboard") } |
| 143 | + |
| 144 | + string toString() { result = "AddonProfiles" } |
| 145 | + } |
| 146 | + |
| 147 | + class AddonKubeDashboard extends Object { |
| 148 | + private AddonProfiles profiles; |
| 149 | + |
| 150 | + AddonKubeDashboard() { this = profiles.getProperty("kubeDashboard") } |
| 151 | + |
| 152 | + Boolean getEnabled() { result = this.getProperty("enabled") } |
| 153 | + |
| 154 | + string toString() { result = "AddonKubeDashboard" } |
| 155 | + } |
| 156 | + |
| 157 | + class AddonAzurePolicy extends Object { |
| 158 | + private AddonProfiles profiles; |
| 159 | + |
| 160 | + AddonAzurePolicy() { this = profiles.getProperty("azurePolicy") } |
| 161 | + |
| 162 | + Boolean getEnabled() { result = this.getProperty("enabled") } |
| 163 | + |
| 164 | + string toString() { result = "AddonAzurePolicy" } |
| 165 | + } |
| 166 | + } |
| 167 | +} |
0 commit comments