Advertisement
Guest User

\o/

a guest
Apr 3rd, 2020
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 10.70 KB | None | 0 0
  1. $ go run cmd/ack-generate/main.go types < /tmp/eks.swagger.yaml
  2. // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License"). You may
  5. // not use this file except in compliance with the License. A copy of the
  6. // License is located at
  7. //
  8. //     http://aws.amazon.com/apache2.0/
  9. //
  10. // or in the "license" file accompanying this file. This file is distributed
  11. // on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  12. // express or implied. See the License for the specific language governing
  13. // permissions and limitations under the License.
  14.  
  15. package v1alpha1
  16.  
  17. import (
  18.     metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  19. )
  20. type UpdateParam struct {
  21.     Type string `json:"type,omitempty"`
  22.     Value string `json:"value,omitempty"`
  23. }
  24.  
  25. type LogSetup struct {
  26.     Enabled bool `json:"enabled,omitempty"`
  27.     Types []string `json:"types,omitempty"`
  28. }
  29.  
  30. type NodegroupHealth struct {
  31.     Issues []*Issues `json:"issues,omitempty"`
  32. }
  33.  
  34. type EncryptionConfig struct {
  35.     Provider *Provider `json:"provider,omitempty"`
  36.     Resources []string `json:"resources,omitempty"`
  37. }
  38.  
  39. type OIDC struct {
  40.     Issuer string `json:"issuer,omitempty"`
  41. }
  42.  
  43. type VpcConfigRequest struct {
  44.     EndpointPrivateAccess bool `json:"endpointPrivateAccess,omitempty"`
  45.     EndpointPublicAccess bool `json:"endpointPublicAccess,omitempty"`
  46.     PublicAccessCidrs []string `json:"publicAccessCidrs,omitempty"`
  47.     SecurityGroupIds []string `json:"securityGroupIds,omitempty"`
  48.     SubnetIds []string `json:"subnetIds,omitempty"`
  49. }
  50.  
  51. type FargateProfileSelector struct {
  52.     Labels map[string]string `json:"labels,omitempty"`
  53.     Namespace string `json:"namespace,omitempty"`
  54. }
  55.  
  56. type Provider struct {
  57.     KeyArn string `json:"keyArn,omitempty"`
  58. }
  59.  
  60. type NodegroupResources struct {
  61.     AutoScalingGroups []*AutoScalingGroups `json:"autoScalingGroups,omitempty"`
  62.     RemoteAccessSecurityGroup string `json:"remoteAccessSecurityGroup,omitempty"`
  63. }
  64.  
  65. type RemoteAccessConfig struct {
  66.     Ec2SshKey string `json:"ec2SshKey,omitempty"`
  67.     SourceSecurityGroups []string `json:"sourceSecurityGroups,omitempty"`
  68. }
  69.  
  70. type AutoScalingGroup struct {
  71.     Name string `json:"name,omitempty"`
  72. }
  73.  
  74. type NodegroupScalingConfig struct {
  75.     DesiredSize int64 `json:"desiredSize,omitempty"`
  76.     MaxSize int64 `json:"maxSize,omitempty"`
  77.     MinSize int64 `json:"minSize,omitempty"`
  78. }
  79.  
  80. type UpdateLabelsPayload struct {
  81.     AddOrUpdateLabels map[string]string `json:"addOrUpdateLabels,omitempty"`
  82.     RemoveLabels []string `json:"removeLabels,omitempty"`
  83. }
  84.  
  85. type Update struct {
  86.     CreatedAt string `json:"createdAt,omitempty"`
  87.     Errors []*Errors `json:"errors,omitempty"`
  88.     Id string `json:"id,omitempty"`
  89.     Params []*Params `json:"params,omitempty"`
  90.     Status string `json:"status,omitempty"`
  91.     Type string `json:"type,omitempty"`
  92. }
  93.  
  94. type Logging struct {
  95.     ClusterLogging []*ClusterLogging `json:"clusterLogging,omitempty"`
  96. }
  97.  
  98. type Identity struct {
  99.     Oidc *Oidc `json:"oidc,omitempty"`
  100. }
  101.  
  102. type VpcConfigResponse struct {
  103.     ClusterSecurityGroupId string `json:"clusterSecurityGroupId,omitempty"`
  104.     EndpointPrivateAccess bool `json:"endpointPrivateAccess,omitempty"`
  105.     EndpointPublicAccess bool `json:"endpointPublicAccess,omitempty"`
  106.     PublicAccessCidrs []string `json:"publicAccessCidrs,omitempty"`
  107.     SecurityGroupIds []string `json:"securityGroupIds,omitempty"`
  108.     SubnetIds []string `json:"subnetIds,omitempty"`
  109.     VpcId string `json:"vpcId,omitempty"`
  110. }
  111.  
  112. type Certificate struct {
  113.     Data string `json:"data,omitempty"`
  114. }
  115.  
  116. type Issue struct {
  117.     Code string `json:"code,omitempty"`
  118.     Message string `json:"message,omitempty"`
  119.     ResourceIds []string `json:"resourceIds,omitempty"`
  120. }
  121.  
  122. // ClusterSpec defines the desired state of Cluster
  123. type ClusterSpec struct {
  124.     // The Arn attr is on all AWS service API CRs. It represents the Amazon
  125.     // Resource Name for the object. CRs of this Kind that are created without
  126.     // an Arn attr will be created by the controller. CRs of this Kind that
  127.     // are created with a non-nil Arn attr are considered by the controller to
  128.     // already exist in the backend AWS service API.
  129.     Arn string `json:"arn,omitempty"`
  130.     ClientRequestToken string `json:"clientRequestToken,omitempty"`
  131.     EncryptionConfig []*EncryptionConfig `json:"encryptionConfig,omitempty"`
  132.     Logging *Logging `json:"logging,omitempty"`
  133.     Name string `json:"name,omitempty"`
  134.     ResourcesVpcConfig *ResourcesVpcConfig `json:"resourcesVpcConfig,omitempty"`
  135.     RoleArn string `json:"roleArn,omitempty"`
  136.     Tags map[string]string `json:"tags,omitempty"`
  137.     Version string `json:"version,omitempty"`
  138. }
  139.  
  140. // ClusterStatus defines the observed state of Cluster
  141. type ClusterStatus struct {
  142.     Arn string `json:"arn,omitempty"`
  143.     CertificateAuthority *CertificateAuthority `json:"certificateAuthority,omitempty"`
  144.     ClientRequestToken string `json:"clientRequestToken,omitempty"`
  145.     CreatedAt string `json:"createdAt,omitempty"`
  146.     EncryptionConfig []*EncryptionConfig `json:"encryptionConfig,omitempty"`
  147.     Endpoint string `json:"endpoint,omitempty"`
  148.     Identity *Identity `json:"identity,omitempty"`
  149.     Logging *Logging `json:"logging,omitempty"`
  150.     Name string `json:"name,omitempty"`
  151.     PlatformVersion string `json:"platformVersion,omitempty"`
  152.     ResourcesVpcConfig *ResourcesVpcConfig `json:"resourcesVpcConfig,omitempty"`
  153.     RoleArn string `json:"roleArn,omitempty"`
  154.     Status string `json:"status,omitempty"`
  155.     Tags map[string]string `json:"tags,omitempty"`
  156.     Version string `json:"version,omitempty"`
  157. }
  158.  
  159. // Cluster is the Schema for the Clusters API
  160. type Cluster struct {
  161.     metav1.TypeMeta   `json:",inline"`
  162.     metav1.ObjectMeta `json:"metadata,omitempty"`
  163.     Spec   ClusterSpec   `json:"spec,omitempty"`
  164.     Status ClusterStatus `json:"status,omitempty"`
  165. }
  166.  
  167. // ClusterList contains a list of Cluster
  168. type ClusterList struct {
  169.     metav1.TypeMeta `json:",inline"`
  170.     metav1.ListMeta `json:"metadata,omitempty"`
  171.     Items           []Cluster `json:"items"`
  172. }
  173. // NodegroupSpec defines the desired state of Nodegroup
  174. type NodegroupSpec struct {
  175.     // The Arn attr is on all AWS service API CRs. It represents the Amazon
  176.     // Resource Name for the object. CRs of this Kind that are created without
  177.     // an Arn attr will be created by the controller. CRs of this Kind that
  178.     // are created with a non-nil Arn attr are considered by the controller to
  179.     // already exist in the backend AWS service API.
  180.     Arn string `json:"arn,omitempty"`
  181.     AmiType string `json:"amiType,omitempty"`
  182.     ClientRequestToken string `json:"clientRequestToken,omitempty"`
  183.     ClusterName string `json:"clusterName,omitempty"`
  184.     DiskSize int64 `json:"diskSize,omitempty"`
  185.     InstanceTypes []string `json:"instanceTypes,omitempty"`
  186.     Labels map[string]string `json:"labels,omitempty"`
  187.     NodeRole string `json:"nodeRole,omitempty"`
  188.     NodegroupName string `json:"nodegroupName,omitempty"`
  189.     ReleaseVersion string `json:"releaseVersion,omitempty"`
  190.     RemoteAccess *RemoteAccess `json:"remoteAccess,omitempty"`
  191.     ScalingConfig *ScalingConfig `json:"scalingConfig,omitempty"`
  192.     Subnets []string `json:"subnets,omitempty"`
  193.     Tags map[string]string `json:"tags,omitempty"`
  194.     Version string `json:"version,omitempty"`
  195. }
  196.  
  197. // NodegroupStatus defines the observed state of Nodegroup
  198. type NodegroupStatus struct {
  199.     AmiType string `json:"amiType,omitempty"`
  200.     ClusterName string `json:"clusterName,omitempty"`
  201.     CreatedAt string `json:"createdAt,omitempty"`
  202.     DiskSize int64 `json:"diskSize,omitempty"`
  203.     Health *Health `json:"health,omitempty"`
  204.     InstanceTypes []string `json:"instanceTypes,omitempty"`
  205.     Labels map[string]string `json:"labels,omitempty"`
  206.     ModifiedAt string `json:"modifiedAt,omitempty"`
  207.     NodeRole string `json:"nodeRole,omitempty"`
  208.     NodegroupArn string `json:"nodegroupArn,omitempty"`
  209.     NodegroupName string `json:"nodegroupName,omitempty"`
  210.     ReleaseVersion string `json:"releaseVersion,omitempty"`
  211.     RemoteAccess *RemoteAccess `json:"remoteAccess,omitempty"`
  212.     Resources *Resources `json:"resources,omitempty"`
  213.     ScalingConfig *ScalingConfig `json:"scalingConfig,omitempty"`
  214.     Status string `json:"status,omitempty"`
  215.     Subnets []string `json:"subnets,omitempty"`
  216.     Tags map[string]string `json:"tags,omitempty"`
  217.     Version string `json:"version,omitempty"`
  218. }
  219.  
  220. // Nodegroup is the Schema for the Nodegroups API
  221. type Nodegroup struct {
  222.     metav1.TypeMeta   `json:",inline"`
  223.     metav1.ObjectMeta `json:"metadata,omitempty"`
  224.     Spec   NodegroupSpec   `json:"spec,omitempty"`
  225.     Status NodegroupStatus `json:"status,omitempty"`
  226. }
  227.  
  228. // NodegroupList contains a list of Nodegroup
  229. type NodegroupList struct {
  230.     metav1.TypeMeta `json:",inline"`
  231.     metav1.ListMeta `json:"metadata,omitempty"`
  232.     Items           []Nodegroup `json:"items"`
  233. }
  234. // FargateProfileSpec defines the desired state of FargateProfile
  235. type FargateProfileSpec struct {
  236.     // The Arn attr is on all AWS service API CRs. It represents the Amazon
  237.     // Resource Name for the object. CRs of this Kind that are created without
  238.     // an Arn attr will be created by the controller. CRs of this Kind that
  239.     // are created with a non-nil Arn attr are considered by the controller to
  240.     // already exist in the backend AWS service API.
  241.     Arn string `json:"arn,omitempty"`
  242.     ClientRequestToken string `json:"clientRequestToken,omitempty"`
  243.     ClusterName string `json:"clusterName,omitempty"`
  244.     FargateProfileName string `json:"fargateProfileName,omitempty"`
  245.     PodExecutionRoleArn string `json:"podExecutionRoleArn,omitempty"`
  246.     Selectors []*Selectors `json:"selectors,omitempty"`
  247.     Subnets []string `json:"subnets,omitempty"`
  248.     Tags map[string]string `json:"tags,omitempty"`
  249. }
  250.  
  251. // FargateProfileStatus defines the observed state of FargateProfile
  252. type FargateProfileStatus struct {
  253.     ClusterName string `json:"clusterName,omitempty"`
  254.     CreatedAt string `json:"createdAt,omitempty"`
  255.     FargateProfileArn string `json:"fargateProfileArn,omitempty"`
  256.     FargateProfileName string `json:"fargateProfileName,omitempty"`
  257.     PodExecutionRoleArn string `json:"podExecutionRoleArn,omitempty"`
  258.     Selectors []*Selectors `json:"selectors,omitempty"`
  259.     Status string `json:"status,omitempty"`
  260.     Subnets []string `json:"subnets,omitempty"`
  261.     Tags map[string]string `json:"tags,omitempty"`
  262. }
  263.  
  264. // FargateProfile is the Schema for the FargateProfiles API
  265. type FargateProfile struct {
  266.     metav1.TypeMeta   `json:",inline"`
  267.     metav1.ObjectMeta `json:"metadata,omitempty"`
  268.     Spec   FargateProfileSpec   `json:"spec,omitempty"`
  269.     Status FargateProfileStatus `json:"status,omitempty"`
  270. }
  271.  
  272. // FargateProfileList contains a list of FargateProfile
  273. type FargateProfileList struct {
  274.     metav1.TypeMeta `json:",inline"`
  275.     metav1.ListMeta `json:"metadata,omitempty"`
  276.     Items           []FargateProfile `json:"items"`
  277. }
  278.  
  279. func init() {
  280.     SchemeBuilder.Register(&Cluster{}, &ClusterList{})
  281.     SchemeBuilder.Register(&Nodegroup{}, &NodegroupList{})
  282.     SchemeBuilder.Register(&FargateProfile{}, &FargateProfileList{})
  283. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement