From 3ceb868c76c73612c3b3414b6051c64d17639c6e Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 18 Oct 2021 18:27:47 -0500 Subject: [PATCH 1/7] update generator for tgw generation --- generator.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generator.yaml b/generator.yaml index 383c94a5..6ffb3534 100644 --- a/generator.yaml +++ b/generator.yaml @@ -7,6 +7,7 @@ ignore: - CreateSubnetInput.DryRun - CreateRouteTableInput.DryRun - CreateInternetGatewayInput.DryRun + - CreateTransitGatewayInput.DryRun resource_names: - AccountAttribute - CapacityReservation @@ -55,7 +56,7 @@ ignore: - TransitGatewayRouteTable - TransitGatewayRoute - TransitGatewayVpcAttachment - - TransitGateway + #- TransitGateway - Volume - VpcEndpointConnectionNotification - VpcEndpointServiceConfiguration @@ -66,6 +67,8 @@ ignore: - VpnConnectionRoute - VpnConnection - VpnGateway + operations: + - ModifyTransitGateway operations: CreateVpcEndpoint: From 27e1df9ab42350c38e9a3d4e0ab81fa0d80029b2 Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 18 Oct 2021 18:28:50 -0500 Subject: [PATCH 2/7] generate tgw create --- apis/v1alpha1/generator.yaml | 5 +- apis/v1alpha1/transit_gateway.go | 85 ++ apis/v1alpha1/types.go | 576 +++++++---- apis/v1alpha1/zz_generated.deepcopy.go | 975 +++++++++++++++++- cmd/controller/main.go | 1 + .../ec2.services.k8s.aws_transitgateways.yaml | 181 ++++ config/crd/kustomization.yaml | 1 + config/rbac/cluster-role-controller.yaml | 20 + config/rbac/role-reader.yaml | 1 + config/rbac/role-writer.yaml | 2 + .../ec2.services.k8s.aws_transitgateways.yaml | 181 ++++ helm/templates/cluster-role-controller.yaml | 20 + helm/templates/role-reader.yaml | 1 + helm/templates/role-writer.yaml | 3 + 14 files changed, 1816 insertions(+), 236 deletions(-) create mode 100644 apis/v1alpha1/transit_gateway.go create mode 100644 config/crd/bases/ec2.services.k8s.aws_transitgateways.yaml create mode 100644 helm/crds/ec2.services.k8s.aws_transitgateways.yaml diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index 383c94a5..6ffb3534 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -7,6 +7,7 @@ ignore: - CreateSubnetInput.DryRun - CreateRouteTableInput.DryRun - CreateInternetGatewayInput.DryRun + - CreateTransitGatewayInput.DryRun resource_names: - AccountAttribute - CapacityReservation @@ -55,7 +56,7 @@ ignore: - TransitGatewayRouteTable - TransitGatewayRoute - TransitGatewayVpcAttachment - - TransitGateway + #- TransitGateway - Volume - VpcEndpointConnectionNotification - VpcEndpointServiceConfiguration @@ -66,6 +67,8 @@ ignore: - VpnConnectionRoute - VpnConnection - VpnGateway + operations: + - ModifyTransitGateway operations: CreateVpcEndpoint: diff --git a/apis/v1alpha1/transit_gateway.go b/apis/v1alpha1/transit_gateway.go new file mode 100644 index 00000000..54824269 --- /dev/null +++ b/apis/v1alpha1/transit_gateway.go @@ -0,0 +1,85 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. + +// Code generated by ack-generate. DO NOT EDIT. + +package v1alpha1 + +import ( + ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TransitGatewaySpec defines the desired state of TransitGateway. +// +// Describes a transit gateway. +type TransitGatewaySpec struct { + // A description of the transit gateway. + Description *string `json:"description,omitempty"` + // The transit gateway options. + Options *TransitGatewayRequestOptions `json:"options,omitempty"` + // The tags to apply to the transit gateway. + TagSpecifications []*TagSpecification `json:"tagSpecifications,omitempty"` +} + +// TransitGatewayStatus defines the observed state of TransitGateway +type TransitGatewayStatus struct { + // All CRs managed by ACK have a common `Status.ACKResourceMetadata` member + // that is used to contain resource sync state, account ownership, + // constructed ARN for the resource + // +kubebuilder:validation:Optional + ACKResourceMetadata *ackv1alpha1.ResourceMetadata `json:"ackResourceMetadata"` + // All CRS managed by ACK have a common `Status.Conditions` member that + // contains a collection of `ackv1alpha1.Condition` objects that describe + // the various terminal states of the CR and its backend AWS service API + // resource + // +kubebuilder:validation:Optional + Conditions []*ackv1alpha1.Condition `json:"conditions"` + // The creation time. + // +kubebuilder:validation:Optional + CreationTime *metav1.Time `json:"creationTime,omitempty"` + // The ID of the AWS account ID that owns the transit gateway. + // +kubebuilder:validation:Optional + OwnerID *string `json:"ownerID,omitempty"` + // The state of the transit gateway. + // +kubebuilder:validation:Optional + State *string `json:"state,omitempty"` + // The tags for the transit gateway. + // +kubebuilder:validation:Optional + Tags []*Tag `json:"tags,omitempty"` + // The ID of the transit gateway. + // +kubebuilder:validation:Optional + TransitGatewayID *string `json:"transitGatewayID,omitempty"` +} + +// TransitGateway is the Schema for the TransitGateways API +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +type TransitGateway struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec TransitGatewaySpec `json:"spec,omitempty"` + Status TransitGatewayStatus `json:"status,omitempty"` +} + +// TransitGatewayList contains a list of TransitGateway +// +kubebuilder:object:root=true +type TransitGatewayList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TransitGateway `json:"items"` +} + +func init() { + SchemeBuilder.Register(&TransitGateway{}, &TransitGatewayList{}) +} diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index 53a95532..1d177353 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -209,9 +209,11 @@ type BlockDeviceMapping struct { // Describes a bundle task. type BundleTask struct { - BundleID *string `json:"bundleID,omitempty"` - InstanceID *string `json:"instanceID,omitempty"` - Progress *string `json:"progress,omitempty"` + BundleID *string `json:"bundleID,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + Progress *string `json:"progress,omitempty"` + StartTime *metav1.Time `json:"startTime,omitempty"` + UpdateTime *metav1.Time `json:"updateTime,omitempty"` } // Describes an error for BundleInstance. @@ -283,7 +285,9 @@ type CapacityReservation struct { AvailableInstanceCount *int64 `json:"availableInstanceCount,omitempty"` CapacityReservationARN *string `json:"capacityReservationARN,omitempty"` CapacityReservationID *string `json:"capacityReservationID,omitempty"` + CreateDate *metav1.Time `json:"createDate,omitempty"` EBSOptimized *bool `json:"ebsOptimized,omitempty"` + EndDate *metav1.Time `json:"endDate,omitempty"` EphemeralStorage *bool `json:"ephemeralStorage,omitempty"` InstanceType *string `json:"instanceType,omitempty"` OwnerID *string `json:"ownerID,omitempty"` @@ -364,7 +368,9 @@ type ClientConnectResponseOptions struct { // Describes the client-specific data. type ClientData struct { - Comment *string `json:"comment,omitempty"` + Comment *string `json:"comment,omitempty"` + UploadEnd *metav1.Time `json:"uploadEnd,omitempty"` + UploadStart *metav1.Time `json:"uploadStart,omitempty"` } // Describes the state of an authorization rule. @@ -489,6 +495,11 @@ type CreateFleetError struct { ErrorMessage *string `json:"errorMessage,omitempty"` } +// Describes the options for a VPC attachment. +type CreateTransitGatewayVPCAttachmentRequestOptions struct { + DNSSupport *string `json:"dnsSupport,omitempty"` +} + // Describes the user or group to be added or removed from the list of create // volume permissions for a volume. type CreateVolumePermission struct { @@ -550,12 +561,14 @@ type DeleteFleetError struct { type DeleteLaunchTemplateVersionsResponseErrorItem struct { LaunchTemplateID *string `json:"launchTemplateID,omitempty"` LaunchTemplateName *string `json:"launchTemplateName,omitempty"` + VersionNumber *int64 `json:"versionNumber,omitempty"` } // Describes a launch template version that was successfully deleted. type DeleteLaunchTemplateVersionsResponseSuccessItem struct { LaunchTemplateID *string `json:"launchTemplateID,omitempty"` LaunchTemplateName *string `json:"launchTemplateName,omitempty"` + VersionNumber *int64 `json:"versionNumber,omitempty"` } // Describes the error for a Reserved Instance whose queued purchase could not @@ -643,16 +656,19 @@ type DiskImage struct { type DiskImageDescription struct { Checksum *string `json:"checksum,omitempty"` ImportManifestURL *string `json:"importManifestURL,omitempty"` + Size *int64 `json:"size,omitempty"` } // Describes a disk image. type DiskImageDetail struct { + Bytes *int64 `json:"bytes,omitempty"` ImportManifestURL *string `json:"importManifestURL,omitempty"` } // Describes a disk image volume. type DiskImageVolumeDescription struct { - ID *string `json:"id,omitempty"` + ID *string `json:"id,omitempty"` + Size *int64 `json:"size,omitempty"` } // Describes a block device for an EBS volume. @@ -669,9 +685,10 @@ type EBSBlockDevice struct { // Describes a parameter used to set up an EBS volume in a block device mapping. type EBSInstanceBlockDevice struct { - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - Status *string `json:"status,omitempty"` - VolumeID *string `json:"volumeID,omitempty"` + AttachTime *metav1.Time `json:"attachTime,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Status *string `json:"status,omitempty"` + VolumeID *string `json:"volumeID,omitempty"` } // Describes information used to set up an EBS volume specified in a block device @@ -720,9 +737,10 @@ type ElasticInferenceAccelerator struct { // Describes the association between an instance and an elastic inference accelerator. type ElasticInferenceAcceleratorAssociation struct { - ElasticInferenceAcceleratorARN *string `json:"elasticInferenceAcceleratorARN,omitempty"` - ElasticInferenceAcceleratorAssociationID *string `json:"elasticInferenceAcceleratorAssociationID,omitempty"` - ElasticInferenceAcceleratorAssociationState *string `json:"elasticInferenceAcceleratorAssociationState,omitempty"` + ElasticInferenceAcceleratorARN *string `json:"elasticInferenceAcceleratorARN,omitempty"` + ElasticInferenceAcceleratorAssociationID *string `json:"elasticInferenceAcceleratorAssociationID,omitempty"` + ElasticInferenceAcceleratorAssociationState *string `json:"elasticInferenceAcceleratorAssociationState,omitempty"` + ElasticInferenceAcceleratorAssociationTime *metav1.Time `json:"elasticInferenceAcceleratorAssociationTime,omitempty"` } // Contains information about the errors that occurred when enabling fast snapshot @@ -833,16 +851,18 @@ type ExportToS3TaskSpecification struct { // Describes an Amazon FPGA image (AFI). type FPGAImage struct { - DataRetentionSupport *bool `json:"dataRetentionSupport,omitempty"` - Description *string `json:"description,omitempty"` - FPGAImageGlobalID *string `json:"fpgaImageGlobalID,omitempty"` - FPGAImageID *string `json:"fpgaImageID,omitempty"` - Name *string `json:"name,omitempty"` - OwnerAlias *string `json:"ownerAlias,omitempty"` - OwnerID *string `json:"ownerID,omitempty"` - Public *bool `json:"public,omitempty"` - ShellVersion *string `json:"shellVersion,omitempty"` - Tags []*Tag `json:"tags,omitempty"` + CreateTime *metav1.Time `json:"createTime,omitempty"` + DataRetentionSupport *bool `json:"dataRetentionSupport,omitempty"` + Description *string `json:"description,omitempty"` + FPGAImageGlobalID *string `json:"fpgaImageGlobalID,omitempty"` + FPGAImageID *string `json:"fpgaImageID,omitempty"` + Name *string `json:"name,omitempty"` + OwnerAlias *string `json:"ownerAlias,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + Public *bool `json:"public,omitempty"` + ShellVersion *string `json:"shellVersion,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + UpdateTime *metav1.Time `json:"updateTime,omitempty"` } // Describes an Amazon FPGA image (AFI) attribute. @@ -907,10 +927,13 @@ type Filter struct { // Describes an EC2 Fleet. type FleetData struct { - ClientToken *string `json:"clientToken,omitempty"` - ReplaceUnhealthyInstances *bool `json:"replaceUnhealthyInstances,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - TerminateInstancesWithExpiration *bool `json:"terminateInstancesWithExpiration,omitempty"` + ClientToken *string `json:"clientToken,omitempty"` + CreateTime *metav1.Time `json:"createTime,omitempty"` + ReplaceUnhealthyInstances *bool `json:"replaceUnhealthyInstances,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + TerminateInstancesWithExpiration *bool `json:"terminateInstancesWithExpiration,omitempty"` + ValidFrom *metav1.Time `json:"validFrom,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // Describes overrides for a launch template. @@ -984,16 +1007,28 @@ type HibernationOptionsRequest struct { Configured *bool `json:"configured,omitempty"` } +// Describes an event in the history of the Spot Fleet request. +type HistoryRecord struct { + Timestamp *metav1.Time `json:"timestamp,omitempty"` +} + +// Describes an event in the history of an EC2 Fleet. +type HistoryRecordEntry struct { + Timestamp *metav1.Time `json:"timestamp,omitempty"` +} + // Describes the properties of the Dedicated Host. type Host struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - AvailabilityZoneID *string `json:"availabilityZoneID,omitempty"` - ClientToken *string `json:"clientToken,omitempty"` - HostID *string `json:"hostID,omitempty"` - HostReservationID *string `json:"hostReservationID,omitempty"` - MemberOfServiceLinkedResourceGroup *bool `json:"memberOfServiceLinkedResourceGroup,omitempty"` - OwnerID *string `json:"ownerID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` + AllocationTime *metav1.Time `json:"allocationTime,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + AvailabilityZoneID *string `json:"availabilityZoneID,omitempty"` + ClientToken *string `json:"clientToken,omitempty"` + HostID *string `json:"hostID,omitempty"` + HostReservationID *string `json:"hostReservationID,omitempty"` + MemberOfServiceLinkedResourceGroup *bool `json:"memberOfServiceLinkedResourceGroup,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + ReleaseTime *metav1.Time `json:"releaseTime,omitempty"` + Tags []*Tag `json:"tags,omitempty"` } // Describes an instance running on a Dedicated Host. @@ -1023,14 +1058,16 @@ type HostProperties struct { // Details about the Dedicated Host Reservation and associated Dedicated Hosts. type HostReservation struct { - Count *int64 `json:"count,omitempty"` - Duration *int64 `json:"duration,omitempty"` - HostReservationID *string `json:"hostReservationID,omitempty"` - HourlyPrice *string `json:"hourlyPrice,omitempty"` - InstanceFamily *string `json:"instanceFamily,omitempty"` - OfferingID *string `json:"offeringID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - UpfrontPrice *string `json:"upfrontPrice,omitempty"` + Count *int64 `json:"count,omitempty"` + Duration *int64 `json:"duration,omitempty"` + End *metav1.Time `json:"end,omitempty"` + HostReservationID *string `json:"hostReservationID,omitempty"` + HourlyPrice *string `json:"hourlyPrice,omitempty"` + InstanceFamily *string `json:"instanceFamily,omitempty"` + OfferingID *string `json:"offeringID,omitempty"` + Start *metav1.Time `json:"start,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + UpfrontPrice *string `json:"upfrontPrice,omitempty"` } // Describes an IAM instance profile. @@ -1041,8 +1078,9 @@ type IAMInstanceProfile struct { // Describes an association between an IAM instance profile and an instance. type IAMInstanceProfileAssociation struct { - AssociationID *string `json:"associationID,omitempty"` - InstanceID *string `json:"instanceID,omitempty"` + AssociationID *string `json:"associationID,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + Timestamp *metav1.Time `json:"timestamp,omitempty"` } // Describes an IAM instance profile. @@ -1059,8 +1097,9 @@ type ICMPTypeCode struct { // Describes the ID format for a resource. type IDFormat struct { - Resource *string `json:"resource,omitempty"` - UseLongIDs *bool `json:"useLongIDs,omitempty"` + Deadline *metav1.Time `json:"deadline,omitempty"` + Resource *string `json:"resource,omitempty"` + UseLongIDs *bool `json:"useLongIDs,omitempty"` } // The internet key exchange (IKE) version permitted for the VPN tunnel. @@ -1182,6 +1221,7 @@ type ImportInstanceTaskDetails struct { // Describes an import volume task. type ImportInstanceVolumeDetailItem struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + BytesConverted *int64 `json:"bytesConverted,omitempty"` Description *string `json:"description,omitempty"` Status *string `json:"status,omitempty"` StatusMessage *string `json:"statusMessage,omitempty"` @@ -1197,34 +1237,36 @@ type ImportSnapshotTask struct { // Describes an import volume task. type ImportVolumeTaskDetails struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + BytesConverted *int64 `json:"bytesConverted,omitempty"` Description *string `json:"description,omitempty"` } // Describes an instance. type Instance struct { - AMILaunchIndex *int64 `json:"amiLaunchIndex,omitempty"` - CapacityReservationID *string `json:"capacityReservationID,omitempty"` - ClientToken *string `json:"clientToken,omitempty"` - EBSOptimized *bool `json:"ebsOptimized,omitempty"` - EnaSupport *bool `json:"enaSupport,omitempty"` - ImageID *string `json:"imageID,omitempty"` - InstanceID *string `json:"instanceID,omitempty"` - KernelID *string `json:"kernelID,omitempty"` - KeyName *string `json:"keyName,omitempty"` - OutpostARN *string `json:"outpostARN,omitempty"` - PrivateDNSName *string `json:"privateDNSName,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - PublicDNSName *string `json:"publicDNSName,omitempty"` - PublicIPAddress *string `json:"publicIPAddress,omitempty"` - RamdiskID *string `json:"ramdiskID,omitempty"` - RootDeviceName *string `json:"rootDeviceName,omitempty"` - SourceDestCheck *bool `json:"sourceDestCheck,omitempty"` - SpotInstanceRequestID *string `json:"spotInstanceRequestID,omitempty"` - SriovNetSupport *string `json:"sriovNetSupport,omitempty"` - StateTransitionReason *string `json:"stateTransitionReason,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - VPCID *string `json:"vpcID,omitempty"` + AMILaunchIndex *int64 `json:"amiLaunchIndex,omitempty"` + CapacityReservationID *string `json:"capacityReservationID,omitempty"` + ClientToken *string `json:"clientToken,omitempty"` + EBSOptimized *bool `json:"ebsOptimized,omitempty"` + EnaSupport *bool `json:"enaSupport,omitempty"` + ImageID *string `json:"imageID,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + KernelID *string `json:"kernelID,omitempty"` + KeyName *string `json:"keyName,omitempty"` + LaunchTime *metav1.Time `json:"launchTime,omitempty"` + OutpostARN *string `json:"outpostARN,omitempty"` + PrivateDNSName *string `json:"privateDNSName,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + PublicDNSName *string `json:"publicDNSName,omitempty"` + PublicIPAddress *string `json:"publicIPAddress,omitempty"` + RamdiskID *string `json:"ramdiskID,omitempty"` + RootDeviceName *string `json:"rootDeviceName,omitempty"` + SourceDestCheck *bool `json:"sourceDestCheck,omitempty"` + SpotInstanceRequestID *string `json:"spotInstanceRequestID,omitempty"` + SriovNetSupport *string `json:"sriovNetSupport,omitempty"` + StateTransitionReason *string `json:"stateTransitionReason,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + VPCID *string `json:"vpcID,omitempty"` } // Describes a block device mapping. @@ -1323,11 +1365,12 @@ type InstanceNetworkInterfaceAssociation struct { // Describes a network interface attachment. type InstanceNetworkInterfaceAttachment struct { - AttachmentID *string `json:"attachmentID,omitempty"` - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - DeviceIndex *int64 `json:"deviceIndex,omitempty"` - NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` - Status *string `json:"status,omitempty"` + AttachTime *metav1.Time `json:"attachTime,omitempty"` + AttachmentID *string `json:"attachmentID,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + DeviceIndex *int64 `json:"deviceIndex,omitempty"` + NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` + Status *string `json:"status,omitempty"` } // Describes a network interface. @@ -1375,9 +1418,17 @@ type InstanceStatus struct { OutpostARN *string `json:"outpostARN,omitempty"` } +// Describes the instance status. +type InstanceStatusDetails struct { + ImpairedSince *metav1.Time `json:"impairedSince,omitempty"` +} + // Describes a scheduled event for an instance. type InstanceStatusEvent struct { - Description *string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` + NotAfter *metav1.Time `json:"notAfter,omitempty"` + NotBefore *metav1.Time `json:"notBefore,omitempty"` + NotBeforeDeadline *metav1.Time `json:"notBeforeDeadline,omitempty"` } // Describes the registered tag keys for the current Region. @@ -1439,9 +1490,12 @@ type LaunchSpecification struct { // Describes a launch template. type LaunchTemplate struct { - CreatedBy *string `json:"createdBy,omitempty"` - LaunchTemplateID *string `json:"launchTemplateID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` + CreateTime *metav1.Time `json:"createTime,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + DefaultVersionNumber *int64 `json:"defaultVersionNumber,omitempty"` + LatestVersionNumber *int64 `json:"latestVersionNumber,omitempty"` + LaunchTemplateID *string `json:"launchTemplateID,omitempty"` + Tags []*Tag `json:"tags,omitempty"` } // Describes a block device mapping. @@ -1627,14 +1681,16 @@ type LaunchTemplateSpecification struct { // The options for Spot Instances. type LaunchTemplateSpotMarketOptions struct { - BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` - MaxPrice *string `json:"maxPrice,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // The options for Spot Instances. type LaunchTemplateSpotMarketOptionsRequest struct { - BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` - MaxPrice *string `json:"maxPrice,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // The tag specification for the launch template. @@ -1651,9 +1707,11 @@ type LaunchTemplateTagSpecificationRequest struct { // Describes a launch template version. type LaunchTemplateVersion struct { - CreatedBy *string `json:"createdBy,omitempty"` - DefaultVersion *bool `json:"defaultVersion,omitempty"` - LaunchTemplateID *string `json:"launchTemplateID,omitempty"` + CreateTime *metav1.Time `json:"createTime,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + DefaultVersion *bool `json:"defaultVersion,omitempty"` + LaunchTemplateID *string `json:"launchTemplateID,omitempty"` + VersionNumber *int64 `json:"versionNumber,omitempty"` } // Describes the monitoring for the instance. @@ -1755,6 +1813,23 @@ type ManagedPrefixList struct { PrefixListName *string `json:"prefixListName,omitempty"` StateMessage *string `json:"stateMessage,omitempty"` Tags []*Tag `json:"tags,omitempty"` + Version *int64 `json:"version,omitempty"` +} + +// The transit gateway options. +type ModifyTransitGatewayOptions struct { + AddTransitGatewayCIDRBlocks []*string `json:"addTransitGatewayCIDRBlocks,omitempty"` + AutoAcceptSharedAttachments *string `json:"autoAcceptSharedAttachments,omitempty"` + DefaultRouteTableAssociation *string `json:"defaultRouteTableAssociation,omitempty"` + DefaultRouteTablePropagation *string `json:"defaultRouteTablePropagation,omitempty"` + DNSSupport *string `json:"dnsSupport,omitempty"` + RemoveTransitGatewayCIDRBlocks []*string `json:"removeTransitGatewayCIDRBlocks,omitempty"` + VPNEcmpSupport *string `json:"vpnEcmpSupport,omitempty"` +} + +// Describes the options for a VPC attachment. +type ModifyTransitGatewayVPCAttachmentRequestOptions struct { + DNSSupport *string `json:"dnsSupport,omitempty"` } // The AWS Site-to-Site VPN tunnel options to modify. @@ -1779,12 +1854,14 @@ type MovingAddressStatus struct { // Describes a NAT gateway. type NatGateway struct { - FailureCode *string `json:"failureCode,omitempty"` - FailureMessage *string `json:"failureMessage,omitempty"` - NatGatewayID *string `json:"natGatewayID,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - VPCID *string `json:"vpcID,omitempty"` + CreateTime *metav1.Time `json:"createTime,omitempty"` + DeleteTime *metav1.Time `json:"deleteTime,omitempty"` + FailureCode *string `json:"failureCode,omitempty"` + FailureMessage *string `json:"failureMessage,omitempty"` + NatGatewayID *string `json:"natGatewayID,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + VPCID *string `json:"vpcID,omitempty"` } // Describes the IP addresses and network interface associated with a NAT gateway. @@ -1870,13 +1947,14 @@ type NetworkInterfaceAssociation struct { // Describes a network interface attachment. type NetworkInterfaceAttachment struct { - AttachmentID *string `json:"attachmentID,omitempty"` - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - DeviceIndex *int64 `json:"deviceIndex,omitempty"` - InstanceID *string `json:"instanceID,omitempty"` - InstanceOwnerID *string `json:"instanceOwnerID,omitempty"` - NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` - Status *string `json:"status,omitempty"` + AttachTime *metav1.Time `json:"attachTime,omitempty"` + AttachmentID *string `json:"attachmentID,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + DeviceIndex *int64 `json:"deviceIndex,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + InstanceOwnerID *string `json:"instanceOwnerID,omitempty"` + NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` + Status *string `json:"status,omitempty"` } // Describes an attachment change. @@ -2096,7 +2174,13 @@ type PrefixListID struct { // Describes the price for a Reserved Instance. type PriceSchedule struct { - Active *bool `json:"active,omitempty"` + Active *bool `json:"active,omitempty"` + Term *int64 `json:"term,omitempty"` +} + +// Describes the price for a Reserved Instance. +type PriceScheduleSpecification struct { + Term *int64 `json:"term,omitempty"` } // Describes a Reserved Instance offering. @@ -2144,9 +2228,11 @@ type PropagatingVGW struct { // (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html), // contact us through the Support Center (https://console.aws.amazon.com/support/home?). type ProvisionedBandwidth struct { - Provisioned *string `json:"provisioned,omitempty"` - Requested *string `json:"requested,omitempty"` - Status *string `json:"status,omitempty"` + ProvisionTime *metav1.Time `json:"provisionTime,omitempty"` + Provisioned *string `json:"provisioned,omitempty"` + RequestTime *metav1.Time `json:"requestTime,omitempty"` + Requested *string `json:"requested,omitempty"` + Status *string `json:"status,omitempty"` } // The status of an updated pointer (PTR) record for an Elastic IP address. @@ -2238,11 +2324,14 @@ type ReservedInstanceReservationValue struct { // Describes a Reserved Instance. type ReservedInstances struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - InstanceCount *int64 `json:"instanceCount,omitempty"` - InstanceTenancy *string `json:"instanceTenancy,omitempty"` - ReservedInstancesID *string `json:"reservedInstancesID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + Duration *int64 `json:"duration,omitempty"` + End *metav1.Time `json:"end,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + InstanceTenancy *string `json:"instanceTenancy,omitempty"` + ReservedInstancesID *string `json:"reservedInstancesID,omitempty"` + Start *metav1.Time `json:"start,omitempty"` + Tags []*Tag `json:"tags,omitempty"` } // Describes the configuration settings for the modified Reserved Instances. @@ -2259,19 +2348,24 @@ type ReservedInstancesID struct { // Describes a Reserved Instance listing. type ReservedInstancesListing struct { - ClientToken *string `json:"clientToken,omitempty"` - ReservedInstancesID *string `json:"reservedInstancesID,omitempty"` - ReservedInstancesListingID *string `json:"reservedInstancesListingID,omitempty"` - StatusMessage *string `json:"statusMessage,omitempty"` - Tags []*Tag `json:"tags,omitempty"` + ClientToken *string `json:"clientToken,omitempty"` + CreateDate *metav1.Time `json:"createDate,omitempty"` + ReservedInstancesID *string `json:"reservedInstancesID,omitempty"` + ReservedInstancesListingID *string `json:"reservedInstancesListingID,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + UpdateDate *metav1.Time `json:"updateDate,omitempty"` } // Describes a Reserved Instance modification. type ReservedInstancesModification struct { - ClientToken *string `json:"clientToken,omitempty"` - ReservedInstancesModificationID *string `json:"reservedInstancesModificationID,omitempty"` - Status *string `json:"status,omitempty"` - StatusMessage *string `json:"statusMessage,omitempty"` + ClientToken *string `json:"clientToken,omitempty"` + CreateDate *metav1.Time `json:"createDate,omitempty"` + EffectiveDate *metav1.Time `json:"effectiveDate,omitempty"` + ReservedInstancesModificationID *string `json:"reservedInstancesModificationID,omitempty"` + Status *string `json:"status,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` + UpdateDate *metav1.Time `json:"updateDate,omitempty"` } // Describes the modification request/s. @@ -2282,6 +2376,7 @@ type ReservedInstancesModificationResult struct { // Describes a Reserved Instance offering. type ReservedInstancesOffering struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + Duration *int64 `json:"duration,omitempty"` InstanceTenancy *string `json:"instanceTenancy,omitempty"` Marketplace *bool `json:"marketplace,omitempty"` ReservedInstancesOfferingID *string `json:"reservedInstancesOfferingID,omitempty"` @@ -2371,30 +2466,36 @@ type S3Storage struct { // Describes a Scheduled Instance. type ScheduledInstance struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - HourlyPrice *string `json:"hourlyPrice,omitempty"` - InstanceCount *int64 `json:"instanceCount,omitempty"` - InstanceType *string `json:"instanceType,omitempty"` - NetworkPlatform *string `json:"networkPlatform,omitempty"` - Platform *string `json:"platform,omitempty"` - ScheduledInstanceID *string `json:"scheduledInstanceID,omitempty"` - SlotDurationInHours *int64 `json:"slotDurationInHours,omitempty"` - TotalScheduledInstanceHours *int64 `json:"totalScheduledInstanceHours,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + CreateDate *metav1.Time `json:"createDate,omitempty"` + HourlyPrice *string `json:"hourlyPrice,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + NetworkPlatform *string `json:"networkPlatform,omitempty"` + NextSlotStartTime *metav1.Time `json:"nextSlotStartTime,omitempty"` + Platform *string `json:"platform,omitempty"` + PreviousSlotEndTime *metav1.Time `json:"previousSlotEndTime,omitempty"` + ScheduledInstanceID *string `json:"scheduledInstanceID,omitempty"` + SlotDurationInHours *int64 `json:"slotDurationInHours,omitempty"` + TermEndDate *metav1.Time `json:"termEndDate,omitempty"` + TermStartDate *metav1.Time `json:"termStartDate,omitempty"` + TotalScheduledInstanceHours *int64 `json:"totalScheduledInstanceHours,omitempty"` } // Describes a schedule that is available for your Scheduled Instances. type ScheduledInstanceAvailability struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - AvailableInstanceCount *int64 `json:"availableInstanceCount,omitempty"` - HourlyPrice *string `json:"hourlyPrice,omitempty"` - InstanceType *string `json:"instanceType,omitempty"` - MaxTermDurationInDays *int64 `json:"maxTermDurationInDays,omitempty"` - MinTermDurationInDays *int64 `json:"minTermDurationInDays,omitempty"` - NetworkPlatform *string `json:"networkPlatform,omitempty"` - Platform *string `json:"platform,omitempty"` - PurchaseToken *string `json:"purchaseToken,omitempty"` - SlotDurationInHours *int64 `json:"slotDurationInHours,omitempty"` - TotalScheduledInstanceHours *int64 `json:"totalScheduledInstanceHours,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + AvailableInstanceCount *int64 `json:"availableInstanceCount,omitempty"` + FirstSlotStartTime *metav1.Time `json:"firstSlotStartTime,omitempty"` + HourlyPrice *string `json:"hourlyPrice,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + MaxTermDurationInDays *int64 `json:"maxTermDurationInDays,omitempty"` + MinTermDurationInDays *int64 `json:"minTermDurationInDays,omitempty"` + NetworkPlatform *string `json:"networkPlatform,omitempty"` + Platform *string `json:"platform,omitempty"` + PurchaseToken *string `json:"purchaseToken,omitempty"` + SlotDurationInHours *int64 `json:"slotDurationInHours,omitempty"` + TotalScheduledInstanceHours *int64 `json:"totalScheduledInstanceHours,omitempty"` } // Describes the recurring schedule for a Scheduled Instance. @@ -2526,6 +2627,19 @@ type ServiceDetail struct { VPCEndpointPolicySupported *bool `json:"vpcEndpointPolicySupported,omitempty"` } +// Describes the time period for a Scheduled Instance to start its first schedule. +// The time period must span less than one day. +type SlotDateTimeRangeRequest struct { + EarliestTime *metav1.Time `json:"earliestTime,omitempty"` + LatestTime *metav1.Time `json:"latestTime,omitempty"` +} + +// Describes the time period for a Scheduled Instance to start its first schedule. +type SlotStartTimeRangeRequest struct { + EarliestTime *metav1.Time `json:"earliestTime,omitempty"` + LatestTime *metav1.Time `json:"latestTime,omitempty"` +} + // Describes the snapshot created from the imported disk. type SnapshotDetail struct { Description *string `json:"description,omitempty"` @@ -2620,6 +2734,8 @@ type SpotFleetRequestConfigData struct { TagSpecifications []*TagSpecification `json:"tagSpecifications,omitempty"` TargetCapacity *int64 `json:"targetCapacity,omitempty"` TerminateInstancesWithExpiration *bool `json:"terminateInstancesWithExpiration,omitempty"` + ValidFrom *metav1.Time `json:"validFrom,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // The tags for a Spot Fleet resource. @@ -2630,14 +2746,17 @@ type SpotFleetTagSpecification struct { // Describes a Spot Instance request. type SpotInstanceRequest struct { - ActualBlockHourlyPrice *string `json:"actualBlockHourlyPrice,omitempty"` - AvailabilityZoneGroup *string `json:"availabilityZoneGroup,omitempty"` - BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` - LaunchGroup *string `json:"launchGroup,omitempty"` - LaunchedAvailabilityZone *string `json:"launchedAvailabilityZone,omitempty"` - SpotInstanceRequestID *string `json:"spotInstanceRequestID,omitempty"` - SpotPrice *string `json:"spotPrice,omitempty"` - Tags []*Tag `json:"tags,omitempty"` + ActualBlockHourlyPrice *string `json:"actualBlockHourlyPrice,omitempty"` + AvailabilityZoneGroup *string `json:"availabilityZoneGroup,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + CreateTime *metav1.Time `json:"createTime,omitempty"` + LaunchGroup *string `json:"launchGroup,omitempty"` + LaunchedAvailabilityZone *string `json:"launchedAvailabilityZone,omitempty"` + SpotInstanceRequestID *string `json:"spotInstanceRequestID,omitempty"` + SpotPrice *string `json:"spotPrice,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + ValidFrom *metav1.Time `json:"validFrom,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // Describes a Spot Instance state change. @@ -2648,14 +2767,16 @@ type SpotInstanceStateFault struct { // Describes the status of a Spot Instance request. type SpotInstanceStatus struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + UpdateTime *metav1.Time `json:"updateTime,omitempty"` } // The options for Spot Instances. type SpotMarketOptions struct { - BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` - MaxPrice *string `json:"maxPrice,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // Describes the configuration of Spot Instances in an EC2 Fleet. @@ -2686,8 +2807,9 @@ type SpotPlacement struct { // Describes the maximum price per hour that you are willing to pay for a Spot // Instance. type SpotPrice struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - SpotPrice *string `json:"spotPrice,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + SpotPrice *string `json:"spotPrice,omitempty"` + Timestamp *metav1.Time `json:"timestamp,omitempty"` } // Describes a stale rule in a security group. @@ -2914,15 +3036,6 @@ type TrafficMirrorTarget struct { TrafficMirrorTargetID *string `json:"trafficMirrorTargetID,omitempty"` } -// Describes a transit gateway. -type TransitGateway struct { - Description *string `json:"description,omitempty"` - OwnerID *string `json:"ownerID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - TransitGatewayARN *string `json:"transitGatewayARN,omitempty"` - TransitGatewayID *string `json:"transitGatewayID,omitempty"` -} - // Describes an association between a resource attachment and a transit gateway // route table. type TransitGatewayAssociation struct { @@ -2931,12 +3044,13 @@ type TransitGatewayAssociation struct { // Describes an attachment between a resource and a transit gateway. type TransitGatewayAttachment struct { - ResourceID *string `json:"resourceID,omitempty"` - ResourceOwnerID *string `json:"resourceOwnerID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - TransitGatewayAttachmentID *string `json:"transitGatewayAttachmentID,omitempty"` - TransitGatewayID *string `json:"transitGatewayID,omitempty"` - TransitGatewayOwnerID *string `json:"transitGatewayOwnerID,omitempty"` + CreationTime *metav1.Time `json:"creationTime,omitempty"` + ResourceID *string `json:"resourceID,omitempty"` + ResourceOwnerID *string `json:"resourceOwnerID,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + TransitGatewayAttachmentID *string `json:"transitGatewayAttachmentID,omitempty"` + TransitGatewayID *string `json:"transitGatewayID,omitempty"` + TransitGatewayOwnerID *string `json:"transitGatewayOwnerID,omitempty"` } // Describes an association. @@ -2947,7 +3061,9 @@ type TransitGatewayAttachmentAssociation struct { // The BGP configuration information. type TransitGatewayAttachmentBGPConfiguration struct { PeerAddress *string `json:"peerAddress,omitempty"` + PeerASN *int64 `json:"peerASN,omitempty"` TransitGatewayAddress *string `json:"transitGatewayAddress,omitempty"` + TransitGatewayASN *int64 `json:"transitGatewayASN,omitempty"` } // Describes a propagation route table. @@ -2957,12 +3073,15 @@ type TransitGatewayAttachmentPropagation struct { // Describes a transit gateway Connect attachment. type TransitGatewayConnect struct { - Tags []*Tag `json:"tags,omitempty"` + CreationTime *metav1.Time `json:"creationTime,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + TransitGatewayID *string `json:"transitGatewayID,omitempty"` } // Describes a transit gateway Connect peer. type TransitGatewayConnectPeer struct { - Tags []*Tag `json:"tags,omitempty"` + CreationTime *metav1.Time `json:"creationTime,omitempty"` + Tags []*Tag `json:"tags,omitempty"` } // Describes the Connect peer details. @@ -2971,6 +3090,11 @@ type TransitGatewayConnectPeerConfiguration struct { TransitGatewayAddress *string `json:"transitGatewayAddress,omitempty"` } +// The BGP options for the Connect attachment. +type TransitGatewayConnectRequestBGPOptions struct { + PeerASN *int64 `json:"peerASN,omitempty"` +} + // Describes the deregistered transit gateway multicast group members. type TransitGatewayMulticastDeregisteredGroupMembers struct { DeregisteredNetworkInterfaceIDs []*string `json:"deregisteredNetworkInterfaceIDs,omitempty"` @@ -2987,11 +3111,12 @@ type TransitGatewayMulticastDeregisteredGroupSources struct { // Describes the transit gateway multicast domain. type TransitGatewayMulticastDomain struct { - OwnerID *string `json:"ownerID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - TransitGatewayID *string `json:"transitGatewayID,omitempty"` - TransitGatewayMulticastDomainARN *string `json:"transitGatewayMulticastDomainARN,omitempty"` - TransitGatewayMulticastDomainID *string `json:"transitGatewayMulticastDomainID,omitempty"` + CreationTime *metav1.Time `json:"creationTime,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + TransitGatewayID *string `json:"transitGatewayID,omitempty"` + TransitGatewayMulticastDomainARN *string `json:"transitGatewayMulticastDomainARN,omitempty"` + TransitGatewayMulticastDomainID *string `json:"transitGatewayMulticastDomainID,omitempty"` } // Describes the resources associated with the transit gateway multicast domain. @@ -3037,15 +3162,23 @@ type TransitGatewayMulticastRegisteredGroupSources struct { // Describes the options for a transit gateway. type TransitGatewayOptions struct { + AmazonSideASN *int64 `json:"amazonSideASN,omitempty"` AssociationDefaultRouteTableID *string `json:"associationDefaultRouteTableID,omitempty"` + AutoAcceptSharedAttachments *string `json:"autoAcceptSharedAttachments,omitempty"` + DefaultRouteTableAssociation *string `json:"defaultRouteTableAssociation,omitempty"` + DefaultRouteTablePropagation *string `json:"defaultRouteTablePropagation,omitempty"` + DNSSupport *string `json:"dnsSupport,omitempty"` + MulticastSupport *string `json:"multicastSupport,omitempty"` PropagationDefaultRouteTableID *string `json:"propagationDefaultRouteTableID,omitempty"` TransitGatewayCIDRBlocks []*string `json:"transitGatewayCIDRBlocks,omitempty"` + VPNEcmpSupport *string `json:"vpnEcmpSupport,omitempty"` } // Describes the transit gateway peering attachment. type TransitGatewayPeeringAttachment struct { - Tags []*Tag `json:"tags,omitempty"` - TransitGatewayAttachmentID *string `json:"transitGatewayAttachmentID,omitempty"` + CreationTime *metav1.Time `json:"creationTime,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + TransitGatewayAttachmentID *string `json:"transitGatewayAttachmentID,omitempty"` } // Describes a transit gateway prefix list attachment. @@ -3065,6 +3198,18 @@ type TransitGatewayPropagation struct { TransitGatewayRouteTableID *string `json:"transitGatewayRouteTableID,omitempty"` } +// Describes the options for a transit gateway. +type TransitGatewayRequestOptions struct { + AmazonSideASN *int64 `json:"amazonSideASN,omitempty"` + AutoAcceptSharedAttachments *string `json:"autoAcceptSharedAttachments,omitempty"` + DefaultRouteTableAssociation *string `json:"defaultRouteTableAssociation,omitempty"` + DefaultRouteTablePropagation *string `json:"defaultRouteTablePropagation,omitempty"` + DNSSupport *string `json:"dnsSupport,omitempty"` + MulticastSupport *string `json:"multicastSupport,omitempty"` + TransitGatewayCIDRBlocks []*string `json:"transitGatewayCIDRBlocks,omitempty"` + VPNEcmpSupport *string `json:"vpnEcmpSupport,omitempty"` +} + // Describes a route for a transit gateway route table. type TransitGatewayRoute struct { DestinationCIDRBlock *string `json:"destinationCIDRBlock,omitempty"` @@ -3078,11 +3223,12 @@ type TransitGatewayRouteAttachment struct { // Describes a transit gateway route table. type TransitGatewayRouteTable struct { - DefaultAssociationRouteTable *bool `json:"defaultAssociationRouteTable,omitempty"` - DefaultPropagationRouteTable *bool `json:"defaultPropagationRouteTable,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - TransitGatewayID *string `json:"transitGatewayID,omitempty"` - TransitGatewayRouteTableID *string `json:"transitGatewayRouteTableID,omitempty"` + CreationTime *metav1.Time `json:"creationTime,omitempty"` + DefaultAssociationRouteTable *bool `json:"defaultAssociationRouteTable,omitempty"` + DefaultPropagationRouteTable *bool `json:"defaultPropagationRouteTable,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + TransitGatewayID *string `json:"transitGatewayID,omitempty"` + TransitGatewayRouteTableID *string `json:"transitGatewayRouteTableID,omitempty"` } // Describes an association between a route table and a resource attachment. @@ -3099,12 +3245,31 @@ type TransitGatewayRouteTablePropagation struct { // Describes a VPC attachment. type TransitGatewayVPCAttachment struct { - SubnetIDs []*string `json:"subnetIDs,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - TransitGatewayAttachmentID *string `json:"transitGatewayAttachmentID,omitempty"` - TransitGatewayID *string `json:"transitGatewayID,omitempty"` - VPCID *string `json:"vpcID,omitempty"` - VPCOwnerID *string `json:"vpcOwnerID,omitempty"` + CreationTime *metav1.Time `json:"creationTime,omitempty"` + SubnetIDs []*string `json:"subnetIDs,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + TransitGatewayAttachmentID *string `json:"transitGatewayAttachmentID,omitempty"` + TransitGatewayID *string `json:"transitGatewayID,omitempty"` + VPCID *string `json:"vpcID,omitempty"` + VPCOwnerID *string `json:"vpcOwnerID,omitempty"` +} + +// Describes the VPC attachment options. +type TransitGatewayVPCAttachmentOptions struct { + DNSSupport *string `json:"dnsSupport,omitempty"` +} + +// Describes a transit gateway. +type TransitGateway_SDK struct { + CreationTime *metav1.Time `json:"creationTime,omitempty"` + Description *string `json:"description,omitempty"` + // Describes the options for a transit gateway. + Options *TransitGatewayOptions `json:"options,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + State *string `json:"state,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + TransitGatewayARN *string `json:"transitGatewayARN,omitempty"` + TransitGatewayID *string `json:"transitGatewayID,omitempty"` } // The VPN tunnel options. @@ -3180,10 +3345,11 @@ type UserIDGroupPair struct { // Describes telemetry for a VPN tunnel. type VGWTelemetry struct { - AcceptedRouteCount *int64 `json:"acceptedRouteCount,omitempty"` - CertificateARN *string `json:"certificateARN,omitempty"` - OutsideIPAddress *string `json:"outsideIPAddress,omitempty"` - StatusMessage *string `json:"statusMessage,omitempty"` + AcceptedRouteCount *int64 `json:"acceptedRouteCount,omitempty"` + CertificateARN *string `json:"certificateARN,omitempty"` + LastStatusChange *metav1.Time `json:"lastStatusChange,omitempty"` + OutsideIPAddress *string `json:"outsideIPAddress,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` } // Describes an attachment between a virtual private gateway and a VPC. @@ -3259,8 +3425,9 @@ type VPCIPv6CIDRBlockAssociation struct { // Describes a VPC peering connection. type VPCPeeringConnection struct { - Tags []*Tag `json:"tags,omitempty"` - VPCPeeringConnectionID *string `json:"vpcPeeringConnectionID,omitempty"` + ExpirationTime *metav1.Time `json:"expirationTime,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + VPCPeeringConnectionID *string `json:"vpcPeeringConnectionID,omitempty"` } // Describes the VPC peering connection options. @@ -3330,6 +3497,7 @@ type VPNConnectionOptionsSpecification struct { // Describes a virtual private gateway. type VPNGateway struct { + AmazonSideASN *int64 `json:"amazonSideASN,omitempty"` AvailabilityZone *string `json:"availabilityZone,omitempty"` Tags []*Tag `json:"tags,omitempty"` VPNGatewayID *string `json:"vpnGatewayID,omitempty"` @@ -3363,20 +3531,28 @@ type ValidationError struct { Message *string `json:"message,omitempty"` } +// Describes an EBS volume. +type VolumeDetail struct { + Size *int64 `json:"size,omitempty"` +} + // Describes the modification status of an EBS volume. // // If the volume has never been modified, some element values will be null. type VolumeModification struct { - OriginalIOPS *int64 `json:"originalIOPS,omitempty"` - OriginalMultiAttachEnabled *bool `json:"originalMultiAttachEnabled,omitempty"` - OriginalSize *int64 `json:"originalSize,omitempty"` - OriginalThroughput *int64 `json:"originalThroughput,omitempty"` - StatusMessage *string `json:"statusMessage,omitempty"` - TargetIOPS *int64 `json:"targetIOPS,omitempty"` - TargetMultiAttachEnabled *bool `json:"targetMultiAttachEnabled,omitempty"` - TargetSize *int64 `json:"targetSize,omitempty"` - TargetThroughput *int64 `json:"targetThroughput,omitempty"` - VolumeID *string `json:"volumeID,omitempty"` + EndTime *metav1.Time `json:"endTime,omitempty"` + OriginalIOPS *int64 `json:"originalIOPS,omitempty"` + OriginalMultiAttachEnabled *bool `json:"originalMultiAttachEnabled,omitempty"` + OriginalSize *int64 `json:"originalSize,omitempty"` + OriginalThroughput *int64 `json:"originalThroughput,omitempty"` + Progress *int64 `json:"progress,omitempty"` + StartTime *metav1.Time `json:"startTime,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` + TargetIOPS *int64 `json:"targetIOPS,omitempty"` + TargetMultiAttachEnabled *bool `json:"targetMultiAttachEnabled,omitempty"` + TargetSize *int64 `json:"targetSize,omitempty"` + TargetThroughput *int64 `json:"targetThroughput,omitempty"` + VolumeID *string `json:"volumeID,omitempty"` } // Describes a volume status operation code. diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index ae0ec50d..5e68e19d 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. @@ -794,6 +793,14 @@ func (in *BundleTask) DeepCopyInto(out *BundleTask) { *out = new(string) **out = **in } + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + *out = (*in).DeepCopy() + } + if in.UpdateTime != nil { + in, out := &in.UpdateTime, &out.UpdateTime + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleTask. @@ -1064,11 +1071,19 @@ func (in *CapacityReservation) DeepCopyInto(out *CapacityReservation) { *out = new(string) **out = **in } + if in.CreateDate != nil { + in, out := &in.CreateDate, &out.CreateDate + *out = (*in).DeepCopy() + } if in.EBSOptimized != nil { in, out := &in.EBSOptimized, &out.EBSOptimized *out = new(bool) **out = **in } + if in.EndDate != nil { + in, out := &in.EndDate, &out.EndDate + *out = (*in).DeepCopy() + } if in.EphemeralStorage != nil { in, out := &in.EphemeralStorage, &out.EphemeralStorage *out = new(bool) @@ -1426,6 +1441,14 @@ func (in *ClientData) DeepCopyInto(out *ClientData) { *out = new(string) **out = **in } + if in.UploadEnd != nil { + in, out := &in.UploadEnd, &out.UploadEnd + *out = (*in).DeepCopy() + } + if in.UploadStart != nil { + in, out := &in.UploadStart, &out.UploadStart + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientData. @@ -2010,6 +2033,26 @@ func (in *CreateFleetError) DeepCopy() *CreateFleetError { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CreateTransitGatewayVPCAttachmentRequestOptions) DeepCopyInto(out *CreateTransitGatewayVPCAttachmentRequestOptions) { + *out = *in + if in.DNSSupport != nil { + in, out := &in.DNSSupport, &out.DNSSupport + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CreateTransitGatewayVPCAttachmentRequestOptions. +func (in *CreateTransitGatewayVPCAttachmentRequestOptions) DeepCopy() *CreateTransitGatewayVPCAttachmentRequestOptions { + if in == nil { + return nil + } + out := new(CreateTransitGatewayVPCAttachmentRequestOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CreateVolumePermission) DeepCopyInto(out *CreateVolumePermission) { *out = *in @@ -2276,6 +2319,11 @@ func (in *DeleteLaunchTemplateVersionsResponseErrorItem) DeepCopyInto(out *Delet *out = new(string) **out = **in } + if in.VersionNumber != nil { + in, out := &in.VersionNumber, &out.VersionNumber + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeleteLaunchTemplateVersionsResponseErrorItem. @@ -2301,6 +2349,11 @@ func (in *DeleteLaunchTemplateVersionsResponseSuccessItem) DeepCopyInto(out *Del *out = new(string) **out = **in } + if in.VersionNumber != nil { + in, out := &in.VersionNumber, &out.VersionNumber + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeleteLaunchTemplateVersionsResponseSuccessItem. @@ -2636,6 +2689,11 @@ func (in *DiskImageDescription) DeepCopyInto(out *DiskImageDescription) { *out = new(string) **out = **in } + if in.Size != nil { + in, out := &in.Size, &out.Size + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskImageDescription. @@ -2651,6 +2709,11 @@ func (in *DiskImageDescription) DeepCopy() *DiskImageDescription { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DiskImageDetail) DeepCopyInto(out *DiskImageDetail) { *out = *in + if in.Bytes != nil { + in, out := &in.Bytes, &out.Bytes + *out = new(int64) + **out = **in + } if in.ImportManifestURL != nil { in, out := &in.ImportManifestURL, &out.ImportManifestURL *out = new(string) @@ -2676,6 +2739,11 @@ func (in *DiskImageVolumeDescription) DeepCopyInto(out *DiskImageVolumeDescripti *out = new(string) **out = **in } + if in.Size != nil { + in, out := &in.Size, &out.Size + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskImageVolumeDescription. @@ -2746,6 +2814,10 @@ func (in *EBSBlockDevice) DeepCopy() *EBSBlockDevice { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EBSInstanceBlockDevice) DeepCopyInto(out *EBSInstanceBlockDevice) { *out = *in + if in.AttachTime != nil { + in, out := &in.AttachTime, &out.AttachTime + *out = (*in).DeepCopy() + } if in.DeleteOnTermination != nil { in, out := &in.DeleteOnTermination, &out.DeleteOnTermination *out = new(bool) @@ -2989,6 +3061,10 @@ func (in *ElasticInferenceAcceleratorAssociation) DeepCopyInto(out *ElasticInfer *out = new(string) **out = **in } + if in.ElasticInferenceAcceleratorAssociationTime != nil { + in, out := &in.ElasticInferenceAcceleratorAssociationTime, &out.ElasticInferenceAcceleratorAssociationTime + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticInferenceAcceleratorAssociation. @@ -3458,6 +3534,10 @@ func (in *ExportToS3TaskSpecification) DeepCopy() *ExportToS3TaskSpecification { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FPGAImage) DeepCopyInto(out *FPGAImage) { *out = *in + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = (*in).DeepCopy() + } if in.DataRetentionSupport != nil { in, out := &in.DataRetentionSupport, &out.DataRetentionSupport *out = new(bool) @@ -3514,6 +3594,10 @@ func (in *FPGAImage) DeepCopyInto(out *FPGAImage) { } } } + if in.UpdateTime != nil { + in, out := &in.UpdateTime, &out.UpdateTime + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FPGAImage. @@ -3685,6 +3769,10 @@ func (in *FleetData) DeepCopyInto(out *FleetData) { *out = new(string) **out = **in } + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = (*in).DeepCopy() + } if in.ReplaceUnhealthyInstances != nil { in, out := &in.ReplaceUnhealthyInstances, &out.ReplaceUnhealthyInstances *out = new(bool) @@ -3706,6 +3794,14 @@ func (in *FleetData) DeepCopyInto(out *FleetData) { *out = new(bool) **out = **in } + if in.ValidFrom != nil { + in, out := &in.ValidFrom, &out.ValidFrom + *out = (*in).DeepCopy() + } + if in.ValidUntil != nil { + in, out := &in.ValidUntil, &out.ValidUntil + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FleetData. @@ -3968,9 +4064,51 @@ func (in *HibernationOptionsRequest) DeepCopy() *HibernationOptionsRequest { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HistoryRecord) DeepCopyInto(out *HistoryRecord) { + *out = *in + if in.Timestamp != nil { + in, out := &in.Timestamp, &out.Timestamp + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HistoryRecord. +func (in *HistoryRecord) DeepCopy() *HistoryRecord { + if in == nil { + return nil + } + out := new(HistoryRecord) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HistoryRecordEntry) DeepCopyInto(out *HistoryRecordEntry) { + *out = *in + if in.Timestamp != nil { + in, out := &in.Timestamp, &out.Timestamp + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HistoryRecordEntry. +func (in *HistoryRecordEntry) DeepCopy() *HistoryRecordEntry { + if in == nil { + return nil + } + out := new(HistoryRecordEntry) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Host) DeepCopyInto(out *Host) { *out = *in + if in.AllocationTime != nil { + in, out := &in.AllocationTime, &out.AllocationTime + *out = (*in).DeepCopy() + } if in.AvailabilityZone != nil { in, out := &in.AvailabilityZone, &out.AvailabilityZone *out = new(string) @@ -4006,6 +4144,10 @@ func (in *Host) DeepCopyInto(out *Host) { *out = new(string) **out = **in } + if in.ReleaseTime != nil { + in, out := &in.ReleaseTime, &out.ReleaseTime + *out = (*in).DeepCopy() + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -4152,6 +4294,10 @@ func (in *HostReservation) DeepCopyInto(out *HostReservation) { *out = new(int64) **out = **in } + if in.End != nil { + in, out := &in.End, &out.End + *out = (*in).DeepCopy() + } if in.HostReservationID != nil { in, out := &in.HostReservationID, &out.HostReservationID *out = new(string) @@ -4172,6 +4318,10 @@ func (in *HostReservation) DeepCopyInto(out *HostReservation) { *out = new(string) **out = **in } + if in.Start != nil { + in, out := &in.Start, &out.Start + *out = (*in).DeepCopy() + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -4238,6 +4388,10 @@ func (in *IAMInstanceProfileAssociation) DeepCopyInto(out *IAMInstanceProfileAss *out = new(string) **out = **in } + if in.Timestamp != nil { + in, out := &in.Timestamp, &out.Timestamp + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IAMInstanceProfileAssociation. @@ -4303,6 +4457,10 @@ func (in *ICMPTypeCode) DeepCopy() *ICMPTypeCode { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IDFormat) DeepCopyInto(out *IDFormat) { *out = *in + if in.Deadline != nil { + in, out := &in.Deadline, &out.Deadline + *out = (*in).DeepCopy() + } if in.Resource != nil { in, out := &in.Resource, &out.Resource *out = new(string) @@ -4856,6 +5014,11 @@ func (in *ImportInstanceVolumeDetailItem) DeepCopyInto(out *ImportInstanceVolume *out = new(string) **out = **in } + if in.BytesConverted != nil { + in, out := &in.BytesConverted, &out.BytesConverted + *out = new(int64) + **out = **in + } if in.Description != nil { in, out := &in.Description, &out.Description *out = new(string) @@ -4927,6 +5090,11 @@ func (in *ImportVolumeTaskDetails) DeepCopyInto(out *ImportVolumeTaskDetails) { *out = new(string) **out = **in } + if in.BytesConverted != nil { + in, out := &in.BytesConverted, &out.BytesConverted + *out = new(int64) + **out = **in + } if in.Description != nil { in, out := &in.Description, &out.Description *out = new(string) @@ -4992,6 +5160,10 @@ func (in *Instance) DeepCopyInto(out *Instance) { *out = new(string) **out = **in } + if in.LaunchTime != nil { + in, out := &in.LaunchTime, &out.LaunchTime + *out = (*in).DeepCopy() + } if in.OutpostARN != nil { in, out := &in.OutpostARN, &out.OutpostARN *out = new(string) @@ -5468,6 +5640,10 @@ func (in *InstanceNetworkInterfaceAssociation) DeepCopy() *InstanceNetworkInterf // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceNetworkInterfaceAttachment) DeepCopyInto(out *InstanceNetworkInterfaceAttachment) { *out = *in + if in.AttachTime != nil { + in, out := &in.AttachTime, &out.AttachTime + *out = (*in).DeepCopy() + } if in.AttachmentID != nil { in, out := &in.AttachmentID, &out.AttachmentID *out = new(string) @@ -5700,6 +5876,25 @@ func (in *InstanceStatus) DeepCopy() *InstanceStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceStatusDetails) DeepCopyInto(out *InstanceStatusDetails) { + *out = *in + if in.ImpairedSince != nil { + in, out := &in.ImpairedSince, &out.ImpairedSince + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatusDetails. +func (in *InstanceStatusDetails) DeepCopy() *InstanceStatusDetails { + if in == nil { + return nil + } + out := new(InstanceStatusDetails) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceStatusEvent) DeepCopyInto(out *InstanceStatusEvent) { *out = *in @@ -5708,6 +5903,18 @@ func (in *InstanceStatusEvent) DeepCopyInto(out *InstanceStatusEvent) { *out = new(string) **out = **in } + if in.NotAfter != nil { + in, out := &in.NotAfter, &out.NotAfter + *out = (*in).DeepCopy() + } + if in.NotBefore != nil { + in, out := &in.NotBefore, &out.NotBefore + *out = (*in).DeepCopy() + } + if in.NotBeforeDeadline != nil { + in, out := &in.NotBeforeDeadline, &out.NotBeforeDeadline + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatusEvent. @@ -6129,11 +6336,25 @@ func (in *LaunchSpecification) DeepCopy() *LaunchSpecification { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplate) DeepCopyInto(out *LaunchTemplate) { *out = *in + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = (*in).DeepCopy() + } if in.CreatedBy != nil { in, out := &in.CreatedBy, &out.CreatedBy *out = new(string) **out = **in } + if in.DefaultVersionNumber != nil { + in, out := &in.DefaultVersionNumber, &out.DefaultVersionNumber + *out = new(int64) + **out = **in + } + if in.LatestVersionNumber != nil { + in, out := &in.LatestVersionNumber, &out.LatestVersionNumber + *out = new(int64) + **out = **in + } if in.LaunchTemplateID != nil { in, out := &in.LaunchTemplateID, &out.LaunchTemplateID *out = new(string) @@ -6915,6 +7136,10 @@ func (in *LaunchTemplateSpotMarketOptions) DeepCopyInto(out *LaunchTemplateSpotM *out = new(string) **out = **in } + if in.ValidUntil != nil { + in, out := &in.ValidUntil, &out.ValidUntil + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpotMarketOptions. @@ -6940,6 +7165,10 @@ func (in *LaunchTemplateSpotMarketOptionsRequest) DeepCopyInto(out *LaunchTempla *out = new(string) **out = **in } + if in.ValidUntil != nil { + in, out := &in.ValidUntil, &out.ValidUntil + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpotMarketOptionsRequest. @@ -7017,6 +7246,10 @@ func (in *LaunchTemplateTagSpecificationRequest) DeepCopy() *LaunchTemplateTagSp // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateVersion) DeepCopyInto(out *LaunchTemplateVersion) { *out = *in + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = (*in).DeepCopy() + } if in.CreatedBy != nil { in, out := &in.CreatedBy, &out.CreatedBy *out = new(string) @@ -7032,6 +7265,11 @@ func (in *LaunchTemplateVersion) DeepCopyInto(out *LaunchTemplateVersion) { *out = new(string) **out = **in } + if in.VersionNumber != nil { + in, out := &in.VersionNumber, &out.VersionNumber + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateVersion. @@ -7504,6 +7742,11 @@ func (in *ManagedPrefixList) DeepCopyInto(out *ManagedPrefixList) { } } } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedPrefixList. @@ -7516,6 +7759,88 @@ func (in *ManagedPrefixList) DeepCopy() *ManagedPrefixList { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModifyTransitGatewayOptions) DeepCopyInto(out *ModifyTransitGatewayOptions) { + *out = *in + if in.AddTransitGatewayCIDRBlocks != nil { + in, out := &in.AddTransitGatewayCIDRBlocks, &out.AddTransitGatewayCIDRBlocks + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.AutoAcceptSharedAttachments != nil { + in, out := &in.AutoAcceptSharedAttachments, &out.AutoAcceptSharedAttachments + *out = new(string) + **out = **in + } + if in.DefaultRouteTableAssociation != nil { + in, out := &in.DefaultRouteTableAssociation, &out.DefaultRouteTableAssociation + *out = new(string) + **out = **in + } + if in.DefaultRouteTablePropagation != nil { + in, out := &in.DefaultRouteTablePropagation, &out.DefaultRouteTablePropagation + *out = new(string) + **out = **in + } + if in.DNSSupport != nil { + in, out := &in.DNSSupport, &out.DNSSupport + *out = new(string) + **out = **in + } + if in.RemoveTransitGatewayCIDRBlocks != nil { + in, out := &in.RemoveTransitGatewayCIDRBlocks, &out.RemoveTransitGatewayCIDRBlocks + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.VPNEcmpSupport != nil { + in, out := &in.VPNEcmpSupport, &out.VPNEcmpSupport + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModifyTransitGatewayOptions. +func (in *ModifyTransitGatewayOptions) DeepCopy() *ModifyTransitGatewayOptions { + if in == nil { + return nil + } + out := new(ModifyTransitGatewayOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModifyTransitGatewayVPCAttachmentRequestOptions) DeepCopyInto(out *ModifyTransitGatewayVPCAttachmentRequestOptions) { + *out = *in + if in.DNSSupport != nil { + in, out := &in.DNSSupport, &out.DNSSupport + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModifyTransitGatewayVPCAttachmentRequestOptions. +func (in *ModifyTransitGatewayVPCAttachmentRequestOptions) DeepCopy() *ModifyTransitGatewayVPCAttachmentRequestOptions { + if in == nil { + return nil + } + out := new(ModifyTransitGatewayVPCAttachmentRequestOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ModifyVPNTunnelOptionsSpecification) DeepCopyInto(out *ModifyVPNTunnelOptionsSpecification) { *out = *in @@ -7609,6 +7934,14 @@ func (in *MovingAddressStatus) DeepCopy() *MovingAddressStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NatGateway) DeepCopyInto(out *NatGateway) { *out = *in + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = (*in).DeepCopy() + } + if in.DeleteTime != nil { + in, out := &in.DeleteTime, &out.DeleteTime + *out = (*in).DeepCopy() + } if in.FailureCode != nil { in, out := &in.FailureCode, &out.FailureCode *out = new(string) @@ -8037,6 +8370,10 @@ func (in *NetworkInterfaceAssociation) DeepCopy() *NetworkInterfaceAssociation { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NetworkInterfaceAttachment) DeepCopyInto(out *NetworkInterfaceAttachment) { *out = *in + if in.AttachTime != nil { + in, out := &in.AttachTime, &out.AttachTime + *out = (*in).DeepCopy() + } if in.AttachmentID != nil { in, out := &in.AttachmentID, &out.AttachmentID *out = new(string) @@ -9000,6 +9337,11 @@ func (in *PriceSchedule) DeepCopyInto(out *PriceSchedule) { *out = new(bool) **out = **in } + if in.Term != nil { + in, out := &in.Term, &out.Term + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriceSchedule. @@ -9012,6 +9354,26 @@ func (in *PriceSchedule) DeepCopy() *PriceSchedule { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PriceScheduleSpecification) DeepCopyInto(out *PriceScheduleSpecification) { + *out = *in + if in.Term != nil { + in, out := &in.Term, &out.Term + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriceScheduleSpecification. +func (in *PriceScheduleSpecification) DeepCopy() *PriceScheduleSpecification { + if in == nil { + return nil + } + out := new(PriceScheduleSpecification) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PricingDetail) DeepCopyInto(out *PricingDetail) { *out = *in @@ -9170,11 +9532,19 @@ func (in *PropagatingVGW) DeepCopy() *PropagatingVGW { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProvisionedBandwidth) DeepCopyInto(out *ProvisionedBandwidth) { *out = *in + if in.ProvisionTime != nil { + in, out := &in.ProvisionTime, &out.ProvisionTime + *out = (*in).DeepCopy() + } if in.Provisioned != nil { in, out := &in.Provisioned, &out.Provisioned *out = new(string) **out = **in } + if in.RequestTime != nil { + in, out := &in.RequestTime, &out.RequestTime + *out = (*in).DeepCopy() + } if in.Requested != nil { in, out := &in.Requested, &out.Requested *out = new(string) @@ -9571,12 +9941,21 @@ func (in *ReservedInstances) DeepCopyInto(out *ReservedInstances) { *out = new(string) **out = **in } - if in.InstanceCount != nil { - in, out := &in.InstanceCount, &out.InstanceCount + if in.Duration != nil { + in, out := &in.Duration, &out.Duration *out = new(int64) **out = **in } - if in.InstanceTenancy != nil { + if in.End != nil { + in, out := &in.End, &out.End + *out = (*in).DeepCopy() + } + if in.InstanceCount != nil { + in, out := &in.InstanceCount, &out.InstanceCount + *out = new(int64) + **out = **in + } + if in.InstanceTenancy != nil { in, out := &in.InstanceTenancy, &out.InstanceTenancy *out = new(string) **out = **in @@ -9586,6 +9965,10 @@ func (in *ReservedInstances) DeepCopyInto(out *ReservedInstances) { *out = new(string) **out = **in } + if in.Start != nil { + in, out := &in.Start, &out.Start + *out = (*in).DeepCopy() + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -9667,6 +10050,10 @@ func (in *ReservedInstancesListing) DeepCopyInto(out *ReservedInstancesListing) *out = new(string) **out = **in } + if in.CreateDate != nil { + in, out := &in.CreateDate, &out.CreateDate + *out = (*in).DeepCopy() + } if in.ReservedInstancesID != nil { in, out := &in.ReservedInstancesID, &out.ReservedInstancesID *out = new(string) @@ -9693,6 +10080,10 @@ func (in *ReservedInstancesListing) DeepCopyInto(out *ReservedInstancesListing) } } } + if in.UpdateDate != nil { + in, out := &in.UpdateDate, &out.UpdateDate + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservedInstancesListing. @@ -9713,6 +10104,14 @@ func (in *ReservedInstancesModification) DeepCopyInto(out *ReservedInstancesModi *out = new(string) **out = **in } + if in.CreateDate != nil { + in, out := &in.CreateDate, &out.CreateDate + *out = (*in).DeepCopy() + } + if in.EffectiveDate != nil { + in, out := &in.EffectiveDate, &out.EffectiveDate + *out = (*in).DeepCopy() + } if in.ReservedInstancesModificationID != nil { in, out := &in.ReservedInstancesModificationID, &out.ReservedInstancesModificationID *out = new(string) @@ -9728,6 +10127,10 @@ func (in *ReservedInstancesModification) DeepCopyInto(out *ReservedInstancesModi *out = new(string) **out = **in } + if in.UpdateDate != nil { + in, out := &in.UpdateDate, &out.UpdateDate + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservedInstancesModification. @@ -9768,6 +10171,11 @@ func (in *ReservedInstancesOffering) DeepCopyInto(out *ReservedInstancesOffering *out = new(string) **out = **in } + if in.Duration != nil { + in, out := &in.Duration, &out.Duration + *out = new(int64) + **out = **in + } if in.InstanceTenancy != nil { in, out := &in.InstanceTenancy, &out.InstanceTenancy *out = new(string) @@ -10359,6 +10767,10 @@ func (in *ScheduledInstance) DeepCopyInto(out *ScheduledInstance) { *out = new(string) **out = **in } + if in.CreateDate != nil { + in, out := &in.CreateDate, &out.CreateDate + *out = (*in).DeepCopy() + } if in.HourlyPrice != nil { in, out := &in.HourlyPrice, &out.HourlyPrice *out = new(string) @@ -10379,11 +10791,19 @@ func (in *ScheduledInstance) DeepCopyInto(out *ScheduledInstance) { *out = new(string) **out = **in } + if in.NextSlotStartTime != nil { + in, out := &in.NextSlotStartTime, &out.NextSlotStartTime + *out = (*in).DeepCopy() + } if in.Platform != nil { in, out := &in.Platform, &out.Platform *out = new(string) **out = **in } + if in.PreviousSlotEndTime != nil { + in, out := &in.PreviousSlotEndTime, &out.PreviousSlotEndTime + *out = (*in).DeepCopy() + } if in.ScheduledInstanceID != nil { in, out := &in.ScheduledInstanceID, &out.ScheduledInstanceID *out = new(string) @@ -10394,6 +10814,14 @@ func (in *ScheduledInstance) DeepCopyInto(out *ScheduledInstance) { *out = new(int64) **out = **in } + if in.TermEndDate != nil { + in, out := &in.TermEndDate, &out.TermEndDate + *out = (*in).DeepCopy() + } + if in.TermStartDate != nil { + in, out := &in.TermStartDate, &out.TermStartDate + *out = (*in).DeepCopy() + } if in.TotalScheduledInstanceHours != nil { in, out := &in.TotalScheduledInstanceHours, &out.TotalScheduledInstanceHours *out = new(int64) @@ -10424,6 +10852,10 @@ func (in *ScheduledInstanceAvailability) DeepCopyInto(out *ScheduledInstanceAvai *out = new(int64) **out = **in } + if in.FirstSlotStartTime != nil { + in, out := &in.FirstSlotStartTime, &out.FirstSlotStartTime + *out = (*in).DeepCopy() + } if in.HourlyPrice != nil { in, out := &in.HourlyPrice, &out.HourlyPrice *out = new(string) @@ -11085,6 +11517,52 @@ func (in *ServiceDetail) DeepCopy() *ServiceDetail { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlotDateTimeRangeRequest) DeepCopyInto(out *SlotDateTimeRangeRequest) { + *out = *in + if in.EarliestTime != nil { + in, out := &in.EarliestTime, &out.EarliestTime + *out = (*in).DeepCopy() + } + if in.LatestTime != nil { + in, out := &in.LatestTime, &out.LatestTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlotDateTimeRangeRequest. +func (in *SlotDateTimeRangeRequest) DeepCopy() *SlotDateTimeRangeRequest { + if in == nil { + return nil + } + out := new(SlotDateTimeRangeRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlotStartTimeRangeRequest) DeepCopyInto(out *SlotStartTimeRangeRequest) { + *out = *in + if in.EarliestTime != nil { + in, out := &in.EarliestTime, &out.EarliestTime + *out = (*in).DeepCopy() + } + if in.LatestTime != nil { + in, out := &in.LatestTime, &out.LatestTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlotStartTimeRangeRequest. +func (in *SlotStartTimeRangeRequest) DeepCopy() *SlotStartTimeRangeRequest { + if in == nil { + return nil + } + out := new(SlotStartTimeRangeRequest) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SnapshotDetail) DeepCopyInto(out *SnapshotDetail) { *out = *in @@ -11509,6 +11987,14 @@ func (in *SpotFleetRequestConfigData) DeepCopyInto(out *SpotFleetRequestConfigDa *out = new(bool) **out = **in } + if in.ValidFrom != nil { + in, out := &in.ValidFrom, &out.ValidFrom + *out = (*in).DeepCopy() + } + if in.ValidUntil != nil { + in, out := &in.ValidUntil, &out.ValidUntil + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpotFleetRequestConfigData. @@ -11570,6 +12056,10 @@ func (in *SpotInstanceRequest) DeepCopyInto(out *SpotInstanceRequest) { *out = new(int64) **out = **in } + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = (*in).DeepCopy() + } if in.LaunchGroup != nil { in, out := &in.LaunchGroup, &out.LaunchGroup *out = new(string) @@ -11601,6 +12091,14 @@ func (in *SpotInstanceRequest) DeepCopyInto(out *SpotInstanceRequest) { } } } + if in.ValidFrom != nil { + in, out := &in.ValidFrom, &out.ValidFrom + *out = (*in).DeepCopy() + } + if in.ValidUntil != nil { + in, out := &in.ValidUntil, &out.ValidUntil + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpotInstanceRequest. @@ -11651,6 +12149,10 @@ func (in *SpotInstanceStatus) DeepCopyInto(out *SpotInstanceStatus) { *out = new(string) **out = **in } + if in.UpdateTime != nil { + in, out := &in.UpdateTime, &out.UpdateTime + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpotInstanceStatus. @@ -11676,6 +12178,10 @@ func (in *SpotMarketOptions) DeepCopyInto(out *SpotMarketOptions) { *out = new(string) **out = **in } + if in.ValidUntil != nil { + in, out := &in.ValidUntil, &out.ValidUntil + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpotMarketOptions. @@ -11811,6 +12317,10 @@ func (in *SpotPrice) DeepCopyInto(out *SpotPrice) { *out = new(string) **out = **in } + if in.Timestamp != nil { + in, out := &in.Timestamp, &out.Timestamp + *out = (*in).DeepCopy() + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpotPrice. @@ -12921,37 +13431,10 @@ func (in *TrafficMirrorTarget) DeepCopy() *TrafficMirrorTarget { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGateway) DeepCopyInto(out *TransitGateway) { *out = *in - if in.Description != nil { - in, out := &in.Description, &out.Description - *out = new(string) - **out = **in - } - if in.OwnerID != nil { - in, out := &in.OwnerID, &out.OwnerID - *out = new(string) - **out = **in - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make([]*Tag, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(Tag) - (*in).DeepCopyInto(*out) - } - } - } - if in.TransitGatewayARN != nil { - in, out := &in.TransitGatewayARN, &out.TransitGatewayARN - *out = new(string) - **out = **in - } - if in.TransitGatewayID != nil { - in, out := &in.TransitGatewayID, &out.TransitGatewayID - *out = new(string) - **out = **in - } + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGateway. @@ -12964,6 +13447,14 @@ func (in *TransitGateway) DeepCopy() *TransitGateway { return out } +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TransitGateway) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayAssociation) DeepCopyInto(out *TransitGatewayAssociation) { *out = *in @@ -12987,6 +13478,10 @@ func (in *TransitGatewayAssociation) DeepCopy() *TransitGatewayAssociation { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayAttachment) DeepCopyInto(out *TransitGatewayAttachment) { *out = *in + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } if in.ResourceID != nil { in, out := &in.ResourceID, &out.ResourceID *out = new(string) @@ -13063,11 +13558,21 @@ func (in *TransitGatewayAttachmentBGPConfiguration) DeepCopyInto(out *TransitGat *out = new(string) **out = **in } + if in.PeerASN != nil { + in, out := &in.PeerASN, &out.PeerASN + *out = new(int64) + **out = **in + } if in.TransitGatewayAddress != nil { in, out := &in.TransitGatewayAddress, &out.TransitGatewayAddress *out = new(string) **out = **in } + if in.TransitGatewayASN != nil { + in, out := &in.TransitGatewayASN, &out.TransitGatewayASN + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGatewayAttachmentBGPConfiguration. @@ -13103,6 +13608,10 @@ func (in *TransitGatewayAttachmentPropagation) DeepCopy() *TransitGatewayAttachm // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayConnect) DeepCopyInto(out *TransitGatewayConnect) { *out = *in + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -13114,6 +13623,11 @@ func (in *TransitGatewayConnect) DeepCopyInto(out *TransitGatewayConnect) { } } } + if in.TransitGatewayID != nil { + in, out := &in.TransitGatewayID, &out.TransitGatewayID + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGatewayConnect. @@ -13129,6 +13643,10 @@ func (in *TransitGatewayConnect) DeepCopy() *TransitGatewayConnect { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayConnectPeer) DeepCopyInto(out *TransitGatewayConnectPeer) { *out = *in + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -13177,6 +13695,58 @@ func (in *TransitGatewayConnectPeerConfiguration) DeepCopy() *TransitGatewayConn return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TransitGatewayConnectRequestBGPOptions) DeepCopyInto(out *TransitGatewayConnectRequestBGPOptions) { + *out = *in + if in.PeerASN != nil { + in, out := &in.PeerASN, &out.PeerASN + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGatewayConnectRequestBGPOptions. +func (in *TransitGatewayConnectRequestBGPOptions) DeepCopy() *TransitGatewayConnectRequestBGPOptions { + if in == nil { + return nil + } + out := new(TransitGatewayConnectRequestBGPOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TransitGatewayList) DeepCopyInto(out *TransitGatewayList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TransitGateway, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGatewayList. +func (in *TransitGatewayList) DeepCopy() *TransitGatewayList { + if in == nil { + return nil + } + out := new(TransitGatewayList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TransitGatewayList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayMulticastDeregisteredGroupMembers) DeepCopyInto(out *TransitGatewayMulticastDeregisteredGroupMembers) { *out = *in @@ -13252,6 +13822,10 @@ func (in *TransitGatewayMulticastDeregisteredGroupSources) DeepCopy() *TransitGa // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayMulticastDomain) DeepCopyInto(out *TransitGatewayMulticastDomain) { *out = *in + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } if in.OwnerID != nil { in, out := &in.OwnerID, &out.OwnerID *out = new(string) @@ -13490,11 +14064,41 @@ func (in *TransitGatewayMulticastRegisteredGroupSources) DeepCopy() *TransitGate // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayOptions) DeepCopyInto(out *TransitGatewayOptions) { *out = *in + if in.AmazonSideASN != nil { + in, out := &in.AmazonSideASN, &out.AmazonSideASN + *out = new(int64) + **out = **in + } if in.AssociationDefaultRouteTableID != nil { in, out := &in.AssociationDefaultRouteTableID, &out.AssociationDefaultRouteTableID *out = new(string) **out = **in } + if in.AutoAcceptSharedAttachments != nil { + in, out := &in.AutoAcceptSharedAttachments, &out.AutoAcceptSharedAttachments + *out = new(string) + **out = **in + } + if in.DefaultRouteTableAssociation != nil { + in, out := &in.DefaultRouteTableAssociation, &out.DefaultRouteTableAssociation + *out = new(string) + **out = **in + } + if in.DefaultRouteTablePropagation != nil { + in, out := &in.DefaultRouteTablePropagation, &out.DefaultRouteTablePropagation + *out = new(string) + **out = **in + } + if in.DNSSupport != nil { + in, out := &in.DNSSupport, &out.DNSSupport + *out = new(string) + **out = **in + } + if in.MulticastSupport != nil { + in, out := &in.MulticastSupport, &out.MulticastSupport + *out = new(string) + **out = **in + } if in.PropagationDefaultRouteTableID != nil { in, out := &in.PropagationDefaultRouteTableID, &out.PropagationDefaultRouteTableID *out = new(string) @@ -13511,6 +14115,11 @@ func (in *TransitGatewayOptions) DeepCopyInto(out *TransitGatewayOptions) { } } } + if in.VPNEcmpSupport != nil { + in, out := &in.VPNEcmpSupport, &out.VPNEcmpSupport + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGatewayOptions. @@ -13526,6 +14135,10 @@ func (in *TransitGatewayOptions) DeepCopy() *TransitGatewayOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayPeeringAttachment) DeepCopyInto(out *TransitGatewayPeeringAttachment) { *out = *in + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -13624,6 +14237,67 @@ func (in *TransitGatewayPropagation) DeepCopy() *TransitGatewayPropagation { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TransitGatewayRequestOptions) DeepCopyInto(out *TransitGatewayRequestOptions) { + *out = *in + if in.AmazonSideASN != nil { + in, out := &in.AmazonSideASN, &out.AmazonSideASN + *out = new(int64) + **out = **in + } + if in.AutoAcceptSharedAttachments != nil { + in, out := &in.AutoAcceptSharedAttachments, &out.AutoAcceptSharedAttachments + *out = new(string) + **out = **in + } + if in.DefaultRouteTableAssociation != nil { + in, out := &in.DefaultRouteTableAssociation, &out.DefaultRouteTableAssociation + *out = new(string) + **out = **in + } + if in.DefaultRouteTablePropagation != nil { + in, out := &in.DefaultRouteTablePropagation, &out.DefaultRouteTablePropagation + *out = new(string) + **out = **in + } + if in.DNSSupport != nil { + in, out := &in.DNSSupport, &out.DNSSupport + *out = new(string) + **out = **in + } + if in.MulticastSupport != nil { + in, out := &in.MulticastSupport, &out.MulticastSupport + *out = new(string) + **out = **in + } + if in.TransitGatewayCIDRBlocks != nil { + in, out := &in.TransitGatewayCIDRBlocks, &out.TransitGatewayCIDRBlocks + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.VPNEcmpSupport != nil { + in, out := &in.VPNEcmpSupport, &out.VPNEcmpSupport + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGatewayRequestOptions. +func (in *TransitGatewayRequestOptions) DeepCopy() *TransitGatewayRequestOptions { + if in == nil { + return nil + } + out := new(TransitGatewayRequestOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayRoute) DeepCopyInto(out *TransitGatewayRoute) { *out = *in @@ -13672,6 +14346,10 @@ func (in *TransitGatewayRouteAttachment) DeepCopy() *TransitGatewayRouteAttachme // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayRouteTable) DeepCopyInto(out *TransitGatewayRouteTable) { *out = *in + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } if in.DefaultAssociationRouteTable != nil { in, out := &in.DefaultAssociationRouteTable, &out.DefaultAssociationRouteTable *out = new(bool) @@ -13765,9 +14443,110 @@ func (in *TransitGatewayRouteTablePropagation) DeepCopy() *TransitGatewayRouteTa return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TransitGatewaySpec) DeepCopyInto(out *TransitGatewaySpec) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = new(TransitGatewayRequestOptions) + (*in).DeepCopyInto(*out) + } + if in.TagSpecifications != nil { + in, out := &in.TagSpecifications, &out.TagSpecifications + *out = make([]*TagSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(TagSpecification) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGatewaySpec. +func (in *TransitGatewaySpec) DeepCopy() *TransitGatewaySpec { + if in == nil { + return nil + } + out := new(TransitGatewaySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TransitGatewayStatus) DeepCopyInto(out *TransitGatewayStatus) { + *out = *in + if in.ACKResourceMetadata != nil { + in, out := &in.ACKResourceMetadata, &out.ACKResourceMetadata + *out = new(corev1alpha1.ResourceMetadata) + (*in).DeepCopyInto(*out) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]*corev1alpha1.Condition, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(corev1alpha1.Condition) + (*in).DeepCopyInto(*out) + } + } + } + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } + if in.OwnerID != nil { + in, out := &in.OwnerID, &out.OwnerID + *out = new(string) + **out = **in + } + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]*Tag, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Tag) + (*in).DeepCopyInto(*out) + } + } + } + if in.TransitGatewayID != nil { + in, out := &in.TransitGatewayID, &out.TransitGatewayID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGatewayStatus. +func (in *TransitGatewayStatus) DeepCopy() *TransitGatewayStatus { + if in == nil { + return nil + } + out := new(TransitGatewayStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TransitGatewayVPCAttachment) DeepCopyInto(out *TransitGatewayVPCAttachment) { *out = *in + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } if in.SubnetIDs != nil { in, out := &in.SubnetIDs, &out.SubnetIDs *out = make([]*string, len(*in)) @@ -13822,6 +14601,86 @@ func (in *TransitGatewayVPCAttachment) DeepCopy() *TransitGatewayVPCAttachment { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TransitGatewayVPCAttachmentOptions) DeepCopyInto(out *TransitGatewayVPCAttachmentOptions) { + *out = *in + if in.DNSSupport != nil { + in, out := &in.DNSSupport, &out.DNSSupport + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGatewayVPCAttachmentOptions. +func (in *TransitGatewayVPCAttachmentOptions) DeepCopy() *TransitGatewayVPCAttachmentOptions { + if in == nil { + return nil + } + out := new(TransitGatewayVPCAttachmentOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TransitGateway_SDK) DeepCopyInto(out *TransitGateway_SDK) { + *out = *in + if in.CreationTime != nil { + in, out := &in.CreationTime, &out.CreationTime + *out = (*in).DeepCopy() + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = new(TransitGatewayOptions) + (*in).DeepCopyInto(*out) + } + if in.OwnerID != nil { + in, out := &in.OwnerID, &out.OwnerID + *out = new(string) + **out = **in + } + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]*Tag, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Tag) + (*in).DeepCopyInto(*out) + } + } + } + if in.TransitGatewayARN != nil { + in, out := &in.TransitGatewayARN, &out.TransitGatewayARN + *out = new(string) + **out = **in + } + if in.TransitGatewayID != nil { + in, out := &in.TransitGatewayID, &out.TransitGatewayID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransitGateway_SDK. +func (in *TransitGateway_SDK) DeepCopy() *TransitGateway_SDK { + if in == nil { + return nil + } + out := new(TransitGateway_SDK) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TunnelOption) DeepCopyInto(out *TunnelOption) { *out = *in @@ -14120,6 +14979,10 @@ func (in *VGWTelemetry) DeepCopyInto(out *VGWTelemetry) { *out = new(string) **out = **in } + if in.LastStatusChange != nil { + in, out := &in.LastStatusChange, &out.LastStatusChange + *out = (*in).DeepCopy() + } if in.OutsideIPAddress != nil { in, out := &in.OutsideIPAddress, &out.OutsideIPAddress *out = new(string) @@ -14819,6 +15682,10 @@ func (in *VPCList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPCPeeringConnection) DeepCopyInto(out *VPCPeeringConnection) { *out = *in + if in.ExpirationTime != nil { + in, out := &in.ExpirationTime, &out.ExpirationTime + *out = (*in).DeepCopy() + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -15309,6 +16176,11 @@ func (in *VPNConnectionOptionsSpecification) DeepCopy() *VPNConnectionOptionsSpe // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPNGateway) DeepCopyInto(out *VPNGateway) { *out = *in + if in.AmazonSideASN != nil { + in, out := &in.AmazonSideASN, &out.AmazonSideASN + *out = new(int64) + **out = **in + } if in.AvailabilityZone != nil { in, out := &in.AvailabilityZone, &out.AvailabilityZone *out = new(string) @@ -15457,9 +16329,33 @@ func (in *ValidationError) DeepCopy() *ValidationError { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeDetail) DeepCopyInto(out *VolumeDetail) { + *out = *in + if in.Size != nil { + in, out := &in.Size, &out.Size + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeDetail. +func (in *VolumeDetail) DeepCopy() *VolumeDetail { + if in == nil { + return nil + } + out := new(VolumeDetail) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeModification) DeepCopyInto(out *VolumeModification) { *out = *in + if in.EndTime != nil { + in, out := &in.EndTime, &out.EndTime + *out = (*in).DeepCopy() + } if in.OriginalIOPS != nil { in, out := &in.OriginalIOPS, &out.OriginalIOPS *out = new(int64) @@ -15480,6 +16376,15 @@ func (in *VolumeModification) DeepCopyInto(out *VolumeModification) { *out = new(int64) **out = **in } + if in.Progress != nil { + in, out := &in.Progress, &out.Progress + *out = new(int64) + **out = **in + } + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + *out = (*in).DeepCopy() + } if in.StatusMessage != nil { in, out := &in.StatusMessage, &out.StatusMessage *out = new(string) diff --git a/cmd/controller/main.go b/cmd/controller/main.go index 0f2371c6..93297977 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -36,6 +36,7 @@ import ( _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/internet_gateway" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/route_table" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/subnet" + _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/transit_gateway" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/vpc" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/vpc_endpoint" ) diff --git a/config/crd/bases/ec2.services.k8s.aws_transitgateways.yaml b/config/crd/bases/ec2.services.k8s.aws_transitgateways.yaml new file mode 100644 index 00000000..cce35a1e --- /dev/null +++ b/config/crd/bases/ec2.services.k8s.aws_transitgateways.yaml @@ -0,0 +1,181 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.7.0 + creationTimestamp: null + name: transitgateways.ec2.services.k8s.aws +spec: + group: ec2.services.k8s.aws + names: + kind: TransitGateway + listKind: TransitGatewayList + plural: transitgateways + singular: transitgateway + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: TransitGateway is the Schema for the TransitGateways API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: "TransitGatewaySpec defines the desired state of TransitGateway. + \n Describes a transit gateway." + properties: + description: + description: A description of the transit gateway. + type: string + options: + description: The transit gateway options. + properties: + amazonSideASN: + format: int64 + type: integer + autoAcceptSharedAttachments: + type: string + defaultRouteTableAssociation: + type: string + defaultRouteTablePropagation: + type: string + dnsSupport: + type: string + multicastSupport: + type: string + transitGatewayCIDRBlocks: + items: + type: string + type: array + vpnEcmpSupport: + type: string + type: object + tagSpecifications: + description: The tags to apply to the transit gateway. + items: + description: The tags to apply to a resource when the resource is + being created. + properties: + resourceType: + type: string + tags: + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array + type: object + type: array + type: object + status: + description: TransitGatewayStatus defines the observed state of TransitGateway + properties: + ackResourceMetadata: + description: All CRs managed by ACK have a common `Status.ACKResourceMetadata` + member that is used to contain resource sync state, account ownership, + constructed ARN for the resource + properties: + arn: + description: 'ARN is the Amazon Resource Name for the resource. + This is a globally-unique identifier and is set only by the + ACK service controller once the controller has orchestrated + the creation of the resource OR when it has verified that an + "adopted" resource (a resource where the ARN annotation was + set by the Kubernetes user on the CR) exists and matches the + supplied CR''s Spec field values. TODO(vijat@): Find a better + strategy for resources that do not have ARN in CreateOutputResponse + https://github.com/aws/aws-controllers-k8s/issues/270' + type: string + ownerAccountID: + description: OwnerAccountID is the AWS Account ID of the account + that owns the backend AWS service API resource. + type: string + required: + - ownerAccountID + type: object + conditions: + description: All CRS managed by ACK have a common `Status.Conditions` + member that contains a collection of `ackv1alpha1.Condition` objects + that describe the various terminal states of the CR and its backend + AWS service API resource + items: + description: Condition is the common struct used by all CRDs managed + by ACK service controllers to indicate terminal states of the + CR and its backend AWS service API resource + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type is the type of the Condition + type: string + required: + - status + - type + type: object + type: array + creationTime: + description: The creation time. + format: date-time + type: string + ownerID: + description: The ID of the AWS account ID that owns the transit gateway. + type: string + state: + description: The state of the transit gateway. + type: string + tags: + description: The tags for the transit gateway. + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array + transitGatewayID: + description: The ID of the transit gateway. + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 47df41b6..51dcfe86 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -6,5 +6,6 @@ resources: - bases/ec2.services.k8s.aws_internetgateways.yaml - bases/ec2.services.k8s.aws_routetables.yaml - bases/ec2.services.k8s.aws_subnets.yaml + - bases/ec2.services.k8s.aws_transitgateways.yaml - bases/ec2.services.k8s.aws_vpcs.yaml - bases/ec2.services.k8s.aws_vpcendpoints.yaml diff --git a/config/rbac/cluster-role-controller.yaml b/config/rbac/cluster-role-controller.yaml index ccec25df..7d8d3eb4 100644 --- a/config/rbac/cluster-role-controller.yaml +++ b/config/rbac/cluster-role-controller.yaml @@ -82,6 +82,26 @@ rules: - get - patch - update +- apiGroups: + - ec2.services.k8s.aws + resources: + - transitgateways + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - transitgateways/status + verbs: + - get + - patch + - update - apiGroups: - ec2.services.k8s.aws resources: diff --git a/config/rbac/role-reader.yaml b/config/rbac/role-reader.yaml index 08eb1d2e..0c944ed4 100644 --- a/config/rbac/role-reader.yaml +++ b/config/rbac/role-reader.yaml @@ -12,6 +12,7 @@ rules: - internetgateways - routetables - subnets + - transitgateways - vpcs - vpcendpoints verbs: diff --git a/config/rbac/role-writer.yaml b/config/rbac/role-writer.yaml index ea28b1f6..4718e584 100644 --- a/config/rbac/role-writer.yaml +++ b/config/rbac/role-writer.yaml @@ -12,6 +12,7 @@ rules: - internetgateways - routetables - subnets + - transitgateways - vpcs - vpcendpoints verbs: @@ -28,6 +29,7 @@ rules: - internetgateways - routetables - subnets + - transitgateways - vpcs - vpcendpoints verbs: diff --git a/helm/crds/ec2.services.k8s.aws_transitgateways.yaml b/helm/crds/ec2.services.k8s.aws_transitgateways.yaml new file mode 100644 index 00000000..cce35a1e --- /dev/null +++ b/helm/crds/ec2.services.k8s.aws_transitgateways.yaml @@ -0,0 +1,181 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.7.0 + creationTimestamp: null + name: transitgateways.ec2.services.k8s.aws +spec: + group: ec2.services.k8s.aws + names: + kind: TransitGateway + listKind: TransitGatewayList + plural: transitgateways + singular: transitgateway + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: TransitGateway is the Schema for the TransitGateways API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: "TransitGatewaySpec defines the desired state of TransitGateway. + \n Describes a transit gateway." + properties: + description: + description: A description of the transit gateway. + type: string + options: + description: The transit gateway options. + properties: + amazonSideASN: + format: int64 + type: integer + autoAcceptSharedAttachments: + type: string + defaultRouteTableAssociation: + type: string + defaultRouteTablePropagation: + type: string + dnsSupport: + type: string + multicastSupport: + type: string + transitGatewayCIDRBlocks: + items: + type: string + type: array + vpnEcmpSupport: + type: string + type: object + tagSpecifications: + description: The tags to apply to the transit gateway. + items: + description: The tags to apply to a resource when the resource is + being created. + properties: + resourceType: + type: string + tags: + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array + type: object + type: array + type: object + status: + description: TransitGatewayStatus defines the observed state of TransitGateway + properties: + ackResourceMetadata: + description: All CRs managed by ACK have a common `Status.ACKResourceMetadata` + member that is used to contain resource sync state, account ownership, + constructed ARN for the resource + properties: + arn: + description: 'ARN is the Amazon Resource Name for the resource. + This is a globally-unique identifier and is set only by the + ACK service controller once the controller has orchestrated + the creation of the resource OR when it has verified that an + "adopted" resource (a resource where the ARN annotation was + set by the Kubernetes user on the CR) exists and matches the + supplied CR''s Spec field values. TODO(vijat@): Find a better + strategy for resources that do not have ARN in CreateOutputResponse + https://github.com/aws/aws-controllers-k8s/issues/270' + type: string + ownerAccountID: + description: OwnerAccountID is the AWS Account ID of the account + that owns the backend AWS service API resource. + type: string + required: + - ownerAccountID + type: object + conditions: + description: All CRS managed by ACK have a common `Status.Conditions` + member that contains a collection of `ackv1alpha1.Condition` objects + that describe the various terminal states of the CR and its backend + AWS service API resource + items: + description: Condition is the common struct used by all CRDs managed + by ACK service controllers to indicate terminal states of the + CR and its backend AWS service API resource + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type is the type of the Condition + type: string + required: + - status + - type + type: object + type: array + creationTime: + description: The creation time. + format: date-time + type: string + ownerID: + description: The ID of the AWS account ID that owns the transit gateway. + type: string + state: + description: The state of the transit gateway. + type: string + tags: + description: The tags for the transit gateway. + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array + transitGatewayID: + description: The ID of the transit gateway. + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/helm/templates/cluster-role-controller.yaml b/helm/templates/cluster-role-controller.yaml index adec33a3..bebe2879 100644 --- a/helm/templates/cluster-role-controller.yaml +++ b/helm/templates/cluster-role-controller.yaml @@ -88,6 +88,26 @@ rules: - get - patch - update +- apiGroups: + - ec2.services.k8s.aws + resources: + - transitgateways + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - transitgateways/status + verbs: + - get + - patch + - update - apiGroups: - ec2.services.k8s.aws resources: diff --git a/helm/templates/role-reader.yaml b/helm/templates/role-reader.yaml index d4d13ec7..c7ef685c 100644 --- a/helm/templates/role-reader.yaml +++ b/helm/templates/role-reader.yaml @@ -12,6 +12,7 @@ rules: - internetgateways - routetables - subnets + - transitgateways - vpcs - vpcendpoints verbs: diff --git a/helm/templates/role-writer.yaml b/helm/templates/role-writer.yaml index dae8c0e4..002d0f38 100644 --- a/helm/templates/role-writer.yaml +++ b/helm/templates/role-writer.yaml @@ -15,6 +15,8 @@ rules: - subnets + - transitgateways + - vpcs - vpcendpoints @@ -33,6 +35,7 @@ rules: - internetgateways - routetables - subnets + - transitgateways - vpcs - vpcendpoints verbs: From e2f1e77900284979e63ba6d131a9bc520e9c3bee Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 18 Oct 2021 18:29:14 -0500 Subject: [PATCH 3/7] add tgw create/delete test --- pkg/resource/transit_gateway/delta.go | 112 ++++ pkg/resource/transit_gateway/descriptor.go | 154 +++++ pkg/resource/transit_gateway/identifiers.go | 46 ++ pkg/resource/transit_gateway/manager.go | 304 ++++++++++ .../transit_gateway/manager_factory.go | 96 ++++ pkg/resource/transit_gateway/resource.go | 107 ++++ pkg/resource/transit_gateway/sdk.go | 535 ++++++++++++++++++ test/e2e/resources/transitgateway.yaml | 5 + test/e2e/tests/test_transit_gateway.py | 98 ++++ 9 files changed, 1457 insertions(+) create mode 100644 pkg/resource/transit_gateway/delta.go create mode 100644 pkg/resource/transit_gateway/descriptor.go create mode 100644 pkg/resource/transit_gateway/identifiers.go create mode 100644 pkg/resource/transit_gateway/manager.go create mode 100644 pkg/resource/transit_gateway/manager_factory.go create mode 100644 pkg/resource/transit_gateway/resource.go create mode 100644 pkg/resource/transit_gateway/sdk.go create mode 100644 test/e2e/resources/transitgateway.yaml create mode 100644 test/e2e/tests/test_transit_gateway.py diff --git a/pkg/resource/transit_gateway/delta.go b/pkg/resource/transit_gateway/delta.go new file mode 100644 index 00000000..925ae154 --- /dev/null +++ b/pkg/resource/transit_gateway/delta.go @@ -0,0 +1,112 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. + +// Code generated by ack-generate. DO NOT EDIT. + +package transit_gateway + +import ( + "bytes" + "reflect" + + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" +) + +// Hack to avoid import errors during build... +var ( + _ = &bytes.Buffer{} + _ = &reflect.Method{} +) + +// newResourceDelta returns a new `ackcompare.Delta` used to compare two +// resources +func newResourceDelta( + a *resource, + b *resource, +) *ackcompare.Delta { + delta := ackcompare.NewDelta() + if (a == nil && b != nil) || + (a != nil && b == nil) { + delta.Add("", a, b) + return delta + } + + if ackcompare.HasNilDifference(a.ko.Spec.Description, b.ko.Spec.Description) { + delta.Add("Spec.Description", a.ko.Spec.Description, b.ko.Spec.Description) + } else if a.ko.Spec.Description != nil && b.ko.Spec.Description != nil { + if *a.ko.Spec.Description != *b.ko.Spec.Description { + delta.Add("Spec.Description", a.ko.Spec.Description, b.ko.Spec.Description) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Options, b.ko.Spec.Options) { + delta.Add("Spec.Options", a.ko.Spec.Options, b.ko.Spec.Options) + } else if a.ko.Spec.Options != nil && b.ko.Spec.Options != nil { + if ackcompare.HasNilDifference(a.ko.Spec.Options.AmazonSideASN, b.ko.Spec.Options.AmazonSideASN) { + delta.Add("Spec.Options.AmazonSideASN", a.ko.Spec.Options.AmazonSideASN, b.ko.Spec.Options.AmazonSideASN) + } else if a.ko.Spec.Options.AmazonSideASN != nil && b.ko.Spec.Options.AmazonSideASN != nil { + if *a.ko.Spec.Options.AmazonSideASN != *b.ko.Spec.Options.AmazonSideASN { + delta.Add("Spec.Options.AmazonSideASN", a.ko.Spec.Options.AmazonSideASN, b.ko.Spec.Options.AmazonSideASN) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Options.AutoAcceptSharedAttachments, b.ko.Spec.Options.AutoAcceptSharedAttachments) { + delta.Add("Spec.Options.AutoAcceptSharedAttachments", a.ko.Spec.Options.AutoAcceptSharedAttachments, b.ko.Spec.Options.AutoAcceptSharedAttachments) + } else if a.ko.Spec.Options.AutoAcceptSharedAttachments != nil && b.ko.Spec.Options.AutoAcceptSharedAttachments != nil { + if *a.ko.Spec.Options.AutoAcceptSharedAttachments != *b.ko.Spec.Options.AutoAcceptSharedAttachments { + delta.Add("Spec.Options.AutoAcceptSharedAttachments", a.ko.Spec.Options.AutoAcceptSharedAttachments, b.ko.Spec.Options.AutoAcceptSharedAttachments) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Options.DefaultRouteTableAssociation, b.ko.Spec.Options.DefaultRouteTableAssociation) { + delta.Add("Spec.Options.DefaultRouteTableAssociation", a.ko.Spec.Options.DefaultRouteTableAssociation, b.ko.Spec.Options.DefaultRouteTableAssociation) + } else if a.ko.Spec.Options.DefaultRouteTableAssociation != nil && b.ko.Spec.Options.DefaultRouteTableAssociation != nil { + if *a.ko.Spec.Options.DefaultRouteTableAssociation != *b.ko.Spec.Options.DefaultRouteTableAssociation { + delta.Add("Spec.Options.DefaultRouteTableAssociation", a.ko.Spec.Options.DefaultRouteTableAssociation, b.ko.Spec.Options.DefaultRouteTableAssociation) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Options.DefaultRouteTablePropagation, b.ko.Spec.Options.DefaultRouteTablePropagation) { + delta.Add("Spec.Options.DefaultRouteTablePropagation", a.ko.Spec.Options.DefaultRouteTablePropagation, b.ko.Spec.Options.DefaultRouteTablePropagation) + } else if a.ko.Spec.Options.DefaultRouteTablePropagation != nil && b.ko.Spec.Options.DefaultRouteTablePropagation != nil { + if *a.ko.Spec.Options.DefaultRouteTablePropagation != *b.ko.Spec.Options.DefaultRouteTablePropagation { + delta.Add("Spec.Options.DefaultRouteTablePropagation", a.ko.Spec.Options.DefaultRouteTablePropagation, b.ko.Spec.Options.DefaultRouteTablePropagation) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Options.DNSSupport, b.ko.Spec.Options.DNSSupport) { + delta.Add("Spec.Options.DNSSupport", a.ko.Spec.Options.DNSSupport, b.ko.Spec.Options.DNSSupport) + } else if a.ko.Spec.Options.DNSSupport != nil && b.ko.Spec.Options.DNSSupport != nil { + if *a.ko.Spec.Options.DNSSupport != *b.ko.Spec.Options.DNSSupport { + delta.Add("Spec.Options.DNSSupport", a.ko.Spec.Options.DNSSupport, b.ko.Spec.Options.DNSSupport) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Options.MulticastSupport, b.ko.Spec.Options.MulticastSupport) { + delta.Add("Spec.Options.MulticastSupport", a.ko.Spec.Options.MulticastSupport, b.ko.Spec.Options.MulticastSupport) + } else if a.ko.Spec.Options.MulticastSupport != nil && b.ko.Spec.Options.MulticastSupport != nil { + if *a.ko.Spec.Options.MulticastSupport != *b.ko.Spec.Options.MulticastSupport { + delta.Add("Spec.Options.MulticastSupport", a.ko.Spec.Options.MulticastSupport, b.ko.Spec.Options.MulticastSupport) + } + } + if !ackcompare.SliceStringPEqual(a.ko.Spec.Options.TransitGatewayCIDRBlocks, b.ko.Spec.Options.TransitGatewayCIDRBlocks) { + delta.Add("Spec.Options.TransitGatewayCIDRBlocks", a.ko.Spec.Options.TransitGatewayCIDRBlocks, b.ko.Spec.Options.TransitGatewayCIDRBlocks) + } + if ackcompare.HasNilDifference(a.ko.Spec.Options.VPNEcmpSupport, b.ko.Spec.Options.VPNEcmpSupport) { + delta.Add("Spec.Options.VPNEcmpSupport", a.ko.Spec.Options.VPNEcmpSupport, b.ko.Spec.Options.VPNEcmpSupport) + } else if a.ko.Spec.Options.VPNEcmpSupport != nil && b.ko.Spec.Options.VPNEcmpSupport != nil { + if *a.ko.Spec.Options.VPNEcmpSupport != *b.ko.Spec.Options.VPNEcmpSupport { + delta.Add("Spec.Options.VPNEcmpSupport", a.ko.Spec.Options.VPNEcmpSupport, b.ko.Spec.Options.VPNEcmpSupport) + } + } + } + if !reflect.DeepEqual(a.ko.Spec.TagSpecifications, b.ko.Spec.TagSpecifications) { + delta.Add("Spec.TagSpecifications", a.ko.Spec.TagSpecifications, b.ko.Spec.TagSpecifications) + } + + return delta +} diff --git a/pkg/resource/transit_gateway/descriptor.go b/pkg/resource/transit_gateway/descriptor.go new file mode 100644 index 00000000..0a2c3358 --- /dev/null +++ b/pkg/resource/transit_gateway/descriptor.go @@ -0,0 +1,154 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. + +// Code generated by ack-generate. DO NOT EDIT. + +package transit_gateway + +import ( + ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" + acktypes "github.com/aws-controllers-k8s/runtime/pkg/types" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8sapirt "k8s.io/apimachinery/pkg/runtime" + k8sctrlutil "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + + svcapitypes "github.com/aws-controllers-k8s/ec2-controller/apis/v1alpha1" +) + +const ( + finalizerString = "finalizers.ec2.services.k8s.aws/TransitGateway" +) + +var ( + GroupVersionResource = svcapitypes.GroupVersion.WithResource("transitgateways") + GroupKind = metav1.GroupKind{ + Group: "ec2.services.k8s.aws", + Kind: "TransitGateway", + } +) + +// resourceDescriptor implements the +// `aws-service-operator-k8s/pkg/types.AWSResourceDescriptor` interface +type resourceDescriptor struct { +} + +// GroupKind returns a Kubernetes metav1.GroupKind struct that describes the +// API Group and Kind of CRs described by the descriptor +func (d *resourceDescriptor) GroupKind() *metav1.GroupKind { + return &GroupKind +} + +// EmptyRuntimeObject returns an empty object prototype that may be used in +// apimachinery and k8s client operations +func (d *resourceDescriptor) EmptyRuntimeObject() k8sapirt.Object { + return &svcapitypes.TransitGateway{} +} + +// ResourceFromRuntimeObject returns an AWSResource that has been initialized +// with the supplied runtime.Object +func (d *resourceDescriptor) ResourceFromRuntimeObject( + obj k8sapirt.Object, +) acktypes.AWSResource { + return &resource{ + ko: obj.(*svcapitypes.TransitGateway), + } +} + +// Delta returns an `ackcompare.Delta` object containing the difference between +// one `AWSResource` and another. +func (d *resourceDescriptor) Delta(a, b acktypes.AWSResource) *ackcompare.Delta { + return newResourceDelta(a.(*resource), b.(*resource)) +} + +// IsManaged returns true if the supplied AWSResource is under the management +// of an ACK service controller. What this means in practice is that the +// underlying custom resource (CR) in the AWSResource has had a +// resource-specific finalizer associated with it. +func (d *resourceDescriptor) IsManaged( + res acktypes.AWSResource, +) bool { + obj := res.RuntimeMetaObject() + if obj == nil { + // Should not happen. If it does, there is a bug in the code + panic("nil RuntimeMetaObject in AWSResource") + } + // Remove use of custom code once + // https://github.com/kubernetes-sigs/controller-runtime/issues/994 is + // fixed. This should be able to be: + // + // return k8sctrlutil.ContainsFinalizer(obj, finalizerString) + return containsFinalizer(obj, finalizerString) +} + +// Remove once https://github.com/kubernetes-sigs/controller-runtime/issues/994 +// is fixed. +func containsFinalizer(obj acktypes.RuntimeMetaObject, finalizer string) bool { + f := obj.GetFinalizers() + for _, e := range f { + if e == finalizer { + return true + } + } + return false +} + +// MarkManaged places the supplied resource under the management of ACK. What +// this typically means is that the resource manager will decorate the +// underlying custom resource (CR) with a finalizer that indicates ACK is +// managing the resource and the underlying CR may not be deleted until ACK is +// finished cleaning up any backend AWS service resources associated with the +// CR. +func (d *resourceDescriptor) MarkManaged( + res acktypes.AWSResource, +) { + obj := res.RuntimeMetaObject() + if obj == nil { + // Should not happen. If it does, there is a bug in the code + panic("nil RuntimeMetaObject in AWSResource") + } + k8sctrlutil.AddFinalizer(obj, finalizerString) +} + +// MarkUnmanaged removes the supplied resource from management by ACK. What +// this typically means is that the resource manager will remove a finalizer +// underlying custom resource (CR) that indicates ACK is managing the resource. +// This will allow the Kubernetes API server to delete the underlying CR. +func (d *resourceDescriptor) MarkUnmanaged( + res acktypes.AWSResource, +) { + obj := res.RuntimeMetaObject() + if obj == nil { + // Should not happen. If it does, there is a bug in the code + panic("nil RuntimeMetaObject in AWSResource") + } + k8sctrlutil.RemoveFinalizer(obj, finalizerString) +} + +// MarkAdopted places descriptors on the custom resource that indicate the +// resource was not created from within ACK. +func (d *resourceDescriptor) MarkAdopted( + res acktypes.AWSResource, +) { + obj := res.RuntimeMetaObject() + if obj == nil { + // Should not happen. If it does, there is a bug in the code + panic("nil RuntimeMetaObject in AWSResource") + } + curr := obj.GetAnnotations() + if curr == nil { + curr = make(map[string]string) + } + curr[ackv1alpha1.AnnotationAdopted] = "true" + obj.SetAnnotations(curr) +} diff --git a/pkg/resource/transit_gateway/identifiers.go b/pkg/resource/transit_gateway/identifiers.go new file mode 100644 index 00000000..7c59432a --- /dev/null +++ b/pkg/resource/transit_gateway/identifiers.go @@ -0,0 +1,46 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. + +// Code generated by ack-generate. DO NOT EDIT. + +package transit_gateway + +import ( + ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" +) + +// resourceIdentifiers implements the +// `aws-service-operator-k8s/pkg/types.AWSResourceIdentifiers` interface +type resourceIdentifiers struct { + meta *ackv1alpha1.ResourceMetadata +} + +// ARN returns the AWS Resource Name for the backend AWS resource. If nil, +// this means the resource has not yet been created in the backend AWS +// service. +func (ri *resourceIdentifiers) ARN() *ackv1alpha1.AWSResourceName { + if ri.meta != nil { + return ri.meta.ARN + } + return nil +} + +// OwnerAccountID returns the AWS account identifier in which the +// backend AWS resource resides, or nil if this information is not known +// for the resource +func (ri *resourceIdentifiers) OwnerAccountID() *ackv1alpha1.AWSAccountID { + if ri.meta != nil { + return ri.meta.OwnerAccountID + } + return nil +} diff --git a/pkg/resource/transit_gateway/manager.go b/pkg/resource/transit_gateway/manager.go new file mode 100644 index 00000000..4618a171 --- /dev/null +++ b/pkg/resource/transit_gateway/manager.go @@ -0,0 +1,304 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. + +// Code generated by ack-generate. DO NOT EDIT. + +package transit_gateway + +import ( + "context" + "fmt" + "time" + + ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" + ackcondition "github.com/aws-controllers-k8s/runtime/pkg/condition" + ackcfg "github.com/aws-controllers-k8s/runtime/pkg/config" + ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors" + ackmetrics "github.com/aws-controllers-k8s/runtime/pkg/metrics" + ackrequeue "github.com/aws-controllers-k8s/runtime/pkg/requeue" + ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" + acktypes "github.com/aws-controllers-k8s/runtime/pkg/types" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/go-logr/logr" + corev1 "k8s.io/api/core/v1" + + svcsdk "github.com/aws/aws-sdk-go/service/ec2" + svcsdkapi "github.com/aws/aws-sdk-go/service/ec2/ec2iface" +) + +// +kubebuilder:rbac:groups=ec2.services.k8s.aws,resources=transitgateways,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=ec2.services.k8s.aws,resources=transitgateways/status,verbs=get;update;patch + +var lateInitializeFieldNames = []string{} + +// resourceManager is responsible for providing a consistent way to perform +// CRUD operations in a backend AWS service API for Book custom resources. +type resourceManager struct { + // cfg is a copy of the ackcfg.Config object passed on start of the service + // controller + cfg ackcfg.Config + // log refers to the logr.Logger object handling logging for the service + // controller + log logr.Logger + // metrics contains a collection of Prometheus metric objects that the + // service controller and its reconcilers track + metrics *ackmetrics.Metrics + // rr is the Reconciler which can be used for various utility + // functions such as querying for Secret values given a SecretReference + rr acktypes.Reconciler + // awsAccountID is the AWS account identifier that contains the resources + // managed by this resource manager + awsAccountID ackv1alpha1.AWSAccountID + // The AWS Region that this resource manager targets + awsRegion ackv1alpha1.AWSRegion + // sess is the AWS SDK Session object used to communicate with the backend + // AWS service API + sess *session.Session + // sdk is a pointer to the AWS service API interface exposed by the + // aws-sdk-go/services/{alias}/{alias}iface package. + sdkapi svcsdkapi.EC2API +} + +// concreteResource returns a pointer to a resource from the supplied +// generic AWSResource interface +func (rm *resourceManager) concreteResource( + res acktypes.AWSResource, +) *resource { + // cast the generic interface into a pointer type specific to the concrete + // implementing resource type managed by this resource manager + return res.(*resource) +} + +// ReadOne returns the currently-observed state of the supplied AWSResource in +// the backend AWS service API. +func (rm *resourceManager) ReadOne( + ctx context.Context, + res acktypes.AWSResource, +) (acktypes.AWSResource, error) { + r := rm.concreteResource(res) + if r.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's ReadOne() method received resource with nil CR object") + } + observed, err := rm.sdkFind(ctx, r) + if err != nil { + if observed != nil { + return rm.onError(observed, err) + } + return rm.onError(r, err) + } + return rm.onSuccess(observed) +} + +// Create attempts to create the supplied AWSResource in the backend AWS +// service API, returning an AWSResource representing the newly-created +// resource +func (rm *resourceManager) Create( + ctx context.Context, + res acktypes.AWSResource, +) (acktypes.AWSResource, error) { + r := rm.concreteResource(res) + if r.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's Create() method received resource with nil CR object") + } + created, err := rm.sdkCreate(ctx, r) + if err != nil { + return rm.onError(r, err) + } + return rm.onSuccess(created) +} + +// Update attempts to mutate the supplied desired AWSResource in the backend AWS +// service API, returning an AWSResource representing the newly-mutated +// resource. +// Note for specialized logic implementers can check to see how the latest +// observed resource differs from the supplied desired state. The +// higher-level reonciler determines whether or not the desired differs +// from the latest observed and decides whether to call the resource +// manager's Update method +func (rm *resourceManager) Update( + ctx context.Context, + resDesired acktypes.AWSResource, + resLatest acktypes.AWSResource, + delta *ackcompare.Delta, +) (acktypes.AWSResource, error) { + desired := rm.concreteResource(resDesired) + latest := rm.concreteResource(resLatest) + if desired.ko == nil || latest.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's Update() method received resource with nil CR object") + } + updated, err := rm.sdkUpdate(ctx, desired, latest, delta) + if err != nil { + return rm.onError(latest, err) + } + return rm.onSuccess(updated) +} + +// Delete attempts to destroy the supplied AWSResource in the backend AWS +// service API, returning an AWSResource representing the +// resource being deleted (if delete is asynchronous and takes time) +func (rm *resourceManager) Delete( + ctx context.Context, + res acktypes.AWSResource, +) (acktypes.AWSResource, error) { + r := rm.concreteResource(res) + if r.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's Update() method received resource with nil CR object") + } + observed, err := rm.sdkDelete(ctx, r) + if err != nil { + if observed != nil { + return rm.onError(observed, err) + } + return rm.onError(r, err) + } + + return rm.onSuccess(observed) +} + +// ARNFromName returns an AWS Resource Name from a given string name. This +// is useful for constructing ARNs for APIs that require ARNs in their +// GetAttributes operations but all we have (for new CRs at least) is a +// name for the resource +func (rm *resourceManager) ARNFromName(name string) string { + return fmt.Sprintf( + "arn:aws:ec2:%s:%s:%s", + rm.awsRegion, + rm.awsAccountID, + name, + ) +} + +// LateInitialize returns an acktypes.AWSResource after setting the late initialized +// fields from the readOne call. This method will initialize the optional fields +// which were not provided by the k8s user but were defaulted by the AWS service. +// If there are no such fields to be initialized, the returned object is similar to +// object passed in the parameter. +func (rm *resourceManager) LateInitialize( + ctx context.Context, + latest acktypes.AWSResource, +) (acktypes.AWSResource, error) { + rlog := ackrtlog.FromContext(ctx) + // If there are no fields to late initialize, do nothing + if len(lateInitializeFieldNames) == 0 { + rlog.Debug("no late initialization required.") + return latest, nil + } + latestCopy := latest.DeepCopy() + lateInitConditionReason := "" + lateInitConditionMessage := "" + observed, err := rm.ReadOne(ctx, latestCopy) + if err != nil { + lateInitConditionMessage = "Unable to complete Read operation required for late initialization" + lateInitConditionReason = "Late Initialization Failure" + ackcondition.SetLateInitialized(latestCopy, corev1.ConditionFalse, &lateInitConditionMessage, &lateInitConditionReason) + return latestCopy, err + } + lateInitializedRes := rm.lateInitializeFromReadOneOutput(observed, latestCopy) + incompleteInitialization := rm.incompleteLateInitialization(lateInitializedRes) + if incompleteInitialization { + // Add the condition with LateInitialized=False + lateInitConditionMessage = "Late initialization did not complete, requeuing with delay of 5 seconds" + lateInitConditionReason = "Delayed Late Initialization" + ackcondition.SetLateInitialized(lateInitializedRes, corev1.ConditionFalse, &lateInitConditionMessage, &lateInitConditionReason) + return lateInitializedRes, ackrequeue.NeededAfter(nil, time.Duration(5)*time.Second) + } + // Set LateInitialized condition to True + lateInitConditionMessage = "Late initialization successful" + lateInitConditionReason = "Late initialization successful" + ackcondition.SetLateInitialized(lateInitializedRes, corev1.ConditionTrue, &lateInitConditionMessage, &lateInitConditionReason) + return lateInitializedRes, nil +} + +// incompleteLateInitialization return true if there are fields which were supposed to be +// late initialized but are not. If all the fields are late initialized, false is returned +func (rm *resourceManager) incompleteLateInitialization( + res acktypes.AWSResource, +) bool { + return false +} + +// lateInitializeFromReadOneOutput late initializes the 'latest' resource from the 'observed' +// resource and returns 'latest' resource +func (rm *resourceManager) lateInitializeFromReadOneOutput( + observed acktypes.AWSResource, + latest acktypes.AWSResource, +) acktypes.AWSResource { + return latest +} + +// newResourceManager returns a new struct implementing +// acktypes.AWSResourceManager +func newResourceManager( + cfg ackcfg.Config, + log logr.Logger, + metrics *ackmetrics.Metrics, + rr acktypes.Reconciler, + sess *session.Session, + id ackv1alpha1.AWSAccountID, + region ackv1alpha1.AWSRegion, +) (*resourceManager, error) { + return &resourceManager{ + cfg: cfg, + log: log, + metrics: metrics, + rr: rr, + awsAccountID: id, + awsRegion: region, + sess: sess, + sdkapi: svcsdk.New(sess), + }, nil +} + +// onError updates resource conditions and returns updated resource +// it returns nil if no condition is updated. +func (rm *resourceManager) onError( + r *resource, + err error, +) (acktypes.AWSResource, error) { + if r == nil { + return nil, err + } + r1, updated := rm.updateConditions(r, false, err) + if !updated { + return r, err + } + for _, condition := range r1.Conditions() { + if condition.Type == ackv1alpha1.ConditionTypeTerminal && + condition.Status == corev1.ConditionTrue { + // resource is in Terminal condition + // return Terminal error + return r1, ackerr.Terminal + } + } + return r1, err +} + +// onSuccess updates resource conditions and returns updated resource +// it returns the supplied resource if no condition is updated. +func (rm *resourceManager) onSuccess( + r *resource, +) (acktypes.AWSResource, error) { + if r == nil { + return nil, nil + } + r1, updated := rm.updateConditions(r, true, nil) + if !updated { + return r, nil + } + return r1, nil +} diff --git a/pkg/resource/transit_gateway/manager_factory.go b/pkg/resource/transit_gateway/manager_factory.go new file mode 100644 index 00000000..6e154e21 --- /dev/null +++ b/pkg/resource/transit_gateway/manager_factory.go @@ -0,0 +1,96 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. + +// Code generated by ack-generate. DO NOT EDIT. + +package transit_gateway + +import ( + "fmt" + "sync" + + ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" + ackcfg "github.com/aws-controllers-k8s/runtime/pkg/config" + ackmetrics "github.com/aws-controllers-k8s/runtime/pkg/metrics" + acktypes "github.com/aws-controllers-k8s/runtime/pkg/types" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/go-logr/logr" + + svcresource "github.com/aws-controllers-k8s/ec2-controller/pkg/resource" +) + +// resourceManagerFactory produces resourceManager objects. It implements the +// `types.AWSResourceManagerFactory` interface. +type resourceManagerFactory struct { + sync.RWMutex + // rmCache contains resource managers for a particular AWS account ID + rmCache map[string]*resourceManager +} + +// ResourcePrototype returns an AWSResource that resource managers produced by +// this factory will handle +func (f *resourceManagerFactory) ResourceDescriptor() acktypes.AWSResourceDescriptor { + return &resourceDescriptor{} +} + +// ManagerFor returns a resource manager object that can manage resources for a +// supplied AWS account +func (f *resourceManagerFactory) ManagerFor( + cfg ackcfg.Config, + log logr.Logger, + metrics *ackmetrics.Metrics, + rr acktypes.Reconciler, + sess *session.Session, + id ackv1alpha1.AWSAccountID, + region ackv1alpha1.AWSRegion, +) (acktypes.AWSResourceManager, error) { + rmId := fmt.Sprintf("%s/%s", id, region) + f.RLock() + rm, found := f.rmCache[rmId] + f.RUnlock() + + if found { + return rm, nil + } + + f.Lock() + defer f.Unlock() + + rm, err := newResourceManager(cfg, log, metrics, rr, sess, id, region) + if err != nil { + return nil, err + } + f.rmCache[rmId] = rm + return rm, nil +} + +// IsAdoptable returns true if the resource is able to be adopted +func (f *resourceManagerFactory) IsAdoptable() bool { + return true +} + +// RequeueOnSuccessSeconds returns true if the resource should be requeued after specified seconds +// Default is false which means resource will not be requeued after success. +func (f *resourceManagerFactory) RequeueOnSuccessSeconds() int { + return 0 +} + +func newResourceManagerFactory() *resourceManagerFactory { + return &resourceManagerFactory{ + rmCache: map[string]*resourceManager{}, + } +} + +func init() { + svcresource.RegisterManagerFactory(newResourceManagerFactory()) +} diff --git a/pkg/resource/transit_gateway/resource.go b/pkg/resource/transit_gateway/resource.go new file mode 100644 index 00000000..e3175d46 --- /dev/null +++ b/pkg/resource/transit_gateway/resource.go @@ -0,0 +1,107 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. + +// Code generated by ack-generate. DO NOT EDIT. + +package transit_gateway + +import ( + ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" + ackerrors "github.com/aws-controllers-k8s/runtime/pkg/errors" + acktypes "github.com/aws-controllers-k8s/runtime/pkg/types" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8srt "k8s.io/apimachinery/pkg/runtime" + + svcapitypes "github.com/aws-controllers-k8s/ec2-controller/apis/v1alpha1" +) + +// Hack to avoid import errors during build... +var ( + _ = &ackerrors.MissingNameIdentifier +) + +// resource implements the `aws-controller-k8s/runtime/pkg/types.AWSResource` +// interface +type resource struct { + // The Kubernetes-native CR representing the resource + ko *svcapitypes.TransitGateway +} + +// Identifiers returns an AWSResourceIdentifiers object containing various +// identifying information, including the AWS account ID that owns the +// resource, the resource's AWS Resource Name (ARN) +func (r *resource) Identifiers() acktypes.AWSResourceIdentifiers { + return &resourceIdentifiers{r.ko.Status.ACKResourceMetadata} +} + +// IsBeingDeleted returns true if the Kubernetes resource has a non-zero +// deletion timestemp +func (r *resource) IsBeingDeleted() bool { + return !r.ko.DeletionTimestamp.IsZero() +} + +// RuntimeObject returns the Kubernetes apimachinery/runtime representation of +// the AWSResource +func (r *resource) RuntimeObject() k8srt.Object { + return r.ko +} + +// MetaObject returns the Kubernetes apimachinery/apis/meta/v1.Object +// representation of the AWSResource +func (r *resource) MetaObject() metav1.Object { + return r.ko.GetObjectMeta() +} + +// RuntimeMetaObject returns an object that implements both the Kubernetes +// apimachinery/runtime.Object and the Kubernetes +// apimachinery/apis/meta/v1.Object interfaces +func (r *resource) RuntimeMetaObject() acktypes.RuntimeMetaObject { + return r.ko +} + +// Conditions returns the ACK Conditions collection for the AWSResource +func (r *resource) Conditions() []*ackv1alpha1.Condition { + return r.ko.Status.Conditions +} + +// ReplaceConditions sets the Conditions status field for the resource +func (r *resource) ReplaceConditions(conditions []*ackv1alpha1.Condition) { + r.ko.Status.Conditions = conditions +} + +// SetObjectMeta sets the ObjectMeta field for the resource +func (r *resource) SetObjectMeta(meta metav1.ObjectMeta) { + r.ko.ObjectMeta = meta +} + +// SetStatus will set the Status field for the resource +func (r *resource) SetStatus(desired acktypes.AWSResource) { + r.ko.Status = desired.(*resource).ko.Status +} + +// SetIdentifiers sets the Spec or Status field that is referenced as the unique +// resource identifier +func (r *resource) SetIdentifiers(identifier *ackv1alpha1.AWSIdentifiers) error { + if identifier.NameOrID == "" { + return ackerrors.MissingNameIdentifier + } + r.ko.Status.TransitGatewayID = &identifier.NameOrID + + return nil +} + +// DeepCopy will return a copy of the resource +func (r *resource) DeepCopy() acktypes.AWSResource { + koCopy := r.ko.DeepCopy() + return &resource{koCopy} +} diff --git a/pkg/resource/transit_gateway/sdk.go b/pkg/resource/transit_gateway/sdk.go new file mode 100644 index 00000000..662bae2b --- /dev/null +++ b/pkg/resource/transit_gateway/sdk.go @@ -0,0 +1,535 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. + +// Code generated by ack-generate. DO NOT EDIT. + +package transit_gateway + +import ( + "context" + "strings" + + ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" + ackcondition "github.com/aws-controllers-k8s/runtime/pkg/condition" + ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors" + ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" + "github.com/aws/aws-sdk-go/aws" + svcsdk "github.com/aws/aws-sdk-go/service/ec2" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + svcapitypes "github.com/aws-controllers-k8s/ec2-controller/apis/v1alpha1" +) + +// Hack to avoid import errors during build... +var ( + _ = &metav1.Time{} + _ = strings.ToLower("") + _ = &aws.JSONValue{} + _ = &svcsdk.EC2{} + _ = &svcapitypes.TransitGateway{} + _ = ackv1alpha1.AWSAccountID("") + _ = &ackerr.NotFound + _ = &ackcondition.NotManagedMessage +) + +// sdkFind returns SDK-specific information about a supplied resource +func (rm *resourceManager) sdkFind( + ctx context.Context, + r *resource, +) (latest *resource, err error) { + rlog := ackrtlog.FromContext(ctx) + exit := rlog.Trace("rm.sdkFind") + defer exit(err) + // If any required fields in the input shape are missing, AWS resource is + // not created yet. Return NotFound here to indicate to callers that the + // resource isn't yet created. + if rm.requiredFieldsMissingFromReadManyInput(r) { + return nil, ackerr.NotFound + } + + input, err := rm.newListRequestPayload(r) + if err != nil { + return nil, err + } + var resp *svcsdk.DescribeTransitGatewaysOutput + resp, err = rm.sdkapi.DescribeTransitGatewaysWithContext(ctx, input) + rm.metrics.RecordAPICall("READ_MANY", "DescribeTransitGateways", err) + if err != nil { + if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "UNKNOWN" { + return nil, ackerr.NotFound + } + return nil, err + } + + // Merge in the information we read from the API call above to the copy of + // the original Kubernetes object we passed to the function + ko := r.ko.DeepCopy() + + found := false + for _, elem := range resp.TransitGateways { + if elem.CreationTime != nil { + ko.Status.CreationTime = &metav1.Time{*elem.CreationTime} + } else { + ko.Status.CreationTime = nil + } + if elem.Description != nil { + ko.Spec.Description = elem.Description + } else { + ko.Spec.Description = nil + } + if elem.Options != nil { + f2 := &svcapitypes.TransitGatewayRequestOptions{} + if elem.Options.AmazonSideAsn != nil { + f2.AmazonSideASN = elem.Options.AmazonSideAsn + } + if elem.Options.AutoAcceptSharedAttachments != nil { + f2.AutoAcceptSharedAttachments = elem.Options.AutoAcceptSharedAttachments + } + if elem.Options.DefaultRouteTableAssociation != nil { + f2.DefaultRouteTableAssociation = elem.Options.DefaultRouteTableAssociation + } + if elem.Options.DefaultRouteTablePropagation != nil { + f2.DefaultRouteTablePropagation = elem.Options.DefaultRouteTablePropagation + } + if elem.Options.DnsSupport != nil { + f2.DNSSupport = elem.Options.DnsSupport + } + if elem.Options.MulticastSupport != nil { + f2.MulticastSupport = elem.Options.MulticastSupport + } + if elem.Options.TransitGatewayCidrBlocks != nil { + f2f8 := []*string{} + for _, f2f8iter := range elem.Options.TransitGatewayCidrBlocks { + var f2f8elem string + f2f8elem = *f2f8iter + f2f8 = append(f2f8, &f2f8elem) + } + f2.TransitGatewayCIDRBlocks = f2f8 + } + if elem.Options.VpnEcmpSupport != nil { + f2.VPNEcmpSupport = elem.Options.VpnEcmpSupport + } + ko.Spec.Options = f2 + } else { + ko.Spec.Options = nil + } + if elem.OwnerId != nil { + ko.Status.OwnerID = elem.OwnerId + } else { + ko.Status.OwnerID = nil + } + if elem.State != nil { + ko.Status.State = elem.State + } else { + ko.Status.State = nil + } + if elem.Tags != nil { + f5 := []*svcapitypes.Tag{} + for _, f5iter := range elem.Tags { + f5elem := &svcapitypes.Tag{} + if f5iter.Key != nil { + f5elem.Key = f5iter.Key + } + if f5iter.Value != nil { + f5elem.Value = f5iter.Value + } + f5 = append(f5, f5elem) + } + ko.Status.Tags = f5 + } else { + ko.Status.Tags = nil + } + if elem.TransitGatewayArn != nil { + if ko.Status.ACKResourceMetadata == nil { + ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{} + } + tmpARN := ackv1alpha1.AWSResourceName(*elem.TransitGatewayArn) + ko.Status.ACKResourceMetadata.ARN = &tmpARN + } + if elem.TransitGatewayId != nil { + ko.Status.TransitGatewayID = elem.TransitGatewayId + } else { + ko.Status.TransitGatewayID = nil + } + found = true + break + } + if !found { + return nil, ackerr.NotFound + } + + rm.setStatusDefaults(ko) + return &resource{ko}, nil +} + +// requiredFieldsMissingFromReadManyInput returns true if there are any fields +// for the ReadMany Input shape that are required but not present in the +// resource's Spec or Status +func (rm *resourceManager) requiredFieldsMissingFromReadManyInput( + r *resource, +) bool { + return r.ko.Status.TransitGatewayID == nil + +} + +// newListRequestPayload returns SDK-specific struct for the HTTP request +// payload of the List API call for the resource +func (rm *resourceManager) newListRequestPayload( + r *resource, +) (*svcsdk.DescribeTransitGatewaysInput, error) { + res := &svcsdk.DescribeTransitGatewaysInput{} + + if r.ko.Status.TransitGatewayID != nil { + f4 := []*string{} + f4 = append(f4, r.ko.Status.TransitGatewayID) + res.SetTransitGatewayIds(f4) + } + + return res, nil +} + +// sdkCreate creates the supplied resource in the backend AWS service API and +// returns a copy of the resource with resource fields (in both Spec and +// Status) filled in with values from the CREATE API operation's Output shape. +func (rm *resourceManager) sdkCreate( + ctx context.Context, + desired *resource, +) (created *resource, err error) { + rlog := ackrtlog.FromContext(ctx) + exit := rlog.Trace("rm.sdkCreate") + defer exit(err) + input, err := rm.newCreateRequestPayload(ctx, desired) + if err != nil { + return nil, err + } + + var resp *svcsdk.CreateTransitGatewayOutput + _ = resp + resp, err = rm.sdkapi.CreateTransitGatewayWithContext(ctx, input) + rm.metrics.RecordAPICall("CREATE", "CreateTransitGateway", err) + if err != nil { + return nil, err + } + // Merge in the information we read from the API call above to the copy of + // the original Kubernetes object we passed to the function + ko := desired.ko.DeepCopy() + + if resp.TransitGateway.CreationTime != nil { + ko.Status.CreationTime = &metav1.Time{*resp.TransitGateway.CreationTime} + } else { + ko.Status.CreationTime = nil + } + if resp.TransitGateway.Description != nil { + ko.Spec.Description = resp.TransitGateway.Description + } else { + ko.Spec.Description = nil + } + if resp.TransitGateway.Options != nil { + f2 := &svcapitypes.TransitGatewayRequestOptions{} + if resp.TransitGateway.Options.AmazonSideAsn != nil { + f2.AmazonSideASN = resp.TransitGateway.Options.AmazonSideAsn + } + if resp.TransitGateway.Options.AutoAcceptSharedAttachments != nil { + f2.AutoAcceptSharedAttachments = resp.TransitGateway.Options.AutoAcceptSharedAttachments + } + if resp.TransitGateway.Options.DefaultRouteTableAssociation != nil { + f2.DefaultRouteTableAssociation = resp.TransitGateway.Options.DefaultRouteTableAssociation + } + if resp.TransitGateway.Options.DefaultRouteTablePropagation != nil { + f2.DefaultRouteTablePropagation = resp.TransitGateway.Options.DefaultRouteTablePropagation + } + if resp.TransitGateway.Options.DnsSupport != nil { + f2.DNSSupport = resp.TransitGateway.Options.DnsSupport + } + if resp.TransitGateway.Options.MulticastSupport != nil { + f2.MulticastSupport = resp.TransitGateway.Options.MulticastSupport + } + if resp.TransitGateway.Options.TransitGatewayCidrBlocks != nil { + f2f8 := []*string{} + for _, f2f8iter := range resp.TransitGateway.Options.TransitGatewayCidrBlocks { + var f2f8elem string + f2f8elem = *f2f8iter + f2f8 = append(f2f8, &f2f8elem) + } + f2.TransitGatewayCIDRBlocks = f2f8 + } + if resp.TransitGateway.Options.VpnEcmpSupport != nil { + f2.VPNEcmpSupport = resp.TransitGateway.Options.VpnEcmpSupport + } + ko.Spec.Options = f2 + } else { + ko.Spec.Options = nil + } + if resp.TransitGateway.OwnerId != nil { + ko.Status.OwnerID = resp.TransitGateway.OwnerId + } else { + ko.Status.OwnerID = nil + } + if resp.TransitGateway.State != nil { + ko.Status.State = resp.TransitGateway.State + } else { + ko.Status.State = nil + } + if resp.TransitGateway.Tags != nil { + f5 := []*svcapitypes.Tag{} + for _, f5iter := range resp.TransitGateway.Tags { + f5elem := &svcapitypes.Tag{} + if f5iter.Key != nil { + f5elem.Key = f5iter.Key + } + if f5iter.Value != nil { + f5elem.Value = f5iter.Value + } + f5 = append(f5, f5elem) + } + ko.Status.Tags = f5 + } else { + ko.Status.Tags = nil + } + if ko.Status.ACKResourceMetadata == nil { + ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{} + } + if resp.TransitGateway.TransitGatewayArn != nil { + arn := ackv1alpha1.AWSResourceName(*resp.TransitGateway.TransitGatewayArn) + ko.Status.ACKResourceMetadata.ARN = &arn + } + if resp.TransitGateway.TransitGatewayId != nil { + ko.Status.TransitGatewayID = resp.TransitGateway.TransitGatewayId + } else { + ko.Status.TransitGatewayID = nil + } + + rm.setStatusDefaults(ko) + return &resource{ko}, nil +} + +// newCreateRequestPayload returns an SDK-specific struct for the HTTP request +// payload of the Create API call for the resource +func (rm *resourceManager) newCreateRequestPayload( + ctx context.Context, + r *resource, +) (*svcsdk.CreateTransitGatewayInput, error) { + res := &svcsdk.CreateTransitGatewayInput{} + + if r.ko.Spec.Description != nil { + res.SetDescription(*r.ko.Spec.Description) + } + if r.ko.Spec.Options != nil { + f1 := &svcsdk.TransitGatewayRequestOptions{} + if r.ko.Spec.Options.AmazonSideASN != nil { + f1.SetAmazonSideAsn(*r.ko.Spec.Options.AmazonSideASN) + } + if r.ko.Spec.Options.AutoAcceptSharedAttachments != nil { + f1.SetAutoAcceptSharedAttachments(*r.ko.Spec.Options.AutoAcceptSharedAttachments) + } + if r.ko.Spec.Options.DefaultRouteTableAssociation != nil { + f1.SetDefaultRouteTableAssociation(*r.ko.Spec.Options.DefaultRouteTableAssociation) + } + if r.ko.Spec.Options.DefaultRouteTablePropagation != nil { + f1.SetDefaultRouteTablePropagation(*r.ko.Spec.Options.DefaultRouteTablePropagation) + } + if r.ko.Spec.Options.DNSSupport != nil { + f1.SetDnsSupport(*r.ko.Spec.Options.DNSSupport) + } + if r.ko.Spec.Options.MulticastSupport != nil { + f1.SetMulticastSupport(*r.ko.Spec.Options.MulticastSupport) + } + if r.ko.Spec.Options.TransitGatewayCIDRBlocks != nil { + f1f6 := []*string{} + for _, f1f6iter := range r.ko.Spec.Options.TransitGatewayCIDRBlocks { + var f1f6elem string + f1f6elem = *f1f6iter + f1f6 = append(f1f6, &f1f6elem) + } + f1.SetTransitGatewayCidrBlocks(f1f6) + } + if r.ko.Spec.Options.VPNEcmpSupport != nil { + f1.SetVpnEcmpSupport(*r.ko.Spec.Options.VPNEcmpSupport) + } + res.SetOptions(f1) + } + if r.ko.Spec.TagSpecifications != nil { + f2 := []*svcsdk.TagSpecification{} + for _, f2iter := range r.ko.Spec.TagSpecifications { + f2elem := &svcsdk.TagSpecification{} + if f2iter.ResourceType != nil { + f2elem.SetResourceType(*f2iter.ResourceType) + } + if f2iter.Tags != nil { + f2elemf1 := []*svcsdk.Tag{} + for _, f2elemf1iter := range f2iter.Tags { + f2elemf1elem := &svcsdk.Tag{} + if f2elemf1iter.Key != nil { + f2elemf1elem.SetKey(*f2elemf1iter.Key) + } + if f2elemf1iter.Value != nil { + f2elemf1elem.SetValue(*f2elemf1iter.Value) + } + f2elemf1 = append(f2elemf1, f2elemf1elem) + } + f2elem.SetTags(f2elemf1) + } + f2 = append(f2, f2elem) + } + res.SetTagSpecifications(f2) + } + + return res, nil +} + +// sdkUpdate patches the supplied resource in the backend AWS service API and +// returns a new resource with updated fields. +func (rm *resourceManager) sdkUpdate( + ctx context.Context, + desired *resource, + latest *resource, + delta *ackcompare.Delta, +) (*resource, error) { + // TODO(jaypipes): Figure this out... + return nil, ackerr.NotImplemented +} + +// sdkDelete deletes the supplied resource in the backend AWS service API +func (rm *resourceManager) sdkDelete( + ctx context.Context, + r *resource, +) (latest *resource, err error) { + rlog := ackrtlog.FromContext(ctx) + exit := rlog.Trace("rm.sdkDelete") + defer exit(err) + input, err := rm.newDeleteRequestPayload(r) + if err != nil { + return nil, err + } + var resp *svcsdk.DeleteTransitGatewayOutput + _ = resp + resp, err = rm.sdkapi.DeleteTransitGatewayWithContext(ctx, input) + rm.metrics.RecordAPICall("DELETE", "DeleteTransitGateway", err) + return nil, err +} + +// newDeleteRequestPayload returns an SDK-specific struct for the HTTP request +// payload of the Delete API call for the resource +func (rm *resourceManager) newDeleteRequestPayload( + r *resource, +) (*svcsdk.DeleteTransitGatewayInput, error) { + res := &svcsdk.DeleteTransitGatewayInput{} + + if r.ko.Status.TransitGatewayID != nil { + res.SetTransitGatewayId(*r.ko.Status.TransitGatewayID) + } + + return res, nil +} + +// setStatusDefaults sets default properties into supplied custom resource +func (rm *resourceManager) setStatusDefaults( + ko *svcapitypes.TransitGateway, +) { + if ko.Status.ACKResourceMetadata == nil { + ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{} + } + if ko.Status.ACKResourceMetadata.OwnerAccountID == nil { + ko.Status.ACKResourceMetadata.OwnerAccountID = &rm.awsAccountID + } + if ko.Status.Conditions == nil { + ko.Status.Conditions = []*ackv1alpha1.Condition{} + } +} + +// updateConditions returns updated resource, true; if conditions were updated +// else it returns nil, false +func (rm *resourceManager) updateConditions( + r *resource, + onSuccess bool, + err error, +) (*resource, bool) { + ko := r.ko.DeepCopy() + rm.setStatusDefaults(ko) + + // Terminal condition + var terminalCondition *ackv1alpha1.Condition = nil + var recoverableCondition *ackv1alpha1.Condition = nil + var syncCondition *ackv1alpha1.Condition = nil + for _, condition := range ko.Status.Conditions { + if condition.Type == ackv1alpha1.ConditionTypeTerminal { + terminalCondition = condition + } + if condition.Type == ackv1alpha1.ConditionTypeRecoverable { + recoverableCondition = condition + } + if condition.Type == ackv1alpha1.ConditionTypeResourceSynced { + syncCondition = condition + } + } + + if rm.terminalAWSError(err) || err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound { + if terminalCondition == nil { + terminalCondition = &ackv1alpha1.Condition{ + Type: ackv1alpha1.ConditionTypeTerminal, + } + ko.Status.Conditions = append(ko.Status.Conditions, terminalCondition) + } + var errorMessage = "" + if err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound { + errorMessage = err.Error() + } else { + awsErr, _ := ackerr.AWSError(err) + errorMessage = awsErr.Error() + } + terminalCondition.Status = corev1.ConditionTrue + terminalCondition.Message = &errorMessage + } else { + // Clear the terminal condition if no longer present + if terminalCondition != nil { + terminalCondition.Status = corev1.ConditionFalse + terminalCondition.Message = nil + } + // Handling Recoverable Conditions + if err != nil { + if recoverableCondition == nil { + // Add a new Condition containing a non-terminal error + recoverableCondition = &ackv1alpha1.Condition{ + Type: ackv1alpha1.ConditionTypeRecoverable, + } + ko.Status.Conditions = append(ko.Status.Conditions, recoverableCondition) + } + recoverableCondition.Status = corev1.ConditionTrue + awsErr, _ := ackerr.AWSError(err) + errorMessage := err.Error() + if awsErr != nil { + errorMessage = awsErr.Error() + } + recoverableCondition.Message = &errorMessage + } else if recoverableCondition != nil { + recoverableCondition.Status = corev1.ConditionFalse + recoverableCondition.Message = nil + } + } + // Required to avoid the "declared but not used" error in the default case + _ = syncCondition + if terminalCondition != nil || recoverableCondition != nil || syncCondition != nil { + return &resource{ko}, true // updated + } + return nil, false // not updated +} + +// terminalAWSError returns awserr, true; if the supplied error is an aws Error type +// and if the exception indicates that it is a Terminal exception +// 'Terminal' exception are specified in generator configuration +func (rm *resourceManager) terminalAWSError(err error) bool { + // No terminal_errors specified for this resource in generator config + return false +} diff --git a/test/e2e/resources/transitgateway.yaml b/test/e2e/resources/transitgateway.yaml new file mode 100644 index 00000000..80a8cb98 --- /dev/null +++ b/test/e2e/resources/transitgateway.yaml @@ -0,0 +1,5 @@ +apiVersion: ec2.services.k8s.aws/v1alpha1 +kind: TransitGateway +metadata: + name: $TGW_NAME +spec: {} \ No newline at end of file diff --git a/test/e2e/tests/test_transit_gateway.py b/test/e2e/tests/test_transit_gateway.py new file mode 100644 index 00000000..93cda4ca --- /dev/null +++ b/test/e2e/tests/test_transit_gateway.py @@ -0,0 +1,98 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + +"""Integration tests for the Transit Gateway API. +""" + +import boto3 +import pytest +import time +import logging + +from acktest.resources import random_suffix_name +from acktest.k8s import resource as k8s +from e2e import service_marker, CRD_GROUP, CRD_VERSION, load_ec2_resource +from e2e.replacement_values import REPLACEMENT_VALUES + +RESOURCE_PLURAL = "transitgateways" + +CREATE_WAIT_AFTER_SECONDS = 60 +DELETE_WAIT_AFTER_SECONDS = 30 + +@pytest.fixture(scope="module") +def ec2_client(): + return boto3.client("ec2") + + +def get_tgw(ec2_client, tgw_id: str) -> dict: + try: + resp = ec2_client.describe_transit_gateways( + TransitGatewayIds=[tgw_id] + ) + except Exception as e: + logging.debug(e) + return None + + if len(resp["TransitGateways"]) == 0: + return None + return resp["TransitGateways"][0] + + +def tgw_exists(ec2_client, tgw_id: str) -> bool: + tgw = get_tgw(ec2_client, tgw_id) + return tgw is not None and tgw['State'] != "deleting" and tgw['State'] != "deleted" + +@service_marker +@pytest.mark.canary +class TestTGW: + def test_create_delete(self, ec2_client): + resource_name = random_suffix_name("tgw-ack-test", 24) + replacements = REPLACEMENT_VALUES.copy() + replacements["TGW_NAME"] = resource_name + + # Load TGW CR + resource_data = load_ec2_resource( + "transitgateway", + additional_replacements=replacements, + ) + logging.debug(resource_data) + + # Create k8s resource + ref = k8s.CustomResourceReference( + CRD_GROUP, CRD_VERSION, RESOURCE_PLURAL, + resource_name, namespace="default", + ) + k8s.create_custom_resource(ref, resource_data) + cr = k8s.wait_resource_consumed_by_controller(ref) + + assert cr is not None + assert k8s.get_resource_exists(ref) + + resource = k8s.get_resource(ref) + resource_id = resource["status"]["transitGatewayID"] + + time.sleep(CREATE_WAIT_AFTER_SECONDS) + + # Check TGW exists + exists = tgw_exists(ec2_client, resource_id) + assert exists + + # Delete k8s resource + _, deleted = k8s.delete_custom_resource(ref, 2, 5) + assert deleted is True + + time.sleep(DELETE_WAIT_AFTER_SECONDS) + + # Check TGW doesn't exist + exists = tgw_exists(ec2_client, resource_id) + assert not exists \ No newline at end of file From ec1129b2f7a624a610a1f5bc389674dda276e00e Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 18 Oct 2021 18:41:27 -0500 Subject: [PATCH 4/7] up the timeouts --- test/e2e/tests/test_transit_gateway.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/tests/test_transit_gateway.py b/test/e2e/tests/test_transit_gateway.py index 93cda4ca..2ef3acd4 100644 --- a/test/e2e/tests/test_transit_gateway.py +++ b/test/e2e/tests/test_transit_gateway.py @@ -26,8 +26,8 @@ RESOURCE_PLURAL = "transitgateways" -CREATE_WAIT_AFTER_SECONDS = 60 -DELETE_WAIT_AFTER_SECONDS = 30 +CREATE_WAIT_AFTER_SECONDS = 90 +DELETE_WAIT_AFTER_SECONDS = 60 @pytest.fixture(scope="module") def ec2_client(): From d633e96837ba157a28bfed8ddc7739500012eb5d Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 19 Oct 2021 10:59:01 -0500 Subject: [PATCH 5/7] updates --- test/e2e/tests/test_transit_gateway.py | 4 +++- test/e2e/tests/test_vpc_endpoint.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/e2e/tests/test_transit_gateway.py b/test/e2e/tests/test_transit_gateway.py index 2ef3acd4..0688619f 100644 --- a/test/e2e/tests/test_transit_gateway.py +++ b/test/e2e/tests/test_transit_gateway.py @@ -26,8 +26,10 @@ RESOURCE_PLURAL = "transitgateways" +## The long delete wait is required to make sure the TGW can transition out of its "pending" status. +## TGWs are unable to be deleted while in "pending" CREATE_WAIT_AFTER_SECONDS = 90 -DELETE_WAIT_AFTER_SECONDS = 60 +DELETE_WAIT_AFTER_SECONDS = 10 @pytest.fixture(scope="module") def ec2_client(): diff --git a/test/e2e/tests/test_vpc_endpoint.py b/test/e2e/tests/test_vpc_endpoint.py index 127f9213..938df9bb 100644 --- a/test/e2e/tests/test_vpc_endpoint.py +++ b/test/e2e/tests/test_vpc_endpoint.py @@ -14,6 +14,7 @@ """Integration tests for the Vpc Endpoint API. """ +from os import environ import pytest import time import logging @@ -24,8 +25,10 @@ from e2e.replacement_values import REPLACEMENT_VALUES from e2e.bootstrap_resources import get_bootstrap_resources +# Default to us-west-2 since that's where prow is deployed +REGION = "us-west-2" if environ.get('AWS_DEFAULT_REGION') is None else environ.get('AWS_DEFAULT_REGION') RESOURCE_PLURAL = "vpcendpoints" -ENDPOINT_SERVICE_NAME = "com.amazonaws.us-west-2.s3" +ENDPOINT_SERVICE_NAME = "com.amazonaws.%s.s3" % REGION CREATE_WAIT_AFTER_SECONDS = 10 DELETE_WAIT_AFTER_SECONDS = 10 From eaa46d87fb81f49c00f623f200d37c87321ebc30 Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 19 Oct 2021 16:54:38 -0500 Subject: [PATCH 6/7] generate again for ECMP --- apis/v1alpha1/ack-generate-metadata.yaml | 10 ++-- apis/v1alpha1/enums.go | 6 +-- apis/v1alpha1/types.go | 6 +-- apis/v1alpha1/zz_generated.deepcopy.go | 12 ++--- .../ec2.services.k8s.aws_transitgateways.yaml | 2 +- .../ec2.services.k8s.aws_transitgateways.yaml | 2 +- pkg/resource/transit_gateway/delta.go | 10 ++-- pkg/resource/transit_gateway/sdk.go | 8 ++-- pkg/resource/vpc_endpoint/sdk.go | 46 +++++++++++++++++-- 9 files changed, 71 insertions(+), 31 deletions(-) diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index dcbdfb32..c3037155 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2021-10-18T19:14:45Z" - build_hash: 21ee1672e2c1556fd5784a22bc48aa619975cc6f - go_version: go1.17 + build_date: "2021-10-19T21:53:53Z" + build_hash: 7dd0760fcd1cc03646423fb58b1bba773c795dfb + go_version: go1.16.6 version: v0.15.1 -api_directory_checksum: 0f150b1176d3ba9246acb726466358f2877b24a8 +api_directory_checksum: bd9d20204d6c7aec274c9d3c6dc6da2b264670c1 api_version: v1alpha1 aws_sdk_go_version: v1.37.10 generator_config_info: - file_checksum: af6d95e7cd2066fe11752abd324daf8e051be09f + file_checksum: c47b31195e00afb6637d63b44560fb2b82245978 original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/enums.go b/apis/v1alpha1/enums.go index c18a7af2..bd622c66 100644 --- a/apis/v1alpha1/enums.go +++ b/apis/v1alpha1/enums.go @@ -2148,11 +2148,11 @@ const ( VPCTenancy_default VPCTenancy = "default" ) -type VPNEcmpSupportValue string +type VPNECMPSupportValue string const ( - VPNEcmpSupportValue_enable VPNEcmpSupportValue = "enable" - VPNEcmpSupportValue_disable VPNEcmpSupportValue = "disable" + VPNECMPSupportValue_enable VPNECMPSupportValue = "enable" + VPNECMPSupportValue_disable VPNECMPSupportValue = "disable" ) type VPNProtocol string diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index 1d177353..ce21b740 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -1824,7 +1824,7 @@ type ModifyTransitGatewayOptions struct { DefaultRouteTablePropagation *string `json:"defaultRouteTablePropagation,omitempty"` DNSSupport *string `json:"dnsSupport,omitempty"` RemoveTransitGatewayCIDRBlocks []*string `json:"removeTransitGatewayCIDRBlocks,omitempty"` - VPNEcmpSupport *string `json:"vpnEcmpSupport,omitempty"` + VPNECMPSupport *string `json:"vpnECMPSupport,omitempty"` } // Describes the options for a VPC attachment. @@ -3171,7 +3171,7 @@ type TransitGatewayOptions struct { MulticastSupport *string `json:"multicastSupport,omitempty"` PropagationDefaultRouteTableID *string `json:"propagationDefaultRouteTableID,omitempty"` TransitGatewayCIDRBlocks []*string `json:"transitGatewayCIDRBlocks,omitempty"` - VPNEcmpSupport *string `json:"vpnEcmpSupport,omitempty"` + VPNECMPSupport *string `json:"vpnECMPSupport,omitempty"` } // Describes the transit gateway peering attachment. @@ -3207,7 +3207,7 @@ type TransitGatewayRequestOptions struct { DNSSupport *string `json:"dnsSupport,omitempty"` MulticastSupport *string `json:"multicastSupport,omitempty"` TransitGatewayCIDRBlocks []*string `json:"transitGatewayCIDRBlocks,omitempty"` - VPNEcmpSupport *string `json:"vpnEcmpSupport,omitempty"` + VPNECMPSupport *string `json:"vpnECMPSupport,omitempty"` } // Describes a route for a transit gateway route table. diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 5e68e19d..e3485e18 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -7804,8 +7804,8 @@ func (in *ModifyTransitGatewayOptions) DeepCopyInto(out *ModifyTransitGatewayOpt } } } - if in.VPNEcmpSupport != nil { - in, out := &in.VPNEcmpSupport, &out.VPNEcmpSupport + if in.VPNECMPSupport != nil { + in, out := &in.VPNECMPSupport, &out.VPNECMPSupport *out = new(string) **out = **in } @@ -14115,8 +14115,8 @@ func (in *TransitGatewayOptions) DeepCopyInto(out *TransitGatewayOptions) { } } } - if in.VPNEcmpSupport != nil { - in, out := &in.VPNEcmpSupport, &out.VPNEcmpSupport + if in.VPNECMPSupport != nil { + in, out := &in.VPNECMPSupport, &out.VPNECMPSupport *out = new(string) **out = **in } @@ -14281,8 +14281,8 @@ func (in *TransitGatewayRequestOptions) DeepCopyInto(out *TransitGatewayRequestO } } } - if in.VPNEcmpSupport != nil { - in, out := &in.VPNEcmpSupport, &out.VPNEcmpSupport + if in.VPNECMPSupport != nil { + in, out := &in.VPNECMPSupport, &out.VPNECMPSupport *out = new(string) **out = **in } diff --git a/config/crd/bases/ec2.services.k8s.aws_transitgateways.yaml b/config/crd/bases/ec2.services.k8s.aws_transitgateways.yaml index cce35a1e..f78bdaab 100644 --- a/config/crd/bases/ec2.services.k8s.aws_transitgateways.yaml +++ b/config/crd/bases/ec2.services.k8s.aws_transitgateways.yaml @@ -60,7 +60,7 @@ spec: items: type: string type: array - vpnEcmpSupport: + vpnECMPSupport: type: string type: object tagSpecifications: diff --git a/helm/crds/ec2.services.k8s.aws_transitgateways.yaml b/helm/crds/ec2.services.k8s.aws_transitgateways.yaml index cce35a1e..f78bdaab 100644 --- a/helm/crds/ec2.services.k8s.aws_transitgateways.yaml +++ b/helm/crds/ec2.services.k8s.aws_transitgateways.yaml @@ -60,7 +60,7 @@ spec: items: type: string type: array - vpnEcmpSupport: + vpnECMPSupport: type: string type: object tagSpecifications: diff --git a/pkg/resource/transit_gateway/delta.go b/pkg/resource/transit_gateway/delta.go index 925ae154..b7981fe0 100644 --- a/pkg/resource/transit_gateway/delta.go +++ b/pkg/resource/transit_gateway/delta.go @@ -96,11 +96,11 @@ func newResourceDelta( if !ackcompare.SliceStringPEqual(a.ko.Spec.Options.TransitGatewayCIDRBlocks, b.ko.Spec.Options.TransitGatewayCIDRBlocks) { delta.Add("Spec.Options.TransitGatewayCIDRBlocks", a.ko.Spec.Options.TransitGatewayCIDRBlocks, b.ko.Spec.Options.TransitGatewayCIDRBlocks) } - if ackcompare.HasNilDifference(a.ko.Spec.Options.VPNEcmpSupport, b.ko.Spec.Options.VPNEcmpSupport) { - delta.Add("Spec.Options.VPNEcmpSupport", a.ko.Spec.Options.VPNEcmpSupport, b.ko.Spec.Options.VPNEcmpSupport) - } else if a.ko.Spec.Options.VPNEcmpSupport != nil && b.ko.Spec.Options.VPNEcmpSupport != nil { - if *a.ko.Spec.Options.VPNEcmpSupport != *b.ko.Spec.Options.VPNEcmpSupport { - delta.Add("Spec.Options.VPNEcmpSupport", a.ko.Spec.Options.VPNEcmpSupport, b.ko.Spec.Options.VPNEcmpSupport) + if ackcompare.HasNilDifference(a.ko.Spec.Options.VPNECMPSupport, b.ko.Spec.Options.VPNECMPSupport) { + delta.Add("Spec.Options.VPNECMPSupport", a.ko.Spec.Options.VPNECMPSupport, b.ko.Spec.Options.VPNECMPSupport) + } else if a.ko.Spec.Options.VPNECMPSupport != nil && b.ko.Spec.Options.VPNECMPSupport != nil { + if *a.ko.Spec.Options.VPNECMPSupport != *b.ko.Spec.Options.VPNECMPSupport { + delta.Add("Spec.Options.VPNECMPSupport", a.ko.Spec.Options.VPNECMPSupport, b.ko.Spec.Options.VPNECMPSupport) } } } diff --git a/pkg/resource/transit_gateway/sdk.go b/pkg/resource/transit_gateway/sdk.go index 662bae2b..7a0c6c6f 100644 --- a/pkg/resource/transit_gateway/sdk.go +++ b/pkg/resource/transit_gateway/sdk.go @@ -119,7 +119,7 @@ func (rm *resourceManager) sdkFind( f2.TransitGatewayCIDRBlocks = f2f8 } if elem.Options.VpnEcmpSupport != nil { - f2.VPNEcmpSupport = elem.Options.VpnEcmpSupport + f2.VPNECMPSupport = elem.Options.VpnEcmpSupport } ko.Spec.Options = f2 } else { @@ -266,7 +266,7 @@ func (rm *resourceManager) sdkCreate( f2.TransitGatewayCIDRBlocks = f2f8 } if resp.TransitGateway.Options.VpnEcmpSupport != nil { - f2.VPNEcmpSupport = resp.TransitGateway.Options.VpnEcmpSupport + f2.VPNECMPSupport = resp.TransitGateway.Options.VpnEcmpSupport } ko.Spec.Options = f2 } else { @@ -355,8 +355,8 @@ func (rm *resourceManager) newCreateRequestPayload( } f1.SetTransitGatewayCidrBlocks(f1f6) } - if r.ko.Spec.Options.VPNEcmpSupport != nil { - f1.SetVpnEcmpSupport(*r.ko.Spec.Options.VPNEcmpSupport) + if r.ko.Spec.Options.VPNECMPSupport != nil { + f1.SetVpnEcmpSupport(*r.ko.Spec.Options.VPNECMPSupport) } res.SetOptions(f1) } diff --git a/pkg/resource/vpc_endpoint/sdk.go b/pkg/resource/vpc_endpoint/sdk.go index 0f247770..2be93bdf 100644 --- a/pkg/resource/vpc_endpoint/sdk.go +++ b/pkg/resource/vpc_endpoint/sdk.go @@ -522,9 +522,49 @@ func (rm *resourceManager) sdkUpdate( desired *resource, latest *resource, delta *ackcompare.Delta, -) (*resource, error) { - // TODO(jaypipes): Figure this out... - return nil, ackerr.NotImplemented +) (updated *resource, err error) { + rlog := ackrtlog.FromContext(ctx) + exit := rlog.Trace("rm.sdkUpdate") + defer exit(err) + input, err := rm.newUpdateRequestPayload(ctx, desired) + if err != nil { + return nil, err + } + + var resp *svcsdk.ModifyVpcEndpointOutput + _ = resp + resp, err = rm.sdkapi.ModifyVpcEndpointWithContext(ctx, input) + rm.metrics.RecordAPICall("UPDATE", "ModifyVpcEndpoint", err) + if err != nil { + return nil, err + } + // Merge in the information we read from the API call above to the copy of + // the original Kubernetes object we passed to the function + ko := desired.ko.DeepCopy() + + rm.setStatusDefaults(ko) + return &resource{ko}, nil +} + +// newUpdateRequestPayload returns an SDK-specific struct for the HTTP request +// payload of the Update API call for the resource +func (rm *resourceManager) newUpdateRequestPayload( + ctx context.Context, + r *resource, +) (*svcsdk.ModifyVpcEndpointInput, error) { + res := &svcsdk.ModifyVpcEndpointInput{} + + if r.ko.Spec.PolicyDocument != nil { + res.SetPolicyDocument(*r.ko.Spec.PolicyDocument) + } + if r.ko.Spec.PrivateDNSEnabled != nil { + res.SetPrivateDnsEnabled(*r.ko.Spec.PrivateDNSEnabled) + } + if r.ko.Status.VPCEndpointID != nil { + res.SetVpcEndpointId(*r.ko.Status.VPCEndpointID) + } + + return res, nil } // sdkDelete deletes the supplied resource in the backend AWS service API From ebc002932dd5bd41cac031ab76e5b6dcf0b22d6e Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 19 Oct 2021 18:23:13 -0500 Subject: [PATCH 7/7] regenerate w/ ENA as initialism --- apis/v1alpha1/ack-generate-metadata.yaml | 6 +++--- apis/v1alpha1/enums.go | 16 ++++++++-------- apis/v1alpha1/types.go | 4 ++-- apis/v1alpha1/zz_generated.deepcopy.go | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index c3037155..ac18934f 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,9 +1,9 @@ ack_generate_info: - build_date: "2021-10-19T21:53:53Z" - build_hash: 7dd0760fcd1cc03646423fb58b1bba773c795dfb + build_date: "2021-10-19T23:05:01Z" + build_hash: 7c6fc8daae2b1eddf00bfe9da797e6c5aab0ce7d go_version: go1.16.6 version: v0.15.1 -api_directory_checksum: bd9d20204d6c7aec274c9d3c6dc6da2b264670c1 +api_directory_checksum: ec534cc9172badabfaf6976400bb79a3d4e66c5d api_version: v1alpha1 aws_sdk_go_version: v1.37.10 generator_config_info: diff --git a/apis/v1alpha1/enums.go b/apis/v1alpha1/enums.go index bd622c66..7fa73436 100644 --- a/apis/v1alpha1/enums.go +++ b/apis/v1alpha1/enums.go @@ -486,6 +486,14 @@ const ( EBSOptimizedSupport_default EBSOptimizedSupport = "default" ) +type ENASupport string + +const ( + ENASupport_unsupported ENASupport = "unsupported" + ENASupport_supported ENASupport = "supported" + ENASupport_required ENASupport = "required" +) + type ElasticGPUState string const ( @@ -499,14 +507,6 @@ const ( ElasticGPUStatus_IMPAIRED ElasticGPUStatus = "IMPAIRED" ) -type EnaSupport string - -const ( - EnaSupport_unsupported EnaSupport = "unsupported" - EnaSupport_supported EnaSupport = "supported" - EnaSupport_required EnaSupport = "required" -) - type EndDateType string const ( diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index ce21b740..84f39363 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -1153,7 +1153,7 @@ type IPv6Range struct { type Image struct { CreationDate *string `json:"creationDate,omitempty"` Description *string `json:"description,omitempty"` - EnaSupport *bool `json:"enaSupport,omitempty"` + ENASupport *bool `json:"enaSupport,omitempty"` ImageID *string `json:"imageID,omitempty"` ImageLocation *string `json:"imageLocation,omitempty"` ImageOwnerAlias *string `json:"imageOwnerAlias,omitempty"` @@ -1247,7 +1247,7 @@ type Instance struct { CapacityReservationID *string `json:"capacityReservationID,omitempty"` ClientToken *string `json:"clientToken,omitempty"` EBSOptimized *bool `json:"ebsOptimized,omitempty"` - EnaSupport *bool `json:"enaSupport,omitempty"` + ENASupport *bool `json:"enaSupport,omitempty"` ImageID *string `json:"imageID,omitempty"` InstanceID *string `json:"instanceID,omitempty"` KernelID *string `json:"kernelID,omitempty"` diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index e3485e18..8011b60d 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -4697,8 +4697,8 @@ func (in *Image) DeepCopyInto(out *Image) { *out = new(string) **out = **in } - if in.EnaSupport != nil { - in, out := &in.EnaSupport, &out.EnaSupport + if in.ENASupport != nil { + in, out := &in.ENASupport, &out.ENASupport *out = new(bool) **out = **in } @@ -5135,8 +5135,8 @@ func (in *Instance) DeepCopyInto(out *Instance) { *out = new(bool) **out = **in } - if in.EnaSupport != nil { - in, out := &in.EnaSupport, &out.EnaSupport + if in.ENASupport != nil { + in, out := &in.ENASupport, &out.ENASupport *out = new(bool) **out = **in }