-
Notifications
You must be signed in to change notification settings - Fork 5k
/
fleet.tsp
238 lines (200 loc) · 7.57 KB
/
fleet.tsp
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
import "@typespec/rest";
import "@typespec/openapi";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "./helpers.tsp";
using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;
using Azure.Core;
using Azure.Core.Traits;
using TypeSpec.OpenAPI;
namespace Microsoft.ContainerService;
@doc("The Fleet resource.")
@resource("fleets")
model Fleet is TrackedResource<FleetProperties> {
@doc("The name of the Fleet resource.")
@pattern("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
@minLength(1)
@maxLength(63)
@key("fleetName")
@path
@segment("fleets")
@visibility("create", "read")
name: string;
...EntityTag;
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "https://github.com/Azure/typespec-azure/issues/2840"
@added(Versions.v2023_06_15_preview)
@doc("Managed identity.")
identity?: Azure.ResourceManager.Foundations.ManagedIdentityProperties;
}
@doc("Fleet properties.")
model FleetProperties {
// adding a response header in the model currently impacts the model used in the List result model.
// omitting it for now as response headers do not impact SDK generation.
// ...EtagResponseEnvelope;
@visibility("read")
@doc("The status of the last operation.")
provisioningState?: FleetProvisioningState;
#suppress "@azure-tools/typespec-providerhub/non-breaking-versioning" "https://github.com/Azure/typespec-azure/issues/3558"
@doc("The FleetHubProfile configures the Fleet's hub.")
@added(Versions.v2022_09_02_preview)
@added(Versions.v2023_03_15_preview)
@added(Versions.v2023_06_15_preview)
@added(Versions.v2023_08_15_preview)
@removed(Versions.v2023_10_15)
@added(Versions.v2024_02_02_preview)
@added(Versions.v2024_04_01)
hubProfile?: FleetHubProfile;
}
@doc("The FleetHubProfile configures the fleet hub.")
model FleetHubProfile {
@doc("DNS prefix used to create the FQDN for the Fleet hub.")
@visibility("read", "create")
@pattern("^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$")
@minLength(1)
@maxLength(54)
dnsPrefix?: string;
@added(Versions.v2023_06_15_preview)
@doc("The access profile for the Fleet hub API server.")
@visibility("read", "create")
apiServerAccessProfile?: APIServerAccessProfile;
@added(Versions.v2023_06_15_preview)
@doc("The agent profile for the Fleet hub.")
@visibility("read", "create")
agentProfile?: AgentProfile;
@visibility("read")
@doc("The FQDN of the Fleet hub.")
fqdn?: string;
@visibility("read")
@doc("The Kubernetes version of the Fleet hub.")
kubernetesVersion?: string;
@added(Versions.v2023_08_15_preview)
@visibility("read")
@doc("The Azure Portal FQDN of the Fleet hub.")
portalFqdn?: string;
}
scalar SubnetResourceId
extends Azure.Core.armResourceIdentifier<[
{
type: "Microsoft.Network/virtualNetworks/subnets",
}
]>;
#suppress "@azure-tools/typespec-azure-core/casing-style" "match existing AKS APIServerAccessProfile"
@doc("Access profile for the Fleet hub API server.")
model APIServerAccessProfile {
@visibility("read", "create")
@doc("Whether to create the Fleet hub as a private cluster or not.")
enablePrivateCluster?: boolean;
@visibility("read", "create")
@removed(Versions.v2024_04_01)
@doc("Whether to enable apiserver vnet integration for the Fleet hub or not.")
enableVnetIntegration?: boolean;
@visibility("read", "create")
@removed(Versions.v2024_04_01)
@doc("The subnet to be used when apiserver vnet integration is enabled. It is required when creating a new Fleet with BYO vnet.")
subnetId?: SubnetResourceId;
}
@doc("Agent profile for the Fleet hub.")
model AgentProfile {
@visibility("read", "create")
@doc("The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet and subnet will be generated and used.")
subnetId?: SubnetResourceId;
@added(Versions.v2023_08_15_preview)
@doc("The virtual machine size of the Fleet hub.")
@visibility("read", "create")
vmSize?: string;
}
@lroStatus
@doc("The provisioning state of the last accepted operation.")
union FleetProvisioningState {
string,
ResourceProvisioningState,
@doc("The provisioning state of a fleet being created.")
Creating: "Creating",
@doc("The provisioning state of a fleet being updated.")
Updating: "Updating",
@doc("The provisioning state of a fleet being deleted.")
Deleting: "Deleting",
}
@doc("Properties of a Fleet that can be patched.")
model FleetPatch {
...Azure.ResourceManager.Foundations.ArmTagsProperty;
// adding a response header in the model currently impacts the model used in the List result model.
// omitting it for now as response headers do not impact SDK generation.
// ...EtagResponseEnvelope;
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "https://github.com/Azure/typespec-azure/issues/2840"
@added(Versions.v2023_06_15_preview)
@doc("Managed identity.")
identity?: Azure.ResourceManager.Foundations.ManagedIdentityProperties;
}
@doc("One credential result item.")
model FleetCredentialResult {
@visibility("read")
@doc("The name of the credential.")
name?: string;
@visibility("read")
@doc("Base64-encoded Kubernetes configuration file.")
value?: bytes;
}
@doc("The Credential results response.")
model FleetCredentialResults {
@visibility("read")
@doc("Array of base64-encoded Kubernetes configuration files.")
@extension("x-ms-identifiers", ["name"])
kubeconfigs?: FleetCredentialResult[];
}
@armResourceOperations
interface Fleets {
@doc("Gets a Fleet.")
get is ArmResourceRead<Fleet>;
#suppress "@azure-tools/typespec-azure-core/no-operation-id" "changing the operation-id on an existing operation is an SDK breaking change"
@doc("Creates or updates a Fleet.")
@operationId("Fleets_CreateOrUpdate")
create is ArmResourceCreateOrUpdateAsync<
Fleet,
BaseParameters<Fleet> &
IfMatchParameters<Fleet> &
IfNoneMatchParameters<Fleet>
>;
#suppress "@azure-tools/typespec-providerhub/non-breaking-versioning" "Actual breaking change"
@sharedRoute
@removed(Versions.v2023_06_15_preview)
update is ArmCustomPatchSync<
Fleet,
FleetPatch,
BaseParameters<Fleet> & IfMatchParameters<Fleet>
>;
#suppress "@azure-tools/typespec-azure-core/no-operation-id" "Use operationId to keep same name as deprecated sync operation"
@added(Versions.v2023_06_15_preview)
@operationId("Fleets_Update")
@extension(
"x-ms-long-running-operation-options",
{
`final-state-via`: "original-uri",
}
)
@sharedRoute
updateAsync is ArmCustomPatchAsync<
Fleet,
FleetPatch,
BaseParameters<Fleet> & IfMatchParameters<Fleet>
>;
#suppress "deprecated" "Existing API"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "Existing API"
@sharedRoute // why do we need to set shared route on delete? compiler complains with an error
// All shared routes must agree on the value of the shared parameter.TypeSpec(@typespec/http/shared-inconsistency)
delete is ArmResourceDeleteAsync<
Fleet,
BaseParameters<Fleet> & IfMatchParameters<Fleet>
>;
@doc("Lists fleets in the specified subscription and resource group.")
listByResourceGroup is ArmResourceListByParent<Fleet>;
@doc("Lists fleets in the specified subscription.")
listBySubscription is ArmListBySubscription<Fleet>;
@doc("Lists the user credentials of a Fleet.")
listCredentials is ArmResourceActionSync<Fleet, void, FleetCredentialResults>;
}