From 353c0924c55e1667232c1589ec192b3edb30c445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Mon, 16 Aug 2021 15:53:59 -0500 Subject: [PATCH 01/10] generate subnet resource --- apis/v1alpha1/ack-generate-metadata.yaml | 28 +- apis/v1alpha1/generator.yaml | 3 +- apis/v1alpha1/subnet.go | 133 ++ apis/v1alpha1/types.go | 509 ++++-- apis/v1alpha1/zz_generated.deepcopy.go | 1562 ++++++++++++++++- cmd/controller/main.go | 1 + .../bases/ec2.services.k8s.aws_subnets.yaml | 234 +++ config/crd/kustomization.yaml | 1 + config/rbac/cluster-role-controller.yaml | 20 + config/rbac/role-reader.yaml | 1 + config/rbac/role-writer.yaml | 2 + generator.yaml | 3 +- pkg/resource/subnet/delta.go | 80 + pkg/resource/subnet/descriptor.go | 153 ++ pkg/resource/subnet/identifiers.go | 46 + pkg/resource/subnet/manager.go | 289 +++ pkg/resource/subnet/manager_factory.go | 96 + pkg/resource/subnet/resource.go | 100 ++ pkg/resource/subnet/sdk.go | 561 ++++++ 19 files changed, 3658 insertions(+), 164 deletions(-) create mode 100644 apis/v1alpha1/subnet.go create mode 100644 config/crd/bases/ec2.services.k8s.aws_subnets.yaml create mode 100644 pkg/resource/subnet/delta.go create mode 100644 pkg/resource/subnet/descriptor.go create mode 100644 pkg/resource/subnet/identifiers.go create mode 100644 pkg/resource/subnet/manager.go create mode 100644 pkg/resource/subnet/manager_factory.go create mode 100644 pkg/resource/subnet/resource.go create mode 100644 pkg/resource/subnet/sdk.go diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 213b635e..1f75117d 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,14 +1,38 @@ ack_generate_info: +<<<<<<< HEAD build_date: "2021-08-16T20:38:40Z" +======= +<<<<<<< HEAD +<<<<<<< HEAD + build_date: "2021-08-16T20:38:40Z" +======= + build_date: "2021-08-16T20:49:09Z" +>>>>>>> ec049ca (regen vpc with 0.10.0) +======= + build_date: "2021-08-16T20:50:58Z" +>>>>>>> cc7c4b2 (generate subnet resource) +>>>>>>> 5dec341 (generate subnet resource) build_hash: afa7fe00dae2c7404018e98c13130a01b6643d1d go_version: go1.16.6 darwin/amd64 version: v0.10.0 -api_directory_checksum: d84b2e29cfafbcd249dab46daa7972a32fe9c446 +api_directory_checksum: 7f0fe6c5c959e20c5eb4ccef47e456622eeb24f3 api_version: v1alpha1 aws_sdk_go_version: v1.37.10 generator_config_info: - file_checksum: 33f4857c10945c0b2612675fc5657588633478e7 + file_checksum: 4b048f807c7151379f0b09f26ddc40b101b8e6fd original_file_name: generator.yaml last_modification: reason: API generation +<<<<<<< HEAD + timestamp: 2021-08-16 20:38:50.308741 +0000 UTC +======= +<<<<<<< HEAD +<<<<<<< HEAD timestamp: 2021-08-16 20:38:50.308741 +0000 UTC +======= + timestamp: 2021-08-16 20:49:17.748573 +0000 UTC +>>>>>>> ec049ca (regen vpc with 0.10.0) +======= + timestamp: 2021-08-16 20:51:07.853927 +0000 UTC +>>>>>>> cc7c4b2 (generate subnet resource) +>>>>>>> 5dec341 (generate subnet resource) diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index 3c3e531f..7866b532 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -1,6 +1,7 @@ ignore: field_paths: - CreateVpcInput.DryRun + - CreateSubnetInput.DryRun resource_names: - AccountAttribute - CapacityReservation @@ -36,7 +37,7 @@ ignore: - SecurityGroup - Snapshot - SpotDatafeedSubscription - - Subnet + #- Subnet - TrafficMirrorFilterRule - TrafficMirrorFilter - TrafficMirrorSession diff --git a/apis/v1alpha1/subnet.go b/apis/v1alpha1/subnet.go new file mode 100644 index 00000000..79876f80 --- /dev/null +++ b/apis/v1alpha1/subnet.go @@ -0,0 +1,133 @@ +// 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" +) + +// SubnetSpec defines the desired state of Subnet. +// +// Describes a subnet. +type SubnetSpec struct { + // The Availability Zone or Local Zone for the subnet. + // + // Default: AWS selects one for you. If you create more than one subnet in your + // VPC, we do not necessarily select a different zone for each subnet. + // + // To create a subnet in a Local Zone, set this value to the Local Zone ID, + // for example us-west-2-lax-1a. For information about the Regions that support + // Local Zones, see Available Regions (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions) + // in the Amazon Elastic Compute Cloud User Guide. + // + // To create a subnet in an Outpost, set this value to the Availability Zone + // for the Outpost and specify the Outpost ARN. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // The AZ ID or the Local Zone ID of the subnet. + AvailabilityZoneID *string `json:"availabilityZoneID,omitempty"` + // The IPv4 network range for the subnet, in CIDR notation. For example, 10.0.0.0/24. + // We modify the specified CIDR block to its canonical form; for example, if + // you specify 100.68.0.18/18, we modify it to 100.68.0.0/18. + // +kubebuilder:validation:Required + CIDRBlock *string `json:"cidrBlock"` + // The IPv6 network range for the subnet, in CIDR notation. The subnet size + // must use a /64 prefix length. + IPv6CIDRBlock *string `json:"ipv6CIDRBlock,omitempty"` + // The Amazon Resource Name (ARN) of the Outpost. If you specify an Outpost + // ARN, you must also specify the Availability Zone of the Outpost subnet. + OutpostARN *string `json:"outpostARN,omitempty"` + // The tags to assign to the subnet. + TagSpecifications []*TagSpecification `json:"tagSpecifications,omitempty"` + // The ID of the VPC. + // +kubebuilder:validation:Required + VPCID *string `json:"vpcID"` +} + +// SubnetStatus defines the observed state of Subnet +type SubnetStatus 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"` + // Indicates whether a network interface created in this subnet (including a + // network interface created by RunInstances) receives an IPv6 address. + // +kubebuilder:validation:Optional + AssignIPv6AddressOnCreation *bool `json:"assignIPv6AddressOnCreation,omitempty"` + // The number of unused private IPv4 addresses in the subnet. The IPv4 addresses + // for any stopped instances are considered unavailable. + // +kubebuilder:validation:Optional + AvailableIPAddressCount *int64 `json:"availableIPAddressCount,omitempty"` + // The customer-owned IPv4 address pool associated with the subnet. + // +kubebuilder:validation:Optional + CustomerOwnedIPv4Pool *string `json:"customerOwnedIPv4Pool,omitempty"` + // Indicates whether this is the default subnet for the Availability Zone. + // +kubebuilder:validation:Optional + DefaultForAZ *bool `json:"defaultForAZ,omitempty"` + // Information about the IPv6 CIDR blocks associated with the subnet. + // +kubebuilder:validation:Optional + IPv6CIDRBlockAssociationSet []*SubnetIPv6CIDRBlockAssociation `json:"ipv6CIDRBlockAssociationSet,omitempty"` + // Indicates whether a network interface created in this subnet (including a + // network interface created by RunInstances) receives a customer-owned IPv4 + // address. + // +kubebuilder:validation:Optional + MapCustomerOwnedIPOnLaunch *bool `json:"mapCustomerOwnedIPOnLaunch,omitempty"` + // Indicates whether instances launched in this subnet receive a public IPv4 + // address. + // +kubebuilder:validation:Optional + MapPublicIPOnLaunch *bool `json:"mapPublicIPOnLaunch,omitempty"` + // The ID of the AWS account that owns the subnet. + // +kubebuilder:validation:Optional + OwnerID *string `json:"ownerID,omitempty"` + // The current state of the subnet. + // +kubebuilder:validation:Optional + State *string `json:"state,omitempty"` + // The ID of the subnet. + // +kubebuilder:validation:Optional + SubnetID *string `json:"subnetID,omitempty"` + // Any tags assigned to the subnet. + // +kubebuilder:validation:Optional + Tags []*Tag `json:"tags,omitempty"` +} + +// Subnet is the Schema for the Subnets API +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +type Subnet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec SubnetSpec `json:"spec,omitempty"` + Status SubnetStatus `json:"status,omitempty"` +} + +// SubnetList contains a list of Subnet +// +kubebuilder:object:root=true +type SubnetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Subnet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Subnet{}, &SubnetList{}) +} diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index 3ef61256..c80d93c2 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -90,6 +90,7 @@ type AnalysisACLRule struct { Egress *bool `json:"egress,omitempty"` Protocol *string `json:"protocol,omitempty"` RuleAction *string `json:"ruleAction,omitempty"` + RuleNumber *int64 `json:"ruleNumber,omitempty"` } // Describes a path component. @@ -193,6 +194,12 @@ type AvailabilityZoneMessage struct { Message *string `json:"message,omitempty"` } +// The capacity information for instances that can be launched onto the Dedicated +// Host. +type AvailableCapacity struct { + AvailableVCPUs *int64 `json:"availableVCPUs,omitempty"` +} + // Describes a block device mapping. type BlockDeviceMapping struct { DeviceName *string `json:"deviceName,omitempty"` @@ -236,6 +243,19 @@ type CIDRBlock struct { CIDRBlock *string `json:"cidrBlock,omitempty"` } +// The CPU options for the instance. +type CPUOptions struct { + CoreCount *int64 `json:"coreCount,omitempty"` + ThreadsPerCore *int64 `json:"threadsPerCore,omitempty"` +} + +// The CPU options for the instance. Both the core count and threads per core +// must be specified in the request. +type CPUOptionsRequest struct { + CoreCount *int64 `json:"coreCount,omitempty"` + ThreadsPerCore *int64 `json:"threadsPerCore,omitempty"` +} + // Describes a Spot Fleet error. type CancelSpotFleetRequestsError struct { Message *string `json:"message,omitempty"` @@ -260,6 +280,7 @@ type CancelledSpotInstanceRequest struct { type CapacityReservation struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` AvailabilityZoneID *string `json:"availabilityZoneID,omitempty"` + AvailableInstanceCount *int64 `json:"availableInstanceCount,omitempty"` CapacityReservationARN *string `json:"capacityReservationARN,omitempty"` CapacityReservationID *string `json:"capacityReservationID,omitempty"` EBSOptimized *bool `json:"ebsOptimized,omitempty"` @@ -267,6 +288,7 @@ type CapacityReservation struct { InstanceType *string `json:"instanceType,omitempty"` OwnerID *string `json:"ownerID,omitempty"` Tags []*Tag `json:"tags,omitempty"` + TotalInstanceCount *int64 `json:"totalInstanceCount,omitempty"` } // Describes a resource group to which a Capacity Reservation has been added. @@ -384,6 +406,7 @@ type ClientVPNEndpoint struct { SplitTunnel *bool `json:"splitTunnel,omitempty"` Tags []*Tag `json:"tags,omitempty"` VPCID *string `json:"vpcID,omitempty"` + VPNPort *int64 `json:"vpnPort,omitempty"` } // Describes the status of the Client VPN endpoint attribute. @@ -422,6 +445,7 @@ type CoipAddressUsage struct { // Describes a customer-owned address pool. type CoipPool struct { PoolCIDRs []*string `json:"poolCIDRs,omitempty"` + PoolID *string `json:"poolID,omitempty"` Tags []*Tag `json:"tags,omitempty"` } @@ -623,9 +647,12 @@ type DiskImageVolumeDescription struct { type EBSBlockDevice struct { DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` Encrypted *bool `json:"encrypted,omitempty"` + IOPS *int64 `json:"iops,omitempty"` KMSKeyID *string `json:"kmsKeyID,omitempty"` OutpostARN *string `json:"outpostARN,omitempty"` SnapshotID *string `json:"snapshotID,omitempty"` + Throughput *int64 `json:"throughput,omitempty"` + VolumeSize *int64 `json:"volumeSize,omitempty"` } // Describes a parameter used to set up an EBS volume in a block device mapping. @@ -878,6 +905,7 @@ type FleetLaunchTemplateOverrides struct { type FleetLaunchTemplateOverridesRequest struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` MaxPrice *string `json:"maxPrice,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // Describes the Amazon EC2 launch template and the launch template version @@ -909,6 +937,7 @@ type FlowLog struct { LogDestination *string `json:"logDestination,omitempty"` LogFormat *string `json:"logFormat,omitempty"` LogGroupName *string `json:"logGroupName,omitempty"` + MaxAggregationInterval *int64 `json:"maxAggregationInterval,omitempty"` ResourceID *string `json:"resourceID,omitempty"` Tags []*Tag `json:"tags,omitempty"` } @@ -956,6 +985,7 @@ type HostInstance struct { // Details about the Dedicated Host Reservation offering. type HostOffering struct { + Duration *int64 `json:"duration,omitempty"` HourlyPrice *string `json:"hourlyPrice,omitempty"` InstanceFamily *string `json:"instanceFamily,omitempty"` OfferingID *string `json:"offeringID,omitempty"` @@ -964,12 +994,17 @@ type HostOffering struct { // Describes the properties of a Dedicated Host. type HostProperties struct { + Cores *int64 `json:"cores,omitempty"` InstanceFamily *string `json:"instanceFamily,omitempty"` InstanceType *string `json:"instanceType,omitempty"` + Sockets *int64 `json:"sockets,omitempty"` + TotalVCPUs *int64 `json:"totalVCPUs,omitempty"` } // 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"` @@ -996,6 +1031,12 @@ type IAMInstanceProfileSpecification struct { Name *string `json:"name,omitempty"` } +// Describes the ICMP type and code. +type ICMPTypeCode struct { + Code *int64 `json:"code,omitempty"` + Type *int64 `json:"type_,omitempty"` +} + // Describes the ID format for a resource. type IDFormat struct { Resource *string `json:"resource,omitempty"` @@ -1014,7 +1055,9 @@ type IKEVersionsRequestListValue struct { // Describes a set of permissions for a security group rule. type IPPermission struct { + FromPort *int64 `json:"fromPort,omitempty"` IPProtocol *string `json:"ipProtocol,omitempty"` + ToPort *int64 `json:"toPort,omitempty"` } // Describes an IPv4 range. @@ -1107,6 +1150,7 @@ type ImportInstanceLaunchSpecification struct { AdditionalInfo *string `json:"additionalInfo,omitempty"` Monitoring *bool `json:"monitoring,omitempty"` PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // Describes an import instance task. @@ -1138,6 +1182,7 @@ type ImportVolumeTaskDetails struct { // 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"` @@ -1177,7 +1222,14 @@ type InstanceBlockDeviceMappingSpecification struct { // Information about the number of instances that can be launched onto the Dedicated // Host. type InstanceCapacity struct { - InstanceType *string `json:"instanceType,omitempty"` + AvailableCapacity *int64 `json:"availableCapacity,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + TotalCapacity *int64 `json:"totalCapacity,omitempty"` +} + +// Describes a Reserved Instance listing state. +type InstanceCount struct { + InstanceCount *int64 `json:"instanceCount,omitempty"` } // Describes the credit option for CPU usage of a burstable performance instance. @@ -1212,6 +1264,16 @@ type InstanceIPv6AddressRequest struct { IPv6Address *string `json:"ipv6Address,omitempty"` } +// The metadata options for the instance. +type InstanceMetadataOptionsRequest struct { + HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` +} + +// The metadata options for the instance. +type InstanceMetadataOptionsResponse struct { + HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` +} + // Describes the monitoring of an instance. type InstanceMonitoring struct { InstanceID *string `json:"instanceID,omitempty"` @@ -1243,18 +1305,24 @@ type InstanceNetworkInterfaceAssociation struct { type InstanceNetworkInterfaceAttachment struct { AttachmentID *string `json:"attachmentID,omitempty"` DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + DeviceIndex *int64 `json:"deviceIndex,omitempty"` + NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` } // Describes a network interface. type InstanceNetworkInterfaceSpecification struct { - AssociateCarrierIPAddress *bool `json:"associateCarrierIPAddress,omitempty"` - AssociatePublicIPAddress *bool `json:"associatePublicIPAddress,omitempty"` - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - Description *string `json:"description,omitempty"` - InterfaceType *string `json:"interfaceType,omitempty"` - NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` + AssociateCarrierIPAddress *bool `json:"associateCarrierIPAddress,omitempty"` + AssociatePublicIPAddress *bool `json:"associatePublicIPAddress,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Description *string `json:"description,omitempty"` + DeviceIndex *int64 `json:"deviceIndex,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` + IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` + NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + SecondaryPrivateIPAddressCount *int64 `json:"secondaryPrivateIPAddressCount,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // Describes a private IPv4 address. @@ -1269,6 +1337,11 @@ type InstanceSpecification struct { ExcludeBootVolume *bool `json:"excludeBootVolume,omitempty"` } +// Describes the current state of an instance. +type InstanceState struct { + Code *int64 `json:"code,omitempty"` +} + // Describes an instance state change. type InstanceStateChange struct { InstanceID *string `json:"instanceID,omitempty"` @@ -1293,7 +1366,8 @@ type InstanceTagNotificationAttribute struct { // Information about the Capacity Reservation usage. type InstanceUsage struct { - AccountID *string `json:"accountID,omitempty"` + AccountID *string `json:"accountID,omitempty"` + UsedInstanceCount *int64 `json:"usedInstanceCount,omitempty"` } // Describes an internet gateway. @@ -1361,16 +1435,35 @@ type LaunchTemplateBlockDeviceMappingRequest struct { VirtualName *string `json:"virtualName,omitempty"` } +// The CPU options for the instance. +type LaunchTemplateCPUOptions struct { + CoreCount *int64 `json:"coreCount,omitempty"` + ThreadsPerCore *int64 `json:"threadsPerCore,omitempty"` +} + +// The CPU options for the instance. Both the core count and threads per core +// must be specified in the request. +type LaunchTemplateCPUOptionsRequest struct { + CoreCount *int64 `json:"coreCount,omitempty"` + ThreadsPerCore *int64 `json:"threadsPerCore,omitempty"` +} + // Describes a block device for an EBS volume. type LaunchTemplateEBSBlockDevice struct { - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Encrypted *bool `json:"encrypted,omitempty"` + IOPS *int64 `json:"iops,omitempty"` + Throughput *int64 `json:"throughput,omitempty"` + VolumeSize *int64 `json:"volumeSize,omitempty"` } // The parameters for a block device for an EBS volume. type LaunchTemplateEBSBlockDeviceRequest struct { - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Encrypted *bool `json:"encrypted,omitempty"` + IOPS *int64 `json:"iops,omitempty"` + Throughput *int64 `json:"throughput,omitempty"` + VolumeSize *int64 `json:"volumeSize,omitempty"` } // Describes an elastic inference accelerator. @@ -1380,7 +1473,8 @@ type LaunchTemplateElasticInferenceAccelerator struct { // Describes an elastic inference accelerator. type LaunchTemplateElasticInferenceAcceleratorResponse struct { - Type *string `json:"type_,omitempty"` + Count *int64 `json:"count,omitempty"` + Type *string `json:"type_,omitempty"` } // Indicates whether the instance is enabled for AWS Nitro Enclaves. @@ -1418,24 +1512,48 @@ type LaunchTemplateIAMInstanceProfileSpecificationRequest struct { Name *string `json:"name,omitempty"` } +// The metadata options for the instance. For more information, see Instance +// Metadata and User Data (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) +// in the Amazon Elastic Compute Cloud User Guide. +type LaunchTemplateInstanceMetadataOptions struct { + HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` +} + +// The metadata options for the instance. For more information, see Instance +// Metadata and User Data (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) +// in the Amazon Elastic Compute Cloud User Guide. +type LaunchTemplateInstanceMetadataOptionsRequest struct { + HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` +} + // Describes a network interface. type LaunchTemplateInstanceNetworkInterfaceSpecification struct { - AssociateCarrierIPAddress *bool `json:"associateCarrierIPAddress,omitempty"` - AssociatePublicIPAddress *bool `json:"associatePublicIPAddress,omitempty"` - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - Description *string `json:"description,omitempty"` - InterfaceType *string `json:"interfaceType,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + AssociateCarrierIPAddress *bool `json:"associateCarrierIPAddress,omitempty"` + AssociatePublicIPAddress *bool `json:"associatePublicIPAddress,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Description *string `json:"description,omitempty"` + DeviceIndex *int64 `json:"deviceIndex,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` + IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + SecondaryPrivateIPAddressCount *int64 `json:"secondaryPrivateIPAddressCount,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // The parameters for a network interface. type LaunchTemplateInstanceNetworkInterfaceSpecificationRequest struct { - AssociateCarrierIPAddress *bool `json:"associateCarrierIPAddress,omitempty"` - AssociatePublicIPAddress *bool `json:"associatePublicIPAddress,omitempty"` - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - Description *string `json:"description,omitempty"` - InterfaceType *string `json:"interfaceType,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + AssociateCarrierIPAddress *bool `json:"associateCarrierIPAddress,omitempty"` + AssociatePublicIPAddress *bool `json:"associatePublicIPAddress,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Description *string `json:"description,omitempty"` + DeviceIndex *int64 `json:"deviceIndex,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` + IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + SecondaryPrivateIPAddressCount *int64 `json:"secondaryPrivateIPAddressCount,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // Describes a license configuration. @@ -1462,6 +1580,7 @@ type LaunchTemplatePlacement struct { GroupName *string `json:"groupName,omitempty"` HostID *string `json:"hostID,omitempty"` HostResourceGroupARN *string `json:"hostResourceGroupARN,omitempty"` + PartitionNumber *int64 `json:"partitionNumber,omitempty"` SpreadDomain *string `json:"spreadDomain,omitempty"` Tenancy *string `json:"tenancy,omitempty"` } @@ -1471,6 +1590,7 @@ type LaunchTemplatePlacementRequest struct { Affinity *string `json:"affinity,omitempty"` AvailabilityZone *string `json:"availabilityZone,omitempty"` HostResourceGroupARN *string `json:"hostResourceGroupARN,omitempty"` + PartitionNumber *int64 `json:"partitionNumber,omitempty"` SpreadDomain *string `json:"spreadDomain,omitempty"` Tenancy *string `json:"tenancy,omitempty"` } @@ -1484,12 +1604,14 @@ type LaunchTemplateSpecification struct { // The options for Spot Instances. type LaunchTemplateSpotMarketOptions struct { - MaxPrice *string `json:"maxPrice,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` } // The options for Spot Instances. type LaunchTemplateSpotMarketOptionsRequest struct { - MaxPrice *string `json:"maxPrice,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` } // The tag specification for the launch template. @@ -1586,10 +1708,13 @@ type LocalGatewayRouteTableVirtualInterfaceGroupAssociation struct { // Describes a local gateway virtual interface. type LocalGatewayVirtualInterface struct { LocalAddress *string `json:"localAddress,omitempty"` + LocalBGPASN *int64 `json:"localBGPASN,omitempty"` LocalGatewayID *string `json:"localGatewayID,omitempty"` OwnerID *string `json:"ownerID,omitempty"` PeerAddress *string `json:"peerAddress,omitempty"` + PeerBGPASN *int64 `json:"peerBGPASN,omitempty"` Tags []*Tag `json:"tags,omitempty"` + Vlan *int64 `json:"vlan,omitempty"` } // Describes a local gateway virtual interface group. @@ -1602,6 +1727,7 @@ type LocalGatewayVirtualInterfaceGroup struct { // Describes a managed prefix list. type ManagedPrefixList struct { AddressFamily *string `json:"addressFamily,omitempty"` + MaxEntries *int64 `json:"maxEntries,omitempty"` OwnerID *string `json:"ownerID,omitempty"` PrefixListName *string `json:"prefixListName,omitempty"` StateMessage *string `json:"stateMessage,omitempty"` @@ -1610,11 +1736,17 @@ type ManagedPrefixList struct { // The AWS Site-to-Site VPN tunnel options to modify. type ModifyVPNTunnelOptionsSpecification struct { - DPDTimeoutAction *string `json:"dpdTimeoutAction,omitempty"` - PreSharedKey *string `json:"preSharedKey,omitempty"` - StartupAction *string `json:"startupAction,omitempty"` - TunnelInsideCIDR *string `json:"tunnelInsideCIDR,omitempty"` - TunnelInsideIPv6CIDR *string `json:"tunnelInsideIPv6CIDR,omitempty"` + DPDTimeoutAction *string `json:"dpdTimeoutAction,omitempty"` + DPDTimeoutSeconds *int64 `json:"dpdTimeoutSeconds,omitempty"` + Phase1LifetimeSeconds *int64 `json:"phase1LifetimeSeconds,omitempty"` + Phase2LifetimeSeconds *int64 `json:"phase2LifetimeSeconds,omitempty"` + PreSharedKey *string `json:"preSharedKey,omitempty"` + RekeyFuzzPercentage *int64 `json:"rekeyFuzzPercentage,omitempty"` + RekeyMarginTimeSeconds *int64 `json:"rekeyMarginTimeSeconds,omitempty"` + ReplayWindowSize *int64 `json:"replayWindowSize,omitempty"` + StartupAction *string `json:"startupAction,omitempty"` + TunnelInsideCIDR *string `json:"tunnelInsideCIDR,omitempty"` + TunnelInsideIPv6CIDR *string `json:"tunnelInsideIPv6CIDR,omitempty"` } // Describes the status of a moving Elastic IP address. @@ -1662,6 +1794,7 @@ type NetworkACLEntry struct { Egress *bool `json:"egress,omitempty"` IPv6CIDRBlock *string `json:"ipv6CIDRBlock,omitempty"` Protocol *string `json:"protocol,omitempty"` + RuleNumber *int64 `json:"ruleNumber,omitempty"` } // Describes a network insights analysis. @@ -1673,9 +1806,10 @@ type NetworkInsightsAnalysis struct { // Describes a path. type NetworkInsightsPath struct { - Destination *string `json:"destination,omitempty"` - Source *string `json:"source,omitempty"` - Tags []*Tag `json:"tags,omitempty"` + Destination *string `json:"destination,omitempty"` + DestinationPort *int64 `json:"destinationPort,omitempty"` + Source *string `json:"source,omitempty"` + Tags []*Tag `json:"tags,omitempty"` } // Describes a network interface. @@ -1713,8 +1847,10 @@ type NetworkInterfaceAssociation struct { 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"` } // Describes an attachment change. @@ -1755,6 +1891,7 @@ type NewDHCPConfiguration struct { // Describes the configuration of On-Demand Instances in an EC2 Fleet. type OnDemandOptions struct { MaxTotalPrice *string `json:"maxTotalPrice,omitempty"` + MinTargetCapacity *int64 `json:"minTargetCapacity,omitempty"` SingleAvailabilityZone *bool `json:"singleAvailabilityZone,omitempty"` SingleInstanceType *bool `json:"singleInstanceType,omitempty"` } @@ -1762,10 +1899,16 @@ type OnDemandOptions struct { // Describes the configuration of On-Demand Instances in an EC2 Fleet. type OnDemandOptionsRequest struct { MaxTotalPrice *string `json:"maxTotalPrice,omitempty"` + MinTargetCapacity *int64 `json:"minTargetCapacity,omitempty"` SingleAvailabilityZone *bool `json:"singleAvailabilityZone,omitempty"` SingleInstanceType *bool `json:"singleInstanceType,omitempty"` } +// Describes a path component. +type PathComponent struct { + SequenceNumber *int64 `json:"sequenceNumber,omitempty"` +} + // Describes the data that identifies an Amazon FPGA image (AFI) on the PCI // bus. type PciID struct { @@ -1802,6 +1945,17 @@ type PeeringTgwInfo struct { TransitGatewayID *string `json:"transitGatewayID,omitempty"` } +// The Diffie-Hellmann group number for phase 1 IKE negotiations. +type Phase1DHGroupNumbersListValue struct { + Value *int64 `json:"value,omitempty"` +} + +// Specifies a Diffie-Hellman group number for the VPN tunnel for phase 1 IKE +// negotiations. +type Phase1DHGroupNumbersRequestListValue struct { + Value *int64 `json:"value,omitempty"` +} + // The encryption algorithm for phase 1 IKE negotiations. type Phase1EncryptionAlgorithmsListValue struct { Value *string `json:"value,omitempty"` @@ -1822,6 +1976,17 @@ type Phase1IntegrityAlgorithmsRequestListValue struct { Value *string `json:"value,omitempty"` } +// The Diffie-Hellmann group number for phase 2 IKE negotiations. +type Phase2DHGroupNumbersListValue struct { + Value *int64 `json:"value,omitempty"` +} + +// Specifies a Diffie-Hellman group number for the VPN tunnel for phase 2 IKE +// negotiations. +type Phase2DHGroupNumbersRequestListValue struct { + Value *int64 `json:"value,omitempty"` +} + // The encryption algorithm for phase 2 IKE negotiations. type Phase2EncryptionAlgorithmsListValue struct { Value *string `json:"value,omitempty"` @@ -1849,15 +2014,17 @@ type Placement struct { GroupName *string `json:"groupName,omitempty"` HostID *string `json:"hostID,omitempty"` HostResourceGroupARN *string `json:"hostResourceGroupARN,omitempty"` + PartitionNumber *int64 `json:"partitionNumber,omitempty"` SpreadDomain *string `json:"spreadDomain,omitempty"` Tenancy *string `json:"tenancy,omitempty"` } // Describes a placement group. type PlacementGroup struct { - GroupID *string `json:"groupID,omitempty"` - GroupName *string `json:"groupName,omitempty"` - Tags []*Tag `json:"tags,omitempty"` + GroupID *string `json:"groupID,omitempty"` + GroupName *string `json:"groupName,omitempty"` + PartitionCount *int64 `json:"partitionCount,omitempty"` + Tags []*Tag `json:"tags,omitempty"` } // Describes the placement of an instance. @@ -1870,6 +2037,12 @@ type PoolCIDRBlock struct { CIDR *string `json:"cidr,omitempty"` } +// Describes a range of ports. +type PortRange struct { + From *int64 `json:"from,omitempty"` + To *int64 `json:"to,omitempty"` +} + // Describes prefixes for AWS services. type PrefixList struct { CIDRs []*string `json:"cidrs,omitempty"` @@ -1900,6 +2073,11 @@ type PriceSchedule struct { Active *bool `json:"active,omitempty"` } +// Describes a Reserved Instance offering. +type PricingDetail struct { + Count *int64 `json:"count,omitempty"` +} + // PrincipalIdFormat description type PrincipalIDFormat struct { ARN *string `json:"arn,omitempty"` @@ -1954,20 +2132,25 @@ type PtrUpdateStatus struct { // Describes an IPv4 address pool. type PublicIPv4Pool struct { - Description *string `json:"description,omitempty"` - NetworkBorderGroup *string `json:"networkBorderGroup,omitempty"` - PoolID *string `json:"poolID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` + Description *string `json:"description,omitempty"` + NetworkBorderGroup *string `json:"networkBorderGroup,omitempty"` + PoolID *string `json:"poolID,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + TotalAddressCount *int64 `json:"totalAddressCount,omitempty"` + TotalAvailableAddressCount *int64 `json:"totalAvailableAddressCount,omitempty"` } // Describes an address range of an IPv4 address pool. type PublicIPv4PoolRange struct { - FirstAddress *string `json:"firstAddress,omitempty"` - LastAddress *string `json:"lastAddress,omitempty"` + AddressCount *int64 `json:"addressCount,omitempty"` + AvailableAddressCount *int64 `json:"availableAddressCount,omitempty"` + FirstAddress *string `json:"firstAddress,omitempty"` + LastAddress *string `json:"lastAddress,omitempty"` } // Describes the result of the purchase. type Purchase struct { + Duration *int64 `json:"duration,omitempty"` HostReservationID *string `json:"hostReservationID,omitempty"` HourlyPrice *string `json:"hourlyPrice,omitempty"` InstanceFamily *string `json:"instanceFamily,omitempty"` @@ -1976,6 +2159,7 @@ type Purchase struct { // Describes a request to purchase Scheduled Instances. type PurchaseRequest struct { + InstanceCount *int64 `json:"instanceCount,omitempty"` PurchaseToken *string `json:"purchaseToken,omitempty"` } @@ -2010,6 +2194,7 @@ type RequestLaunchTemplateData struct { type RequestSpotLaunchSpecification struct { AddressingType *string `json:"addressingType,omitempty"` EBSOptimized *bool `json:"ebsOptimized,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` UserData *string `json:"userData,omitempty"` } @@ -2028,6 +2213,7 @@ 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"` @@ -2036,6 +2222,7 @@ type ReservedInstances struct { // Describes the configuration settings for the modified Reserved Instances. type ReservedInstancesConfiguration struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` Platform *string `json:"platform,omitempty"` } @@ -2148,27 +2335,36 @@ type S3Storage struct { // Describes a Scheduled Instance. type ScheduledInstance struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - HourlyPrice *string `json:"hourlyPrice,omitempty"` - InstanceType *string `json:"instanceType,omitempty"` - NetworkPlatform *string `json:"networkPlatform,omitempty"` - Platform *string `json:"platform,omitempty"` - ScheduledInstanceID *string `json:"scheduledInstanceID,omitempty"` + 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"` } // Describes a schedule that is available for your Scheduled Instances. type ScheduledInstanceAvailability struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - HourlyPrice *string `json:"hourlyPrice,omitempty"` - InstanceType *string `json:"instanceType,omitempty"` - NetworkPlatform *string `json:"networkPlatform,omitempty"` - Platform *string `json:"platform,omitempty"` - PurchaseToken *string `json:"purchaseToken,omitempty"` + 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"` } // Describes the recurring schedule for a Scheduled Instance. type ScheduledInstanceRecurrence struct { Frequency *string `json:"frequency,omitempty"` + Interval *int64 `json:"interval,omitempty"` OccurrenceRelativeToEnd *bool `json:"occurrenceRelativeToEnd,omitempty"` OccurrenceUnit *string `json:"occurrenceUnit,omitempty"` } @@ -2176,6 +2372,7 @@ type ScheduledInstanceRecurrence struct { // Describes the recurring schedule for a Scheduled Instance. type ScheduledInstanceRecurrenceRequest struct { Frequency *string `json:"frequency,omitempty"` + Interval *int64 `json:"interval,omitempty"` OccurrenceRelativeToEnd *bool `json:"occurrenceRelativeToEnd,omitempty"` OccurrenceUnit *string `json:"occurrenceUnit,omitempty"` } @@ -2191,6 +2388,8 @@ type ScheduledInstancesBlockDeviceMapping struct { type ScheduledInstancesEBS struct { DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` Encrypted *bool `json:"encrypted,omitempty"` + IOPS *int64 `json:"iops,omitempty"` + VolumeSize *int64 `json:"volumeSize,omitempty"` VolumeType *string `json:"volumeType,omitempty"` } @@ -2208,6 +2407,7 @@ type ScheduledInstancesIAMInstanceProfile struct { type ScheduledInstancesLaunchSpecification struct { EBSOptimized *bool `json:"ebsOptimized,omitempty"` InstanceType *string `json:"instanceType,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` UserData *string `json:"userData,omitempty"` } @@ -2218,10 +2418,14 @@ type ScheduledInstancesMonitoring struct { // Describes a network interface for a Scheduled Instance. type ScheduledInstancesNetworkInterface struct { - AssociatePublicIPAddress *bool `json:"associatePublicIPAddress,omitempty"` - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - Description *string `json:"description,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + AssociatePublicIPAddress *bool `json:"associatePublicIPAddress,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Description *string `json:"description,omitempty"` + DeviceIndex *int64 `json:"deviceIndex,omitempty"` + IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + SecondaryPrivateIPAddressCount *int64 `json:"secondaryPrivateIPAddressCount,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // Describes the placement for a Scheduled Instance. @@ -2315,6 +2519,7 @@ type SnapshotInfo struct { SnapshotID *string `json:"snapshotID,omitempty"` Tags []*Tag `json:"tags,omitempty"` VolumeID *string `json:"volumeID,omitempty"` + VolumeSize *int64 `json:"volumeSize,omitempty"` } // Details about the import snapshot task. @@ -2368,11 +2573,14 @@ type SpotFleetRequestConfig struct { type SpotFleetRequestConfigData struct { ClientToken *string `json:"clientToken,omitempty"` IAMFleetRole *string `json:"iamFleetRole,omitempty"` + InstancePoolsToUseCount *int64 `json:"instancePoolsToUseCount,omitempty"` OnDemandMaxTotalPrice *string `json:"onDemandMaxTotalPrice,omitempty"` + OnDemandTargetCapacity *int64 `json:"onDemandTargetCapacity,omitempty"` ReplaceUnhealthyInstances *bool `json:"replaceUnhealthyInstances,omitempty"` SpotMaxTotalPrice *string `json:"spotMaxTotalPrice,omitempty"` SpotPrice *string `json:"spotPrice,omitempty"` TagSpecifications []*TagSpecification `json:"tagSpecifications,omitempty"` + TargetCapacity *int64 `json:"targetCapacity,omitempty"` TerminateInstancesWithExpiration *bool `json:"terminateInstancesWithExpiration,omitempty"` } @@ -2386,6 +2594,7 @@ type SpotFleetTagSpecification struct { 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"` @@ -2407,21 +2616,26 @@ type SpotInstanceStatus struct { // The options for Spot Instances. type SpotMarketOptions struct { - MaxPrice *string `json:"maxPrice,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` } // Describes the configuration of Spot Instances in an EC2 Fleet. type SpotOptions struct { - MaxTotalPrice *string `json:"maxTotalPrice,omitempty"` - SingleAvailabilityZone *bool `json:"singleAvailabilityZone,omitempty"` - SingleInstanceType *bool `json:"singleInstanceType,omitempty"` + InstancePoolsToUseCount *int64 `json:"instancePoolsToUseCount,omitempty"` + MaxTotalPrice *string `json:"maxTotalPrice,omitempty"` + MinTargetCapacity *int64 `json:"minTargetCapacity,omitempty"` + SingleAvailabilityZone *bool `json:"singleAvailabilityZone,omitempty"` + SingleInstanceType *bool `json:"singleInstanceType,omitempty"` } // Describes the configuration of Spot Instances in an EC2 Fleet request. type SpotOptionsRequest struct { - MaxTotalPrice *string `json:"maxTotalPrice,omitempty"` - SingleAvailabilityZone *bool `json:"singleAvailabilityZone,omitempty"` - SingleInstanceType *bool `json:"singleInstanceType,omitempty"` + InstancePoolsToUseCount *int64 `json:"instancePoolsToUseCount,omitempty"` + MaxTotalPrice *string `json:"maxTotalPrice,omitempty"` + MinTargetCapacity *int64 `json:"minTargetCapacity,omitempty"` + SingleAvailabilityZone *bool `json:"singleAvailabilityZone,omitempty"` + SingleInstanceType *bool `json:"singleInstanceType,omitempty"` } // Describes Spot Instance placement. @@ -2440,7 +2654,9 @@ type SpotPrice struct { // Describes a stale rule in a security group. type StaleIPPermission struct { + FromPort *int64 `json:"fromPort,omitempty"` IPProtocol *string `json:"ipProtocol,omitempty"` + ToPort *int64 `json:"toPort,omitempty"` } // Describes a stale security group (a security group that contains stale rules). @@ -2463,23 +2679,6 @@ type StorageLocation struct { Key *string `json:"key,omitempty"` } -// Describes a subnet. -type Subnet struct { - AssignIPv6AddressOnCreation *bool `json:"assignIPv6AddressOnCreation,omitempty"` - AvailabilityZone *string `json:"availabilityZone,omitempty"` - AvailabilityZoneID *string `json:"availabilityZoneID,omitempty"` - CIDRBlock *string `json:"cidrBlock,omitempty"` - DefaultForAZ *bool `json:"defaultForAZ,omitempty"` - MapCustomerOwnedIPOnLaunch *bool `json:"mapCustomerOwnedIPOnLaunch,omitempty"` - MapPublicIPOnLaunch *bool `json:"mapPublicIPOnLaunch,omitempty"` - OutpostARN *string `json:"outpostARN,omitempty"` - OwnerID *string `json:"ownerID,omitempty"` - SubnetARN *string `json:"subnetARN,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - VPCID *string `json:"vpcID,omitempty"` -} - // Describes the subnet association with the transit gateway multicast domain. type SubnetAssociation struct { SubnetID *string `json:"subnetID,omitempty"` @@ -2487,6 +2686,7 @@ type SubnetAssociation struct { // Describes the state of a CIDR block. type SubnetCIDRBlockState struct { + State *string `json:"state,omitempty"` StatusMessage *string `json:"statusMessage,omitempty"` } @@ -2494,6 +2694,29 @@ type SubnetCIDRBlockState struct { type SubnetIPv6CIDRBlockAssociation struct { AssociationID *string `json:"associationID,omitempty"` IPv6CIDRBlock *string `json:"ipv6CIDRBlock,omitempty"` + // Describes the state of a CIDR block. + IPv6CIDRBlockState *SubnetCIDRBlockState `json:"ipv6CIDRBlockState,omitempty"` +} + +// Describes a subnet. +type Subnet_SDK struct { + AssignIPv6AddressOnCreation *bool `json:"assignIPv6AddressOnCreation,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + AvailabilityZoneID *string `json:"availabilityZoneID,omitempty"` + AvailableIPAddressCount *int64 `json:"availableIPAddressCount,omitempty"` + CIDRBlock *string `json:"cidrBlock,omitempty"` + CustomerOwnedIPv4Pool *string `json:"customerOwnedIPv4Pool,omitempty"` + DefaultForAZ *bool `json:"defaultForAZ,omitempty"` + IPv6CIDRBlockAssociationSet []*SubnetIPv6CIDRBlockAssociation `json:"ipv6CIDRBlockAssociationSet,omitempty"` + MapCustomerOwnedIPOnLaunch *bool `json:"mapCustomerOwnedIPOnLaunch,omitempty"` + MapPublicIPOnLaunch *bool `json:"mapPublicIPOnLaunch,omitempty"` + OutpostARN *string `json:"outpostARN,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + State *string `json:"state,omitempty"` + SubnetARN *string `json:"subnetARN,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + VPCID *string `json:"vpcID,omitempty"` } // Describes the burstable performance instance whose credit option for CPU @@ -2527,9 +2750,57 @@ type TagSpecification struct { Tags []*Tag `json:"tags,omitempty"` } +// The number of units to request. You can choose to set the target capacity +// in terms of instances or a performance characteristic that is important to +// your application workload, such as vCPUs, memory, or I/O. If the request +// type is maintain, you can specify a target capacity of 0 and add capacity +// later. +// +// You can use the On-Demand Instance MaxTotalPrice parameter, the Spot Instance +// MaxTotalPrice, or both to ensure that your fleet cost does not exceed your +// budget. If you set a maximum price per hour for the On-Demand Instances and +// Spot Instances in your request, EC2 Fleet will launch instances until it +// reaches the maximum amount that you're willing to pay. When the maximum amount +// you're willing to pay is reached, the fleet stops launching instances even +// if it hasn’t met the target capacity. The MaxTotalPrice parameters are +// located in OnDemandOptions (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_OnDemandOptions.html) +// and SpotOptions (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SpotOptions). +type TargetCapacitySpecification struct { + OnDemandTargetCapacity *int64 `json:"onDemandTargetCapacity,omitempty"` + SpotTargetCapacity *int64 `json:"spotTargetCapacity,omitempty"` + TotalTargetCapacity *int64 `json:"totalTargetCapacity,omitempty"` +} + +// The number of units to request. You can choose to set the target capacity +// as the number of instances. Or you can set the target capacity to a performance +// characteristic that is important to your application workload, such as vCPUs, +// memory, or I/O. If the request type is maintain, you can specify a target +// capacity of 0 and add capacity later. +// +// You can use the On-Demand Instance MaxTotalPrice parameter, the Spot Instance +// MaxTotalPrice parameter, or both parameters to ensure that your fleet cost +// does not exceed your budget. If you set a maximum price per hour for the +// On-Demand Instances and Spot Instances in your request, EC2 Fleet will launch +// instances until it reaches the maximum amount that you're willing to pay. +// When the maximum amount you're willing to pay is reached, the fleet stops +// launching instances even if it hasn’t met the target capacity. The MaxTotalPrice +// parameters are located in OnDemandOptionsRequest (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_OnDemandOptionsRequest) +// and SpotOptionsRequest (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SpotOptionsRequest). +type TargetCapacitySpecificationRequest struct { + OnDemandTargetCapacity *int64 `json:"onDemandTargetCapacity,omitempty"` + SpotTargetCapacity *int64 `json:"spotTargetCapacity,omitempty"` + TotalTargetCapacity *int64 `json:"totalTargetCapacity,omitempty"` +} + // Information about the Convertible Reserved Instance offering. type TargetConfiguration struct { - OfferingID *string `json:"offeringID,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + OfferingID *string `json:"offeringID,omitempty"` +} + +// Details about the target configuration. +type TargetConfigurationRequest struct { + InstanceCount *int64 `json:"instanceCount,omitempty"` } // Describes a load balancer target group. @@ -2562,20 +2833,37 @@ type TrafficMirrorFilter struct { type TrafficMirrorFilterRule struct { Description *string `json:"description,omitempty"` DestinationCIDRBlock *string `json:"destinationCIDRBlock,omitempty"` + Protocol *int64 `json:"protocol,omitempty"` + RuleNumber *int64 `json:"ruleNumber,omitempty"` SourceCIDRBlock *string `json:"sourceCIDRBlock,omitempty"` TrafficMirrorFilterID *string `json:"trafficMirrorFilterID,omitempty"` TrafficMirrorFilterRuleID *string `json:"trafficMirrorFilterRuleID,omitempty"` } +// Describes the Traffic Mirror port range. +type TrafficMirrorPortRange struct { + FromPort *int64 `json:"fromPort,omitempty"` + ToPort *int64 `json:"toPort,omitempty"` +} + +// Information about the Traffic Mirror filter rule port range. +type TrafficMirrorPortRangeRequest struct { + FromPort *int64 `json:"fromPort,omitempty"` + ToPort *int64 `json:"toPort,omitempty"` +} + // Describes a Traffic Mirror session. type TrafficMirrorSession struct { Description *string `json:"description,omitempty"` NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` OwnerID *string `json:"ownerID,omitempty"` + PacketLength *int64 `json:"packetLength,omitempty"` + SessionNumber *int64 `json:"sessionNumber,omitempty"` Tags []*Tag `json:"tags,omitempty"` TrafficMirrorFilterID *string `json:"trafficMirrorFilterID,omitempty"` TrafficMirrorSessionID *string `json:"trafficMirrorSessionID,omitempty"` TrafficMirrorTargetID *string `json:"trafficMirrorTargetID,omitempty"` + VirtualNetworkID *int64 `json:"virtualNetworkID,omitempty"` } // Describes a Traffic Mirror target. @@ -2783,12 +3071,18 @@ type TransitGatewayVPCAttachment struct { // The VPN tunnel options. type TunnelOption struct { - DPDTimeoutAction *string `json:"dpdTimeoutAction,omitempty"` - OutsideIPAddress *string `json:"outsideIPAddress,omitempty"` - PreSharedKey *string `json:"preSharedKey,omitempty"` - StartupAction *string `json:"startupAction,omitempty"` - TunnelInsideCIDR *string `json:"tunnelInsideCIDR,omitempty"` - TunnelInsideIPv6CIDR *string `json:"tunnelInsideIPv6CIDR,omitempty"` + DPDTimeoutAction *string `json:"dpdTimeoutAction,omitempty"` + DPDTimeoutSeconds *int64 `json:"dpdTimeoutSeconds,omitempty"` + OutsideIPAddress *string `json:"outsideIPAddress,omitempty"` + Phase1LifetimeSeconds *int64 `json:"phase1LifetimeSeconds,omitempty"` + Phase2LifetimeSeconds *int64 `json:"phase2LifetimeSeconds,omitempty"` + PreSharedKey *string `json:"preSharedKey,omitempty"` + RekeyFuzzPercentage *int64 `json:"rekeyFuzzPercentage,omitempty"` + RekeyMarginTimeSeconds *int64 `json:"rekeyMarginTimeSeconds,omitempty"` + ReplayWindowSize *int64 `json:"replayWindowSize,omitempty"` + StartupAction *string `json:"startupAction,omitempty"` + TunnelInsideCIDR *string `json:"tunnelInsideCIDR,omitempty"` + TunnelInsideIPv6CIDR *string `json:"tunnelInsideIPv6CIDR,omitempty"` } // Describes the burstable performance instance whose credit option for CPU @@ -2845,9 +3139,10 @@ type UserIDGroupPair struct { // Describes telemetry for a VPN tunnel. type VGWTelemetry struct { - 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"` + OutsideIPAddress *string `json:"outsideIPAddress,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` } // Describes an attachment between a virtual private gateway and a VPC. @@ -2995,11 +3290,17 @@ type VPNStaticRoute struct { // The tunnel options for a single VPN tunnel. type VPNTunnelOptionsSpecification struct { - DPDTimeoutAction *string `json:"dpdTimeoutAction,omitempty"` - PreSharedKey *string `json:"preSharedKey,omitempty"` - StartupAction *string `json:"startupAction,omitempty"` - TunnelInsideCIDR *string `json:"tunnelInsideCIDR,omitempty"` - TunnelInsideIPv6CIDR *string `json:"tunnelInsideIPv6CIDR,omitempty"` + DPDTimeoutAction *string `json:"dpdTimeoutAction,omitempty"` + DPDTimeoutSeconds *int64 `json:"dpdTimeoutSeconds,omitempty"` + Phase1LifetimeSeconds *int64 `json:"phase1LifetimeSeconds,omitempty"` + Phase2LifetimeSeconds *int64 `json:"phase2LifetimeSeconds,omitempty"` + PreSharedKey *string `json:"preSharedKey,omitempty"` + RekeyFuzzPercentage *int64 `json:"rekeyFuzzPercentage,omitempty"` + RekeyMarginTimeSeconds *int64 `json:"rekeyMarginTimeSeconds,omitempty"` + ReplayWindowSize *int64 `json:"replayWindowSize,omitempty"` + StartupAction *string `json:"startupAction,omitempty"` + TunnelInsideCIDR *string `json:"tunnelInsideCIDR,omitempty"` + TunnelInsideIPv6CIDR *string `json:"tunnelInsideIPv6CIDR,omitempty"` } // The error code and error message that is returned for a parameter or parameter @@ -3014,9 +3315,15 @@ type ValidationError struct { // // 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"` } diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index d598f54a..d65ed9d3 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -293,6 +293,11 @@ func (in *AnalysisACLRule) DeepCopyInto(out *AnalysisACLRule) { *out = new(string) **out = **in } + if in.RuleNumber != nil { + in, out := &in.RuleNumber, &out.RuleNumber + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalysisACLRule. @@ -720,6 +725,26 @@ func (in *AvailabilityZoneMessage) DeepCopy() *AvailabilityZoneMessage { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AvailableCapacity) DeepCopyInto(out *AvailableCapacity) { + *out = *in + if in.AvailableVCPUs != nil { + in, out := &in.AvailableVCPUs, &out.AvailableVCPUs + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AvailableCapacity. +func (in *AvailableCapacity) DeepCopy() *AvailableCapacity { + if in == nil { + return nil + } + out := new(AvailableCapacity) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BlockDeviceMapping) DeepCopyInto(out *BlockDeviceMapping) { *out = *in @@ -880,6 +905,56 @@ func (in *CIDRBlock) DeepCopy() *CIDRBlock { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CPUOptions) DeepCopyInto(out *CPUOptions) { + *out = *in + if in.CoreCount != nil { + in, out := &in.CoreCount, &out.CoreCount + *out = new(int64) + **out = **in + } + if in.ThreadsPerCore != nil { + in, out := &in.ThreadsPerCore, &out.ThreadsPerCore + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CPUOptions. +func (in *CPUOptions) DeepCopy() *CPUOptions { + if in == nil { + return nil + } + out := new(CPUOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CPUOptionsRequest) DeepCopyInto(out *CPUOptionsRequest) { + *out = *in + if in.CoreCount != nil { + in, out := &in.CoreCount, &out.CoreCount + *out = new(int64) + **out = **in + } + if in.ThreadsPerCore != nil { + in, out := &in.ThreadsPerCore, &out.ThreadsPerCore + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CPUOptionsRequest. +func (in *CPUOptionsRequest) DeepCopy() *CPUOptionsRequest { + if in == nil { + return nil + } + out := new(CPUOptionsRequest) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CancelSpotFleetRequestsError) DeepCopyInto(out *CancelSpotFleetRequestsError) { *out = *in @@ -973,6 +1048,11 @@ func (in *CapacityReservation) DeepCopyInto(out *CapacityReservation) { *out = new(string) **out = **in } + if in.AvailableInstanceCount != nil { + in, out := &in.AvailableInstanceCount, &out.AvailableInstanceCount + *out = new(int64) + **out = **in + } if in.CapacityReservationARN != nil { in, out := &in.CapacityReservationARN, &out.CapacityReservationARN *out = new(string) @@ -1014,6 +1094,11 @@ func (in *CapacityReservation) DeepCopyInto(out *CapacityReservation) { } } } + if in.TotalInstanceCount != nil { + in, out := &in.TotalInstanceCount, &out.TotalInstanceCount + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CapacityReservation. @@ -1544,6 +1629,11 @@ func (in *ClientVPNEndpoint) DeepCopyInto(out *ClientVPNEndpoint) { *out = new(string) **out = **in } + if in.VPNPort != nil { + in, out := &in.VPNPort, &out.VPNPort + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientVPNEndpoint. @@ -1710,6 +1800,11 @@ func (in *CoipPool) DeepCopyInto(out *CoipPool) { } } } + if in.PoolID != nil { + in, out := &in.PoolID, &out.PoolID + *out = new(string) + **out = **in + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -2556,6 +2651,11 @@ func (in *EBSBlockDevice) DeepCopyInto(out *EBSBlockDevice) { *out = new(bool) **out = **in } + if in.IOPS != nil { + in, out := &in.IOPS, &out.IOPS + *out = new(int64) + **out = **in + } if in.KMSKeyID != nil { in, out := &in.KMSKeyID, &out.KMSKeyID *out = new(string) @@ -2571,6 +2671,16 @@ func (in *EBSBlockDevice) DeepCopyInto(out *EBSBlockDevice) { *out = new(string) **out = **in } + if in.Throughput != nil { + in, out := &in.Throughput, &out.Throughput + *out = new(int64) + **out = **in + } + if in.VolumeSize != nil { + in, out := &in.VolumeSize, &out.VolumeSize + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EBSBlockDevice. @@ -3565,6 +3675,11 @@ func (in *FleetLaunchTemplateOverridesRequest) DeepCopyInto(out *FleetLaunchTemp *out = new(string) **out = **in } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FleetLaunchTemplateOverridesRequest. @@ -3665,6 +3780,11 @@ func (in *FlowLog) DeepCopyInto(out *FlowLog) { *out = new(string) **out = **in } + if in.MaxAggregationInterval != nil { + in, out := &in.MaxAggregationInterval, &out.MaxAggregationInterval + *out = new(int64) + **out = **in + } if in.ResourceID != nil { in, out := &in.ResourceID, &out.ResourceID *out = new(string) @@ -3852,6 +3972,11 @@ func (in *HostInstance) DeepCopy() *HostInstance { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HostOffering) DeepCopyInto(out *HostOffering) { *out = *in + if in.Duration != nil { + in, out := &in.Duration, &out.Duration + *out = new(int64) + **out = **in + } if in.HourlyPrice != nil { in, out := &in.HourlyPrice, &out.HourlyPrice *out = new(string) @@ -3887,6 +4012,11 @@ func (in *HostOffering) DeepCopy() *HostOffering { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HostProperties) DeepCopyInto(out *HostProperties) { *out = *in + if in.Cores != nil { + in, out := &in.Cores, &out.Cores + *out = new(int64) + **out = **in + } if in.InstanceFamily != nil { in, out := &in.InstanceFamily, &out.InstanceFamily *out = new(string) @@ -3897,6 +4027,16 @@ func (in *HostProperties) DeepCopyInto(out *HostProperties) { *out = new(string) **out = **in } + if in.Sockets != nil { + in, out := &in.Sockets, &out.Sockets + *out = new(int64) + **out = **in + } + if in.TotalVCPUs != nil { + in, out := &in.TotalVCPUs, &out.TotalVCPUs + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostProperties. @@ -3912,6 +4052,16 @@ func (in *HostProperties) DeepCopy() *HostProperties { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HostReservation) DeepCopyInto(out *HostReservation) { *out = *in + if in.Count != nil { + in, out := &in.Count, &out.Count + *out = new(int64) + **out = **in + } + if in.Duration != nil { + in, out := &in.Duration, &out.Duration + *out = new(int64) + **out = **in + } if in.HostReservationID != nil { in, out := &in.HostReservationID, &out.HostReservationID *out = new(string) @@ -4035,6 +4185,31 @@ func (in *IAMInstanceProfileSpecification) DeepCopy() *IAMInstanceProfileSpecifi return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ICMPTypeCode) DeepCopyInto(out *ICMPTypeCode) { + *out = *in + if in.Code != nil { + in, out := &in.Code, &out.Code + *out = new(int64) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ICMPTypeCode. +func (in *ICMPTypeCode) DeepCopy() *ICMPTypeCode { + if in == nil { + return nil + } + out := new(ICMPTypeCode) + in.DeepCopyInto(out) + return out +} + // 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 @@ -4103,11 +4278,21 @@ func (in *IKEVersionsRequestListValue) DeepCopy() *IKEVersionsRequestListValue { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IPPermission) DeepCopyInto(out *IPPermission) { *out = *in + if in.FromPort != nil { + in, out := &in.FromPort, &out.FromPort + *out = new(int64) + **out = **in + } if in.IPProtocol != nil { in, out := &in.IPProtocol, &out.IPProtocol *out = new(string) **out = **in } + if in.ToPort != nil { + in, out := &in.ToPort, &out.ToPort + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPermission. @@ -4531,6 +4716,11 @@ func (in *ImportInstanceLaunchSpecification) DeepCopyInto(out *ImportInstanceLau *out = new(string) **out = **in } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportInstanceLaunchSpecification. @@ -4667,6 +4857,11 @@ func (in *ImportVolumeTaskDetails) DeepCopy() *ImportVolumeTaskDetails { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Instance) DeepCopyInto(out *Instance) { *out = *in + if in.AmiLaunchIndex != nil { + in, out := &in.AmiLaunchIndex, &out.AmiLaunchIndex + *out = new(int64) + **out = **in + } if in.CapacityReservationID != nil { in, out := &in.CapacityReservationID, &out.CapacityReservationID *out = new(string) @@ -4848,11 +5043,21 @@ func (in *InstanceBlockDeviceMappingSpecification) DeepCopy() *InstanceBlockDevi // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceCapacity) DeepCopyInto(out *InstanceCapacity) { *out = *in + if in.AvailableCapacity != nil { + in, out := &in.AvailableCapacity, &out.AvailableCapacity + *out = new(int64) + **out = **in + } if in.InstanceType != nil { in, out := &in.InstanceType, &out.InstanceType *out = new(string) **out = **in } + if in.TotalCapacity != nil { + in, out := &in.TotalCapacity, &out.TotalCapacity + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceCapacity. @@ -4865,6 +5070,26 @@ func (in *InstanceCapacity) DeepCopy() *InstanceCapacity { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceCount) DeepCopyInto(out *InstanceCount) { + *out = *in + if in.InstanceCount != nil { + in, out := &in.InstanceCount, &out.InstanceCount + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceCount. +func (in *InstanceCount) DeepCopy() *InstanceCount { + if in == nil { + return nil + } + out := new(InstanceCount) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceCreditSpecification) DeepCopyInto(out *InstanceCreditSpecification) { *out = *in @@ -4990,6 +5215,46 @@ func (in *InstanceIPv6AddressRequest) DeepCopy() *InstanceIPv6AddressRequest { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceMetadataOptionsRequest) DeepCopyInto(out *InstanceMetadataOptionsRequest) { + *out = *in + if in.HTTPPutResponseHopLimit != nil { + in, out := &in.HTTPPutResponseHopLimit, &out.HTTPPutResponseHopLimit + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceMetadataOptionsRequest. +func (in *InstanceMetadataOptionsRequest) DeepCopy() *InstanceMetadataOptionsRequest { + if in == nil { + return nil + } + out := new(InstanceMetadataOptionsRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceMetadataOptionsResponse) DeepCopyInto(out *InstanceMetadataOptionsResponse) { + *out = *in + if in.HTTPPutResponseHopLimit != nil { + in, out := &in.HTTPPutResponseHopLimit, &out.HTTPPutResponseHopLimit + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceMetadataOptionsResponse. +func (in *InstanceMetadataOptionsResponse) DeepCopy() *InstanceMetadataOptionsResponse { + if in == nil { + return nil + } + out := new(InstanceMetadataOptionsResponse) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceMonitoring) DeepCopyInto(out *InstanceMonitoring) { *out = *in @@ -5123,6 +5388,16 @@ func (in *InstanceNetworkInterfaceAttachment) DeepCopyInto(out *InstanceNetworkI *out = new(bool) **out = **in } + if in.DeviceIndex != nil { + in, out := &in.DeviceIndex, &out.DeviceIndex + *out = new(int64) + **out = **in + } + if in.NetworkCardIndex != nil { + in, out := &in.NetworkCardIndex, &out.NetworkCardIndex + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceNetworkInterfaceAttachment. @@ -5158,11 +5433,26 @@ func (in *InstanceNetworkInterfaceSpecification) DeepCopyInto(out *InstanceNetwo *out = new(string) **out = **in } + if in.DeviceIndex != nil { + in, out := &in.DeviceIndex, &out.DeviceIndex + *out = new(int64) + **out = **in + } if in.InterfaceType != nil { in, out := &in.InterfaceType, &out.InterfaceType *out = new(string) **out = **in } + if in.IPv6AddressCount != nil { + in, out := &in.IPv6AddressCount, &out.IPv6AddressCount + *out = new(int64) + **out = **in + } + if in.NetworkCardIndex != nil { + in, out := &in.NetworkCardIndex, &out.NetworkCardIndex + *out = new(int64) + **out = **in + } if in.NetworkInterfaceID != nil { in, out := &in.NetworkInterfaceID, &out.NetworkInterfaceID *out = new(string) @@ -5173,6 +5463,11 @@ func (in *InstanceNetworkInterfaceSpecification) DeepCopyInto(out *InstanceNetwo *out = new(string) **out = **in } + if in.SecondaryPrivateIPAddressCount != nil { + in, out := &in.SecondaryPrivateIPAddressCount, &out.SecondaryPrivateIPAddressCount + *out = new(int64) + **out = **in + } if in.SubnetID != nil { in, out := &in.SubnetID, &out.SubnetID *out = new(string) @@ -5240,6 +5535,26 @@ func (in *InstanceSpecification) DeepCopy() *InstanceSpecification { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceState) DeepCopyInto(out *InstanceState) { + *out = *in + if in.Code != nil { + in, out := &in.Code, &out.Code + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceState. +func (in *InstanceState) DeepCopy() *InstanceState { + if in == nil { + return nil + } + out := new(InstanceState) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceStateChange) DeepCopyInto(out *InstanceStateChange) { *out = *in @@ -5338,6 +5653,11 @@ func (in *InstanceUsage) DeepCopyInto(out *InstanceUsage) { *out = new(string) **out = **in } + if in.UsedInstanceCount != nil { + in, out := &in.UsedInstanceCount, &out.UsedInstanceCount + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceUsage. @@ -5643,6 +5963,56 @@ func (in *LaunchTemplateBlockDeviceMappingRequest) DeepCopy() *LaunchTemplateBlo return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateCPUOptions) DeepCopyInto(out *LaunchTemplateCPUOptions) { + *out = *in + if in.CoreCount != nil { + in, out := &in.CoreCount, &out.CoreCount + *out = new(int64) + **out = **in + } + if in.ThreadsPerCore != nil { + in, out := &in.ThreadsPerCore, &out.ThreadsPerCore + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateCPUOptions. +func (in *LaunchTemplateCPUOptions) DeepCopy() *LaunchTemplateCPUOptions { + if in == nil { + return nil + } + out := new(LaunchTemplateCPUOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateCPUOptionsRequest) DeepCopyInto(out *LaunchTemplateCPUOptionsRequest) { + *out = *in + if in.CoreCount != nil { + in, out := &in.CoreCount, &out.CoreCount + *out = new(int64) + **out = **in + } + if in.ThreadsPerCore != nil { + in, out := &in.ThreadsPerCore, &out.ThreadsPerCore + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateCPUOptionsRequest. +func (in *LaunchTemplateCPUOptionsRequest) DeepCopy() *LaunchTemplateCPUOptionsRequest { + if in == nil { + return nil + } + out := new(LaunchTemplateCPUOptionsRequest) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateEBSBlockDevice) DeepCopyInto(out *LaunchTemplateEBSBlockDevice) { *out = *in @@ -5656,6 +6026,21 @@ func (in *LaunchTemplateEBSBlockDevice) DeepCopyInto(out *LaunchTemplateEBSBlock *out = new(bool) **out = **in } + if in.IOPS != nil { + in, out := &in.IOPS, &out.IOPS + *out = new(int64) + **out = **in + } + if in.Throughput != nil { + in, out := &in.Throughput, &out.Throughput + *out = new(int64) + **out = **in + } + if in.VolumeSize != nil { + in, out := &in.VolumeSize, &out.VolumeSize + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateEBSBlockDevice. @@ -5681,6 +6066,21 @@ func (in *LaunchTemplateEBSBlockDeviceRequest) DeepCopyInto(out *LaunchTemplateE *out = new(bool) **out = **in } + if in.IOPS != nil { + in, out := &in.IOPS, &out.IOPS + *out = new(int64) + **out = **in + } + if in.Throughput != nil { + in, out := &in.Throughput, &out.Throughput + *out = new(int64) + **out = **in + } + if in.VolumeSize != nil { + in, out := &in.VolumeSize, &out.VolumeSize + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateEBSBlockDeviceRequest. @@ -5716,6 +6116,11 @@ func (in *LaunchTemplateElasticInferenceAccelerator) DeepCopy() *LaunchTemplateE // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateElasticInferenceAcceleratorResponse) DeepCopyInto(out *LaunchTemplateElasticInferenceAcceleratorResponse) { *out = *in + if in.Count != nil { + in, out := &in.Count, &out.Count + *out = new(int64) + **out = **in + } if in.Type != nil { in, out := &in.Type, &out.Type *out = new(string) @@ -5863,6 +6268,46 @@ func (in *LaunchTemplateIAMInstanceProfileSpecificationRequest) DeepCopy() *Laun return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateInstanceMetadataOptions) DeepCopyInto(out *LaunchTemplateInstanceMetadataOptions) { + *out = *in + if in.HTTPPutResponseHopLimit != nil { + in, out := &in.HTTPPutResponseHopLimit, &out.HTTPPutResponseHopLimit + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateInstanceMetadataOptions. +func (in *LaunchTemplateInstanceMetadataOptions) DeepCopy() *LaunchTemplateInstanceMetadataOptions { + if in == nil { + return nil + } + out := new(LaunchTemplateInstanceMetadataOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateInstanceMetadataOptionsRequest) DeepCopyInto(out *LaunchTemplateInstanceMetadataOptionsRequest) { + *out = *in + if in.HTTPPutResponseHopLimit != nil { + in, out := &in.HTTPPutResponseHopLimit, &out.HTTPPutResponseHopLimit + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateInstanceMetadataOptionsRequest. +func (in *LaunchTemplateInstanceMetadataOptionsRequest) DeepCopy() *LaunchTemplateInstanceMetadataOptionsRequest { + if in == nil { + return nil + } + out := new(LaunchTemplateInstanceMetadataOptionsRequest) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateInstanceNetworkInterfaceSpecification) DeepCopyInto(out *LaunchTemplateInstanceNetworkInterfaceSpecification) { *out = *in @@ -5886,16 +6331,41 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecification) DeepCopyInto(out *out = new(string) **out = **in } + if in.DeviceIndex != nil { + in, out := &in.DeviceIndex, &out.DeviceIndex + *out = new(int64) + **out = **in + } if in.InterfaceType != nil { in, out := &in.InterfaceType, &out.InterfaceType *out = new(string) **out = **in } - if in.PrivateIPAddress != nil { + if in.IPv6AddressCount != nil { + in, out := &in.IPv6AddressCount, &out.IPv6AddressCount + *out = new(int64) + **out = **in + } + if in.NetworkCardIndex != nil { + in, out := &in.NetworkCardIndex, &out.NetworkCardIndex + *out = new(int64) + **out = **in + } + if in.PrivateIPAddress != nil { in, out := &in.PrivateIPAddress, &out.PrivateIPAddress *out = new(string) **out = **in } + if in.SecondaryPrivateIPAddressCount != nil { + in, out := &in.SecondaryPrivateIPAddressCount, &out.SecondaryPrivateIPAddressCount + *out = new(int64) + **out = **in + } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateInstanceNetworkInterfaceSpecification. @@ -5931,16 +6401,41 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) DeepCopyIn *out = new(string) **out = **in } + if in.DeviceIndex != nil { + in, out := &in.DeviceIndex, &out.DeviceIndex + *out = new(int64) + **out = **in + } if in.InterfaceType != nil { in, out := &in.InterfaceType, &out.InterfaceType *out = new(string) **out = **in } + if in.IPv6AddressCount != nil { + in, out := &in.IPv6AddressCount, &out.IPv6AddressCount + *out = new(int64) + **out = **in + } + if in.NetworkCardIndex != nil { + in, out := &in.NetworkCardIndex, &out.NetworkCardIndex + *out = new(int64) + **out = **in + } if in.PrivateIPAddress != nil { in, out := &in.PrivateIPAddress, &out.PrivateIPAddress *out = new(string) **out = **in } + if in.SecondaryPrivateIPAddressCount != nil { + in, out := &in.SecondaryPrivateIPAddressCount, &out.SecondaryPrivateIPAddressCount + *out = new(int64) + **out = **in + } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateInstanceNetworkInterfaceSpecificationRequest. @@ -6051,6 +6546,11 @@ func (in *LaunchTemplatePlacement) DeepCopyInto(out *LaunchTemplatePlacement) { *out = new(string) **out = **in } + if in.PartitionNumber != nil { + in, out := &in.PartitionNumber, &out.PartitionNumber + *out = new(int64) + **out = **in + } if in.SpreadDomain != nil { in, out := &in.SpreadDomain, &out.SpreadDomain *out = new(string) @@ -6091,6 +6591,11 @@ func (in *LaunchTemplatePlacementRequest) DeepCopyInto(out *LaunchTemplatePlacem *out = new(string) **out = **in } + if in.PartitionNumber != nil { + in, out := &in.PartitionNumber, &out.PartitionNumber + *out = new(int64) + **out = **in + } if in.SpreadDomain != nil { in, out := &in.SpreadDomain, &out.SpreadDomain *out = new(string) @@ -6141,6 +6646,11 @@ func (in *LaunchTemplateSpecification) DeepCopy() *LaunchTemplateSpecification { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateSpotMarketOptions) DeepCopyInto(out *LaunchTemplateSpotMarketOptions) { *out = *in + if in.BlockDurationMinutes != nil { + in, out := &in.BlockDurationMinutes, &out.BlockDurationMinutes + *out = new(int64) + **out = **in + } if in.MaxPrice != nil { in, out := &in.MaxPrice, &out.MaxPrice *out = new(string) @@ -6161,6 +6671,11 @@ func (in *LaunchTemplateSpotMarketOptions) DeepCopy() *LaunchTemplateSpotMarketO // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateSpotMarketOptionsRequest) DeepCopyInto(out *LaunchTemplateSpotMarketOptionsRequest) { *out = *in + if in.BlockDurationMinutes != nil { + in, out := &in.BlockDurationMinutes, &out.BlockDurationMinutes + *out = new(int64) + **out = **in + } if in.MaxPrice != nil { in, out := &in.MaxPrice, &out.MaxPrice *out = new(string) @@ -6602,6 +7117,11 @@ func (in *LocalGatewayVirtualInterface) DeepCopyInto(out *LocalGatewayVirtualInt *out = new(string) **out = **in } + if in.LocalBGPASN != nil { + in, out := &in.LocalBGPASN, &out.LocalBGPASN + *out = new(int64) + **out = **in + } if in.LocalGatewayID != nil { in, out := &in.LocalGatewayID, &out.LocalGatewayID *out = new(string) @@ -6617,6 +7137,11 @@ func (in *LocalGatewayVirtualInterface) DeepCopyInto(out *LocalGatewayVirtualInt *out = new(string) **out = **in } + if in.PeerBGPASN != nil { + in, out := &in.PeerBGPASN, &out.PeerBGPASN + *out = new(int64) + **out = **in + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -6628,6 +7153,11 @@ func (in *LocalGatewayVirtualInterface) DeepCopyInto(out *LocalGatewayVirtualInt } } } + if in.Vlan != nil { + in, out := &in.Vlan, &out.Vlan + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalGatewayVirtualInterface. @@ -6684,6 +7214,11 @@ func (in *ManagedPrefixList) DeepCopyInto(out *ManagedPrefixList) { *out = new(string) **out = **in } + if in.MaxEntries != nil { + in, out := &in.MaxEntries, &out.MaxEntries + *out = new(int64) + **out = **in + } if in.OwnerID != nil { in, out := &in.OwnerID, &out.OwnerID *out = new(string) @@ -6730,11 +7265,41 @@ func (in *ModifyVPNTunnelOptionsSpecification) DeepCopyInto(out *ModifyVPNTunnel *out = new(string) **out = **in } + if in.DPDTimeoutSeconds != nil { + in, out := &in.DPDTimeoutSeconds, &out.DPDTimeoutSeconds + *out = new(int64) + **out = **in + } + if in.Phase1LifetimeSeconds != nil { + in, out := &in.Phase1LifetimeSeconds, &out.Phase1LifetimeSeconds + *out = new(int64) + **out = **in + } + if in.Phase2LifetimeSeconds != nil { + in, out := &in.Phase2LifetimeSeconds, &out.Phase2LifetimeSeconds + *out = new(int64) + **out = **in + } if in.PreSharedKey != nil { in, out := &in.PreSharedKey, &out.PreSharedKey *out = new(string) **out = **in } + if in.RekeyFuzzPercentage != nil { + in, out := &in.RekeyFuzzPercentage, &out.RekeyFuzzPercentage + *out = new(int64) + **out = **in + } + if in.RekeyMarginTimeSeconds != nil { + in, out := &in.RekeyMarginTimeSeconds, &out.RekeyMarginTimeSeconds + *out = new(int64) + **out = **in + } + if in.ReplayWindowSize != nil { + in, out := &in.ReplayWindowSize, &out.ReplayWindowSize + *out = new(int64) + **out = **in + } if in.StartupAction != nil { in, out := &in.StartupAction, &out.StartupAction *out = new(string) @@ -6967,6 +7532,11 @@ func (in *NetworkACLEntry) DeepCopyInto(out *NetworkACLEntry) { *out = new(string) **out = **in } + if in.RuleNumber != nil { + in, out := &in.RuleNumber, &out.RuleNumber + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkACLEntry. @@ -7023,6 +7593,11 @@ func (in *NetworkInsightsPath) DeepCopyInto(out *NetworkInsightsPath) { *out = new(string) **out = **in } + if in.DestinationPort != nil { + in, out := &in.DestinationPort, &out.DestinationPort + *out = new(int64) + **out = **in + } if in.Source != nil { in, out := &in.Source, &out.Source *out = new(string) @@ -7205,6 +7780,11 @@ func (in *NetworkInterfaceAttachment) DeepCopyInto(out *NetworkInterfaceAttachme *out = new(bool) **out = **in } + if in.DeviceIndex != nil { + in, out := &in.DeviceIndex, &out.DeviceIndex + *out = new(int64) + **out = **in + } if in.InstanceID != nil { in, out := &in.InstanceID, &out.InstanceID *out = new(string) @@ -7215,6 +7795,11 @@ func (in *NetworkInterfaceAttachment) DeepCopyInto(out *NetworkInterfaceAttachme *out = new(string) **out = **in } + if in.NetworkCardIndex != nil { + in, out := &in.NetworkCardIndex, &out.NetworkCardIndex + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterfaceAttachment. @@ -7391,6 +7976,11 @@ func (in *OnDemandOptions) DeepCopyInto(out *OnDemandOptions) { *out = new(string) **out = **in } + if in.MinTargetCapacity != nil { + in, out := &in.MinTargetCapacity, &out.MinTargetCapacity + *out = new(int64) + **out = **in + } if in.SingleAvailabilityZone != nil { in, out := &in.SingleAvailabilityZone, &out.SingleAvailabilityZone *out = new(bool) @@ -7421,6 +8011,11 @@ func (in *OnDemandOptionsRequest) DeepCopyInto(out *OnDemandOptionsRequest) { *out = new(string) **out = **in } + if in.MinTargetCapacity != nil { + in, out := &in.MinTargetCapacity, &out.MinTargetCapacity + *out = new(int64) + **out = **in + } if in.SingleAvailabilityZone != nil { in, out := &in.SingleAvailabilityZone, &out.SingleAvailabilityZone *out = new(bool) @@ -7443,6 +8038,26 @@ func (in *OnDemandOptionsRequest) DeepCopy() *OnDemandOptionsRequest { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PathComponent) DeepCopyInto(out *PathComponent) { + *out = *in + if in.SequenceNumber != nil { + in, out := &in.SequenceNumber, &out.SequenceNumber + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PathComponent. +func (in *PathComponent) DeepCopy() *PathComponent { + if in == nil { + return nil + } + out := new(PathComponent) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PciID) DeepCopyInto(out *PciID) { *out = *in @@ -7593,6 +8208,46 @@ func (in *PeeringTgwInfo) DeepCopy() *PeeringTgwInfo { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Phase1DHGroupNumbersListValue) DeepCopyInto(out *Phase1DHGroupNumbersListValue) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase1DHGroupNumbersListValue. +func (in *Phase1DHGroupNumbersListValue) DeepCopy() *Phase1DHGroupNumbersListValue { + if in == nil { + return nil + } + out := new(Phase1DHGroupNumbersListValue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Phase1DHGroupNumbersRequestListValue) DeepCopyInto(out *Phase1DHGroupNumbersRequestListValue) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase1DHGroupNumbersRequestListValue. +func (in *Phase1DHGroupNumbersRequestListValue) DeepCopy() *Phase1DHGroupNumbersRequestListValue { + if in == nil { + return nil + } + out := new(Phase1DHGroupNumbersRequestListValue) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Phase1EncryptionAlgorithmsListValue) DeepCopyInto(out *Phase1EncryptionAlgorithmsListValue) { *out = *in @@ -7673,6 +8328,46 @@ func (in *Phase1IntegrityAlgorithmsRequestListValue) DeepCopy() *Phase1Integrity return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Phase2DHGroupNumbersListValue) DeepCopyInto(out *Phase2DHGroupNumbersListValue) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase2DHGroupNumbersListValue. +func (in *Phase2DHGroupNumbersListValue) DeepCopy() *Phase2DHGroupNumbersListValue { + if in == nil { + return nil + } + out := new(Phase2DHGroupNumbersListValue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Phase2DHGroupNumbersRequestListValue) DeepCopyInto(out *Phase2DHGroupNumbersRequestListValue) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase2DHGroupNumbersRequestListValue. +func (in *Phase2DHGroupNumbersRequestListValue) DeepCopy() *Phase2DHGroupNumbersRequestListValue { + if in == nil { + return nil + } + out := new(Phase2DHGroupNumbersRequestListValue) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Phase2EncryptionAlgorithmsListValue) DeepCopyInto(out *Phase2EncryptionAlgorithmsListValue) { *out = *in @@ -7781,6 +8476,11 @@ func (in *Placement) DeepCopyInto(out *Placement) { *out = new(string) **out = **in } + if in.PartitionNumber != nil { + in, out := &in.PartitionNumber, &out.PartitionNumber + *out = new(int64) + **out = **in + } if in.SpreadDomain != nil { in, out := &in.SpreadDomain, &out.SpreadDomain *out = new(string) @@ -7816,6 +8516,11 @@ func (in *PlacementGroup) DeepCopyInto(out *PlacementGroup) { *out = new(string) **out = **in } + if in.PartitionCount != nil { + in, out := &in.PartitionCount, &out.PartitionCount + *out = new(int64) + **out = **in + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -7879,6 +8584,31 @@ func (in *PoolCIDRBlock) DeepCopy() *PoolCIDRBlock { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortRange) DeepCopyInto(out *PortRange) { + *out = *in + if in.From != nil { + in, out := &in.From, &out.From + *out = new(int64) + **out = **in + } + if in.To != nil { + in, out := &in.To, &out.To + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRange. +func (in *PortRange) DeepCopy() *PortRange { + if in == nil { + return nil + } + out := new(PortRange) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PrefixList) DeepCopyInto(out *PrefixList) { *out = *in @@ -8010,6 +8740,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 *PricingDetail) DeepCopyInto(out *PricingDetail) { + *out = *in + if in.Count != nil { + in, out := &in.Count, &out.Count + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PricingDetail. +func (in *PricingDetail) DeepCopy() *PricingDetail { + if in == nil { + return nil + } + out := new(PricingDetail) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PrincipalIDFormat) DeepCopyInto(out *PrincipalIDFormat) { *out = *in @@ -8234,6 +8984,16 @@ func (in *PublicIPv4Pool) DeepCopyInto(out *PublicIPv4Pool) { } } } + if in.TotalAddressCount != nil { + in, out := &in.TotalAddressCount, &out.TotalAddressCount + *out = new(int64) + **out = **in + } + if in.TotalAvailableAddressCount != nil { + in, out := &in.TotalAvailableAddressCount, &out.TotalAvailableAddressCount + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PublicIPv4Pool. @@ -8249,6 +9009,16 @@ func (in *PublicIPv4Pool) DeepCopy() *PublicIPv4Pool { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PublicIPv4PoolRange) DeepCopyInto(out *PublicIPv4PoolRange) { *out = *in + if in.AddressCount != nil { + in, out := &in.AddressCount, &out.AddressCount + *out = new(int64) + **out = **in + } + if in.AvailableAddressCount != nil { + in, out := &in.AvailableAddressCount, &out.AvailableAddressCount + *out = new(int64) + **out = **in + } if in.FirstAddress != nil { in, out := &in.FirstAddress, &out.FirstAddress *out = new(string) @@ -8274,6 +9044,11 @@ func (in *PublicIPv4PoolRange) DeepCopy() *PublicIPv4PoolRange { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Purchase) DeepCopyInto(out *Purchase) { *out = *in + if in.Duration != nil { + in, out := &in.Duration, &out.Duration + *out = new(int64) + **out = **in + } if in.HostReservationID != nil { in, out := &in.HostReservationID, &out.HostReservationID *out = new(string) @@ -8309,6 +9084,11 @@ func (in *Purchase) DeepCopy() *Purchase { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PurchaseRequest) DeepCopyInto(out *PurchaseRequest) { *out = *in + if in.InstanceCount != nil { + in, out := &in.InstanceCount, &out.InstanceCount + *out = new(int64) + **out = **in + } if in.PurchaseToken != nil { in, out := &in.PurchaseToken, &out.PurchaseToken *out = new(string) @@ -8439,6 +9219,11 @@ func (in *RequestSpotLaunchSpecification) DeepCopyInto(out *RequestSpotLaunchSpe *out = new(bool) **out = **in } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *out = new(string) + **out = **in + } if in.UserData != nil { in, out := &in.UserData, &out.UserData *out = new(string) @@ -8514,6 +9299,11 @@ func (in *ReservedInstances) DeepCopyInto(out *ReservedInstances) { *out = new(string) **out = **in } + 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) @@ -8555,6 +9345,11 @@ func (in *ReservedInstancesConfiguration) DeepCopyInto(out *ReservedInstancesCon *out = new(string) **out = **in } + if in.InstanceCount != nil { + in, out := &in.InstanceCount, &out.InstanceCount + *out = new(int64) + **out = **in + } if in.Platform != nil { in, out := &in.Platform, &out.Platform *out = new(string) @@ -9064,6 +9859,11 @@ func (in *ScheduledInstance) DeepCopyInto(out *ScheduledInstance) { *out = new(string) **out = **in } + if in.InstanceCount != nil { + in, out := &in.InstanceCount, &out.InstanceCount + *out = new(int64) + **out = **in + } if in.InstanceType != nil { in, out := &in.InstanceType, &out.InstanceType *out = new(string) @@ -9084,6 +9884,16 @@ func (in *ScheduledInstance) DeepCopyInto(out *ScheduledInstance) { *out = new(string) **out = **in } + if in.SlotDurationInHours != nil { + in, out := &in.SlotDurationInHours, &out.SlotDurationInHours + *out = new(int64) + **out = **in + } + if in.TotalScheduledInstanceHours != nil { + in, out := &in.TotalScheduledInstanceHours, &out.TotalScheduledInstanceHours + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledInstance. @@ -9104,6 +9914,11 @@ func (in *ScheduledInstanceAvailability) DeepCopyInto(out *ScheduledInstanceAvai *out = new(string) **out = **in } + if in.AvailableInstanceCount != nil { + in, out := &in.AvailableInstanceCount, &out.AvailableInstanceCount + *out = new(int64) + **out = **in + } if in.HourlyPrice != nil { in, out := &in.HourlyPrice, &out.HourlyPrice *out = new(string) @@ -9114,6 +9929,16 @@ func (in *ScheduledInstanceAvailability) DeepCopyInto(out *ScheduledInstanceAvai *out = new(string) **out = **in } + if in.MaxTermDurationInDays != nil { + in, out := &in.MaxTermDurationInDays, &out.MaxTermDurationInDays + *out = new(int64) + **out = **in + } + if in.MinTermDurationInDays != nil { + in, out := &in.MinTermDurationInDays, &out.MinTermDurationInDays + *out = new(int64) + **out = **in + } if in.NetworkPlatform != nil { in, out := &in.NetworkPlatform, &out.NetworkPlatform *out = new(string) @@ -9129,6 +9954,16 @@ func (in *ScheduledInstanceAvailability) DeepCopyInto(out *ScheduledInstanceAvai *out = new(string) **out = **in } + if in.SlotDurationInHours != nil { + in, out := &in.SlotDurationInHours, &out.SlotDurationInHours + *out = new(int64) + **out = **in + } + if in.TotalScheduledInstanceHours != nil { + in, out := &in.TotalScheduledInstanceHours, &out.TotalScheduledInstanceHours + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledInstanceAvailability. @@ -9149,6 +9984,11 @@ func (in *ScheduledInstanceRecurrence) DeepCopyInto(out *ScheduledInstanceRecurr *out = new(string) **out = **in } + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(int64) + **out = **in + } if in.OccurrenceRelativeToEnd != nil { in, out := &in.OccurrenceRelativeToEnd, &out.OccurrenceRelativeToEnd *out = new(bool) @@ -9179,6 +10019,11 @@ func (in *ScheduledInstanceRecurrenceRequest) DeepCopyInto(out *ScheduledInstanc *out = new(string) **out = **in } + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(int64) + **out = **in + } if in.OccurrenceRelativeToEnd != nil { in, out := &in.OccurrenceRelativeToEnd, &out.OccurrenceRelativeToEnd *out = new(bool) @@ -9244,6 +10089,16 @@ func (in *ScheduledInstancesEBS) DeepCopyInto(out *ScheduledInstancesEBS) { *out = new(bool) **out = **in } + if in.IOPS != nil { + in, out := &in.IOPS, &out.IOPS + *out = new(int64) + **out = **in + } + if in.VolumeSize != nil { + in, out := &in.VolumeSize, &out.VolumeSize + *out = new(int64) + **out = **in + } if in.VolumeType != nil { in, out := &in.VolumeType, &out.VolumeType *out = new(string) @@ -9299,6 +10154,11 @@ func (in *ScheduledInstancesLaunchSpecification) DeepCopyInto(out *ScheduledInst *out = new(string) **out = **in } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *out = new(string) + **out = **in + } if in.UserData != nil { in, out := &in.UserData, &out.UserData *out = new(string) @@ -9354,11 +10214,31 @@ func (in *ScheduledInstancesNetworkInterface) DeepCopyInto(out *ScheduledInstanc *out = new(string) **out = **in } + if in.DeviceIndex != nil { + in, out := &in.DeviceIndex, &out.DeviceIndex + *out = new(int64) + **out = **in + } + if in.IPv6AddressCount != nil { + in, out := &in.IPv6AddressCount, &out.IPv6AddressCount + *out = new(int64) + **out = **in + } if in.PrivateIPAddress != nil { in, out := &in.PrivateIPAddress, &out.PrivateIPAddress *out = new(string) **out = **in } + if in.SecondaryPrivateIPAddressCount != nil { + in, out := &in.SecondaryPrivateIPAddressCount, &out.SecondaryPrivateIPAddressCount + *out = new(int64) + **out = **in + } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledInstancesNetworkInterface. @@ -9834,6 +10714,11 @@ func (in *SnapshotInfo) DeepCopyInto(out *SnapshotInfo) { *out = new(string) **out = **in } + if in.VolumeSize != nil { + in, out := &in.VolumeSize, &out.VolumeSize + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotInfo. @@ -10060,11 +10945,21 @@ func (in *SpotFleetRequestConfigData) DeepCopyInto(out *SpotFleetRequestConfigDa *out = new(string) **out = **in } + if in.InstancePoolsToUseCount != nil { + in, out := &in.InstancePoolsToUseCount, &out.InstancePoolsToUseCount + *out = new(int64) + **out = **in + } if in.OnDemandMaxTotalPrice != nil { in, out := &in.OnDemandMaxTotalPrice, &out.OnDemandMaxTotalPrice *out = new(string) **out = **in } + if in.OnDemandTargetCapacity != nil { + in, out := &in.OnDemandTargetCapacity, &out.OnDemandTargetCapacity + *out = new(int64) + **out = **in + } if in.ReplaceUnhealthyInstances != nil { in, out := &in.ReplaceUnhealthyInstances, &out.ReplaceUnhealthyInstances *out = new(bool) @@ -10091,6 +10986,11 @@ func (in *SpotFleetRequestConfigData) DeepCopyInto(out *SpotFleetRequestConfigDa } } } + if in.TargetCapacity != nil { + in, out := &in.TargetCapacity, &out.TargetCapacity + *out = new(int64) + **out = **in + } if in.TerminateInstancesWithExpiration != nil { in, out := &in.TerminateInstancesWithExpiration, &out.TerminateInstancesWithExpiration *out = new(bool) @@ -10152,6 +11052,11 @@ func (in *SpotInstanceRequest) DeepCopyInto(out *SpotInstanceRequest) { *out = new(string) **out = **in } + if in.BlockDurationMinutes != nil { + in, out := &in.BlockDurationMinutes, &out.BlockDurationMinutes + *out = new(int64) + **out = **in + } if in.LaunchGroup != nil { in, out := &in.LaunchGroup, &out.LaunchGroup *out = new(string) @@ -10248,6 +11153,11 @@ func (in *SpotInstanceStatus) DeepCopy() *SpotInstanceStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SpotMarketOptions) DeepCopyInto(out *SpotMarketOptions) { *out = *in + if in.BlockDurationMinutes != nil { + in, out := &in.BlockDurationMinutes, &out.BlockDurationMinutes + *out = new(int64) + **out = **in + } if in.MaxPrice != nil { in, out := &in.MaxPrice, &out.MaxPrice *out = new(string) @@ -10268,11 +11178,21 @@ func (in *SpotMarketOptions) DeepCopy() *SpotMarketOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SpotOptions) DeepCopyInto(out *SpotOptions) { *out = *in + if in.InstancePoolsToUseCount != nil { + in, out := &in.InstancePoolsToUseCount, &out.InstancePoolsToUseCount + *out = new(int64) + **out = **in + } if in.MaxTotalPrice != nil { in, out := &in.MaxTotalPrice, &out.MaxTotalPrice *out = new(string) **out = **in } + if in.MinTargetCapacity != nil { + in, out := &in.MinTargetCapacity, &out.MinTargetCapacity + *out = new(int64) + **out = **in + } if in.SingleAvailabilityZone != nil { in, out := &in.SingleAvailabilityZone, &out.SingleAvailabilityZone *out = new(bool) @@ -10298,11 +11218,21 @@ func (in *SpotOptions) DeepCopy() *SpotOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SpotOptionsRequest) DeepCopyInto(out *SpotOptionsRequest) { *out = *in + if in.InstancePoolsToUseCount != nil { + in, out := &in.InstancePoolsToUseCount, &out.InstancePoolsToUseCount + *out = new(int64) + **out = **in + } if in.MaxTotalPrice != nil { in, out := &in.MaxTotalPrice, &out.MaxTotalPrice *out = new(string) **out = **in } + if in.MinTargetCapacity != nil { + in, out := &in.MinTargetCapacity, &out.MinTargetCapacity + *out = new(int64) + **out = **in + } if in.SingleAvailabilityZone != nil { in, out := &in.SingleAvailabilityZone, &out.SingleAvailabilityZone *out = new(bool) @@ -10383,11 +11313,21 @@ func (in *SpotPrice) DeepCopy() *SpotPrice { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StaleIPPermission) DeepCopyInto(out *StaleIPPermission) { *out = *in + if in.FromPort != nil { + in, out := &in.FromPort, &out.FromPort + *out = new(int64) + **out = **in + } if in.IPProtocol != nil { in, out := &in.IPProtocol, &out.IPProtocol *out = new(string) **out = **in } + if in.ToPort != nil { + in, out := &in.ToPort, &out.ToPort + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StaleIPPermission. @@ -10488,11 +11428,140 @@ func (in *StorageLocation) DeepCopy() *StorageLocation { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Subnet) DeepCopyInto(out *Subnet) { *out = *in - if in.AssignIPv6AddressOnCreation != nil { - in, out := &in.AssignIPv6AddressOnCreation, &out.AssignIPv6AddressOnCreation - *out = new(bool) + 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 Subnet. +func (in *Subnet) DeepCopy() *Subnet { + if in == nil { + return nil + } + out := new(Subnet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Subnet) 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 *SubnetAssociation) DeepCopyInto(out *SubnetAssociation) { + *out = *in + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetAssociation. +func (in *SubnetAssociation) DeepCopy() *SubnetAssociation { + if in == nil { + return nil + } + out := new(SubnetAssociation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubnetCIDRBlockState) DeepCopyInto(out *SubnetCIDRBlockState) { + *out = *in + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } + if in.StatusMessage != nil { + in, out := &in.StatusMessage, &out.StatusMessage + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetCIDRBlockState. +func (in *SubnetCIDRBlockState) DeepCopy() *SubnetCIDRBlockState { + if in == nil { + return nil + } + out := new(SubnetCIDRBlockState) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubnetIPv6CIDRBlockAssociation) DeepCopyInto(out *SubnetIPv6CIDRBlockAssociation) { + *out = *in + if in.AssociationID != nil { + in, out := &in.AssociationID, &out.AssociationID + *out = new(string) + **out = **in + } + if in.IPv6CIDRBlock != nil { + in, out := &in.IPv6CIDRBlock, &out.IPv6CIDRBlock + *out = new(string) **out = **in } + if in.IPv6CIDRBlockState != nil { + in, out := &in.IPv6CIDRBlockState, &out.IPv6CIDRBlockState + *out = new(SubnetCIDRBlockState) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetIPv6CIDRBlockAssociation. +func (in *SubnetIPv6CIDRBlockAssociation) DeepCopy() *SubnetIPv6CIDRBlockAssociation { + if in == nil { + return nil + } + out := new(SubnetIPv6CIDRBlockAssociation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubnetList) DeepCopyInto(out *SubnetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Subnet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetList. +func (in *SubnetList) DeepCopy() *SubnetList { + if in == nil { + return nil + } + out := new(SubnetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SubnetList) 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 *SubnetSpec) DeepCopyInto(out *SubnetSpec) { + *out = *in if in.AvailabilityZone != nil { in, out := &in.AvailabilityZone, &out.AvailabilityZone *out = new(string) @@ -10508,11 +11577,94 @@ func (in *Subnet) DeepCopyInto(out *Subnet) { *out = new(string) **out = **in } + if in.IPv6CIDRBlock != nil { + in, out := &in.IPv6CIDRBlock, &out.IPv6CIDRBlock + *out = new(string) + **out = **in + } + if in.OutpostARN != nil { + in, out := &in.OutpostARN, &out.OutpostARN + *out = new(string) + **out = **in + } + 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) + } + } + } + if in.VPCID != nil { + in, out := &in.VPCID, &out.VPCID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetSpec. +func (in *SubnetSpec) DeepCopy() *SubnetSpec { + if in == nil { + return nil + } + out := new(SubnetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubnetStatus) DeepCopyInto(out *SubnetStatus) { + *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.AssignIPv6AddressOnCreation != nil { + in, out := &in.AssignIPv6AddressOnCreation, &out.AssignIPv6AddressOnCreation + *out = new(bool) + **out = **in + } + if in.AvailableIPAddressCount != nil { + in, out := &in.AvailableIPAddressCount, &out.AvailableIPAddressCount + *out = new(int64) + **out = **in + } + if in.CustomerOwnedIPv4Pool != nil { + in, out := &in.CustomerOwnedIPv4Pool, &out.CustomerOwnedIPv4Pool + *out = new(string) + **out = **in + } if in.DefaultForAZ != nil { in, out := &in.DefaultForAZ, &out.DefaultForAZ *out = new(bool) **out = **in } + if in.IPv6CIDRBlockAssociationSet != nil { + in, out := &in.IPv6CIDRBlockAssociationSet, &out.IPv6CIDRBlockAssociationSet + *out = make([]*SubnetIPv6CIDRBlockAssociation, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(SubnetIPv6CIDRBlockAssociation) + (*in).DeepCopyInto(*out) + } + } + } if in.MapCustomerOwnedIPOnLaunch != nil { in, out := &in.MapCustomerOwnedIPOnLaunch, &out.MapCustomerOwnedIPOnLaunch *out = new(bool) @@ -10523,18 +11675,13 @@ func (in *Subnet) DeepCopyInto(out *Subnet) { *out = new(bool) **out = **in } - if in.OutpostARN != nil { - in, out := &in.OutpostARN, &out.OutpostARN - *out = new(string) - **out = **in - } if in.OwnerID != nil { in, out := &in.OwnerID, &out.OwnerID *out = new(string) **out = **in } - if in.SubnetARN != nil { - in, out := &in.SubnetARN, &out.SubnetARN + if in.State != nil { + in, out := &in.State, &out.State *out = new(string) **out = **in } @@ -10554,84 +11701,126 @@ func (in *Subnet) DeepCopyInto(out *Subnet) { } } } - if in.VPCID != nil { - in, out := &in.VPCID, &out.VPCID - *out = new(string) - **out = **in - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnet. -func (in *Subnet) DeepCopy() *Subnet { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetStatus. +func (in *SubnetStatus) DeepCopy() *SubnetStatus { if in == nil { return nil } - out := new(Subnet) + out := new(SubnetStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SubnetAssociation) DeepCopyInto(out *SubnetAssociation) { +func (in *Subnet_SDK) DeepCopyInto(out *Subnet_SDK) { *out = *in - if in.SubnetID != nil { - in, out := &in.SubnetID, &out.SubnetID + if in.AssignIPv6AddressOnCreation != nil { + in, out := &in.AssignIPv6AddressOnCreation, &out.AssignIPv6AddressOnCreation + *out = new(bool) + **out = **in + } + if in.AvailabilityZone != nil { + in, out := &in.AvailabilityZone, &out.AvailabilityZone *out = new(string) **out = **in } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetAssociation. -func (in *SubnetAssociation) DeepCopy() *SubnetAssociation { - if in == nil { - return nil + if in.AvailabilityZoneID != nil { + in, out := &in.AvailabilityZoneID, &out.AvailabilityZoneID + *out = new(string) + **out = **in } - out := new(SubnetAssociation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SubnetCIDRBlockState) DeepCopyInto(out *SubnetCIDRBlockState) { - *out = *in - if in.StatusMessage != nil { - in, out := &in.StatusMessage, &out.StatusMessage + if in.AvailableIPAddressCount != nil { + in, out := &in.AvailableIPAddressCount, &out.AvailableIPAddressCount + *out = new(int64) + **out = **in + } + if in.CIDRBlock != nil { + in, out := &in.CIDRBlock, &out.CIDRBlock *out = new(string) **out = **in } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetCIDRBlockState. -func (in *SubnetCIDRBlockState) DeepCopy() *SubnetCIDRBlockState { - if in == nil { - return nil + if in.CustomerOwnedIPv4Pool != nil { + in, out := &in.CustomerOwnedIPv4Pool, &out.CustomerOwnedIPv4Pool + *out = new(string) + **out = **in } - out := new(SubnetCIDRBlockState) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SubnetIPv6CIDRBlockAssociation) DeepCopyInto(out *SubnetIPv6CIDRBlockAssociation) { - *out = *in - if in.AssociationID != nil { - in, out := &in.AssociationID, &out.AssociationID + if in.DefaultForAZ != nil { + in, out := &in.DefaultForAZ, &out.DefaultForAZ + *out = new(bool) + **out = **in + } + if in.IPv6CIDRBlockAssociationSet != nil { + in, out := &in.IPv6CIDRBlockAssociationSet, &out.IPv6CIDRBlockAssociationSet + *out = make([]*SubnetIPv6CIDRBlockAssociation, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(SubnetIPv6CIDRBlockAssociation) + (*in).DeepCopyInto(*out) + } + } + } + if in.MapCustomerOwnedIPOnLaunch != nil { + in, out := &in.MapCustomerOwnedIPOnLaunch, &out.MapCustomerOwnedIPOnLaunch + *out = new(bool) + **out = **in + } + if in.MapPublicIPOnLaunch != nil { + in, out := &in.MapPublicIPOnLaunch, &out.MapPublicIPOnLaunch + *out = new(bool) + **out = **in + } + if in.OutpostARN != nil { + in, out := &in.OutpostARN, &out.OutpostARN *out = new(string) **out = **in } - if in.IPv6CIDRBlock != nil { - in, out := &in.IPv6CIDRBlock, &out.IPv6CIDRBlock + 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.SubnetARN != nil { + in, out := &in.SubnetARN, &out.SubnetARN + *out = new(string) + **out = **in + } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *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.VPCID != nil { + in, out := &in.VPCID, &out.VPCID *out = new(string) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetIPv6CIDRBlockAssociation. -func (in *SubnetIPv6CIDRBlockAssociation) DeepCopy() *SubnetIPv6CIDRBlockAssociation { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnet_SDK. +func (in *Subnet_SDK) DeepCopy() *Subnet_SDK { if in == nil { return nil } - out := new(SubnetIPv6CIDRBlockAssociation) + out := new(Subnet_SDK) in.DeepCopyInto(out) return out } @@ -10767,9 +11956,74 @@ func (in *TagSpecification) DeepCopy() *TagSpecification { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetCapacitySpecification) DeepCopyInto(out *TargetCapacitySpecification) { + *out = *in + if in.OnDemandTargetCapacity != nil { + in, out := &in.OnDemandTargetCapacity, &out.OnDemandTargetCapacity + *out = new(int64) + **out = **in + } + if in.SpotTargetCapacity != nil { + in, out := &in.SpotTargetCapacity, &out.SpotTargetCapacity + *out = new(int64) + **out = **in + } + if in.TotalTargetCapacity != nil { + in, out := &in.TotalTargetCapacity, &out.TotalTargetCapacity + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetCapacitySpecification. +func (in *TargetCapacitySpecification) DeepCopy() *TargetCapacitySpecification { + if in == nil { + return nil + } + out := new(TargetCapacitySpecification) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetCapacitySpecificationRequest) DeepCopyInto(out *TargetCapacitySpecificationRequest) { + *out = *in + if in.OnDemandTargetCapacity != nil { + in, out := &in.OnDemandTargetCapacity, &out.OnDemandTargetCapacity + *out = new(int64) + **out = **in + } + if in.SpotTargetCapacity != nil { + in, out := &in.SpotTargetCapacity, &out.SpotTargetCapacity + *out = new(int64) + **out = **in + } + if in.TotalTargetCapacity != nil { + in, out := &in.TotalTargetCapacity, &out.TotalTargetCapacity + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetCapacitySpecificationRequest. +func (in *TargetCapacitySpecificationRequest) DeepCopy() *TargetCapacitySpecificationRequest { + if in == nil { + return nil + } + out := new(TargetCapacitySpecificationRequest) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TargetConfiguration) DeepCopyInto(out *TargetConfiguration) { *out = *in + if in.InstanceCount != nil { + in, out := &in.InstanceCount, &out.InstanceCount + *out = new(int64) + **out = **in + } if in.OfferingID != nil { in, out := &in.OfferingID, &out.OfferingID *out = new(string) @@ -10787,6 +12041,26 @@ func (in *TargetConfiguration) DeepCopy() *TargetConfiguration { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetConfigurationRequest) DeepCopyInto(out *TargetConfigurationRequest) { + *out = *in + if in.InstanceCount != nil { + in, out := &in.InstanceCount, &out.InstanceCount + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetConfigurationRequest. +func (in *TargetConfigurationRequest) DeepCopy() *TargetConfigurationRequest { + if in == nil { + return nil + } + out := new(TargetConfigurationRequest) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TargetGroup) DeepCopyInto(out *TargetGroup) { *out = *in @@ -10922,6 +12196,16 @@ func (in *TrafficMirrorFilterRule) DeepCopyInto(out *TrafficMirrorFilterRule) { *out = new(string) **out = **in } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(int64) + **out = **in + } + if in.RuleNumber != nil { + in, out := &in.RuleNumber, &out.RuleNumber + *out = new(int64) + **out = **in + } if in.SourceCIDRBlock != nil { in, out := &in.SourceCIDRBlock, &out.SourceCIDRBlock *out = new(string) @@ -10949,6 +12233,56 @@ func (in *TrafficMirrorFilterRule) DeepCopy() *TrafficMirrorFilterRule { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TrafficMirrorPortRange) DeepCopyInto(out *TrafficMirrorPortRange) { + *out = *in + if in.FromPort != nil { + in, out := &in.FromPort, &out.FromPort + *out = new(int64) + **out = **in + } + if in.ToPort != nil { + in, out := &in.ToPort, &out.ToPort + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficMirrorPortRange. +func (in *TrafficMirrorPortRange) DeepCopy() *TrafficMirrorPortRange { + if in == nil { + return nil + } + out := new(TrafficMirrorPortRange) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TrafficMirrorPortRangeRequest) DeepCopyInto(out *TrafficMirrorPortRangeRequest) { + *out = *in + if in.FromPort != nil { + in, out := &in.FromPort, &out.FromPort + *out = new(int64) + **out = **in + } + if in.ToPort != nil { + in, out := &in.ToPort, &out.ToPort + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficMirrorPortRangeRequest. +func (in *TrafficMirrorPortRangeRequest) DeepCopy() *TrafficMirrorPortRangeRequest { + if in == nil { + return nil + } + out := new(TrafficMirrorPortRangeRequest) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TrafficMirrorSession) DeepCopyInto(out *TrafficMirrorSession) { *out = *in @@ -10967,6 +12301,16 @@ func (in *TrafficMirrorSession) DeepCopyInto(out *TrafficMirrorSession) { *out = new(string) **out = **in } + if in.PacketLength != nil { + in, out := &in.PacketLength, &out.PacketLength + *out = new(int64) + **out = **in + } + if in.SessionNumber != nil { + in, out := &in.SessionNumber, &out.SessionNumber + *out = new(int64) + **out = **in + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -10993,6 +12337,11 @@ func (in *TrafficMirrorSession) DeepCopyInto(out *TrafficMirrorSession) { *out = new(string) **out = **in } + if in.VirtualNetworkID != nil { + in, out := &in.VirtualNetworkID, &out.VirtualNetworkID + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficMirrorSession. @@ -11968,16 +13317,46 @@ func (in *TunnelOption) DeepCopyInto(out *TunnelOption) { *out = new(string) **out = **in } + if in.DPDTimeoutSeconds != nil { + in, out := &in.DPDTimeoutSeconds, &out.DPDTimeoutSeconds + *out = new(int64) + **out = **in + } if in.OutsideIPAddress != nil { in, out := &in.OutsideIPAddress, &out.OutsideIPAddress *out = new(string) **out = **in } + if in.Phase1LifetimeSeconds != nil { + in, out := &in.Phase1LifetimeSeconds, &out.Phase1LifetimeSeconds + *out = new(int64) + **out = **in + } + if in.Phase2LifetimeSeconds != nil { + in, out := &in.Phase2LifetimeSeconds, &out.Phase2LifetimeSeconds + *out = new(int64) + **out = **in + } if in.PreSharedKey != nil { in, out := &in.PreSharedKey, &out.PreSharedKey *out = new(string) **out = **in } + if in.RekeyFuzzPercentage != nil { + in, out := &in.RekeyFuzzPercentage, &out.RekeyFuzzPercentage + *out = new(int64) + **out = **in + } + if in.RekeyMarginTimeSeconds != nil { + in, out := &in.RekeyMarginTimeSeconds, &out.RekeyMarginTimeSeconds + *out = new(int64) + **out = **in + } + if in.ReplayWindowSize != nil { + in, out := &in.ReplayWindowSize, &out.ReplayWindowSize + *out = new(int64) + **out = **in + } if in.StartupAction != nil { in, out := &in.StartupAction, &out.StartupAction *out = new(string) @@ -12213,6 +13592,11 @@ func (in *UserIDGroupPair) DeepCopy() *UserIDGroupPair { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VGWTelemetry) DeepCopyInto(out *VGWTelemetry) { *out = *in + if in.AcceptedRouteCount != nil { + in, out := &in.AcceptedRouteCount, &out.AcceptedRouteCount + *out = new(int64) + **out = **in + } if in.CertificateARN != nil { in, out := &in.CertificateARN, &out.CertificateARN *out = new(string) @@ -13150,11 +14534,41 @@ func (in *VPNTunnelOptionsSpecification) DeepCopyInto(out *VPNTunnelOptionsSpeci *out = new(string) **out = **in } + if in.DPDTimeoutSeconds != nil { + in, out := &in.DPDTimeoutSeconds, &out.DPDTimeoutSeconds + *out = new(int64) + **out = **in + } + if in.Phase1LifetimeSeconds != nil { + in, out := &in.Phase1LifetimeSeconds, &out.Phase1LifetimeSeconds + *out = new(int64) + **out = **in + } + if in.Phase2LifetimeSeconds != nil { + in, out := &in.Phase2LifetimeSeconds, &out.Phase2LifetimeSeconds + *out = new(int64) + **out = **in + } if in.PreSharedKey != nil { in, out := &in.PreSharedKey, &out.PreSharedKey *out = new(string) **out = **in } + if in.RekeyFuzzPercentage != nil { + in, out := &in.RekeyFuzzPercentage, &out.RekeyFuzzPercentage + *out = new(int64) + **out = **in + } + if in.RekeyMarginTimeSeconds != nil { + in, out := &in.RekeyMarginTimeSeconds, &out.RekeyMarginTimeSeconds + *out = new(int64) + **out = **in + } + if in.ReplayWindowSize != nil { + in, out := &in.ReplayWindowSize, &out.ReplayWindowSize + *out = new(int64) + **out = **in + } if in.StartupAction != nil { in, out := &in.StartupAction, &out.StartupAction *out = new(string) @@ -13210,21 +14624,51 @@ func (in *ValidationError) DeepCopy() *ValidationError { // 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.OriginalIOPS != nil { + in, out := &in.OriginalIOPS, &out.OriginalIOPS + *out = new(int64) + **out = **in + } if in.OriginalMultiAttachEnabled != nil { in, out := &in.OriginalMultiAttachEnabled, &out.OriginalMultiAttachEnabled *out = new(bool) **out = **in } + if in.OriginalSize != nil { + in, out := &in.OriginalSize, &out.OriginalSize + *out = new(int64) + **out = **in + } + if in.OriginalThroughput != nil { + in, out := &in.OriginalThroughput, &out.OriginalThroughput + *out = new(int64) + **out = **in + } if in.StatusMessage != nil { in, out := &in.StatusMessage, &out.StatusMessage *out = new(string) **out = **in } + if in.TargetIOPS != nil { + in, out := &in.TargetIOPS, &out.TargetIOPS + *out = new(int64) + **out = **in + } if in.TargetMultiAttachEnabled != nil { in, out := &in.TargetMultiAttachEnabled, &out.TargetMultiAttachEnabled *out = new(bool) **out = **in } + if in.TargetSize != nil { + in, out := &in.TargetSize, &out.TargetSize + *out = new(int64) + **out = **in + } + if in.TargetThroughput != nil { + in, out := &in.TargetThroughput, &out.TargetThroughput + *out = new(int64) + **out = **in + } if in.VolumeID != nil { in, out := &in.VolumeID, &out.VolumeID *out = new(string) diff --git a/cmd/controller/main.go b/cmd/controller/main.go index 0b831c64..7dcaab16 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -32,6 +32,7 @@ import ( svcresource "github.com/aws-controllers-k8s/ec2-controller/pkg/resource" ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" + _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/subnet" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/vpc" ) diff --git a/config/crd/bases/ec2.services.k8s.aws_subnets.yaml b/config/crd/bases/ec2.services.k8s.aws_subnets.yaml new file mode 100644 index 00000000..e8c62a99 --- /dev/null +++ b/config/crd/bases/ec2.services.k8s.aws_subnets.yaml @@ -0,0 +1,234 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.1 + creationTimestamp: null + name: subnets.ec2.services.k8s.aws +spec: + group: ec2.services.k8s.aws + names: + kind: Subnet + listKind: SubnetList + plural: subnets + singular: subnet + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Subnet is the Schema for the Subnets 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: "SubnetSpec defines the desired state of Subnet. \n Describes + a subnet." + properties: + availabilityZone: + description: "The Availability Zone or Local Zone for the subnet. + \n Default: AWS selects one for you. If you create more than one + subnet in your VPC, we do not necessarily select a different zone + for each subnet. \n To create a subnet in a Local Zone, set this + value to the Local Zone ID, for example us-west-2-lax-1a. For information + about the Regions that support Local Zones, see Available Regions + (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions) + in the Amazon Elastic Compute Cloud User Guide. \n To create a subnet + in an Outpost, set this value to the Availability Zone for the Outpost + and specify the Outpost ARN." + type: string + availabilityZoneID: + description: The AZ ID or the Local Zone ID of the subnet. + type: string + cidrBlock: + description: The IPv4 network range for the subnet, in CIDR notation. + For example, 10.0.0.0/24. We modify the specified CIDR block to + its canonical form; for example, if you specify 100.68.0.18/18, + we modify it to 100.68.0.0/18. + type: string + ipv6CIDRBlock: + description: The IPv6 network range for the subnet, in CIDR notation. + The subnet size must use a /64 prefix length. + type: string + outpostARN: + description: The Amazon Resource Name (ARN) of the Outpost. If you + specify an Outpost ARN, you must also specify the Availability Zone + of the Outpost subnet. + type: string + tagSpecifications: + description: The tags to assign to the subnet. + 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 + vpcID: + description: The ID of the VPC. + type: string + required: + - cidrBlock + - vpcID + type: object + status: + description: SubnetStatus defines the observed state of Subnet + 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 + assignIPv6AddressOnCreation: + description: Indicates whether a network interface created in this + subnet (including a network interface created by RunInstances) receives + an IPv6 address. + type: boolean + availableIPAddressCount: + description: The number of unused private IPv4 addresses in the subnet. + The IPv4 addresses for any stopped instances are considered unavailable. + format: int64 + type: integer + 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 + customerOwnedIPv4Pool: + description: The customer-owned IPv4 address pool associated with + the subnet. + type: string + defaultForAZ: + description: Indicates whether this is the default subnet for the + Availability Zone. + type: boolean + ipv6CIDRBlockAssociationSet: + description: Information about the IPv6 CIDR blocks associated with + the subnet. + items: + description: Describes an IPv6 CIDR block associated with a subnet. + properties: + associationID: + type: string + ipv6CIDRBlock: + type: string + ipv6CIDRBlockState: + description: Describes the state of a CIDR block. + properties: + state: + type: string + statusMessage: + type: string + type: object + type: object + type: array + mapCustomerOwnedIPOnLaunch: + description: Indicates whether a network interface created in this + subnet (including a network interface created by RunInstances) receives + a customer-owned IPv4 address. + type: boolean + mapPublicIPOnLaunch: + description: Indicates whether instances launched in this subnet receive + a public IPv4 address. + type: boolean + ownerID: + description: The ID of the AWS account that owns the subnet. + type: string + state: + description: The current state of the subnet. + type: string + subnetID: + description: The ID of the subnet. + type: string + tags: + description: Any tags assigned to the subnet. + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array + 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 041240b8..f60a0e39 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -3,4 +3,5 @@ kind: Kustomization bases: - common resources: + - bases/ec2.services.k8s.aws_subnets.yaml - bases/ec2.services.k8s.aws_vpcs.yaml diff --git a/config/rbac/cluster-role-controller.yaml b/config/rbac/cluster-role-controller.yaml index 66c4e459..bd6faab3 100644 --- a/config/rbac/cluster-role-controller.yaml +++ b/config/rbac/cluster-role-controller.yaml @@ -22,6 +22,26 @@ rules: - get - list - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - subnets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - subnets/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 8c16203d..2b69d5b4 100644 --- a/config/rbac/role-reader.yaml +++ b/config/rbac/role-reader.yaml @@ -9,6 +9,7 @@ rules: - apiGroups: - ec2.services.k8s.aws resources: + - subnets - vpcs verbs: - get diff --git a/config/rbac/role-writer.yaml b/config/rbac/role-writer.yaml index 2721353e..425bb80a 100644 --- a/config/rbac/role-writer.yaml +++ b/config/rbac/role-writer.yaml @@ -9,6 +9,7 @@ rules: - apiGroups: - ec2.services.k8s.aws resources: + - subnets - vpcs verbs: - create @@ -21,6 +22,7 @@ rules: - apiGroups: - ec2.services.k8s.aws resources: + - subnets - vpcs verbs: - get diff --git a/generator.yaml b/generator.yaml index 3c3e531f..7866b532 100644 --- a/generator.yaml +++ b/generator.yaml @@ -1,6 +1,7 @@ ignore: field_paths: - CreateVpcInput.DryRun + - CreateSubnetInput.DryRun resource_names: - AccountAttribute - CapacityReservation @@ -36,7 +37,7 @@ ignore: - SecurityGroup - Snapshot - SpotDatafeedSubscription - - Subnet + #- Subnet - TrafficMirrorFilterRule - TrafficMirrorFilter - TrafficMirrorSession diff --git a/pkg/resource/subnet/delta.go b/pkg/resource/subnet/delta.go new file mode 100644 index 00000000..ad9938c0 --- /dev/null +++ b/pkg/resource/subnet/delta.go @@ -0,0 +1,80 @@ +// 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 subnet + +import ( + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" +) + +// 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.AvailabilityZone, b.ko.Spec.AvailabilityZone) { + delta.Add("Spec.AvailabilityZone", a.ko.Spec.AvailabilityZone, b.ko.Spec.AvailabilityZone) + } else if a.ko.Spec.AvailabilityZone != nil && b.ko.Spec.AvailabilityZone != nil { + if *a.ko.Spec.AvailabilityZone != *b.ko.Spec.AvailabilityZone { + delta.Add("Spec.AvailabilityZone", a.ko.Spec.AvailabilityZone, b.ko.Spec.AvailabilityZone) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.AvailabilityZoneID, b.ko.Spec.AvailabilityZoneID) { + delta.Add("Spec.AvailabilityZoneID", a.ko.Spec.AvailabilityZoneID, b.ko.Spec.AvailabilityZoneID) + } else if a.ko.Spec.AvailabilityZoneID != nil && b.ko.Spec.AvailabilityZoneID != nil { + if *a.ko.Spec.AvailabilityZoneID != *b.ko.Spec.AvailabilityZoneID { + delta.Add("Spec.AvailabilityZoneID", a.ko.Spec.AvailabilityZoneID, b.ko.Spec.AvailabilityZoneID) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.CIDRBlock, b.ko.Spec.CIDRBlock) { + delta.Add("Spec.CIDRBlock", a.ko.Spec.CIDRBlock, b.ko.Spec.CIDRBlock) + } else if a.ko.Spec.CIDRBlock != nil && b.ko.Spec.CIDRBlock != nil { + if *a.ko.Spec.CIDRBlock != *b.ko.Spec.CIDRBlock { + delta.Add("Spec.CIDRBlock", a.ko.Spec.CIDRBlock, b.ko.Spec.CIDRBlock) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.IPv6CIDRBlock, b.ko.Spec.IPv6CIDRBlock) { + delta.Add("Spec.IPv6CIDRBlock", a.ko.Spec.IPv6CIDRBlock, b.ko.Spec.IPv6CIDRBlock) + } else if a.ko.Spec.IPv6CIDRBlock != nil && b.ko.Spec.IPv6CIDRBlock != nil { + if *a.ko.Spec.IPv6CIDRBlock != *b.ko.Spec.IPv6CIDRBlock { + delta.Add("Spec.IPv6CIDRBlock", a.ko.Spec.IPv6CIDRBlock, b.ko.Spec.IPv6CIDRBlock) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.OutpostARN, b.ko.Spec.OutpostARN) { + delta.Add("Spec.OutpostARN", a.ko.Spec.OutpostARN, b.ko.Spec.OutpostARN) + } else if a.ko.Spec.OutpostARN != nil && b.ko.Spec.OutpostARN != nil { + if *a.ko.Spec.OutpostARN != *b.ko.Spec.OutpostARN { + delta.Add("Spec.OutpostARN", a.ko.Spec.OutpostARN, b.ko.Spec.OutpostARN) + } + } + + if ackcompare.HasNilDifference(a.ko.Spec.VPCID, b.ko.Spec.VPCID) { + delta.Add("Spec.VPCID", a.ko.Spec.VPCID, b.ko.Spec.VPCID) + } else if a.ko.Spec.VPCID != nil && b.ko.Spec.VPCID != nil { + if *a.ko.Spec.VPCID != *b.ko.Spec.VPCID { + delta.Add("Spec.VPCID", a.ko.Spec.VPCID, b.ko.Spec.VPCID) + } + } + + return delta +} diff --git a/pkg/resource/subnet/descriptor.go b/pkg/resource/subnet/descriptor.go new file mode 100644 index 00000000..34c3e654 --- /dev/null +++ b/pkg/resource/subnet/descriptor.go @@ -0,0 +1,153 @@ +// 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 subnet + +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/Subnet" +) + +var ( + resourceGK = metav1.GroupKind{ + Group: "ec2.services.k8s.aws", + Kind: "Subnet", + } +) + +// 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 &resourceGK +} + +// EmptyRuntimeObject returns an empty object prototype that may be used in +// apimachinery and k8s client operations +func (d *resourceDescriptor) EmptyRuntimeObject() k8sapirt.Object { + return &svcapitypes.Subnet{} +} + +// 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.Subnet), + } +} + +// 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/subnet/identifiers.go b/pkg/resource/subnet/identifiers.go new file mode 100644 index 00000000..bc2cbf42 --- /dev/null +++ b/pkg/resource/subnet/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 subnet + +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/subnet/manager.go b/pkg/resource/subnet/manager.go new file mode 100644 index 00000000..384baafd --- /dev/null +++ b/pkg/resource/subnet/manager.go @@ -0,0 +1,289 @@ +// 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 subnet + +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=subnets,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=ec2.services.k8s.aws,resources=subnets/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") + } + return rm.sdkDelete(ctx, r) +} + +// 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 + } + lateInitConditionReason := "" + lateInitConditionMessage := "" + observed, err := rm.ReadOne(ctx, latest) + if err != nil { + lateInitConditionMessage = "Unable to complete Read operation required for late initialization" + lateInitConditionReason = "Late Initialization Failure" + ackcondition.SetLateInitialized(latest, corev1.ConditionFalse, &lateInitConditionMessage, &lateInitConditionReason) + return latest, err + } + latest = rm.lateInitializeFromReadOneOutput(observed, latest) + incompleteInitialization := rm.incompleteLateInitialization(latest) + 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(latest, corev1.ConditionFalse, &lateInitConditionMessage, &lateInitConditionReason) + return latest, ackrequeue.NeededAfter(nil, time.Duration(5)*time.Second) + } + // Set LateIntialized condition to True + lateInitConditionMessage = "Late initialization successful" + lateInitConditionReason = "Late initialization successful" + ackcondition.SetLateInitialized(latest, corev1.ConditionTrue, &lateInitConditionMessage, &lateInitConditionReason) + return latest, 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( + latest 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) { + 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) { + r1, updated := rm.updateConditions(r, true, nil) + if !updated { + return r, nil + } + return r1, nil +} diff --git a/pkg/resource/subnet/manager_factory.go b/pkg/resource/subnet/manager_factory.go new file mode 100644 index 00000000..abe1baf6 --- /dev/null +++ b/pkg/resource/subnet/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 subnet + +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/subnet/resource.go b/pkg/resource/subnet/resource.go new file mode 100644 index 00000000..d3ba4ff9 --- /dev/null +++ b/pkg/resource/subnet/resource.go @@ -0,0 +1,100 @@ +// 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 subnet + +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.Subnet +} + +// 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 +} + +// 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 + } + + return nil +} diff --git a/pkg/resource/subnet/sdk.go b/pkg/resource/subnet/sdk.go new file mode 100644 index 00000000..066fd6b0 --- /dev/null +++ b/pkg/resource/subnet/sdk.go @@ -0,0 +1,561 @@ +// 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 subnet + +import ( + "context" + "strings" + + ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" + 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.Subnet{} + _ = ackv1alpha1.AWSAccountID("") + _ = &ackerr.NotFound +) + +// 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) + input, err := rm.newListRequestPayload(r) + if err != nil { + return nil, err + } + var resp *svcsdk.DescribeSubnetsOutput + resp, err = rm.sdkapi.DescribeSubnetsWithContext(ctx, input) + rm.metrics.RecordAPICall("READ_MANY", "DescribeSubnets", 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.Subnets { + if elem.AssignIpv6AddressOnCreation != nil { + ko.Status.AssignIPv6AddressOnCreation = elem.AssignIpv6AddressOnCreation + } else { + ko.Status.AssignIPv6AddressOnCreation = nil + } + if elem.AvailabilityZone != nil { + ko.Spec.AvailabilityZone = elem.AvailabilityZone + } else { + ko.Spec.AvailabilityZone = nil + } + if elem.AvailabilityZoneId != nil { + ko.Spec.AvailabilityZoneID = elem.AvailabilityZoneId + } else { + ko.Spec.AvailabilityZoneID = nil + } + if elem.AvailableIpAddressCount != nil { + ko.Status.AvailableIPAddressCount = elem.AvailableIpAddressCount + } else { + ko.Status.AvailableIPAddressCount = nil + } + if elem.CidrBlock != nil { + ko.Spec.CIDRBlock = elem.CidrBlock + } else { + ko.Spec.CIDRBlock = nil + } + if elem.CustomerOwnedIpv4Pool != nil { + ko.Status.CustomerOwnedIPv4Pool = elem.CustomerOwnedIpv4Pool + } else { + ko.Status.CustomerOwnedIPv4Pool = nil + } + if elem.DefaultForAz != nil { + ko.Status.DefaultForAZ = elem.DefaultForAz + } else { + ko.Status.DefaultForAZ = nil + } + if elem.Ipv6CidrBlockAssociationSet != nil { + f7 := []*svcapitypes.SubnetIPv6CIDRBlockAssociation{} + for _, f7iter := range elem.Ipv6CidrBlockAssociationSet { + f7elem := &svcapitypes.SubnetIPv6CIDRBlockAssociation{} + if f7iter.AssociationId != nil { + f7elem.AssociationID = f7iter.AssociationId + } + if f7iter.Ipv6CidrBlock != nil { + f7elem.IPv6CIDRBlock = f7iter.Ipv6CidrBlock + } + if f7iter.Ipv6CidrBlockState != nil { + f7elemf2 := &svcapitypes.SubnetCIDRBlockState{} + if f7iter.Ipv6CidrBlockState.State != nil { + f7elemf2.State = f7iter.Ipv6CidrBlockState.State + } + if f7iter.Ipv6CidrBlockState.StatusMessage != nil { + f7elemf2.StatusMessage = f7iter.Ipv6CidrBlockState.StatusMessage + } + f7elem.IPv6CIDRBlockState = f7elemf2 + } + f7 = append(f7, f7elem) + } + ko.Status.IPv6CIDRBlockAssociationSet = f7 + } else { + ko.Status.IPv6CIDRBlockAssociationSet = nil + } + if elem.MapCustomerOwnedIpOnLaunch != nil { + ko.Status.MapCustomerOwnedIPOnLaunch = elem.MapCustomerOwnedIpOnLaunch + } else { + ko.Status.MapCustomerOwnedIPOnLaunch = nil + } + if elem.MapPublicIpOnLaunch != nil { + ko.Status.MapPublicIPOnLaunch = elem.MapPublicIpOnLaunch + } else { + ko.Status.MapPublicIPOnLaunch = nil + } + if elem.OutpostArn != nil { + ko.Spec.OutpostARN = elem.OutpostArn + } else { + ko.Spec.OutpostARN = 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.SubnetArn != nil { + if ko.Status.ACKResourceMetadata == nil { + ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{} + } + tmpARN := ackv1alpha1.AWSResourceName(*elem.SubnetArn) + ko.Status.ACKResourceMetadata.ARN = &tmpARN + } + if elem.SubnetId != nil { + ko.Status.SubnetID = elem.SubnetId + } else { + ko.Status.SubnetID = nil + } + if elem.Tags != nil { + f15 := []*svcapitypes.Tag{} + for _, f15iter := range elem.Tags { + f15elem := &svcapitypes.Tag{} + if f15iter.Key != nil { + f15elem.Key = f15iter.Key + } + if f15iter.Value != nil { + f15elem.Value = f15iter.Value + } + f15 = append(f15, f15elem) + } + ko.Status.Tags = f15 + } else { + ko.Status.Tags = nil + } + if elem.VpcId != nil { + ko.Spec.VPCID = elem.VpcId + } else { + ko.Spec.VPCID = nil + } + found = true + break + } + if !found { + return nil, ackerr.NotFound + } + + rm.setStatusDefaults(ko) + return &resource{ko}, 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.DescribeSubnetsInput, error) { + res := &svcsdk.DescribeSubnetsInput{} + + 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.CreateSubnetOutput + _ = resp + resp, err = rm.sdkapi.CreateSubnetWithContext(ctx, input) + rm.metrics.RecordAPICall("CREATE", "CreateSubnet", 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.Subnet.AssignIpv6AddressOnCreation != nil { + ko.Status.AssignIPv6AddressOnCreation = resp.Subnet.AssignIpv6AddressOnCreation + } else { + ko.Status.AssignIPv6AddressOnCreation = nil + } + if resp.Subnet.AvailabilityZone != nil { + ko.Spec.AvailabilityZone = resp.Subnet.AvailabilityZone + } else { + ko.Spec.AvailabilityZone = nil + } + if resp.Subnet.AvailabilityZoneId != nil { + ko.Spec.AvailabilityZoneID = resp.Subnet.AvailabilityZoneId + } else { + ko.Spec.AvailabilityZoneID = nil + } + if resp.Subnet.AvailableIpAddressCount != nil { + ko.Status.AvailableIPAddressCount = resp.Subnet.AvailableIpAddressCount + } else { + ko.Status.AvailableIPAddressCount = nil + } + if resp.Subnet.CidrBlock != nil { + ko.Spec.CIDRBlock = resp.Subnet.CidrBlock + } else { + ko.Spec.CIDRBlock = nil + } + if resp.Subnet.CustomerOwnedIpv4Pool != nil { + ko.Status.CustomerOwnedIPv4Pool = resp.Subnet.CustomerOwnedIpv4Pool + } else { + ko.Status.CustomerOwnedIPv4Pool = nil + } + if resp.Subnet.DefaultForAz != nil { + ko.Status.DefaultForAZ = resp.Subnet.DefaultForAz + } else { + ko.Status.DefaultForAZ = nil + } + if resp.Subnet.Ipv6CidrBlockAssociationSet != nil { + f7 := []*svcapitypes.SubnetIPv6CIDRBlockAssociation{} + for _, f7iter := range resp.Subnet.Ipv6CidrBlockAssociationSet { + f7elem := &svcapitypes.SubnetIPv6CIDRBlockAssociation{} + if f7iter.AssociationId != nil { + f7elem.AssociationID = f7iter.AssociationId + } + if f7iter.Ipv6CidrBlock != nil { + f7elem.IPv6CIDRBlock = f7iter.Ipv6CidrBlock + } + if f7iter.Ipv6CidrBlockState != nil { + f7elemf2 := &svcapitypes.SubnetCIDRBlockState{} + if f7iter.Ipv6CidrBlockState.State != nil { + f7elemf2.State = f7iter.Ipv6CidrBlockState.State + } + if f7iter.Ipv6CidrBlockState.StatusMessage != nil { + f7elemf2.StatusMessage = f7iter.Ipv6CidrBlockState.StatusMessage + } + f7elem.IPv6CIDRBlockState = f7elemf2 + } + f7 = append(f7, f7elem) + } + ko.Status.IPv6CIDRBlockAssociationSet = f7 + } else { + ko.Status.IPv6CIDRBlockAssociationSet = nil + } + if resp.Subnet.MapCustomerOwnedIpOnLaunch != nil { + ko.Status.MapCustomerOwnedIPOnLaunch = resp.Subnet.MapCustomerOwnedIpOnLaunch + } else { + ko.Status.MapCustomerOwnedIPOnLaunch = nil + } + if resp.Subnet.MapPublicIpOnLaunch != nil { + ko.Status.MapPublicIPOnLaunch = resp.Subnet.MapPublicIpOnLaunch + } else { + ko.Status.MapPublicIPOnLaunch = nil + } + if resp.Subnet.OutpostArn != nil { + ko.Spec.OutpostARN = resp.Subnet.OutpostArn + } else { + ko.Spec.OutpostARN = nil + } + if resp.Subnet.OwnerId != nil { + ko.Status.OwnerID = resp.Subnet.OwnerId + } else { + ko.Status.OwnerID = nil + } + if resp.Subnet.State != nil { + ko.Status.State = resp.Subnet.State + } else { + ko.Status.State = nil + } + if ko.Status.ACKResourceMetadata == nil { + ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{} + } + if resp.Subnet.SubnetArn != nil { + arn := ackv1alpha1.AWSResourceName(*resp.Subnet.SubnetArn) + ko.Status.ACKResourceMetadata.ARN = &arn + } + if resp.Subnet.SubnetId != nil { + ko.Status.SubnetID = resp.Subnet.SubnetId + } else { + ko.Status.SubnetID = nil + } + if resp.Subnet.Tags != nil { + f15 := []*svcapitypes.Tag{} + for _, f15iter := range resp.Subnet.Tags { + f15elem := &svcapitypes.Tag{} + if f15iter.Key != nil { + f15elem.Key = f15iter.Key + } + if f15iter.Value != nil { + f15elem.Value = f15iter.Value + } + f15 = append(f15, f15elem) + } + ko.Status.Tags = f15 + } else { + ko.Status.Tags = nil + } + if resp.Subnet.VpcId != nil { + ko.Spec.VPCID = resp.Subnet.VpcId + } else { + ko.Spec.VPCID = 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.CreateSubnetInput, error) { + res := &svcsdk.CreateSubnetInput{} + + if r.ko.Spec.AvailabilityZone != nil { + res.SetAvailabilityZone(*r.ko.Spec.AvailabilityZone) + } + if r.ko.Spec.AvailabilityZoneID != nil { + res.SetAvailabilityZoneId(*r.ko.Spec.AvailabilityZoneID) + } + if r.ko.Spec.CIDRBlock != nil { + res.SetCidrBlock(*r.ko.Spec.CIDRBlock) + } + if r.ko.Spec.IPv6CIDRBlock != nil { + res.SetIpv6CidrBlock(*r.ko.Spec.IPv6CIDRBlock) + } + if r.ko.Spec.OutpostARN != nil { + res.SetOutpostArn(*r.ko.Spec.OutpostARN) + } + if r.ko.Spec.TagSpecifications != nil { + f5 := []*svcsdk.TagSpecification{} + for _, f5iter := range r.ko.Spec.TagSpecifications { + f5elem := &svcsdk.TagSpecification{} + if f5iter.ResourceType != nil { + f5elem.SetResourceType(*f5iter.ResourceType) + } + if f5iter.Tags != nil { + f5elemf1 := []*svcsdk.Tag{} + for _, f5elemf1iter := range f5iter.Tags { + f5elemf1elem := &svcsdk.Tag{} + if f5elemf1iter.Key != nil { + f5elemf1elem.SetKey(*f5elemf1iter.Key) + } + if f5elemf1iter.Value != nil { + f5elemf1elem.SetValue(*f5elemf1iter.Value) + } + f5elemf1 = append(f5elemf1, f5elemf1elem) + } + f5elem.SetTags(f5elemf1) + } + f5 = append(f5, f5elem) + } + res.SetTagSpecifications(f5) + } + if r.ko.Spec.VPCID != nil { + res.SetVpcId(*r.ko.Spec.VPCID) + } + + 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.DeleteSubnetOutput + _ = resp + resp, err = rm.sdkapi.DeleteSubnetWithContext(ctx, input) + rm.metrics.RecordAPICall("DELETE", "DeleteSubnet", 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.DeleteSubnetInput, error) { + res := &svcsdk.DeleteSubnetInput{} + + if r.ko.Status.SubnetID != nil { + res.SetSubnetId(*r.ko.Status.SubnetID) + } + + return res, nil +} + +// setStatusDefaults sets default properties into supplied custom resource +func (rm *resourceManager) setStatusDefaults( + ko *svcapitypes.Subnet, +) { + 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.Message() + } + 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.Message() + } + 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 +} From 5b31b2751fbe1cde7c20519f2459572402a5ca5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Mon, 16 Aug 2021 15:56:48 -0500 Subject: [PATCH 02/10] add subnet hooks --- apis/v1alpha1/generator.yaml | 6 ++++ generator.yaml | 6 ++++ pkg/resource/subnet/hooks.go | 36 +++++++++++++++++++ pkg/resource/subnet/sdk.go | 6 ++++ .../sdk_read_many_post_build_request.go.tpl | 3 ++ .../sdk_read_many_pre_build_request.go.tpl | 3 ++ 6 files changed, 60 insertions(+) create mode 100644 pkg/resource/subnet/hooks.go create mode 100644 templates/hooks/subnet/sdk_read_many_post_build_request.go.tpl create mode 100644 templates/hooks/subnet/sdk_read_many_pre_build_request.go.tpl diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index 7866b532..b6d01314 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -64,6 +64,12 @@ ignore: resources: Vpc: + hooks: + sdk_read_many_pre_build_request: + template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl + sdk_read_many_post_build_request: + template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl + Subnet: hooks: sdk_read_many_pre_build_request: template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl diff --git a/generator.yaml b/generator.yaml index 7866b532..b6d01314 100644 --- a/generator.yaml +++ b/generator.yaml @@ -64,6 +64,12 @@ ignore: resources: Vpc: + hooks: + sdk_read_many_pre_build_request: + template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl + sdk_read_many_post_build_request: + template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl + Subnet: hooks: sdk_read_many_pre_build_request: template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl diff --git a/pkg/resource/subnet/hooks.go b/pkg/resource/subnet/hooks.go new file mode 100644 index 00000000..a2ab928e --- /dev/null +++ b/pkg/resource/subnet/hooks.go @@ -0,0 +1,36 @@ +// 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. + +package subnet + +import ( + "errors" + + svcsdk "github.com/aws/aws-sdk-go/service/ec2" +) + +// isRequiredFieldsMissingFromInput returns True if CR is +// missing required fields for reconciliation. +func isRequiredFieldsMissingFromInput(r *resource) bool { + return r.ko.Status.State == nil +} + +// addIDToListRequest adds requested-resource VpcId to ListRequest. Return error to indicate to callers that the +// resource is not yet created. +func addIDToListRequest(r *resource, input *svcsdk.DescribeSubnetsInput) error { + if r.ko.Status.SubnetID == nil { + return errors.New("unable to extract subnetId from Kubernetes resource") + } + input.SubnetIds = []*string{r.ko.Status.SubnetID} + return nil +} diff --git a/pkg/resource/subnet/sdk.go b/pkg/resource/subnet/sdk.go index 066fd6b0..d218d61a 100644 --- a/pkg/resource/subnet/sdk.go +++ b/pkg/resource/subnet/sdk.go @@ -50,10 +50,16 @@ func (rm *resourceManager) sdkFind( rlog := ackrtlog.FromContext(ctx) exit := rlog.Trace("rm.sdkFind") defer exit(err) + if isRequiredFieldsMissingFromInput(r) { + return nil, ackerr.NotFound + } input, err := rm.newListRequestPayload(r) if err != nil { return nil, err } + if err = addIDToListRequest(r, input); err != nil { + return nil, ackerr.NotFound + } var resp *svcsdk.DescribeSubnetsOutput resp, err = rm.sdkapi.DescribeSubnetsWithContext(ctx, input) rm.metrics.RecordAPICall("READ_MANY", "DescribeSubnets", err) diff --git a/templates/hooks/subnet/sdk_read_many_post_build_request.go.tpl b/templates/hooks/subnet/sdk_read_many_post_build_request.go.tpl new file mode 100644 index 00000000..893e9bf9 --- /dev/null +++ b/templates/hooks/subnet/sdk_read_many_post_build_request.go.tpl @@ -0,0 +1,3 @@ + if err = addIDToListRequest(r, input); err != nil { + return nil, ackerr.NotFound + } \ No newline at end of file diff --git a/templates/hooks/subnet/sdk_read_many_pre_build_request.go.tpl b/templates/hooks/subnet/sdk_read_many_pre_build_request.go.tpl new file mode 100644 index 00000000..732bc19d --- /dev/null +++ b/templates/hooks/subnet/sdk_read_many_pre_build_request.go.tpl @@ -0,0 +1,3 @@ + if isRequiredFieldsMissingFromInput(r) { + return nil, ackerr.NotFound + } \ No newline at end of file From 3ba3f310332fdd788a2c283cf02a3dc96092ef8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Wed, 18 Aug 2021 13:16:37 -0500 Subject: [PATCH 03/10] add terminal codes for subnet --- apis/v1alpha1/ack-generate-metadata.yaml | 32 +++--------------------- apis/v1alpha1/generator.yaml | 6 ++++- generator.yaml | 6 ++++- pkg/resource/subnet/sdk.go | 16 ++++++++++-- 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 1f75117d..25efc71a 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,38 +1,14 @@ ack_generate_info: -<<<<<<< HEAD - build_date: "2021-08-16T20:38:40Z" -======= -<<<<<<< HEAD -<<<<<<< HEAD - build_date: "2021-08-16T20:38:40Z" -======= - build_date: "2021-08-16T20:49:09Z" ->>>>>>> ec049ca (regen vpc with 0.10.0) -======= - build_date: "2021-08-16T20:50:58Z" ->>>>>>> cc7c4b2 (generate subnet resource) ->>>>>>> 5dec341 (generate subnet resource) + build_date: "2021-08-18T18:14:34Z" build_hash: afa7fe00dae2c7404018e98c13130a01b6643d1d go_version: go1.16.6 darwin/amd64 version: v0.10.0 -api_directory_checksum: 7f0fe6c5c959e20c5eb4ccef47e456622eeb24f3 +api_directory_checksum: aae0d15e0e983bfceae42ac7f3dd640e1f9b298a api_version: v1alpha1 aws_sdk_go_version: v1.37.10 generator_config_info: - file_checksum: 4b048f807c7151379f0b09f26ddc40b101b8e6fd + file_checksum: 6c20d9f262878523aa969804ed9d3cbacd739ca1 original_file_name: generator.yaml last_modification: reason: API generation -<<<<<<< HEAD - timestamp: 2021-08-16 20:38:50.308741 +0000 UTC -======= -<<<<<<< HEAD -<<<<<<< HEAD - timestamp: 2021-08-16 20:38:50.308741 +0000 UTC -======= - timestamp: 2021-08-16 20:49:17.748573 +0000 UTC ->>>>>>> ec049ca (regen vpc with 0.10.0) -======= - timestamp: 2021-08-16 20:51:07.853927 +0000 UTC ->>>>>>> cc7c4b2 (generate subnet resource) ->>>>>>> 5dec341 (generate subnet resource) + timestamp: 2021-08-18 18:14:44.307493 +0000 UTC diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index b6d01314..d82b1834 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -74,4 +74,8 @@ resources: sdk_read_many_pre_build_request: template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl sdk_read_many_post_build_request: - template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl \ No newline at end of file + template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl + exceptions: + terminal_codes: + - InvalidVpcID.Malformed + - InvalidVpcID.NotFound \ No newline at end of file diff --git a/generator.yaml b/generator.yaml index b6d01314..d82b1834 100644 --- a/generator.yaml +++ b/generator.yaml @@ -74,4 +74,8 @@ resources: sdk_read_many_pre_build_request: template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl sdk_read_many_post_build_request: - template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl \ No newline at end of file + template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl + exceptions: + terminal_codes: + - InvalidVpcID.Malformed + - InvalidVpcID.NotFound \ No newline at end of file diff --git a/pkg/resource/subnet/sdk.go b/pkg/resource/subnet/sdk.go index d218d61a..82b53afc 100644 --- a/pkg/resource/subnet/sdk.go +++ b/pkg/resource/subnet/sdk.go @@ -562,6 +562,18 @@ func (rm *resourceManager) updateConditions( // 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 + if err == nil { + return false + } + awsErr, ok := ackerr.AWSError(err) + if !ok { + return false + } + switch awsErr.Code() { + case "InvalidVpcID.Malformed", + "InvalidVpcID.NotFound": + return true + default: + return false + } } From 3e8faba883ce3a29216d2e4ce73780d7aebd0c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Wed, 18 Aug 2021 13:17:59 -0500 Subject: [PATCH 04/10] add helm artifacts for subnet --- helm/crds/ec2.services.k8s.aws_subnets.yaml | 234 ++++++++++++++++++++ helm/templates/cluster-role-controller.yaml | 20 ++ helm/templates/role-reader.yaml | 1 + helm/templates/role-writer.yaml | 3 + 4 files changed, 258 insertions(+) create mode 100644 helm/crds/ec2.services.k8s.aws_subnets.yaml diff --git a/helm/crds/ec2.services.k8s.aws_subnets.yaml b/helm/crds/ec2.services.k8s.aws_subnets.yaml new file mode 100644 index 00000000..e8c62a99 --- /dev/null +++ b/helm/crds/ec2.services.k8s.aws_subnets.yaml @@ -0,0 +1,234 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.1 + creationTimestamp: null + name: subnets.ec2.services.k8s.aws +spec: + group: ec2.services.k8s.aws + names: + kind: Subnet + listKind: SubnetList + plural: subnets + singular: subnet + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Subnet is the Schema for the Subnets 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: "SubnetSpec defines the desired state of Subnet. \n Describes + a subnet." + properties: + availabilityZone: + description: "The Availability Zone or Local Zone for the subnet. + \n Default: AWS selects one for you. If you create more than one + subnet in your VPC, we do not necessarily select a different zone + for each subnet. \n To create a subnet in a Local Zone, set this + value to the Local Zone ID, for example us-west-2-lax-1a. For information + about the Regions that support Local Zones, see Available Regions + (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions) + in the Amazon Elastic Compute Cloud User Guide. \n To create a subnet + in an Outpost, set this value to the Availability Zone for the Outpost + and specify the Outpost ARN." + type: string + availabilityZoneID: + description: The AZ ID or the Local Zone ID of the subnet. + type: string + cidrBlock: + description: The IPv4 network range for the subnet, in CIDR notation. + For example, 10.0.0.0/24. We modify the specified CIDR block to + its canonical form; for example, if you specify 100.68.0.18/18, + we modify it to 100.68.0.0/18. + type: string + ipv6CIDRBlock: + description: The IPv6 network range for the subnet, in CIDR notation. + The subnet size must use a /64 prefix length. + type: string + outpostARN: + description: The Amazon Resource Name (ARN) of the Outpost. If you + specify an Outpost ARN, you must also specify the Availability Zone + of the Outpost subnet. + type: string + tagSpecifications: + description: The tags to assign to the subnet. + 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 + vpcID: + description: The ID of the VPC. + type: string + required: + - cidrBlock + - vpcID + type: object + status: + description: SubnetStatus defines the observed state of Subnet + 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 + assignIPv6AddressOnCreation: + description: Indicates whether a network interface created in this + subnet (including a network interface created by RunInstances) receives + an IPv6 address. + type: boolean + availableIPAddressCount: + description: The number of unused private IPv4 addresses in the subnet. + The IPv4 addresses for any stopped instances are considered unavailable. + format: int64 + type: integer + 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 + customerOwnedIPv4Pool: + description: The customer-owned IPv4 address pool associated with + the subnet. + type: string + defaultForAZ: + description: Indicates whether this is the default subnet for the + Availability Zone. + type: boolean + ipv6CIDRBlockAssociationSet: + description: Information about the IPv6 CIDR blocks associated with + the subnet. + items: + description: Describes an IPv6 CIDR block associated with a subnet. + properties: + associationID: + type: string + ipv6CIDRBlock: + type: string + ipv6CIDRBlockState: + description: Describes the state of a CIDR block. + properties: + state: + type: string + statusMessage: + type: string + type: object + type: object + type: array + mapCustomerOwnedIPOnLaunch: + description: Indicates whether a network interface created in this + subnet (including a network interface created by RunInstances) receives + a customer-owned IPv4 address. + type: boolean + mapPublicIPOnLaunch: + description: Indicates whether instances launched in this subnet receive + a public IPv4 address. + type: boolean + ownerID: + description: The ID of the AWS account that owns the subnet. + type: string + state: + description: The current state of the subnet. + type: string + subnetID: + description: The ID of the subnet. + type: string + tags: + description: Any tags assigned to the subnet. + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array + 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 66c4e459..bd6faab3 100644 --- a/helm/templates/cluster-role-controller.yaml +++ b/helm/templates/cluster-role-controller.yaml @@ -22,6 +22,26 @@ rules: - get - list - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - subnets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - subnets/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 63709d89..e2c9264a 100644 --- a/helm/templates/role-reader.yaml +++ b/helm/templates/role-reader.yaml @@ -9,6 +9,7 @@ rules: - apiGroups: - ec2.services.k8s.aws resources: + - subnets - vpcs verbs: - get diff --git a/helm/templates/role-writer.yaml b/helm/templates/role-writer.yaml index cb8293a6..99ca51dd 100644 --- a/helm/templates/role-writer.yaml +++ b/helm/templates/role-writer.yaml @@ -9,6 +9,8 @@ rules: - apiGroups: - ec2.services.k8s.aws resources: + - subnets + - vpcs verbs: @@ -22,6 +24,7 @@ rules: - apiGroups: - ec2.services.k8s.aws resources: + - subnets - vpcs verbs: - get From 19c102cc8439698e2989c73c03b3851eb2feb389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Wed, 18 Aug 2021 13:19:12 -0500 Subject: [PATCH 05/10] add smoke tests for subnet --- test/e2e/__init__.py | 21 ----- test/e2e/resources/subnet.yaml | 7 ++ test/e2e/tests/test_subnet.py | 152 +++++++++++++++++++++++++++++++++ test/e2e/tests/test_vpc.py | 2 +- 4 files changed, 160 insertions(+), 22 deletions(-) create mode 100644 test/e2e/resources/subnet.yaml create mode 100644 test/e2e/tests/test_subnet.py diff --git a/test/e2e/__init__.py b/test/e2e/__init__.py index a9809a61..76c023f1 100644 --- a/test/e2e/__init__.py +++ b/test/e2e/__init__.py @@ -15,7 +15,6 @@ from typing import Dict, Any from pathlib import Path -from acktest.k8s import resource from acktest.resources import load_resource_file SERVICE_NAME = "ec2" @@ -32,23 +31,3 @@ def load_ec2_resource(resource_name: str, additional_replacements: Dict[str, Any directory for the current service. """ return load_resource_file(resource_directory, resource_name, additional_replacements=additional_replacements) - -def create_vpc_resource( - resource_plural, resource_name, spec_file, replacements, namespace="default" -): - """ - Wrapper around k8s.load_and_create_resource to create a VPC resource - """ - - reference, spec, res = resource.load_and_create_resource( - resource_directory, - CRD_GROUP, - CRD_VERSION, - resource_plural, - resource_name, - spec_file, - replacements, - namespace, - ) - - return reference, spec, res \ No newline at end of file diff --git a/test/e2e/resources/subnet.yaml b/test/e2e/resources/subnet.yaml new file mode 100644 index 00000000..cf6d0b6f --- /dev/null +++ b/test/e2e/resources/subnet.yaml @@ -0,0 +1,7 @@ +apiVersion: ec2.services.k8s.aws/v1alpha1 +kind: Subnet +metadata: + name: $SUBNET_NAME +spec: + cidrBlock: $CIDR_BLOCK + vpcID: $VPC_ID \ No newline at end of file diff --git a/test/e2e/tests/test_subnet.py b/test/e2e/tests/test_subnet.py new file mode 100644 index 00000000..7cdd42cb --- /dev/null +++ b/test/e2e/tests/test_subnet.py @@ -0,0 +1,152 @@ +# 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 Subnet 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 = "subnets" + +CREATE_WAIT_AFTER_SECONDS = 10 +DELETE_WAIT_AFTER_SECONDS = 10 + +test_resource_values = REPLACEMENT_VALUES.copy() + + +@pytest.fixture(scope="module") +def ec2_client(): + return boto3.client("ec2") + +@pytest.fixture(scope="module") +def vpc_resource(): + resource_name = random_suffix_name("vpc-for-subnet", 24) + test_resource_values["VPC_NAME"] = resource_name + test_resource_values["CIDR_BLOCK"] = "10.0.0.0/16" + + resource_data = load_ec2_resource( + "vpc", + additional_replacements=test_resource_values, + ) + ref = k8s.CustomResourceReference( + CRD_GROUP, CRD_VERSION, "vpcs", + 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) + test_resource_values["VPC_ID"] = resource["status"]["vpcID"] + + yield ref, cr + + k8s.delete_custom_resource(ref) + +@service_marker +@pytest.mark.canary +class TestSubnet: + def get_subnet(self, ec2_client, subnet_id: str) -> dict: + try: + resp = ec2_client.describe_subnets() + except Exception as e: + logging.debug(e) + return None + + subnets = resp["Subnets"] + for subnet in subnets: + if subnet["SubnetId"] == subnet_id: + return subnet + + return None + + def subnet_exists(self, ec2_client, subnet_id: str) -> bool: + return self.get_subnet(ec2_client, subnet_id) is not None + + def test_crud(self, ec2_client, vpc_resource): + resource_name = random_suffix_name("subnet-crud", 24) + test_resource_values["SUBNET_NAME"] = resource_name + + # Load Subnet CR + resource_data = load_ec2_resource( + "subnet", + additional_replacements=test_resource_values, + ) + 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"]["subnetID"] + + time.sleep(CREATE_WAIT_AFTER_SECONDS) + + # Check Subnet exists + exists = self.subnet_exists(ec2_client, resource_id) + assert exists + + # Delete k8s resource + _, deleted = k8s.delete_custom_resource(ref) + assert deleted is True + + time.sleep(DELETE_WAIT_AFTER_SECONDS) + + # Check VPC doesn't exist + exists = self.subnet_exists(ec2_client, resource_id) + assert not exists + + def test_terminal_condition(self, vpc_resource): + resource_name = random_suffix_name("subnet-fail", 24) + test_resource_values["SUBNET_NAME"] = resource_name + test_resource_values["VPC_ID"] = "InvalidVpcId" + + # Load Subnet CR + resource_data = load_ec2_resource( + "subnet", + additional_replacements=test_resource_values, + ) + 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) + + assert k8s.assert_condition_state_message( + ref, "ACK.Terminal", "True", "The vpc ID 'InvalidVpcId' does not exist" + ) diff --git a/test/e2e/tests/test_vpc.py b/test/e2e/tests/test_vpc.py index 0348e535..216c4ad7 100644 --- a/test/e2e/tests/test_vpc.py +++ b/test/e2e/tests/test_vpc.py @@ -87,7 +87,7 @@ def test_smoke(self, ec2_client): assert exists # Delete k8s resource - _, deleted = k8s.delete_custom_resource(ref) + _, deleted = k8s.delete_custom_resource(ref, 2, 5) assert deleted is True time.sleep(DELETE_WAIT_AFTER_SECONDS) From c27745180e5b517a0a3c2db5b7f75268b5b46836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Wed, 18 Aug 2021 16:13:41 -0500 Subject: [PATCH 06/10] minor changes to smoke tests --- test/e2e/tests/test_subnet.py | 18 ++++++++++++++---- test/e2e/tests/test_vpc.py | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/test/e2e/tests/test_subnet.py b/test/e2e/tests/test_subnet.py index 7cdd42cb..934fa015 100644 --- a/test/e2e/tests/test_subnet.py +++ b/test/e2e/tests/test_subnet.py @@ -29,9 +29,6 @@ CREATE_WAIT_AFTER_SECONDS = 10 DELETE_WAIT_AFTER_SECONDS = 10 -test_resource_values = REPLACEMENT_VALUES.copy() - - @pytest.fixture(scope="module") def ec2_client(): return boto3.client("ec2") @@ -39,6 +36,7 @@ def ec2_client(): @pytest.fixture(scope="module") def vpc_resource(): resource_name = random_suffix_name("vpc-for-subnet", 24) + test_resource_values = REPLACEMENT_VALUES.copy() test_resource_values["VPC_NAME"] = resource_name test_resource_values["CIDR_BLOCK"] = "10.0.0.0/16" @@ -83,9 +81,16 @@ def get_subnet(self, ec2_client, subnet_id: str) -> dict: def subnet_exists(self, ec2_client, subnet_id: str) -> bool: return self.get_subnet(ec2_client, subnet_id) is not None - def test_crud(self, ec2_client, vpc_resource): + def test_create_delete(self, ec2_client, vpc_resource): + test_resource_values = REPLACEMENT_VALUES.copy() resource_name = random_suffix_name("subnet-crud", 24) + _, vpc_cr = vpc_resource + vpc_id = vpc_cr['status']['vpcID'] + vpc_cidr = vpc_cr['spec']['cidrBlock'] + test_resource_values["SUBNET_NAME"] = resource_name + test_resource_values["VPC_ID"] = vpc_id + test_resource_values["CIDR_BLOCK"] = vpc_cidr # Load Subnet CR resource_data = load_ec2_resource( @@ -125,9 +130,14 @@ def test_crud(self, ec2_client, vpc_resource): assert not exists def test_terminal_condition(self, vpc_resource): + test_resource_values = REPLACEMENT_VALUES.copy() resource_name = random_suffix_name("subnet-fail", 24) + _, vpc_cr = vpc_resource + vpc_cidr = vpc_cr['spec']['cidrBlock'] + test_resource_values["SUBNET_NAME"] = resource_name test_resource_values["VPC_ID"] = "InvalidVpcId" + test_resource_values["CIDR_BLOCK"] = vpc_cidr # Load Subnet CR resource_data = load_ec2_resource( diff --git a/test/e2e/tests/test_vpc.py b/test/e2e/tests/test_vpc.py index 216c4ad7..4d7fa136 100644 --- a/test/e2e/tests/test_vpc.py +++ b/test/e2e/tests/test_vpc.py @@ -53,7 +53,7 @@ def get_vpc(self, ec2_client, vpc_id: str) -> dict: def vpc_exists(self, ec2_client, vpc_id: str) -> bool: return self.get_vpc(ec2_client, vpc_id) is not None - def test_smoke(self, ec2_client): + def test_create_delete(self, ec2_client): resource_name = random_suffix_name("vpc-ack-test", 24) replacements = REPLACEMENT_VALUES.copy() replacements["VPC_NAME"] = resource_name From 63dc41f596968f709da9206606fc6ecc3e91501b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Wed, 18 Aug 2021 16:40:35 -0500 Subject: [PATCH 07/10] regen with v0.12.0 --- apis/v1alpha1/ack-generate-metadata.yaml | 10 +++++----- apis/v1alpha1/generator.yaml | 4 ---- cmd/controller/main.go | 12 +++++++----- config/overlays/namespaced/kustomization.yaml | 15 +++++++++++++++ config/overlays/namespaced/role-binding.json | 3 +++ config/overlays/namespaced/role.json | 2 ++ generator.yaml | 4 ---- go.mod | 2 +- go.sum | 4 ++-- pkg/resource/subnet/delta.go | 11 ++++++++++- pkg/resource/subnet/sdk.go | 16 +++++++++++++++- pkg/resource/vpc/delta.go | 10 ++++++++++ pkg/resource/vpc/sdk.go | 16 +++++++++++++++- .../sdk_read_many_pre_build_request.go.tpl | 3 --- .../vpc/sdk_read_many_pre_build_request.go.tpl | 3 --- 15 files changed, 85 insertions(+), 30 deletions(-) create mode 100644 config/overlays/namespaced/kustomization.yaml create mode 100644 config/overlays/namespaced/role-binding.json create mode 100644 config/overlays/namespaced/role.json delete mode 100644 templates/hooks/subnet/sdk_read_many_pre_build_request.go.tpl delete mode 100644 templates/hooks/vpc/sdk_read_many_pre_build_request.go.tpl diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 25efc71a..603d6729 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,14 +1,14 @@ ack_generate_info: - build_date: "2021-08-18T18:14:34Z" - build_hash: afa7fe00dae2c7404018e98c13130a01b6643d1d + build_date: "2021-08-18T21:36:57Z" + build_hash: 821a0daf362fdda8148046310c3eb478b96366ac go_version: go1.16.6 darwin/amd64 - version: v0.10.0 + version: v0.12.0 api_directory_checksum: aae0d15e0e983bfceae42ac7f3dd640e1f9b298a api_version: v1alpha1 aws_sdk_go_version: v1.37.10 generator_config_info: - file_checksum: 6c20d9f262878523aa969804ed9d3cbacd739ca1 + file_checksum: f7a61725fe7d34c5e0180ae010b10eebd5cb95e0 original_file_name: generator.yaml last_modification: reason: API generation - timestamp: 2021-08-18 18:14:44.307493 +0000 UTC + timestamp: 2021-08-18 21:37:05.403098 +0000 UTC diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index d82b1834..65ebc635 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -65,14 +65,10 @@ ignore: resources: Vpc: hooks: - sdk_read_many_pre_build_request: - template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl sdk_read_many_post_build_request: template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl Subnet: hooks: - sdk_read_many_pre_build_request: - template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl sdk_read_many_post_build_request: template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl exceptions: diff --git a/cmd/controller/main.go b/cmd/controller/main.go index 7dcaab16..78fe0b5d 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -22,6 +22,7 @@ import ( ackrt "github.com/aws-controllers-k8s/runtime/pkg/runtime" ackrtutil "github.com/aws-controllers-k8s/runtime/pkg/util" ackrtwebhook "github.com/aws-controllers-k8s/runtime/pkg/webhook" + svcsdk "github.com/aws/aws-sdk-go/service/ec2" flag "github.com/spf13/pflag" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" @@ -37,10 +38,11 @@ import ( ) var ( - awsServiceAPIGroup = "ec2.services.k8s.aws" - awsServiceAlias = "ec2" - scheme = runtime.NewScheme() - setupLog = ctrlrt.Log.WithName("setup") + awsServiceAPIGroup = "ec2.services.k8s.aws" + awsServiceAlias = "ec2" + awsServiceEndpointsID = svcsdk.EndpointsID + scheme = runtime.NewScheme() + setupLog = ctrlrt.Log.WithName("setup") ) func init() { @@ -97,7 +99,7 @@ func main() { "aws.service", awsServiceAlias, ) sc := ackrt.NewServiceController( - awsServiceAlias, awsServiceAPIGroup, + awsServiceAlias, awsServiceAPIGroup, awsServiceEndpointsID, ackrt.VersionInfo{}, // TODO: populate version info ).WithLogger( ctrlrt.Log, diff --git a/config/overlays/namespaced/kustomization.yaml b/config/overlays/namespaced/kustomization.yaml new file mode 100644 index 00000000..ed2c782f --- /dev/null +++ b/config/overlays/namespaced/kustomization.yaml @@ -0,0 +1,15 @@ +resources: +- ../../default +patches: +- path: role.json + target: + group: rbac.authorization.k8s.io + version: v1 + kind: ClusterRole + name: ack-ec2-controller +- path: role-binding.json + target: + group: rbac.authorization.k8s.io + version: v1 + kind: ClusterRoleBinding + name: ack-ec2-controller-rolebinding \ No newline at end of file diff --git a/config/overlays/namespaced/role-binding.json b/config/overlays/namespaced/role-binding.json new file mode 100644 index 00000000..83e46c54 --- /dev/null +++ b/config/overlays/namespaced/role-binding.json @@ -0,0 +1,3 @@ +[{"op": "replace", "path": "/kind", "value": "RoleBinding"}, +{"op": "add", "path": "/metadata/namespace", "value": "ack-system"}, +{"op": "replace", "path": "/roleRef/kind", "value": "Role"}] \ No newline at end of file diff --git a/config/overlays/namespaced/role.json b/config/overlays/namespaced/role.json new file mode 100644 index 00000000..deddee70 --- /dev/null +++ b/config/overlays/namespaced/role.json @@ -0,0 +1,2 @@ +[{"op": "replace", "path": "/kind", "value": "Role"}, +{"op": "add", "path": "/metadata/namespace", "value": "ack-system"}] \ No newline at end of file diff --git a/generator.yaml b/generator.yaml index d82b1834..65ebc635 100644 --- a/generator.yaml +++ b/generator.yaml @@ -65,14 +65,10 @@ ignore: resources: Vpc: hooks: - sdk_read_many_pre_build_request: - template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl sdk_read_many_post_build_request: template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl Subnet: hooks: - sdk_read_many_pre_build_request: - template_path: hooks/vpc/sdk_read_many_pre_build_request.go.tpl sdk_read_many_post_build_request: template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl exceptions: diff --git a/go.mod b/go.mod index 6f523ea1..3327e29c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/aws-controllers-k8s/ec2-controller go 1.14 require ( - github.com/aws-controllers-k8s/runtime v0.10.0 + github.com/aws-controllers-k8s/runtime v0.12.0 github.com/aws/aws-sdk-go v1.37.10 github.com/go-logr/logr v0.1.0 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 8bff6ef5..bcbd6dde 100644 --- a/go.sum +++ b/go.sum @@ -23,8 +23,8 @@ github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws-controllers-k8s/runtime v0.10.0 h1:MPZ4mPeap2mP/EKU6Pk7a7phiBSYaeZ9QJX38OPecXo= -github.com/aws-controllers-k8s/runtime v0.10.0/go.mod h1:kG2WM4JAmLgf67cgZV9IZUkY2DsrUzsaNbmhFMfb05c= +github.com/aws-controllers-k8s/runtime v0.12.0 h1:G/lCEozh4Brsv1Ojqyl9D/whpq/YvcFtDZBWXf6YIgI= +github.com/aws-controllers-k8s/runtime v0.12.0/go.mod h1:kG2WM4JAmLgf67cgZV9IZUkY2DsrUzsaNbmhFMfb05c= github.com/aws/aws-sdk-go v1.37.10 h1:LRwl+97B4D69Z7tz+eRUxJ1C7baBaIYhgrn5eLtua+Q= github.com/aws/aws-sdk-go v1.37.10/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= diff --git a/pkg/resource/subnet/delta.go b/pkg/resource/subnet/delta.go index ad9938c0..db2d5f1d 100644 --- a/pkg/resource/subnet/delta.go +++ b/pkg/resource/subnet/delta.go @@ -16,9 +16,16 @@ package subnet import ( + "reflect" + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" ) +// Hack to avoid import errors during build... +var ( + _ = &reflect.Method{} +) + // newResourceDelta returns a new `ackcompare.Delta` used to compare two // resources func newResourceDelta( @@ -67,7 +74,9 @@ func newResourceDelta( delta.Add("Spec.OutpostARN", a.ko.Spec.OutpostARN, b.ko.Spec.OutpostARN) } } - + if !reflect.DeepEqual(a.ko.Spec.TagSpecifications, b.ko.Spec.TagSpecifications) { + delta.Add("Spec.TagSpecifications", a.ko.Spec.TagSpecifications, b.ko.Spec.TagSpecifications) + } if ackcompare.HasNilDifference(a.ko.Spec.VPCID, b.ko.Spec.VPCID) { delta.Add("Spec.VPCID", a.ko.Spec.VPCID, b.ko.Spec.VPCID) } else if a.ko.Spec.VPCID != nil && b.ko.Spec.VPCID != nil { diff --git a/pkg/resource/subnet/sdk.go b/pkg/resource/subnet/sdk.go index 82b53afc..fd20ceab 100644 --- a/pkg/resource/subnet/sdk.go +++ b/pkg/resource/subnet/sdk.go @@ -50,9 +50,13 @@ func (rm *resourceManager) sdkFind( rlog := ackrtlog.FromContext(ctx) exit := rlog.Trace("rm.sdkFind") defer exit(err) - if isRequiredFieldsMissingFromInput(r) { + // 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 @@ -206,6 +210,16 @@ func (rm *resourceManager) sdkFind( 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.SubnetID == nil + +} + // newListRequestPayload returns SDK-specific struct for the HTTP request // payload of the List API call for the resource func (rm *resourceManager) newListRequestPayload( diff --git a/pkg/resource/vpc/delta.go b/pkg/resource/vpc/delta.go index 70f55a0d..720e6080 100644 --- a/pkg/resource/vpc/delta.go +++ b/pkg/resource/vpc/delta.go @@ -16,9 +16,16 @@ package vpc import ( + "reflect" + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" ) +// Hack to avoid import errors during build... +var ( + _ = &reflect.Method{} +) + // newResourceDelta returns a new `ackcompare.Delta` used to compare two // resources func newResourceDelta( @@ -74,6 +81,9 @@ func newResourceDelta( delta.Add("Spec.IPv6Pool", a.ko.Spec.IPv6Pool, b.ko.Spec.IPv6Pool) } } + 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/vpc/sdk.go b/pkg/resource/vpc/sdk.go index dbf8c5b6..65984294 100644 --- a/pkg/resource/vpc/sdk.go +++ b/pkg/resource/vpc/sdk.go @@ -50,9 +50,13 @@ func (rm *resourceManager) sdkFind( rlog := ackrtlog.FromContext(ctx) exit := rlog.Trace("rm.sdkFind") defer exit(err) - if isRequiredFieldsMissingFromInput(r) { + // 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 @@ -196,6 +200,16 @@ func (rm *resourceManager) sdkFind( 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.VPCID == nil + +} + // newListRequestPayload returns SDK-specific struct for the HTTP request // payload of the List API call for the resource func (rm *resourceManager) newListRequestPayload( diff --git a/templates/hooks/subnet/sdk_read_many_pre_build_request.go.tpl b/templates/hooks/subnet/sdk_read_many_pre_build_request.go.tpl deleted file mode 100644 index 732bc19d..00000000 --- a/templates/hooks/subnet/sdk_read_many_pre_build_request.go.tpl +++ /dev/null @@ -1,3 +0,0 @@ - if isRequiredFieldsMissingFromInput(r) { - return nil, ackerr.NotFound - } \ No newline at end of file diff --git a/templates/hooks/vpc/sdk_read_many_pre_build_request.go.tpl b/templates/hooks/vpc/sdk_read_many_pre_build_request.go.tpl deleted file mode 100644 index 732bc19d..00000000 --- a/templates/hooks/vpc/sdk_read_many_pre_build_request.go.tpl +++ /dev/null @@ -1,3 +0,0 @@ - if isRequiredFieldsMissingFromInput(r) { - return nil, ackerr.NotFound - } \ No newline at end of file From 9bf475ff16c719dff51e8ee9d312afa37ba85be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Wed, 18 Aug 2021 16:51:07 -0500 Subject: [PATCH 08/10] remove unused hooks --- pkg/resource/subnet/hooks.go | 6 ------ pkg/resource/vpc/hooks.go | 6 ------ 2 files changed, 12 deletions(-) diff --git a/pkg/resource/subnet/hooks.go b/pkg/resource/subnet/hooks.go index a2ab928e..7b46f296 100644 --- a/pkg/resource/subnet/hooks.go +++ b/pkg/resource/subnet/hooks.go @@ -19,12 +19,6 @@ import ( svcsdk "github.com/aws/aws-sdk-go/service/ec2" ) -// isRequiredFieldsMissingFromInput returns True if CR is -// missing required fields for reconciliation. -func isRequiredFieldsMissingFromInput(r *resource) bool { - return r.ko.Status.State == nil -} - // addIDToListRequest adds requested-resource VpcId to ListRequest. Return error to indicate to callers that the // resource is not yet created. func addIDToListRequest(r *resource, input *svcsdk.DescribeSubnetsInput) error { diff --git a/pkg/resource/vpc/hooks.go b/pkg/resource/vpc/hooks.go index df700541..e182a3fe 100644 --- a/pkg/resource/vpc/hooks.go +++ b/pkg/resource/vpc/hooks.go @@ -19,12 +19,6 @@ import ( svcsdk "github.com/aws/aws-sdk-go/service/ec2" ) -// isRequiredFieldsMissingFromInput returns True if CR is -// missing required fields for reconciliation. -func isRequiredFieldsMissingFromInput(r *resource) bool { - return r.ko.Status.State == nil -} - // addIDToListRequest adds requested-resource VpcId to ListRequest. Return error to indicate to callers that the // resource is not yet created. func addIDToListRequest(r *resource, input *svcsdk.DescribeVpcsInput) error { From 8e612e9d79738392d37406800dc2a1a7c69a1c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Mon, 23 Aug 2021 11:42:27 -0500 Subject: [PATCH 09/10] add empty val check to hooks --- pkg/resource/subnet/hooks.go | 6 +++--- pkg/resource/vpc/hooks.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/resource/subnet/hooks.go b/pkg/resource/subnet/hooks.go index 7b46f296..d8b05b2d 100644 --- a/pkg/resource/subnet/hooks.go +++ b/pkg/resource/subnet/hooks.go @@ -19,10 +19,10 @@ import ( svcsdk "github.com/aws/aws-sdk-go/service/ec2" ) -// addIDToListRequest adds requested-resource VpcId to ListRequest. Return error to indicate to callers that the -// resource is not yet created. +// addIDToListRequest adds requested-resource SubnetId to ListRequest. +// Return error to indicate to callers that the resource is not yet created. func addIDToListRequest(r *resource, input *svcsdk.DescribeSubnetsInput) error { - if r.ko.Status.SubnetID == nil { + if r.ko.Status.SubnetID == nil || *r.ko.Status.SubnetID == "" { return errors.New("unable to extract subnetId from Kubernetes resource") } input.SubnetIds = []*string{r.ko.Status.SubnetID} diff --git a/pkg/resource/vpc/hooks.go b/pkg/resource/vpc/hooks.go index e182a3fe..47c1d7ce 100644 --- a/pkg/resource/vpc/hooks.go +++ b/pkg/resource/vpc/hooks.go @@ -19,10 +19,10 @@ import ( svcsdk "github.com/aws/aws-sdk-go/service/ec2" ) -// addIDToListRequest adds requested-resource VpcId to ListRequest. Return error to indicate to callers that the -// resource is not yet created. +// addIDToListRequest adds requested-resource VpcId to ListRequest. +// Return error to indicate to callers that the resource is not yet created. func addIDToListRequest(r *resource, input *svcsdk.DescribeVpcsInput) error { - if r.ko.Status.VPCID == nil { + if r.ko.Status.VPCID == nil || *r.ko.Status.VPCID == "" { return errors.New("unable to extract vpcId from Kubernetes resource") } input.VpcIds = []*string{r.ko.Status.VPCID} From 9dc4e2bd85dd8479e90801af41f76c6fbc32bdd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=E2=84=A2=EF=B8=8F?= Date: Mon, 23 Aug 2021 16:30:14 -0500 Subject: [PATCH 10/10] correct subnet template_path --- generator.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator.yaml b/generator.yaml index 65ebc635..70238a1e 100644 --- a/generator.yaml +++ b/generator.yaml @@ -70,7 +70,7 @@ resources: Subnet: hooks: sdk_read_many_post_build_request: - template_path: hooks/vpc/sdk_read_many_post_build_request.go.tpl + template_path: hooks/subnet/sdk_read_many_post_build_request.go.tpl exceptions: terminal_codes: - InvalidVpcID.Malformed