· 6 years ago · Apr 06, 2020, 06:54 PM
1jaypipes@udb42383a8e5155:~/go/src/github.com/jaypipes/aws-api-tools$ go run cmd/aws-api-tool/main.go schema appmesh > /tmp/appmesh.yaml
2jaypipes@udb42383a8e5155:~/go/src/github.com/jaypipes/aws-api-tools$ head -n20 /tmp/appmesh.yaml
3components:
4 schemas:
5 AccessLog:
6 properties:
7 file:
8 $ref: '#/components/schemas/FileAccessLog'
9 type: object
10 AccountId:
11 maxLength: 12
12 minLength: 12
13 type: string
14 Arn:
15 type: string
16 AwsCloudMapInstanceAttribute:
17 properties:
18 key:
19 maxLength: 255
20 minLength: 1
21 pattern: ^[a-zA-Z0-9!-~]+$
22 type: string
23jaypipes@udb42383a8e5155:~/go/src/github.com/aws/aws-service-operator-k8s$ go run cmd/ack-generate/main.go types < /tmp/appmesh.yaml
24// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
25//
26// Licensed under the Apache License, Version 2.0 (the "License"). You may
27// not use this file except in compliance with the License. A copy of the
28// License is located at
29//
30// http://aws.amazon.com/apache2.0/
31//
32// or in the "license" file accompanying this file. This file is distributed
33// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
34// express or implied. See the License for the specific language governing
35// permissions and limitations under the License.
36
37package v1alpha1
38
39import (
40 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
41)
42
43
44type Duration struct {
45 Unit string `json:"unit,omitempty"`
46 Value int64 `json:"value,omitempty"`
47}
48
49type MeshRef struct {
50 Arn string `json:"arn,omitempty"`
51 MeshName string `json:"meshName,omitempty"`
52 MeshOwner string `json:"meshOwner,omitempty"`
53 ResourceOwner string `json:"resourceOwner,omitempty"`
54}
55
56type RouteRef struct {
57 Arn string `json:"arn,omitempty"`
58 MeshName string `json:"meshName,omitempty"`
59 MeshOwner string `json:"meshOwner,omitempty"`
60 ResourceOwner string `json:"resourceOwner,omitempty"`
61 RouteName string `json:"routeName,omitempty"`
62 VirtualRouterName string `json:"virtualRouterName,omitempty"`
63}
64
65type MeshData struct {
66 MeshName string `json:"meshName,omitempty"`
67 Metadata *Metadata `json:"metadata,omitempty"`
68 Spec *Spec `json:"spec,omitempty"`
69 Status *Status `json:"status,omitempty"`
70}
71
72type VirtualServiceRef struct {
73 Arn string `json:"arn,omitempty"`
74 MeshName string `json:"meshName,omitempty"`
75 MeshOwner string `json:"meshOwner,omitempty"`
76 ResourceOwner string `json:"resourceOwner,omitempty"`
77 VirtualServiceName string `json:"virtualServiceName,omitempty"`
78}
79
80type ListenerTls struct {
81 Certificate *Certificate `json:"certificate,omitempty"`
82 Mode string `json:"mode,omitempty"`
83}
84
85type VirtualNodeSpec struct {
86 BackendDefaults *BackendDefaults `json:"backendDefaults,omitempty"`
87 Backends []*Backends `json:"backends,omitempty"`
88 Listeners []*Listeners `json:"listeners,omitempty"`
89 Logging *Logging `json:"logging,omitempty"`
90 ServiceDiscovery *ServiceDiscovery `json:"serviceDiscovery,omitempty"`
91}
92
93type VirtualServiceData struct {
94 MeshName string `json:"meshName,omitempty"`
95 Metadata *Metadata `json:"metadata,omitempty"`
96 Spec *Spec `json:"spec,omitempty"`
97 Status *Status `json:"status,omitempty"`
98 VirtualServiceName string `json:"virtualServiceName,omitempty"`
99}
100
101type GrpcRouteMatch struct {
102 Metadata []*Metadata `json:"metadata,omitempty"`
103 MethodName string `json:"methodName,omitempty"`
104 ServiceName string `json:"serviceName,omitempty"`
105}
106
107type RouteStatus struct {
108 Status string `json:"status,omitempty"`
109}
110
111type TcpRoute struct {
112 Action *Action `json:"action,omitempty"`
113}
114
115type FileAccessLog struct {
116 Path string `json:"path,omitempty"`
117}
118
119type VirtualNodeData struct {
120 MeshName string `json:"meshName,omitempty"`
121 Metadata *Metadata `json:"metadata,omitempty"`
122 Spec *Spec `json:"spec,omitempty"`
123 Status *Status `json:"status,omitempty"`
124 VirtualNodeName string `json:"virtualNodeName,omitempty"`
125}
126
127type VirtualRouterSpec struct {
128 Listeners []*Listeners `json:"listeners,omitempty"`
129}
130
131type WeightedTarget struct {
132 VirtualNode string `json:"virtualNode,omitempty"`
133 Weight int64 `json:"weight,omitempty"`
134}
135
136type Logging struct {
137 AccessLog *AccessLog `json:"accessLog,omitempty"`
138}
139
140type VirtualNodeRef struct {
141 Arn string `json:"arn,omitempty"`
142 MeshName string `json:"meshName,omitempty"`
143 MeshOwner string `json:"meshOwner,omitempty"`
144 ResourceOwner string `json:"resourceOwner,omitempty"`
145 VirtualNodeName string `json:"virtualNodeName,omitempty"`
146}
147
148type HttpRouteAction struct {
149 WeightedTargets []*WeightedTargets `json:"weightedTargets,omitempty"`
150}
151
152type TagRef struct {
153 Key string `json:"key,omitempty"`
154 Value string `json:"value,omitempty"`
155}
156
157type DnsServiceDiscovery struct {
158 Hostname string `json:"hostname,omitempty"`
159}
160
161type EgressFilter struct {
162 Type string `json:"type,omitempty"`
163}
164
165type AwsCloudMapInstanceAttribute struct {
166 Key string `json:"key,omitempty"`
167 Value string `json:"value,omitempty"`
168}
169
170type TlsValidationContextAcmTrust struct {
171 CertificateAuthorityArns []string `json:"certificateAuthorityArns,omitempty"`
172}
173
174type ListenerTlsCertificate struct {
175 Acm *Acm `json:"acm,omitempty"`
176 File *File `json:"file,omitempty"`
177}
178
179type VirtualNodeServiceProvider struct {
180 VirtualNodeName string `json:"virtualNodeName,omitempty"`
181}
182
183type VirtualRouterRef struct {
184 Arn string `json:"arn,omitempty"`
185 MeshName string `json:"meshName,omitempty"`
186 MeshOwner string `json:"meshOwner,omitempty"`
187 ResourceOwner string `json:"resourceOwner,omitempty"`
188 VirtualRouterName string `json:"virtualRouterName,omitempty"`
189}
190
191type VirtualServiceProvider struct {
192 VirtualNode *VirtualNode `json:"virtualNode,omitempty"`
193 VirtualRouter *VirtualRouter `json:"virtualRouter,omitempty"`
194}
195
196type TcpRouteAction struct {
197 WeightedTargets []*WeightedTargets `json:"weightedTargets,omitempty"`
198}
199
200type TlsValidationContext struct {
201 Trust *Trust `json:"trust,omitempty"`
202}
203
204type VirtualRouterStatus struct {
205 Status string `json:"status,omitempty"`
206}
207
208type HeaderMatchMethod struct {
209 Exact string `json:"exact,omitempty"`
210 Prefix string `json:"prefix,omitempty"`
211 Range *Range `json:"range,omitempty"`
212 Regex string `json:"regex,omitempty"`
213 Suffix string `json:"suffix,omitempty"`
214}
215
216type VirtualServiceBackend struct {
217 ClientPolicy *ClientPolicy `json:"clientPolicy,omitempty"`
218 VirtualServiceName string `json:"virtualServiceName,omitempty"`
219}
220
221type MeshStatus struct {
222 Status string `json:"status,omitempty"`
223}
224
225type VirtualServiceStatus struct {
226 Status string `json:"status,omitempty"`
227}
228
229type Backend struct {
230 VirtualService *VirtualService `json:"virtualService,omitempty"`
231}
232
233type GrpcRetryPolicy struct {
234 GrpcRetryEvents []string `json:"grpcRetryEvents,omitempty"`
235 HttpRetryEvents []string `json:"httpRetryEvents,omitempty"`
236 MaxRetries int64 `json:"maxRetries,omitempty"`
237 PerRetryTimeout *PerRetryTimeout `json:"perRetryTimeout,omitempty"`
238 TcpRetryEvents []string `json:"tcpRetryEvents,omitempty"`
239}
240
241type HttpRoute struct {
242 Action *Action `json:"action,omitempty"`
243 Match *Match `json:"match,omitempty"`
244 RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"`
245}
246
247type HttpRouteHeader struct {
248 Invert bool `json:"invert,omitempty"`
249 Match *Match `json:"match,omitempty"`
250 Name string `json:"name,omitempty"`
251}
252
253type AccessLog struct {
254 File *File `json:"file,omitempty"`
255}
256
257type BackendDefaults struct {
258 ClientPolicy *ClientPolicy `json:"clientPolicy,omitempty"`
259}
260
261type ServiceDiscovery struct {
262 AwsCloudMap *AwsCloudMap `json:"awsCloudMap,omitempty"`
263 Dns *Dns `json:"dns,omitempty"`
264}
265
266type TlsValidationContextFileTrust struct {
267 CertificateChain string `json:"certificateChain,omitempty"`
268}
269
270type ResourceMetadata struct {
271 Arn string `json:"arn,omitempty"`
272 CreatedAt string `json:"createdAt,omitempty"`
273 LastUpdatedAt string `json:"lastUpdatedAt,omitempty"`
274 MeshOwner string `json:"meshOwner,omitempty"`
275 ResourceOwner string `json:"resourceOwner,omitempty"`
276 Uid string `json:"uid,omitempty"`
277 Version int64 `json:"version,omitempty"`
278}
279
280type RouteData struct {
281 MeshName string `json:"meshName,omitempty"`
282 Metadata *Metadata `json:"metadata,omitempty"`
283 RouteName string `json:"routeName,omitempty"`
284 Spec *Spec `json:"spec,omitempty"`
285 Status *Status `json:"status,omitempty"`
286 VirtualRouterName string `json:"virtualRouterName,omitempty"`
287}
288
289type TlsValidationContextTrust struct {
290 Acm *Acm `json:"acm,omitempty"`
291 File *File `json:"file,omitempty"`
292}
293
294type VirtualRouterData struct {
295 MeshName string `json:"meshName,omitempty"`
296 Metadata *Metadata `json:"metadata,omitempty"`
297 Spec *Spec `json:"spec,omitempty"`
298 Status *Status `json:"status,omitempty"`
299 VirtualRouterName string `json:"virtualRouterName,omitempty"`
300}
301
302type RouteSpec struct {
303 GrpcRoute *GrpcRoute `json:"grpcRoute,omitempty"`
304 Http2Route *Http2Route `json:"http2Route,omitempty"`
305 HttpRoute *HttpRoute `json:"httpRoute,omitempty"`
306 Priority int64 `json:"priority,omitempty"`
307 TcpRoute *TcpRoute `json:"tcpRoute,omitempty"`
308}
309
310type MeshSpec struct {
311 EgressFilter *EgressFilter `json:"egressFilter,omitempty"`
312}
313
314type ListenerTlsFileCertificate struct {
315 CertificateChain string `json:"certificateChain,omitempty"`
316 PrivateKey string `json:"privateKey,omitempty"`
317}
318
319type MatchRange struct {
320 End int64 `json:"end,omitempty"`
321 Start int64 `json:"start,omitempty"`
322}
323
324type ClientPolicy struct {
325 Tls *Tls `json:"tls,omitempty"`
326}
327
328type GrpcRouteMetadata struct {
329 Invert bool `json:"invert,omitempty"`
330 Match *Match `json:"match,omitempty"`
331 Name string `json:"name,omitempty"`
332}
333
334type VirtualServiceSpec struct {
335 Provider *Provider `json:"provider,omitempty"`
336}
337
338type VirtualNodeStatus struct {
339 Status string `json:"status,omitempty"`
340}
341
342type VirtualRouterServiceProvider struct {
343 VirtualRouterName string `json:"virtualRouterName,omitempty"`
344}
345
346type HttpRouteMatch struct {
347 Headers []*Headers `json:"headers,omitempty"`
348 Method string `json:"method,omitempty"`
349 Prefix string `json:"prefix,omitempty"`
350 Scheme string `json:"scheme,omitempty"`
351}
352
353type PortMapping struct {
354 Port int64 `json:"port,omitempty"`
355 Protocol string `json:"protocol,omitempty"`
356}
357
358type AwsCloudMapServiceDiscovery struct {
359 Attributes []*Attributes `json:"attributes,omitempty"`
360 NamespaceName string `json:"namespaceName,omitempty"`
361 ServiceName string `json:"serviceName,omitempty"`
362}
363
364type GrpcRoute struct {
365 Action *Action `json:"action,omitempty"`
366 Match *Match `json:"match,omitempty"`
367 RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"`
368}
369
370type HealthCheckPolicy struct {
371 HealthyThreshold int64 `json:"healthyThreshold,omitempty"`
372 IntervalMillis int64 `json:"intervalMillis,omitempty"`
373 Path string `json:"path,omitempty"`
374 Port int64 `json:"port,omitempty"`
375 Protocol string `json:"protocol,omitempty"`
376 TimeoutMillis int64 `json:"timeoutMillis,omitempty"`
377 UnhealthyThreshold int64 `json:"unhealthyThreshold,omitempty"`
378}
379
380type HttpRetryPolicy struct {
381 HttpRetryEvents []string `json:"httpRetryEvents,omitempty"`
382 MaxRetries int64 `json:"maxRetries,omitempty"`
383 PerRetryTimeout *PerRetryTimeout `json:"perRetryTimeout,omitempty"`
384 TcpRetryEvents []string `json:"tcpRetryEvents,omitempty"`
385}
386
387type Listener struct {
388 HealthCheck *HealthCheck `json:"healthCheck,omitempty"`
389 PortMapping *PortMapping `json:"portMapping,omitempty"`
390 Tls *Tls `json:"tls,omitempty"`
391}
392
393type GrpcRouteMetadataMatchMethod struct {
394 Exact string `json:"exact,omitempty"`
395 Prefix string `json:"prefix,omitempty"`
396 Range *Range `json:"range,omitempty"`
397 Regex string `json:"regex,omitempty"`
398 Suffix string `json:"suffix,omitempty"`
399}
400
401type VirtualRouterListener struct {
402 PortMapping *PortMapping `json:"portMapping,omitempty"`
403}
404
405type ClientPolicyTls struct {
406 Enforce bool `json:"enforce,omitempty"`
407 Ports []int64 `json:"ports,omitempty"`
408 Validation *Validation `json:"validation,omitempty"`
409}
410
411type GrpcRouteAction struct {
412 WeightedTargets []*WeightedTargets `json:"weightedTargets,omitempty"`
413}
414
415type ListenerTlsAcmCertificate struct {
416 CertificateArn string `json:"certificateArn,omitempty"`
417}
418
419// RouteSpec defines the desired state of Route
420type RouteSpec struct {
421 // The Arn attr is on all AWS service API CRs. It represents the Amazon
422 // Resource Name for the object. CRs of this Kind that are created without
423 // an Arn attr will be created by the controller. CRs of this Kind that
424 // are created with a non-nil Arn attr are considered by the controller to
425 // already exist in the backend AWS service API.
426 Arn string `json:"arn,omitempty"`
427 ClientToken string `json:"clientToken,omitempty"`
428 MeshName string `json:"meshName,omitempty"`
429 MeshOwner string `json:"meshOwner,omitempty"`
430 RouteName string `json:"routeName,omitempty"`
431 Spec *Spec `json:"spec,omitempty"`
432 Tags []*Tags `json:"tags,omitempty"`
433 VirtualRouterName string `json:"virtualRouterName,omitempty"`
434}
435
436// RouteStatus defines the observed state of Route
437type RouteStatus struct {
438 MeshName string `json:"meshName,omitempty"`
439 Metadata *Metadata `json:"metadata,omitempty"`
440 RouteName string `json:"routeName,omitempty"`
441 Spec *Spec `json:"spec,omitempty"`
442 Status *Status `json:"status,omitempty"`
443 VirtualRouterName string `json:"virtualRouterName,omitempty"`
444}
445
446// Route is the Schema for the Routes API
447type Route struct {
448 metav1.TypeMeta `json:",inline"`
449 metav1.ObjectMeta `json:"metadata,omitempty"`
450 Spec RouteSpec `json:"spec,omitempty"`
451 Status RouteStatus `json:"status,omitempty"`
452}
453
454// RouteList contains a list of Route
455type RouteList struct {
456 metav1.TypeMeta `json:",inline"`
457 metav1.ListMeta `json:"metadata,omitempty"`
458 Items []Route `json:"items"`
459}
460
461// VirtualNodeSpec defines the desired state of VirtualNode
462type VirtualNodeSpec struct {
463 // The Arn attr is on all AWS service API CRs. It represents the Amazon
464 // Resource Name for the object. CRs of this Kind that are created without
465 // an Arn attr will be created by the controller. CRs of this Kind that
466 // are created with a non-nil Arn attr are considered by the controller to
467 // already exist in the backend AWS service API.
468 Arn string `json:"arn,omitempty"`
469 ClientToken string `json:"clientToken,omitempty"`
470 MeshName string `json:"meshName,omitempty"`
471 MeshOwner string `json:"meshOwner,omitempty"`
472 Spec *Spec `json:"spec,omitempty"`
473 Tags []*Tags `json:"tags,omitempty"`
474 VirtualNodeName string `json:"virtualNodeName,omitempty"`
475}
476
477// VirtualNodeStatus defines the observed state of VirtualNode
478type VirtualNodeStatus struct {
479 MeshName string `json:"meshName,omitempty"`
480 Metadata *Metadata `json:"metadata,omitempty"`
481 Spec *Spec `json:"spec,omitempty"`
482 Status *Status `json:"status,omitempty"`
483 VirtualNodeName string `json:"virtualNodeName,omitempty"`
484}
485
486// VirtualNode is the Schema for the VirtualNodes API
487type VirtualNode struct {
488 metav1.TypeMeta `json:",inline"`
489 metav1.ObjectMeta `json:"metadata,omitempty"`
490 Spec VirtualNodeSpec `json:"spec,omitempty"`
491 Status VirtualNodeStatus `json:"status,omitempty"`
492}
493
494// VirtualNodeList contains a list of VirtualNode
495type VirtualNodeList struct {
496 metav1.TypeMeta `json:",inline"`
497 metav1.ListMeta `json:"metadata,omitempty"`
498 Items []VirtualNode `json:"items"`
499}
500
501// VirtualRouterSpec defines the desired state of VirtualRouter
502type VirtualRouterSpec struct {
503 // The Arn attr is on all AWS service API CRs. It represents the Amazon
504 // Resource Name for the object. CRs of this Kind that are created without
505 // an Arn attr will be created by the controller. CRs of this Kind that
506 // are created with a non-nil Arn attr are considered by the controller to
507 // already exist in the backend AWS service API.
508 Arn string `json:"arn,omitempty"`
509 ClientToken string `json:"clientToken,omitempty"`
510 MeshName string `json:"meshName,omitempty"`
511 MeshOwner string `json:"meshOwner,omitempty"`
512 Spec *Spec `json:"spec,omitempty"`
513 Tags []*Tags `json:"tags,omitempty"`
514 VirtualRouterName string `json:"virtualRouterName,omitempty"`
515}
516
517// VirtualRouterStatus defines the observed state of VirtualRouter
518type VirtualRouterStatus struct {
519 MeshName string `json:"meshName,omitempty"`
520 Metadata *Metadata `json:"metadata,omitempty"`
521 Spec *Spec `json:"spec,omitempty"`
522 Status *Status `json:"status,omitempty"`
523 VirtualRouterName string `json:"virtualRouterName,omitempty"`
524}
525
526// VirtualRouter is the Schema for the VirtualRouters API
527type VirtualRouter struct {
528 metav1.TypeMeta `json:",inline"`
529 metav1.ObjectMeta `json:"metadata,omitempty"`
530 Spec VirtualRouterSpec `json:"spec,omitempty"`
531 Status VirtualRouterStatus `json:"status,omitempty"`
532}
533
534// VirtualRouterList contains a list of VirtualRouter
535type VirtualRouterList struct {
536 metav1.TypeMeta `json:",inline"`
537 metav1.ListMeta `json:"metadata,omitempty"`
538 Items []VirtualRouter `json:"items"`
539}
540
541// VirtualServiceSpec defines the desired state of VirtualService
542type VirtualServiceSpec struct {
543 // The Arn attr is on all AWS service API CRs. It represents the Amazon
544 // Resource Name for the object. CRs of this Kind that are created without
545 // an Arn attr will be created by the controller. CRs of this Kind that
546 // are created with a non-nil Arn attr are considered by the controller to
547 // already exist in the backend AWS service API.
548 Arn string `json:"arn,omitempty"`
549 ClientToken string `json:"clientToken,omitempty"`
550 MeshName string `json:"meshName,omitempty"`
551 MeshOwner string `json:"meshOwner,omitempty"`
552 Spec *Spec `json:"spec,omitempty"`
553 Tags []*Tags `json:"tags,omitempty"`
554 VirtualServiceName string `json:"virtualServiceName,omitempty"`
555}
556
557// VirtualServiceStatus defines the observed state of VirtualService
558type VirtualServiceStatus struct {
559 MeshName string `json:"meshName,omitempty"`
560 Metadata *Metadata `json:"metadata,omitempty"`
561 Spec *Spec `json:"spec,omitempty"`
562 Status *Status `json:"status,omitempty"`
563 VirtualServiceName string `json:"virtualServiceName,omitempty"`
564}
565
566// VirtualService is the Schema for the VirtualServices API
567type VirtualService struct {
568 metav1.TypeMeta `json:",inline"`
569 metav1.ObjectMeta `json:"metadata,omitempty"`
570 Spec VirtualServiceSpec `json:"spec,omitempty"`
571 Status VirtualServiceStatus `json:"status,omitempty"`
572}
573
574// VirtualServiceList contains a list of VirtualService
575type VirtualServiceList struct {
576 metav1.TypeMeta `json:",inline"`
577 metav1.ListMeta `json:"metadata,omitempty"`
578 Items []VirtualService `json:"items"`
579}
580
581// MeshSpec defines the desired state of Mesh
582type MeshSpec struct {
583 // The Arn attr is on all AWS service API CRs. It represents the Amazon
584 // Resource Name for the object. CRs of this Kind that are created without
585 // an Arn attr will be created by the controller. CRs of this Kind that
586 // are created with a non-nil Arn attr are considered by the controller to
587 // already exist in the backend AWS service API.
588 Arn string `json:"arn,omitempty"`
589 ClientToken string `json:"clientToken,omitempty"`
590 MeshName string `json:"meshName,omitempty"`
591 Spec *Spec `json:"spec,omitempty"`
592 Tags []*Tags `json:"tags,omitempty"`
593}
594
595// MeshStatus defines the observed state of Mesh
596type MeshStatus struct {
597 MeshName string `json:"meshName,omitempty"`
598 Metadata *Metadata `json:"metadata,omitempty"`
599 Spec *Spec `json:"spec,omitempty"`
600 Status *Status `json:"status,omitempty"`
601}
602
603// Mesh is the Schema for the Meshes API
604type Mesh struct {
605 metav1.TypeMeta `json:",inline"`
606 metav1.ObjectMeta `json:"metadata,omitempty"`
607 Spec MeshSpec `json:"spec,omitempty"`
608 Status MeshStatus `json:"status,omitempty"`
609}
610
611// MeshList contains a list of Mesh
612type MeshList struct {
613 metav1.TypeMeta `json:",inline"`
614 metav1.ListMeta `json:"metadata,omitempty"`
615 Items []Mesh `json:"items"`
616}
617
618
619func init() {
620 SchemeBuilder.Register(&Route{}, &RouteList{})
621 SchemeBuilder.Register(&VirtualNode{}, &VirtualNodeList{})
622 SchemeBuilder.Register(&VirtualRouter{}, &VirtualRouterList{})
623 SchemeBuilder.Register(&VirtualService{}, &VirtualServiceList{})
624 SchemeBuilder.Register(&Mesh{}, &MeshList{})
625}