diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 193bd35d..0d4de197 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2022-04-15T17:13:39Z" - build_hash: 50c64871bcaf88b9ee200eb8d6b8245fa8f675eb - go_version: go1.17.5 - version: v0.18.4 -api_directory_checksum: 35ef0e4da69ded8c1fa7a4a6029510864a1069af + build_date: "2022-05-03T19:26:03Z" + build_hash: 95f81d38b4dcdb28193e1f8b04c1c6f995c26cb9 + go_version: go1.18.1 + version: v0.18.4-7-g95f81d3-dirty +api_directory_checksum: 4721a2b09c125750c8bd7e6e9449e4c6ef9c9b54 api_version: v1alpha1 aws_sdk_go_version: v1.42.0 generator_config_info: - file_checksum: 32301fc646db64b7beb3541310c727da6b6d8dc5 + file_checksum: e96b0305d488b1c0a3f9eff5dce5e54ae6958477 original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index 6dde027f..401f985a 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -23,6 +23,8 @@ ignore: # support EC2-VPC only - AllocateAddressInput.Domain - AllocateAddressOutput.Domain + - RunInstancesInput.ClientToken + - RunInstancesInput.DryRun resource_names: - AccountAttribute - CapacityReservation @@ -38,7 +40,7 @@ ignore: - Fleet - FpgaImage - Image - - Instance + #- Instance - InstanceEventWindow - InstanceExportTask #- InternetGateway @@ -56,6 +58,7 @@ ignore: - NetworkInterface - PlacementGroup - ReplaceRootVolumeTask + #- Reservation - ReservedInstancesListing - RestoreImageTask #- RouteTable @@ -111,6 +114,18 @@ operations: operation_type: - Delete resource_name: VpcEndpoint + RunInstances: + operation_type: + - Create + resource_name: Reservation + DescribeInstances: + operation_type: + - List + resource_name: Reservation + TerminateInstances: + operation_type: + - Delete + resource_name: Reservation resources: DhcpOptions: fields: @@ -224,6 +239,15 @@ resources: - path: Status.State in: - available + Reservation: + fields: + ReservationId: + is_primary_key: true + hooks: + sdk_delete_post_build_request: + template_path: hooks/reservation/sdk_delete_post_build_request.go.tpl + sdk_read_many_post_build_request: + template_path: hooks/reservation/sdk_read_many_post_build_request.go.tpl SecurityGroup: fields: # support EC2-VPC only diff --git a/apis/v1alpha1/reservation.go b/apis/v1alpha1/reservation.go new file mode 100644 index 00000000..fa113e3b --- /dev/null +++ b/apis/v1alpha1/reservation.go @@ -0,0 +1,286 @@ +// 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" +) + +// ReservationSpec defines the desired state of Reservation. +// +// Describes a launch request for one or more instances, and includes owner, +// requester, and security group information that applies to all instances in +// the launch request. +type ReservationSpec struct { + // Reserved. + AdditionalInfo *string `json:"additionalInfo,omitempty"` + // The block device mapping, which defines the EBS volumes and instance store + // volumes to attach to the instance at launch. For more information, see Block + // device mappings (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) + // in the Amazon EC2 User Guide. + BlockDeviceMappings []*BlockDeviceMapping `json:"blockDeviceMappings,omitempty"` + // Information about the Capacity Reservation targeting option. If you do not + // specify this parameter, the instance's Capacity Reservation preference defaults + // to open, which enables it to run in any open Capacity Reservation that has + // matching attributes (instance type, platform, Availability Zone). + CapacityReservationSpecification *CapacityReservationSpecification `json:"capacityReservationSpecification,omitempty"` + // The CPU options for the instance. For more information, see Optimizing CPU + // options (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) + // in the Amazon EC2 User Guide. + CPUOptions *CPUOptionsRequest `json:"cpuOptions,omitempty"` + // The credit option for CPU usage of the burstable performance instance. Valid + // values are standard and unlimited. To change this attribute after launch, + // use ModifyInstanceCreditSpecification (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceCreditSpecification.html). + // For more information, see Burstable performance instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) + // in the Amazon EC2 User Guide. + // + // Default: standard (T2 instances) or unlimited (T3/T3a instances) + // + // For T3 instances with host tenancy, only standard is supported. + CreditSpecification *CreditSpecificationRequest `json:"creditSpecification,omitempty"` + // If you set this parameter to true, you can't terminate the instance using + // the Amazon EC2 console, CLI, or API; otherwise, you can. To change this attribute + // after launch, use ModifyInstanceAttribute (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html). + // Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, + // you can terminate the instance by running the shutdown command from the instance. + // + // Default: false + DisableAPITermination *bool `json:"disableAPITermination,omitempty"` + // Indicates whether the instance is optimized for Amazon EBS I/O. This optimization + // provides dedicated throughput to Amazon EBS and an optimized configuration + // stack to provide optimal Amazon EBS I/O performance. This optimization isn't + // available with all instance types. Additional usage charges apply when using + // an EBS-optimized instance. + // + // Default: false + EBSOptimized *bool `json:"ebsOptimized,omitempty"` + // An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource + // that you can attach to your Windows instance to accelerate the graphics performance + // of your applications. For more information, see Amazon EC2 Elastic GPUs (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html) + // in the Amazon EC2 User Guide. + ElasticGPUSpecification []*ElasticGPUSpecification `json:"elasticGPUSpecification,omitempty"` + // An elastic inference accelerator to associate with the instance. Elastic + // inference accelerators are a resource you can attach to your Amazon EC2 instances + // to accelerate your Deep Learning (DL) inference workloads. + // + // You cannot specify accelerators from different generations in the same request. + ElasticInferenceAccelerators []*ElasticInferenceAccelerator `json:"elasticInferenceAccelerators,omitempty"` + // Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. + // For more information, see What is Amazon Web Services Nitro Enclaves? (https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html) + // in the Amazon Web Services Nitro Enclaves User Guide. + // + // You can't enable Amazon Web Services Nitro Enclaves and hibernation on the + // same instance. + EnclaveOptions *EnclaveOptionsRequest `json:"enclaveOptions,omitempty"` + // Indicates whether an instance is enabled for hibernation. For more information, + // see Hibernate your instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + // in the Amazon EC2 User Guide. + // + // You can't enable hibernation and Amazon Web Services Nitro Enclaves on the + // same instance. + HibernationOptions *HibernationOptionsRequest `json:"hibernationOptions,omitempty"` + // The name or Amazon Resource Name (ARN) of an IAM instance profile. + IAMInstanceProfile *IAMInstanceProfileSpecification `json:"iamInstanceProfile,omitempty"` + // The ID of the AMI. An AMI ID is required to launch an instance and must be + // specified here or in a launch template. + ImageID *string `json:"imageID,omitempty"` + // Indicates whether an instance stops or terminates when you initiate shutdown + // from the instance (using the operating system command for system shutdown). + // + // Default: stop + InstanceInitiatedShutdownBehavior *string `json:"instanceInitiatedShutdownBehavior,omitempty"` + // The market (purchasing) option for the instances. + // + // For RunInstances, persistent Spot Instance requests are only supported when + // InstanceInterruptionBehavior is set to either hibernate or stop. + InstanceMarketOptions *InstanceMarketOptionsRequest `json:"instanceMarketOptions,omitempty"` + // The instance type. For more information, see Instance types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + // in the Amazon EC2 User Guide. + // + // Default: m1.small + InstanceType *string `json:"instanceType,omitempty"` + // [EC2-VPC] The number of IPv6 addresses to associate with the primary network + // interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. + // You cannot specify this option and the option to assign specific IPv6 addresses + // in the same request. You can specify this option if you've specified a minimum + // number of instances to launch. + // + // You cannot specify this option and the network interfaces option in the same + // request. + IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + // [EC2-VPC] The IPv6 addresses from the range of the subnet to associate with + // the primary network interface. You cannot specify this option and the option + // to assign a number of IPv6 addresses in the same request. You cannot specify + // this option if you've specified a minimum number of instances to launch. + // + // You cannot specify this option and the network interfaces option in the same + // request. + IPv6Addresses []*InstanceIPv6Address `json:"ipv6Addresses,omitempty"` + // The ID of the kernel. + // + // We recommend that you use PV-GRUB instead of kernels and RAM disks. For more + // information, see PV-GRUB (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + // in the Amazon EC2 User Guide. + KernelID *string `json:"kernelID,omitempty"` + // The name of the key pair. You can create a key pair using CreateKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html) + // or ImportKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html). + // + // If you do not specify a key pair, you can't connect to the instance unless + // you choose an AMI that is configured to allow users another way to log in. + KeyName *string `json:"keyName,omitempty"` + // The launch template to use to launch the instances. Any parameters that you + // specify in RunInstances override the same parameters in the launch template. + // You can specify either the name or ID of a launch template, but not both. + LaunchTemplate *LaunchTemplateSpecification `json:"launchTemplate,omitempty"` + // The license configurations. + LicenseSpecifications []*LicenseConfigurationRequest `json:"licenseSpecifications,omitempty"` + // The maximum number of instances to launch. If you specify more instances + // than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches + // the largest possible number of instances above MinCount. + // + // Constraints: Between 1 and the maximum number you're allowed for the specified + // instance type. For more information about the default limits, and how to + // request an increase, see How many instances can I run in Amazon EC2 (http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2) + // in the Amazon EC2 FAQ. + // +kubebuilder:validation:Required + MaxCount *int64 `json:"maxCount"` + // 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). + MetadataOptions *InstanceMetadataOptionsRequest `json:"metadataOptions,omitempty"` + // The minimum number of instances to launch. If you specify a minimum that + // is more instances than Amazon EC2 can launch in the target Availability Zone, + // Amazon EC2 launches no instances. + // + // Constraints: Between 1 and the maximum number you're allowed for the specified + // instance type. For more information about the default limits, and how to + // request an increase, see How many instances can I run in Amazon EC2 (http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2) + // in the Amazon EC2 General FAQ. + // +kubebuilder:validation:Required + MinCount *int64 `json:"minCount"` + // Specifies whether detailed monitoring is enabled for the instance. + Monitoring *RunInstancesMonitoringEnabled `json:"monitoring,omitempty"` + // The network interfaces to associate with the instance. If you specify a network + // interface, you must specify any security groups and subnets as part of the + // network interface. + NetworkInterfaces []*InstanceNetworkInterfaceSpecification `json:"networkInterfaces,omitempty"` + // The placement for the instance. + Placement *Placement `json:"placement,omitempty"` + // [EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 + // address range of the subnet. + // + // Only one private IP address can be designated as primary. You can't specify + // this option if you've specified the option to designate a private IP address + // as the primary IP address in a network interface specification. You cannot + // specify this option if you're launching more than one instance in the request. + // + // You cannot specify this option and the network interfaces option in the same + // request. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // The ID of the RAM disk to select. Some kernels require additional drivers + // at launch. Check the kernel requirements for information about whether you + // need to specify a RAM disk. To find kernel requirements, go to the Amazon + // Web Services Resource Center and search for the kernel ID. + // + // We recommend that you use PV-GRUB instead of kernels and RAM disks. For more + // information, see PV-GRUB (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + // in the Amazon EC2 User Guide. + RAMDiskID *string `json:"ramDiskID,omitempty"` + // The IDs of the security groups. You can create a security group using CreateSecurityGroup + // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html). + // + // If you specify a network interface, you must specify any security groups + // as part of the network interface. + SecurityGroupIDs []*string `json:"securityGroupIDs,omitempty"` + // [EC2-Classic, default VPC] The names of the security groups. For a nondefault + // VPC, you must use security group IDs instead. + // + // If you specify a network interface, you must specify any security groups + // as part of the network interface. + // + // Default: Amazon EC2 uses the default security group. + SecurityGroups []*string `json:"securityGroups,omitempty"` + // [EC2-VPC] The ID of the subnet to launch the instance into. + // + // If you specify a network interface, you must specify any subnets as part + // of the network interface. + SubnetID *string `json:"subnetID,omitempty"` + // The tags to apply to the resources during launch. You can only tag instances + // and volumes on launch. The specified tags are applied to all instances or + // volumes that are created during launch. To tag a resource after it has been + // created, see CreateTags (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html). + TagSpecifications []*TagSpecification `json:"tagSpecifications,omitempty"` + // The user data to make available to the instance. For more information, see + // Running commands on your Linux instance at launch (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) + // (Linux) and Adding User Data (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) + // (Windows). If you are using a command line tool, base64-encoding is performed + // for you, and you can load the text from a file. Otherwise, you must provide + // base64-encoded text. User data is limited to 16 KB. + UserData *string `json:"userData,omitempty"` +} + +// ReservationStatus defines the observed state of Reservation +type ReservationStatus 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"` + // [EC2-Classic only] The security groups. + // +kubebuilder:validation:Optional + Groups []*GroupIdentifier `json:"groups,omitempty"` + // The instances. + // +kubebuilder:validation:Optional + Instances []*Instance `json:"instances,omitempty"` + // The ID of the Amazon Web Services account that owns the reservation. + // +kubebuilder:validation:Optional + OwnerID *string `json:"ownerID,omitempty"` + // The ID of the requester that launched the instances on your behalf (for example, + // Amazon Web Services Management Console or Auto Scaling). + // +kubebuilder:validation:Optional + RequesterID *string `json:"requesterID,omitempty"` + // The ID of the reservation. + // +kubebuilder:validation:Optional + ReservationID *string `json:"reservationID,omitempty"` +} + +// Reservation is the Schema for the Reservations API +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +type Reservation struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec ReservationSpec `json:"spec,omitempty"` + Status ReservationStatus `json:"status,omitempty"` +} + +// ReservationList contains a list of Reservation +// +kubebuilder:object:root=true +type ReservationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Reservation `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Reservation{}, &ReservationList{}) +} diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index f89e5dfb..b70fd905 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -256,9 +256,11 @@ type BaselineEBSBandwidthMbpsRequest struct { // Describes a block device mapping, which defines the EBS volumes and instance // store volumes to attach to an instance at launch. type BlockDeviceMapping struct { - DeviceName *string `json:"deviceName,omitempty"` - NoDevice *string `json:"noDevice,omitempty"` - VirtualName *string `json:"virtualName,omitempty"` + DeviceName *string `json:"deviceName,omitempty"` + // Describes a block device for an EBS volume. + EBS *EBSBlockDevice `json:"ebs,omitempty"` + NoDevice *string `json:"noDevice,omitempty"` + VirtualName *string `json:"virtualName,omitempty"` } // Describes a bundle task. @@ -366,8 +368,37 @@ type CapacityReservationGroup struct { OwnerID *string `json:"ownerID,omitempty"` } +// Describes an instance's Capacity Reservation targeting option. You can specify +// only one parameter at a time. If you specify CapacityReservationPreference +// and CapacityReservationTarget, the request fails. +// +// Use the CapacityReservationPreference parameter to configure the instance +// to run as an On-Demand Instance or to run in any open Capacity Reservation +// that has matching attributes (instance type, platform, Availability Zone). +// Use the CapacityReservationTarget parameter to explicitly target a specific +// Capacity Reservation or a Capacity Reservation group. +type CapacityReservationSpecification struct { + CapacityReservationPreference *string `json:"capacityReservationPreference,omitempty"` + // Describes a target Capacity Reservation or Capacity Reservation group. + CapacityReservationTarget *CapacityReservationTarget `json:"capacityReservationTarget,omitempty"` +} + +// Describes the instance's Capacity Reservation targeting preferences. The +// action returns the capacityReservationPreference response element if the +// instance is configured to run in On-Demand capacity, or if it is configured +// in run in any open Capacity Reservation that has matching attributes (instance +// type, platform, Availability Zone). The action returns the capacityReservationTarget +// response element if the instance explicily targets a specific Capacity Reservation +// or Capacity Reservation group. +type CapacityReservationSpecificationResponse struct { + CapacityReservationPreference *string `json:"capacityReservationPreference,omitempty"` + // Describes a target Capacity Reservation or Capacity Reservation group. + CapacityReservationTarget *CapacityReservationTargetResponse `json:"capacityReservationTarget,omitempty"` +} + // Describes a target Capacity Reservation or Capacity Reservation group. type CapacityReservationTarget struct { + CapacityReservationID *string `json:"capacityReservationID,omitempty"` CapacityReservationResourceGroupARN *string `json:"capacityReservationResourceGroupARN,omitempty"` } @@ -403,9 +434,10 @@ type ClassicLinkDNSSupport struct { // Describes a linked EC2-Classic instance. type ClassicLinkInstance struct { - InstanceID *string `json:"instanceID,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - VPCID *string `json:"vpcID,omitempty"` + Groups []*GroupIdentifier `json:"groups,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + VPCID *string `json:"vpcID,omitempty"` } // Describes a Classic Load Balancer. @@ -559,6 +591,12 @@ type CreateFleetError struct { ErrorMessage *string `json:"errorMessage,omitempty"` } +// Describes the instances that were launched by the fleet. +type CreateFleetInstance struct { + InstanceType *string `json:"instanceType,omitempty"` + Platform *string `json:"platform,omitempty"` +} + type CreateRouteInput struct { CarrierGatewayID *string `json:"carrierGatewayID,omitempty"` DestinationCIDRBlock *string `json:"destinationCIDRBlock,omitempty"` @@ -687,6 +725,12 @@ type DescribeFleetError struct { ErrorMessage *string `json:"errorMessage,omitempty"` } +// Describes the instances that were launched by the fleet. +type DescribeFleetsInstances struct { + InstanceType *string `json:"instanceType,omitempty"` + Platform *string `json:"platform,omitempty"` +} + // Describes the destination options for a flow log. type DestinationOptionsRequest struct { HiveCompatiblePartitions *bool `json:"hiveCompatiblePartitions,omitempty"` @@ -772,8 +816,10 @@ type EBSBlockDevice struct { 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"` + VolumeType *string `json:"volumeType,omitempty"` } // Describes a parameter used to set up an EBS volume in a block device mapping. @@ -826,7 +872,8 @@ type ElasticGPUs struct { // Describes an elastic inference accelerator. type ElasticInferenceAccelerator struct { - Type *string `json:"type_,omitempty"` + Count *int64 `json:"count,omitempty"` + Type *string `json:"type_,omitempty"` } // Describes the association between an instance and an elastic inference accelerator. @@ -946,25 +993,27 @@ type ExportToS3TaskSpecification struct { // Describes an Amazon FPGA image (AFI). type FPGAImage struct { - CreateTime *metav1.Time `json:"createTime,omitempty"` - DataRetentionSupport *bool `json:"dataRetentionSupport,omitempty"` - Description *string `json:"description,omitempty"` - FPGAImageGlobalID *string `json:"fpgaImageGlobalID,omitempty"` - FPGAImageID *string `json:"fpgaImageID,omitempty"` - Name *string `json:"name,omitempty"` - OwnerAlias *string `json:"ownerAlias,omitempty"` - OwnerID *string `json:"ownerID,omitempty"` - Public *bool `json:"public,omitempty"` - ShellVersion *string `json:"shellVersion,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - UpdateTime *metav1.Time `json:"updateTime,omitempty"` + CreateTime *metav1.Time `json:"createTime,omitempty"` + DataRetentionSupport *bool `json:"dataRetentionSupport,omitempty"` + Description *string `json:"description,omitempty"` + FPGAImageGlobalID *string `json:"fpgaImageGlobalID,omitempty"` + FPGAImageID *string `json:"fpgaImageID,omitempty"` + Name *string `json:"name,omitempty"` + OwnerAlias *string `json:"ownerAlias,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + ProductCodes []*ProductCode `json:"productCodes,omitempty"` + Public *bool `json:"public,omitempty"` + ShellVersion *string `json:"shellVersion,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + UpdateTime *metav1.Time `json:"updateTime,omitempty"` } // Describes an Amazon FPGA image (AFI) attribute. type FPGAImageAttribute struct { - Description *string `json:"description,omitempty"` - FPGAImageID *string `json:"fpgaImageID,omitempty"` - Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + FPGAImageID *string `json:"fpgaImageID,omitempty"` + Name *string `json:"name,omitempty"` + ProductCodes []*ProductCode `json:"productCodes,omitempty"` } // Describes the state of the bitstream generation process for an Amazon FPGA @@ -1000,11 +1049,13 @@ type Filter struct { // Information about a Capacity Reservation in a Capacity Reservation Fleet. type FleetCapacityReservation struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - AvailabilityZoneID *string `json:"availabilityZoneID,omitempty"` - CreateDate *metav1.Time `json:"createDate,omitempty"` - EBSOptimized *bool `json:"ebsOptimized,omitempty"` - TotalInstanceCount *int64 `json:"totalInstanceCount,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + AvailabilityZoneID *string `json:"availabilityZoneID,omitempty"` + CapacityReservationID *string `json:"capacityReservationID,omitempty"` + CreateDate *metav1.Time `json:"createDate,omitempty"` + EBSOptimized *bool `json:"ebsOptimized,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + TotalInstanceCount *int64 `json:"totalInstanceCount,omitempty"` } // Describes an EC2 Fleet. @@ -1022,6 +1073,7 @@ type FleetData struct { // Describes overrides for a launch template. type FleetLaunchTemplateOverrides struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` MaxPrice *string `json:"maxPrice,omitempty"` SubnetID *string `json:"subnetID,omitempty"` } @@ -1029,8 +1081,11 @@ type FleetLaunchTemplateOverrides struct { // Describes overrides for a launch template. type FleetLaunchTemplateOverridesRequest struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` MaxPrice *string `json:"maxPrice,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` + // Describes the placement of an instance. + Placement *Placement `json:"placement,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // Describes the Amazon EC2 launch template and the launch template version @@ -1049,7 +1104,8 @@ type FleetLaunchTemplateSpecification struct { // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html) // in the Amazon EC2 User Guide. type FleetLaunchTemplateSpecificationRequest struct { - Version *string `json:"version,omitempty"` + LaunchTemplateID *string `json:"launchTemplateID,omitempty"` + Version *string `json:"version,omitempty"` } // The strategy to use when Amazon EC2 emits a signal that your Spot Instance @@ -1175,9 +1231,11 @@ type IAMInstanceProfile struct { // Describes an association between an IAM instance profile and an instance. type IAMInstanceProfileAssociation struct { - AssociationID *string `json:"associationID,omitempty"` - InstanceID *string `json:"instanceID,omitempty"` - Timestamp *metav1.Time `json:"timestamp,omitempty"` + AssociationID *string `json:"associationID,omitempty"` + // Describes an IAM instance profile. + IAMInstanceProfile *IAMInstanceProfile `json:"iamInstanceProfile,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + Timestamp *metav1.Time `json:"timestamp,omitempty"` } // Describes an IAM instance profile. @@ -1282,23 +1340,32 @@ type IPv6Range struct { // Describes an image. type Image struct { - CreationDate *string `json:"creationDate,omitempty"` - DeprecationTime *string `json:"deprecationTime,omitempty"` - Description *string `json:"description,omitempty"` - ENASupport *bool `json:"enaSupport,omitempty"` - ImageID *string `json:"imageID,omitempty"` - ImageLocation *string `json:"imageLocation,omitempty"` - ImageOwnerAlias *string `json:"imageOwnerAlias,omitempty"` - KernelID *string `json:"kernelID,omitempty"` - Name *string `json:"name,omitempty"` - OwnerID *string `json:"ownerID,omitempty"` - PlatformDetails *string `json:"platformDetails,omitempty"` - Public *bool `json:"public,omitempty"` - RamdiskID *string `json:"ramdiskID,omitempty"` - RootDeviceName *string `json:"rootDeviceName,omitempty"` - SriovNetSupport *string `json:"sriovNetSupport,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - UsageOperation *string `json:"usageOperation,omitempty"` + Architecture *string `json:"architecture,omitempty"` + BootMode *string `json:"bootMode,omitempty"` + CreationDate *string `json:"creationDate,omitempty"` + DeprecationTime *string `json:"deprecationTime,omitempty"` + Description *string `json:"description,omitempty"` + ENASupport *bool `json:"enaSupport,omitempty"` + Hypervisor *string `json:"hypervisor,omitempty"` + ImageID *string `json:"imageID,omitempty"` + ImageLocation *string `json:"imageLocation,omitempty"` + ImageOwnerAlias *string `json:"imageOwnerAlias,omitempty"` + KernelID *string `json:"kernelID,omitempty"` + Name *string `json:"name,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + Platform *string `json:"platform,omitempty"` + PlatformDetails *string `json:"platformDetails,omitempty"` + ProductCodes []*ProductCode `json:"productCodes,omitempty"` + Public *bool `json:"public,omitempty"` + RAMDiskID *string `json:"ramDiskID,omitempty"` + RootDeviceName *string `json:"rootDeviceName,omitempty"` + RootDeviceType *string `json:"rootDeviceType,omitempty"` + SRIOVNetSupport *string `json:"sriovNetSupport,omitempty"` + // Describes a state change. + StateReason *StateReason `json:"stateReason,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + UsageOperation *string `json:"usageOperation,omitempty"` + VirtualizationType *string `json:"virtualizationType,omitempty"` } // Describes the disk container object for an import image task. @@ -1306,6 +1373,7 @@ type ImageDiskContainer struct { Description *string `json:"description,omitempty"` DeviceName *string `json:"deviceName,omitempty"` Format *string `json:"format,omitempty"` + SnapshotID *string `json:"snapshotID,omitempty"` URL *string `json:"url,omitempty"` } @@ -1322,6 +1390,7 @@ type ImportImageLicenseConfigurationResponse struct { // Describes an import image task. type ImportImageTask struct { Architecture *string `json:"architecture,omitempty"` + BootMode *string `json:"bootMode,omitempty"` Description *string `json:"description,omitempty"` Encrypted *bool `json:"encrypted,omitempty"` Hypervisor *string `json:"hypervisor,omitempty"` @@ -1339,16 +1408,24 @@ type ImportImageTask struct { // Describes the launch specification for VM import. type ImportInstanceLaunchSpecification struct { - AdditionalInfo *string `json:"additionalInfo,omitempty"` - Monitoring *bool `json:"monitoring,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` + AdditionalInfo *string `json:"additionalInfo,omitempty"` + Architecture *string `json:"architecture,omitempty"` + GroupIDs []*string `json:"groupIDs,omitempty"` + GroupNames []*string `json:"groupNames,omitempty"` + InstanceInitiatedShutdownBehavior *string `json:"instanceInitiatedShutdownBehavior,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + Monitoring *bool `json:"monitoring,omitempty"` + // Describes the placement of an instance. + Placement *Placement `json:"placement,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // Describes an import instance task. type ImportInstanceTaskDetails struct { Description *string `json:"description,omitempty"` InstanceID *string `json:"instanceID,omitempty"` + Platform *string `json:"platform,omitempty"` } // Describes an import volume task. @@ -1376,38 +1453,84 @@ 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"` - ENASupport *bool `json:"enaSupport,omitempty"` - ImageID *string `json:"imageID,omitempty"` - InstanceID *string `json:"instanceID,omitempty"` - KernelID *string `json:"kernelID,omitempty"` - KeyName *string `json:"keyName,omitempty"` - LaunchTime *metav1.Time `json:"launchTime,omitempty"` - OutpostARN *string `json:"outpostARN,omitempty"` - PlatformDetails *string `json:"platformDetails,omitempty"` - PrivateDNSName *string `json:"privateDNSName,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - PublicDNSName *string `json:"publicDNSName,omitempty"` - PublicIPAddress *string `json:"publicIPAddress,omitempty"` - RamdiskID *string `json:"ramdiskID,omitempty"` - RootDeviceName *string `json:"rootDeviceName,omitempty"` - SourceDestCheck *bool `json:"sourceDestCheck,omitempty"` - SpotInstanceRequestID *string `json:"spotInstanceRequestID,omitempty"` - SriovNetSupport *string `json:"sriovNetSupport,omitempty"` + AMILaunchIndex *int64 `json:"amiLaunchIndex,omitempty"` + Architecture *string `json:"architecture,omitempty"` + BlockDeviceMappings []*InstanceBlockDeviceMapping `json:"blockDeviceMappings,omitempty"` + BootMode *string `json:"bootMode,omitempty"` + CapacityReservationID *string `json:"capacityReservationID,omitempty"` + // Describes the instance's Capacity Reservation targeting preferences. The + // action returns the capacityReservationPreference response element if the + // instance is configured to run in On-Demand capacity, or if it is configured + // in run in any open Capacity Reservation that has matching attributes (instance + // type, platform, Availability Zone). The action returns the capacityReservationTarget + // response element if the instance explicily targets a specific Capacity Reservation + // or Capacity Reservation group. + CapacityReservationSpecification *CapacityReservationSpecificationResponse `json:"capacityReservationSpecification,omitempty"` + ClientToken *string `json:"clientToken,omitempty"` + // The CPU options for the instance. + CPUOptions *CPUOptions `json:"cpuOptions,omitempty"` + EBSOptimized *bool `json:"ebsOptimized,omitempty"` + ElasticGPUAssociations []*ElasticGPUAssociation `json:"elasticGPUAssociations,omitempty"` + ElasticInferenceAcceleratorAssociations []*ElasticInferenceAcceleratorAssociation `json:"elasticInferenceAcceleratorAssociations,omitempty"` + ENASupport *bool `json:"enaSupport,omitempty"` + // Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. + EnclaveOptions *EnclaveOptions `json:"enclaveOptions,omitempty"` + // Indicates whether your instance is configured for hibernation. This parameter + // is valid only if the instance meets the hibernation prerequisites (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). + // For more information, see Hibernate your instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + // in the Amazon EC2 User Guide. + HibernationOptions *HibernationOptions `json:"hibernationOptions,omitempty"` + Hypervisor *string `json:"hypervisor,omitempty"` + // Describes an IAM instance profile. + IAMInstanceProfile *IAMInstanceProfile `json:"iamInstanceProfile,omitempty"` + ImageID *string `json:"imageID,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + InstanceLifecycle *string `json:"instanceLifecycle,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` + KeyName *string `json:"keyName,omitempty"` + LaunchTime *metav1.Time `json:"launchTime,omitempty"` + Licenses []*LicenseConfiguration `json:"licenses,omitempty"` + // The metadata options for the instance. + MetadataOptions *InstanceMetadataOptionsResponse `json:"metadataOptions,omitempty"` + // Describes the monitoring of an instance. + Monitoring *Monitoring `json:"monitoring,omitempty"` + NetworkInterfaces []*InstanceNetworkInterface `json:"networkInterfaces,omitempty"` + OutpostARN *string `json:"outpostARN,omitempty"` + // Describes the placement of an instance. + Placement *Placement `json:"placement,omitempty"` + Platform *string `json:"platform,omitempty"` + PlatformDetails *string `json:"platformDetails,omitempty"` + PrivateDNSName *string `json:"privateDNSName,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + ProductCodes []*ProductCode `json:"productCodes,omitempty"` + PublicDNSName *string `json:"publicDNSName,omitempty"` + PublicIPAddress *string `json:"publicIPAddress,omitempty"` + RAMDiskID *string `json:"ramDiskID,omitempty"` + RootDeviceName *string `json:"rootDeviceName,omitempty"` + RootDeviceType *string `json:"rootDeviceType,omitempty"` + SecurityGroups []*GroupIdentifier `json:"securityGroups,omitempty"` + SourceDestCheck *bool `json:"sourceDestCheck,omitempty"` + SpotInstanceRequestID *string `json:"spotInstanceRequestID,omitempty"` + SRIOVNetSupport *string `json:"sriovNetSupport,omitempty"` + // Describes the current state of an instance. + State *InstanceState `json:"state,omitempty"` + // Describes a state change. + StateReason *StateReason `json:"stateReason,omitempty"` StateTransitionReason *string `json:"stateTransitionReason,omitempty"` SubnetID *string `json:"subnetID,omitempty"` Tags []*Tag `json:"tags,omitempty"` UsageOperation *string `json:"usageOperation,omitempty"` UsageOperationUpdateTime *metav1.Time `json:"usageOperationUpdateTime,omitempty"` + VirtualizationType *string `json:"virtualizationType,omitempty"` VPCID *string `json:"vpcID,omitempty"` } // Describes a block device mapping. type InstanceBlockDeviceMapping struct { DeviceName *string `json:"deviceName,omitempty"` + // Describes a parameter used to set up an EBS volume in a block device mapping. + EBS *EBSInstanceBlockDevice `json:"ebs,omitempty"` } // Describes a block device mapping entry. @@ -1496,33 +1619,59 @@ type InstanceIPv6Prefix struct { IPv6Prefix *string `json:"ipv6Prefix,omitempty"` } +// Describes the market (purchasing) option for the instances. +type InstanceMarketOptionsRequest struct { + MarketType *string `json:"marketType,omitempty"` + // The options for Spot Instances. + SpotOptions *SpotMarketOptions `json:"spotOptions,omitempty"` +} + // The metadata options for the instance. type InstanceMetadataOptionsRequest struct { - HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` + HTTPEndpoint *string `json:"httpEndpoint,omitempty"` + HTTPProtocolIPv6 *string `json:"httpProtocolIPv6,omitempty"` + HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` + HTTPTokens *string `json:"httpTokens,omitempty"` } // The metadata options for the instance. type InstanceMetadataOptionsResponse struct { - HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` + HTTPEndpoint *string `json:"httpEndpoint,omitempty"` + HTTPProtocolIPv6 *string `json:"httpProtocolIPv6,omitempty"` + HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` + HTTPTokens *string `json:"httpTokens,omitempty"` + State *string `json:"state,omitempty"` } // Describes the monitoring of an instance. type InstanceMonitoring struct { InstanceID *string `json:"instanceID,omitempty"` + // Describes the monitoring of an instance. + Monitoring *Monitoring `json:"monitoring,omitempty"` } // Describes a network interface. type InstanceNetworkInterface struct { - Description *string `json:"description,omitempty"` - InterfaceType *string `json:"interfaceType,omitempty"` - MacAddress *string `json:"macAddress,omitempty"` - NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` - OwnerID *string `json:"ownerID,omitempty"` - PrivateDNSName *string `json:"privateDNSName,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - SourceDestCheck *bool `json:"sourceDestCheck,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` - VPCID *string `json:"vpcID,omitempty"` + // Describes association information for an Elastic IP address (IPv4). + Association *InstanceNetworkInterfaceAssociation `json:"association,omitempty"` + // Describes a network interface attachment. + Attachment *InstanceNetworkInterfaceAttachment `json:"attachment,omitempty"` + Description *string `json:"description,omitempty"` + Groups []*GroupIdentifier `json:"groups,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` + IPv4Prefixes []*InstanceIPv4Prefix `json:"ipv4Prefixes,omitempty"` + IPv6Addresses []*InstanceIPv6Address `json:"ipv6Addresses,omitempty"` + IPv6Prefixes []*InstanceIPv6Prefix `json:"ipv6Prefixes,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + PrivateDNSName *string `json:"privateDNSName,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + PrivateIPAddresses []*InstancePrivateIPAddress `json:"privateIPAddresses,omitempty"` + SourceDestCheck *bool `json:"sourceDestCheck,omitempty"` + Status *string `json:"status,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` + VPCID *string `json:"vpcID,omitempty"` } // Describes association information for an Elastic IP address (IPv4). @@ -1546,27 +1695,34 @@ type InstanceNetworkInterfaceAttachment struct { // 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"` - DeviceIndex *int64 `json:"deviceIndex,omitempty"` - InterfaceType *string `json:"interfaceType,omitempty"` - IPv4PrefixCount *int64 `json:"ipv4PrefixCount,omitempty"` - IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` - IPv6PrefixCount *int64 `json:"ipv6PrefixCount,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"` + 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"` + Groups []*string `json:"groups,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` + IPv4PrefixCount *int64 `json:"ipv4PrefixCount,omitempty"` + IPv4Prefixes []*IPv4PrefixSpecificationRequest `json:"ipv4Prefixes,omitempty"` + IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + IPv6Addresses []*InstanceIPv6Address `json:"ipv6Addresses,omitempty"` + IPv6PrefixCount *int64 `json:"ipv6PrefixCount,omitempty"` + IPv6Prefixes []*IPv6PrefixSpecificationRequest `json:"ipv6Prefixes,omitempty"` + NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` + NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + PrivateIPAddresses []*PrivateIPAddressSpecification `json:"privateIPAddresses,omitempty"` + SecondaryPrivateIPAddressCount *int64 `json:"secondaryPrivateIPAddressCount,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // Describes a private IPv4 address. type InstancePrivateIPAddress struct { - Primary *bool `json:"primary,omitempty"` - PrivateDNSName *string `json:"privateDNSName,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // Describes association information for an Elastic IP address (IPv4). + Association *InstanceNetworkInterfaceAssociation `json:"association,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateDNSName *string `json:"privateDNSName,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` } // The attributes for the instance types. When you specify instance attributes, @@ -1619,19 +1775,26 @@ type InstanceSpecification struct { // Describes the current state of an instance. type InstanceState struct { - Code *int64 `json:"code,omitempty"` + Code *int64 `json:"code,omitempty"` + Name *string `json:"name,omitempty"` } // Describes an instance state change. type InstanceStateChange struct { - InstanceID *string `json:"instanceID,omitempty"` + // Describes the current state of an instance. + CurrentState *InstanceState `json:"currentState,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + // Describes the current state of an instance. + PreviousState *InstanceState `json:"previousState,omitempty"` } // Describes the status of an instance. type InstanceStatus struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` InstanceID *string `json:"instanceID,omitempty"` - OutpostARN *string `json:"outpostARN,omitempty"` + // Describes the current state of an instance. + InstanceState *InstanceState `json:"instanceState,omitempty"` + OutpostARN *string `json:"outpostARN,omitempty"` } // Describes the instance status. @@ -1652,11 +1815,21 @@ type InstanceTagNotificationAttribute struct { IncludeAllTagsOfInstance *bool `json:"includeAllTagsOfInstance,omitempty"` } +// Describes the instance type. +type InstanceTypeInfo struct { + InstanceType *string `json:"instanceType,omitempty"` +} + // The list of instance types with the specified instance attributes. type InstanceTypeInfoFromInstanceRequirements struct { InstanceType *string `json:"instanceType,omitempty"` } +// The instance types offered. +type InstanceTypeOffering struct { + InstanceType *string `json:"instanceType,omitempty"` +} + // Information about the Capacity Reservation usage. type InstanceUsage struct { AccountID *string `json:"accountID,omitempty"` @@ -1703,12 +1876,19 @@ type LaunchPermission struct { type LaunchSpecification struct { AddressingType *string `json:"addressingType,omitempty"` EBSOptimized *bool `json:"ebsOptimized,omitempty"` - ImageID *string `json:"imageID,omitempty"` - KernelID *string `json:"kernelID,omitempty"` - KeyName *string `json:"keyName,omitempty"` - RamdiskID *string `json:"ramdiskID,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` - UserData *string `json:"userData,omitempty"` + // Describes an IAM instance profile. + IAMInstanceProfile *IAMInstanceProfileSpecification `json:"iamInstanceProfile,omitempty"` + ImageID *string `json:"imageID,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` + KeyName *string `json:"keyName,omitempty"` + // Describes the monitoring of an instance. + Monitoring *RunInstancesMonitoringEnabled `json:"monitoring,omitempty"` + NetworkInterfaces []*InstanceNetworkInterfaceSpecification `json:"networkInterfaces,omitempty"` + RAMDiskID *string `json:"ramDiskID,omitempty"` + SecurityGroups []*GroupIdentifier `json:"securityGroups,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` + UserData *string `json:"userData,omitempty"` } // Describes a launch template. @@ -1748,22 +1928,45 @@ type LaunchTemplateCPUOptionsRequest struct { ThreadsPerCore *int64 `json:"threadsPerCore,omitempty"` } +// Describes an instance's Capacity Reservation targeting option. You can specify +// only one option at a time. Use the CapacityReservationPreference parameter +// to configure the instance to run in On-Demand capacity or to run in any open +// Capacity Reservation that has matching attributes (instance type, platform, +// Availability Zone). Use the CapacityReservationTarget parameter to explicitly +// target a specific Capacity Reservation or a Capacity Reservation group. +type LaunchTemplateCapacityReservationSpecificationRequest struct { + CapacityReservationPreference *string `json:"capacityReservationPreference,omitempty"` + // Describes a target Capacity Reservation or Capacity Reservation group. + CapacityReservationTarget *CapacityReservationTarget `json:"capacityReservationTarget,omitempty"` +} + +// Information about the Capacity Reservation targeting option. +type LaunchTemplateCapacityReservationSpecificationResponse struct { + CapacityReservationPreference *string `json:"capacityReservationPreference,omitempty"` + // Describes a target Capacity Reservation or Capacity Reservation group. + CapacityReservationTarget *CapacityReservationTargetResponse `json:"capacityReservationTarget,omitempty"` +} + // Describes a block device for an EBS volume. type LaunchTemplateEBSBlockDevice struct { - 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"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Encrypted *bool `json:"encrypted,omitempty"` + IOPS *int64 `json:"iops,omitempty"` + SnapshotID *string `json:"snapshotID,omitempty"` + Throughput *int64 `json:"throughput,omitempty"` + VolumeSize *int64 `json:"volumeSize,omitempty"` + VolumeType *string `json:"volumeType,omitempty"` } // The parameters for a block device for an EBS volume. type LaunchTemplateEBSBlockDeviceRequest struct { - 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"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Encrypted *bool `json:"encrypted,omitempty"` + IOPS *int64 `json:"iops,omitempty"` + SnapshotID *string `json:"snapshotID,omitempty"` + Throughput *int64 `json:"throughput,omitempty"` + VolumeSize *int64 `json:"volumeSize,omitempty"` + VolumeType *string `json:"volumeType,omitempty"` } // Describes an elastic inference accelerator. @@ -1812,6 +2015,16 @@ type LaunchTemplateIAMInstanceProfileSpecificationRequest struct { Name *string `json:"name,omitempty"` } +// The market (purchasing) option for the instances. +type LaunchTemplateInstanceMarketOptions struct { + MarketType *string `json:"marketType,omitempty"` +} + +// The market (purchasing) option for the instances. +type LaunchTemplateInstanceMarketOptionsRequest struct { + MarketType *string `json:"marketType,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. @@ -1828,39 +2041,45 @@ type LaunchTemplateInstanceMetadataOptionsRequest struct { // 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"` - DeviceIndex *int64 `json:"deviceIndex,omitempty"` - Groups []*string `json:"groups,omitempty"` - InterfaceType *string `json:"interfaceType,omitempty"` - IPv4PrefixCount *int64 `json:"ipv4PrefixCount,omitempty"` - IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` - IPv6PrefixCount *int64 `json:"ipv6PrefixCount,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"` + 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"` + Groups []*string `json:"groups,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` + IPv4PrefixCount *int64 `json:"ipv4PrefixCount,omitempty"` + IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + IPv6Addresses []*InstanceIPv6Address `json:"ipv6Addresses,omitempty"` + IPv6PrefixCount *int64 `json:"ipv6PrefixCount,omitempty"` + NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` + NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + PrivateIPAddresses []*PrivateIPAddressSpecification `json:"privateIPAddresses,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"` - DeviceIndex *int64 `json:"deviceIndex,omitempty"` - InterfaceType *string `json:"interfaceType,omitempty"` - IPv4PrefixCount *int64 `json:"ipv4PrefixCount,omitempty"` - IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` - IPv6PrefixCount *int64 `json:"ipv6PrefixCount,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"` + 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"` + Groups []*string `json:"groups,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` + IPv4PrefixCount *int64 `json:"ipv4PrefixCount,omitempty"` + IPv4Prefixes []*IPv4PrefixSpecificationRequest `json:"ipv4Prefixes,omitempty"` + IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + IPv6PrefixCount *int64 `json:"ipv6PrefixCount,omitempty"` + IPv6Prefixes []*IPv6PrefixSpecificationRequest `json:"ipv6Prefixes,omitempty"` + NetworkCardIndex *int64 `json:"networkCardIndex,omitempty"` + NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + PrivateIPAddresses []*PrivateIPAddressSpecification `json:"privateIPAddresses,omitempty"` + SecondaryPrivateIPAddressCount *int64 `json:"secondaryPrivateIPAddressCount,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` } // Describes a license configuration. @@ -1876,6 +2095,7 @@ type LaunchTemplateLicenseConfigurationRequest struct { // Describes overrides for a launch template. type LaunchTemplateOverrides struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` SpotPrice *string `json:"spotPrice,omitempty"` SubnetID *string `json:"subnetID,omitempty"` } @@ -1896,6 +2116,7 @@ type LaunchTemplatePlacement struct { type LaunchTemplatePlacementRequest struct { Affinity *string `json:"affinity,omitempty"` AvailabilityZone *string `json:"availabilityZone,omitempty"` + GroupName *string `json:"groupName,omitempty"` HostResourceGroupARN *string `json:"hostResourceGroupARN,omitempty"` PartitionNumber *int64 `json:"partitionNumber,omitempty"` SpreadDomain *string `json:"spreadDomain,omitempty"` @@ -1905,22 +2126,27 @@ type LaunchTemplatePlacementRequest struct { // The launch template to use. You must specify either the launch template ID // or launch template name in the request, but not both. type LaunchTemplateSpecification struct { + LaunchTemplateID *string `json:"launchTemplateID,omitempty"` LaunchTemplateName *string `json:"launchTemplateName,omitempty"` Version *string `json:"version,omitempty"` } // The options for Spot Instances. type LaunchTemplateSpotMarketOptions struct { - BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` - MaxPrice *string `json:"maxPrice,omitempty"` - ValidUntil *metav1.Time `json:"validUntil,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + InstanceInterruptionBehavior *string `json:"instanceInterruptionBehavior,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` + SpotInstanceType *string `json:"spotInstanceType,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // The options for Spot Instances. type LaunchTemplateSpotMarketOptionsRequest struct { - BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` - MaxPrice *string `json:"maxPrice,omitempty"` - ValidUntil *metav1.Time `json:"validUntil,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + InstanceInterruptionBehavior *string `json:"instanceInterruptionBehavior,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` + SpotInstanceType *string `json:"spotInstanceType,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // The tag specification for the launch template. @@ -2093,6 +2319,11 @@ type ModifyVPNTunnelOptionsSpecification struct { TunnelInsideIPv6CIDR *string `json:"tunnelInsideIPv6CIDR,omitempty"` } +// Describes the monitoring of an instance. +type Monitoring struct { + State *string `json:"state,omitempty"` +} + // Describes the status of a moving Elastic IP address. type MovingAddressStatus struct { PublicIP *string `json:"publicIP,omitempty"` @@ -2169,21 +2400,23 @@ type NetworkInsightsPath struct { // Describes a network interface. type NetworkInterface struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - DenyAllIgwTraffic *bool `json:"denyAllIgwTraffic,omitempty"` - Description *string `json:"description,omitempty"` - MacAddress *string `json:"macAddress,omitempty"` - NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` - OutpostARN *string `json:"outpostARN,omitempty"` - OwnerID *string `json:"ownerID,omitempty"` - PrivateDNSName *string `json:"privateDNSName,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - RequesterID *string `json:"requesterID,omitempty"` - RequesterManaged *bool `json:"requesterManaged,omitempty"` - SourceDestCheck *bool `json:"sourceDestCheck,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` - TagSet []*Tag `json:"tagSet,omitempty"` - VPCID *string `json:"vpcID,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + DenyAllIgwTraffic *bool `json:"denyAllIgwTraffic,omitempty"` + Description *string `json:"description,omitempty"` + Groups []*GroupIdentifier `json:"groups,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` + OutpostARN *string `json:"outpostARN,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + PrivateDNSName *string `json:"privateDNSName,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + RequesterID *string `json:"requesterID,omitempty"` + RequesterManaged *bool `json:"requesterManaged,omitempty"` + SourceDestCheck *bool `json:"sourceDestCheck,omitempty"` + Status *string `json:"status,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` + TagSet []*Tag `json:"tagSet,omitempty"` + VPCID *string `json:"vpcID,omitempty"` } // Describes association information for an Elastic IP address (IPv4 only), @@ -2381,6 +2614,7 @@ type Phase2IntegrityAlgorithmsRequestListValue struct { type Placement struct { Affinity *string `json:"affinity,omitempty"` AvailabilityZone *string `json:"availabilityZone,omitempty"` + GroupName *string `json:"groupName,omitempty"` HostID *string `json:"hostID,omitempty"` HostResourceGroupARN *string `json:"hostResourceGroupARN,omitempty"` PartitionNumber *int64 `json:"partitionNumber,omitempty"` @@ -2396,6 +2630,11 @@ type PlacementGroup struct { Tags []*Tag `json:"tags,omitempty"` } +// Describes the placement of an instance. +type PlacementResponse struct { + GroupName *string `json:"groupName,omitempty"` +} + // Describes a CIDR block for an address pool. type PoolCIDRBlock struct { CIDR *string `json:"cidr,omitempty"` @@ -2476,7 +2715,8 @@ type PrivateIPAddressSpecification struct { // Describes a product code. type ProductCode struct { - ProductCodeID *string `json:"productCodeID,omitempty"` + ProductCodeID *string `json:"productCodeID,omitempty"` + ProductCodeType *string `json:"productCodeType,omitempty"` } // Describes a virtual private gateway propagating route. @@ -2574,17 +2814,37 @@ type ReplaceRootVolumeTask struct { // The information to include in the launch template. type RequestLaunchTemplateData struct { - DisableAPITermination *bool `json:"disableAPITermination,omitempty"` - EBSOptimized *bool `json:"ebsOptimized,omitempty"` - UserData *string `json:"userData,omitempty"` + // The credit option for CPU usage of a T2, T3, or T3a instance. + CreditSpecification *CreditSpecificationRequest `json:"creditSpecification,omitempty"` + DisableAPITermination *bool `json:"disableAPITermination,omitempty"` + EBSOptimized *bool `json:"ebsOptimized,omitempty"` + ImageID *string `json:"imageID,omitempty"` + InstanceInitiatedShutdownBehavior *string `json:"instanceInitiatedShutdownBehavior,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` + KeyName *string `json:"keyName,omitempty"` + RAMDiskID *string `json:"ramDiskID,omitempty"` + SecurityGroupIDs []*string `json:"securityGroupIDs,omitempty"` + SecurityGroups []*string `json:"securityGroups,omitempty"` + UserData *string `json:"userData,omitempty"` } // Describes the launch specification for an instance. type RequestSpotLaunchSpecification struct { AddressingType *string `json:"addressingType,omitempty"` EBSOptimized *bool `json:"ebsOptimized,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` - UserData *string `json:"userData,omitempty"` + // Describes an IAM instance profile. + IAMInstanceProfile *IAMInstanceProfileSpecification `json:"iamInstanceProfile,omitempty"` + ImageID *string `json:"imageID,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` + KeyName *string `json:"keyName,omitempty"` + // Describes the monitoring of an instance. + Monitoring *RunInstancesMonitoringEnabled `json:"monitoring,omitempty"` + NetworkInterfaces []*InstanceNetworkInterfaceSpecification `json:"networkInterfaces,omitempty"` + RAMDiskID *string `json:"ramDiskID,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` + UserData *string `json:"userData,omitempty"` } // Information about an instance type to use in a Capacity Reservation Fleet. @@ -2592,6 +2852,7 @@ type ReservationFleetInstanceSpecification struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` AvailabilityZoneID *string `json:"availabilityZoneID,omitempty"` EBSOptimized *bool `json:"ebsOptimized,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` } // The cost associated with the Reserved Instance. @@ -2601,6 +2862,17 @@ type ReservationValue struct { RemainingUpfrontValue *string `json:"remainingUpfrontValue,omitempty"` } +// Describes a launch request for one or more instances, and includes owner, +// requester, and security group information that applies to all instances in +// the launch request. +type Reservation_SDK struct { + Groups []*GroupIdentifier `json:"groups,omitempty"` + Instances []*Instance `json:"instances,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + RequesterID *string `json:"requesterID,omitempty"` + ReservationID *string `json:"reservationID,omitempty"` +} + // The total value of the Convertible Reserved Instance. type ReservedInstanceReservationValue struct { ReservedInstanceID *string `json:"reservedInstanceID,omitempty"` @@ -2613,6 +2885,7 @@ type ReservedInstances struct { End *metav1.Time `json:"end,omitempty"` InstanceCount *int64 `json:"instanceCount,omitempty"` InstanceTenancy *string `json:"instanceTenancy,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` ReservedInstancesID *string `json:"reservedInstancesID,omitempty"` Start *metav1.Time `json:"start,omitempty"` Tags []*Tag `json:"tags,omitempty"` @@ -2622,6 +2895,7 @@ type ReservedInstances struct { type ReservedInstancesConfiguration struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` InstanceCount *int64 `json:"instanceCount,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` Platform *string `json:"platform,omitempty"` } @@ -2662,6 +2936,7 @@ type ReservedInstancesOffering struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` Duration *int64 `json:"duration,omitempty"` InstanceTenancy *string `json:"instanceTenancy,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` Marketplace *bool `json:"marketplace,omitempty"` ReservedInstancesOfferingID *string `json:"reservedInstancesOfferingID,omitempty"` } @@ -2674,15 +2949,17 @@ type ResponseError struct { // The information for a launch template. type ResponseLaunchTemplateData struct { - DisableAPITermination *bool `json:"disableAPITermination,omitempty"` - EBSOptimized *bool `json:"ebsOptimized,omitempty"` - ImageID *string `json:"imageID,omitempty"` - KernelID *string `json:"kernelID,omitempty"` - KeyName *string `json:"keyName,omitempty"` - RamDiskID *string `json:"ramDiskID,omitempty"` - SecurityGroupIDs []*string `json:"securityGroupIDs,omitempty"` - SecurityGroups []*string `json:"securityGroups,omitempty"` - UserData *string `json:"userData,omitempty"` + DisableAPITermination *bool `json:"disableAPITermination,omitempty"` + EBSOptimized *bool `json:"ebsOptimized,omitempty"` + ImageID *string `json:"imageID,omitempty"` + InstanceInitiatedShutdownBehavior *string `json:"instanceInitiatedShutdownBehavior,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` + KeyName *string `json:"keyName,omitempty"` + RAMDiskID *string `json:"ramDiskID,omitempty"` + SecurityGroupIDs []*string `json:"securityGroupIDs,omitempty"` + SecurityGroups []*string `json:"securityGroups,omitempty"` + UserData *string `json:"userData,omitempty"` } // Describes a route in a route table. @@ -2818,6 +3095,7 @@ type ScheduledInstancesEBS struct { DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` Encrypted *bool `json:"encrypted,omitempty"` IOPS *int64 `json:"iops,omitempty"` + SnapshotID *string `json:"snapshotID,omitempty"` VolumeSize *int64 `json:"volumeSize,omitempty"` VolumeType *string `json:"volumeType,omitempty"` } @@ -2835,7 +3113,11 @@ type ScheduledInstancesIAMInstanceProfile struct { // NetworkInterface. type ScheduledInstancesLaunchSpecification struct { EBSOptimized *bool `json:"ebsOptimized,omitempty"` + ImageID *string `json:"imageID,omitempty"` InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` + KeyName *string `json:"keyName,omitempty"` + RAMDiskID *string `json:"ramDiskID,omitempty"` SubnetID *string `json:"subnetID,omitempty"` UserData *string `json:"userData,omitempty"` } @@ -2861,6 +3143,7 @@ type ScheduledInstancesNetworkInterface struct { // Describes the placement for a Scheduled Instance. type ScheduledInstancesPlacement struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + GroupName *string `json:"groupName,omitempty"` } // Describes a private IPv4 address for a Scheduled Instance. @@ -3054,11 +3337,18 @@ type SpotDatafeedSubscription struct { type SpotFleetLaunchSpecification struct { AddressingType *string `json:"addressingType,omitempty"` EBSOptimized *bool `json:"ebsOptimized,omitempty"` - KernelID *string `json:"kernelID,omitempty"` - RamdiskID *string `json:"ramdiskID,omitempty"` - SpotPrice *string `json:"spotPrice,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` - UserData *string `json:"userData,omitempty"` + // Describes an IAM instance profile. + IAMInstanceProfile *IAMInstanceProfileSpecification `json:"iamInstanceProfile,omitempty"` + ImageID *string `json:"imageID,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` + KeyName *string `json:"keyName,omitempty"` + NetworkInterfaces []*InstanceNetworkInterfaceSpecification `json:"networkInterfaces,omitempty"` + RAMDiskID *string `json:"ramDiskID,omitempty"` + SecurityGroups []*GroupIdentifier `json:"securityGroups,omitempty"` + SpotPrice *string `json:"spotPrice,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` + UserData *string `json:"userData,omitempty"` } // Describes whether monitoring is enabled. @@ -3078,6 +3368,7 @@ type SpotFleetRequestConfigData struct { ClientToken *string `json:"clientToken,omitempty"` Context *string `json:"context,omitempty"` IAMFleetRole *string `json:"iamFleetRole,omitempty"` + InstanceInterruptionBehavior *string `json:"instanceInterruptionBehavior,omitempty"` InstancePoolsToUseCount *int64 `json:"instancePoolsToUseCount,omitempty"` OnDemandMaxTotalPrice *string `json:"onDemandMaxTotalPrice,omitempty"` OnDemandTargetCapacity *int64 `json:"onDemandTargetCapacity,omitempty"` @@ -3099,18 +3390,20 @@ type SpotFleetTagSpecification struct { // Describes a Spot Instance request. type SpotInstanceRequest struct { - ActualBlockHourlyPrice *string `json:"actualBlockHourlyPrice,omitempty"` - AvailabilityZoneGroup *string `json:"availabilityZoneGroup,omitempty"` - BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` - CreateTime *metav1.Time `json:"createTime,omitempty"` - InstanceID *string `json:"instanceID,omitempty"` - LaunchGroup *string `json:"launchGroup,omitempty"` - LaunchedAvailabilityZone *string `json:"launchedAvailabilityZone,omitempty"` - SpotInstanceRequestID *string `json:"spotInstanceRequestID,omitempty"` - SpotPrice *string `json:"spotPrice,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - ValidFrom *metav1.Time `json:"validFrom,omitempty"` - ValidUntil *metav1.Time `json:"validUntil,omitempty"` + ActualBlockHourlyPrice *string `json:"actualBlockHourlyPrice,omitempty"` + AvailabilityZoneGroup *string `json:"availabilityZoneGroup,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + CreateTime *metav1.Time `json:"createTime,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + InstanceInterruptionBehavior *string `json:"instanceInterruptionBehavior,omitempty"` + LaunchGroup *string `json:"launchGroup,omitempty"` + LaunchedAvailabilityZone *string `json:"launchedAvailabilityZone,omitempty"` + SpotInstanceRequestID *string `json:"spotInstanceRequestID,omitempty"` + SpotPrice *string `json:"spotPrice,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + Type *string `json:"type_,omitempty"` + ValidFrom *metav1.Time `json:"validFrom,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // Describes a Spot Instance state change. @@ -3128,9 +3421,11 @@ type SpotInstanceStatus struct { // The options for Spot Instances. type SpotMarketOptions struct { - BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` - MaxPrice *string `json:"maxPrice,omitempty"` - ValidUntil *metav1.Time `json:"validUntil,omitempty"` + BlockDurationMinutes *int64 `json:"blockDurationMinutes,omitempty"` + InstanceInterruptionBehavior *string `json:"instanceInterruptionBehavior,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` + SpotInstanceType *string `json:"spotInstanceType,omitempty"` + ValidUntil *metav1.Time `json:"validUntil,omitempty"` } // Describes the configuration of Spot Instances in an EC2 Fleet. @@ -3154,6 +3449,7 @@ type SpotOptionsRequest struct { // Describes Spot Instance placement. type SpotPlacement struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + GroupName *string `json:"groupName,omitempty"` Tenancy *string `json:"tenancy,omitempty"` } @@ -3171,6 +3467,7 @@ type SpotPlacementScore struct { // Instance. type SpotPrice struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` SpotPrice *string `json:"spotPrice,omitempty"` Timestamp *metav1.Time `json:"timestamp,omitempty"` } @@ -3969,6 +4266,7 @@ type VolumeModification struct { OriginalMultiAttachEnabled *bool `json:"originalMultiAttachEnabled,omitempty"` OriginalSize *int64 `json:"originalSize,omitempty"` OriginalThroughput *int64 `json:"originalThroughput,omitempty"` + OriginalVolumeType *string `json:"originalVolumeType,omitempty"` Progress *int64 `json:"progress,omitempty"` StartTime *metav1.Time `json:"startTime,omitempty"` StatusMessage *string `json:"statusMessage,omitempty"` @@ -3976,6 +4274,7 @@ type VolumeModification struct { TargetMultiAttachEnabled *bool `json:"targetMultiAttachEnabled,omitempty"` TargetSize *int64 `json:"targetSize,omitempty"` TargetThroughput *int64 `json:"targetThroughput,omitempty"` + TargetVolumeType *string `json:"targetVolumeType,omitempty"` VolumeID *string `json:"volumeID,omitempty"` } diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index b37551fc..ae64eb4f 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -947,6 +947,11 @@ func (in *BlockDeviceMapping) DeepCopyInto(out *BlockDeviceMapping) { *out = new(string) **out = **in } + if in.EBS != nil { + in, out := &in.EBS, &out.EBS + *out = new(EBSBlockDevice) + (*in).DeepCopyInto(*out) + } if in.NoDevice != nil { in, out := &in.NoDevice, &out.NoDevice *out = new(string) @@ -1404,9 +1409,64 @@ func (in *CapacityReservationGroup) DeepCopy() *CapacityReservationGroup { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CapacityReservationSpecification) DeepCopyInto(out *CapacityReservationSpecification) { + *out = *in + if in.CapacityReservationPreference != nil { + in, out := &in.CapacityReservationPreference, &out.CapacityReservationPreference + *out = new(string) + **out = **in + } + if in.CapacityReservationTarget != nil { + in, out := &in.CapacityReservationTarget, &out.CapacityReservationTarget + *out = new(CapacityReservationTarget) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CapacityReservationSpecification. +func (in *CapacityReservationSpecification) DeepCopy() *CapacityReservationSpecification { + if in == nil { + return nil + } + out := new(CapacityReservationSpecification) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CapacityReservationSpecificationResponse) DeepCopyInto(out *CapacityReservationSpecificationResponse) { + *out = *in + if in.CapacityReservationPreference != nil { + in, out := &in.CapacityReservationPreference, &out.CapacityReservationPreference + *out = new(string) + **out = **in + } + if in.CapacityReservationTarget != nil { + in, out := &in.CapacityReservationTarget, &out.CapacityReservationTarget + *out = new(CapacityReservationTargetResponse) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CapacityReservationSpecificationResponse. +func (in *CapacityReservationSpecificationResponse) DeepCopy() *CapacityReservationSpecificationResponse { + if in == nil { + return nil + } + out := new(CapacityReservationSpecificationResponse) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CapacityReservationTarget) DeepCopyInto(out *CapacityReservationTarget) { *out = *in + if in.CapacityReservationID != nil { + in, out := &in.CapacityReservationID, &out.CapacityReservationID + *out = new(string) + **out = **in + } if in.CapacityReservationResourceGroupARN != nil { in, out := &in.CapacityReservationResourceGroupARN, &out.CapacityReservationResourceGroupARN *out = new(string) @@ -1558,6 +1618,17 @@ func (in *ClassicLinkDNSSupport) DeepCopy() *ClassicLinkDNSSupport { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClassicLinkInstance) DeepCopyInto(out *ClassicLinkInstance) { *out = *in + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]*GroupIdentifier, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(GroupIdentifier) + (*in).DeepCopyInto(*out) + } + } + } if in.InstanceID != nil { in, out := &in.InstanceID, &out.InstanceID *out = new(string) @@ -2281,6 +2352,31 @@ func (in *CreateFleetError) DeepCopy() *CreateFleetError { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CreateFleetInstance) DeepCopyInto(out *CreateFleetInstance) { + *out = *in + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } + if in.Platform != nil { + in, out := &in.Platform, &out.Platform + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CreateFleetInstance. +func (in *CreateFleetInstance) DeepCopy() *CreateFleetInstance { + if in == nil { + return nil + } + out := new(CreateFleetInstance) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CreateRouteInput) DeepCopyInto(out *CreateRouteInput) { *out = *in @@ -2989,6 +3085,31 @@ func (in *DescribeFleetError) DeepCopy() *DescribeFleetError { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DescribeFleetsInstances) DeepCopyInto(out *DescribeFleetsInstances) { + *out = *in + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } + if in.Platform != nil { + in, out := &in.Platform, &out.Platform + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DescribeFleetsInstances. +func (in *DescribeFleetsInstances) DeepCopy() *DescribeFleetsInstances { + if in == nil { + return nil + } + out := new(DescribeFleetsInstances) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DestinationOptionsRequest) DeepCopyInto(out *DestinationOptionsRequest) { *out = *in @@ -3332,6 +3453,11 @@ func (in *EBSBlockDevice) DeepCopyInto(out *EBSBlockDevice) { *out = new(string) **out = **in } + if in.SnapshotID != nil { + in, out := &in.SnapshotID, &out.SnapshotID + *out = new(string) + **out = **in + } if in.Throughput != nil { in, out := &in.Throughput, &out.Throughput *out = new(int64) @@ -3342,6 +3468,11 @@ func (in *EBSBlockDevice) DeepCopyInto(out *EBSBlockDevice) { *out = new(int64) **out = **in } + if in.VolumeType != nil { + in, out := &in.VolumeType, &out.VolumeType + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EBSBlockDevice. @@ -3730,6 +3861,11 @@ func (in *ElasticIPAddressStatus) DeepCopy() *ElasticIPAddressStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ElasticInferenceAccelerator) DeepCopyInto(out *ElasticInferenceAccelerator) { *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) @@ -4288,6 +4424,17 @@ func (in *FPGAImage) DeepCopyInto(out *FPGAImage) { *out = new(string) **out = **in } + if in.ProductCodes != nil { + in, out := &in.ProductCodes, &out.ProductCodes + *out = make([]*ProductCode, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ProductCode) + (*in).DeepCopyInto(*out) + } + } + } if in.Public != nil { in, out := &in.Public, &out.Public *out = new(bool) @@ -4343,6 +4490,17 @@ func (in *FPGAImageAttribute) DeepCopyInto(out *FPGAImageAttribute) { *out = new(string) **out = **in } + if in.ProductCodes != nil { + in, out := &in.ProductCodes, &out.ProductCodes + *out = make([]*ProductCode, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ProductCode) + (*in).DeepCopyInto(*out) + } + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FPGAImageAttribute. @@ -4489,6 +4647,11 @@ func (in *FleetCapacityReservation) DeepCopyInto(out *FleetCapacityReservation) *out = new(string) **out = **in } + if in.CapacityReservationID != nil { + in, out := &in.CapacityReservationID, &out.CapacityReservationID + *out = new(string) + **out = **in + } if in.CreateDate != nil { in, out := &in.CreateDate, &out.CreateDate *out = (*in).DeepCopy() @@ -4498,6 +4661,11 @@ func (in *FleetCapacityReservation) DeepCopyInto(out *FleetCapacityReservation) *out = new(bool) **out = **in } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.TotalInstanceCount != nil { in, out := &in.TotalInstanceCount, &out.TotalInstanceCount *out = new(int64) @@ -4581,6 +4749,11 @@ func (in *FleetLaunchTemplateOverrides) DeepCopyInto(out *FleetLaunchTemplateOve *out = new(string) **out = **in } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.MaxPrice != nil { in, out := &in.MaxPrice, &out.MaxPrice *out = new(string) @@ -4611,11 +4784,21 @@ func (in *FleetLaunchTemplateOverridesRequest) DeepCopyInto(out *FleetLaunchTemp *out = new(string) **out = **in } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.MaxPrice != nil { in, out := &in.MaxPrice, &out.MaxPrice *out = new(string) **out = **in } + if in.Placement != nil { + in, out := &in.Placement, &out.Placement + *out = new(Placement) + (*in).DeepCopyInto(*out) + } if in.SubnetID != nil { in, out := &in.SubnetID, &out.SubnetID *out = new(string) @@ -4661,6 +4844,11 @@ func (in *FleetLaunchTemplateSpecification) DeepCopy() *FleetLaunchTemplateSpeci // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FleetLaunchTemplateSpecificationRequest) DeepCopyInto(out *FleetLaunchTemplateSpecificationRequest) { *out = *in + if in.LaunchTemplateID != nil { + in, out := &in.LaunchTemplateID, &out.LaunchTemplateID + *out = new(string) + **out = **in + } if in.Version != nil { in, out := &in.Version, &out.Version *out = new(string) @@ -5182,6 +5370,11 @@ func (in *IAMInstanceProfileAssociation) DeepCopyInto(out *IAMInstanceProfileAss *out = new(string) **out = **in } + if in.IAMInstanceProfile != nil { + in, out := &in.IAMInstanceProfile, &out.IAMInstanceProfile + *out = new(IAMInstanceProfile) + (*in).DeepCopyInto(*out) + } if in.InstanceID != nil { in, out := &in.InstanceID, &out.InstanceID *out = new(string) @@ -5650,6 +5843,16 @@ func (in *IPv6Range) DeepCopy() *IPv6Range { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Image) DeepCopyInto(out *Image) { *out = *in + if in.Architecture != nil { + in, out := &in.Architecture, &out.Architecture + *out = new(string) + **out = **in + } + if in.BootMode != nil { + in, out := &in.BootMode, &out.BootMode + *out = new(string) + **out = **in + } if in.CreationDate != nil { in, out := &in.CreationDate, &out.CreationDate *out = new(string) @@ -5670,6 +5873,11 @@ func (in *Image) DeepCopyInto(out *Image) { *out = new(bool) **out = **in } + if in.Hypervisor != nil { + in, out := &in.Hypervisor, &out.Hypervisor + *out = new(string) + **out = **in + } if in.ImageID != nil { in, out := &in.ImageID, &out.ImageID *out = new(string) @@ -5700,18 +5908,34 @@ func (in *Image) DeepCopyInto(out *Image) { *out = new(string) **out = **in } + if in.Platform != nil { + in, out := &in.Platform, &out.Platform + *out = new(string) + **out = **in + } if in.PlatformDetails != nil { in, out := &in.PlatformDetails, &out.PlatformDetails *out = new(string) **out = **in } + if in.ProductCodes != nil { + in, out := &in.ProductCodes, &out.ProductCodes + *out = make([]*ProductCode, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ProductCode) + (*in).DeepCopyInto(*out) + } + } + } if in.Public != nil { in, out := &in.Public, &out.Public *out = new(bool) **out = **in } - if in.RamdiskID != nil { - in, out := &in.RamdiskID, &out.RamdiskID + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID *out = new(string) **out = **in } @@ -5720,11 +5944,21 @@ func (in *Image) DeepCopyInto(out *Image) { *out = new(string) **out = **in } - if in.SriovNetSupport != nil { - in, out := &in.SriovNetSupport, &out.SriovNetSupport + if in.RootDeviceType != nil { + in, out := &in.RootDeviceType, &out.RootDeviceType + *out = new(string) + **out = **in + } + if in.SRIOVNetSupport != nil { + in, out := &in.SRIOVNetSupport, &out.SRIOVNetSupport *out = new(string) **out = **in } + if in.StateReason != nil { + in, out := &in.StateReason, &out.StateReason + *out = new(StateReason) + (*in).DeepCopyInto(*out) + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make([]*Tag, len(*in)) @@ -5741,6 +5975,11 @@ func (in *Image) DeepCopyInto(out *Image) { *out = new(string) **out = **in } + if in.VirtualizationType != nil { + in, out := &in.VirtualizationType, &out.VirtualizationType + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image. @@ -5771,6 +6010,11 @@ func (in *ImageDiskContainer) DeepCopyInto(out *ImageDiskContainer) { *out = new(string) **out = **in } + if in.SnapshotID != nil { + in, out := &in.SnapshotID, &out.SnapshotID + *out = new(string) + **out = **in + } if in.URL != nil { in, out := &in.URL, &out.URL *out = new(string) @@ -5836,6 +6080,11 @@ func (in *ImportImageTask) DeepCopyInto(out *ImportImageTask) { *out = new(string) **out = **in } + if in.BootMode != nil { + in, out := &in.BootMode, &out.BootMode + *out = new(string) + **out = **in + } if in.Description != nil { in, out := &in.Description, &out.Description *out = new(string) @@ -5927,11 +6176,53 @@ func (in *ImportInstanceLaunchSpecification) DeepCopyInto(out *ImportInstanceLau *out = new(string) **out = **in } + if in.Architecture != nil { + in, out := &in.Architecture, &out.Architecture + *out = new(string) + **out = **in + } + if in.GroupIDs != nil { + in, out := &in.GroupIDs, &out.GroupIDs + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.GroupNames != nil { + in, out := &in.GroupNames, &out.GroupNames + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.InstanceInitiatedShutdownBehavior != nil { + in, out := &in.InstanceInitiatedShutdownBehavior, &out.InstanceInitiatedShutdownBehavior + *out = new(string) + **out = **in + } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.Monitoring != nil { in, out := &in.Monitoring, &out.Monitoring *out = new(bool) **out = **in } + if in.Placement != nil { + in, out := &in.Placement, &out.Placement + *out = new(Placement) + (*in).DeepCopyInto(*out) + } if in.PrivateIPAddress != nil { in, out := &in.PrivateIPAddress, &out.PrivateIPAddress *out = new(string) @@ -5967,6 +6258,11 @@ func (in *ImportInstanceTaskDetails) DeepCopyInto(out *ImportInstanceTaskDetails *out = new(string) **out = **in } + if in.Platform != nil { + in, out := &in.Platform, &out.Platform + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportInstanceTaskDetails. @@ -6093,25 +6389,98 @@ func (in *Instance) DeepCopyInto(out *Instance) { *out = new(int64) **out = **in } + if in.Architecture != nil { + in, out := &in.Architecture, &out.Architecture + *out = new(string) + **out = **in + } + if in.BlockDeviceMappings != nil { + in, out := &in.BlockDeviceMappings, &out.BlockDeviceMappings + *out = make([]*InstanceBlockDeviceMapping, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceBlockDeviceMapping) + (*in).DeepCopyInto(*out) + } + } + } + if in.BootMode != nil { + in, out := &in.BootMode, &out.BootMode + *out = new(string) + **out = **in + } if in.CapacityReservationID != nil { in, out := &in.CapacityReservationID, &out.CapacityReservationID *out = new(string) **out = **in } + if in.CapacityReservationSpecification != nil { + in, out := &in.CapacityReservationSpecification, &out.CapacityReservationSpecification + *out = new(CapacityReservationSpecificationResponse) + (*in).DeepCopyInto(*out) + } if in.ClientToken != nil { in, out := &in.ClientToken, &out.ClientToken *out = new(string) **out = **in } + if in.CPUOptions != nil { + in, out := &in.CPUOptions, &out.CPUOptions + *out = new(CPUOptions) + (*in).DeepCopyInto(*out) + } if in.EBSOptimized != nil { in, out := &in.EBSOptimized, &out.EBSOptimized *out = new(bool) **out = **in } - if in.ENASupport != nil { - in, out := &in.ENASupport, &out.ENASupport - *out = new(bool) - **out = **in + if in.ElasticGPUAssociations != nil { + in, out := &in.ElasticGPUAssociations, &out.ElasticGPUAssociations + *out = make([]*ElasticGPUAssociation, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ElasticGPUAssociation) + (*in).DeepCopyInto(*out) + } + } + } + if in.ElasticInferenceAcceleratorAssociations != nil { + in, out := &in.ElasticInferenceAcceleratorAssociations, &out.ElasticInferenceAcceleratorAssociations + *out = make([]*ElasticInferenceAcceleratorAssociation, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ElasticInferenceAcceleratorAssociation) + (*in).DeepCopyInto(*out) + } + } + } + if in.ENASupport != nil { + in, out := &in.ENASupport, &out.ENASupport + *out = new(bool) + **out = **in + } + if in.EnclaveOptions != nil { + in, out := &in.EnclaveOptions, &out.EnclaveOptions + *out = new(EnclaveOptions) + (*in).DeepCopyInto(*out) + } + if in.HibernationOptions != nil { + in, out := &in.HibernationOptions, &out.HibernationOptions + *out = new(HibernationOptions) + (*in).DeepCopyInto(*out) + } + if in.Hypervisor != nil { + in, out := &in.Hypervisor, &out.Hypervisor + *out = new(string) + **out = **in + } + if in.IAMInstanceProfile != nil { + in, out := &in.IAMInstanceProfile, &out.IAMInstanceProfile + *out = new(IAMInstanceProfile) + (*in).DeepCopyInto(*out) } if in.ImageID != nil { in, out := &in.ImageID, &out.ImageID @@ -6123,6 +6492,16 @@ func (in *Instance) DeepCopyInto(out *Instance) { *out = new(string) **out = **in } + if in.InstanceLifecycle != nil { + in, out := &in.InstanceLifecycle, &out.InstanceLifecycle + *out = new(string) + **out = **in + } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.KernelID != nil { in, out := &in.KernelID, &out.KernelID *out = new(string) @@ -6137,11 +6516,53 @@ func (in *Instance) DeepCopyInto(out *Instance) { in, out := &in.LaunchTime, &out.LaunchTime *out = (*in).DeepCopy() } + if in.Licenses != nil { + in, out := &in.Licenses, &out.Licenses + *out = make([]*LicenseConfiguration, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LicenseConfiguration) + (*in).DeepCopyInto(*out) + } + } + } + if in.MetadataOptions != nil { + in, out := &in.MetadataOptions, &out.MetadataOptions + *out = new(InstanceMetadataOptionsResponse) + (*in).DeepCopyInto(*out) + } + if in.Monitoring != nil { + in, out := &in.Monitoring, &out.Monitoring + *out = new(Monitoring) + (*in).DeepCopyInto(*out) + } + if in.NetworkInterfaces != nil { + in, out := &in.NetworkInterfaces, &out.NetworkInterfaces + *out = make([]*InstanceNetworkInterface, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceNetworkInterface) + (*in).DeepCopyInto(*out) + } + } + } if in.OutpostARN != nil { in, out := &in.OutpostARN, &out.OutpostARN *out = new(string) **out = **in } + if in.Placement != nil { + in, out := &in.Placement, &out.Placement + *out = new(Placement) + (*in).DeepCopyInto(*out) + } + if in.Platform != nil { + in, out := &in.Platform, &out.Platform + *out = new(string) + **out = **in + } if in.PlatformDetails != nil { in, out := &in.PlatformDetails, &out.PlatformDetails *out = new(string) @@ -6157,6 +6578,17 @@ func (in *Instance) DeepCopyInto(out *Instance) { *out = new(string) **out = **in } + if in.ProductCodes != nil { + in, out := &in.ProductCodes, &out.ProductCodes + *out = make([]*ProductCode, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ProductCode) + (*in).DeepCopyInto(*out) + } + } + } if in.PublicDNSName != nil { in, out := &in.PublicDNSName, &out.PublicDNSName *out = new(string) @@ -6167,8 +6599,8 @@ func (in *Instance) DeepCopyInto(out *Instance) { *out = new(string) **out = **in } - if in.RamdiskID != nil { - in, out := &in.RamdiskID, &out.RamdiskID + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID *out = new(string) **out = **in } @@ -6177,6 +6609,22 @@ func (in *Instance) DeepCopyInto(out *Instance) { *out = new(string) **out = **in } + if in.RootDeviceType != nil { + in, out := &in.RootDeviceType, &out.RootDeviceType + *out = new(string) + **out = **in + } + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]*GroupIdentifier, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(GroupIdentifier) + (*in).DeepCopyInto(*out) + } + } + } if in.SourceDestCheck != nil { in, out := &in.SourceDestCheck, &out.SourceDestCheck *out = new(bool) @@ -6187,11 +6635,21 @@ func (in *Instance) DeepCopyInto(out *Instance) { *out = new(string) **out = **in } - if in.SriovNetSupport != nil { - in, out := &in.SriovNetSupport, &out.SriovNetSupport + if in.SRIOVNetSupport != nil { + in, out := &in.SRIOVNetSupport, &out.SRIOVNetSupport *out = new(string) **out = **in } + if in.State != nil { + in, out := &in.State, &out.State + *out = new(InstanceState) + (*in).DeepCopyInto(*out) + } + if in.StateReason != nil { + in, out := &in.StateReason, &out.StateReason + *out = new(StateReason) + (*in).DeepCopyInto(*out) + } if in.StateTransitionReason != nil { in, out := &in.StateTransitionReason, &out.StateTransitionReason *out = new(string) @@ -6222,6 +6680,11 @@ func (in *Instance) DeepCopyInto(out *Instance) { in, out := &in.UsageOperationUpdateTime, &out.UsageOperationUpdateTime *out = (*in).DeepCopy() } + if in.VirtualizationType != nil { + in, out := &in.VirtualizationType, &out.VirtualizationType + *out = new(string) + **out = **in + } if in.VPCID != nil { in, out := &in.VPCID, &out.VPCID *out = new(string) @@ -6247,6 +6710,11 @@ func (in *InstanceBlockDeviceMapping) DeepCopyInto(out *InstanceBlockDeviceMappi *out = new(string) **out = **in } + if in.EBS != nil { + in, out := &in.EBS, &out.EBS + *out = new(EBSInstanceBlockDevice) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceBlockDeviceMapping. @@ -6618,14 +7086,54 @@ func (in *InstanceIPv6Prefix) DeepCopy() *InstanceIPv6Prefix { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceMarketOptionsRequest) DeepCopyInto(out *InstanceMarketOptionsRequest) { + *out = *in + if in.MarketType != nil { + in, out := &in.MarketType, &out.MarketType + *out = new(string) + **out = **in + } + if in.SpotOptions != nil { + in, out := &in.SpotOptions, &out.SpotOptions + *out = new(SpotMarketOptions) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceMarketOptionsRequest. +func (in *InstanceMarketOptionsRequest) DeepCopy() *InstanceMarketOptionsRequest { + if in == nil { + return nil + } + out := new(InstanceMarketOptionsRequest) + in.DeepCopyInto(out) + 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.HTTPEndpoint != nil { + in, out := &in.HTTPEndpoint, &out.HTTPEndpoint + *out = new(string) + **out = **in + } + if in.HTTPProtocolIPv6 != nil { + in, out := &in.HTTPProtocolIPv6, &out.HTTPProtocolIPv6 + *out = new(string) + **out = **in + } if in.HTTPPutResponseHopLimit != nil { in, out := &in.HTTPPutResponseHopLimit, &out.HTTPPutResponseHopLimit *out = new(int64) **out = **in } + if in.HTTPTokens != nil { + in, out := &in.HTTPTokens, &out.HTTPTokens + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceMetadataOptionsRequest. @@ -6641,11 +7149,31 @@ func (in *InstanceMetadataOptionsRequest) DeepCopy() *InstanceMetadataOptionsReq // 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.HTTPEndpoint != nil { + in, out := &in.HTTPEndpoint, &out.HTTPEndpoint + *out = new(string) + **out = **in + } + if in.HTTPProtocolIPv6 != nil { + in, out := &in.HTTPProtocolIPv6, &out.HTTPProtocolIPv6 + *out = new(string) + **out = **in + } if in.HTTPPutResponseHopLimit != nil { in, out := &in.HTTPPutResponseHopLimit, &out.HTTPPutResponseHopLimit *out = new(int64) **out = **in } + if in.HTTPTokens != nil { + in, out := &in.HTTPTokens, &out.HTTPTokens + *out = new(string) + **out = **in + } + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceMetadataOptionsResponse. @@ -6666,6 +7194,11 @@ func (in *InstanceMonitoring) DeepCopyInto(out *InstanceMonitoring) { *out = new(string) **out = **in } + if in.Monitoring != nil { + in, out := &in.Monitoring, &out.Monitoring + *out = new(Monitoring) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceMonitoring. @@ -6681,16 +7214,70 @@ func (in *InstanceMonitoring) DeepCopy() *InstanceMonitoring { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceNetworkInterface) DeepCopyInto(out *InstanceNetworkInterface) { *out = *in + if in.Association != nil { + in, out := &in.Association, &out.Association + *out = new(InstanceNetworkInterfaceAssociation) + (*in).DeepCopyInto(*out) + } + if in.Attachment != nil { + in, out := &in.Attachment, &out.Attachment + *out = new(InstanceNetworkInterfaceAttachment) + (*in).DeepCopyInto(*out) + } if in.Description != nil { in, out := &in.Description, &out.Description *out = new(string) **out = **in } + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]*GroupIdentifier, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(GroupIdentifier) + (*in).DeepCopyInto(*out) + } + } + } if in.InterfaceType != nil { in, out := &in.InterfaceType, &out.InterfaceType *out = new(string) **out = **in } + if in.IPv4Prefixes != nil { + in, out := &in.IPv4Prefixes, &out.IPv4Prefixes + *out = make([]*InstanceIPv4Prefix, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceIPv4Prefix) + (*in).DeepCopyInto(*out) + } + } + } + if in.IPv6Addresses != nil { + in, out := &in.IPv6Addresses, &out.IPv6Addresses + *out = make([]*InstanceIPv6Address, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceIPv6Address) + (*in).DeepCopyInto(*out) + } + } + } + if in.IPv6Prefixes != nil { + in, out := &in.IPv6Prefixes, &out.IPv6Prefixes + *out = make([]*InstanceIPv6Prefix, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceIPv6Prefix) + (*in).DeepCopyInto(*out) + } + } + } if in.MacAddress != nil { in, out := &in.MacAddress, &out.MacAddress *out = new(string) @@ -6716,11 +7303,27 @@ func (in *InstanceNetworkInterface) DeepCopyInto(out *InstanceNetworkInterface) *out = new(string) **out = **in } + if in.PrivateIPAddresses != nil { + in, out := &in.PrivateIPAddresses, &out.PrivateIPAddresses + *out = make([]*InstancePrivateIPAddress, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstancePrivateIPAddress) + (*in).DeepCopyInto(*out) + } + } + } if in.SourceDestCheck != nil { in, out := &in.SourceDestCheck, &out.SourceDestCheck *out = new(bool) **out = **in } + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(string) + **out = **in + } if in.SubnetID != nil { in, out := &in.SubnetID, &out.SubnetID *out = new(string) @@ -6855,6 +7458,17 @@ func (in *InstanceNetworkInterfaceSpecification) DeepCopyInto(out *InstanceNetwo *out = new(int64) **out = **in } + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } if in.InterfaceType != nil { in, out := &in.InterfaceType, &out.InterfaceType *out = new(string) @@ -6865,16 +7479,49 @@ func (in *InstanceNetworkInterfaceSpecification) DeepCopyInto(out *InstanceNetwo *out = new(int64) **out = **in } + if in.IPv4Prefixes != nil { + in, out := &in.IPv4Prefixes, &out.IPv4Prefixes + *out = make([]*IPv4PrefixSpecificationRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(IPv4PrefixSpecificationRequest) + (*in).DeepCopyInto(*out) + } + } + } if in.IPv6AddressCount != nil { in, out := &in.IPv6AddressCount, &out.IPv6AddressCount *out = new(int64) **out = **in } + if in.IPv6Addresses != nil { + in, out := &in.IPv6Addresses, &out.IPv6Addresses + *out = make([]*InstanceIPv6Address, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceIPv6Address) + (*in).DeepCopyInto(*out) + } + } + } if in.IPv6PrefixCount != nil { in, out := &in.IPv6PrefixCount, &out.IPv6PrefixCount *out = new(int64) **out = **in } + if in.IPv6Prefixes != nil { + in, out := &in.IPv6Prefixes, &out.IPv6Prefixes + *out = make([]*IPv6PrefixSpecificationRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(IPv6PrefixSpecificationRequest) + (*in).DeepCopyInto(*out) + } + } + } if in.NetworkCardIndex != nil { in, out := &in.NetworkCardIndex, &out.NetworkCardIndex *out = new(int64) @@ -6890,6 +7537,17 @@ func (in *InstanceNetworkInterfaceSpecification) DeepCopyInto(out *InstanceNetwo *out = new(string) **out = **in } + if in.PrivateIPAddresses != nil { + in, out := &in.PrivateIPAddresses, &out.PrivateIPAddresses + *out = make([]*PrivateIPAddressSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(PrivateIPAddressSpecification) + (*in).DeepCopyInto(*out) + } + } + } if in.SecondaryPrivateIPAddressCount != nil { in, out := &in.SecondaryPrivateIPAddressCount, &out.SecondaryPrivateIPAddressCount *out = new(int64) @@ -6915,6 +7573,11 @@ func (in *InstanceNetworkInterfaceSpecification) DeepCopy() *InstanceNetworkInte // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstancePrivateIPAddress) DeepCopyInto(out *InstancePrivateIPAddress) { *out = *in + if in.Association != nil { + in, out := &in.Association, &out.Association + *out = new(InstanceNetworkInterfaceAssociation) + (*in).DeepCopyInto(*out) + } if in.Primary != nil { in, out := &in.Primary, &out.Primary *out = new(bool) @@ -7035,6 +7698,11 @@ func (in *InstanceState) DeepCopyInto(out *InstanceState) { *out = new(int64) **out = **in } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceState. @@ -7050,11 +7718,21 @@ func (in *InstanceState) DeepCopy() *InstanceState { // 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 + if in.CurrentState != nil { + in, out := &in.CurrentState, &out.CurrentState + *out = new(InstanceState) + (*in).DeepCopyInto(*out) + } if in.InstanceID != nil { in, out := &in.InstanceID, &out.InstanceID *out = new(string) **out = **in } + if in.PreviousState != nil { + in, out := &in.PreviousState, &out.PreviousState + *out = new(InstanceState) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStateChange. @@ -7080,6 +7758,11 @@ func (in *InstanceStatus) DeepCopyInto(out *InstanceStatus) { *out = new(string) **out = **in } + if in.InstanceState != nil { + in, out := &in.InstanceState, &out.InstanceState + *out = new(InstanceState) + (*in).DeepCopyInto(*out) + } if in.OutpostARN != nil { in, out := &in.OutpostARN, &out.OutpostARN *out = new(string) @@ -7169,7 +7852,7 @@ func (in *InstanceTagNotificationAttribute) DeepCopy() *InstanceTagNotificationA } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceTypeInfoFromInstanceRequirements) DeepCopyInto(out *InstanceTypeInfoFromInstanceRequirements) { +func (in *InstanceTypeInfo) DeepCopyInto(out *InstanceTypeInfo) { *out = *in if in.InstanceType != nil { in, out := &in.InstanceType, &out.InstanceType @@ -7178,49 +7861,89 @@ func (in *InstanceTypeInfoFromInstanceRequirements) DeepCopyInto(out *InstanceTy } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTypeInfoFromInstanceRequirements. -func (in *InstanceTypeInfoFromInstanceRequirements) DeepCopy() *InstanceTypeInfoFromInstanceRequirements { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTypeInfo. +func (in *InstanceTypeInfo) DeepCopy() *InstanceTypeInfo { if in == nil { return nil } - out := new(InstanceTypeInfoFromInstanceRequirements) + out := new(InstanceTypeInfo) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceUsage) DeepCopyInto(out *InstanceUsage) { +func (in *InstanceTypeInfoFromInstanceRequirements) DeepCopyInto(out *InstanceTypeInfoFromInstanceRequirements) { *out = *in - if in.AccountID != nil { - in, out := &in.AccountID, &out.AccountID + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType *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. -func (in *InstanceUsage) DeepCopy() *InstanceUsage { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTypeInfoFromInstanceRequirements. +func (in *InstanceTypeInfoFromInstanceRequirements) DeepCopy() *InstanceTypeInfoFromInstanceRequirements { if in == nil { return nil } - out := new(InstanceUsage) + out := new(InstanceTypeInfoFromInstanceRequirements) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InternetGateway) DeepCopyInto(out *InternetGateway) { +func (in *InstanceTypeOffering) DeepCopyInto(out *InstanceTypeOffering) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTypeOffering. +func (in *InstanceTypeOffering) DeepCopy() *InstanceTypeOffering { + if in == nil { + return nil + } + out := new(InstanceTypeOffering) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceUsage) DeepCopyInto(out *InstanceUsage) { + *out = *in + if in.AccountID != nil { + in, out := &in.AccountID, &out.AccountID + *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. +func (in *InstanceUsage) DeepCopy() *InstanceUsage { + if in == nil { + return nil + } + out := new(InstanceUsage) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InternetGateway) DeepCopyInto(out *InternetGateway) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InternetGateway. func (in *InternetGateway) DeepCopy() *InternetGateway { @@ -7552,11 +8275,21 @@ func (in *LaunchSpecification) DeepCopyInto(out *LaunchSpecification) { *out = new(bool) **out = **in } + if in.IAMInstanceProfile != nil { + in, out := &in.IAMInstanceProfile, &out.IAMInstanceProfile + *out = new(IAMInstanceProfileSpecification) + (*in).DeepCopyInto(*out) + } if in.ImageID != nil { in, out := &in.ImageID, &out.ImageID *out = new(string) **out = **in } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.KernelID != nil { in, out := &in.KernelID, &out.KernelID *out = new(string) @@ -7567,11 +8300,38 @@ func (in *LaunchSpecification) DeepCopyInto(out *LaunchSpecification) { *out = new(string) **out = **in } - if in.RamdiskID != nil { - in, out := &in.RamdiskID, &out.RamdiskID + if in.Monitoring != nil { + in, out := &in.Monitoring, &out.Monitoring + *out = new(RunInstancesMonitoringEnabled) + (*in).DeepCopyInto(*out) + } + if in.NetworkInterfaces != nil { + in, out := &in.NetworkInterfaces, &out.NetworkInterfaces + *out = make([]*InstanceNetworkInterfaceSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceNetworkInterfaceSpecification) + (*in).DeepCopyInto(*out) + } + } + } + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID *out = new(string) **out = **in } + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]*GroupIdentifier, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(GroupIdentifier) + (*in).DeepCopyInto(*out) + } + } + } if in.SubnetID != nil { in, out := &in.SubnetID, &out.SubnetID *out = new(string) @@ -7754,6 +8514,56 @@ func (in *LaunchTemplateCPUOptionsRequest) DeepCopy() *LaunchTemplateCPUOptionsR return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateCapacityReservationSpecificationRequest) DeepCopyInto(out *LaunchTemplateCapacityReservationSpecificationRequest) { + *out = *in + if in.CapacityReservationPreference != nil { + in, out := &in.CapacityReservationPreference, &out.CapacityReservationPreference + *out = new(string) + **out = **in + } + if in.CapacityReservationTarget != nil { + in, out := &in.CapacityReservationTarget, &out.CapacityReservationTarget + *out = new(CapacityReservationTarget) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateCapacityReservationSpecificationRequest. +func (in *LaunchTemplateCapacityReservationSpecificationRequest) DeepCopy() *LaunchTemplateCapacityReservationSpecificationRequest { + if in == nil { + return nil + } + out := new(LaunchTemplateCapacityReservationSpecificationRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateCapacityReservationSpecificationResponse) DeepCopyInto(out *LaunchTemplateCapacityReservationSpecificationResponse) { + *out = *in + if in.CapacityReservationPreference != nil { + in, out := &in.CapacityReservationPreference, &out.CapacityReservationPreference + *out = new(string) + **out = **in + } + if in.CapacityReservationTarget != nil { + in, out := &in.CapacityReservationTarget, &out.CapacityReservationTarget + *out = new(CapacityReservationTargetResponse) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateCapacityReservationSpecificationResponse. +func (in *LaunchTemplateCapacityReservationSpecificationResponse) DeepCopy() *LaunchTemplateCapacityReservationSpecificationResponse { + if in == nil { + return nil + } + out := new(LaunchTemplateCapacityReservationSpecificationResponse) + 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 @@ -7772,6 +8582,11 @@ func (in *LaunchTemplateEBSBlockDevice) DeepCopyInto(out *LaunchTemplateEBSBlock *out = new(int64) **out = **in } + if in.SnapshotID != nil { + in, out := &in.SnapshotID, &out.SnapshotID + *out = new(string) + **out = **in + } if in.Throughput != nil { in, out := &in.Throughput, &out.Throughput *out = new(int64) @@ -7782,6 +8597,11 @@ func (in *LaunchTemplateEBSBlockDevice) DeepCopyInto(out *LaunchTemplateEBSBlock *out = new(int64) **out = **in } + if in.VolumeType != nil { + in, out := &in.VolumeType, &out.VolumeType + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateEBSBlockDevice. @@ -7812,6 +8632,11 @@ func (in *LaunchTemplateEBSBlockDeviceRequest) DeepCopyInto(out *LaunchTemplateE *out = new(int64) **out = **in } + if in.SnapshotID != nil { + in, out := &in.SnapshotID, &out.SnapshotID + *out = new(string) + **out = **in + } if in.Throughput != nil { in, out := &in.Throughput, &out.Throughput *out = new(int64) @@ -7822,6 +8647,11 @@ func (in *LaunchTemplateEBSBlockDeviceRequest) DeepCopyInto(out *LaunchTemplateE *out = new(int64) **out = **in } + if in.VolumeType != nil { + in, out := &in.VolumeType, &out.VolumeType + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateEBSBlockDeviceRequest. @@ -8009,6 +8839,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 *LaunchTemplateInstanceMarketOptions) DeepCopyInto(out *LaunchTemplateInstanceMarketOptions) { + *out = *in + if in.MarketType != nil { + in, out := &in.MarketType, &out.MarketType + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateInstanceMarketOptions. +func (in *LaunchTemplateInstanceMarketOptions) DeepCopy() *LaunchTemplateInstanceMarketOptions { + if in == nil { + return nil + } + out := new(LaunchTemplateInstanceMarketOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateInstanceMarketOptionsRequest) DeepCopyInto(out *LaunchTemplateInstanceMarketOptionsRequest) { + *out = *in + if in.MarketType != nil { + in, out := &in.MarketType, &out.MarketType + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateInstanceMarketOptionsRequest. +func (in *LaunchTemplateInstanceMarketOptionsRequest) DeepCopy() *LaunchTemplateInstanceMarketOptionsRequest { + if in == nil { + return nil + } + out := new(LaunchTemplateInstanceMarketOptionsRequest) + in.DeepCopyInto(out) + 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 @@ -8103,6 +8973,17 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecification) DeepCopyInto(out *out = new(int64) **out = **in } + if in.IPv6Addresses != nil { + in, out := &in.IPv6Addresses, &out.IPv6Addresses + *out = make([]*InstanceIPv6Address, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceIPv6Address) + (*in).DeepCopyInto(*out) + } + } + } if in.IPv6PrefixCount != nil { in, out := &in.IPv6PrefixCount, &out.IPv6PrefixCount *out = new(int64) @@ -8123,6 +9004,17 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecification) DeepCopyInto(out *out = new(string) **out = **in } + if in.PrivateIPAddresses != nil { + in, out := &in.PrivateIPAddresses, &out.PrivateIPAddresses + *out = make([]*PrivateIPAddressSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(PrivateIPAddressSpecification) + (*in).DeepCopyInto(*out) + } + } + } if in.SecondaryPrivateIPAddressCount != nil { in, out := &in.SecondaryPrivateIPAddressCount, &out.SecondaryPrivateIPAddressCount *out = new(int64) @@ -8173,6 +9065,17 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) DeepCopyIn *out = new(int64) **out = **in } + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } if in.InterfaceType != nil { in, out := &in.InterfaceType, &out.InterfaceType *out = new(string) @@ -8183,6 +9086,17 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) DeepCopyIn *out = new(int64) **out = **in } + if in.IPv4Prefixes != nil { + in, out := &in.IPv4Prefixes, &out.IPv4Prefixes + *out = make([]*IPv4PrefixSpecificationRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(IPv4PrefixSpecificationRequest) + (*in).DeepCopyInto(*out) + } + } + } if in.IPv6AddressCount != nil { in, out := &in.IPv6AddressCount, &out.IPv6AddressCount *out = new(int64) @@ -8193,6 +9107,17 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) DeepCopyIn *out = new(int64) **out = **in } + if in.IPv6Prefixes != nil { + in, out := &in.IPv6Prefixes, &out.IPv6Prefixes + *out = make([]*IPv6PrefixSpecificationRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(IPv6PrefixSpecificationRequest) + (*in).DeepCopyInto(*out) + } + } + } if in.NetworkCardIndex != nil { in, out := &in.NetworkCardIndex, &out.NetworkCardIndex *out = new(int64) @@ -8208,6 +9133,17 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) DeepCopyIn *out = new(string) **out = **in } + if in.PrivateIPAddresses != nil { + in, out := &in.PrivateIPAddresses, &out.PrivateIPAddresses + *out = make([]*PrivateIPAddressSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(PrivateIPAddressSpecification) + (*in).DeepCopyInto(*out) + } + } + } if in.SecondaryPrivateIPAddressCount != nil { in, out := &in.SecondaryPrivateIPAddressCount, &out.SecondaryPrivateIPAddressCount *out = new(int64) @@ -8278,6 +9214,11 @@ func (in *LaunchTemplateOverrides) DeepCopyInto(out *LaunchTemplateOverrides) { *out = new(string) **out = **in } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.SpotPrice != nil { in, out := &in.SpotPrice, &out.SpotPrice *out = new(string) @@ -8368,6 +9309,11 @@ func (in *LaunchTemplatePlacementRequest) DeepCopyInto(out *LaunchTemplatePlacem *out = new(string) **out = **in } + if in.GroupName != nil { + in, out := &in.GroupName, &out.GroupName + *out = new(string) + **out = **in + } if in.HostResourceGroupARN != nil { in, out := &in.HostResourceGroupARN, &out.HostResourceGroupARN *out = new(string) @@ -8403,6 +9349,11 @@ func (in *LaunchTemplatePlacementRequest) DeepCopy() *LaunchTemplatePlacementReq // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateSpecification) DeepCopyInto(out *LaunchTemplateSpecification) { *out = *in + if in.LaunchTemplateID != nil { + in, out := &in.LaunchTemplateID, &out.LaunchTemplateID + *out = new(string) + **out = **in + } if in.LaunchTemplateName != nil { in, out := &in.LaunchTemplateName, &out.LaunchTemplateName *out = new(string) @@ -8433,11 +9384,21 @@ func (in *LaunchTemplateSpotMarketOptions) DeepCopyInto(out *LaunchTemplateSpotM *out = new(int64) **out = **in } + if in.InstanceInterruptionBehavior != nil { + in, out := &in.InstanceInterruptionBehavior, &out.InstanceInterruptionBehavior + *out = new(string) + **out = **in + } if in.MaxPrice != nil { in, out := &in.MaxPrice, &out.MaxPrice *out = new(string) **out = **in } + if in.SpotInstanceType != nil { + in, out := &in.SpotInstanceType, &out.SpotInstanceType + *out = new(string) + **out = **in + } if in.ValidUntil != nil { in, out := &in.ValidUntil, &out.ValidUntil *out = (*in).DeepCopy() @@ -8462,11 +9423,21 @@ func (in *LaunchTemplateSpotMarketOptionsRequest) DeepCopyInto(out *LaunchTempla *out = new(int64) **out = **in } + if in.InstanceInterruptionBehavior != nil { + in, out := &in.InstanceInterruptionBehavior, &out.InstanceInterruptionBehavior + *out = new(string) + **out = **in + } if in.MaxPrice != nil { in, out := &in.MaxPrice, &out.MaxPrice *out = new(string) **out = **in } + if in.SpotInstanceType != nil { + in, out := &in.SpotInstanceType, &out.SpotInstanceType + *out = new(string) + **out = **in + } if in.ValidUntil != nil { in, out := &in.ValidUntil, &out.ValidUntil *out = (*in).DeepCopy() @@ -9283,6 +10254,26 @@ func (in *ModifyVPNTunnelOptionsSpecification) DeepCopy() *ModifyVPNTunnelOption return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Monitoring) DeepCopyInto(out *Monitoring) { + *out = *in + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Monitoring. +func (in *Monitoring) DeepCopy() *Monitoring { + if in == nil { + return nil + } + out := new(Monitoring) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MovingAddressStatus) DeepCopyInto(out *MovingAddressStatus) { *out = *in @@ -9843,6 +10834,17 @@ func (in *NetworkInterface) DeepCopyInto(out *NetworkInterface) { *out = new(string) **out = **in } + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]*GroupIdentifier, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(GroupIdentifier) + (*in).DeepCopyInto(*out) + } + } + } if in.MacAddress != nil { in, out := &in.MacAddress, &out.MacAddress *out = new(string) @@ -9888,8 +10890,13 @@ func (in *NetworkInterface) DeepCopyInto(out *NetworkInterface) { *out = new(bool) **out = **in } - if in.SubnetID != nil { - in, out := &in.SubnetID, &out.SubnetID + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(string) + **out = **in + } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID *out = new(string) **out = **in } @@ -10724,6 +11731,11 @@ func (in *Placement) DeepCopyInto(out *Placement) { *out = new(string) **out = **in } + if in.GroupName != nil { + in, out := &in.GroupName, &out.GroupName + *out = new(string) + **out = **in + } if in.HostID != nil { in, out := &in.HostID, &out.HostID *out = new(string) @@ -10802,6 +11814,26 @@ func (in *PlacementGroup) DeepCopy() *PlacementGroup { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlacementResponse) DeepCopyInto(out *PlacementResponse) { + *out = *in + if in.GroupName != nil { + in, out := &in.GroupName, &out.GroupName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementResponse. +func (in *PlacementResponse) DeepCopy() *PlacementResponse { + if in == nil { + return nil + } + out := new(PlacementResponse) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PoolCIDRBlock) DeepCopyInto(out *PoolCIDRBlock) { *out = *in @@ -11126,6 +12158,11 @@ func (in *ProductCode) DeepCopyInto(out *ProductCode) { *out = new(string) **out = **in } + if in.ProductCodeType != nil { + in, out := &in.ProductCodeType, &out.ProductCodeType + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProductCode. @@ -11505,42 +12542,518 @@ func (in *ReplaceRootVolumeTask) DeepCopyInto(out *ReplaceRootVolumeTask) { *out = new(string) **out = **in } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make([]*Tag, len(*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) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplaceRootVolumeTask. +func (in *ReplaceRootVolumeTask) DeepCopy() *ReplaceRootVolumeTask { + if in == nil { + return nil + } + out := new(ReplaceRootVolumeTask) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequestLaunchTemplateData) DeepCopyInto(out *RequestLaunchTemplateData) { + *out = *in + if in.CreditSpecification != nil { + in, out := &in.CreditSpecification, &out.CreditSpecification + *out = new(CreditSpecificationRequest) + (*in).DeepCopyInto(*out) + } + if in.DisableAPITermination != nil { + in, out := &in.DisableAPITermination, &out.DisableAPITermination + *out = new(bool) + **out = **in + } + if in.EBSOptimized != nil { + in, out := &in.EBSOptimized, &out.EBSOptimized + *out = new(bool) + **out = **in + } + if in.ImageID != nil { + in, out := &in.ImageID, &out.ImageID + *out = new(string) + **out = **in + } + if in.InstanceInitiatedShutdownBehavior != nil { + in, out := &in.InstanceInitiatedShutdownBehavior, &out.InstanceInitiatedShutdownBehavior + *out = new(string) + **out = **in + } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } + if in.KernelID != nil { + in, out := &in.KernelID, &out.KernelID + *out = new(string) + **out = **in + } + if in.KeyName != nil { + in, out := &in.KeyName, &out.KeyName + *out = new(string) + **out = **in + } + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID + *out = new(string) + **out = **in + } + if in.SecurityGroupIDs != nil { + in, out := &in.SecurityGroupIDs, &out.SecurityGroupIDs + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.UserData != nil { + in, out := &in.UserData, &out.UserData + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestLaunchTemplateData. +func (in *RequestLaunchTemplateData) DeepCopy() *RequestLaunchTemplateData { + if in == nil { + return nil + } + out := new(RequestLaunchTemplateData) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequestSpotLaunchSpecification) DeepCopyInto(out *RequestSpotLaunchSpecification) { + *out = *in + if in.AddressingType != nil { + in, out := &in.AddressingType, &out.AddressingType + *out = new(string) + **out = **in + } + if in.EBSOptimized != nil { + in, out := &in.EBSOptimized, &out.EBSOptimized + *out = new(bool) + **out = **in + } + if in.IAMInstanceProfile != nil { + in, out := &in.IAMInstanceProfile, &out.IAMInstanceProfile + *out = new(IAMInstanceProfileSpecification) + (*in).DeepCopyInto(*out) + } + if in.ImageID != nil { + in, out := &in.ImageID, &out.ImageID + *out = new(string) + **out = **in + } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } + if in.KernelID != nil { + in, out := &in.KernelID, &out.KernelID + *out = new(string) + **out = **in + } + if in.KeyName != nil { + in, out := &in.KeyName, &out.KeyName + *out = new(string) + **out = **in + } + if in.Monitoring != nil { + in, out := &in.Monitoring, &out.Monitoring + *out = new(RunInstancesMonitoringEnabled) + (*in).DeepCopyInto(*out) + } + if in.NetworkInterfaces != nil { + in, out := &in.NetworkInterfaces, &out.NetworkInterfaces + *out = make([]*InstanceNetworkInterfaceSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceNetworkInterfaceSpecification) + (*in).DeepCopyInto(*out) + } + } + } + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID + *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) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestSpotLaunchSpecification. +func (in *RequestSpotLaunchSpecification) DeepCopy() *RequestSpotLaunchSpecification { + if in == nil { + return nil + } + out := new(RequestSpotLaunchSpecification) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Reservation) DeepCopyInto(out *Reservation) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reservation. +func (in *Reservation) DeepCopy() *Reservation { + if in == nil { + return nil + } + out := new(Reservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Reservation) 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 *ReservationFleetInstanceSpecification) DeepCopyInto(out *ReservationFleetInstanceSpecification) { + *out = *in + if in.AvailabilityZone != nil { + in, out := &in.AvailabilityZone, &out.AvailabilityZone + *out = new(string) + **out = **in + } + if in.AvailabilityZoneID != nil { + in, out := &in.AvailabilityZoneID, &out.AvailabilityZoneID + *out = new(string) + **out = **in + } + if in.EBSOptimized != nil { + in, out := &in.EBSOptimized, &out.EBSOptimized + *out = new(bool) + **out = **in + } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservationFleetInstanceSpecification. +func (in *ReservationFleetInstanceSpecification) DeepCopy() *ReservationFleetInstanceSpecification { + if in == nil { + return nil + } + out := new(ReservationFleetInstanceSpecification) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReservationList) DeepCopyInto(out *ReservationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Reservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservationList. +func (in *ReservationList) DeepCopy() *ReservationList { + if in == nil { + return nil + } + out := new(ReservationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ReservationList) 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 *ReservationSpec) DeepCopyInto(out *ReservationSpec) { + *out = *in + if in.AdditionalInfo != nil { + in, out := &in.AdditionalInfo, &out.AdditionalInfo + *out = new(string) + **out = **in + } + if in.BlockDeviceMappings != nil { + in, out := &in.BlockDeviceMappings, &out.BlockDeviceMappings + *out = make([]*BlockDeviceMapping, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(BlockDeviceMapping) + (*in).DeepCopyInto(*out) + } + } + } + if in.CapacityReservationSpecification != nil { + in, out := &in.CapacityReservationSpecification, &out.CapacityReservationSpecification + *out = new(CapacityReservationSpecification) + (*in).DeepCopyInto(*out) + } + if in.CPUOptions != nil { + in, out := &in.CPUOptions, &out.CPUOptions + *out = new(CPUOptionsRequest) + (*in).DeepCopyInto(*out) + } + if in.CreditSpecification != nil { + in, out := &in.CreditSpecification, &out.CreditSpecification + *out = new(CreditSpecificationRequest) + (*in).DeepCopyInto(*out) + } + if in.DisableAPITermination != nil { + in, out := &in.DisableAPITermination, &out.DisableAPITermination + *out = new(bool) + **out = **in + } + if in.EBSOptimized != nil { + in, out := &in.EBSOptimized, &out.EBSOptimized + *out = new(bool) + **out = **in + } + if in.ElasticGPUSpecification != nil { + in, out := &in.ElasticGPUSpecification, &out.ElasticGPUSpecification + *out = make([]*ElasticGPUSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ElasticGPUSpecification) + (*in).DeepCopyInto(*out) + } + } + } + if in.ElasticInferenceAccelerators != nil { + in, out := &in.ElasticInferenceAccelerators, &out.ElasticInferenceAccelerators + *out = make([]*ElasticInferenceAccelerator, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ElasticInferenceAccelerator) + (*in).DeepCopyInto(*out) + } + } + } + if in.EnclaveOptions != nil { + in, out := &in.EnclaveOptions, &out.EnclaveOptions + *out = new(EnclaveOptionsRequest) + (*in).DeepCopyInto(*out) + } + if in.HibernationOptions != nil { + in, out := &in.HibernationOptions, &out.HibernationOptions + *out = new(HibernationOptionsRequest) + (*in).DeepCopyInto(*out) + } + if in.IAMInstanceProfile != nil { + in, out := &in.IAMInstanceProfile, &out.IAMInstanceProfile + *out = new(IAMInstanceProfileSpecification) + (*in).DeepCopyInto(*out) + } + if in.ImageID != nil { + in, out := &in.ImageID, &out.ImageID + *out = new(string) + **out = **in + } + if in.InstanceInitiatedShutdownBehavior != nil { + in, out := &in.InstanceInitiatedShutdownBehavior, &out.InstanceInitiatedShutdownBehavior + *out = new(string) + **out = **in + } + if in.InstanceMarketOptions != nil { + in, out := &in.InstanceMarketOptions, &out.InstanceMarketOptions + *out = new(InstanceMarketOptionsRequest) + (*in).DeepCopyInto(*out) + } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } + if in.IPv6AddressCount != nil { + in, out := &in.IPv6AddressCount, &out.IPv6AddressCount + *out = new(int64) + **out = **in + } + if in.IPv6Addresses != nil { + in, out := &in.IPv6Addresses, &out.IPv6Addresses + *out = make([]*InstanceIPv6Address, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceIPv6Address) + (*in).DeepCopyInto(*out) + } + } + } + if in.KernelID != nil { + in, out := &in.KernelID, &out.KernelID + *out = new(string) + **out = **in + } + if in.KeyName != nil { + in, out := &in.KeyName, &out.KeyName + *out = new(string) + **out = **in + } + if in.LaunchTemplate != nil { + in, out := &in.LaunchTemplate, &out.LaunchTemplate + *out = new(LaunchTemplateSpecification) + (*in).DeepCopyInto(*out) + } + if in.LicenseSpecifications != nil { + in, out := &in.LicenseSpecifications, &out.LicenseSpecifications + *out = make([]*LicenseConfigurationRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LicenseConfigurationRequest) + (*in).DeepCopyInto(*out) + } + } + } + if in.MaxCount != nil { + in, out := &in.MaxCount, &out.MaxCount + *out = new(int64) + **out = **in + } + if in.MetadataOptions != nil { + in, out := &in.MetadataOptions, &out.MetadataOptions + *out = new(InstanceMetadataOptionsRequest) + (*in).DeepCopyInto(*out) + } + if in.MinCount != nil { + in, out := &in.MinCount, &out.MinCount + *out = new(int64) + **out = **in + } + if in.Monitoring != nil { + in, out := &in.Monitoring, &out.Monitoring + *out = new(RunInstancesMonitoringEnabled) + (*in).DeepCopyInto(*out) + } + if in.NetworkInterfaces != nil { + in, out := &in.NetworkInterfaces, &out.NetworkInterfaces + *out = make([]*InstanceNetworkInterfaceSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceNetworkInterfaceSpecification) + (*in).DeepCopyInto(*out) + } + } + } + if in.Placement != nil { + in, out := &in.Placement, &out.Placement + *out = new(Placement) + (*in).DeepCopyInto(*out) + } + if in.PrivateIPAddress != nil { + in, out := &in.PrivateIPAddress, &out.PrivateIPAddress + *out = new(string) + **out = **in + } + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID + *out = new(string) + **out = **in + } + if in.SecurityGroupIDs != nil { + in, out := &in.SecurityGroupIDs, &out.SecurityGroupIDs + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *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(Tag) + *out = new(TagSpecification) (*in).DeepCopyInto(*out) } } } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplaceRootVolumeTask. -func (in *ReplaceRootVolumeTask) DeepCopy() *ReplaceRootVolumeTask { - if in == nil { - return nil - } - out := new(ReplaceRootVolumeTask) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RequestLaunchTemplateData) DeepCopyInto(out *RequestLaunchTemplateData) { - *out = *in - if in.DisableAPITermination != nil { - in, out := &in.DisableAPITermination, &out.DisableAPITermination - *out = new(bool) - **out = **in - } - if in.EBSOptimized != nil { - in, out := &in.EBSOptimized, &out.EBSOptimized - *out = new(bool) - **out = **in - } if in.UserData != nil { in, out := &in.UserData, &out.UserData *out = new(string) @@ -11548,107 +13061,162 @@ func (in *RequestLaunchTemplateData) DeepCopyInto(out *RequestLaunchTemplateData } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestLaunchTemplateData. -func (in *RequestLaunchTemplateData) DeepCopy() *RequestLaunchTemplateData { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservationSpec. +func (in *ReservationSpec) DeepCopy() *ReservationSpec { if in == nil { return nil } - out := new(RequestLaunchTemplateData) + out := new(ReservationSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RequestSpotLaunchSpecification) DeepCopyInto(out *RequestSpotLaunchSpecification) { +func (in *ReservationStatus) DeepCopyInto(out *ReservationStatus) { *out = *in - if in.AddressingType != nil { - in, out := &in.AddressingType, &out.AddressingType - *out = new(string) - **out = **in + if in.ACKResourceMetadata != nil { + in, out := &in.ACKResourceMetadata, &out.ACKResourceMetadata + *out = new(corev1alpha1.ResourceMetadata) + (*in).DeepCopyInto(*out) } - if in.EBSOptimized != nil { - in, out := &in.EBSOptimized, &out.EBSOptimized - *out = new(bool) + 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.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]*GroupIdentifier, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(GroupIdentifier) + (*in).DeepCopyInto(*out) + } + } + } + if in.Instances != nil { + in, out := &in.Instances, &out.Instances + *out = make([]*Instance, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Instance) + (*in).DeepCopyInto(*out) + } + } + } + if in.OwnerID != nil { + in, out := &in.OwnerID, &out.OwnerID + *out = new(string) **out = **in } - if in.SubnetID != nil { - in, out := &in.SubnetID, &out.SubnetID + if in.RequesterID != nil { + in, out := &in.RequesterID, &out.RequesterID *out = new(string) **out = **in } - if in.UserData != nil { - in, out := &in.UserData, &out.UserData + if in.ReservationID != nil { + in, out := &in.ReservationID, &out.ReservationID *out = new(string) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestSpotLaunchSpecification. -func (in *RequestSpotLaunchSpecification) DeepCopy() *RequestSpotLaunchSpecification { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservationStatus. +func (in *ReservationStatus) DeepCopy() *ReservationStatus { if in == nil { return nil } - out := new(RequestSpotLaunchSpecification) + out := new(ReservationStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReservationFleetInstanceSpecification) DeepCopyInto(out *ReservationFleetInstanceSpecification) { +func (in *ReservationValue) DeepCopyInto(out *ReservationValue) { *out = *in - if in.AvailabilityZone != nil { - in, out := &in.AvailabilityZone, &out.AvailabilityZone + if in.HourlyPrice != nil { + in, out := &in.HourlyPrice, &out.HourlyPrice *out = new(string) **out = **in } - if in.AvailabilityZoneID != nil { - in, out := &in.AvailabilityZoneID, &out.AvailabilityZoneID + if in.RemainingTotalValue != nil { + in, out := &in.RemainingTotalValue, &out.RemainingTotalValue *out = new(string) **out = **in } - if in.EBSOptimized != nil { - in, out := &in.EBSOptimized, &out.EBSOptimized - *out = new(bool) + if in.RemainingUpfrontValue != nil { + in, out := &in.RemainingUpfrontValue, &out.RemainingUpfrontValue + *out = new(string) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservationFleetInstanceSpecification. -func (in *ReservationFleetInstanceSpecification) DeepCopy() *ReservationFleetInstanceSpecification { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservationValue. +func (in *ReservationValue) DeepCopy() *ReservationValue { if in == nil { return nil } - out := new(ReservationFleetInstanceSpecification) + out := new(ReservationValue) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReservationValue) DeepCopyInto(out *ReservationValue) { +func (in *Reservation_SDK) DeepCopyInto(out *Reservation_SDK) { *out = *in - if in.HourlyPrice != nil { - in, out := &in.HourlyPrice, &out.HourlyPrice + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]*GroupIdentifier, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(GroupIdentifier) + (*in).DeepCopyInto(*out) + } + } + } + if in.Instances != nil { + in, out := &in.Instances, &out.Instances + *out = make([]*Instance, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Instance) + (*in).DeepCopyInto(*out) + } + } + } + if in.OwnerID != nil { + in, out := &in.OwnerID, &out.OwnerID *out = new(string) **out = **in } - if in.RemainingTotalValue != nil { - in, out := &in.RemainingTotalValue, &out.RemainingTotalValue + if in.RequesterID != nil { + in, out := &in.RequesterID, &out.RequesterID *out = new(string) **out = **in } - if in.RemainingUpfrontValue != nil { - in, out := &in.RemainingUpfrontValue, &out.RemainingUpfrontValue + if in.ReservationID != nil { + in, out := &in.ReservationID, &out.ReservationID *out = new(string) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservationValue. -func (in *ReservationValue) DeepCopy() *ReservationValue { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reservation_SDK. +func (in *Reservation_SDK) DeepCopy() *Reservation_SDK { if in == nil { return nil } - out := new(ReservationValue) + out := new(Reservation_SDK) in.DeepCopyInto(out) return out } @@ -11700,6 +13268,11 @@ func (in *ReservedInstances) DeepCopyInto(out *ReservedInstances) { *out = new(string) **out = **in } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.ReservedInstancesID != nil { in, out := &in.ReservedInstancesID, &out.ReservedInstancesID *out = new(string) @@ -11745,6 +13318,11 @@ func (in *ReservedInstancesConfiguration) DeepCopyInto(out *ReservedInstancesCon *out = new(int64) **out = **in } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.Platform != nil { in, out := &in.Platform, &out.Platform *out = new(string) @@ -11921,6 +13499,11 @@ func (in *ReservedInstancesOffering) DeepCopyInto(out *ReservedInstancesOffering *out = new(string) **out = **in } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.Marketplace != nil { in, out := &in.Marketplace, &out.Marketplace *out = new(bool) @@ -11981,6 +13564,16 @@ func (in *ResponseLaunchTemplateData) DeepCopyInto(out *ResponseLaunchTemplateDa *out = new(string) **out = **in } + if in.InstanceInitiatedShutdownBehavior != nil { + in, out := &in.InstanceInitiatedShutdownBehavior, &out.InstanceInitiatedShutdownBehavior + *out = new(string) + **out = **in + } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.KernelID != nil { in, out := &in.KernelID, &out.KernelID *out = new(string) @@ -11991,8 +13584,8 @@ func (in *ResponseLaunchTemplateData) DeepCopyInto(out *ResponseLaunchTemplateDa *out = new(string) **out = **in } - if in.RamDiskID != nil { - in, out := &in.RamDiskID, &out.RamDiskID + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID *out = new(string) **out = **in } @@ -12812,6 +14405,11 @@ func (in *ScheduledInstancesEBS) DeepCopyInto(out *ScheduledInstancesEBS) { *out = new(int64) **out = **in } + if in.SnapshotID != nil { + in, out := &in.SnapshotID, &out.SnapshotID + *out = new(string) + **out = **in + } if in.VolumeSize != nil { in, out := &in.VolumeSize, &out.VolumeSize *out = new(int64) @@ -12867,11 +14465,31 @@ func (in *ScheduledInstancesLaunchSpecification) DeepCopyInto(out *ScheduledInst *out = new(bool) **out = **in } + if in.ImageID != nil { + in, out := &in.ImageID, &out.ImageID + *out = new(string) + **out = **in + } if in.InstanceType != nil { in, out := &in.InstanceType, &out.InstanceType *out = new(string) **out = **in } + if in.KernelID != nil { + in, out := &in.KernelID, &out.KernelID + *out = new(string) + **out = **in + } + if in.KeyName != nil { + in, out := &in.KeyName, &out.KeyName + *out = new(string) + **out = **in + } + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID + *out = new(string) + **out = **in + } if in.SubnetID != nil { in, out := &in.SubnetID, &out.SubnetID *out = new(string) @@ -12982,6 +14600,11 @@ func (in *ScheduledInstancesPlacement) DeepCopyInto(out *ScheduledInstancesPlace *out = new(string) **out = **in } + if in.GroupName != nil { + in, out := &in.GroupName, &out.GroupName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledInstancesPlacement. @@ -13957,16 +15580,58 @@ func (in *SpotFleetLaunchSpecification) DeepCopyInto(out *SpotFleetLaunchSpecifi *out = new(bool) **out = **in } + if in.IAMInstanceProfile != nil { + in, out := &in.IAMInstanceProfile, &out.IAMInstanceProfile + *out = new(IAMInstanceProfileSpecification) + (*in).DeepCopyInto(*out) + } + if in.ImageID != nil { + in, out := &in.ImageID, &out.ImageID + *out = new(string) + **out = **in + } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.KernelID != nil { in, out := &in.KernelID, &out.KernelID *out = new(string) **out = **in } - if in.RamdiskID != nil { - in, out := &in.RamdiskID, &out.RamdiskID + if in.KeyName != nil { + in, out := &in.KeyName, &out.KeyName + *out = new(string) + **out = **in + } + if in.NetworkInterfaces != nil { + in, out := &in.NetworkInterfaces, &out.NetworkInterfaces + *out = make([]*InstanceNetworkInterfaceSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceNetworkInterfaceSpecification) + (*in).DeepCopyInto(*out) + } + } + } + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID *out = new(string) **out = **in } + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]*GroupIdentifier, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(GroupIdentifier) + (*in).DeepCopyInto(*out) + } + } + } if in.SpotPrice != nil { in, out := &in.SpotPrice, &out.SpotPrice *out = new(string) @@ -14067,6 +15732,11 @@ func (in *SpotFleetRequestConfigData) DeepCopyInto(out *SpotFleetRequestConfigDa *out = new(string) **out = **in } + if in.InstanceInterruptionBehavior != nil { + in, out := &in.InstanceInterruptionBehavior, &out.InstanceInterruptionBehavior + *out = new(string) + **out = **in + } if in.InstancePoolsToUseCount != nil { in, out := &in.InstancePoolsToUseCount, &out.InstancePoolsToUseCount *out = new(int64) @@ -14196,6 +15866,11 @@ func (in *SpotInstanceRequest) DeepCopyInto(out *SpotInstanceRequest) { *out = new(string) **out = **in } + if in.InstanceInterruptionBehavior != nil { + in, out := &in.InstanceInterruptionBehavior, &out.InstanceInterruptionBehavior + *out = new(string) + **out = **in + } if in.LaunchGroup != nil { in, out := &in.LaunchGroup, &out.LaunchGroup *out = new(string) @@ -14227,6 +15902,11 @@ func (in *SpotInstanceRequest) DeepCopyInto(out *SpotInstanceRequest) { } } } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } if in.ValidFrom != nil { in, out := &in.ValidFrom, &out.ValidFrom *out = (*in).DeepCopy() @@ -14309,11 +15989,21 @@ func (in *SpotMarketOptions) DeepCopyInto(out *SpotMarketOptions) { *out = new(int64) **out = **in } + if in.InstanceInterruptionBehavior != nil { + in, out := &in.InstanceInterruptionBehavior, &out.InstanceInterruptionBehavior + *out = new(string) + **out = **in + } if in.MaxPrice != nil { in, out := &in.MaxPrice, &out.MaxPrice *out = new(string) **out = **in } + if in.SpotInstanceType != nil { + in, out := &in.SpotInstanceType, &out.SpotInstanceType + *out = new(string) + **out = **in + } if in.ValidUntil != nil { in, out := &in.ValidUntil, &out.ValidUntil *out = (*in).DeepCopy() @@ -14418,6 +16108,11 @@ func (in *SpotPlacement) DeepCopyInto(out *SpotPlacement) { *out = new(string) **out = **in } + if in.GroupName != nil { + in, out := &in.GroupName, &out.GroupName + *out = new(string) + **out = **in + } if in.Tenancy != nil { in, out := &in.Tenancy, &out.Tenancy *out = new(string) @@ -14473,6 +16168,11 @@ func (in *SpotPrice) DeepCopyInto(out *SpotPrice) { *out = new(string) **out = **in } + if in.InstanceType != nil { + in, out := &in.InstanceType, &out.InstanceType + *out = new(string) + **out = **in + } if in.SpotPrice != nil { in, out := &in.SpotPrice, &out.SpotPrice *out = new(string) @@ -18858,6 +20558,11 @@ func (in *VolumeModification) DeepCopyInto(out *VolumeModification) { *out = new(int64) **out = **in } + if in.OriginalVolumeType != nil { + in, out := &in.OriginalVolumeType, &out.OriginalVolumeType + *out = new(string) + **out = **in + } if in.Progress != nil { in, out := &in.Progress, &out.Progress *out = new(int64) @@ -18892,6 +20597,11 @@ func (in *VolumeModification) DeepCopyInto(out *VolumeModification) { *out = new(int64) **out = **in } + if in.TargetVolumeType != nil { + in, out := &in.TargetVolumeType, &out.TargetVolumeType + *out = new(string) + **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 61e8651a..d7952160 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -37,6 +37,7 @@ import ( _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/elastic_ip_address" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/internet_gateway" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/nat_gateway" + _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/reservation" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/route_table" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/security_group" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/subnet" diff --git a/config/crd/bases/ec2.services.k8s.aws_reservations.yaml b/config/crd/bases/ec2.services.k8s.aws_reservations.yaml new file mode 100644 index 00000000..4796a34b --- /dev/null +++ b/config/crd/bases/ec2.services.k8s.aws_reservations.yaml @@ -0,0 +1,1039 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.7.0 + creationTimestamp: null + name: reservations.ec2.services.k8s.aws +spec: + group: ec2.services.k8s.aws + names: + kind: Reservation + listKind: ReservationList + plural: reservations + singular: reservation + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Reservation is the Schema for the Reservations 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: "ReservationSpec defines the desired state of Reservation. + \n Describes a launch request for one or more instances, and includes + owner, requester, and security group information that applies to all + instances in the launch request." + properties: + additionalInfo: + description: Reserved. + type: string + blockDeviceMappings: + description: The block device mapping, which defines the EBS volumes + and instance store volumes to attach to the instance at launch. + For more information, see Block device mappings (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) + in the Amazon EC2 User Guide. + items: + description: Describes a block device mapping, which defines the + EBS volumes and instance store volumes to attach to an instance + at launch. + properties: + deviceName: + type: string + ebs: + description: Describes a block device for an EBS volume. + properties: + deleteOnTermination: + type: boolean + encrypted: + type: boolean + iops: + format: int64 + type: integer + kmsKeyID: + type: string + outpostARN: + type: string + snapshotID: + type: string + throughput: + format: int64 + type: integer + volumeSize: + format: int64 + type: integer + volumeType: + type: string + type: object + noDevice: + type: string + virtualName: + type: string + type: object + type: array + capacityReservationSpecification: + description: Information about the Capacity Reservation targeting + option. If you do not specify this parameter, the instance's Capacity + Reservation preference defaults to open, which enables it to run + in any open Capacity Reservation that has matching attributes (instance + type, platform, Availability Zone). + properties: + capacityReservationPreference: + type: string + capacityReservationTarget: + description: Describes a target Capacity Reservation or Capacity + Reservation group. + properties: + capacityReservationID: + type: string + capacityReservationResourceGroupARN: + type: string + type: object + type: object + cpuOptions: + description: The CPU options for the instance. For more information, + see Optimizing CPU options (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) + in the Amazon EC2 User Guide. + properties: + coreCount: + format: int64 + type: integer + threadsPerCore: + format: int64 + type: integer + type: object + creditSpecification: + description: "The credit option for CPU usage of the burstable performance + instance. Valid values are standard and unlimited. To change this + attribute after launch, use ModifyInstanceCreditSpecification (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceCreditSpecification.html). + For more information, see Burstable performance instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) + in the Amazon EC2 User Guide. \n Default: standard (T2 instances) + or unlimited (T3/T3a instances) \n For T3 instances with host tenancy, + only standard is supported." + properties: + cpuCredits: + type: string + type: object + disableAPITermination: + description: "If you set this parameter to true, you can't terminate + the instance using the Amazon EC2 console, CLI, or API; otherwise, + you can. To change this attribute after launch, use ModifyInstanceAttribute + (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html). + Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, + you can terminate the instance by running the shutdown command from + the instance. \n Default: false" + type: boolean + ebsOptimized: + description: "Indicates whether the instance is optimized for Amazon + EBS I/O. This optimization provides dedicated throughput to Amazon + EBS and an optimized configuration stack to provide optimal Amazon + EBS I/O performance. This optimization isn't available with all + instance types. Additional usage charges apply when using an EBS-optimized + instance. \n Default: false" + type: boolean + elasticGPUSpecification: + description: An elastic GPU to associate with the instance. An Elastic + GPU is a GPU resource that you can attach to your Windows instance + to accelerate the graphics performance of your applications. For + more information, see Amazon EC2 Elastic GPUs (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html) + in the Amazon EC2 User Guide. + items: + description: A specification for an Elastic Graphics accelerator. + properties: + type_: + type: string + type: object + type: array + elasticInferenceAccelerators: + description: "An elastic inference accelerator to associate with the + instance. Elastic inference accelerators are a resource you can + attach to your Amazon EC2 instances to accelerate your Deep Learning + (DL) inference workloads. \n You cannot specify accelerators from + different generations in the same request." + items: + description: Describes an elastic inference accelerator. + properties: + count: + format: int64 + type: integer + type_: + type: string + type: object + type: array + enclaveOptions: + description: "Indicates whether the instance is enabled for Amazon + Web Services Nitro Enclaves. For more information, see What is Amazon + Web Services Nitro Enclaves? (https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html) + in the Amazon Web Services Nitro Enclaves User Guide. \n You can't + enable Amazon Web Services Nitro Enclaves and hibernation on the + same instance." + properties: + enabled: + type: boolean + type: object + hibernationOptions: + description: "Indicates whether an instance is enabled for hibernation. + For more information, see Hibernate your instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + in the Amazon EC2 User Guide. \n You can't enable hibernation and + Amazon Web Services Nitro Enclaves on the same instance." + properties: + configured: + type: boolean + type: object + iamInstanceProfile: + description: The name or Amazon Resource Name (ARN) of an IAM instance + profile. + properties: + arn: + type: string + name: + type: string + type: object + imageID: + description: The ID of the AMI. An AMI ID is required to launch an + instance and must be specified here or in a launch template. + type: string + instanceInitiatedShutdownBehavior: + description: "Indicates whether an instance stops or terminates when + you initiate shutdown from the instance (using the operating system + command for system shutdown). \n Default: stop" + type: string + instanceMarketOptions: + description: "The market (purchasing) option for the instances. \n + For RunInstances, persistent Spot Instance requests are only supported + when InstanceInterruptionBehavior is set to either hibernate or + stop." + properties: + marketType: + type: string + spotOptions: + description: The options for Spot Instances. + properties: + blockDurationMinutes: + format: int64 + type: integer + instanceInterruptionBehavior: + type: string + maxPrice: + type: string + spotInstanceType: + type: string + validUntil: + format: date-time + type: string + type: object + type: object + instanceType: + description: "The instance type. For more information, see Instance + types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + in the Amazon EC2 User Guide. \n Default: m1.small" + type: string + ipv6AddressCount: + description: "[EC2-VPC] The number of IPv6 addresses to associate + with the primary network interface. Amazon EC2 chooses the IPv6 + addresses from the range of your subnet. You cannot specify this + option and the option to assign specific IPv6 addresses in the same + request. You can specify this option if you've specified a minimum + number of instances to launch. \n You cannot specify this option + and the network interfaces option in the same request." + format: int64 + type: integer + ipv6Addresses: + description: "[EC2-VPC] The IPv6 addresses from the range of the subnet + to associate with the primary network interface. You cannot specify + this option and the option to assign a number of IPv6 addresses + in the same request. You cannot specify this option if you've specified + a minimum number of instances to launch. \n You cannot specify this + option and the network interfaces option in the same request." + items: + description: Describes an IPv6 address. + properties: + ipv6Address: + type: string + type: object + type: array + kernelID: + description: "The ID of the kernel. \n We recommend that you use PV-GRUB + instead of kernels and RAM disks. For more information, see PV-GRUB + (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + in the Amazon EC2 User Guide." + type: string + keyName: + description: "The name of the key pair. You can create a key pair + using CreateKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html) + or ImportKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html). + \n If you do not specify a key pair, you can't connect to the instance + unless you choose an AMI that is configured to allow users another + way to log in." + type: string + launchTemplate: + description: The launch template to use to launch the instances. Any + parameters that you specify in RunInstances override the same parameters + in the launch template. You can specify either the name or ID of + a launch template, but not both. + properties: + launchTemplateID: + type: string + launchTemplateName: + type: string + version: + type: string + type: object + licenseSpecifications: + description: The license configurations. + items: + description: Describes a license configuration. + properties: + licenseConfigurationARN: + type: string + type: object + type: array + maxCount: + description: "The maximum number of instances to launch. If you specify + more instances than Amazon EC2 can launch in the target Availability + Zone, Amazon EC2 launches the largest possible number of instances + above MinCount. \n Constraints: Between 1 and the maximum number + you're allowed for the specified instance type. For more information + about the default limits, and how to request an increase, see How + many instances can I run in Amazon EC2 (http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2) + in the Amazon EC2 FAQ." + format: int64 + type: integer + metadataOptions: + description: 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). + properties: + httpEndpoint: + type: string + httpProtocolIPv6: + type: string + httpPutResponseHopLimit: + format: int64 + type: integer + httpTokens: + type: string + type: object + minCount: + description: "The minimum number of instances to launch. If you specify + a minimum that is more instances than Amazon EC2 can launch in the + target Availability Zone, Amazon EC2 launches no instances. \n Constraints: + Between 1 and the maximum number you're allowed for the specified + instance type. For more information about the default limits, and + how to request an increase, see How many instances can I run in + Amazon EC2 (http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2) + in the Amazon EC2 General FAQ." + format: int64 + type: integer + monitoring: + description: Specifies whether detailed monitoring is enabled for + the instance. + properties: + enabled: + type: boolean + type: object + networkInterfaces: + description: The network interfaces to associate with the instance. + If you specify a network interface, you must specify any security + groups and subnets as part of the network interface. + items: + description: Describes a network interface. + properties: + associateCarrierIPAddress: + type: boolean + associatePublicIPAddress: + type: boolean + deleteOnTermination: + type: boolean + description: + type: string + deviceIndex: + format: int64 + type: integer + groups: + items: + type: string + type: array + interfaceType: + type: string + ipv4PrefixCount: + format: int64 + type: integer + ipv4Prefixes: + items: + description: Describes the IPv4 prefix option for a network + interface. + properties: + ipv4Prefix: + type: string + type: object + type: array + ipv6AddressCount: + format: int64 + type: integer + ipv6Addresses: + items: + description: Describes an IPv6 address. + properties: + ipv6Address: + type: string + type: object + type: array + ipv6PrefixCount: + format: int64 + type: integer + ipv6Prefixes: + items: + description: Describes the IPv4 prefix option for a network + interface. + properties: + ipv6Prefix: + type: string + type: object + type: array + networkCardIndex: + format: int64 + type: integer + networkInterfaceID: + type: string + privateIPAddress: + type: string + privateIPAddresses: + items: + description: Describes a secondary private IPv4 address for + a network interface. + properties: + primary: + type: boolean + privateIPAddress: + type: string + type: object + type: array + secondaryPrivateIPAddressCount: + format: int64 + type: integer + subnetID: + type: string + type: object + type: array + placement: + description: The placement for the instance. + properties: + affinity: + type: string + availabilityZone: + type: string + groupName: + type: string + hostID: + type: string + hostResourceGroupARN: + type: string + partitionNumber: + format: int64 + type: integer + spreadDomain: + type: string + tenancy: + type: string + type: object + privateIPAddress: + description: "[EC2-VPC] The primary IPv4 address. You must specify + a value from the IPv4 address range of the subnet. \n Only one private + IP address can be designated as primary. You can't specify this + option if you've specified the option to designate a private IP + address as the primary IP address in a network interface specification. + You cannot specify this option if you're launching more than one + instance in the request. \n You cannot specify this option and the + network interfaces option in the same request." + type: string + ramDiskID: + description: "The ID of the RAM disk to select. Some kernels require + additional drivers at launch. Check the kernel requirements for + information about whether you need to specify a RAM disk. To find + kernel requirements, go to the Amazon Web Services Resource Center + and search for the kernel ID. \n We recommend that you use PV-GRUB + instead of kernels and RAM disks. For more information, see PV-GRUB + (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + in the Amazon EC2 User Guide." + type: string + securityGroupIDs: + description: "The IDs of the security groups. You can create a security + group using CreateSecurityGroup (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html). + \n If you specify a network interface, you must specify any security + groups as part of the network interface." + items: + type: string + type: array + securityGroups: + description: "[EC2-Classic, default VPC] The names of the security + groups. For a nondefault VPC, you must use security group IDs instead. + \n If you specify a network interface, you must specify any security + groups as part of the network interface. \n Default: Amazon EC2 + uses the default security group." + items: + type: string + type: array + subnetID: + description: "[EC2-VPC] The ID of the subnet to launch the instance + into. \n If you specify a network interface, you must specify any + subnets as part of the network interface." + type: string + tagSpecifications: + description: The tags to apply to the resources during launch. You + can only tag instances and volumes on launch. The specified tags + are applied to all instances or volumes that are created during + launch. To tag a resource after it has been created, see CreateTags + (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html). + 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 + userData: + description: The user data to make available to the instance. For + more information, see Running commands on your Linux instance at + launch (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) + (Linux) and Adding User Data (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) + (Windows). If you are using a command line tool, base64-encoding + is performed for you, and you can load the text from a file. Otherwise, + you must provide base64-encoded text. User data is limited to 16 + KB. + type: string + required: + - maxCount + - minCount + type: object + status: + description: ReservationStatus defines the observed state of Reservation + 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 + region: + description: Region is the AWS region in which the resource exists + or will exist. + type: string + required: + - ownerAccountID + - region + type: object + conditions: + description: All CRS managed by ACK have a common `Status.Conditions` + member that contains a collection of `ackv1alpha1.Condition` objects + that describe the various terminal states of the CR and its backend + AWS service API resource + items: + description: Condition is the common struct used by all CRDs managed + by ACK service controllers to indicate terminal states of the + CR and its backend AWS service API resource + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type is the type of the Condition + type: string + required: + - status + - type + type: object + type: array + groups: + description: '[EC2-Classic only] The security groups.' + items: + description: Describes a security group. + properties: + groupID: + type: string + groupName: + type: string + type: object + type: array + instances: + description: The instances. + items: + description: Describes an instance. + properties: + amiLaunchIndex: + format: int64 + type: integer + architecture: + type: string + blockDeviceMappings: + items: + description: Describes a block device mapping. + properties: + deviceName: + type: string + ebs: + description: Describes a parameter used to set up an EBS + volume in a block device mapping. + properties: + attachTime: + format: date-time + type: string + deleteOnTermination: + type: boolean + status: + type: string + volumeID: + type: string + type: object + type: object + type: array + bootMode: + type: string + capacityReservationID: + type: string + capacityReservationSpecification: + description: Describes the instance's Capacity Reservation targeting + preferences. The action returns the capacityReservationPreference + response element if the instance is configured to run in On-Demand + capacity, or if it is configured in run in any open Capacity + Reservation that has matching attributes (instance type, platform, + Availability Zone). The action returns the capacityReservationTarget + response element if the instance explicily targets a specific + Capacity Reservation or Capacity Reservation group. + properties: + capacityReservationPreference: + type: string + capacityReservationTarget: + description: Describes a target Capacity Reservation or + Capacity Reservation group. + properties: + capacityReservationID: + type: string + capacityReservationResourceGroupARN: + type: string + type: object + type: object + clientToken: + type: string + cpuOptions: + description: The CPU options for the instance. + properties: + coreCount: + format: int64 + type: integer + threadsPerCore: + format: int64 + type: integer + type: object + ebsOptimized: + type: boolean + elasticGPUAssociations: + items: + description: Describes the association between an instance + and an Elastic Graphics accelerator. + properties: + elasticGPUAssociationID: + type: string + elasticGPUAssociationState: + type: string + elasticGPUAssociationTime: + type: string + elasticGPUID: + type: string + type: object + type: array + elasticInferenceAcceleratorAssociations: + items: + description: Describes the association between an instance + and an elastic inference accelerator. + properties: + elasticInferenceAcceleratorARN: + type: string + elasticInferenceAcceleratorAssociationID: + type: string + elasticInferenceAcceleratorAssociationState: + type: string + elasticInferenceAcceleratorAssociationTime: + format: date-time + type: string + type: object + type: array + enaSupport: + type: boolean + enclaveOptions: + description: Indicates whether the instance is enabled for Amazon + Web Services Nitro Enclaves. + properties: + enabled: + type: boolean + type: object + hibernationOptions: + description: Indicates whether your instance is configured for + hibernation. This parameter is valid only if the instance + meets the hibernation prerequisites (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). + For more information, see Hibernate your instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + in the Amazon EC2 User Guide. + properties: + configured: + type: boolean + type: object + hypervisor: + type: string + iamInstanceProfile: + description: Describes an IAM instance profile. + properties: + arn: + type: string + id: + type: string + type: object + imageID: + type: string + instanceID: + type: string + instanceLifecycle: + type: string + instanceType: + type: string + kernelID: + type: string + keyName: + type: string + launchTime: + format: date-time + type: string + licenses: + items: + description: Describes a license configuration. + properties: + licenseConfigurationARN: + type: string + type: object + type: array + metadataOptions: + description: The metadata options for the instance. + properties: + httpEndpoint: + type: string + httpProtocolIPv6: + type: string + httpPutResponseHopLimit: + format: int64 + type: integer + httpTokens: + type: string + state: + type: string + type: object + monitoring: + description: Describes the monitoring of an instance. + properties: + state: + type: string + type: object + networkInterfaces: + items: + description: Describes a network interface. + properties: + association: + description: Describes association information for an + Elastic IP address (IPv4). + properties: + carrierIP: + type: string + customerOwnedIP: + type: string + ipOwnerID: + type: string + publicDNSName: + type: string + publicIP: + type: string + type: object + attachment: + description: Describes a network interface attachment. + properties: + attachTime: + format: date-time + type: string + attachmentID: + type: string + deleteOnTermination: + type: boolean + deviceIndex: + format: int64 + type: integer + networkCardIndex: + format: int64 + type: integer + status: + type: string + type: object + description: + type: string + groups: + items: + description: Describes a security group. + properties: + groupID: + type: string + groupName: + type: string + type: object + type: array + interfaceType: + type: string + ipv4Prefixes: + items: + description: Information about an IPv4 prefix. + properties: + ipv4Prefix: + type: string + type: object + type: array + ipv6Addresses: + items: + description: Describes an IPv6 address. + properties: + ipv6Address: + type: string + type: object + type: array + ipv6Prefixes: + items: + description: Information about an IPv6 prefix. + properties: + ipv6Prefix: + type: string + type: object + type: array + macAddress: + type: string + networkInterfaceID: + type: string + ownerID: + type: string + privateDNSName: + type: string + privateIPAddress: + type: string + privateIPAddresses: + items: + description: Describes a private IPv4 address. + properties: + association: + description: Describes association information for + an Elastic IP address (IPv4). + properties: + carrierIP: + type: string + customerOwnedIP: + type: string + ipOwnerID: + type: string + publicDNSName: + type: string + publicIP: + type: string + type: object + primary: + type: boolean + privateDNSName: + type: string + privateIPAddress: + type: string + type: object + type: array + sourceDestCheck: + type: boolean + status: + type: string + subnetID: + type: string + vpcID: + type: string + type: object + type: array + outpostARN: + type: string + placement: + description: Describes the placement of an instance. + properties: + affinity: + type: string + availabilityZone: + type: string + groupName: + type: string + hostID: + type: string + hostResourceGroupARN: + type: string + partitionNumber: + format: int64 + type: integer + spreadDomain: + type: string + tenancy: + type: string + type: object + platform: + type: string + platformDetails: + type: string + privateDNSName: + type: string + privateIPAddress: + type: string + productCodes: + items: + description: Describes a product code. + properties: + productCodeID: + type: string + productCodeType: + type: string + type: object + type: array + publicDNSName: + type: string + publicIPAddress: + type: string + ramDiskID: + type: string + rootDeviceName: + type: string + rootDeviceType: + type: string + securityGroups: + items: + description: Describes a security group. + properties: + groupID: + type: string + groupName: + type: string + type: object + type: array + sourceDestCheck: + type: boolean + spotInstanceRequestID: + type: string + sriovNetSupport: + type: string + state: + description: Describes the current state of an instance. + properties: + code: + format: int64 + type: integer + name: + type: string + type: object + stateReason: + description: Describes a state change. + properties: + code: + type: string + message: + type: string + type: object + stateTransitionReason: + type: string + subnetID: + type: string + tags: + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array + usageOperation: + type: string + usageOperationUpdateTime: + format: date-time + type: string + virtualizationType: + type: string + vpcID: + type: string + type: object + type: array + ownerID: + description: The ID of the Amazon Web Services account that owns the + reservation. + type: string + requesterID: + description: The ID of the requester that launched the instances on + your behalf (for example, Amazon Web Services Management Console + or Auto Scaling). + type: string + reservationID: + description: The ID of the reservation. + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index d2265c7d..6f613044 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -7,6 +7,7 @@ resources: - bases/ec2.services.k8s.aws_elasticipaddresses.yaml - bases/ec2.services.k8s.aws_internetgateways.yaml - bases/ec2.services.k8s.aws_natgateways.yaml + - bases/ec2.services.k8s.aws_reservations.yaml - bases/ec2.services.k8s.aws_routetables.yaml - bases/ec2.services.k8s.aws_securitygroups.yaml - bases/ec2.services.k8s.aws_subnets.yaml diff --git a/config/rbac/cluster-role-controller.yaml b/config/rbac/cluster-role-controller.yaml index 4dede92d..548b5c6b 100644 --- a/config/rbac/cluster-role-controller.yaml +++ b/config/rbac/cluster-role-controller.yaml @@ -112,6 +112,26 @@ rules: - get - patch - update +- apiGroups: + - ec2.services.k8s.aws + resources: + - reservations + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - reservations/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 244de4ce..17f7323b 100644 --- a/config/rbac/role-reader.yaml +++ b/config/rbac/role-reader.yaml @@ -13,6 +13,7 @@ rules: - elasticipaddresses - internetgateways - natgateways + - reservations - routetables - securitygroups - subnets diff --git a/config/rbac/role-writer.yaml b/config/rbac/role-writer.yaml index 992a763a..d6854353 100644 --- a/config/rbac/role-writer.yaml +++ b/config/rbac/role-writer.yaml @@ -13,6 +13,7 @@ rules: - elasticipaddresses - internetgateways - natgateways + - reservations - routetables - securitygroups - subnets @@ -34,6 +35,7 @@ rules: - elasticipaddresses - internetgateways - natgateways + - reservations - routetables - securitygroups - subnets diff --git a/generator.yaml b/generator.yaml index 6dde027f..401f985a 100644 --- a/generator.yaml +++ b/generator.yaml @@ -23,6 +23,8 @@ ignore: # support EC2-VPC only - AllocateAddressInput.Domain - AllocateAddressOutput.Domain + - RunInstancesInput.ClientToken + - RunInstancesInput.DryRun resource_names: - AccountAttribute - CapacityReservation @@ -38,7 +40,7 @@ ignore: - Fleet - FpgaImage - Image - - Instance + #- Instance - InstanceEventWindow - InstanceExportTask #- InternetGateway @@ -56,6 +58,7 @@ ignore: - NetworkInterface - PlacementGroup - ReplaceRootVolumeTask + #- Reservation - ReservedInstancesListing - RestoreImageTask #- RouteTable @@ -111,6 +114,18 @@ operations: operation_type: - Delete resource_name: VpcEndpoint + RunInstances: + operation_type: + - Create + resource_name: Reservation + DescribeInstances: + operation_type: + - List + resource_name: Reservation + TerminateInstances: + operation_type: + - Delete + resource_name: Reservation resources: DhcpOptions: fields: @@ -224,6 +239,15 @@ resources: - path: Status.State in: - available + Reservation: + fields: + ReservationId: + is_primary_key: true + hooks: + sdk_delete_post_build_request: + template_path: hooks/reservation/sdk_delete_post_build_request.go.tpl + sdk_read_many_post_build_request: + template_path: hooks/reservation/sdk_read_many_post_build_request.go.tpl SecurityGroup: fields: # support EC2-VPC only diff --git a/helm/crds/ec2.services.k8s.aws_reservations.yaml b/helm/crds/ec2.services.k8s.aws_reservations.yaml new file mode 100644 index 00000000..4796a34b --- /dev/null +++ b/helm/crds/ec2.services.k8s.aws_reservations.yaml @@ -0,0 +1,1039 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.7.0 + creationTimestamp: null + name: reservations.ec2.services.k8s.aws +spec: + group: ec2.services.k8s.aws + names: + kind: Reservation + listKind: ReservationList + plural: reservations + singular: reservation + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Reservation is the Schema for the Reservations 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: "ReservationSpec defines the desired state of Reservation. + \n Describes a launch request for one or more instances, and includes + owner, requester, and security group information that applies to all + instances in the launch request." + properties: + additionalInfo: + description: Reserved. + type: string + blockDeviceMappings: + description: The block device mapping, which defines the EBS volumes + and instance store volumes to attach to the instance at launch. + For more information, see Block device mappings (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) + in the Amazon EC2 User Guide. + items: + description: Describes a block device mapping, which defines the + EBS volumes and instance store volumes to attach to an instance + at launch. + properties: + deviceName: + type: string + ebs: + description: Describes a block device for an EBS volume. + properties: + deleteOnTermination: + type: boolean + encrypted: + type: boolean + iops: + format: int64 + type: integer + kmsKeyID: + type: string + outpostARN: + type: string + snapshotID: + type: string + throughput: + format: int64 + type: integer + volumeSize: + format: int64 + type: integer + volumeType: + type: string + type: object + noDevice: + type: string + virtualName: + type: string + type: object + type: array + capacityReservationSpecification: + description: Information about the Capacity Reservation targeting + option. If you do not specify this parameter, the instance's Capacity + Reservation preference defaults to open, which enables it to run + in any open Capacity Reservation that has matching attributes (instance + type, platform, Availability Zone). + properties: + capacityReservationPreference: + type: string + capacityReservationTarget: + description: Describes a target Capacity Reservation or Capacity + Reservation group. + properties: + capacityReservationID: + type: string + capacityReservationResourceGroupARN: + type: string + type: object + type: object + cpuOptions: + description: The CPU options for the instance. For more information, + see Optimizing CPU options (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) + in the Amazon EC2 User Guide. + properties: + coreCount: + format: int64 + type: integer + threadsPerCore: + format: int64 + type: integer + type: object + creditSpecification: + description: "The credit option for CPU usage of the burstable performance + instance. Valid values are standard and unlimited. To change this + attribute after launch, use ModifyInstanceCreditSpecification (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceCreditSpecification.html). + For more information, see Burstable performance instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) + in the Amazon EC2 User Guide. \n Default: standard (T2 instances) + or unlimited (T3/T3a instances) \n For T3 instances with host tenancy, + only standard is supported." + properties: + cpuCredits: + type: string + type: object + disableAPITermination: + description: "If you set this parameter to true, you can't terminate + the instance using the Amazon EC2 console, CLI, or API; otherwise, + you can. To change this attribute after launch, use ModifyInstanceAttribute + (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html). + Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, + you can terminate the instance by running the shutdown command from + the instance. \n Default: false" + type: boolean + ebsOptimized: + description: "Indicates whether the instance is optimized for Amazon + EBS I/O. This optimization provides dedicated throughput to Amazon + EBS and an optimized configuration stack to provide optimal Amazon + EBS I/O performance. This optimization isn't available with all + instance types. Additional usage charges apply when using an EBS-optimized + instance. \n Default: false" + type: boolean + elasticGPUSpecification: + description: An elastic GPU to associate with the instance. An Elastic + GPU is a GPU resource that you can attach to your Windows instance + to accelerate the graphics performance of your applications. For + more information, see Amazon EC2 Elastic GPUs (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html) + in the Amazon EC2 User Guide. + items: + description: A specification for an Elastic Graphics accelerator. + properties: + type_: + type: string + type: object + type: array + elasticInferenceAccelerators: + description: "An elastic inference accelerator to associate with the + instance. Elastic inference accelerators are a resource you can + attach to your Amazon EC2 instances to accelerate your Deep Learning + (DL) inference workloads. \n You cannot specify accelerators from + different generations in the same request." + items: + description: Describes an elastic inference accelerator. + properties: + count: + format: int64 + type: integer + type_: + type: string + type: object + type: array + enclaveOptions: + description: "Indicates whether the instance is enabled for Amazon + Web Services Nitro Enclaves. For more information, see What is Amazon + Web Services Nitro Enclaves? (https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html) + in the Amazon Web Services Nitro Enclaves User Guide. \n You can't + enable Amazon Web Services Nitro Enclaves and hibernation on the + same instance." + properties: + enabled: + type: boolean + type: object + hibernationOptions: + description: "Indicates whether an instance is enabled for hibernation. + For more information, see Hibernate your instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + in the Amazon EC2 User Guide. \n You can't enable hibernation and + Amazon Web Services Nitro Enclaves on the same instance." + properties: + configured: + type: boolean + type: object + iamInstanceProfile: + description: The name or Amazon Resource Name (ARN) of an IAM instance + profile. + properties: + arn: + type: string + name: + type: string + type: object + imageID: + description: The ID of the AMI. An AMI ID is required to launch an + instance and must be specified here or in a launch template. + type: string + instanceInitiatedShutdownBehavior: + description: "Indicates whether an instance stops or terminates when + you initiate shutdown from the instance (using the operating system + command for system shutdown). \n Default: stop" + type: string + instanceMarketOptions: + description: "The market (purchasing) option for the instances. \n + For RunInstances, persistent Spot Instance requests are only supported + when InstanceInterruptionBehavior is set to either hibernate or + stop." + properties: + marketType: + type: string + spotOptions: + description: The options for Spot Instances. + properties: + blockDurationMinutes: + format: int64 + type: integer + instanceInterruptionBehavior: + type: string + maxPrice: + type: string + spotInstanceType: + type: string + validUntil: + format: date-time + type: string + type: object + type: object + instanceType: + description: "The instance type. For more information, see Instance + types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + in the Amazon EC2 User Guide. \n Default: m1.small" + type: string + ipv6AddressCount: + description: "[EC2-VPC] The number of IPv6 addresses to associate + with the primary network interface. Amazon EC2 chooses the IPv6 + addresses from the range of your subnet. You cannot specify this + option and the option to assign specific IPv6 addresses in the same + request. You can specify this option if you've specified a minimum + number of instances to launch. \n You cannot specify this option + and the network interfaces option in the same request." + format: int64 + type: integer + ipv6Addresses: + description: "[EC2-VPC] The IPv6 addresses from the range of the subnet + to associate with the primary network interface. You cannot specify + this option and the option to assign a number of IPv6 addresses + in the same request. You cannot specify this option if you've specified + a minimum number of instances to launch. \n You cannot specify this + option and the network interfaces option in the same request." + items: + description: Describes an IPv6 address. + properties: + ipv6Address: + type: string + type: object + type: array + kernelID: + description: "The ID of the kernel. \n We recommend that you use PV-GRUB + instead of kernels and RAM disks. For more information, see PV-GRUB + (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + in the Amazon EC2 User Guide." + type: string + keyName: + description: "The name of the key pair. You can create a key pair + using CreateKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html) + or ImportKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html). + \n If you do not specify a key pair, you can't connect to the instance + unless you choose an AMI that is configured to allow users another + way to log in." + type: string + launchTemplate: + description: The launch template to use to launch the instances. Any + parameters that you specify in RunInstances override the same parameters + in the launch template. You can specify either the name or ID of + a launch template, but not both. + properties: + launchTemplateID: + type: string + launchTemplateName: + type: string + version: + type: string + type: object + licenseSpecifications: + description: The license configurations. + items: + description: Describes a license configuration. + properties: + licenseConfigurationARN: + type: string + type: object + type: array + maxCount: + description: "The maximum number of instances to launch. If you specify + more instances than Amazon EC2 can launch in the target Availability + Zone, Amazon EC2 launches the largest possible number of instances + above MinCount. \n Constraints: Between 1 and the maximum number + you're allowed for the specified instance type. For more information + about the default limits, and how to request an increase, see How + many instances can I run in Amazon EC2 (http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2) + in the Amazon EC2 FAQ." + format: int64 + type: integer + metadataOptions: + description: 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). + properties: + httpEndpoint: + type: string + httpProtocolIPv6: + type: string + httpPutResponseHopLimit: + format: int64 + type: integer + httpTokens: + type: string + type: object + minCount: + description: "The minimum number of instances to launch. If you specify + a minimum that is more instances than Amazon EC2 can launch in the + target Availability Zone, Amazon EC2 launches no instances. \n Constraints: + Between 1 and the maximum number you're allowed for the specified + instance type. For more information about the default limits, and + how to request an increase, see How many instances can I run in + Amazon EC2 (http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2) + in the Amazon EC2 General FAQ." + format: int64 + type: integer + monitoring: + description: Specifies whether detailed monitoring is enabled for + the instance. + properties: + enabled: + type: boolean + type: object + networkInterfaces: + description: The network interfaces to associate with the instance. + If you specify a network interface, you must specify any security + groups and subnets as part of the network interface. + items: + description: Describes a network interface. + properties: + associateCarrierIPAddress: + type: boolean + associatePublicIPAddress: + type: boolean + deleteOnTermination: + type: boolean + description: + type: string + deviceIndex: + format: int64 + type: integer + groups: + items: + type: string + type: array + interfaceType: + type: string + ipv4PrefixCount: + format: int64 + type: integer + ipv4Prefixes: + items: + description: Describes the IPv4 prefix option for a network + interface. + properties: + ipv4Prefix: + type: string + type: object + type: array + ipv6AddressCount: + format: int64 + type: integer + ipv6Addresses: + items: + description: Describes an IPv6 address. + properties: + ipv6Address: + type: string + type: object + type: array + ipv6PrefixCount: + format: int64 + type: integer + ipv6Prefixes: + items: + description: Describes the IPv4 prefix option for a network + interface. + properties: + ipv6Prefix: + type: string + type: object + type: array + networkCardIndex: + format: int64 + type: integer + networkInterfaceID: + type: string + privateIPAddress: + type: string + privateIPAddresses: + items: + description: Describes a secondary private IPv4 address for + a network interface. + properties: + primary: + type: boolean + privateIPAddress: + type: string + type: object + type: array + secondaryPrivateIPAddressCount: + format: int64 + type: integer + subnetID: + type: string + type: object + type: array + placement: + description: The placement for the instance. + properties: + affinity: + type: string + availabilityZone: + type: string + groupName: + type: string + hostID: + type: string + hostResourceGroupARN: + type: string + partitionNumber: + format: int64 + type: integer + spreadDomain: + type: string + tenancy: + type: string + type: object + privateIPAddress: + description: "[EC2-VPC] The primary IPv4 address. You must specify + a value from the IPv4 address range of the subnet. \n Only one private + IP address can be designated as primary. You can't specify this + option if you've specified the option to designate a private IP + address as the primary IP address in a network interface specification. + You cannot specify this option if you're launching more than one + instance in the request. \n You cannot specify this option and the + network interfaces option in the same request." + type: string + ramDiskID: + description: "The ID of the RAM disk to select. Some kernels require + additional drivers at launch. Check the kernel requirements for + information about whether you need to specify a RAM disk. To find + kernel requirements, go to the Amazon Web Services Resource Center + and search for the kernel ID. \n We recommend that you use PV-GRUB + instead of kernels and RAM disks. For more information, see PV-GRUB + (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + in the Amazon EC2 User Guide." + type: string + securityGroupIDs: + description: "The IDs of the security groups. You can create a security + group using CreateSecurityGroup (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html). + \n If you specify a network interface, you must specify any security + groups as part of the network interface." + items: + type: string + type: array + securityGroups: + description: "[EC2-Classic, default VPC] The names of the security + groups. For a nondefault VPC, you must use security group IDs instead. + \n If you specify a network interface, you must specify any security + groups as part of the network interface. \n Default: Amazon EC2 + uses the default security group." + items: + type: string + type: array + subnetID: + description: "[EC2-VPC] The ID of the subnet to launch the instance + into. \n If you specify a network interface, you must specify any + subnets as part of the network interface." + type: string + tagSpecifications: + description: The tags to apply to the resources during launch. You + can only tag instances and volumes on launch. The specified tags + are applied to all instances or volumes that are created during + launch. To tag a resource after it has been created, see CreateTags + (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html). + 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 + userData: + description: The user data to make available to the instance. For + more information, see Running commands on your Linux instance at + launch (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) + (Linux) and Adding User Data (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) + (Windows). If you are using a command line tool, base64-encoding + is performed for you, and you can load the text from a file. Otherwise, + you must provide base64-encoded text. User data is limited to 16 + KB. + type: string + required: + - maxCount + - minCount + type: object + status: + description: ReservationStatus defines the observed state of Reservation + 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 + region: + description: Region is the AWS region in which the resource exists + or will exist. + type: string + required: + - ownerAccountID + - region + type: object + conditions: + description: All CRS managed by ACK have a common `Status.Conditions` + member that contains a collection of `ackv1alpha1.Condition` objects + that describe the various terminal states of the CR and its backend + AWS service API resource + items: + description: Condition is the common struct used by all CRDs managed + by ACK service controllers to indicate terminal states of the + CR and its backend AWS service API resource + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type is the type of the Condition + type: string + required: + - status + - type + type: object + type: array + groups: + description: '[EC2-Classic only] The security groups.' + items: + description: Describes a security group. + properties: + groupID: + type: string + groupName: + type: string + type: object + type: array + instances: + description: The instances. + items: + description: Describes an instance. + properties: + amiLaunchIndex: + format: int64 + type: integer + architecture: + type: string + blockDeviceMappings: + items: + description: Describes a block device mapping. + properties: + deviceName: + type: string + ebs: + description: Describes a parameter used to set up an EBS + volume in a block device mapping. + properties: + attachTime: + format: date-time + type: string + deleteOnTermination: + type: boolean + status: + type: string + volumeID: + type: string + type: object + type: object + type: array + bootMode: + type: string + capacityReservationID: + type: string + capacityReservationSpecification: + description: Describes the instance's Capacity Reservation targeting + preferences. The action returns the capacityReservationPreference + response element if the instance is configured to run in On-Demand + capacity, or if it is configured in run in any open Capacity + Reservation that has matching attributes (instance type, platform, + Availability Zone). The action returns the capacityReservationTarget + response element if the instance explicily targets a specific + Capacity Reservation or Capacity Reservation group. + properties: + capacityReservationPreference: + type: string + capacityReservationTarget: + description: Describes a target Capacity Reservation or + Capacity Reservation group. + properties: + capacityReservationID: + type: string + capacityReservationResourceGroupARN: + type: string + type: object + type: object + clientToken: + type: string + cpuOptions: + description: The CPU options for the instance. + properties: + coreCount: + format: int64 + type: integer + threadsPerCore: + format: int64 + type: integer + type: object + ebsOptimized: + type: boolean + elasticGPUAssociations: + items: + description: Describes the association between an instance + and an Elastic Graphics accelerator. + properties: + elasticGPUAssociationID: + type: string + elasticGPUAssociationState: + type: string + elasticGPUAssociationTime: + type: string + elasticGPUID: + type: string + type: object + type: array + elasticInferenceAcceleratorAssociations: + items: + description: Describes the association between an instance + and an elastic inference accelerator. + properties: + elasticInferenceAcceleratorARN: + type: string + elasticInferenceAcceleratorAssociationID: + type: string + elasticInferenceAcceleratorAssociationState: + type: string + elasticInferenceAcceleratorAssociationTime: + format: date-time + type: string + type: object + type: array + enaSupport: + type: boolean + enclaveOptions: + description: Indicates whether the instance is enabled for Amazon + Web Services Nitro Enclaves. + properties: + enabled: + type: boolean + type: object + hibernationOptions: + description: Indicates whether your instance is configured for + hibernation. This parameter is valid only if the instance + meets the hibernation prerequisites (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). + For more information, see Hibernate your instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + in the Amazon EC2 User Guide. + properties: + configured: + type: boolean + type: object + hypervisor: + type: string + iamInstanceProfile: + description: Describes an IAM instance profile. + properties: + arn: + type: string + id: + type: string + type: object + imageID: + type: string + instanceID: + type: string + instanceLifecycle: + type: string + instanceType: + type: string + kernelID: + type: string + keyName: + type: string + launchTime: + format: date-time + type: string + licenses: + items: + description: Describes a license configuration. + properties: + licenseConfigurationARN: + type: string + type: object + type: array + metadataOptions: + description: The metadata options for the instance. + properties: + httpEndpoint: + type: string + httpProtocolIPv6: + type: string + httpPutResponseHopLimit: + format: int64 + type: integer + httpTokens: + type: string + state: + type: string + type: object + monitoring: + description: Describes the monitoring of an instance. + properties: + state: + type: string + type: object + networkInterfaces: + items: + description: Describes a network interface. + properties: + association: + description: Describes association information for an + Elastic IP address (IPv4). + properties: + carrierIP: + type: string + customerOwnedIP: + type: string + ipOwnerID: + type: string + publicDNSName: + type: string + publicIP: + type: string + type: object + attachment: + description: Describes a network interface attachment. + properties: + attachTime: + format: date-time + type: string + attachmentID: + type: string + deleteOnTermination: + type: boolean + deviceIndex: + format: int64 + type: integer + networkCardIndex: + format: int64 + type: integer + status: + type: string + type: object + description: + type: string + groups: + items: + description: Describes a security group. + properties: + groupID: + type: string + groupName: + type: string + type: object + type: array + interfaceType: + type: string + ipv4Prefixes: + items: + description: Information about an IPv4 prefix. + properties: + ipv4Prefix: + type: string + type: object + type: array + ipv6Addresses: + items: + description: Describes an IPv6 address. + properties: + ipv6Address: + type: string + type: object + type: array + ipv6Prefixes: + items: + description: Information about an IPv6 prefix. + properties: + ipv6Prefix: + type: string + type: object + type: array + macAddress: + type: string + networkInterfaceID: + type: string + ownerID: + type: string + privateDNSName: + type: string + privateIPAddress: + type: string + privateIPAddresses: + items: + description: Describes a private IPv4 address. + properties: + association: + description: Describes association information for + an Elastic IP address (IPv4). + properties: + carrierIP: + type: string + customerOwnedIP: + type: string + ipOwnerID: + type: string + publicDNSName: + type: string + publicIP: + type: string + type: object + primary: + type: boolean + privateDNSName: + type: string + privateIPAddress: + type: string + type: object + type: array + sourceDestCheck: + type: boolean + status: + type: string + subnetID: + type: string + vpcID: + type: string + type: object + type: array + outpostARN: + type: string + placement: + description: Describes the placement of an instance. + properties: + affinity: + type: string + availabilityZone: + type: string + groupName: + type: string + hostID: + type: string + hostResourceGroupARN: + type: string + partitionNumber: + format: int64 + type: integer + spreadDomain: + type: string + tenancy: + type: string + type: object + platform: + type: string + platformDetails: + type: string + privateDNSName: + type: string + privateIPAddress: + type: string + productCodes: + items: + description: Describes a product code. + properties: + productCodeID: + type: string + productCodeType: + type: string + type: object + type: array + publicDNSName: + type: string + publicIPAddress: + type: string + ramDiskID: + type: string + rootDeviceName: + type: string + rootDeviceType: + type: string + securityGroups: + items: + description: Describes a security group. + properties: + groupID: + type: string + groupName: + type: string + type: object + type: array + sourceDestCheck: + type: boolean + spotInstanceRequestID: + type: string + sriovNetSupport: + type: string + state: + description: Describes the current state of an instance. + properties: + code: + format: int64 + type: integer + name: + type: string + type: object + stateReason: + description: Describes a state change. + properties: + code: + type: string + message: + type: string + type: object + stateTransitionReason: + type: string + subnetID: + type: string + tags: + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array + usageOperation: + type: string + usageOperationUpdateTime: + format: date-time + type: string + virtualizationType: + type: string + vpcID: + type: string + type: object + type: array + ownerID: + description: The ID of the Amazon Web Services account that owns the + reservation. + type: string + requesterID: + description: The ID of the requester that launched the instances on + your behalf (for example, Amazon Web Services Management Console + or Auto Scaling). + type: string + reservationID: + description: The ID of the reservation. + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/helm/templates/cluster-role-controller.yaml b/helm/templates/cluster-role-controller.yaml index 2ef323ce..0cd24864 100644 --- a/helm/templates/cluster-role-controller.yaml +++ b/helm/templates/cluster-role-controller.yaml @@ -118,6 +118,26 @@ rules: - get - patch - update +- apiGroups: + - ec2.services.k8s.aws + resources: + - reservations + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - reservations/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 2c7c0c7e..5a3ba2a7 100644 --- a/helm/templates/role-reader.yaml +++ b/helm/templates/role-reader.yaml @@ -13,6 +13,7 @@ rules: - elasticipaddresses - internetgateways - natgateways + - reservations - routetables - securitygroups - subnets diff --git a/helm/templates/role-writer.yaml b/helm/templates/role-writer.yaml index e48fbedf..dd47a7e3 100644 --- a/helm/templates/role-writer.yaml +++ b/helm/templates/role-writer.yaml @@ -17,6 +17,8 @@ rules: - natgateways + - reservations + - routetables - securitygroups @@ -44,6 +46,7 @@ rules: - elasticipaddresses - internetgateways - natgateways + - reservations - routetables - securitygroups - subnets diff --git a/pkg/resource/reservation/delta.go b/pkg/resource/reservation/delta.go new file mode 100644 index 00000000..88e5c1a3 --- /dev/null +++ b/pkg/resource/reservation/delta.go @@ -0,0 +1,454 @@ +// 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 reservation + +import ( + "bytes" + "reflect" + + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" +) + +// Hack to avoid import errors during build... +var ( + _ = &bytes.Buffer{} + _ = &reflect.Method{} +) + +// newResourceDelta returns a new `ackcompare.Delta` used to compare two +// resources +func newResourceDelta( + a *resource, + b *resource, +) *ackcompare.Delta { + delta := ackcompare.NewDelta() + if (a == nil && b != nil) || + (a != nil && b == nil) { + delta.Add("", a, b) + return delta + } + + if ackcompare.HasNilDifference(a.ko.Spec.AdditionalInfo, b.ko.Spec.AdditionalInfo) { + delta.Add("Spec.AdditionalInfo", a.ko.Spec.AdditionalInfo, b.ko.Spec.AdditionalInfo) + } else if a.ko.Spec.AdditionalInfo != nil && b.ko.Spec.AdditionalInfo != nil { + if *a.ko.Spec.AdditionalInfo != *b.ko.Spec.AdditionalInfo { + delta.Add("Spec.AdditionalInfo", a.ko.Spec.AdditionalInfo, b.ko.Spec.AdditionalInfo) + } + } + if !reflect.DeepEqual(a.ko.Spec.BlockDeviceMappings, b.ko.Spec.BlockDeviceMappings) { + delta.Add("Spec.BlockDeviceMappings", a.ko.Spec.BlockDeviceMappings, b.ko.Spec.BlockDeviceMappings) + } + if ackcompare.HasNilDifference(a.ko.Spec.CapacityReservationSpecification, b.ko.Spec.CapacityReservationSpecification) { + delta.Add("Spec.CapacityReservationSpecification", a.ko.Spec.CapacityReservationSpecification, b.ko.Spec.CapacityReservationSpecification) + } else if a.ko.Spec.CapacityReservationSpecification != nil && b.ko.Spec.CapacityReservationSpecification != nil { + if ackcompare.HasNilDifference(a.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference, b.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference) { + delta.Add("Spec.CapacityReservationSpecification.CapacityReservationPreference", a.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference, b.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference) + } else if a.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference != nil && b.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference != nil { + if *a.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference != *b.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference { + delta.Add("Spec.CapacityReservationSpecification.CapacityReservationPreference", a.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference, b.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget, b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget) { + delta.Add("Spec.CapacityReservationSpecification.CapacityReservationTarget", a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget, b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget) + } else if a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget != nil && b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget != nil { + if ackcompare.HasNilDifference(a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID, b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID) { + delta.Add("Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID", a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID, b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID) + } else if a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID != nil && b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID != nil { + if *a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID != *b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID { + delta.Add("Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID", a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID, b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN, b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN) { + delta.Add("Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN", a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN, b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN) + } else if a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN != nil && b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN != nil { + if *a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN != *b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN { + delta.Add("Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN", a.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN, b.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN) + } + } + } + } + if ackcompare.HasNilDifference(a.ko.Spec.CPUOptions, b.ko.Spec.CPUOptions) { + delta.Add("Spec.CPUOptions", a.ko.Spec.CPUOptions, b.ko.Spec.CPUOptions) + } else if a.ko.Spec.CPUOptions != nil && b.ko.Spec.CPUOptions != nil { + if ackcompare.HasNilDifference(a.ko.Spec.CPUOptions.CoreCount, b.ko.Spec.CPUOptions.CoreCount) { + delta.Add("Spec.CPUOptions.CoreCount", a.ko.Spec.CPUOptions.CoreCount, b.ko.Spec.CPUOptions.CoreCount) + } else if a.ko.Spec.CPUOptions.CoreCount != nil && b.ko.Spec.CPUOptions.CoreCount != nil { + if *a.ko.Spec.CPUOptions.CoreCount != *b.ko.Spec.CPUOptions.CoreCount { + delta.Add("Spec.CPUOptions.CoreCount", a.ko.Spec.CPUOptions.CoreCount, b.ko.Spec.CPUOptions.CoreCount) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.CPUOptions.ThreadsPerCore, b.ko.Spec.CPUOptions.ThreadsPerCore) { + delta.Add("Spec.CPUOptions.ThreadsPerCore", a.ko.Spec.CPUOptions.ThreadsPerCore, b.ko.Spec.CPUOptions.ThreadsPerCore) + } else if a.ko.Spec.CPUOptions.ThreadsPerCore != nil && b.ko.Spec.CPUOptions.ThreadsPerCore != nil { + if *a.ko.Spec.CPUOptions.ThreadsPerCore != *b.ko.Spec.CPUOptions.ThreadsPerCore { + delta.Add("Spec.CPUOptions.ThreadsPerCore", a.ko.Spec.CPUOptions.ThreadsPerCore, b.ko.Spec.CPUOptions.ThreadsPerCore) + } + } + } + if ackcompare.HasNilDifference(a.ko.Spec.CreditSpecification, b.ko.Spec.CreditSpecification) { + delta.Add("Spec.CreditSpecification", a.ko.Spec.CreditSpecification, b.ko.Spec.CreditSpecification) + } else if a.ko.Spec.CreditSpecification != nil && b.ko.Spec.CreditSpecification != nil { + if ackcompare.HasNilDifference(a.ko.Spec.CreditSpecification.CPUCredits, b.ko.Spec.CreditSpecification.CPUCredits) { + delta.Add("Spec.CreditSpecification.CPUCredits", a.ko.Spec.CreditSpecification.CPUCredits, b.ko.Spec.CreditSpecification.CPUCredits) + } else if a.ko.Spec.CreditSpecification.CPUCredits != nil && b.ko.Spec.CreditSpecification.CPUCredits != nil { + if *a.ko.Spec.CreditSpecification.CPUCredits != *b.ko.Spec.CreditSpecification.CPUCredits { + delta.Add("Spec.CreditSpecification.CPUCredits", a.ko.Spec.CreditSpecification.CPUCredits, b.ko.Spec.CreditSpecification.CPUCredits) + } + } + } + if ackcompare.HasNilDifference(a.ko.Spec.DisableAPITermination, b.ko.Spec.DisableAPITermination) { + delta.Add("Spec.DisableAPITermination", a.ko.Spec.DisableAPITermination, b.ko.Spec.DisableAPITermination) + } else if a.ko.Spec.DisableAPITermination != nil && b.ko.Spec.DisableAPITermination != nil { + if *a.ko.Spec.DisableAPITermination != *b.ko.Spec.DisableAPITermination { + delta.Add("Spec.DisableAPITermination", a.ko.Spec.DisableAPITermination, b.ko.Spec.DisableAPITermination) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.EBSOptimized, b.ko.Spec.EBSOptimized) { + delta.Add("Spec.EBSOptimized", a.ko.Spec.EBSOptimized, b.ko.Spec.EBSOptimized) + } else if a.ko.Spec.EBSOptimized != nil && b.ko.Spec.EBSOptimized != nil { + if *a.ko.Spec.EBSOptimized != *b.ko.Spec.EBSOptimized { + delta.Add("Spec.EBSOptimized", a.ko.Spec.EBSOptimized, b.ko.Spec.EBSOptimized) + } + } + if !reflect.DeepEqual(a.ko.Spec.ElasticGPUSpecification, b.ko.Spec.ElasticGPUSpecification) { + delta.Add("Spec.ElasticGPUSpecification", a.ko.Spec.ElasticGPUSpecification, b.ko.Spec.ElasticGPUSpecification) + } + if !reflect.DeepEqual(a.ko.Spec.ElasticInferenceAccelerators, b.ko.Spec.ElasticInferenceAccelerators) { + delta.Add("Spec.ElasticInferenceAccelerators", a.ko.Spec.ElasticInferenceAccelerators, b.ko.Spec.ElasticInferenceAccelerators) + } + if ackcompare.HasNilDifference(a.ko.Spec.EnclaveOptions, b.ko.Spec.EnclaveOptions) { + delta.Add("Spec.EnclaveOptions", a.ko.Spec.EnclaveOptions, b.ko.Spec.EnclaveOptions) + } else if a.ko.Spec.EnclaveOptions != nil && b.ko.Spec.EnclaveOptions != nil { + if ackcompare.HasNilDifference(a.ko.Spec.EnclaveOptions.Enabled, b.ko.Spec.EnclaveOptions.Enabled) { + delta.Add("Spec.EnclaveOptions.Enabled", a.ko.Spec.EnclaveOptions.Enabled, b.ko.Spec.EnclaveOptions.Enabled) + } else if a.ko.Spec.EnclaveOptions.Enabled != nil && b.ko.Spec.EnclaveOptions.Enabled != nil { + if *a.ko.Spec.EnclaveOptions.Enabled != *b.ko.Spec.EnclaveOptions.Enabled { + delta.Add("Spec.EnclaveOptions.Enabled", a.ko.Spec.EnclaveOptions.Enabled, b.ko.Spec.EnclaveOptions.Enabled) + } + } + } + if ackcompare.HasNilDifference(a.ko.Spec.HibernationOptions, b.ko.Spec.HibernationOptions) { + delta.Add("Spec.HibernationOptions", a.ko.Spec.HibernationOptions, b.ko.Spec.HibernationOptions) + } else if a.ko.Spec.HibernationOptions != nil && b.ko.Spec.HibernationOptions != nil { + if ackcompare.HasNilDifference(a.ko.Spec.HibernationOptions.Configured, b.ko.Spec.HibernationOptions.Configured) { + delta.Add("Spec.HibernationOptions.Configured", a.ko.Spec.HibernationOptions.Configured, b.ko.Spec.HibernationOptions.Configured) + } else if a.ko.Spec.HibernationOptions.Configured != nil && b.ko.Spec.HibernationOptions.Configured != nil { + if *a.ko.Spec.HibernationOptions.Configured != *b.ko.Spec.HibernationOptions.Configured { + delta.Add("Spec.HibernationOptions.Configured", a.ko.Spec.HibernationOptions.Configured, b.ko.Spec.HibernationOptions.Configured) + } + } + } + if ackcompare.HasNilDifference(a.ko.Spec.IAMInstanceProfile, b.ko.Spec.IAMInstanceProfile) { + delta.Add("Spec.IAMInstanceProfile", a.ko.Spec.IAMInstanceProfile, b.ko.Spec.IAMInstanceProfile) + } else if a.ko.Spec.IAMInstanceProfile != nil && b.ko.Spec.IAMInstanceProfile != nil { + if ackcompare.HasNilDifference(a.ko.Spec.IAMInstanceProfile.ARN, b.ko.Spec.IAMInstanceProfile.ARN) { + delta.Add("Spec.IAMInstanceProfile.ARN", a.ko.Spec.IAMInstanceProfile.ARN, b.ko.Spec.IAMInstanceProfile.ARN) + } else if a.ko.Spec.IAMInstanceProfile.ARN != nil && b.ko.Spec.IAMInstanceProfile.ARN != nil { + if *a.ko.Spec.IAMInstanceProfile.ARN != *b.ko.Spec.IAMInstanceProfile.ARN { + delta.Add("Spec.IAMInstanceProfile.ARN", a.ko.Spec.IAMInstanceProfile.ARN, b.ko.Spec.IAMInstanceProfile.ARN) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.IAMInstanceProfile.Name, b.ko.Spec.IAMInstanceProfile.Name) { + delta.Add("Spec.IAMInstanceProfile.Name", a.ko.Spec.IAMInstanceProfile.Name, b.ko.Spec.IAMInstanceProfile.Name) + } else if a.ko.Spec.IAMInstanceProfile.Name != nil && b.ko.Spec.IAMInstanceProfile.Name != nil { + if *a.ko.Spec.IAMInstanceProfile.Name != *b.ko.Spec.IAMInstanceProfile.Name { + delta.Add("Spec.IAMInstanceProfile.Name", a.ko.Spec.IAMInstanceProfile.Name, b.ko.Spec.IAMInstanceProfile.Name) + } + } + } + if ackcompare.HasNilDifference(a.ko.Spec.ImageID, b.ko.Spec.ImageID) { + delta.Add("Spec.ImageID", a.ko.Spec.ImageID, b.ko.Spec.ImageID) + } else if a.ko.Spec.ImageID != nil && b.ko.Spec.ImageID != nil { + if *a.ko.Spec.ImageID != *b.ko.Spec.ImageID { + delta.Add("Spec.ImageID", a.ko.Spec.ImageID, b.ko.Spec.ImageID) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.InstanceInitiatedShutdownBehavior, b.ko.Spec.InstanceInitiatedShutdownBehavior) { + delta.Add("Spec.InstanceInitiatedShutdownBehavior", a.ko.Spec.InstanceInitiatedShutdownBehavior, b.ko.Spec.InstanceInitiatedShutdownBehavior) + } else if a.ko.Spec.InstanceInitiatedShutdownBehavior != nil && b.ko.Spec.InstanceInitiatedShutdownBehavior != nil { + if *a.ko.Spec.InstanceInitiatedShutdownBehavior != *b.ko.Spec.InstanceInitiatedShutdownBehavior { + delta.Add("Spec.InstanceInitiatedShutdownBehavior", a.ko.Spec.InstanceInitiatedShutdownBehavior, b.ko.Spec.InstanceInitiatedShutdownBehavior) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.InstanceMarketOptions, b.ko.Spec.InstanceMarketOptions) { + delta.Add("Spec.InstanceMarketOptions", a.ko.Spec.InstanceMarketOptions, b.ko.Spec.InstanceMarketOptions) + } else if a.ko.Spec.InstanceMarketOptions != nil && b.ko.Spec.InstanceMarketOptions != nil { + if ackcompare.HasNilDifference(a.ko.Spec.InstanceMarketOptions.MarketType, b.ko.Spec.InstanceMarketOptions.MarketType) { + delta.Add("Spec.InstanceMarketOptions.MarketType", a.ko.Spec.InstanceMarketOptions.MarketType, b.ko.Spec.InstanceMarketOptions.MarketType) + } else if a.ko.Spec.InstanceMarketOptions.MarketType != nil && b.ko.Spec.InstanceMarketOptions.MarketType != nil { + if *a.ko.Spec.InstanceMarketOptions.MarketType != *b.ko.Spec.InstanceMarketOptions.MarketType { + delta.Add("Spec.InstanceMarketOptions.MarketType", a.ko.Spec.InstanceMarketOptions.MarketType, b.ko.Spec.InstanceMarketOptions.MarketType) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.InstanceMarketOptions.SpotOptions, b.ko.Spec.InstanceMarketOptions.SpotOptions) { + delta.Add("Spec.InstanceMarketOptions.SpotOptions", a.ko.Spec.InstanceMarketOptions.SpotOptions, b.ko.Spec.InstanceMarketOptions.SpotOptions) + } else if a.ko.Spec.InstanceMarketOptions.SpotOptions != nil && b.ko.Spec.InstanceMarketOptions.SpotOptions != nil { + if ackcompare.HasNilDifference(a.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes, b.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes) { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes", a.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes, b.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes) + } else if a.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil && b.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil { + if *a.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != *b.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes", a.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes, b.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior, b.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior) { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior", a.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior, b.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior) + } else if a.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil && b.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil { + if *a.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != *b.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior", a.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior, b.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice, b.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice) { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.MaxPrice", a.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice, b.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice) + } else if a.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice != nil && b.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice != nil { + if *a.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice != *b.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.MaxPrice", a.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice, b.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType, b.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType) { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType", a.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType, b.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType) + } else if a.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil && b.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil { + if *a.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType != *b.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType", a.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType, b.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil, b.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil) { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.ValidUntil", a.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil, b.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil) + } else if a.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil != nil && b.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil != nil { + if !a.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil.Equal(b.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil) { + delta.Add("Spec.InstanceMarketOptions.SpotOptions.ValidUntil", a.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil, b.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil) + } + } + } + } + if ackcompare.HasNilDifference(a.ko.Spec.InstanceType, b.ko.Spec.InstanceType) { + delta.Add("Spec.InstanceType", a.ko.Spec.InstanceType, b.ko.Spec.InstanceType) + } else if a.ko.Spec.InstanceType != nil && b.ko.Spec.InstanceType != nil { + if *a.ko.Spec.InstanceType != *b.ko.Spec.InstanceType { + delta.Add("Spec.InstanceType", a.ko.Spec.InstanceType, b.ko.Spec.InstanceType) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.IPv6AddressCount, b.ko.Spec.IPv6AddressCount) { + delta.Add("Spec.IPv6AddressCount", a.ko.Spec.IPv6AddressCount, b.ko.Spec.IPv6AddressCount) + } else if a.ko.Spec.IPv6AddressCount != nil && b.ko.Spec.IPv6AddressCount != nil { + if *a.ko.Spec.IPv6AddressCount != *b.ko.Spec.IPv6AddressCount { + delta.Add("Spec.IPv6AddressCount", a.ko.Spec.IPv6AddressCount, b.ko.Spec.IPv6AddressCount) + } + } + if !reflect.DeepEqual(a.ko.Spec.IPv6Addresses, b.ko.Spec.IPv6Addresses) { + delta.Add("Spec.IPv6Addresses", a.ko.Spec.IPv6Addresses, b.ko.Spec.IPv6Addresses) + } + if ackcompare.HasNilDifference(a.ko.Spec.KernelID, b.ko.Spec.KernelID) { + delta.Add("Spec.KernelID", a.ko.Spec.KernelID, b.ko.Spec.KernelID) + } else if a.ko.Spec.KernelID != nil && b.ko.Spec.KernelID != nil { + if *a.ko.Spec.KernelID != *b.ko.Spec.KernelID { + delta.Add("Spec.KernelID", a.ko.Spec.KernelID, b.ko.Spec.KernelID) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.KeyName, b.ko.Spec.KeyName) { + delta.Add("Spec.KeyName", a.ko.Spec.KeyName, b.ko.Spec.KeyName) + } else if a.ko.Spec.KeyName != nil && b.ko.Spec.KeyName != nil { + if *a.ko.Spec.KeyName != *b.ko.Spec.KeyName { + delta.Add("Spec.KeyName", a.ko.Spec.KeyName, b.ko.Spec.KeyName) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.LaunchTemplate, b.ko.Spec.LaunchTemplate) { + delta.Add("Spec.LaunchTemplate", a.ko.Spec.LaunchTemplate, b.ko.Spec.LaunchTemplate) + } else if a.ko.Spec.LaunchTemplate != nil && b.ko.Spec.LaunchTemplate != nil { + if ackcompare.HasNilDifference(a.ko.Spec.LaunchTemplate.LaunchTemplateID, b.ko.Spec.LaunchTemplate.LaunchTemplateID) { + delta.Add("Spec.LaunchTemplate.LaunchTemplateID", a.ko.Spec.LaunchTemplate.LaunchTemplateID, b.ko.Spec.LaunchTemplate.LaunchTemplateID) + } else if a.ko.Spec.LaunchTemplate.LaunchTemplateID != nil && b.ko.Spec.LaunchTemplate.LaunchTemplateID != nil { + if *a.ko.Spec.LaunchTemplate.LaunchTemplateID != *b.ko.Spec.LaunchTemplate.LaunchTemplateID { + delta.Add("Spec.LaunchTemplate.LaunchTemplateID", a.ko.Spec.LaunchTemplate.LaunchTemplateID, b.ko.Spec.LaunchTemplate.LaunchTemplateID) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.LaunchTemplate.LaunchTemplateName, b.ko.Spec.LaunchTemplate.LaunchTemplateName) { + delta.Add("Spec.LaunchTemplate.LaunchTemplateName", a.ko.Spec.LaunchTemplate.LaunchTemplateName, b.ko.Spec.LaunchTemplate.LaunchTemplateName) + } else if a.ko.Spec.LaunchTemplate.LaunchTemplateName != nil && b.ko.Spec.LaunchTemplate.LaunchTemplateName != nil { + if *a.ko.Spec.LaunchTemplate.LaunchTemplateName != *b.ko.Spec.LaunchTemplate.LaunchTemplateName { + delta.Add("Spec.LaunchTemplate.LaunchTemplateName", a.ko.Spec.LaunchTemplate.LaunchTemplateName, b.ko.Spec.LaunchTemplate.LaunchTemplateName) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.LaunchTemplate.Version, b.ko.Spec.LaunchTemplate.Version) { + delta.Add("Spec.LaunchTemplate.Version", a.ko.Spec.LaunchTemplate.Version, b.ko.Spec.LaunchTemplate.Version) + } else if a.ko.Spec.LaunchTemplate.Version != nil && b.ko.Spec.LaunchTemplate.Version != nil { + if *a.ko.Spec.LaunchTemplate.Version != *b.ko.Spec.LaunchTemplate.Version { + delta.Add("Spec.LaunchTemplate.Version", a.ko.Spec.LaunchTemplate.Version, b.ko.Spec.LaunchTemplate.Version) + } + } + } + if !reflect.DeepEqual(a.ko.Spec.LicenseSpecifications, b.ko.Spec.LicenseSpecifications) { + delta.Add("Spec.LicenseSpecifications", a.ko.Spec.LicenseSpecifications, b.ko.Spec.LicenseSpecifications) + } + if ackcompare.HasNilDifference(a.ko.Spec.MaxCount, b.ko.Spec.MaxCount) { + delta.Add("Spec.MaxCount", a.ko.Spec.MaxCount, b.ko.Spec.MaxCount) + } else if a.ko.Spec.MaxCount != nil && b.ko.Spec.MaxCount != nil { + if *a.ko.Spec.MaxCount != *b.ko.Spec.MaxCount { + delta.Add("Spec.MaxCount", a.ko.Spec.MaxCount, b.ko.Spec.MaxCount) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.MetadataOptions, b.ko.Spec.MetadataOptions) { + delta.Add("Spec.MetadataOptions", a.ko.Spec.MetadataOptions, b.ko.Spec.MetadataOptions) + } else if a.ko.Spec.MetadataOptions != nil && b.ko.Spec.MetadataOptions != nil { + if ackcompare.HasNilDifference(a.ko.Spec.MetadataOptions.HTTPEndpoint, b.ko.Spec.MetadataOptions.HTTPEndpoint) { + delta.Add("Spec.MetadataOptions.HTTPEndpoint", a.ko.Spec.MetadataOptions.HTTPEndpoint, b.ko.Spec.MetadataOptions.HTTPEndpoint) + } else if a.ko.Spec.MetadataOptions.HTTPEndpoint != nil && b.ko.Spec.MetadataOptions.HTTPEndpoint != nil { + if *a.ko.Spec.MetadataOptions.HTTPEndpoint != *b.ko.Spec.MetadataOptions.HTTPEndpoint { + delta.Add("Spec.MetadataOptions.HTTPEndpoint", a.ko.Spec.MetadataOptions.HTTPEndpoint, b.ko.Spec.MetadataOptions.HTTPEndpoint) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.MetadataOptions.HTTPProtocolIPv6, b.ko.Spec.MetadataOptions.HTTPProtocolIPv6) { + delta.Add("Spec.MetadataOptions.HTTPProtocolIPv6", a.ko.Spec.MetadataOptions.HTTPProtocolIPv6, b.ko.Spec.MetadataOptions.HTTPProtocolIPv6) + } else if a.ko.Spec.MetadataOptions.HTTPProtocolIPv6 != nil && b.ko.Spec.MetadataOptions.HTTPProtocolIPv6 != nil { + if *a.ko.Spec.MetadataOptions.HTTPProtocolIPv6 != *b.ko.Spec.MetadataOptions.HTTPProtocolIPv6 { + delta.Add("Spec.MetadataOptions.HTTPProtocolIPv6", a.ko.Spec.MetadataOptions.HTTPProtocolIPv6, b.ko.Spec.MetadataOptions.HTTPProtocolIPv6) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit, b.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit) { + delta.Add("Spec.MetadataOptions.HTTPPutResponseHopLimit", a.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit, b.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit) + } else if a.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit != nil && b.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit != nil { + if *a.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit != *b.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit { + delta.Add("Spec.MetadataOptions.HTTPPutResponseHopLimit", a.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit, b.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.MetadataOptions.HTTPTokens, b.ko.Spec.MetadataOptions.HTTPTokens) { + delta.Add("Spec.MetadataOptions.HTTPTokens", a.ko.Spec.MetadataOptions.HTTPTokens, b.ko.Spec.MetadataOptions.HTTPTokens) + } else if a.ko.Spec.MetadataOptions.HTTPTokens != nil && b.ko.Spec.MetadataOptions.HTTPTokens != nil { + if *a.ko.Spec.MetadataOptions.HTTPTokens != *b.ko.Spec.MetadataOptions.HTTPTokens { + delta.Add("Spec.MetadataOptions.HTTPTokens", a.ko.Spec.MetadataOptions.HTTPTokens, b.ko.Spec.MetadataOptions.HTTPTokens) + } + } + } + if ackcompare.HasNilDifference(a.ko.Spec.MinCount, b.ko.Spec.MinCount) { + delta.Add("Spec.MinCount", a.ko.Spec.MinCount, b.ko.Spec.MinCount) + } else if a.ko.Spec.MinCount != nil && b.ko.Spec.MinCount != nil { + if *a.ko.Spec.MinCount != *b.ko.Spec.MinCount { + delta.Add("Spec.MinCount", a.ko.Spec.MinCount, b.ko.Spec.MinCount) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Monitoring, b.ko.Spec.Monitoring) { + delta.Add("Spec.Monitoring", a.ko.Spec.Monitoring, b.ko.Spec.Monitoring) + } else if a.ko.Spec.Monitoring != nil && b.ko.Spec.Monitoring != nil { + if ackcompare.HasNilDifference(a.ko.Spec.Monitoring.Enabled, b.ko.Spec.Monitoring.Enabled) { + delta.Add("Spec.Monitoring.Enabled", a.ko.Spec.Monitoring.Enabled, b.ko.Spec.Monitoring.Enabled) + } else if a.ko.Spec.Monitoring.Enabled != nil && b.ko.Spec.Monitoring.Enabled != nil { + if *a.ko.Spec.Monitoring.Enabled != *b.ko.Spec.Monitoring.Enabled { + delta.Add("Spec.Monitoring.Enabled", a.ko.Spec.Monitoring.Enabled, b.ko.Spec.Monitoring.Enabled) + } + } + } + if !reflect.DeepEqual(a.ko.Spec.NetworkInterfaces, b.ko.Spec.NetworkInterfaces) { + delta.Add("Spec.NetworkInterfaces", a.ko.Spec.NetworkInterfaces, b.ko.Spec.NetworkInterfaces) + } + if ackcompare.HasNilDifference(a.ko.Spec.Placement, b.ko.Spec.Placement) { + delta.Add("Spec.Placement", a.ko.Spec.Placement, b.ko.Spec.Placement) + } else if a.ko.Spec.Placement != nil && b.ko.Spec.Placement != nil { + if ackcompare.HasNilDifference(a.ko.Spec.Placement.Affinity, b.ko.Spec.Placement.Affinity) { + delta.Add("Spec.Placement.Affinity", a.ko.Spec.Placement.Affinity, b.ko.Spec.Placement.Affinity) + } else if a.ko.Spec.Placement.Affinity != nil && b.ko.Spec.Placement.Affinity != nil { + if *a.ko.Spec.Placement.Affinity != *b.ko.Spec.Placement.Affinity { + delta.Add("Spec.Placement.Affinity", a.ko.Spec.Placement.Affinity, b.ko.Spec.Placement.Affinity) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Placement.AvailabilityZone, b.ko.Spec.Placement.AvailabilityZone) { + delta.Add("Spec.Placement.AvailabilityZone", a.ko.Spec.Placement.AvailabilityZone, b.ko.Spec.Placement.AvailabilityZone) + } else if a.ko.Spec.Placement.AvailabilityZone != nil && b.ko.Spec.Placement.AvailabilityZone != nil { + if *a.ko.Spec.Placement.AvailabilityZone != *b.ko.Spec.Placement.AvailabilityZone { + delta.Add("Spec.Placement.AvailabilityZone", a.ko.Spec.Placement.AvailabilityZone, b.ko.Spec.Placement.AvailabilityZone) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Placement.GroupName, b.ko.Spec.Placement.GroupName) { + delta.Add("Spec.Placement.GroupName", a.ko.Spec.Placement.GroupName, b.ko.Spec.Placement.GroupName) + } else if a.ko.Spec.Placement.GroupName != nil && b.ko.Spec.Placement.GroupName != nil { + if *a.ko.Spec.Placement.GroupName != *b.ko.Spec.Placement.GroupName { + delta.Add("Spec.Placement.GroupName", a.ko.Spec.Placement.GroupName, b.ko.Spec.Placement.GroupName) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Placement.HostID, b.ko.Spec.Placement.HostID) { + delta.Add("Spec.Placement.HostID", a.ko.Spec.Placement.HostID, b.ko.Spec.Placement.HostID) + } else if a.ko.Spec.Placement.HostID != nil && b.ko.Spec.Placement.HostID != nil { + if *a.ko.Spec.Placement.HostID != *b.ko.Spec.Placement.HostID { + delta.Add("Spec.Placement.HostID", a.ko.Spec.Placement.HostID, b.ko.Spec.Placement.HostID) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Placement.HostResourceGroupARN, b.ko.Spec.Placement.HostResourceGroupARN) { + delta.Add("Spec.Placement.HostResourceGroupARN", a.ko.Spec.Placement.HostResourceGroupARN, b.ko.Spec.Placement.HostResourceGroupARN) + } else if a.ko.Spec.Placement.HostResourceGroupARN != nil && b.ko.Spec.Placement.HostResourceGroupARN != nil { + if *a.ko.Spec.Placement.HostResourceGroupARN != *b.ko.Spec.Placement.HostResourceGroupARN { + delta.Add("Spec.Placement.HostResourceGroupARN", a.ko.Spec.Placement.HostResourceGroupARN, b.ko.Spec.Placement.HostResourceGroupARN) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Placement.PartitionNumber, b.ko.Spec.Placement.PartitionNumber) { + delta.Add("Spec.Placement.PartitionNumber", a.ko.Spec.Placement.PartitionNumber, b.ko.Spec.Placement.PartitionNumber) + } else if a.ko.Spec.Placement.PartitionNumber != nil && b.ko.Spec.Placement.PartitionNumber != nil { + if *a.ko.Spec.Placement.PartitionNumber != *b.ko.Spec.Placement.PartitionNumber { + delta.Add("Spec.Placement.PartitionNumber", a.ko.Spec.Placement.PartitionNumber, b.ko.Spec.Placement.PartitionNumber) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Placement.SpreadDomain, b.ko.Spec.Placement.SpreadDomain) { + delta.Add("Spec.Placement.SpreadDomain", a.ko.Spec.Placement.SpreadDomain, b.ko.Spec.Placement.SpreadDomain) + } else if a.ko.Spec.Placement.SpreadDomain != nil && b.ko.Spec.Placement.SpreadDomain != nil { + if *a.ko.Spec.Placement.SpreadDomain != *b.ko.Spec.Placement.SpreadDomain { + delta.Add("Spec.Placement.SpreadDomain", a.ko.Spec.Placement.SpreadDomain, b.ko.Spec.Placement.SpreadDomain) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.Placement.Tenancy, b.ko.Spec.Placement.Tenancy) { + delta.Add("Spec.Placement.Tenancy", a.ko.Spec.Placement.Tenancy, b.ko.Spec.Placement.Tenancy) + } else if a.ko.Spec.Placement.Tenancy != nil && b.ko.Spec.Placement.Tenancy != nil { + if *a.ko.Spec.Placement.Tenancy != *b.ko.Spec.Placement.Tenancy { + delta.Add("Spec.Placement.Tenancy", a.ko.Spec.Placement.Tenancy, b.ko.Spec.Placement.Tenancy) + } + } + } + if ackcompare.HasNilDifference(a.ko.Spec.PrivateIPAddress, b.ko.Spec.PrivateIPAddress) { + delta.Add("Spec.PrivateIPAddress", a.ko.Spec.PrivateIPAddress, b.ko.Spec.PrivateIPAddress) + } else if a.ko.Spec.PrivateIPAddress != nil && b.ko.Spec.PrivateIPAddress != nil { + if *a.ko.Spec.PrivateIPAddress != *b.ko.Spec.PrivateIPAddress { + delta.Add("Spec.PrivateIPAddress", a.ko.Spec.PrivateIPAddress, b.ko.Spec.PrivateIPAddress) + } + } + if ackcompare.HasNilDifference(a.ko.Spec.RAMDiskID, b.ko.Spec.RAMDiskID) { + delta.Add("Spec.RAMDiskID", a.ko.Spec.RAMDiskID, b.ko.Spec.RAMDiskID) + } else if a.ko.Spec.RAMDiskID != nil && b.ko.Spec.RAMDiskID != nil { + if *a.ko.Spec.RAMDiskID != *b.ko.Spec.RAMDiskID { + delta.Add("Spec.RAMDiskID", a.ko.Spec.RAMDiskID, b.ko.Spec.RAMDiskID) + } + } + if !ackcompare.SliceStringPEqual(a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) { + delta.Add("Spec.SecurityGroupIDs", a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) + } + if !ackcompare.SliceStringPEqual(a.ko.Spec.SecurityGroups, b.ko.Spec.SecurityGroups) { + delta.Add("Spec.SecurityGroups", a.ko.Spec.SecurityGroups, b.ko.Spec.SecurityGroups) + } + if ackcompare.HasNilDifference(a.ko.Spec.SubnetID, b.ko.Spec.SubnetID) { + delta.Add("Spec.SubnetID", a.ko.Spec.SubnetID, b.ko.Spec.SubnetID) + } else if a.ko.Spec.SubnetID != nil && b.ko.Spec.SubnetID != nil { + if *a.ko.Spec.SubnetID != *b.ko.Spec.SubnetID { + delta.Add("Spec.SubnetID", a.ko.Spec.SubnetID, b.ko.Spec.SubnetID) + } + } + 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.UserData, b.ko.Spec.UserData) { + delta.Add("Spec.UserData", a.ko.Spec.UserData, b.ko.Spec.UserData) + } else if a.ko.Spec.UserData != nil && b.ko.Spec.UserData != nil { + if *a.ko.Spec.UserData != *b.ko.Spec.UserData { + delta.Add("Spec.UserData", a.ko.Spec.UserData, b.ko.Spec.UserData) + } + } + + return delta +} diff --git a/pkg/resource/reservation/descriptor.go b/pkg/resource/reservation/descriptor.go new file mode 100644 index 00000000..50058aad --- /dev/null +++ b/pkg/resource/reservation/descriptor.go @@ -0,0 +1,154 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. + +// Code generated by ack-generate. DO NOT EDIT. + +package reservation + +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" + rtclient "sigs.k8s.io/controller-runtime/pkg/client" + 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/Reservation" +) + +var ( + GroupVersionResource = svcapitypes.GroupVersion.WithResource("reservations") + GroupKind = metav1.GroupKind{ + Group: "ec2.services.k8s.aws", + Kind: "Reservation", + } +) + +// resourceDescriptor implements the +// `aws-service-operator-k8s/pkg/types.AWSResourceDescriptor` interface +type resourceDescriptor struct { +} + +// GroupKind returns a Kubernetes metav1.GroupKind struct that describes the +// API Group and Kind of CRs described by the descriptor +func (d *resourceDescriptor) GroupKind() *metav1.GroupKind { + return &GroupKind +} + +// EmptyRuntimeObject returns an empty object prototype that may be used in +// apimachinery and k8s client operations +func (d *resourceDescriptor) EmptyRuntimeObject() rtclient.Object { + return &svcapitypes.Reservation{} +} + +// ResourceFromRuntimeObject returns an AWSResource that has been initialized +// with the supplied runtime.Object +func (d *resourceDescriptor) ResourceFromRuntimeObject( + obj rtclient.Object, +) acktypes.AWSResource { + return &resource{ + ko: obj.(*svcapitypes.Reservation), + } +} + +// 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.RuntimeObject() + 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 rtclient.Object, 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.RuntimeObject() + 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.RuntimeObject() + 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.RuntimeObject() + if obj == nil { + // Should not happen. If it does, there is a bug in the code + panic("nil RuntimeObject 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/reservation/hooks.go b/pkg/resource/reservation/hooks.go new file mode 100644 index 00000000..4c530117 --- /dev/null +++ b/pkg/resource/reservation/hooks.go @@ -0,0 +1,52 @@ +// 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 reservation + +import ( + "errors" + + "github.com/aws/aws-sdk-go/aws" + svcsdk "github.com/aws/aws-sdk-go/service/ec2" +) + +// addInstanceIDsToTerminateRequest uses Reservation InstanceIDs to populate instances field in +// a TerminateInstances request. +// Return error to indicate to callers that the resource is not yet created. +func addInstanceIDsToTerminateRequest(r *resource, + input *svcsdk.TerminateInstancesInput) error { + if r.ko.Status.Instances == nil || len(r.ko.Status.Instances) <= 0 { + return errors.New("unable to extract InstanceIDs from Reservation") + } + for _, instance := range r.ko.Status.Instances { + input.InstanceIds = append(input.InstanceIds, instance.InstanceID) + } + return nil +} + +// addReservationIDToListRequest populates the Filter in a DescribeInstances request +// with the ReservationID +// Return error to indicate to callers that the resource is not yet created. +func addReservationIDToListRequest(r *resource, + input *svcsdk.DescribeInstancesInput) error { + if r.ko.Status.ReservationID == nil { + return errors.New("unable to extract ReservationID from Reservation") + } + input.Filters = []*svcsdk.Filter{ + { + Name: aws.String("reservation-id"), + Values: []*string{r.ko.Status.ReservationID}, + }, + } + return nil +} diff --git a/pkg/resource/reservation/identifiers.go b/pkg/resource/reservation/identifiers.go new file mode 100644 index 00000000..9e133a3a --- /dev/null +++ b/pkg/resource/reservation/identifiers.go @@ -0,0 +1,55 @@ +// 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 reservation + +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 +} + +// Region returns the AWS region in which the resource exists, or +// nil if this information is not known. +func (ri *resourceIdentifiers) Region() *ackv1alpha1.AWSRegion { + if ri.meta != nil { + return ri.meta.Region + } + return nil +} diff --git a/pkg/resource/reservation/manager.go b/pkg/resource/reservation/manager.go new file mode 100644 index 00000000..2e6cc8e5 --- /dev/null +++ b/pkg/resource/reservation/manager.go @@ -0,0 +1,322 @@ +// 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 reservation + +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" + ackutil "github.com/aws-controllers-k8s/runtime/pkg/util" + "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" +) + +var ( + _ = ackutil.InStrings +) + +// +kubebuilder:rbac:groups=ec2.services.k8s.aws,resources=reservations,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=ec2.services.k8s.aws,resources=reservations/status,verbs=get;update;patch + +var lateInitializeFieldNames = []string{} + +// resourceManager is responsible for providing a consistent way to perform +// CRUD operations in a backend AWS service API for Book custom resources. +type resourceManager struct { + // cfg is a copy of the ackcfg.Config object passed on start of the service + // controller + cfg ackcfg.Config + // log refers to the logr.Logger object handling logging for the service + // controller + log logr.Logger + // metrics contains a collection of Prometheus metric objects that the + // service controller and its reconcilers track + metrics *ackmetrics.Metrics + // rr is the Reconciler which can be used for various utility + // functions such as querying for Secret values given a SecretReference + rr acktypes.Reconciler + // awsAccountID is the AWS account identifier that contains the resources + // managed by this resource manager + awsAccountID ackv1alpha1.AWSAccountID + // The AWS Region that this resource manager targets + awsRegion ackv1alpha1.AWSRegion + // sess is the AWS SDK Session object used to communicate with the backend + // AWS service API + sess *session.Session + // sdk is a pointer to the AWS service API interface exposed by the + // aws-sdk-go/services/{alias}/{alias}iface package. + sdkapi svcsdkapi.EC2API +} + +// concreteResource returns a pointer to a resource from the supplied +// generic AWSResource interface +func (rm *resourceManager) concreteResource( + res acktypes.AWSResource, +) *resource { + // cast the generic interface into a pointer type specific to the concrete + // implementing resource type managed by this resource manager + return res.(*resource) +} + +// ReadOne returns the currently-observed state of the supplied AWSResource in +// the backend AWS service API. +func (rm *resourceManager) ReadOne( + ctx context.Context, + res acktypes.AWSResource, +) (acktypes.AWSResource, error) { + r := rm.concreteResource(res) + if r.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's ReadOne() method received resource with nil CR object") + } + observed, err := rm.sdkFind(ctx, r) + if err != nil { + if observed != nil { + return rm.onError(observed, err) + } + return rm.onError(r, err) + } + return rm.onSuccess(observed) +} + +// Create attempts to create the supplied AWSResource in the backend AWS +// service API, returning an AWSResource representing the newly-created +// resource +func (rm *resourceManager) Create( + ctx context.Context, + res acktypes.AWSResource, +) (acktypes.AWSResource, error) { + r := rm.concreteResource(res) + if r.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's Create() method received resource with nil CR object") + } + created, err := rm.sdkCreate(ctx, r) + if err != nil { + return rm.onError(r, err) + } + return rm.onSuccess(created) +} + +// Update attempts to mutate the supplied desired AWSResource in the backend AWS +// service API, returning an AWSResource representing the newly-mutated +// resource. +// Note for specialized logic implementers can check to see how the latest +// observed resource differs from the supplied desired state. The +// higher-level reonciler determines whether or not the desired differs +// from the latest observed and decides whether to call the resource +// manager's Update method +func (rm *resourceManager) Update( + ctx context.Context, + resDesired acktypes.AWSResource, + resLatest acktypes.AWSResource, + delta *ackcompare.Delta, +) (acktypes.AWSResource, error) { + desired := rm.concreteResource(resDesired) + latest := rm.concreteResource(resLatest) + if desired.ko == nil || latest.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's Update() method received resource with nil CR object") + } + updated, err := rm.sdkUpdate(ctx, desired, latest, delta) + if err != nil { + return rm.onError(latest, err) + } + return rm.onSuccess(updated) +} + +// Delete attempts to destroy the supplied AWSResource in the backend AWS +// service API, returning an AWSResource representing the +// resource being deleted (if delete is asynchronous and takes time) +func (rm *resourceManager) Delete( + ctx context.Context, + res acktypes.AWSResource, +) (acktypes.AWSResource, error) { + r := rm.concreteResource(res) + if r.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's Update() method received resource with nil CR object") + } + observed, err := rm.sdkDelete(ctx, r) + if err != nil { + if observed != nil { + return rm.onError(observed, err) + } + return rm.onError(r, err) + } + + return rm.onSuccess(observed) +} + +// ARNFromName returns an AWS Resource Name from a given string name. This +// is useful for constructing ARNs for APIs that require ARNs in their +// GetAttributes operations but all we have (for new CRs at least) is a +// name for the resource +func (rm *resourceManager) ARNFromName(name string) string { + return fmt.Sprintf( + "arn:aws:ec2:%s:%s:%s", + rm.awsRegion, + rm.awsAccountID, + name, + ) +} + +// LateInitialize returns an acktypes.AWSResource after setting the late initialized +// fields from the readOne call. This method will initialize the optional fields +// which were not provided by the k8s user but were defaulted by the AWS service. +// If there are no such fields to be initialized, the returned object is similar to +// object passed in the parameter. +func (rm *resourceManager) LateInitialize( + ctx context.Context, + latest acktypes.AWSResource, +) (acktypes.AWSResource, error) { + rlog := ackrtlog.FromContext(ctx) + // If there are no fields to late initialize, do nothing + if len(lateInitializeFieldNames) == 0 { + rlog.Debug("no late initialization required.") + return latest, nil + } + latestCopy := latest.DeepCopy() + lateInitConditionReason := "" + lateInitConditionMessage := "" + observed, err := rm.ReadOne(ctx, latestCopy) + if err != nil { + lateInitConditionMessage = "Unable to complete Read operation required for late initialization" + lateInitConditionReason = "Late Initialization Failure" + ackcondition.SetLateInitialized(latestCopy, corev1.ConditionFalse, &lateInitConditionMessage, &lateInitConditionReason) + ackcondition.SetSynced(latestCopy, corev1.ConditionFalse, nil, nil) + return latestCopy, err + } + lateInitializedRes := rm.lateInitializeFromReadOneOutput(observed, latestCopy) + incompleteInitialization := rm.incompleteLateInitialization(lateInitializedRes) + if incompleteInitialization { + // Add the condition with LateInitialized=False + lateInitConditionMessage = "Late initialization did not complete, requeuing with delay of 5 seconds" + lateInitConditionReason = "Delayed Late Initialization" + ackcondition.SetLateInitialized(lateInitializedRes, corev1.ConditionFalse, &lateInitConditionMessage, &lateInitConditionReason) + ackcondition.SetSynced(lateInitializedRes, corev1.ConditionFalse, nil, nil) + return lateInitializedRes, ackrequeue.NeededAfter(nil, time.Duration(5)*time.Second) + } + // Set LateInitialized condition to True + lateInitConditionMessage = "Late initialization successful" + lateInitConditionReason = "Late initialization successful" + ackcondition.SetLateInitialized(lateInitializedRes, corev1.ConditionTrue, &lateInitConditionMessage, &lateInitConditionReason) + return lateInitializedRes, nil +} + +// incompleteLateInitialization return true if there are fields which were supposed to be +// late initialized but are not. If all the fields are late initialized, false is returned +func (rm *resourceManager) incompleteLateInitialization( + res acktypes.AWSResource, +) bool { + return false +} + +// lateInitializeFromReadOneOutput late initializes the 'latest' resource from the 'observed' +// resource and returns 'latest' resource +func (rm *resourceManager) lateInitializeFromReadOneOutput( + observed acktypes.AWSResource, + latest acktypes.AWSResource, +) acktypes.AWSResource { + return latest +} + +// IsSynced returns true if the resource is synced. +func (rm *resourceManager) IsSynced(ctx context.Context, res acktypes.AWSResource) (bool, error) { + r := rm.concreteResource(res) + if r.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's IsSynced() method received resource with nil CR object") + } + + return true, nil +} + +// newResourceManager returns a new struct implementing +// acktypes.AWSResourceManager +func newResourceManager( + cfg ackcfg.Config, + log logr.Logger, + metrics *ackmetrics.Metrics, + rr acktypes.Reconciler, + sess *session.Session, + id ackv1alpha1.AWSAccountID, + region ackv1alpha1.AWSRegion, +) (*resourceManager, error) { + return &resourceManager{ + cfg: cfg, + log: log, + metrics: metrics, + rr: rr, + awsAccountID: id, + awsRegion: region, + sess: sess, + sdkapi: svcsdk.New(sess), + }, nil +} + +// onError updates resource conditions and returns updated resource +// it returns nil if no condition is updated. +func (rm *resourceManager) onError( + r *resource, + err error, +) (acktypes.AWSResource, error) { + if r == nil { + return nil, err + } + r1, updated := rm.updateConditions(r, false, err) + if !updated { + return r, err + } + for _, condition := range r1.Conditions() { + if condition.Type == ackv1alpha1.ConditionTypeTerminal && + condition.Status == corev1.ConditionTrue { + // resource is in Terminal condition + // return Terminal error + return r1, ackerr.Terminal + } + } + return r1, err +} + +// onSuccess updates resource conditions and returns updated resource +// it returns the supplied resource if no condition is updated. +func (rm *resourceManager) onSuccess( + r *resource, +) (acktypes.AWSResource, error) { + if r == nil { + return nil, nil + } + r1, updated := rm.updateConditions(r, true, nil) + if !updated { + return r, nil + } + return r1, nil +} diff --git a/pkg/resource/reservation/manager_factory.go b/pkg/resource/reservation/manager_factory.go new file mode 100644 index 00000000..7028ecee --- /dev/null +++ b/pkg/resource/reservation/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 reservation + +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/reservation/references.go b/pkg/resource/reservation/references.go new file mode 100644 index 00000000..1a071cf3 --- /dev/null +++ b/pkg/resource/reservation/references.go @@ -0,0 +1,52 @@ +// 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 reservation + +import ( + "context" + "sigs.k8s.io/controller-runtime/pkg/client" + + acktypes "github.com/aws-controllers-k8s/runtime/pkg/types" + + svcapitypes "github.com/aws-controllers-k8s/ec2-controller/apis/v1alpha1" +) + +// ResolveReferences finds if there are any Reference field(s) present +// inside AWSResource passed in the parameter and attempts to resolve +// those reference field(s) into target field(s). +// It returns an AWSResource with resolved reference(s), and an error if the +// passed AWSResource's reference field(s) cannot be resolved. +// This method also adds/updates the ConditionTypeReferencesResolved for the +// AWSResource. +func (rm *resourceManager) ResolveReferences( + ctx context.Context, + apiReader client.Reader, + res acktypes.AWSResource, +) (acktypes.AWSResource, error) { + return res, nil +} + +// validateReferenceFields validates the reference field and corresponding +// identifier field. +func validateReferenceFields(ko *svcapitypes.Reservation) error { + return nil +} + +// hasNonNilReferences returns true if resource contains a reference to another +// resource +func hasNonNilReferences(ko *svcapitypes.Reservation) bool { + return false +} diff --git a/pkg/resource/reservation/resource.go b/pkg/resource/reservation/resource.go new file mode 100644 index 00000000..7fc26c94 --- /dev/null +++ b/pkg/resource/reservation/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 reservation + +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" + rtclient "sigs.k8s.io/controller-runtime/pkg/client" + + 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.Reservation +} + +// 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() rtclient.Object { + return r.ko +} + +// MetaObject returns the Kubernetes apimachinery/apis/meta/v1.Object +// representation of the AWSResource +func (r *resource) MetaObject() metav1.Object { + return r.ko.GetObjectMeta() +} + +// Conditions returns the ACK Conditions collection for the AWSResource +func (r *resource) Conditions() []*ackv1alpha1.Condition { + return r.ko.Status.Conditions +} + +// ReplaceConditions sets the Conditions status field for the resource +func (r *resource) ReplaceConditions(conditions []*ackv1alpha1.Condition) { + r.ko.Status.Conditions = conditions +} + +// SetObjectMeta sets the ObjectMeta field for the resource +func (r *resource) SetObjectMeta(meta metav1.ObjectMeta) { + r.ko.ObjectMeta = meta +} + +// SetStatus will set the Status field for the resource +func (r *resource) SetStatus(desired acktypes.AWSResource) { + r.ko.Status = desired.(*resource).ko.Status +} + +// SetIdentifiers sets the Spec or Status field that is referenced as the unique +// resource identifier +func (r *resource) SetIdentifiers(identifier *ackv1alpha1.AWSIdentifiers) error { + if identifier.NameOrID == "" { + return ackerrors.MissingNameIdentifier + } + r.ko.Status.ReservationID = &identifier.NameOrID + + return nil +} + +// DeepCopy will return a copy of the resource +func (r *resource) DeepCopy() acktypes.AWSResource { + koCopy := r.ko.DeepCopy() + return &resource{koCopy} +} diff --git a/pkg/resource/reservation/sdk.go b/pkg/resource/reservation/sdk.go new file mode 100644 index 00000000..dda45ade --- /dev/null +++ b/pkg/resource/reservation/sdk.go @@ -0,0 +1,1849 @@ +// 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 reservation + +import ( + "context" + "errors" + "reflect" + "strings" + + ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" + ackcondition "github.com/aws-controllers-k8s/runtime/pkg/condition" + ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors" + ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" + "github.com/aws/aws-sdk-go/aws" + svcsdk "github.com/aws/aws-sdk-go/service/ec2" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + svcapitypes "github.com/aws-controllers-k8s/ec2-controller/apis/v1alpha1" +) + +// Hack to avoid import errors during build... +var ( + _ = &metav1.Time{} + _ = strings.ToLower("") + _ = &aws.JSONValue{} + _ = &svcsdk.EC2{} + _ = &svcapitypes.Reservation{} + _ = ackv1alpha1.AWSAccountID("") + _ = &ackerr.NotFound + _ = &ackcondition.NotManagedMessage + _ = &reflect.Value{} +) + +// sdkFind returns SDK-specific information about a supplied resource +func (rm *resourceManager) sdkFind( + ctx context.Context, + r *resource, +) (latest *resource, err error) { + rlog := ackrtlog.FromContext(ctx) + exit := rlog.Trace("rm.sdkFind") + defer exit(err) + // If any required fields in the input shape are missing, AWS resource is + // not created yet. Return NotFound here to indicate to callers that the + // resource isn't yet created. + if rm.requiredFieldsMissingFromReadManyInput(r) { + return nil, ackerr.NotFound + } + + input, err := rm.newListRequestPayload(r) + if err != nil { + return nil, err + } + if err = addReservationIDToListRequest(r, input); err != nil { + return nil, ackerr.NotFound + } + var resp *svcsdk.DescribeInstancesOutput + resp, err = rm.sdkapi.DescribeInstancesWithContext(ctx, input) + rm.metrics.RecordAPICall("READ_MANY", "DescribeInstances", 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.Reservations { + if elem.Groups != nil { + f0 := []*svcapitypes.GroupIdentifier{} + for _, f0iter := range elem.Groups { + f0elem := &svcapitypes.GroupIdentifier{} + if f0iter.GroupId != nil { + f0elem.GroupID = f0iter.GroupId + } + if f0iter.GroupName != nil { + f0elem.GroupName = f0iter.GroupName + } + f0 = append(f0, f0elem) + } + ko.Status.Groups = f0 + } else { + ko.Status.Groups = nil + } + if elem.Instances != nil { + f1 := []*svcapitypes.Instance{} + for _, f1iter := range elem.Instances { + f1elem := &svcapitypes.Instance{} + if f1iter.AmiLaunchIndex != nil { + f1elem.AMILaunchIndex = f1iter.AmiLaunchIndex + } + if f1iter.Architecture != nil { + f1elem.Architecture = f1iter.Architecture + } + if f1iter.BlockDeviceMappings != nil { + f1elemf2 := []*svcapitypes.InstanceBlockDeviceMapping{} + for _, f1elemf2iter := range f1iter.BlockDeviceMappings { + f1elemf2elem := &svcapitypes.InstanceBlockDeviceMapping{} + if f1elemf2iter.DeviceName != nil { + f1elemf2elem.DeviceName = f1elemf2iter.DeviceName + } + if f1elemf2iter.Ebs != nil { + f1elemf2elemf1 := &svcapitypes.EBSInstanceBlockDevice{} + if f1elemf2iter.Ebs.AttachTime != nil { + f1elemf2elemf1.AttachTime = &metav1.Time{*f1elemf2iter.Ebs.AttachTime} + } + if f1elemf2iter.Ebs.DeleteOnTermination != nil { + f1elemf2elemf1.DeleteOnTermination = f1elemf2iter.Ebs.DeleteOnTermination + } + if f1elemf2iter.Ebs.Status != nil { + f1elemf2elemf1.Status = f1elemf2iter.Ebs.Status + } + if f1elemf2iter.Ebs.VolumeId != nil { + f1elemf2elemf1.VolumeID = f1elemf2iter.Ebs.VolumeId + } + f1elemf2elem.EBS = f1elemf2elemf1 + } + f1elemf2 = append(f1elemf2, f1elemf2elem) + } + f1elem.BlockDeviceMappings = f1elemf2 + } + if f1iter.BootMode != nil { + f1elem.BootMode = f1iter.BootMode + } + if f1iter.CapacityReservationId != nil { + f1elem.CapacityReservationID = f1iter.CapacityReservationId + } + if f1iter.CapacityReservationSpecification != nil { + f1elemf5 := &svcapitypes.CapacityReservationSpecificationResponse{} + if f1iter.CapacityReservationSpecification.CapacityReservationPreference != nil { + f1elemf5.CapacityReservationPreference = f1iter.CapacityReservationSpecification.CapacityReservationPreference + } + if f1iter.CapacityReservationSpecification.CapacityReservationTarget != nil { + f1elemf5f1 := &svcapitypes.CapacityReservationTargetResponse{} + if f1iter.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId != nil { + f1elemf5f1.CapacityReservationID = f1iter.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId + } + if f1iter.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn != nil { + f1elemf5f1.CapacityReservationResourceGroupARN = f1iter.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn + } + f1elemf5.CapacityReservationTarget = f1elemf5f1 + } + f1elem.CapacityReservationSpecification = f1elemf5 + } + if f1iter.ClientToken != nil { + f1elem.ClientToken = f1iter.ClientToken + } + if f1iter.CpuOptions != nil { + f1elemf7 := &svcapitypes.CPUOptions{} + if f1iter.CpuOptions.CoreCount != nil { + f1elemf7.CoreCount = f1iter.CpuOptions.CoreCount + } + if f1iter.CpuOptions.ThreadsPerCore != nil { + f1elemf7.ThreadsPerCore = f1iter.CpuOptions.ThreadsPerCore + } + f1elem.CPUOptions = f1elemf7 + } + if f1iter.EbsOptimized != nil { + f1elem.EBSOptimized = f1iter.EbsOptimized + } + if f1iter.ElasticGpuAssociations != nil { + f1elemf9 := []*svcapitypes.ElasticGPUAssociation{} + for _, f1elemf9iter := range f1iter.ElasticGpuAssociations { + f1elemf9elem := &svcapitypes.ElasticGPUAssociation{} + if f1elemf9iter.ElasticGpuAssociationId != nil { + f1elemf9elem.ElasticGPUAssociationID = f1elemf9iter.ElasticGpuAssociationId + } + if f1elemf9iter.ElasticGpuAssociationState != nil { + f1elemf9elem.ElasticGPUAssociationState = f1elemf9iter.ElasticGpuAssociationState + } + if f1elemf9iter.ElasticGpuAssociationTime != nil { + f1elemf9elem.ElasticGPUAssociationTime = f1elemf9iter.ElasticGpuAssociationTime + } + if f1elemf9iter.ElasticGpuId != nil { + f1elemf9elem.ElasticGPUID = f1elemf9iter.ElasticGpuId + } + f1elemf9 = append(f1elemf9, f1elemf9elem) + } + f1elem.ElasticGPUAssociations = f1elemf9 + } + if f1iter.ElasticInferenceAcceleratorAssociations != nil { + f1elemf10 := []*svcapitypes.ElasticInferenceAcceleratorAssociation{} + for _, f1elemf10iter := range f1iter.ElasticInferenceAcceleratorAssociations { + f1elemf10elem := &svcapitypes.ElasticInferenceAcceleratorAssociation{} + if f1elemf10iter.ElasticInferenceAcceleratorArn != nil { + f1elemf10elem.ElasticInferenceAcceleratorARN = f1elemf10iter.ElasticInferenceAcceleratorArn + } + if f1elemf10iter.ElasticInferenceAcceleratorAssociationId != nil { + f1elemf10elem.ElasticInferenceAcceleratorAssociationID = f1elemf10iter.ElasticInferenceAcceleratorAssociationId + } + if f1elemf10iter.ElasticInferenceAcceleratorAssociationState != nil { + f1elemf10elem.ElasticInferenceAcceleratorAssociationState = f1elemf10iter.ElasticInferenceAcceleratorAssociationState + } + if f1elemf10iter.ElasticInferenceAcceleratorAssociationTime != nil { + f1elemf10elem.ElasticInferenceAcceleratorAssociationTime = &metav1.Time{*f1elemf10iter.ElasticInferenceAcceleratorAssociationTime} + } + f1elemf10 = append(f1elemf10, f1elemf10elem) + } + f1elem.ElasticInferenceAcceleratorAssociations = f1elemf10 + } + if f1iter.EnaSupport != nil { + f1elem.ENASupport = f1iter.EnaSupport + } + if f1iter.EnclaveOptions != nil { + f1elemf12 := &svcapitypes.EnclaveOptions{} + if f1iter.EnclaveOptions.Enabled != nil { + f1elemf12.Enabled = f1iter.EnclaveOptions.Enabled + } + f1elem.EnclaveOptions = f1elemf12 + } + if f1iter.HibernationOptions != nil { + f1elemf13 := &svcapitypes.HibernationOptions{} + if f1iter.HibernationOptions.Configured != nil { + f1elemf13.Configured = f1iter.HibernationOptions.Configured + } + f1elem.HibernationOptions = f1elemf13 + } + if f1iter.Hypervisor != nil { + f1elem.Hypervisor = f1iter.Hypervisor + } + if f1iter.IamInstanceProfile != nil { + f1elemf15 := &svcapitypes.IAMInstanceProfile{} + if f1iter.IamInstanceProfile.Arn != nil { + f1elemf15.ARN = f1iter.IamInstanceProfile.Arn + } + if f1iter.IamInstanceProfile.Id != nil { + f1elemf15.ID = f1iter.IamInstanceProfile.Id + } + f1elem.IAMInstanceProfile = f1elemf15 + } + if f1iter.ImageId != nil { + f1elem.ImageID = f1iter.ImageId + } + if f1iter.InstanceId != nil { + f1elem.InstanceID = f1iter.InstanceId + } + if f1iter.InstanceLifecycle != nil { + f1elem.InstanceLifecycle = f1iter.InstanceLifecycle + } + if f1iter.InstanceType != nil { + f1elem.InstanceType = f1iter.InstanceType + } + if f1iter.KernelId != nil { + f1elem.KernelID = f1iter.KernelId + } + if f1iter.KeyName != nil { + f1elem.KeyName = f1iter.KeyName + } + if f1iter.LaunchTime != nil { + f1elem.LaunchTime = &metav1.Time{*f1iter.LaunchTime} + } + if f1iter.Licenses != nil { + f1elemf23 := []*svcapitypes.LicenseConfiguration{} + for _, f1elemf23iter := range f1iter.Licenses { + f1elemf23elem := &svcapitypes.LicenseConfiguration{} + if f1elemf23iter.LicenseConfigurationArn != nil { + f1elemf23elem.LicenseConfigurationARN = f1elemf23iter.LicenseConfigurationArn + } + f1elemf23 = append(f1elemf23, f1elemf23elem) + } + f1elem.Licenses = f1elemf23 + } + if f1iter.MetadataOptions != nil { + f1elemf24 := &svcapitypes.InstanceMetadataOptionsResponse{} + if f1iter.MetadataOptions.HttpEndpoint != nil { + f1elemf24.HTTPEndpoint = f1iter.MetadataOptions.HttpEndpoint + } + if f1iter.MetadataOptions.HttpProtocolIpv6 != nil { + f1elemf24.HTTPProtocolIPv6 = f1iter.MetadataOptions.HttpProtocolIpv6 + } + if f1iter.MetadataOptions.HttpPutResponseHopLimit != nil { + f1elemf24.HTTPPutResponseHopLimit = f1iter.MetadataOptions.HttpPutResponseHopLimit + } + if f1iter.MetadataOptions.HttpTokens != nil { + f1elemf24.HTTPTokens = f1iter.MetadataOptions.HttpTokens + } + if f1iter.MetadataOptions.State != nil { + f1elemf24.State = f1iter.MetadataOptions.State + } + f1elem.MetadataOptions = f1elemf24 + } + if f1iter.Monitoring != nil { + f1elemf25 := &svcapitypes.Monitoring{} + if f1iter.Monitoring.State != nil { + f1elemf25.State = f1iter.Monitoring.State + } + f1elem.Monitoring = f1elemf25 + } + if f1iter.NetworkInterfaces != nil { + f1elemf26 := []*svcapitypes.InstanceNetworkInterface{} + for _, f1elemf26iter := range f1iter.NetworkInterfaces { + f1elemf26elem := &svcapitypes.InstanceNetworkInterface{} + if f1elemf26iter.Association != nil { + f1elemf26elemf0 := &svcapitypes.InstanceNetworkInterfaceAssociation{} + if f1elemf26iter.Association.CarrierIp != nil { + f1elemf26elemf0.CarrierIP = f1elemf26iter.Association.CarrierIp + } + if f1elemf26iter.Association.CustomerOwnedIp != nil { + f1elemf26elemf0.CustomerOwnedIP = f1elemf26iter.Association.CustomerOwnedIp + } + if f1elemf26iter.Association.IpOwnerId != nil { + f1elemf26elemf0.IPOwnerID = f1elemf26iter.Association.IpOwnerId + } + if f1elemf26iter.Association.PublicDnsName != nil { + f1elemf26elemf0.PublicDNSName = f1elemf26iter.Association.PublicDnsName + } + if f1elemf26iter.Association.PublicIp != nil { + f1elemf26elemf0.PublicIP = f1elemf26iter.Association.PublicIp + } + f1elemf26elem.Association = f1elemf26elemf0 + } + if f1elemf26iter.Attachment != nil { + f1elemf26elemf1 := &svcapitypes.InstanceNetworkInterfaceAttachment{} + if f1elemf26iter.Attachment.AttachTime != nil { + f1elemf26elemf1.AttachTime = &metav1.Time{*f1elemf26iter.Attachment.AttachTime} + } + if f1elemf26iter.Attachment.AttachmentId != nil { + f1elemf26elemf1.AttachmentID = f1elemf26iter.Attachment.AttachmentId + } + if f1elemf26iter.Attachment.DeleteOnTermination != nil { + f1elemf26elemf1.DeleteOnTermination = f1elemf26iter.Attachment.DeleteOnTermination + } + if f1elemf26iter.Attachment.DeviceIndex != nil { + f1elemf26elemf1.DeviceIndex = f1elemf26iter.Attachment.DeviceIndex + } + if f1elemf26iter.Attachment.NetworkCardIndex != nil { + f1elemf26elemf1.NetworkCardIndex = f1elemf26iter.Attachment.NetworkCardIndex + } + if f1elemf26iter.Attachment.Status != nil { + f1elemf26elemf1.Status = f1elemf26iter.Attachment.Status + } + f1elemf26elem.Attachment = f1elemf26elemf1 + } + if f1elemf26iter.Description != nil { + f1elemf26elem.Description = f1elemf26iter.Description + } + if f1elemf26iter.Groups != nil { + f1elemf26elemf3 := []*svcapitypes.GroupIdentifier{} + for _, f1elemf26elemf3iter := range f1elemf26iter.Groups { + f1elemf26elemf3elem := &svcapitypes.GroupIdentifier{} + if f1elemf26elemf3iter.GroupId != nil { + f1elemf26elemf3elem.GroupID = f1elemf26elemf3iter.GroupId + } + if f1elemf26elemf3iter.GroupName != nil { + f1elemf26elemf3elem.GroupName = f1elemf26elemf3iter.GroupName + } + f1elemf26elemf3 = append(f1elemf26elemf3, f1elemf26elemf3elem) + } + f1elemf26elem.Groups = f1elemf26elemf3 + } + if f1elemf26iter.InterfaceType != nil { + f1elemf26elem.InterfaceType = f1elemf26iter.InterfaceType + } + if f1elemf26iter.Ipv4Prefixes != nil { + f1elemf26elemf5 := []*svcapitypes.InstanceIPv4Prefix{} + for _, f1elemf26elemf5iter := range f1elemf26iter.Ipv4Prefixes { + f1elemf26elemf5elem := &svcapitypes.InstanceIPv4Prefix{} + if f1elemf26elemf5iter.Ipv4Prefix != nil { + f1elemf26elemf5elem.IPv4Prefix = f1elemf26elemf5iter.Ipv4Prefix + } + f1elemf26elemf5 = append(f1elemf26elemf5, f1elemf26elemf5elem) + } + f1elemf26elem.IPv4Prefixes = f1elemf26elemf5 + } + if f1elemf26iter.Ipv6Addresses != nil { + f1elemf26elemf6 := []*svcapitypes.InstanceIPv6Address{} + for _, f1elemf26elemf6iter := range f1elemf26iter.Ipv6Addresses { + f1elemf26elemf6elem := &svcapitypes.InstanceIPv6Address{} + if f1elemf26elemf6iter.Ipv6Address != nil { + f1elemf26elemf6elem.IPv6Address = f1elemf26elemf6iter.Ipv6Address + } + f1elemf26elemf6 = append(f1elemf26elemf6, f1elemf26elemf6elem) + } + f1elemf26elem.IPv6Addresses = f1elemf26elemf6 + } + if f1elemf26iter.Ipv6Prefixes != nil { + f1elemf26elemf7 := []*svcapitypes.InstanceIPv6Prefix{} + for _, f1elemf26elemf7iter := range f1elemf26iter.Ipv6Prefixes { + f1elemf26elemf7elem := &svcapitypes.InstanceIPv6Prefix{} + if f1elemf26elemf7iter.Ipv6Prefix != nil { + f1elemf26elemf7elem.IPv6Prefix = f1elemf26elemf7iter.Ipv6Prefix + } + f1elemf26elemf7 = append(f1elemf26elemf7, f1elemf26elemf7elem) + } + f1elemf26elem.IPv6Prefixes = f1elemf26elemf7 + } + if f1elemf26iter.MacAddress != nil { + f1elemf26elem.MacAddress = f1elemf26iter.MacAddress + } + if f1elemf26iter.NetworkInterfaceId != nil { + f1elemf26elem.NetworkInterfaceID = f1elemf26iter.NetworkInterfaceId + } + if f1elemf26iter.OwnerId != nil { + f1elemf26elem.OwnerID = f1elemf26iter.OwnerId + } + if f1elemf26iter.PrivateDnsName != nil { + f1elemf26elem.PrivateDNSName = f1elemf26iter.PrivateDnsName + } + if f1elemf26iter.PrivateIpAddress != nil { + f1elemf26elem.PrivateIPAddress = f1elemf26iter.PrivateIpAddress + } + if f1elemf26iter.PrivateIpAddresses != nil { + f1elemf26elemf13 := []*svcapitypes.InstancePrivateIPAddress{} + for _, f1elemf26elemf13iter := range f1elemf26iter.PrivateIpAddresses { + f1elemf26elemf13elem := &svcapitypes.InstancePrivateIPAddress{} + if f1elemf26elemf13iter.Association != nil { + f1elemf26elemf13elemf0 := &svcapitypes.InstanceNetworkInterfaceAssociation{} + if f1elemf26elemf13iter.Association.CarrierIp != nil { + f1elemf26elemf13elemf0.CarrierIP = f1elemf26elemf13iter.Association.CarrierIp + } + if f1elemf26elemf13iter.Association.CustomerOwnedIp != nil { + f1elemf26elemf13elemf0.CustomerOwnedIP = f1elemf26elemf13iter.Association.CustomerOwnedIp + } + if f1elemf26elemf13iter.Association.IpOwnerId != nil { + f1elemf26elemf13elemf0.IPOwnerID = f1elemf26elemf13iter.Association.IpOwnerId + } + if f1elemf26elemf13iter.Association.PublicDnsName != nil { + f1elemf26elemf13elemf0.PublicDNSName = f1elemf26elemf13iter.Association.PublicDnsName + } + if f1elemf26elemf13iter.Association.PublicIp != nil { + f1elemf26elemf13elemf0.PublicIP = f1elemf26elemf13iter.Association.PublicIp + } + f1elemf26elemf13elem.Association = f1elemf26elemf13elemf0 + } + if f1elemf26elemf13iter.Primary != nil { + f1elemf26elemf13elem.Primary = f1elemf26elemf13iter.Primary + } + if f1elemf26elemf13iter.PrivateDnsName != nil { + f1elemf26elemf13elem.PrivateDNSName = f1elemf26elemf13iter.PrivateDnsName + } + if f1elemf26elemf13iter.PrivateIpAddress != nil { + f1elemf26elemf13elem.PrivateIPAddress = f1elemf26elemf13iter.PrivateIpAddress + } + f1elemf26elemf13 = append(f1elemf26elemf13, f1elemf26elemf13elem) + } + f1elemf26elem.PrivateIPAddresses = f1elemf26elemf13 + } + if f1elemf26iter.SourceDestCheck != nil { + f1elemf26elem.SourceDestCheck = f1elemf26iter.SourceDestCheck + } + if f1elemf26iter.Status != nil { + f1elemf26elem.Status = f1elemf26iter.Status + } + if f1elemf26iter.SubnetId != nil { + f1elemf26elem.SubnetID = f1elemf26iter.SubnetId + } + if f1elemf26iter.VpcId != nil { + f1elemf26elem.VPCID = f1elemf26iter.VpcId + } + f1elemf26 = append(f1elemf26, f1elemf26elem) + } + f1elem.NetworkInterfaces = f1elemf26 + } + if f1iter.OutpostArn != nil { + f1elem.OutpostARN = f1iter.OutpostArn + } + if f1iter.Placement != nil { + f1elemf28 := &svcapitypes.Placement{} + if f1iter.Placement.Affinity != nil { + f1elemf28.Affinity = f1iter.Placement.Affinity + } + if f1iter.Placement.AvailabilityZone != nil { + f1elemf28.AvailabilityZone = f1iter.Placement.AvailabilityZone + } + if f1iter.Placement.GroupName != nil { + f1elemf28.GroupName = f1iter.Placement.GroupName + } + if f1iter.Placement.HostId != nil { + f1elemf28.HostID = f1iter.Placement.HostId + } + if f1iter.Placement.HostResourceGroupArn != nil { + f1elemf28.HostResourceGroupARN = f1iter.Placement.HostResourceGroupArn + } + if f1iter.Placement.PartitionNumber != nil { + f1elemf28.PartitionNumber = f1iter.Placement.PartitionNumber + } + if f1iter.Placement.SpreadDomain != nil { + f1elemf28.SpreadDomain = f1iter.Placement.SpreadDomain + } + if f1iter.Placement.Tenancy != nil { + f1elemf28.Tenancy = f1iter.Placement.Tenancy + } + f1elem.Placement = f1elemf28 + } + if f1iter.Platform != nil { + f1elem.Platform = f1iter.Platform + } + if f1iter.PlatformDetails != nil { + f1elem.PlatformDetails = f1iter.PlatformDetails + } + if f1iter.PrivateDnsName != nil { + f1elem.PrivateDNSName = f1iter.PrivateDnsName + } + if f1iter.PrivateIpAddress != nil { + f1elem.PrivateIPAddress = f1iter.PrivateIpAddress + } + if f1iter.ProductCodes != nil { + f1elemf33 := []*svcapitypes.ProductCode{} + for _, f1elemf33iter := range f1iter.ProductCodes { + f1elemf33elem := &svcapitypes.ProductCode{} + if f1elemf33iter.ProductCodeId != nil { + f1elemf33elem.ProductCodeID = f1elemf33iter.ProductCodeId + } + if f1elemf33iter.ProductCodeType != nil { + f1elemf33elem.ProductCodeType = f1elemf33iter.ProductCodeType + } + f1elemf33 = append(f1elemf33, f1elemf33elem) + } + f1elem.ProductCodes = f1elemf33 + } + if f1iter.PublicDnsName != nil { + f1elem.PublicDNSName = f1iter.PublicDnsName + } + if f1iter.PublicIpAddress != nil { + f1elem.PublicIPAddress = f1iter.PublicIpAddress + } + if f1iter.RamdiskId != nil { + f1elem.RAMDiskID = f1iter.RamdiskId + } + if f1iter.RootDeviceName != nil { + f1elem.RootDeviceName = f1iter.RootDeviceName + } + if f1iter.RootDeviceType != nil { + f1elem.RootDeviceType = f1iter.RootDeviceType + } + if f1iter.SecurityGroups != nil { + f1elemf39 := []*svcapitypes.GroupIdentifier{} + for _, f1elemf39iter := range f1iter.SecurityGroups { + f1elemf39elem := &svcapitypes.GroupIdentifier{} + if f1elemf39iter.GroupId != nil { + f1elemf39elem.GroupID = f1elemf39iter.GroupId + } + if f1elemf39iter.GroupName != nil { + f1elemf39elem.GroupName = f1elemf39iter.GroupName + } + f1elemf39 = append(f1elemf39, f1elemf39elem) + } + f1elem.SecurityGroups = f1elemf39 + } + if f1iter.SourceDestCheck != nil { + f1elem.SourceDestCheck = f1iter.SourceDestCheck + } + if f1iter.SpotInstanceRequestId != nil { + f1elem.SpotInstanceRequestID = f1iter.SpotInstanceRequestId + } + if f1iter.SriovNetSupport != nil { + f1elem.SRIOVNetSupport = f1iter.SriovNetSupport + } + if f1iter.State != nil { + f1elemf43 := &svcapitypes.InstanceState{} + if f1iter.State.Code != nil { + f1elemf43.Code = f1iter.State.Code + } + if f1iter.State.Name != nil { + f1elemf43.Name = f1iter.State.Name + } + f1elem.State = f1elemf43 + } + if f1iter.StateReason != nil { + f1elemf44 := &svcapitypes.StateReason{} + if f1iter.StateReason.Code != nil { + f1elemf44.Code = f1iter.StateReason.Code + } + if f1iter.StateReason.Message != nil { + f1elemf44.Message = f1iter.StateReason.Message + } + f1elem.StateReason = f1elemf44 + } + if f1iter.StateTransitionReason != nil { + f1elem.StateTransitionReason = f1iter.StateTransitionReason + } + if f1iter.SubnetId != nil { + f1elem.SubnetID = f1iter.SubnetId + } + if f1iter.Tags != nil { + f1elemf47 := []*svcapitypes.Tag{} + for _, f1elemf47iter := range f1iter.Tags { + f1elemf47elem := &svcapitypes.Tag{} + if f1elemf47iter.Key != nil { + f1elemf47elem.Key = f1elemf47iter.Key + } + if f1elemf47iter.Value != nil { + f1elemf47elem.Value = f1elemf47iter.Value + } + f1elemf47 = append(f1elemf47, f1elemf47elem) + } + f1elem.Tags = f1elemf47 + } + if f1iter.UsageOperation != nil { + f1elem.UsageOperation = f1iter.UsageOperation + } + if f1iter.UsageOperationUpdateTime != nil { + f1elem.UsageOperationUpdateTime = &metav1.Time{*f1iter.UsageOperationUpdateTime} + } + if f1iter.VirtualizationType != nil { + f1elem.VirtualizationType = f1iter.VirtualizationType + } + if f1iter.VpcId != nil { + f1elem.VPCID = f1iter.VpcId + } + f1 = append(f1, f1elem) + } + ko.Status.Instances = f1 + } else { + ko.Status.Instances = nil + } + if elem.OwnerId != nil { + ko.Status.OwnerID = elem.OwnerId + } else { + ko.Status.OwnerID = nil + } + if elem.RequesterId != nil { + ko.Status.RequesterID = elem.RequesterId + } else { + ko.Status.RequesterID = nil + } + if elem.ReservationId != nil { + ko.Status.ReservationID = elem.ReservationId + } else { + ko.Status.ReservationID = nil + } + found = true + break + } + if !found { + return nil, ackerr.NotFound + } + + rm.setStatusDefaults(ko) + return &resource{ko}, nil +} + +// requiredFieldsMissingFromReadManyInput returns true if there are any fields +// for the ReadMany Input shape that are required but not present in the +// resource's Spec or Status +func (rm *resourceManager) requiredFieldsMissingFromReadManyInput( + r *resource, +) bool { + return false +} + +// 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.DescribeInstancesInput, error) { + res := &svcsdk.DescribeInstancesInput{} + + 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.Reservation + _ = resp + resp, err = rm.sdkapi.RunInstancesWithContext(ctx, input) + rm.metrics.RecordAPICall("CREATE", "RunInstances", 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.Groups != nil { + f0 := []*svcapitypes.GroupIdentifier{} + for _, f0iter := range resp.Groups { + f0elem := &svcapitypes.GroupIdentifier{} + if f0iter.GroupId != nil { + f0elem.GroupID = f0iter.GroupId + } + if f0iter.GroupName != nil { + f0elem.GroupName = f0iter.GroupName + } + f0 = append(f0, f0elem) + } + ko.Status.Groups = f0 + } else { + ko.Status.Groups = nil + } + if resp.Instances != nil { + f1 := []*svcapitypes.Instance{} + for _, f1iter := range resp.Instances { + f1elem := &svcapitypes.Instance{} + if f1iter.AmiLaunchIndex != nil { + f1elem.AMILaunchIndex = f1iter.AmiLaunchIndex + } + if f1iter.Architecture != nil { + f1elem.Architecture = f1iter.Architecture + } + if f1iter.BlockDeviceMappings != nil { + f1elemf2 := []*svcapitypes.InstanceBlockDeviceMapping{} + for _, f1elemf2iter := range f1iter.BlockDeviceMappings { + f1elemf2elem := &svcapitypes.InstanceBlockDeviceMapping{} + if f1elemf2iter.DeviceName != nil { + f1elemf2elem.DeviceName = f1elemf2iter.DeviceName + } + if f1elemf2iter.Ebs != nil { + f1elemf2elemf1 := &svcapitypes.EBSInstanceBlockDevice{} + if f1elemf2iter.Ebs.AttachTime != nil { + f1elemf2elemf1.AttachTime = &metav1.Time{*f1elemf2iter.Ebs.AttachTime} + } + if f1elemf2iter.Ebs.DeleteOnTermination != nil { + f1elemf2elemf1.DeleteOnTermination = f1elemf2iter.Ebs.DeleteOnTermination + } + if f1elemf2iter.Ebs.Status != nil { + f1elemf2elemf1.Status = f1elemf2iter.Ebs.Status + } + if f1elemf2iter.Ebs.VolumeId != nil { + f1elemf2elemf1.VolumeID = f1elemf2iter.Ebs.VolumeId + } + f1elemf2elem.EBS = f1elemf2elemf1 + } + f1elemf2 = append(f1elemf2, f1elemf2elem) + } + f1elem.BlockDeviceMappings = f1elemf2 + } + if f1iter.BootMode != nil { + f1elem.BootMode = f1iter.BootMode + } + if f1iter.CapacityReservationId != nil { + f1elem.CapacityReservationID = f1iter.CapacityReservationId + } + if f1iter.CapacityReservationSpecification != nil { + f1elemf5 := &svcapitypes.CapacityReservationSpecificationResponse{} + if f1iter.CapacityReservationSpecification.CapacityReservationPreference != nil { + f1elemf5.CapacityReservationPreference = f1iter.CapacityReservationSpecification.CapacityReservationPreference + } + if f1iter.CapacityReservationSpecification.CapacityReservationTarget != nil { + f1elemf5f1 := &svcapitypes.CapacityReservationTargetResponse{} + if f1iter.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId != nil { + f1elemf5f1.CapacityReservationID = f1iter.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId + } + if f1iter.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn != nil { + f1elemf5f1.CapacityReservationResourceGroupARN = f1iter.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn + } + f1elemf5.CapacityReservationTarget = f1elemf5f1 + } + f1elem.CapacityReservationSpecification = f1elemf5 + } + if f1iter.ClientToken != nil { + f1elem.ClientToken = f1iter.ClientToken + } + if f1iter.CpuOptions != nil { + f1elemf7 := &svcapitypes.CPUOptions{} + if f1iter.CpuOptions.CoreCount != nil { + f1elemf7.CoreCount = f1iter.CpuOptions.CoreCount + } + if f1iter.CpuOptions.ThreadsPerCore != nil { + f1elemf7.ThreadsPerCore = f1iter.CpuOptions.ThreadsPerCore + } + f1elem.CPUOptions = f1elemf7 + } + if f1iter.EbsOptimized != nil { + f1elem.EBSOptimized = f1iter.EbsOptimized + } + if f1iter.ElasticGpuAssociations != nil { + f1elemf9 := []*svcapitypes.ElasticGPUAssociation{} + for _, f1elemf9iter := range f1iter.ElasticGpuAssociations { + f1elemf9elem := &svcapitypes.ElasticGPUAssociation{} + if f1elemf9iter.ElasticGpuAssociationId != nil { + f1elemf9elem.ElasticGPUAssociationID = f1elemf9iter.ElasticGpuAssociationId + } + if f1elemf9iter.ElasticGpuAssociationState != nil { + f1elemf9elem.ElasticGPUAssociationState = f1elemf9iter.ElasticGpuAssociationState + } + if f1elemf9iter.ElasticGpuAssociationTime != nil { + f1elemf9elem.ElasticGPUAssociationTime = f1elemf9iter.ElasticGpuAssociationTime + } + if f1elemf9iter.ElasticGpuId != nil { + f1elemf9elem.ElasticGPUID = f1elemf9iter.ElasticGpuId + } + f1elemf9 = append(f1elemf9, f1elemf9elem) + } + f1elem.ElasticGPUAssociations = f1elemf9 + } + if f1iter.ElasticInferenceAcceleratorAssociations != nil { + f1elemf10 := []*svcapitypes.ElasticInferenceAcceleratorAssociation{} + for _, f1elemf10iter := range f1iter.ElasticInferenceAcceleratorAssociations { + f1elemf10elem := &svcapitypes.ElasticInferenceAcceleratorAssociation{} + if f1elemf10iter.ElasticInferenceAcceleratorArn != nil { + f1elemf10elem.ElasticInferenceAcceleratorARN = f1elemf10iter.ElasticInferenceAcceleratorArn + } + if f1elemf10iter.ElasticInferenceAcceleratorAssociationId != nil { + f1elemf10elem.ElasticInferenceAcceleratorAssociationID = f1elemf10iter.ElasticInferenceAcceleratorAssociationId + } + if f1elemf10iter.ElasticInferenceAcceleratorAssociationState != nil { + f1elemf10elem.ElasticInferenceAcceleratorAssociationState = f1elemf10iter.ElasticInferenceAcceleratorAssociationState + } + if f1elemf10iter.ElasticInferenceAcceleratorAssociationTime != nil { + f1elemf10elem.ElasticInferenceAcceleratorAssociationTime = &metav1.Time{*f1elemf10iter.ElasticInferenceAcceleratorAssociationTime} + } + f1elemf10 = append(f1elemf10, f1elemf10elem) + } + f1elem.ElasticInferenceAcceleratorAssociations = f1elemf10 + } + if f1iter.EnaSupport != nil { + f1elem.ENASupport = f1iter.EnaSupport + } + if f1iter.EnclaveOptions != nil { + f1elemf12 := &svcapitypes.EnclaveOptions{} + if f1iter.EnclaveOptions.Enabled != nil { + f1elemf12.Enabled = f1iter.EnclaveOptions.Enabled + } + f1elem.EnclaveOptions = f1elemf12 + } + if f1iter.HibernationOptions != nil { + f1elemf13 := &svcapitypes.HibernationOptions{} + if f1iter.HibernationOptions.Configured != nil { + f1elemf13.Configured = f1iter.HibernationOptions.Configured + } + f1elem.HibernationOptions = f1elemf13 + } + if f1iter.Hypervisor != nil { + f1elem.Hypervisor = f1iter.Hypervisor + } + if f1iter.IamInstanceProfile != nil { + f1elemf15 := &svcapitypes.IAMInstanceProfile{} + if f1iter.IamInstanceProfile.Arn != nil { + f1elemf15.ARN = f1iter.IamInstanceProfile.Arn + } + if f1iter.IamInstanceProfile.Id != nil { + f1elemf15.ID = f1iter.IamInstanceProfile.Id + } + f1elem.IAMInstanceProfile = f1elemf15 + } + if f1iter.ImageId != nil { + f1elem.ImageID = f1iter.ImageId + } + if f1iter.InstanceId != nil { + f1elem.InstanceID = f1iter.InstanceId + } + if f1iter.InstanceLifecycle != nil { + f1elem.InstanceLifecycle = f1iter.InstanceLifecycle + } + if f1iter.InstanceType != nil { + f1elem.InstanceType = f1iter.InstanceType + } + if f1iter.KernelId != nil { + f1elem.KernelID = f1iter.KernelId + } + if f1iter.KeyName != nil { + f1elem.KeyName = f1iter.KeyName + } + if f1iter.LaunchTime != nil { + f1elem.LaunchTime = &metav1.Time{*f1iter.LaunchTime} + } + if f1iter.Licenses != nil { + f1elemf23 := []*svcapitypes.LicenseConfiguration{} + for _, f1elemf23iter := range f1iter.Licenses { + f1elemf23elem := &svcapitypes.LicenseConfiguration{} + if f1elemf23iter.LicenseConfigurationArn != nil { + f1elemf23elem.LicenseConfigurationARN = f1elemf23iter.LicenseConfigurationArn + } + f1elemf23 = append(f1elemf23, f1elemf23elem) + } + f1elem.Licenses = f1elemf23 + } + if f1iter.MetadataOptions != nil { + f1elemf24 := &svcapitypes.InstanceMetadataOptionsResponse{} + if f1iter.MetadataOptions.HttpEndpoint != nil { + f1elemf24.HTTPEndpoint = f1iter.MetadataOptions.HttpEndpoint + } + if f1iter.MetadataOptions.HttpProtocolIpv6 != nil { + f1elemf24.HTTPProtocolIPv6 = f1iter.MetadataOptions.HttpProtocolIpv6 + } + if f1iter.MetadataOptions.HttpPutResponseHopLimit != nil { + f1elemf24.HTTPPutResponseHopLimit = f1iter.MetadataOptions.HttpPutResponseHopLimit + } + if f1iter.MetadataOptions.HttpTokens != nil { + f1elemf24.HTTPTokens = f1iter.MetadataOptions.HttpTokens + } + if f1iter.MetadataOptions.State != nil { + f1elemf24.State = f1iter.MetadataOptions.State + } + f1elem.MetadataOptions = f1elemf24 + } + if f1iter.Monitoring != nil { + f1elemf25 := &svcapitypes.Monitoring{} + if f1iter.Monitoring.State != nil { + f1elemf25.State = f1iter.Monitoring.State + } + f1elem.Monitoring = f1elemf25 + } + if f1iter.NetworkInterfaces != nil { + f1elemf26 := []*svcapitypes.InstanceNetworkInterface{} + for _, f1elemf26iter := range f1iter.NetworkInterfaces { + f1elemf26elem := &svcapitypes.InstanceNetworkInterface{} + if f1elemf26iter.Association != nil { + f1elemf26elemf0 := &svcapitypes.InstanceNetworkInterfaceAssociation{} + if f1elemf26iter.Association.CarrierIp != nil { + f1elemf26elemf0.CarrierIP = f1elemf26iter.Association.CarrierIp + } + if f1elemf26iter.Association.CustomerOwnedIp != nil { + f1elemf26elemf0.CustomerOwnedIP = f1elemf26iter.Association.CustomerOwnedIp + } + if f1elemf26iter.Association.IpOwnerId != nil { + f1elemf26elemf0.IPOwnerID = f1elemf26iter.Association.IpOwnerId + } + if f1elemf26iter.Association.PublicDnsName != nil { + f1elemf26elemf0.PublicDNSName = f1elemf26iter.Association.PublicDnsName + } + if f1elemf26iter.Association.PublicIp != nil { + f1elemf26elemf0.PublicIP = f1elemf26iter.Association.PublicIp + } + f1elemf26elem.Association = f1elemf26elemf0 + } + if f1elemf26iter.Attachment != nil { + f1elemf26elemf1 := &svcapitypes.InstanceNetworkInterfaceAttachment{} + if f1elemf26iter.Attachment.AttachTime != nil { + f1elemf26elemf1.AttachTime = &metav1.Time{*f1elemf26iter.Attachment.AttachTime} + } + if f1elemf26iter.Attachment.AttachmentId != nil { + f1elemf26elemf1.AttachmentID = f1elemf26iter.Attachment.AttachmentId + } + if f1elemf26iter.Attachment.DeleteOnTermination != nil { + f1elemf26elemf1.DeleteOnTermination = f1elemf26iter.Attachment.DeleteOnTermination + } + if f1elemf26iter.Attachment.DeviceIndex != nil { + f1elemf26elemf1.DeviceIndex = f1elemf26iter.Attachment.DeviceIndex + } + if f1elemf26iter.Attachment.NetworkCardIndex != nil { + f1elemf26elemf1.NetworkCardIndex = f1elemf26iter.Attachment.NetworkCardIndex + } + if f1elemf26iter.Attachment.Status != nil { + f1elemf26elemf1.Status = f1elemf26iter.Attachment.Status + } + f1elemf26elem.Attachment = f1elemf26elemf1 + } + if f1elemf26iter.Description != nil { + f1elemf26elem.Description = f1elemf26iter.Description + } + if f1elemf26iter.Groups != nil { + f1elemf26elemf3 := []*svcapitypes.GroupIdentifier{} + for _, f1elemf26elemf3iter := range f1elemf26iter.Groups { + f1elemf26elemf3elem := &svcapitypes.GroupIdentifier{} + if f1elemf26elemf3iter.GroupId != nil { + f1elemf26elemf3elem.GroupID = f1elemf26elemf3iter.GroupId + } + if f1elemf26elemf3iter.GroupName != nil { + f1elemf26elemf3elem.GroupName = f1elemf26elemf3iter.GroupName + } + f1elemf26elemf3 = append(f1elemf26elemf3, f1elemf26elemf3elem) + } + f1elemf26elem.Groups = f1elemf26elemf3 + } + if f1elemf26iter.InterfaceType != nil { + f1elemf26elem.InterfaceType = f1elemf26iter.InterfaceType + } + if f1elemf26iter.Ipv4Prefixes != nil { + f1elemf26elemf5 := []*svcapitypes.InstanceIPv4Prefix{} + for _, f1elemf26elemf5iter := range f1elemf26iter.Ipv4Prefixes { + f1elemf26elemf5elem := &svcapitypes.InstanceIPv4Prefix{} + if f1elemf26elemf5iter.Ipv4Prefix != nil { + f1elemf26elemf5elem.IPv4Prefix = f1elemf26elemf5iter.Ipv4Prefix + } + f1elemf26elemf5 = append(f1elemf26elemf5, f1elemf26elemf5elem) + } + f1elemf26elem.IPv4Prefixes = f1elemf26elemf5 + } + if f1elemf26iter.Ipv6Addresses != nil { + f1elemf26elemf6 := []*svcapitypes.InstanceIPv6Address{} + for _, f1elemf26elemf6iter := range f1elemf26iter.Ipv6Addresses { + f1elemf26elemf6elem := &svcapitypes.InstanceIPv6Address{} + if f1elemf26elemf6iter.Ipv6Address != nil { + f1elemf26elemf6elem.IPv6Address = f1elemf26elemf6iter.Ipv6Address + } + f1elemf26elemf6 = append(f1elemf26elemf6, f1elemf26elemf6elem) + } + f1elemf26elem.IPv6Addresses = f1elemf26elemf6 + } + if f1elemf26iter.Ipv6Prefixes != nil { + f1elemf26elemf7 := []*svcapitypes.InstanceIPv6Prefix{} + for _, f1elemf26elemf7iter := range f1elemf26iter.Ipv6Prefixes { + f1elemf26elemf7elem := &svcapitypes.InstanceIPv6Prefix{} + if f1elemf26elemf7iter.Ipv6Prefix != nil { + f1elemf26elemf7elem.IPv6Prefix = f1elemf26elemf7iter.Ipv6Prefix + } + f1elemf26elemf7 = append(f1elemf26elemf7, f1elemf26elemf7elem) + } + f1elemf26elem.IPv6Prefixes = f1elemf26elemf7 + } + if f1elemf26iter.MacAddress != nil { + f1elemf26elem.MacAddress = f1elemf26iter.MacAddress + } + if f1elemf26iter.NetworkInterfaceId != nil { + f1elemf26elem.NetworkInterfaceID = f1elemf26iter.NetworkInterfaceId + } + if f1elemf26iter.OwnerId != nil { + f1elemf26elem.OwnerID = f1elemf26iter.OwnerId + } + if f1elemf26iter.PrivateDnsName != nil { + f1elemf26elem.PrivateDNSName = f1elemf26iter.PrivateDnsName + } + if f1elemf26iter.PrivateIpAddress != nil { + f1elemf26elem.PrivateIPAddress = f1elemf26iter.PrivateIpAddress + } + if f1elemf26iter.PrivateIpAddresses != nil { + f1elemf26elemf13 := []*svcapitypes.InstancePrivateIPAddress{} + for _, f1elemf26elemf13iter := range f1elemf26iter.PrivateIpAddresses { + f1elemf26elemf13elem := &svcapitypes.InstancePrivateIPAddress{} + if f1elemf26elemf13iter.Association != nil { + f1elemf26elemf13elemf0 := &svcapitypes.InstanceNetworkInterfaceAssociation{} + if f1elemf26elemf13iter.Association.CarrierIp != nil { + f1elemf26elemf13elemf0.CarrierIP = f1elemf26elemf13iter.Association.CarrierIp + } + if f1elemf26elemf13iter.Association.CustomerOwnedIp != nil { + f1elemf26elemf13elemf0.CustomerOwnedIP = f1elemf26elemf13iter.Association.CustomerOwnedIp + } + if f1elemf26elemf13iter.Association.IpOwnerId != nil { + f1elemf26elemf13elemf0.IPOwnerID = f1elemf26elemf13iter.Association.IpOwnerId + } + if f1elemf26elemf13iter.Association.PublicDnsName != nil { + f1elemf26elemf13elemf0.PublicDNSName = f1elemf26elemf13iter.Association.PublicDnsName + } + if f1elemf26elemf13iter.Association.PublicIp != nil { + f1elemf26elemf13elemf0.PublicIP = f1elemf26elemf13iter.Association.PublicIp + } + f1elemf26elemf13elem.Association = f1elemf26elemf13elemf0 + } + if f1elemf26elemf13iter.Primary != nil { + f1elemf26elemf13elem.Primary = f1elemf26elemf13iter.Primary + } + if f1elemf26elemf13iter.PrivateDnsName != nil { + f1elemf26elemf13elem.PrivateDNSName = f1elemf26elemf13iter.PrivateDnsName + } + if f1elemf26elemf13iter.PrivateIpAddress != nil { + f1elemf26elemf13elem.PrivateIPAddress = f1elemf26elemf13iter.PrivateIpAddress + } + f1elemf26elemf13 = append(f1elemf26elemf13, f1elemf26elemf13elem) + } + f1elemf26elem.PrivateIPAddresses = f1elemf26elemf13 + } + if f1elemf26iter.SourceDestCheck != nil { + f1elemf26elem.SourceDestCheck = f1elemf26iter.SourceDestCheck + } + if f1elemf26iter.Status != nil { + f1elemf26elem.Status = f1elemf26iter.Status + } + if f1elemf26iter.SubnetId != nil { + f1elemf26elem.SubnetID = f1elemf26iter.SubnetId + } + if f1elemf26iter.VpcId != nil { + f1elemf26elem.VPCID = f1elemf26iter.VpcId + } + f1elemf26 = append(f1elemf26, f1elemf26elem) + } + f1elem.NetworkInterfaces = f1elemf26 + } + if f1iter.OutpostArn != nil { + f1elem.OutpostARN = f1iter.OutpostArn + } + if f1iter.Placement != nil { + f1elemf28 := &svcapitypes.Placement{} + if f1iter.Placement.Affinity != nil { + f1elemf28.Affinity = f1iter.Placement.Affinity + } + if f1iter.Placement.AvailabilityZone != nil { + f1elemf28.AvailabilityZone = f1iter.Placement.AvailabilityZone + } + if f1iter.Placement.GroupName != nil { + f1elemf28.GroupName = f1iter.Placement.GroupName + } + if f1iter.Placement.HostId != nil { + f1elemf28.HostID = f1iter.Placement.HostId + } + if f1iter.Placement.HostResourceGroupArn != nil { + f1elemf28.HostResourceGroupARN = f1iter.Placement.HostResourceGroupArn + } + if f1iter.Placement.PartitionNumber != nil { + f1elemf28.PartitionNumber = f1iter.Placement.PartitionNumber + } + if f1iter.Placement.SpreadDomain != nil { + f1elemf28.SpreadDomain = f1iter.Placement.SpreadDomain + } + if f1iter.Placement.Tenancy != nil { + f1elemf28.Tenancy = f1iter.Placement.Tenancy + } + f1elem.Placement = f1elemf28 + } + if f1iter.Platform != nil { + f1elem.Platform = f1iter.Platform + } + if f1iter.PlatformDetails != nil { + f1elem.PlatformDetails = f1iter.PlatformDetails + } + if f1iter.PrivateDnsName != nil { + f1elem.PrivateDNSName = f1iter.PrivateDnsName + } + if f1iter.PrivateIpAddress != nil { + f1elem.PrivateIPAddress = f1iter.PrivateIpAddress + } + if f1iter.ProductCodes != nil { + f1elemf33 := []*svcapitypes.ProductCode{} + for _, f1elemf33iter := range f1iter.ProductCodes { + f1elemf33elem := &svcapitypes.ProductCode{} + if f1elemf33iter.ProductCodeId != nil { + f1elemf33elem.ProductCodeID = f1elemf33iter.ProductCodeId + } + if f1elemf33iter.ProductCodeType != nil { + f1elemf33elem.ProductCodeType = f1elemf33iter.ProductCodeType + } + f1elemf33 = append(f1elemf33, f1elemf33elem) + } + f1elem.ProductCodes = f1elemf33 + } + if f1iter.PublicDnsName != nil { + f1elem.PublicDNSName = f1iter.PublicDnsName + } + if f1iter.PublicIpAddress != nil { + f1elem.PublicIPAddress = f1iter.PublicIpAddress + } + if f1iter.RamdiskId != nil { + f1elem.RAMDiskID = f1iter.RamdiskId + } + if f1iter.RootDeviceName != nil { + f1elem.RootDeviceName = f1iter.RootDeviceName + } + if f1iter.RootDeviceType != nil { + f1elem.RootDeviceType = f1iter.RootDeviceType + } + if f1iter.SecurityGroups != nil { + f1elemf39 := []*svcapitypes.GroupIdentifier{} + for _, f1elemf39iter := range f1iter.SecurityGroups { + f1elemf39elem := &svcapitypes.GroupIdentifier{} + if f1elemf39iter.GroupId != nil { + f1elemf39elem.GroupID = f1elemf39iter.GroupId + } + if f1elemf39iter.GroupName != nil { + f1elemf39elem.GroupName = f1elemf39iter.GroupName + } + f1elemf39 = append(f1elemf39, f1elemf39elem) + } + f1elem.SecurityGroups = f1elemf39 + } + if f1iter.SourceDestCheck != nil { + f1elem.SourceDestCheck = f1iter.SourceDestCheck + } + if f1iter.SpotInstanceRequestId != nil { + f1elem.SpotInstanceRequestID = f1iter.SpotInstanceRequestId + } + if f1iter.SriovNetSupport != nil { + f1elem.SRIOVNetSupport = f1iter.SriovNetSupport + } + if f1iter.State != nil { + f1elemf43 := &svcapitypes.InstanceState{} + if f1iter.State.Code != nil { + f1elemf43.Code = f1iter.State.Code + } + if f1iter.State.Name != nil { + f1elemf43.Name = f1iter.State.Name + } + f1elem.State = f1elemf43 + } + if f1iter.StateReason != nil { + f1elemf44 := &svcapitypes.StateReason{} + if f1iter.StateReason.Code != nil { + f1elemf44.Code = f1iter.StateReason.Code + } + if f1iter.StateReason.Message != nil { + f1elemf44.Message = f1iter.StateReason.Message + } + f1elem.StateReason = f1elemf44 + } + if f1iter.StateTransitionReason != nil { + f1elem.StateTransitionReason = f1iter.StateTransitionReason + } + if f1iter.SubnetId != nil { + f1elem.SubnetID = f1iter.SubnetId + } + if f1iter.Tags != nil { + f1elemf47 := []*svcapitypes.Tag{} + for _, f1elemf47iter := range f1iter.Tags { + f1elemf47elem := &svcapitypes.Tag{} + if f1elemf47iter.Key != nil { + f1elemf47elem.Key = f1elemf47iter.Key + } + if f1elemf47iter.Value != nil { + f1elemf47elem.Value = f1elemf47iter.Value + } + f1elemf47 = append(f1elemf47, f1elemf47elem) + } + f1elem.Tags = f1elemf47 + } + if f1iter.UsageOperation != nil { + f1elem.UsageOperation = f1iter.UsageOperation + } + if f1iter.UsageOperationUpdateTime != nil { + f1elem.UsageOperationUpdateTime = &metav1.Time{*f1iter.UsageOperationUpdateTime} + } + if f1iter.VirtualizationType != nil { + f1elem.VirtualizationType = f1iter.VirtualizationType + } + if f1iter.VpcId != nil { + f1elem.VPCID = f1iter.VpcId + } + f1 = append(f1, f1elem) + } + ko.Status.Instances = f1 + } else { + ko.Status.Instances = nil + } + if resp.OwnerId != nil { + ko.Status.OwnerID = resp.OwnerId + } else { + ko.Status.OwnerID = nil + } + if resp.RequesterId != nil { + ko.Status.RequesterID = resp.RequesterId + } else { + ko.Status.RequesterID = nil + } + if resp.ReservationId != nil { + ko.Status.ReservationID = resp.ReservationId + } else { + ko.Status.ReservationID = 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.RunInstancesInput, error) { + res := &svcsdk.RunInstancesInput{} + + if r.ko.Spec.AdditionalInfo != nil { + res.SetAdditionalInfo(*r.ko.Spec.AdditionalInfo) + } + if r.ko.Spec.BlockDeviceMappings != nil { + f1 := []*svcsdk.BlockDeviceMapping{} + for _, f1iter := range r.ko.Spec.BlockDeviceMappings { + f1elem := &svcsdk.BlockDeviceMapping{} + if f1iter.DeviceName != nil { + f1elem.SetDeviceName(*f1iter.DeviceName) + } + if f1iter.EBS != nil { + f1elemf1 := &svcsdk.EbsBlockDevice{} + if f1iter.EBS.DeleteOnTermination != nil { + f1elemf1.SetDeleteOnTermination(*f1iter.EBS.DeleteOnTermination) + } + if f1iter.EBS.Encrypted != nil { + f1elemf1.SetEncrypted(*f1iter.EBS.Encrypted) + } + if f1iter.EBS.IOPS != nil { + f1elemf1.SetIops(*f1iter.EBS.IOPS) + } + if f1iter.EBS.KMSKeyID != nil { + f1elemf1.SetKmsKeyId(*f1iter.EBS.KMSKeyID) + } + if f1iter.EBS.OutpostARN != nil { + f1elemf1.SetOutpostArn(*f1iter.EBS.OutpostARN) + } + if f1iter.EBS.SnapshotID != nil { + f1elemf1.SetSnapshotId(*f1iter.EBS.SnapshotID) + } + if f1iter.EBS.Throughput != nil { + f1elemf1.SetThroughput(*f1iter.EBS.Throughput) + } + if f1iter.EBS.VolumeSize != nil { + f1elemf1.SetVolumeSize(*f1iter.EBS.VolumeSize) + } + if f1iter.EBS.VolumeType != nil { + f1elemf1.SetVolumeType(*f1iter.EBS.VolumeType) + } + f1elem.SetEbs(f1elemf1) + } + if f1iter.NoDevice != nil { + f1elem.SetNoDevice(*f1iter.NoDevice) + } + if f1iter.VirtualName != nil { + f1elem.SetVirtualName(*f1iter.VirtualName) + } + f1 = append(f1, f1elem) + } + res.SetBlockDeviceMappings(f1) + } + if r.ko.Spec.CapacityReservationSpecification != nil { + f2 := &svcsdk.CapacityReservationSpecification{} + if r.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference != nil { + f2.SetCapacityReservationPreference(*r.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference) + } + if r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget != nil { + f2f1 := &svcsdk.CapacityReservationTarget{} + if r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID != nil { + f2f1.SetCapacityReservationId(*r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID) + } + if r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN != nil { + f2f1.SetCapacityReservationResourceGroupArn(*r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN) + } + f2.SetCapacityReservationTarget(f2f1) + } + res.SetCapacityReservationSpecification(f2) + } + if r.ko.Spec.CPUOptions != nil { + f3 := &svcsdk.CpuOptionsRequest{} + if r.ko.Spec.CPUOptions.CoreCount != nil { + f3.SetCoreCount(*r.ko.Spec.CPUOptions.CoreCount) + } + if r.ko.Spec.CPUOptions.ThreadsPerCore != nil { + f3.SetThreadsPerCore(*r.ko.Spec.CPUOptions.ThreadsPerCore) + } + res.SetCpuOptions(f3) + } + if r.ko.Spec.CreditSpecification != nil { + f4 := &svcsdk.CreditSpecificationRequest{} + if r.ko.Spec.CreditSpecification.CPUCredits != nil { + f4.SetCpuCredits(*r.ko.Spec.CreditSpecification.CPUCredits) + } + res.SetCreditSpecification(f4) + } + if r.ko.Spec.DisableAPITermination != nil { + res.SetDisableApiTermination(*r.ko.Spec.DisableAPITermination) + } + if r.ko.Spec.EBSOptimized != nil { + res.SetEbsOptimized(*r.ko.Spec.EBSOptimized) + } + if r.ko.Spec.ElasticGPUSpecification != nil { + f7 := []*svcsdk.ElasticGpuSpecification{} + for _, f7iter := range r.ko.Spec.ElasticGPUSpecification { + f7elem := &svcsdk.ElasticGpuSpecification{} + if f7iter.Type != nil { + f7elem.SetType(*f7iter.Type) + } + f7 = append(f7, f7elem) + } + res.SetElasticGpuSpecification(f7) + } + if r.ko.Spec.ElasticInferenceAccelerators != nil { + f8 := []*svcsdk.ElasticInferenceAccelerator{} + for _, f8iter := range r.ko.Spec.ElasticInferenceAccelerators { + f8elem := &svcsdk.ElasticInferenceAccelerator{} + if f8iter.Count != nil { + f8elem.SetCount(*f8iter.Count) + } + if f8iter.Type != nil { + f8elem.SetType(*f8iter.Type) + } + f8 = append(f8, f8elem) + } + res.SetElasticInferenceAccelerators(f8) + } + if r.ko.Spec.EnclaveOptions != nil { + f9 := &svcsdk.EnclaveOptionsRequest{} + if r.ko.Spec.EnclaveOptions.Enabled != nil { + f9.SetEnabled(*r.ko.Spec.EnclaveOptions.Enabled) + } + res.SetEnclaveOptions(f9) + } + if r.ko.Spec.HibernationOptions != nil { + f10 := &svcsdk.HibernationOptionsRequest{} + if r.ko.Spec.HibernationOptions.Configured != nil { + f10.SetConfigured(*r.ko.Spec.HibernationOptions.Configured) + } + res.SetHibernationOptions(f10) + } + if r.ko.Spec.IAMInstanceProfile != nil { + f11 := &svcsdk.IamInstanceProfileSpecification{} + if r.ko.Spec.IAMInstanceProfile.ARN != nil { + f11.SetArn(*r.ko.Spec.IAMInstanceProfile.ARN) + } + if r.ko.Spec.IAMInstanceProfile.Name != nil { + f11.SetName(*r.ko.Spec.IAMInstanceProfile.Name) + } + res.SetIamInstanceProfile(f11) + } + if r.ko.Spec.ImageID != nil { + res.SetImageId(*r.ko.Spec.ImageID) + } + if r.ko.Spec.InstanceInitiatedShutdownBehavior != nil { + res.SetInstanceInitiatedShutdownBehavior(*r.ko.Spec.InstanceInitiatedShutdownBehavior) + } + if r.ko.Spec.InstanceMarketOptions != nil { + f14 := &svcsdk.InstanceMarketOptionsRequest{} + if r.ko.Spec.InstanceMarketOptions.MarketType != nil { + f14.SetMarketType(*r.ko.Spec.InstanceMarketOptions.MarketType) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions != nil { + f14f1 := &svcsdk.SpotMarketOptions{} + if r.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil { + f14f1.SetBlockDurationMinutes(*r.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil { + f14f1.SetInstanceInterruptionBehavior(*r.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice != nil { + f14f1.SetMaxPrice(*r.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil { + f14f1.SetSpotInstanceType(*r.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil != nil { + f14f1.SetValidUntil(r.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil.Time) + } + f14.SetSpotOptions(f14f1) + } + res.SetInstanceMarketOptions(f14) + } + if r.ko.Spec.InstanceType != nil { + res.SetInstanceType(*r.ko.Spec.InstanceType) + } + if r.ko.Spec.IPv6AddressCount != nil { + res.SetIpv6AddressCount(*r.ko.Spec.IPv6AddressCount) + } + if r.ko.Spec.IPv6Addresses != nil { + f17 := []*svcsdk.InstanceIpv6Address{} + for _, f17iter := range r.ko.Spec.IPv6Addresses { + f17elem := &svcsdk.InstanceIpv6Address{} + if f17iter.IPv6Address != nil { + f17elem.SetIpv6Address(*f17iter.IPv6Address) + } + f17 = append(f17, f17elem) + } + res.SetIpv6Addresses(f17) + } + if r.ko.Spec.KernelID != nil { + res.SetKernelId(*r.ko.Spec.KernelID) + } + if r.ko.Spec.KeyName != nil { + res.SetKeyName(*r.ko.Spec.KeyName) + } + if r.ko.Spec.LaunchTemplate != nil { + f20 := &svcsdk.LaunchTemplateSpecification{} + if r.ko.Spec.LaunchTemplate.LaunchTemplateID != nil { + f20.SetLaunchTemplateId(*r.ko.Spec.LaunchTemplate.LaunchTemplateID) + } + if r.ko.Spec.LaunchTemplate.LaunchTemplateName != nil { + f20.SetLaunchTemplateName(*r.ko.Spec.LaunchTemplate.LaunchTemplateName) + } + if r.ko.Spec.LaunchTemplate.Version != nil { + f20.SetVersion(*r.ko.Spec.LaunchTemplate.Version) + } + res.SetLaunchTemplate(f20) + } + if r.ko.Spec.LicenseSpecifications != nil { + f21 := []*svcsdk.LicenseConfigurationRequest{} + for _, f21iter := range r.ko.Spec.LicenseSpecifications { + f21elem := &svcsdk.LicenseConfigurationRequest{} + if f21iter.LicenseConfigurationARN != nil { + f21elem.SetLicenseConfigurationArn(*f21iter.LicenseConfigurationARN) + } + f21 = append(f21, f21elem) + } + res.SetLicenseSpecifications(f21) + } + if r.ko.Spec.MaxCount != nil { + res.SetMaxCount(*r.ko.Spec.MaxCount) + } + if r.ko.Spec.MetadataOptions != nil { + f23 := &svcsdk.InstanceMetadataOptionsRequest{} + if r.ko.Spec.MetadataOptions.HTTPEndpoint != nil { + f23.SetHttpEndpoint(*r.ko.Spec.MetadataOptions.HTTPEndpoint) + } + if r.ko.Spec.MetadataOptions.HTTPProtocolIPv6 != nil { + f23.SetHttpProtocolIpv6(*r.ko.Spec.MetadataOptions.HTTPProtocolIPv6) + } + if r.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit != nil { + f23.SetHttpPutResponseHopLimit(*r.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit) + } + if r.ko.Spec.MetadataOptions.HTTPTokens != nil { + f23.SetHttpTokens(*r.ko.Spec.MetadataOptions.HTTPTokens) + } + res.SetMetadataOptions(f23) + } + if r.ko.Spec.MinCount != nil { + res.SetMinCount(*r.ko.Spec.MinCount) + } + if r.ko.Spec.Monitoring != nil { + f25 := &svcsdk.RunInstancesMonitoringEnabled{} + if r.ko.Spec.Monitoring.Enabled != nil { + f25.SetEnabled(*r.ko.Spec.Monitoring.Enabled) + } + res.SetMonitoring(f25) + } + if r.ko.Spec.NetworkInterfaces != nil { + f26 := []*svcsdk.InstanceNetworkInterfaceSpecification{} + for _, f26iter := range r.ko.Spec.NetworkInterfaces { + f26elem := &svcsdk.InstanceNetworkInterfaceSpecification{} + if f26iter.AssociateCarrierIPAddress != nil { + f26elem.SetAssociateCarrierIpAddress(*f26iter.AssociateCarrierIPAddress) + } + if f26iter.AssociatePublicIPAddress != nil { + f26elem.SetAssociatePublicIpAddress(*f26iter.AssociatePublicIPAddress) + } + if f26iter.DeleteOnTermination != nil { + f26elem.SetDeleteOnTermination(*f26iter.DeleteOnTermination) + } + if f26iter.Description != nil { + f26elem.SetDescription(*f26iter.Description) + } + if f26iter.DeviceIndex != nil { + f26elem.SetDeviceIndex(*f26iter.DeviceIndex) + } + if f26iter.Groups != nil { + f26elemf5 := []*string{} + for _, f26elemf5iter := range f26iter.Groups { + var f26elemf5elem string + f26elemf5elem = *f26elemf5iter + f26elemf5 = append(f26elemf5, &f26elemf5elem) + } + f26elem.SetGroups(f26elemf5) + } + if f26iter.InterfaceType != nil { + f26elem.SetInterfaceType(*f26iter.InterfaceType) + } + if f26iter.IPv4PrefixCount != nil { + f26elem.SetIpv4PrefixCount(*f26iter.IPv4PrefixCount) + } + if f26iter.IPv4Prefixes != nil { + f26elemf8 := []*svcsdk.Ipv4PrefixSpecificationRequest{} + for _, f26elemf8iter := range f26iter.IPv4Prefixes { + f26elemf8elem := &svcsdk.Ipv4PrefixSpecificationRequest{} + if f26elemf8iter.IPv4Prefix != nil { + f26elemf8elem.SetIpv4Prefix(*f26elemf8iter.IPv4Prefix) + } + f26elemf8 = append(f26elemf8, f26elemf8elem) + } + f26elem.SetIpv4Prefixes(f26elemf8) + } + if f26iter.IPv6AddressCount != nil { + f26elem.SetIpv6AddressCount(*f26iter.IPv6AddressCount) + } + if f26iter.IPv6Addresses != nil { + f26elemf10 := []*svcsdk.InstanceIpv6Address{} + for _, f26elemf10iter := range f26iter.IPv6Addresses { + f26elemf10elem := &svcsdk.InstanceIpv6Address{} + if f26elemf10iter.IPv6Address != nil { + f26elemf10elem.SetIpv6Address(*f26elemf10iter.IPv6Address) + } + f26elemf10 = append(f26elemf10, f26elemf10elem) + } + f26elem.SetIpv6Addresses(f26elemf10) + } + if f26iter.IPv6PrefixCount != nil { + f26elem.SetIpv6PrefixCount(*f26iter.IPv6PrefixCount) + } + if f26iter.IPv6Prefixes != nil { + f26elemf12 := []*svcsdk.Ipv6PrefixSpecificationRequest{} + for _, f26elemf12iter := range f26iter.IPv6Prefixes { + f26elemf12elem := &svcsdk.Ipv6PrefixSpecificationRequest{} + if f26elemf12iter.IPv6Prefix != nil { + f26elemf12elem.SetIpv6Prefix(*f26elemf12iter.IPv6Prefix) + } + f26elemf12 = append(f26elemf12, f26elemf12elem) + } + f26elem.SetIpv6Prefixes(f26elemf12) + } + if f26iter.NetworkCardIndex != nil { + f26elem.SetNetworkCardIndex(*f26iter.NetworkCardIndex) + } + if f26iter.NetworkInterfaceID != nil { + f26elem.SetNetworkInterfaceId(*f26iter.NetworkInterfaceID) + } + if f26iter.PrivateIPAddress != nil { + f26elem.SetPrivateIpAddress(*f26iter.PrivateIPAddress) + } + if f26iter.PrivateIPAddresses != nil { + f26elemf16 := []*svcsdk.PrivateIpAddressSpecification{} + for _, f26elemf16iter := range f26iter.PrivateIPAddresses { + f26elemf16elem := &svcsdk.PrivateIpAddressSpecification{} + if f26elemf16iter.Primary != nil { + f26elemf16elem.SetPrimary(*f26elemf16iter.Primary) + } + if f26elemf16iter.PrivateIPAddress != nil { + f26elemf16elem.SetPrivateIpAddress(*f26elemf16iter.PrivateIPAddress) + } + f26elemf16 = append(f26elemf16, f26elemf16elem) + } + f26elem.SetPrivateIpAddresses(f26elemf16) + } + if f26iter.SecondaryPrivateIPAddressCount != nil { + f26elem.SetSecondaryPrivateIpAddressCount(*f26iter.SecondaryPrivateIPAddressCount) + } + if f26iter.SubnetID != nil { + f26elem.SetSubnetId(*f26iter.SubnetID) + } + f26 = append(f26, f26elem) + } + res.SetNetworkInterfaces(f26) + } + if r.ko.Spec.Placement != nil { + f27 := &svcsdk.Placement{} + if r.ko.Spec.Placement.Affinity != nil { + f27.SetAffinity(*r.ko.Spec.Placement.Affinity) + } + if r.ko.Spec.Placement.AvailabilityZone != nil { + f27.SetAvailabilityZone(*r.ko.Spec.Placement.AvailabilityZone) + } + if r.ko.Spec.Placement.GroupName != nil { + f27.SetGroupName(*r.ko.Spec.Placement.GroupName) + } + if r.ko.Spec.Placement.HostID != nil { + f27.SetHostId(*r.ko.Spec.Placement.HostID) + } + if r.ko.Spec.Placement.HostResourceGroupARN != nil { + f27.SetHostResourceGroupArn(*r.ko.Spec.Placement.HostResourceGroupARN) + } + if r.ko.Spec.Placement.PartitionNumber != nil { + f27.SetPartitionNumber(*r.ko.Spec.Placement.PartitionNumber) + } + if r.ko.Spec.Placement.SpreadDomain != nil { + f27.SetSpreadDomain(*r.ko.Spec.Placement.SpreadDomain) + } + if r.ko.Spec.Placement.Tenancy != nil { + f27.SetTenancy(*r.ko.Spec.Placement.Tenancy) + } + res.SetPlacement(f27) + } + if r.ko.Spec.PrivateIPAddress != nil { + res.SetPrivateIpAddress(*r.ko.Spec.PrivateIPAddress) + } + if r.ko.Spec.RAMDiskID != nil { + res.SetRamdiskId(*r.ko.Spec.RAMDiskID) + } + if r.ko.Spec.SecurityGroupIDs != nil { + f30 := []*string{} + for _, f30iter := range r.ko.Spec.SecurityGroupIDs { + var f30elem string + f30elem = *f30iter + f30 = append(f30, &f30elem) + } + res.SetSecurityGroupIds(f30) + } + if r.ko.Spec.SecurityGroups != nil { + f31 := []*string{} + for _, f31iter := range r.ko.Spec.SecurityGroups { + var f31elem string + f31elem = *f31iter + f31 = append(f31, &f31elem) + } + res.SetSecurityGroups(f31) + } + if r.ko.Spec.SubnetID != nil { + res.SetSubnetId(*r.ko.Spec.SubnetID) + } + if r.ko.Spec.TagSpecifications != nil { + f33 := []*svcsdk.TagSpecification{} + for _, f33iter := range r.ko.Spec.TagSpecifications { + f33elem := &svcsdk.TagSpecification{} + if f33iter.ResourceType != nil { + f33elem.SetResourceType(*f33iter.ResourceType) + } + if f33iter.Tags != nil { + f33elemf1 := []*svcsdk.Tag{} + for _, f33elemf1iter := range f33iter.Tags { + f33elemf1elem := &svcsdk.Tag{} + if f33elemf1iter.Key != nil { + f33elemf1elem.SetKey(*f33elemf1iter.Key) + } + if f33elemf1iter.Value != nil { + f33elemf1elem.SetValue(*f33elemf1iter.Value) + } + f33elemf1 = append(f33elemf1, f33elemf1elem) + } + f33elem.SetTags(f33elemf1) + } + f33 = append(f33, f33elem) + } + res.SetTagSpecifications(f33) + } + if r.ko.Spec.UserData != nil { + res.SetUserData(*r.ko.Spec.UserData) + } + + 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 + } + if err = addInstanceIDsToTerminateRequest(r, input); err != nil { + return nil, ackerr.NotFound + } + var resp *svcsdk.TerminateInstancesOutput + _ = resp + resp, err = rm.sdkapi.TerminateInstancesWithContext(ctx, input) + rm.metrics.RecordAPICall("DELETE", "TerminateInstances", 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.TerminateInstancesInput, error) { + res := &svcsdk.TerminateInstancesInput{} + + return res, nil +} + +// setStatusDefaults sets default properties into supplied custom resource +func (rm *resourceManager) setStatusDefaults( + ko *svcapitypes.Reservation, +) { + if ko.Status.ACKResourceMetadata == nil { + ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{} + } + if ko.Status.ACKResourceMetadata.Region == nil { + ko.Status.ACKResourceMetadata.Region = &rm.awsRegion + } + 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 + } + } + var termError *ackerr.TerminalError + if rm.terminalAWSError(err) || err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound || errors.As(err, &termError) { + 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 || errors.As(err, &termError) { + errorMessage = err.Error() + } else { + awsErr, _ := ackerr.AWSError(err) + errorMessage = awsErr.Error() + } + terminalCondition.Status = corev1.ConditionTrue + terminalCondition.Message = &errorMessage + } else { + // Clear the terminal condition if no longer present + if terminalCondition != nil { + terminalCondition.Status = corev1.ConditionFalse + terminalCondition.Message = nil + } + // Handling Recoverable Conditions + if err != nil { + if recoverableCondition == nil { + // Add a new Condition containing a non-terminal error + recoverableCondition = &ackv1alpha1.Condition{ + Type: ackv1alpha1.ConditionTypeRecoverable, + } + ko.Status.Conditions = append(ko.Status.Conditions, recoverableCondition) + } + recoverableCondition.Status = corev1.ConditionTrue + awsErr, _ := ackerr.AWSError(err) + errorMessage := err.Error() + if awsErr != nil { + errorMessage = awsErr.Error() + } + recoverableCondition.Message = &errorMessage + } else if recoverableCondition != nil { + recoverableCondition.Status = corev1.ConditionFalse + recoverableCondition.Message = nil + } + } + // Required to avoid the "declared but not used" error in the default case + _ = syncCondition + if terminalCondition != nil || recoverableCondition != nil || syncCondition != nil { + return &resource{ko}, true // updated + } + return nil, false // not updated +} + +// terminalAWSError returns awserr, true; if the supplied error is an aws Error type +// and if the exception indicates that it is a Terminal exception +// 'Terminal' exception are specified in generator configuration +func (rm *resourceManager) terminalAWSError(err error) bool { + // No terminal_errors specified for this resource in generator config + return false +} diff --git a/templates/hooks/reservation/sdk_delete_post_build_request.go.tpl b/templates/hooks/reservation/sdk_delete_post_build_request.go.tpl new file mode 100644 index 00000000..ed6c7e22 --- /dev/null +++ b/templates/hooks/reservation/sdk_delete_post_build_request.go.tpl @@ -0,0 +1,3 @@ + if err = addInstanceIDsToTerminateRequest(r, input); err != nil { + return nil, ackerr.NotFound + } \ No newline at end of file diff --git a/templates/hooks/reservation/sdk_read_many_post_build_request.go.tpl b/templates/hooks/reservation/sdk_read_many_post_build_request.go.tpl new file mode 100644 index 00000000..4725557c --- /dev/null +++ b/templates/hooks/reservation/sdk_read_many_post_build_request.go.tpl @@ -0,0 +1,3 @@ + if err = addReservationIDToListRequest(r, input); err != nil { + return nil, ackerr.NotFound + } \ No newline at end of file diff --git a/test/e2e/resources/reservation.yaml b/test/e2e/resources/reservation.yaml new file mode 100644 index 00000000..58a7c1eb --- /dev/null +++ b/test/e2e/resources/reservation.yaml @@ -0,0 +1,10 @@ +apiVersion: ec2.services.k8s.aws/v1alpha1 +kind: Reservation +metadata: + name: $RESERVATION_NAME +spec: + minCount: $RESERVATION_MIN + maxCount: $RESERVATION_MAX + imageID: $RESERVATION_AMI_ID + instanceType: $RESERVATION_INSTANCE_TYPE + subnetID: $RESERVATION_SUBNET_ID \ No newline at end of file diff --git a/test/e2e/tests/test_reservation.py b/test/e2e/tests/test_reservation.py new file mode 100644 index 00000000..101fff16 --- /dev/null +++ b/test/e2e/tests/test_reservation.py @@ -0,0 +1,146 @@ +# 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 Reservations (RunInstances) API. +""" + +import datetime +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 +from e2e.bootstrap_resources import get_bootstrap_resources + +RESOURCE_PLURAL = "reservations" +# highly available instance type for deterministic testing +INSTANCE_TYPE = "m4.large" +INSTANCE_COUNT = "2" +INSTANCE_AMI = "Amazon Linux 2 Kernel" + +CREATE_WAIT_AFTER_SECONDS = 10 +DELETE_WAIT_AFTER_SECONDS = 10 +TIMEOUT_SECONDS = 300 + +def get_reservation(ec2_client, reservation_id: str) -> dict: + try: + resp = ec2_client.describe_instances( + Filters=[{"Name": "reservation-id", "Values": [reservation_id]}] + ) + except Exception as e: + logging.debug(e) + return None + if len(resp["Reservations"]) == 0: + return None + return resp["Reservations"][0] + +def get_instance_states(ec2_client, reservation_id): + instance_states = [] + try: + reservation = get_reservation(ec2_client, reservation_id) + for instance in reservation['Instances']: + instance_states.append(instance['State']['Name']) + except Exception as e: + logging.debug(e) + return instance_states + +def wait_for_instances_or_die(ec2_client, reservation_id, desired_state, timeout_sec): + while True: + now = datetime.datetime.now() + timeout = now + datetime.timedelta(seconds=timeout_sec) + if datetime.datetime.now() >= timeout: + pytest.fail(f"Timed out waiting for Instance to enter {desired_state} state") + time.sleep(DELETE_WAIT_AFTER_SECONDS) + instance_states = get_instance_states(ec2_client, reservation_id) + instances_match_state = True + for state in instance_states: + if state != desired_state: + instances_match_state = False + if instances_match_state: + break + +def get_ami_id(ec2_client): + try: + # Use latest AL2 + resp = ec2_client.describe_images( + Owners=['amazon'], + Filters=[ + {"Name": "architecture", "Values": ['x86_64']}, + {"Name": "state", "Values": ['available']}, + {"Name": "virtualization-type", "Values": ['hvm']}, + ], + ) + for image in resp['Images']: + if 'Description' in image: + if INSTANCE_AMI in image['Description']: + return image['ImageId'] + except Exception as e: + logging.debug(e) + +@service_marker +@pytest.mark.canary +class TestReservation: + def test_create_delete(self, ec2_client): + test_resource_values = REPLACEMENT_VALUES.copy() + resource_name = random_suffix_name("reservation-ack-test", 24) + test_vpc = get_bootstrap_resources().SharedTestVPC + subnet_id = test_vpc.public_subnets.subnet_ids[0] + + ami_id = get_ami_id(ec2_client) + test_resource_values["RESERVATION_NAME"] = resource_name + test_resource_values["RESERVATION_MIN"] = INSTANCE_COUNT + test_resource_values["RESERVATION_MAX"] = INSTANCE_COUNT + test_resource_values["RESERVATION_AMI_ID"] = ami_id + test_resource_values["RESERVATION_INSTANCE_TYPE"] = INSTANCE_TYPE + test_resource_values["RESERVATION_SUBNET_ID"] = subnet_id + + # Load Reservation CR + resource_data = load_ec2_resource( + "reservation", + 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"]["reservationID"] + + time.sleep(CREATE_WAIT_AFTER_SECONDS) + + # Check Reservation exists + assert get_reservation(ec2_client, resource_id) is not None + + # Give time for instances to come up + wait_for_instances_or_die(ec2_client, resource_id, 'running', TIMEOUT_SECONDS) + + # Delete k8s resource + _, deleted = k8s.delete_custom_resource(ref, 2, 5) + assert deleted is True + + # Reservation still exists, but instances will commence termination + # State needs to be 'terminated' in order to remove the dependency on the shared subnet + # for successful test cleanup + wait_for_instances_or_die(ec2_client, resource_id, 'terminated', TIMEOUT_SECONDS) \ No newline at end of file