diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index a4045910..6643784f 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-05-10T23:41:20Z" - build_hash: c651d2bb60694df1f7a5dad823258472a1a6fc8a + build_date: "2022-06-02T15:43:18Z" + build_hash: f65a1edc5cee4768ee4fd34b9932799d50c56240 go_version: go1.18.1 - version: v0.18.4-12-gc651d2b -api_directory_checksum: 1d50f8d633cac0c132fe1f1fb8dad566a20c44db + version: v0.18.4-14-gf65a1ed-dirty +api_directory_checksum: 1d5df6d5b0ea731e73f922da612e643a28ff8ea1 api_version: v1alpha1 aws_sdk_go_version: v1.42.0 generator_config_info: - file_checksum: 0dadc8ea417c3f3bacb05c27d0988207733d4e0f + file_checksum: 89addadb5e22cf16b15db6de95c333a0b53f2a68 original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index d8c76846..25a04f47 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -23,6 +23,13 @@ ignore: # support EC2-VPC only - AllocateAddressInput.Domain - AllocateAddressOutput.Domain + - Instance.ClientToken + - InstanceNetworkInterfaceSpecification.Groups + - RunInstancesInput.AdditionalInfo + - RunInstancesInput.ClientToken + - RunInstancesInput.DryRun + - RunInstancesInput.TagSpecifications + - TerminateInstancesInput.DryRun resource_names: - AccountAttribute - CapacityReservation @@ -38,7 +45,7 @@ ignore: - Fleet - FpgaImage - Image - - Instance + #- Instance - InstanceEventWindow - InstanceExportTask #- InternetGateway @@ -111,12 +118,58 @@ operations: operation_type: - Delete resource_name: VpcEndpoint + RunInstances: + #ouput shape: Reservation + output_wrapper_field_path: Instances + operation_type: + - Create + resource_name: Instance + override_values: + # Hard-code MaxCount and MinCount to 1 so the Reservation + # response can only contain a single instance. This + # instance will be managed by the Instance controller. + # Although RunInstances can handle creating multiple + # instances at once (returning them in a single Reservation), + # a Reservation controller does not align with the declarative state model + # in Kubernetes because users would not be able to update the underlying instances. + MaxCount: 1 + MinCount: 1 + DescribeInstances: + #output shape: DescribeInstancesOutput + output_wrapper_field_path: Reservations.Instances + operation_type: + - List + resource_name: Instance + TerminateInstances: + operation_type: + - Delete + resource_name: Instance resources: DhcpOptions: fields: DHCPConfigurations.Values: set: - from: AttributeValue.Value + Instance: + fields: + HibernationOptions: + late_initialize: {} + MaxCount: + is_required: false + MinCount: + is_required: false + SecurityGroups: + set: + - from: GroupName + Tags: + from: + operation: CreateTags + path: Tags + hooks: + sdk_create_post_build_request: + template_path: hooks/instance/sdk_create_post_build_request.go.tpl + sdk_delete_post_build_request: + template_path: hooks/instance/sdk_delete_post_build_request.go.tpl ElasticIPAddress: exceptions: terminal_codes: diff --git a/apis/v1alpha1/instance.go b/apis/v1alpha1/instance.go new file mode 100644 index 00000000..33825b0b --- /dev/null +++ b/apis/v1alpha1/instance.go @@ -0,0 +1,378 @@ +// 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" +) + +// InstanceSpec defines the desired state of Instance. +// +// Describes an instance. +type InstanceSpec struct { + // 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. + MaxCount *int64 `json:"maxCount,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). + 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. + MinCount *int64 `json:"minCount,omitempty"` + // 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. The value parameter is required, but if you don't want the tag + // to have a value, specify the parameter with no value, and we set the value + // to an empty string. + Tags []*Tag `json:"tags,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"` +} + +// InstanceStatus defines the observed state of Instance +type InstanceStatus struct { + // All CRs managed by ACK have a common `Status.ACKResourceMetadata` member + // that is used to contain resource sync state, account ownership, + // constructed ARN for the resource + // +kubebuilder:validation:Optional + ACKResourceMetadata *ackv1alpha1.ResourceMetadata `json:"ackResourceMetadata"` + // All CRS managed by ACK have a common `Status.Conditions` member that + // contains a collection of `ackv1alpha1.Condition` objects that describe + // the various terminal states of the CR and its backend AWS service API + // resource + // +kubebuilder:validation:Optional + Conditions []*ackv1alpha1.Condition `json:"conditions"` + // The AMI launch index, which can be used to find this instance in the launch + // group. + // +kubebuilder:validation:Optional + AMILaunchIndex *int64 `json:"amiLaunchIndex,omitempty"` + // The architecture of the image. + // +kubebuilder:validation:Optional + Architecture *string `json:"architecture,omitempty"` + // The boot mode of the instance. For more information, see Boot modes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) + // in the Amazon EC2 User Guide. + // +kubebuilder:validation:Optional + BootMode *string `json:"bootMode,omitempty"` + // The ID of the Capacity Reservation. + // +kubebuilder:validation:Optional + CapacityReservationID *string `json:"capacityReservationID,omitempty"` + // The Elastic GPU associated with the instance. + // +kubebuilder:validation:Optional + ElasticGPUAssociations []*ElasticGPUAssociation `json:"elasticGPUAssociations,omitempty"` + // The elastic inference accelerator associated with the instance. + // +kubebuilder:validation:Optional + ElasticInferenceAcceleratorAssociations []*ElasticInferenceAcceleratorAssociation `json:"elasticInferenceAcceleratorAssociations,omitempty"` + // Specifies whether enhanced networking with ENA is enabled. + // +kubebuilder:validation:Optional + ENASupport *bool `json:"enaSupport,omitempty"` + // The hypervisor type of the instance. The value xen is used for both Xen and + // Nitro hypervisors. + // +kubebuilder:validation:Optional + Hypervisor *string `json:"hypervisor,omitempty"` + // The ID of the instance. + // +kubebuilder:validation:Optional + InstanceID *string `json:"instanceID,omitempty"` + // Indicates whether this is a Spot Instance or a Scheduled Instance. + // +kubebuilder:validation:Optional + InstanceLifecycle *string `json:"instanceLifecycle,omitempty"` + // The time the instance was launched. + // +kubebuilder:validation:Optional + LaunchTime *metav1.Time `json:"launchTime,omitempty"` + // The license configurations for the instance. + // +kubebuilder:validation:Optional + Licenses []*LicenseConfiguration `json:"licenses,omitempty"` + // The Amazon Resource Name (ARN) of the Outpost. + // +kubebuilder:validation:Optional + OutpostARN *string `json:"outpostARN,omitempty"` + // The value is Windows for Windows instances; otherwise blank. + // +kubebuilder:validation:Optional + Platform *string `json:"platform,omitempty"` + // The platform details value for the instance. For more information, see AMI + // billing information fields (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-info-fields.html) + // in the Amazon EC2 User Guide. + // +kubebuilder:validation:Optional + PlatformDetails *string `json:"platformDetails,omitempty"` + // (IPv4 only) The private DNS hostname name assigned to the instance. This + // DNS hostname can only be used inside the Amazon EC2 network. This name is + // not available until the instance enters the running state. + // + // [EC2-VPC] The Amazon-provided DNS server resolves Amazon-provided private + // DNS hostnames if you've enabled DNS resolution and DNS hostnames in your + // VPC. If you are not using the Amazon-provided DNS server in your VPC, your + // custom domain name servers must resolve the hostname as appropriate. + // +kubebuilder:validation:Optional + PrivateDNSName *string `json:"privateDNSName,omitempty"` + // The product codes attached to this instance, if applicable. + // +kubebuilder:validation:Optional + ProductCodes []*ProductCode `json:"productCodes,omitempty"` + // (IPv4 only) The public DNS name assigned to the instance. This name is not + // available until the instance enters the running state. For EC2-VPC, this + // name is only available if you've enabled DNS hostnames for your VPC. + // +kubebuilder:validation:Optional + PublicDNSName *string `json:"publicDNSName,omitempty"` + // The public IPv4 address, or the Carrier IP address assigned to the instance, + // if applicable. + // + // A Carrier IP address only applies to an instance launched in a subnet associated + // with a Wavelength Zone. + // +kubebuilder:validation:Optional + PublicIPAddress *string `json:"publicIPAddress,omitempty"` + // The device name of the root device volume (for example, /dev/sda1). + // +kubebuilder:validation:Optional + RootDeviceName *string `json:"rootDeviceName,omitempty"` + // The root device type used by the AMI. The AMI can use an EBS volume or an + // instance store volume. + // +kubebuilder:validation:Optional + RootDeviceType *string `json:"rootDeviceType,omitempty"` + // Indicates whether source/destination checking is enabled. + // +kubebuilder:validation:Optional + SourceDestCheck *bool `json:"sourceDestCheck,omitempty"` + // If the request is a Spot Instance request, the ID of the request. + // +kubebuilder:validation:Optional + SpotInstanceRequestID *string `json:"spotInstanceRequestID,omitempty"` + // Specifies whether enhanced networking with the Intel 82599 Virtual Function + // interface is enabled. + // +kubebuilder:validation:Optional + SRIOVNetSupport *string `json:"sriovNetSupport,omitempty"` + // The current state of the instance. + // +kubebuilder:validation:Optional + State *InstanceState `json:"state,omitempty"` + // The reason for the most recent state transition. + // +kubebuilder:validation:Optional + StateReason *StateReason `json:"stateReason,omitempty"` + // The reason for the most recent state transition. This might be an empty string. + // +kubebuilder:validation:Optional + StateTransitionReason *string `json:"stateTransitionReason,omitempty"` + // The usage operation value for the instance. For more information, see AMI + // billing information fields (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-info-fields.html) + // in the Amazon EC2 User Guide. + // +kubebuilder:validation:Optional + UsageOperation *string `json:"usageOperation,omitempty"` + // The time that the usage operation was last updated. + // +kubebuilder:validation:Optional + UsageOperationUpdateTime *metav1.Time `json:"usageOperationUpdateTime,omitempty"` + // The virtualization type of the instance. + // +kubebuilder:validation:Optional + VirtualizationType *string `json:"virtualizationType,omitempty"` + // [EC2-VPC] The ID of the VPC in which the instance is running. + // +kubebuilder:validation:Optional + VPCID *string `json:"vpcID,omitempty"` +} + +// Instance is the Schema for the Instances API +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +type Instance struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec InstanceSpec `json:"spec,omitempty"` + Status InstanceStatus `json:"status,omitempty"` +} + +// InstanceList contains a list of Instance +// +kubebuilder:object:root=true +type InstanceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Instance `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Instance{}, &InstanceList{}) +} diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index 1269754f..b9f1c002 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"` @@ -695,6 +733,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"` @@ -780,8 +824,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. @@ -834,7 +880,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. @@ -954,25 +1001,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 @@ -1008,11 +1057,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. @@ -1030,6 +1081,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"` } @@ -1037,8 +1089,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 @@ -1057,7 +1112,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 @@ -1183,9 +1239,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. @@ -1290,23 +1348,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. @@ -1314,6 +1381,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"` } @@ -1330,6 +1398,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"` @@ -1347,16 +1416,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. @@ -1382,40 +1459,11 @@ type ImportVolumeTaskDetails struct { Description *string `json:"description,omitempty"` } -// Describes an instance. -type Instance struct { - AMILaunchIndex *int64 `json:"amiLaunchIndex,omitempty"` - CapacityReservationID *string `json:"capacityReservationID,omitempty"` - ClientToken *string `json:"clientToken,omitempty"` - EBSOptimized *bool `json:"ebsOptimized,omitempty"` - ENASupport *bool `json:"enaSupport,omitempty"` - ImageID *string `json:"imageID,omitempty"` - InstanceID *string `json:"instanceID,omitempty"` - KernelID *string `json:"kernelID,omitempty"` - KeyName *string `json:"keyName,omitempty"` - 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"` - 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"` - 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. @@ -1504,33 +1552,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). @@ -1554,27 +1628,33 @@ 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"` + 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, @@ -1627,19 +1707,17 @@ 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 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. + CurrentState *InstanceState `json:"currentState,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + // Describes the current state of an instance. + PreviousState *InstanceState `json:"previousState,omitempty"` } // Describes the instance status. @@ -1655,22 +1733,115 @@ type InstanceStatusEvent struct { NotBeforeDeadline *metav1.Time `json:"notBeforeDeadline,omitempty"` } +// Describes the status of an instance. +type InstanceStatus_SDK struct { + AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceID *string `json:"instanceID,omitempty"` + // Describes the current state of an instance. + InstanceState *InstanceState `json:"instanceState,omitempty"` + OutpostARN *string `json:"outpostARN,omitempty"` +} + // Describes the registered tag keys for the current Region. 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"` UsedInstanceCount *int64 `json:"usedInstanceCount,omitempty"` } +// Describes an instance. +type Instance_SDK struct { + 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"` + // 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 the attachment of a VPC to an internet gateway or an egress-only // internet gateway. type InternetGatewayAttachment struct { @@ -1711,12 +1882,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. @@ -1756,22 +1934,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. @@ -1820,6 +2021,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. @@ -1836,39 +2047,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. @@ -1884,6 +2101,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"` } @@ -1904,6 +2122,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"` @@ -1913,22 +2132,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. @@ -2101,6 +2325,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"` @@ -2177,21 +2406,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), @@ -2389,6 +2620,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"` @@ -2404,6 +2636,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"` @@ -2484,7 +2721,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. @@ -2582,17 +2820,48 @@ 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"` +} + +// 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 struct { + Groups []*GroupIdentifier `json:"groups,omitempty"` + Instances []*Instance_SDK `json:"instances,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + RequesterID *string `json:"requesterID,omitempty"` + ReservationID *string `json:"reservationID,omitempty"` } // Information about an instance type to use in a Capacity Reservation Fleet. @@ -2600,6 +2869,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. @@ -2621,6 +2891,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"` @@ -2630,6 +2901,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"` } @@ -2670,6 +2942,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"` } @@ -2682,15 +2955,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. @@ -2826,6 +3101,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"` } @@ -2843,7 +3119,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"` } @@ -2869,6 +3149,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. @@ -3062,11 +3343,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. @@ -3086,6 +3374,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"` @@ -3107,18 +3396,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. @@ -3136,9 +3427,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. @@ -3162,6 +3455,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"` } @@ -3179,6 +3473,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"` } @@ -3977,6 +4272,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"` @@ -3984,6 +4280,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 d0fffa60..e641a66a 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 @@ -3009,6 +3105,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 @@ -3352,6 +3473,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) @@ -3362,6 +3488,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. @@ -3750,6 +3881,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) @@ -4308,6 +4444,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) @@ -4363,6 +4510,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. @@ -4509,6 +4667,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() @@ -4518,6 +4681,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) @@ -4601,6 +4769,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) @@ -4631,11 +4804,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) @@ -4681,6 +4864,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) @@ -5202,6 +5390,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) @@ -5670,6 +5863,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) @@ -5690,6 +5893,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) @@ -5720,11 +5928,27 @@ 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) @@ -5740,11 +5964,21 @@ func (in *Image) DeepCopyInto(out *Image) { *out = new(string) **out = **in } + 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)) @@ -5761,6 +5995,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. @@ -5791,6 +6030,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) @@ -5856,6 +6100,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) @@ -5947,11 +6196,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) @@ -5987,6 +6278,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. @@ -6108,155 +6404,28 @@ func (in *ImportVolumeTaskDetails) DeepCopy() *ImportVolumeTaskDetails { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Instance) DeepCopyInto(out *Instance) { *out = *in - if in.AMILaunchIndex != nil { - in, out := &in.AMILaunchIndex, &out.AMILaunchIndex - *out = new(int64) - **out = **in + 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 Instance. +func (in *Instance) DeepCopy() *Instance { + if in == nil { + return nil } - if in.CapacityReservationID != nil { - in, out := &in.CapacityReservationID, &out.CapacityReservationID - *out = new(string) - **out = **in + out := new(Instance) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Instance) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c } - if in.ClientToken != nil { - in, out := &in.ClientToken, &out.ClientToken - *out = new(string) - **out = **in - } - 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.ImageID != nil { - in, out := &in.ImageID, &out.ImageID - *out = new(string) - **out = **in - } - if in.InstanceID != nil { - in, out := &in.InstanceID, &out.InstanceID - *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.LaunchTime != nil { - in, out := &in.LaunchTime, &out.LaunchTime - *out = (*in).DeepCopy() - } - if in.OutpostARN != nil { - in, out := &in.OutpostARN, &out.OutpostARN - *out = new(string) - **out = **in - } - if in.PlatformDetails != nil { - in, out := &in.PlatformDetails, &out.PlatformDetails - *out = new(string) - **out = **in - } - if in.PrivateDNSName != nil { - in, out := &in.PrivateDNSName, &out.PrivateDNSName - *out = new(string) - **out = **in - } - if in.PrivateIPAddress != nil { - in, out := &in.PrivateIPAddress, &out.PrivateIPAddress - *out = new(string) - **out = **in - } - if in.PublicDNSName != nil { - in, out := &in.PublicDNSName, &out.PublicDNSName - *out = new(string) - **out = **in - } - if in.PublicIPAddress != nil { - in, out := &in.PublicIPAddress, &out.PublicIPAddress - *out = new(string) - **out = **in - } - if in.RAMDiskID != nil { - in, out := &in.RAMDiskID, &out.RAMDiskID - *out = new(string) - **out = **in - } - if in.RootDeviceName != nil { - in, out := &in.RootDeviceName, &out.RootDeviceName - *out = new(string) - **out = **in - } - if in.SourceDestCheck != nil { - in, out := &in.SourceDestCheck, &out.SourceDestCheck - *out = new(bool) - **out = **in - } - if in.SpotInstanceRequestID != nil { - in, out := &in.SpotInstanceRequestID, &out.SpotInstanceRequestID - *out = new(string) - **out = **in - } - if in.SRIOVNetSupport != nil { - in, out := &in.SRIOVNetSupport, &out.SRIOVNetSupport - *out = new(string) - **out = **in - } - if in.StateTransitionReason != nil { - in, out := &in.StateTransitionReason, &out.StateTransitionReason - *out = new(string) - **out = **in - } - if in.SubnetID != nil { - in, out := &in.SubnetID, &out.SubnetID - *out = new(string) - **out = **in - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make([]*Tag, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(Tag) - (*in).DeepCopyInto(*out) - } - } - } - if in.UsageOperation != nil { - in, out := &in.UsageOperation, &out.UsageOperation - *out = new(string) - **out = **in - } - if in.UsageOperationUpdateTime != nil { - in, out := &in.UsageOperationUpdateTime, &out.UsageOperationUpdateTime - *out = (*in).DeepCopy() - } - if in.VPCID != nil { - in, out := &in.VPCID, &out.VPCID - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instance. -func (in *Instance) DeepCopy() *Instance { - if in == nil { - return nil - } - out := new(Instance) - in.DeepCopyInto(out) - return out + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -6267,6 +6436,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. @@ -6638,14 +6812,86 @@ 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 *InstanceList) DeepCopyInto(out *InstanceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Instance, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceList. +func (in *InstanceList) DeepCopy() *InstanceList { + if in == nil { + return nil + } + out := new(InstanceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstanceList) 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 *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. @@ -6661,11 +6907,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. @@ -6686,6 +6952,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. @@ -6701,16 +6972,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) @@ -6736,11 +7061,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) @@ -6885,16 +7226,49 @@ func (in *InstanceNetworkInterfaceSpecification) DeepCopyInto(out *InstanceNetwo *out = new(int64) **out = **in } - if in.IPv6AddressCount != nil { - in, out := &in.IPv6AddressCount, &out.IPv6AddressCount + 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) @@ -6910,6 +7284,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) @@ -6935,6 +7320,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) @@ -7022,6 +7412,245 @@ func (in *InstanceRequirementsRequest) DeepCopy() *InstanceRequirementsRequest { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceSpec) DeepCopyInto(out *InstanceSpec) { + *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.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]*Tag, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Tag) + (*in).DeepCopyInto(*out) + } + } + } + if in.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 InstanceSpec. +func (in *InstanceSpec) DeepCopy() *InstanceSpec { + if in == nil { + return nil + } + out := new(InstanceSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceSpecification) DeepCopyInto(out *InstanceSpecification) { *out = *in @@ -7055,6 +7684,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. @@ -7070,11 +7704,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. @@ -7090,31 +7734,209 @@ func (in *InstanceStateChange) DeepCopy() *InstanceStateChange { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceStatus) DeepCopyInto(out *InstanceStatus) { *out = *in - if in.AvailabilityZone != nil { - in, out := &in.AvailabilityZone, &out.AvailabilityZone - *out = new(string) + if in.ACKResourceMetadata != nil { + in, out := &in.ACKResourceMetadata, &out.ACKResourceMetadata + *out = new(corev1alpha1.ResourceMetadata) + (*in).DeepCopyInto(*out) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]*corev1alpha1.Condition, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(corev1alpha1.Condition) + (*in).DeepCopyInto(*out) + } + } + } + if in.AMILaunchIndex != nil { + in, out := &in.AMILaunchIndex, &out.AMILaunchIndex + *out = new(int64) **out = **in } - if in.InstanceID != nil { - in, out := &in.InstanceID, &out.InstanceID + if in.Architecture != nil { + in, out := &in.Architecture, &out.Architecture *out = new(string) **out = **in } - if in.OutpostARN != nil { - in, out := &in.OutpostARN, &out.OutpostARN + if in.BootMode != nil { + in, out := &in.BootMode, &out.BootMode *out = new(string) **out = **in } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatus. -func (in *InstanceStatus) DeepCopy() *InstanceStatus { - if in == nil { - return nil + if in.CapacityReservationID != nil { + in, out := &in.CapacityReservationID, &out.CapacityReservationID + *out = new(string) + **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.Hypervisor != nil { + in, out := &in.Hypervisor, &out.Hypervisor + *out = new(string) + **out = **in + } + if in.InstanceID != nil { + in, out := &in.InstanceID, &out.InstanceID + *out = new(string) + **out = **in + } + if in.InstanceLifecycle != nil { + in, out := &in.InstanceLifecycle, &out.InstanceLifecycle + *out = new(string) + **out = **in + } + if in.LaunchTime != nil { + 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.OutpostARN != nil { + in, out := &in.OutpostARN, &out.OutpostARN + *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.PrivateDNSName != nil { + in, out := &in.PrivateDNSName, &out.PrivateDNSName + *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) + **out = **in + } + if in.PublicIPAddress != nil { + in, out := &in.PublicIPAddress, &out.PublicIPAddress + *out = new(string) + **out = **in + } + if in.RootDeviceName != nil { + in, out := &in.RootDeviceName, &out.RootDeviceName + *out = new(string) + **out = **in + } + if in.RootDeviceType != nil { + in, out := &in.RootDeviceType, &out.RootDeviceType + *out = new(string) + **out = **in + } + if in.SourceDestCheck != nil { + in, out := &in.SourceDestCheck, &out.SourceDestCheck + *out = new(bool) + **out = **in + } + if in.SpotInstanceRequestID != nil { + in, out := &in.SpotInstanceRequestID, &out.SpotInstanceRequestID + *out = new(string) + **out = **in + } + 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) + **out = **in + } + if in.UsageOperation != nil { + in, out := &in.UsageOperation, &out.UsageOperation + *out = new(string) + **out = **in + } + if in.UsageOperationUpdateTime != nil { + 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) + **out = **in } - out := new(InstanceStatus) - in.DeepCopyInto(out) - return out +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatus. +func (in *InstanceStatus) DeepCopy() *InstanceStatus { + if in == nil { + return nil + } + out := new(InstanceStatus) + in.DeepCopyInto(out) + return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -7168,6 +7990,41 @@ func (in *InstanceStatusEvent) DeepCopy() *InstanceStatusEvent { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceStatus_SDK) DeepCopyInto(out *InstanceStatus_SDK) { + *out = *in + if in.AvailabilityZone != nil { + in, out := &in.AvailabilityZone, &out.AvailabilityZone + *out = new(string) + **out = **in + } + if in.InstanceID != nil { + in, out := &in.InstanceID, &out.InstanceID + *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) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatus_SDK. +func (in *InstanceStatus_SDK) DeepCopy() *InstanceStatus_SDK { + if in == nil { + return nil + } + out := new(InstanceStatus_SDK) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceTagNotificationAttribute) DeepCopyInto(out *InstanceTagNotificationAttribute) { *out = *in @@ -7188,6 +8045,26 @@ func (in *InstanceTagNotificationAttribute) DeepCopy() *InstanceTagNotificationA return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceTypeInfo) DeepCopyInto(out *InstanceTypeInfo) { + *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 InstanceTypeInfo. +func (in *InstanceTypeInfo) DeepCopy() *InstanceTypeInfo { + if in == nil { + return nil + } + 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 *InstanceTypeInfoFromInstanceRequirements) DeepCopyInto(out *InstanceTypeInfoFromInstanceRequirements) { *out = *in @@ -7203,32 +8080,368 @@ func (in *InstanceTypeInfoFromInstanceRequirements) DeepCopy() *InstanceTypeInfo if in == nil { return nil } - 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 *InstanceUsage) DeepCopyInto(out *InstanceUsage) { - *out = *in - if in.AccountID != nil { - in, out := &in.AccountID, &out.AccountID + 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 *InstanceTypeOffering) DeepCopyInto(out *InstanceTypeOffering) { + *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 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 *Instance_SDK) DeepCopyInto(out *Instance_SDK) { + *out = *in + if in.AMILaunchIndex != nil { + in, out := &in.AMILaunchIndex, &out.AMILaunchIndex + *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.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.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 + *out = new(string) + **out = **in + } + if in.InstanceID != nil { + in, out := &in.InstanceID, &out.InstanceID + *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) + **out = **in + } + if in.KeyName != nil { + in, out := &in.KeyName, &out.KeyName + *out = new(string) + **out = **in + } + if in.LaunchTime != nil { + 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) + **out = **in + } + if in.PrivateDNSName != nil { + in, out := &in.PrivateDNSName, &out.PrivateDNSName + *out = new(string) + **out = **in + } + if in.PrivateIPAddress != nil { + in, out := &in.PrivateIPAddress, &out.PrivateIPAddress + *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) + **out = **in + } + if in.PublicIPAddress != nil { + in, out := &in.PublicIPAddress, &out.PublicIPAddress + *out = new(string) + **out = **in + } + if in.RAMDiskID != nil { + in, out := &in.RAMDiskID, &out.RAMDiskID + *out = new(string) + **out = **in + } + if in.RootDeviceName != nil { + in, out := &in.RootDeviceName, &out.RootDeviceName + *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) + **out = **in + } + if in.SpotInstanceRequestID != nil { + in, out := &in.SpotInstanceRequestID, &out.SpotInstanceRequestID + *out = new(string) + **out = **in + } + 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) + **out = **in + } + if in.SubnetID != nil { + in, out := &in.SubnetID, &out.SubnetID + *out = new(string) + **out = **in + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]*Tag, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Tag) + (*in).DeepCopyInto(*out) + } + } + } + if in.UsageOperation != nil { + in, out := &in.UsageOperation, &out.UsageOperation + *out = new(string) + **out = **in + } + if in.UsageOperationUpdateTime != nil { + 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.UsedInstanceCount != nil { - in, out := &in.UsedInstanceCount, &out.UsedInstanceCount - *out = new(int64) + if in.VPCID != nil { + in, out := &in.VPCID, &out.VPCID + *out = new(string) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceUsage. -func (in *InstanceUsage) DeepCopy() *InstanceUsage { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instance_SDK. +func (in *Instance_SDK) DeepCopy() *Instance_SDK { if in == nil { return nil } - out := new(InstanceUsage) + out := new(Instance_SDK) in.DeepCopyInto(out) return out } @@ -7572,11 +8785,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) @@ -7587,11 +8810,38 @@ func (in *LaunchSpecification) DeepCopyInto(out *LaunchSpecification) { *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.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) @@ -7774,6 +9024,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 @@ -7792,6 +9092,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) @@ -7802,6 +9107,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. @@ -7832,6 +9142,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) @@ -7842,6 +9157,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. @@ -8029,6 +9349,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 @@ -8123,6 +9483,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) @@ -8143,6 +9514,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) @@ -8193,6 +9575,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) @@ -8203,6 +9596,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) @@ -8213,6 +9617,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) @@ -8228,6 +9643,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) @@ -8298,6 +9724,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) @@ -8388,6 +9819,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) @@ -8423,6 +9859,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) @@ -8453,11 +9894,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() @@ -8482,11 +9933,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() @@ -9303,6 +10764,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 @@ -9863,6 +11344,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) @@ -9908,6 +11400,11 @@ func (in *NetworkInterface) DeepCopyInto(out *NetworkInterface) { *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) @@ -10744,6 +12241,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) @@ -10822,6 +12324,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 @@ -11146,6 +12668,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. @@ -11551,6 +13078,11 @@ func (in *ReplaceRootVolumeTask) DeepCopy() *ReplaceRootVolumeTask { // 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) @@ -11561,6 +13093,58 @@ func (in *RequestLaunchTemplateData) DeepCopyInto(out *RequestLaunchTemplateData *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) @@ -11591,6 +13175,52 @@ func (in *RequestSpotLaunchSpecification) DeepCopyInto(out *RequestSpotLaunchSpe *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) @@ -11613,6 +13243,58 @@ func (in *RequestSpotLaunchSpecification) DeepCopy() *RequestSpotLaunchSpecifica 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 + 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_SDK, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Instance_SDK) + (*in).DeepCopyInto(*out) + } + } + } + if in.OwnerID != nil { + in, out := &in.OwnerID, &out.OwnerID + *out = new(string) + **out = **in + } + if in.RequesterID != nil { + in, out := &in.RequesterID, &out.RequesterID + *out = new(string) + **out = **in + } + 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 Reservation. +func (in *Reservation) DeepCopy() *Reservation { + if in == nil { + return nil + } + out := new(Reservation) + 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) { *out = *in @@ -11631,6 +13313,11 @@ func (in *ReservationFleetInstanceSpecification) DeepCopyInto(out *ReservationFl *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. @@ -11720,6 +13407,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) @@ -11765,6 +13457,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) @@ -11941,6 +13638,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) @@ -12001,6 +13703,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) @@ -12832,6 +14544,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) @@ -12887,11 +14604,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) @@ -13002,6 +14739,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. @@ -13977,16 +15719,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.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) @@ -14087,6 +15871,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) @@ -14216,6 +16005,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) @@ -14247,6 +16041,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() @@ -14329,11 +16128,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() @@ -14438,6 +16247,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) @@ -14493,6 +16307,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) @@ -18878,6 +20697,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) @@ -18912,6 +20736,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..fc0e09d4 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -35,6 +35,7 @@ import ( _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/dhcp_options" _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/elastic_ip_address" + _ "github.com/aws-controllers-k8s/ec2-controller/pkg/resource/instance" _ "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/route_table" diff --git a/config/crd/bases/ec2.services.k8s.aws_instances.yaml b/config/crd/bases/ec2.services.k8s.aws_instances.yaml new file mode 100644 index 00000000..fe0cec03 --- /dev/null +++ b/config/crd/bases/ec2.services.k8s.aws_instances.yaml @@ -0,0 +1,763 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.7.0 + creationTimestamp: null + name: instances.ec2.services.k8s.aws +spec: + group: ec2.services.k8s.aws + names: + kind: Instance + listKind: InstanceList + plural: instances + singular: instance + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Instance is the Schema for the Instances 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: "InstanceSpec defines the desired state of Instance. \n Describes + an instance." + properties: + 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 + 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 + tags: + description: The tags. The value parameter is required, but if you + don't want the tag to have a value, specify the parameter with no + value, and we set the value to an empty string. + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + 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 + type: object + status: + description: InstanceStatus defines the observed state of Instance + 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 + amiLaunchIndex: + description: The AMI launch index, which can be used to find this + instance in the launch group. + format: int64 + type: integer + architecture: + description: The architecture of the image. + type: string + bootMode: + description: The boot mode of the instance. For more information, + see Boot modes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) + in the Amazon EC2 User Guide. + type: string + capacityReservationID: + description: The ID of the Capacity Reservation. + type: string + 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 + elasticGPUAssociations: + description: The Elastic GPU associated with the instance. + 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: + description: The elastic inference accelerator associated with the + instance. + 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: + description: Specifies whether enhanced networking with ENA is enabled. + type: boolean + hypervisor: + description: The hypervisor type of the instance. The value xen is + used for both Xen and Nitro hypervisors. + type: string + instanceID: + description: The ID of the instance. + type: string + instanceLifecycle: + description: Indicates whether this is a Spot Instance or a Scheduled + Instance. + type: string + launchTime: + description: The time the instance was launched. + format: date-time + type: string + licenses: + description: The license configurations for the instance. + items: + description: Describes a license configuration. + properties: + licenseConfigurationARN: + type: string + type: object + type: array + outpostARN: + description: The Amazon Resource Name (ARN) of the Outpost. + type: string + platform: + description: The value is Windows for Windows instances; otherwise + blank. + type: string + platformDetails: + description: The platform details value for the instance. For more + information, see AMI billing information fields (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-info-fields.html) + in the Amazon EC2 User Guide. + type: string + privateDNSName: + description: "(IPv4 only) The private DNS hostname name assigned to + the instance. This DNS hostname can only be used inside the Amazon + EC2 network. This name is not available until the instance enters + the running state. \n [EC2-VPC] The Amazon-provided DNS server resolves + Amazon-provided private DNS hostnames if you've enabled DNS resolution + and DNS hostnames in your VPC. If you are not using the Amazon-provided + DNS server in your VPC, your custom domain name servers must resolve + the hostname as appropriate." + type: string + productCodes: + description: The product codes attached to this instance, if applicable. + items: + description: Describes a product code. + properties: + productCodeID: + type: string + productCodeType: + type: string + type: object + type: array + publicDNSName: + description: (IPv4 only) The public DNS name assigned to the instance. + This name is not available until the instance enters the running + state. For EC2-VPC, this name is only available if you've enabled + DNS hostnames for your VPC. + type: string + publicIPAddress: + description: "The public IPv4 address, or the Carrier IP address assigned + to the instance, if applicable. \n A Carrier IP address only applies + to an instance launched in a subnet associated with a Wavelength + Zone." + type: string + rootDeviceName: + description: The device name of the root device volume (for example, + /dev/sda1). + type: string + rootDeviceType: + description: The root device type used by the AMI. The AMI can use + an EBS volume or an instance store volume. + type: string + sourceDestCheck: + description: Indicates whether source/destination checking is enabled. + type: boolean + spotInstanceRequestID: + description: If the request is a Spot Instance request, the ID of + the request. + type: string + sriovNetSupport: + description: Specifies whether enhanced networking with the Intel + 82599 Virtual Function interface is enabled. + type: string + state: + description: The current state of the instance. + properties: + code: + format: int64 + type: integer + name: + type: string + type: object + stateReason: + description: The reason for the most recent state transition. + properties: + code: + type: string + message: + type: string + type: object + stateTransitionReason: + description: The reason for the most recent state transition. This + might be an empty string. + type: string + usageOperation: + description: The usage operation value for the instance. For more + information, see AMI billing information fields (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-info-fields.html) + in the Amazon EC2 User Guide. + type: string + usageOperationUpdateTime: + description: The time that the usage operation was last updated. + format: date-time + type: string + virtualizationType: + description: The virtualization type of the instance. + type: string + vpcID: + description: '[EC2-VPC] The ID of the VPC in which the instance is + running.' + 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..d324d847 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -5,6 +5,7 @@ bases: resources: - bases/ec2.services.k8s.aws_dhcpoptions.yaml - bases/ec2.services.k8s.aws_elasticipaddresses.yaml + - bases/ec2.services.k8s.aws_instances.yaml - bases/ec2.services.k8s.aws_internetgateways.yaml - bases/ec2.services.k8s.aws_natgateways.yaml - bases/ec2.services.k8s.aws_routetables.yaml diff --git a/config/rbac/cluster-role-controller.yaml b/config/rbac/cluster-role-controller.yaml index 4dede92d..50f4dbda 100644 --- a/config/rbac/cluster-role-controller.yaml +++ b/config/rbac/cluster-role-controller.yaml @@ -72,6 +72,26 @@ rules: - get - patch - update +- apiGroups: + - ec2.services.k8s.aws + resources: + - instances + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - instances/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..e7793f78 100644 --- a/config/rbac/role-reader.yaml +++ b/config/rbac/role-reader.yaml @@ -11,6 +11,7 @@ rules: resources: - dhcpoptions - elasticipaddresses + - instances - internetgateways - natgateways - routetables diff --git a/config/rbac/role-writer.yaml b/config/rbac/role-writer.yaml index 992a763a..0d62a00d 100644 --- a/config/rbac/role-writer.yaml +++ b/config/rbac/role-writer.yaml @@ -11,6 +11,7 @@ rules: resources: - dhcpoptions - elasticipaddresses + - instances - internetgateways - natgateways - routetables @@ -32,6 +33,7 @@ rules: resources: - dhcpoptions - elasticipaddresses + - instances - internetgateways - natgateways - routetables diff --git a/generator.yaml b/generator.yaml index d8c76846..25a04f47 100644 --- a/generator.yaml +++ b/generator.yaml @@ -23,6 +23,13 @@ ignore: # support EC2-VPC only - AllocateAddressInput.Domain - AllocateAddressOutput.Domain + - Instance.ClientToken + - InstanceNetworkInterfaceSpecification.Groups + - RunInstancesInput.AdditionalInfo + - RunInstancesInput.ClientToken + - RunInstancesInput.DryRun + - RunInstancesInput.TagSpecifications + - TerminateInstancesInput.DryRun resource_names: - AccountAttribute - CapacityReservation @@ -38,7 +45,7 @@ ignore: - Fleet - FpgaImage - Image - - Instance + #- Instance - InstanceEventWindow - InstanceExportTask #- InternetGateway @@ -111,12 +118,58 @@ operations: operation_type: - Delete resource_name: VpcEndpoint + RunInstances: + #ouput shape: Reservation + output_wrapper_field_path: Instances + operation_type: + - Create + resource_name: Instance + override_values: + # Hard-code MaxCount and MinCount to 1 so the Reservation + # response can only contain a single instance. This + # instance will be managed by the Instance controller. + # Although RunInstances can handle creating multiple + # instances at once (returning them in a single Reservation), + # a Reservation controller does not align with the declarative state model + # in Kubernetes because users would not be able to update the underlying instances. + MaxCount: 1 + MinCount: 1 + DescribeInstances: + #output shape: DescribeInstancesOutput + output_wrapper_field_path: Reservations.Instances + operation_type: + - List + resource_name: Instance + TerminateInstances: + operation_type: + - Delete + resource_name: Instance resources: DhcpOptions: fields: DHCPConfigurations.Values: set: - from: AttributeValue.Value + Instance: + fields: + HibernationOptions: + late_initialize: {} + MaxCount: + is_required: false + MinCount: + is_required: false + SecurityGroups: + set: + - from: GroupName + Tags: + from: + operation: CreateTags + path: Tags + hooks: + sdk_create_post_build_request: + template_path: hooks/instance/sdk_create_post_build_request.go.tpl + sdk_delete_post_build_request: + template_path: hooks/instance/sdk_delete_post_build_request.go.tpl ElasticIPAddress: exceptions: terminal_codes: diff --git a/helm/crds/ec2.services.k8s.aws_instances.yaml b/helm/crds/ec2.services.k8s.aws_instances.yaml new file mode 100644 index 00000000..fe0cec03 --- /dev/null +++ b/helm/crds/ec2.services.k8s.aws_instances.yaml @@ -0,0 +1,763 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.7.0 + creationTimestamp: null + name: instances.ec2.services.k8s.aws +spec: + group: ec2.services.k8s.aws + names: + kind: Instance + listKind: InstanceList + plural: instances + singular: instance + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Instance is the Schema for the Instances 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: "InstanceSpec defines the desired state of Instance. \n Describes + an instance." + properties: + 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 + 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 + tags: + description: The tags. The value parameter is required, but if you + don't want the tag to have a value, specify the parameter with no + value, and we set the value to an empty string. + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + 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 + type: object + status: + description: InstanceStatus defines the observed state of Instance + 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 + amiLaunchIndex: + description: The AMI launch index, which can be used to find this + instance in the launch group. + format: int64 + type: integer + architecture: + description: The architecture of the image. + type: string + bootMode: + description: The boot mode of the instance. For more information, + see Boot modes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) + in the Amazon EC2 User Guide. + type: string + capacityReservationID: + description: The ID of the Capacity Reservation. + type: string + 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 + elasticGPUAssociations: + description: The Elastic GPU associated with the instance. + 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: + description: The elastic inference accelerator associated with the + instance. + 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: + description: Specifies whether enhanced networking with ENA is enabled. + type: boolean + hypervisor: + description: The hypervisor type of the instance. The value xen is + used for both Xen and Nitro hypervisors. + type: string + instanceID: + description: The ID of the instance. + type: string + instanceLifecycle: + description: Indicates whether this is a Spot Instance or a Scheduled + Instance. + type: string + launchTime: + description: The time the instance was launched. + format: date-time + type: string + licenses: + description: The license configurations for the instance. + items: + description: Describes a license configuration. + properties: + licenseConfigurationARN: + type: string + type: object + type: array + outpostARN: + description: The Amazon Resource Name (ARN) of the Outpost. + type: string + platform: + description: The value is Windows for Windows instances; otherwise + blank. + type: string + platformDetails: + description: The platform details value for the instance. For more + information, see AMI billing information fields (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-info-fields.html) + in the Amazon EC2 User Guide. + type: string + privateDNSName: + description: "(IPv4 only) The private DNS hostname name assigned to + the instance. This DNS hostname can only be used inside the Amazon + EC2 network. This name is not available until the instance enters + the running state. \n [EC2-VPC] The Amazon-provided DNS server resolves + Amazon-provided private DNS hostnames if you've enabled DNS resolution + and DNS hostnames in your VPC. If you are not using the Amazon-provided + DNS server in your VPC, your custom domain name servers must resolve + the hostname as appropriate." + type: string + productCodes: + description: The product codes attached to this instance, if applicable. + items: + description: Describes a product code. + properties: + productCodeID: + type: string + productCodeType: + type: string + type: object + type: array + publicDNSName: + description: (IPv4 only) The public DNS name assigned to the instance. + This name is not available until the instance enters the running + state. For EC2-VPC, this name is only available if you've enabled + DNS hostnames for your VPC. + type: string + publicIPAddress: + description: "The public IPv4 address, or the Carrier IP address assigned + to the instance, if applicable. \n A Carrier IP address only applies + to an instance launched in a subnet associated with a Wavelength + Zone." + type: string + rootDeviceName: + description: The device name of the root device volume (for example, + /dev/sda1). + type: string + rootDeviceType: + description: The root device type used by the AMI. The AMI can use + an EBS volume or an instance store volume. + type: string + sourceDestCheck: + description: Indicates whether source/destination checking is enabled. + type: boolean + spotInstanceRequestID: + description: If the request is a Spot Instance request, the ID of + the request. + type: string + sriovNetSupport: + description: Specifies whether enhanced networking with the Intel + 82599 Virtual Function interface is enabled. + type: string + state: + description: The current state of the instance. + properties: + code: + format: int64 + type: integer + name: + type: string + type: object + stateReason: + description: The reason for the most recent state transition. + properties: + code: + type: string + message: + type: string + type: object + stateTransitionReason: + description: The reason for the most recent state transition. This + might be an empty string. + type: string + usageOperation: + description: The usage operation value for the instance. For more + information, see AMI billing information fields (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-info-fields.html) + in the Amazon EC2 User Guide. + type: string + usageOperationUpdateTime: + description: The time that the usage operation was last updated. + format: date-time + type: string + virtualizationType: + description: The virtualization type of the instance. + type: string + vpcID: + description: '[EC2-VPC] The ID of the VPC in which the instance is + running.' + 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..b235d2fd 100644 --- a/helm/templates/cluster-role-controller.yaml +++ b/helm/templates/cluster-role-controller.yaml @@ -78,6 +78,26 @@ rules: - get - patch - update +- apiGroups: + - ec2.services.k8s.aws + resources: + - instances + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - ec2.services.k8s.aws + resources: + - instances/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..08760026 100644 --- a/helm/templates/role-reader.yaml +++ b/helm/templates/role-reader.yaml @@ -11,6 +11,7 @@ rules: resources: - dhcpoptions - elasticipaddresses + - instances - internetgateways - natgateways - routetables diff --git a/helm/templates/role-writer.yaml b/helm/templates/role-writer.yaml index e48fbedf..86939537 100644 --- a/helm/templates/role-writer.yaml +++ b/helm/templates/role-writer.yaml @@ -13,6 +13,8 @@ rules: - elasticipaddresses + - instances + - internetgateways - natgateways @@ -42,6 +44,7 @@ rules: resources: - dhcpoptions - elasticipaddresses + - instances - internetgateways - natgateways - routetables diff --git a/pkg/resource/instance/delta.go b/pkg/resource/instance/delta.go new file mode 100644 index 00000000..79b63d92 --- /dev/null +++ b/pkg/resource/instance/delta.go @@ -0,0 +1,447 @@ +// 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 instance + +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 !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.Tags, b.ko.Spec.Tags) { + delta.Add("Spec.Tags", a.ko.Spec.Tags, b.ko.Spec.Tags) + } + 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/instance/descriptor.go b/pkg/resource/instance/descriptor.go new file mode 100644 index 00000000..2ef85d73 --- /dev/null +++ b/pkg/resource/instance/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 instance + +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/Instance" +) + +var ( + GroupVersionResource = svcapitypes.GroupVersion.WithResource("instances") + GroupKind = metav1.GroupKind{ + Group: "ec2.services.k8s.aws", + Kind: "Instance", + } +) + +// 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.Instance{} +} + +// 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.Instance), + } +} + +// 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/instance/hooks.go b/pkg/resource/instance/hooks.go new file mode 100644 index 00000000..05253635 --- /dev/null +++ b/pkg/resource/instance/hooks.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. + +package instance + +import ( + "errors" + + svcsdk "github.com/aws/aws-sdk-go/service/ec2" +) + +// addInstanceIDsToTerminateRequest populates the list of InstanceIDs +// in the TerminateInstances request with the resource's InstanceID +// 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.InstanceID == nil { + return errors.New("InstanceID nil for resource when creating TerminateRequest") + } + input.InstanceIds = append(input.InstanceIds, r.ko.Status.InstanceID) + return nil +} + +// updateTagSpecificationsInCreateRequest adds +// Tags defined in the Spec to RunInstancesInput.TagSpecification +// and ensures the ResourceType is always set to 'instance' +func updateTagSpecificationsInCreateRequest(r *resource, + input *svcsdk.RunInstancesInput) { + desiredTagSpecs := svcsdk.TagSpecification{} + if r.ko.Spec.Tags != nil { + instanceTags := []*svcsdk.Tag{} + for _, desiredTag := range r.ko.Spec.Tags { + // Add in tags defined in the Spec + tag := &svcsdk.Tag{} + if desiredTag.Key != nil && desiredTag.Value != nil { + tag.SetKey(*desiredTag.Key) + tag.SetValue(*desiredTag.Value) + } + instanceTags = append(instanceTags, tag) + } + desiredTagSpecs.SetResourceType("instance") + desiredTagSpecs.SetTags(instanceTags) + } + input.TagSpecifications = []*svcsdk.TagSpecification{&desiredTagSpecs} +} diff --git a/pkg/resource/instance/identifiers.go b/pkg/resource/instance/identifiers.go new file mode 100644 index 00000000..6ef79d64 --- /dev/null +++ b/pkg/resource/instance/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 instance + +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/instance/manager.go b/pkg/resource/instance/manager.go new file mode 100644 index 00000000..16f24a26 --- /dev/null +++ b/pkg/resource/instance/manager.go @@ -0,0 +1,331 @@ +// 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 instance + +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=instances,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=ec2.services.k8s.aws,resources=instances/status,verbs=get;update;patch + +var lateInitializeFieldNames = []string{"HibernationOptions"} + +// 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 { + ko := rm.concreteResource(res).ko.DeepCopy() + if ko.Spec.HibernationOptions == nil { + return true + } + 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 { + observedKo := rm.concreteResource(observed).ko.DeepCopy() + latestKo := rm.concreteResource(latest).ko.DeepCopy() + if observedKo.Spec.HibernationOptions != nil && latestKo.Spec.HibernationOptions == nil { + latestKo.Spec.HibernationOptions = observedKo.Spec.HibernationOptions + } + return &resource{latestKo} +} + +// 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/instance/manager_factory.go b/pkg/resource/instance/manager_factory.go new file mode 100644 index 00000000..dbb16bdc --- /dev/null +++ b/pkg/resource/instance/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 instance + +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/instance/references.go b/pkg/resource/instance/references.go new file mode 100644 index 00000000..c8d14142 --- /dev/null +++ b/pkg/resource/instance/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 instance + +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.Instance) error { + return nil +} + +// hasNonNilReferences returns true if resource contains a reference to another +// resource +func hasNonNilReferences(ko *svcapitypes.Instance) bool { + return false +} diff --git a/pkg/resource/instance/resource.go b/pkg/resource/instance/resource.go new file mode 100644 index 00000000..b71b0d19 --- /dev/null +++ b/pkg/resource/instance/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 instance + +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.Instance +} + +// 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.InstanceID = &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/instance/sdk.go b/pkg/resource/instance/sdk.go new file mode 100644 index 00000000..8dee2742 --- /dev/null +++ b/pkg/resource/instance/sdk.go @@ -0,0 +1,1704 @@ +// 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 instance + +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.Instance{} + _ = 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 + } + 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 _, iter0 := range resp.Reservations { + for _, elem := range iter0.Instances { + if elem.AmiLaunchIndex != nil { + ko.Status.AMILaunchIndex = elem.AmiLaunchIndex + } else { + ko.Status.AMILaunchIndex = nil + } + if elem.Architecture != nil { + ko.Status.Architecture = elem.Architecture + } else { + ko.Status.Architecture = nil + } + if elem.BlockDeviceMappings != nil { + f2 := []*svcapitypes.BlockDeviceMapping{} + for _, f2iter := range elem.BlockDeviceMappings { + f2elem := &svcapitypes.BlockDeviceMapping{} + if f2iter.DeviceName != nil { + f2elem.DeviceName = f2iter.DeviceName + } + if f2iter.Ebs != nil { + f2elemf1 := &svcapitypes.EBSBlockDevice{} + if f2iter.Ebs.DeleteOnTermination != nil { + f2elemf1.DeleteOnTermination = f2iter.Ebs.DeleteOnTermination + } + f2elem.EBS = f2elemf1 + } + f2 = append(f2, f2elem) + } + ko.Spec.BlockDeviceMappings = f2 + } else { + ko.Spec.BlockDeviceMappings = nil + } + if elem.BootMode != nil { + ko.Status.BootMode = elem.BootMode + } else { + ko.Status.BootMode = nil + } + if elem.CapacityReservationId != nil { + ko.Status.CapacityReservationID = elem.CapacityReservationId + } else { + ko.Status.CapacityReservationID = nil + } + if elem.CapacityReservationSpecification != nil { + f5 := &svcapitypes.CapacityReservationSpecification{} + if elem.CapacityReservationSpecification.CapacityReservationPreference != nil { + f5.CapacityReservationPreference = elem.CapacityReservationSpecification.CapacityReservationPreference + } + if elem.CapacityReservationSpecification.CapacityReservationTarget != nil { + f5f1 := &svcapitypes.CapacityReservationTarget{} + if elem.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId != nil { + f5f1.CapacityReservationID = elem.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId + } + if elem.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn != nil { + f5f1.CapacityReservationResourceGroupARN = elem.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn + } + f5.CapacityReservationTarget = f5f1 + } + ko.Spec.CapacityReservationSpecification = f5 + } else { + ko.Spec.CapacityReservationSpecification = nil + } + if elem.CpuOptions != nil { + f6 := &svcapitypes.CPUOptionsRequest{} + if elem.CpuOptions.CoreCount != nil { + f6.CoreCount = elem.CpuOptions.CoreCount + } + if elem.CpuOptions.ThreadsPerCore != nil { + f6.ThreadsPerCore = elem.CpuOptions.ThreadsPerCore + } + ko.Spec.CPUOptions = f6 + } else { + ko.Spec.CPUOptions = nil + } + if elem.EbsOptimized != nil { + ko.Spec.EBSOptimized = elem.EbsOptimized + } else { + ko.Spec.EBSOptimized = nil + } + if elem.ElasticGpuAssociations != nil { + f8 := []*svcapitypes.ElasticGPUAssociation{} + for _, f8iter := range elem.ElasticGpuAssociations { + f8elem := &svcapitypes.ElasticGPUAssociation{} + if f8iter.ElasticGpuAssociationId != nil { + f8elem.ElasticGPUAssociationID = f8iter.ElasticGpuAssociationId + } + if f8iter.ElasticGpuAssociationState != nil { + f8elem.ElasticGPUAssociationState = f8iter.ElasticGpuAssociationState + } + if f8iter.ElasticGpuAssociationTime != nil { + f8elem.ElasticGPUAssociationTime = f8iter.ElasticGpuAssociationTime + } + if f8iter.ElasticGpuId != nil { + f8elem.ElasticGPUID = f8iter.ElasticGpuId + } + f8 = append(f8, f8elem) + } + ko.Status.ElasticGPUAssociations = f8 + } else { + ko.Status.ElasticGPUAssociations = nil + } + if elem.ElasticInferenceAcceleratorAssociations != nil { + f9 := []*svcapitypes.ElasticInferenceAcceleratorAssociation{} + for _, f9iter := range elem.ElasticInferenceAcceleratorAssociations { + f9elem := &svcapitypes.ElasticInferenceAcceleratorAssociation{} + if f9iter.ElasticInferenceAcceleratorArn != nil { + f9elem.ElasticInferenceAcceleratorARN = f9iter.ElasticInferenceAcceleratorArn + } + if f9iter.ElasticInferenceAcceleratorAssociationId != nil { + f9elem.ElasticInferenceAcceleratorAssociationID = f9iter.ElasticInferenceAcceleratorAssociationId + } + if f9iter.ElasticInferenceAcceleratorAssociationState != nil { + f9elem.ElasticInferenceAcceleratorAssociationState = f9iter.ElasticInferenceAcceleratorAssociationState + } + if f9iter.ElasticInferenceAcceleratorAssociationTime != nil { + f9elem.ElasticInferenceAcceleratorAssociationTime = &metav1.Time{*f9iter.ElasticInferenceAcceleratorAssociationTime} + } + f9 = append(f9, f9elem) + } + ko.Status.ElasticInferenceAcceleratorAssociations = f9 + } else { + ko.Status.ElasticInferenceAcceleratorAssociations = nil + } + if elem.EnaSupport != nil { + ko.Status.ENASupport = elem.EnaSupport + } else { + ko.Status.ENASupport = nil + } + if elem.EnclaveOptions != nil { + f11 := &svcapitypes.EnclaveOptionsRequest{} + if elem.EnclaveOptions.Enabled != nil { + f11.Enabled = elem.EnclaveOptions.Enabled + } + ko.Spec.EnclaveOptions = f11 + } else { + ko.Spec.EnclaveOptions = nil + } + if elem.HibernationOptions != nil { + f12 := &svcapitypes.HibernationOptionsRequest{} + if elem.HibernationOptions.Configured != nil { + f12.Configured = elem.HibernationOptions.Configured + } + ko.Spec.HibernationOptions = f12 + } else { + ko.Spec.HibernationOptions = nil + } + if elem.Hypervisor != nil { + ko.Status.Hypervisor = elem.Hypervisor + } else { + ko.Status.Hypervisor = nil + } + if elem.IamInstanceProfile != nil { + f14 := &svcapitypes.IAMInstanceProfileSpecification{} + if elem.IamInstanceProfile.Arn != nil { + f14.ARN = elem.IamInstanceProfile.Arn + } + ko.Spec.IAMInstanceProfile = f14 + } else { + ko.Spec.IAMInstanceProfile = nil + } + if elem.ImageId != nil { + ko.Spec.ImageID = elem.ImageId + } else { + ko.Spec.ImageID = nil + } + if elem.InstanceId != nil { + ko.Status.InstanceID = elem.InstanceId + } else { + ko.Status.InstanceID = nil + } + if elem.InstanceLifecycle != nil { + ko.Status.InstanceLifecycle = elem.InstanceLifecycle + } else { + ko.Status.InstanceLifecycle = nil + } + if elem.InstanceType != nil { + ko.Spec.InstanceType = elem.InstanceType + } else { + ko.Spec.InstanceType = nil + } + if elem.KernelId != nil { + ko.Spec.KernelID = elem.KernelId + } else { + ko.Spec.KernelID = nil + } + if elem.KeyName != nil { + ko.Spec.KeyName = elem.KeyName + } else { + ko.Spec.KeyName = nil + } + if elem.LaunchTime != nil { + ko.Status.LaunchTime = &metav1.Time{*elem.LaunchTime} + } else { + ko.Status.LaunchTime = nil + } + if elem.Licenses != nil { + f22 := []*svcapitypes.LicenseConfiguration{} + for _, f22iter := range elem.Licenses { + f22elem := &svcapitypes.LicenseConfiguration{} + if f22iter.LicenseConfigurationArn != nil { + f22elem.LicenseConfigurationARN = f22iter.LicenseConfigurationArn + } + f22 = append(f22, f22elem) + } + ko.Status.Licenses = f22 + } else { + ko.Status.Licenses = nil + } + if elem.MetadataOptions != nil { + f23 := &svcapitypes.InstanceMetadataOptionsRequest{} + if elem.MetadataOptions.HttpEndpoint != nil { + f23.HTTPEndpoint = elem.MetadataOptions.HttpEndpoint + } + if elem.MetadataOptions.HttpProtocolIpv6 != nil { + f23.HTTPProtocolIPv6 = elem.MetadataOptions.HttpProtocolIpv6 + } + if elem.MetadataOptions.HttpPutResponseHopLimit != nil { + f23.HTTPPutResponseHopLimit = elem.MetadataOptions.HttpPutResponseHopLimit + } + if elem.MetadataOptions.HttpTokens != nil { + f23.HTTPTokens = elem.MetadataOptions.HttpTokens + } + ko.Spec.MetadataOptions = f23 + } else { + ko.Spec.MetadataOptions = nil + } + if elem.Monitoring != nil { + f24 := &svcapitypes.RunInstancesMonitoringEnabled{} + ko.Spec.Monitoring = f24 + } else { + ko.Spec.Monitoring = nil + } + if elem.NetworkInterfaces != nil { + f25 := []*svcapitypes.InstanceNetworkInterfaceSpecification{} + for _, f25iter := range elem.NetworkInterfaces { + f25elem := &svcapitypes.InstanceNetworkInterfaceSpecification{} + if f25iter.Description != nil { + f25elem.Description = f25iter.Description + } + if f25iter.InterfaceType != nil { + f25elem.InterfaceType = f25iter.InterfaceType + } + if f25iter.Ipv4Prefixes != nil { + f25elemf5 := []*svcapitypes.IPv4PrefixSpecificationRequest{} + for _, f25elemf5iter := range f25iter.Ipv4Prefixes { + f25elemf5elem := &svcapitypes.IPv4PrefixSpecificationRequest{} + if f25elemf5iter.Ipv4Prefix != nil { + f25elemf5elem.IPv4Prefix = f25elemf5iter.Ipv4Prefix + } + f25elemf5 = append(f25elemf5, f25elemf5elem) + } + f25elem.IPv4Prefixes = f25elemf5 + } + if f25iter.Ipv6Addresses != nil { + f25elemf6 := []*svcapitypes.InstanceIPv6Address{} + for _, f25elemf6iter := range f25iter.Ipv6Addresses { + f25elemf6elem := &svcapitypes.InstanceIPv6Address{} + if f25elemf6iter.Ipv6Address != nil { + f25elemf6elem.IPv6Address = f25elemf6iter.Ipv6Address + } + f25elemf6 = append(f25elemf6, f25elemf6elem) + } + f25elem.IPv6Addresses = f25elemf6 + } + if f25iter.Ipv6Prefixes != nil { + f25elemf7 := []*svcapitypes.IPv6PrefixSpecificationRequest{} + for _, f25elemf7iter := range f25iter.Ipv6Prefixes { + f25elemf7elem := &svcapitypes.IPv6PrefixSpecificationRequest{} + if f25elemf7iter.Ipv6Prefix != nil { + f25elemf7elem.IPv6Prefix = f25elemf7iter.Ipv6Prefix + } + f25elemf7 = append(f25elemf7, f25elemf7elem) + } + f25elem.IPv6Prefixes = f25elemf7 + } + if f25iter.NetworkInterfaceId != nil { + f25elem.NetworkInterfaceID = f25iter.NetworkInterfaceId + } + if f25iter.PrivateIpAddress != nil { + f25elem.PrivateIPAddress = f25iter.PrivateIpAddress + } + if f25iter.PrivateIpAddresses != nil { + f25elemf13 := []*svcapitypes.PrivateIPAddressSpecification{} + for _, f25elemf13iter := range f25iter.PrivateIpAddresses { + f25elemf13elem := &svcapitypes.PrivateIPAddressSpecification{} + if f25elemf13iter.Primary != nil { + f25elemf13elem.Primary = f25elemf13iter.Primary + } + if f25elemf13iter.PrivateIpAddress != nil { + f25elemf13elem.PrivateIPAddress = f25elemf13iter.PrivateIpAddress + } + f25elemf13 = append(f25elemf13, f25elemf13elem) + } + f25elem.PrivateIPAddresses = f25elemf13 + } + if f25iter.SubnetId != nil { + f25elem.SubnetID = f25iter.SubnetId + } + f25 = append(f25, f25elem) + } + ko.Spec.NetworkInterfaces = f25 + } else { + ko.Spec.NetworkInterfaces = nil + } + if elem.OutpostArn != nil { + ko.Status.OutpostARN = elem.OutpostArn + } else { + ko.Status.OutpostARN = nil + } + if elem.Placement != nil { + f27 := &svcapitypes.Placement{} + if elem.Placement.Affinity != nil { + f27.Affinity = elem.Placement.Affinity + } + if elem.Placement.AvailabilityZone != nil { + f27.AvailabilityZone = elem.Placement.AvailabilityZone + } + if elem.Placement.GroupName != nil { + f27.GroupName = elem.Placement.GroupName + } + if elem.Placement.HostId != nil { + f27.HostID = elem.Placement.HostId + } + if elem.Placement.HostResourceGroupArn != nil { + f27.HostResourceGroupARN = elem.Placement.HostResourceGroupArn + } + if elem.Placement.PartitionNumber != nil { + f27.PartitionNumber = elem.Placement.PartitionNumber + } + if elem.Placement.SpreadDomain != nil { + f27.SpreadDomain = elem.Placement.SpreadDomain + } + if elem.Placement.Tenancy != nil { + f27.Tenancy = elem.Placement.Tenancy + } + ko.Spec.Placement = f27 + } else { + ko.Spec.Placement = nil + } + if elem.Platform != nil { + ko.Status.Platform = elem.Platform + } else { + ko.Status.Platform = nil + } + if elem.PlatformDetails != nil { + ko.Status.PlatformDetails = elem.PlatformDetails + } else { + ko.Status.PlatformDetails = nil + } + if elem.PrivateDnsName != nil { + ko.Status.PrivateDNSName = elem.PrivateDnsName + } else { + ko.Status.PrivateDNSName = nil + } + if elem.PrivateIpAddress != nil { + ko.Spec.PrivateIPAddress = elem.PrivateIpAddress + } else { + ko.Spec.PrivateIPAddress = nil + } + if elem.ProductCodes != nil { + f32 := []*svcapitypes.ProductCode{} + for _, f32iter := range elem.ProductCodes { + f32elem := &svcapitypes.ProductCode{} + if f32iter.ProductCodeId != nil { + f32elem.ProductCodeID = f32iter.ProductCodeId + } + if f32iter.ProductCodeType != nil { + f32elem.ProductCodeType = f32iter.ProductCodeType + } + f32 = append(f32, f32elem) + } + ko.Status.ProductCodes = f32 + } else { + ko.Status.ProductCodes = nil + } + if elem.PublicDnsName != nil { + ko.Status.PublicDNSName = elem.PublicDnsName + } else { + ko.Status.PublicDNSName = nil + } + if elem.PublicIpAddress != nil { + ko.Status.PublicIPAddress = elem.PublicIpAddress + } else { + ko.Status.PublicIPAddress = nil + } + if elem.RamdiskId != nil { + ko.Spec.RAMDiskID = elem.RamdiskId + } else { + ko.Spec.RAMDiskID = nil + } + if elem.RootDeviceName != nil { + ko.Status.RootDeviceName = elem.RootDeviceName + } else { + ko.Status.RootDeviceName = nil + } + if elem.RootDeviceType != nil { + ko.Status.RootDeviceType = elem.RootDeviceType + } else { + ko.Status.RootDeviceType = nil + } + if elem.SecurityGroups != nil { + f38 := []*string{} + for _, f38iter := range elem.SecurityGroups { + var f38elem string + f38elem = *f38iter.GroupName + f38 = append(f38, &f38elem) + } + ko.Spec.SecurityGroups = f38 + } else { + ko.Spec.SecurityGroups = nil + } + if elem.SourceDestCheck != nil { + ko.Status.SourceDestCheck = elem.SourceDestCheck + } else { + ko.Status.SourceDestCheck = nil + } + if elem.SpotInstanceRequestId != nil { + ko.Status.SpotInstanceRequestID = elem.SpotInstanceRequestId + } else { + ko.Status.SpotInstanceRequestID = nil + } + if elem.SriovNetSupport != nil { + ko.Status.SRIOVNetSupport = elem.SriovNetSupport + } else { + ko.Status.SRIOVNetSupport = nil + } + if elem.State != nil { + f42 := &svcapitypes.InstanceState{} + if elem.State.Code != nil { + f42.Code = elem.State.Code + } + if elem.State.Name != nil { + f42.Name = elem.State.Name + } + ko.Status.State = f42 + } else { + ko.Status.State = nil + } + if elem.StateReason != nil { + f43 := &svcapitypes.StateReason{} + if elem.StateReason.Code != nil { + f43.Code = elem.StateReason.Code + } + if elem.StateReason.Message != nil { + f43.Message = elem.StateReason.Message + } + ko.Status.StateReason = f43 + } else { + ko.Status.StateReason = nil + } + if elem.StateTransitionReason != nil { + ko.Status.StateTransitionReason = elem.StateTransitionReason + } else { + ko.Status.StateTransitionReason = nil + } + if elem.SubnetId != nil { + ko.Spec.SubnetID = elem.SubnetId + } else { + ko.Spec.SubnetID = nil + } + if elem.Tags != nil { + f46 := []*svcapitypes.Tag{} + for _, f46iter := range elem.Tags { + f46elem := &svcapitypes.Tag{} + if f46iter.Key != nil { + f46elem.Key = f46iter.Key + } + if f46iter.Value != nil { + f46elem.Value = f46iter.Value + } + f46 = append(f46, f46elem) + } + ko.Spec.Tags = f46 + } else { + ko.Spec.Tags = nil + } + if elem.UsageOperation != nil { + ko.Status.UsageOperation = elem.UsageOperation + } else { + ko.Status.UsageOperation = nil + } + if elem.UsageOperationUpdateTime != nil { + ko.Status.UsageOperationUpdateTime = &metav1.Time{*elem.UsageOperationUpdateTime} + } else { + ko.Status.UsageOperationUpdateTime = nil + } + if elem.VirtualizationType != nil { + ko.Status.VirtualizationType = elem.VirtualizationType + } else { + ko.Status.VirtualizationType = nil + } + if elem.VpcId != nil { + ko.Status.VPCID = elem.VpcId + } else { + ko.Status.VPCID = nil + } + found = true + break + } + break + } + if !found { + return nil, ackerr.NotFound + } + + rm.setStatusDefaults(ko) + return &resource{ko}, nil +} + +// requiredFieldsMissingFromReadManyInput returns true if there are any fields +// for the ReadMany Input shape that are required but not present in the +// resource's Spec or Status +func (rm *resourceManager) requiredFieldsMissingFromReadManyInput( + r *resource, +) bool { + return r.ko.Status.InstanceID == nil + +} + +// newListRequestPayload returns SDK-specific struct for the HTTP request +// payload of the List API call for the resource +func (rm *resourceManager) newListRequestPayload( + r *resource, +) (*svcsdk.DescribeInstancesInput, error) { + res := &svcsdk.DescribeInstancesInput{} + + if r.ko.Status.InstanceID != nil { + f2 := []*string{} + f2 = append(f2, r.ko.Status.InstanceID) + res.SetInstanceIds(f2) + } + + 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 + } + updateTagSpecificationsInCreateRequest(desired, input) + + 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() + + found := false + for _, elem := range resp.Instances { + if elem.AmiLaunchIndex != nil { + ko.Status.AMILaunchIndex = elem.AmiLaunchIndex + } else { + ko.Status.AMILaunchIndex = nil + } + if elem.Architecture != nil { + ko.Status.Architecture = elem.Architecture + } else { + ko.Status.Architecture = nil + } + if elem.BlockDeviceMappings != nil { + f2 := []*svcapitypes.BlockDeviceMapping{} + for _, f2iter := range elem.BlockDeviceMappings { + f2elem := &svcapitypes.BlockDeviceMapping{} + if f2iter.DeviceName != nil { + f2elem.DeviceName = f2iter.DeviceName + } + if f2iter.Ebs != nil { + f2elemf1 := &svcapitypes.EBSBlockDevice{} + if f2iter.Ebs.DeleteOnTermination != nil { + f2elemf1.DeleteOnTermination = f2iter.Ebs.DeleteOnTermination + } + f2elem.EBS = f2elemf1 + } + f2 = append(f2, f2elem) + } + ko.Spec.BlockDeviceMappings = f2 + } else { + ko.Spec.BlockDeviceMappings = nil + } + if elem.BootMode != nil { + ko.Status.BootMode = elem.BootMode + } else { + ko.Status.BootMode = nil + } + if elem.CapacityReservationId != nil { + ko.Status.CapacityReservationID = elem.CapacityReservationId + } else { + ko.Status.CapacityReservationID = nil + } + if elem.CapacityReservationSpecification != nil { + f5 := &svcapitypes.CapacityReservationSpecification{} + if elem.CapacityReservationSpecification.CapacityReservationPreference != nil { + f5.CapacityReservationPreference = elem.CapacityReservationSpecification.CapacityReservationPreference + } + if elem.CapacityReservationSpecification.CapacityReservationTarget != nil { + f5f1 := &svcapitypes.CapacityReservationTarget{} + if elem.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId != nil { + f5f1.CapacityReservationID = elem.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId + } + if elem.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn != nil { + f5f1.CapacityReservationResourceGroupARN = elem.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn + } + f5.CapacityReservationTarget = f5f1 + } + ko.Spec.CapacityReservationSpecification = f5 + } else { + ko.Spec.CapacityReservationSpecification = nil + } + if elem.CpuOptions != nil { + f6 := &svcapitypes.CPUOptionsRequest{} + if elem.CpuOptions.CoreCount != nil { + f6.CoreCount = elem.CpuOptions.CoreCount + } + if elem.CpuOptions.ThreadsPerCore != nil { + f6.ThreadsPerCore = elem.CpuOptions.ThreadsPerCore + } + ko.Spec.CPUOptions = f6 + } else { + ko.Spec.CPUOptions = nil + } + if elem.EbsOptimized != nil { + ko.Spec.EBSOptimized = elem.EbsOptimized + } else { + ko.Spec.EBSOptimized = nil + } + if elem.ElasticGpuAssociations != nil { + f8 := []*svcapitypes.ElasticGPUAssociation{} + for _, f8iter := range elem.ElasticGpuAssociations { + f8elem := &svcapitypes.ElasticGPUAssociation{} + if f8iter.ElasticGpuAssociationId != nil { + f8elem.ElasticGPUAssociationID = f8iter.ElasticGpuAssociationId + } + if f8iter.ElasticGpuAssociationState != nil { + f8elem.ElasticGPUAssociationState = f8iter.ElasticGpuAssociationState + } + if f8iter.ElasticGpuAssociationTime != nil { + f8elem.ElasticGPUAssociationTime = f8iter.ElasticGpuAssociationTime + } + if f8iter.ElasticGpuId != nil { + f8elem.ElasticGPUID = f8iter.ElasticGpuId + } + f8 = append(f8, f8elem) + } + ko.Status.ElasticGPUAssociations = f8 + } else { + ko.Status.ElasticGPUAssociations = nil + } + if elem.ElasticInferenceAcceleratorAssociations != nil { + f9 := []*svcapitypes.ElasticInferenceAcceleratorAssociation{} + for _, f9iter := range elem.ElasticInferenceAcceleratorAssociations { + f9elem := &svcapitypes.ElasticInferenceAcceleratorAssociation{} + if f9iter.ElasticInferenceAcceleratorArn != nil { + f9elem.ElasticInferenceAcceleratorARN = f9iter.ElasticInferenceAcceleratorArn + } + if f9iter.ElasticInferenceAcceleratorAssociationId != nil { + f9elem.ElasticInferenceAcceleratorAssociationID = f9iter.ElasticInferenceAcceleratorAssociationId + } + if f9iter.ElasticInferenceAcceleratorAssociationState != nil { + f9elem.ElasticInferenceAcceleratorAssociationState = f9iter.ElasticInferenceAcceleratorAssociationState + } + if f9iter.ElasticInferenceAcceleratorAssociationTime != nil { + f9elem.ElasticInferenceAcceleratorAssociationTime = &metav1.Time{*f9iter.ElasticInferenceAcceleratorAssociationTime} + } + f9 = append(f9, f9elem) + } + ko.Status.ElasticInferenceAcceleratorAssociations = f9 + } else { + ko.Status.ElasticInferenceAcceleratorAssociations = nil + } + if elem.EnaSupport != nil { + ko.Status.ENASupport = elem.EnaSupport + } else { + ko.Status.ENASupport = nil + } + if elem.EnclaveOptions != nil { + f11 := &svcapitypes.EnclaveOptionsRequest{} + if elem.EnclaveOptions.Enabled != nil { + f11.Enabled = elem.EnclaveOptions.Enabled + } + ko.Spec.EnclaveOptions = f11 + } else { + ko.Spec.EnclaveOptions = nil + } + if elem.HibernationOptions != nil { + f12 := &svcapitypes.HibernationOptionsRequest{} + if elem.HibernationOptions.Configured != nil { + f12.Configured = elem.HibernationOptions.Configured + } + ko.Spec.HibernationOptions = f12 + } else { + ko.Spec.HibernationOptions = nil + } + if elem.Hypervisor != nil { + ko.Status.Hypervisor = elem.Hypervisor + } else { + ko.Status.Hypervisor = nil + } + if elem.IamInstanceProfile != nil { + f14 := &svcapitypes.IAMInstanceProfileSpecification{} + if elem.IamInstanceProfile.Arn != nil { + f14.ARN = elem.IamInstanceProfile.Arn + } + ko.Spec.IAMInstanceProfile = f14 + } else { + ko.Spec.IAMInstanceProfile = nil + } + if elem.ImageId != nil { + ko.Spec.ImageID = elem.ImageId + } else { + ko.Spec.ImageID = nil + } + if elem.InstanceId != nil { + ko.Status.InstanceID = elem.InstanceId + } else { + ko.Status.InstanceID = nil + } + if elem.InstanceLifecycle != nil { + ko.Status.InstanceLifecycle = elem.InstanceLifecycle + } else { + ko.Status.InstanceLifecycle = nil + } + if elem.InstanceType != nil { + ko.Spec.InstanceType = elem.InstanceType + } else { + ko.Spec.InstanceType = nil + } + if elem.KernelId != nil { + ko.Spec.KernelID = elem.KernelId + } else { + ko.Spec.KernelID = nil + } + if elem.KeyName != nil { + ko.Spec.KeyName = elem.KeyName + } else { + ko.Spec.KeyName = nil + } + if elem.LaunchTime != nil { + ko.Status.LaunchTime = &metav1.Time{*elem.LaunchTime} + } else { + ko.Status.LaunchTime = nil + } + if elem.Licenses != nil { + f22 := []*svcapitypes.LicenseConfiguration{} + for _, f22iter := range elem.Licenses { + f22elem := &svcapitypes.LicenseConfiguration{} + if f22iter.LicenseConfigurationArn != nil { + f22elem.LicenseConfigurationARN = f22iter.LicenseConfigurationArn + } + f22 = append(f22, f22elem) + } + ko.Status.Licenses = f22 + } else { + ko.Status.Licenses = nil + } + if elem.MetadataOptions != nil { + f23 := &svcapitypes.InstanceMetadataOptionsRequest{} + if elem.MetadataOptions.HttpEndpoint != nil { + f23.HTTPEndpoint = elem.MetadataOptions.HttpEndpoint + } + if elem.MetadataOptions.HttpProtocolIpv6 != nil { + f23.HTTPProtocolIPv6 = elem.MetadataOptions.HttpProtocolIpv6 + } + if elem.MetadataOptions.HttpPutResponseHopLimit != nil { + f23.HTTPPutResponseHopLimit = elem.MetadataOptions.HttpPutResponseHopLimit + } + if elem.MetadataOptions.HttpTokens != nil { + f23.HTTPTokens = elem.MetadataOptions.HttpTokens + } + ko.Spec.MetadataOptions = f23 + } else { + ko.Spec.MetadataOptions = nil + } + if elem.Monitoring != nil { + f24 := &svcapitypes.RunInstancesMonitoringEnabled{} + ko.Spec.Monitoring = f24 + } else { + ko.Spec.Monitoring = nil + } + if elem.NetworkInterfaces != nil { + f25 := []*svcapitypes.InstanceNetworkInterfaceSpecification{} + for _, f25iter := range elem.NetworkInterfaces { + f25elem := &svcapitypes.InstanceNetworkInterfaceSpecification{} + if f25iter.Description != nil { + f25elem.Description = f25iter.Description + } + if f25iter.InterfaceType != nil { + f25elem.InterfaceType = f25iter.InterfaceType + } + if f25iter.Ipv4Prefixes != nil { + f25elemf5 := []*svcapitypes.IPv4PrefixSpecificationRequest{} + for _, f25elemf5iter := range f25iter.Ipv4Prefixes { + f25elemf5elem := &svcapitypes.IPv4PrefixSpecificationRequest{} + if f25elemf5iter.Ipv4Prefix != nil { + f25elemf5elem.IPv4Prefix = f25elemf5iter.Ipv4Prefix + } + f25elemf5 = append(f25elemf5, f25elemf5elem) + } + f25elem.IPv4Prefixes = f25elemf5 + } + if f25iter.Ipv6Addresses != nil { + f25elemf6 := []*svcapitypes.InstanceIPv6Address{} + for _, f25elemf6iter := range f25iter.Ipv6Addresses { + f25elemf6elem := &svcapitypes.InstanceIPv6Address{} + if f25elemf6iter.Ipv6Address != nil { + f25elemf6elem.IPv6Address = f25elemf6iter.Ipv6Address + } + f25elemf6 = append(f25elemf6, f25elemf6elem) + } + f25elem.IPv6Addresses = f25elemf6 + } + if f25iter.Ipv6Prefixes != nil { + f25elemf7 := []*svcapitypes.IPv6PrefixSpecificationRequest{} + for _, f25elemf7iter := range f25iter.Ipv6Prefixes { + f25elemf7elem := &svcapitypes.IPv6PrefixSpecificationRequest{} + if f25elemf7iter.Ipv6Prefix != nil { + f25elemf7elem.IPv6Prefix = f25elemf7iter.Ipv6Prefix + } + f25elemf7 = append(f25elemf7, f25elemf7elem) + } + f25elem.IPv6Prefixes = f25elemf7 + } + if f25iter.NetworkInterfaceId != nil { + f25elem.NetworkInterfaceID = f25iter.NetworkInterfaceId + } + if f25iter.PrivateIpAddress != nil { + f25elem.PrivateIPAddress = f25iter.PrivateIpAddress + } + if f25iter.PrivateIpAddresses != nil { + f25elemf13 := []*svcapitypes.PrivateIPAddressSpecification{} + for _, f25elemf13iter := range f25iter.PrivateIpAddresses { + f25elemf13elem := &svcapitypes.PrivateIPAddressSpecification{} + if f25elemf13iter.Primary != nil { + f25elemf13elem.Primary = f25elemf13iter.Primary + } + if f25elemf13iter.PrivateIpAddress != nil { + f25elemf13elem.PrivateIPAddress = f25elemf13iter.PrivateIpAddress + } + f25elemf13 = append(f25elemf13, f25elemf13elem) + } + f25elem.PrivateIPAddresses = f25elemf13 + } + if f25iter.SubnetId != nil { + f25elem.SubnetID = f25iter.SubnetId + } + f25 = append(f25, f25elem) + } + ko.Spec.NetworkInterfaces = f25 + } else { + ko.Spec.NetworkInterfaces = nil + } + if elem.OutpostArn != nil { + ko.Status.OutpostARN = elem.OutpostArn + } else { + ko.Status.OutpostARN = nil + } + if elem.Placement != nil { + f27 := &svcapitypes.Placement{} + if elem.Placement.Affinity != nil { + f27.Affinity = elem.Placement.Affinity + } + if elem.Placement.AvailabilityZone != nil { + f27.AvailabilityZone = elem.Placement.AvailabilityZone + } + if elem.Placement.GroupName != nil { + f27.GroupName = elem.Placement.GroupName + } + if elem.Placement.HostId != nil { + f27.HostID = elem.Placement.HostId + } + if elem.Placement.HostResourceGroupArn != nil { + f27.HostResourceGroupARN = elem.Placement.HostResourceGroupArn + } + if elem.Placement.PartitionNumber != nil { + f27.PartitionNumber = elem.Placement.PartitionNumber + } + if elem.Placement.SpreadDomain != nil { + f27.SpreadDomain = elem.Placement.SpreadDomain + } + if elem.Placement.Tenancy != nil { + f27.Tenancy = elem.Placement.Tenancy + } + ko.Spec.Placement = f27 + } else { + ko.Spec.Placement = nil + } + if elem.Platform != nil { + ko.Status.Platform = elem.Platform + } else { + ko.Status.Platform = nil + } + if elem.PlatformDetails != nil { + ko.Status.PlatformDetails = elem.PlatformDetails + } else { + ko.Status.PlatformDetails = nil + } + if elem.PrivateDnsName != nil { + ko.Status.PrivateDNSName = elem.PrivateDnsName + } else { + ko.Status.PrivateDNSName = nil + } + if elem.PrivateIpAddress != nil { + ko.Spec.PrivateIPAddress = elem.PrivateIpAddress + } else { + ko.Spec.PrivateIPAddress = nil + } + if elem.ProductCodes != nil { + f32 := []*svcapitypes.ProductCode{} + for _, f32iter := range elem.ProductCodes { + f32elem := &svcapitypes.ProductCode{} + if f32iter.ProductCodeId != nil { + f32elem.ProductCodeID = f32iter.ProductCodeId + } + if f32iter.ProductCodeType != nil { + f32elem.ProductCodeType = f32iter.ProductCodeType + } + f32 = append(f32, f32elem) + } + ko.Status.ProductCodes = f32 + } else { + ko.Status.ProductCodes = nil + } + if elem.PublicDnsName != nil { + ko.Status.PublicDNSName = elem.PublicDnsName + } else { + ko.Status.PublicDNSName = nil + } + if elem.PublicIpAddress != nil { + ko.Status.PublicIPAddress = elem.PublicIpAddress + } else { + ko.Status.PublicIPAddress = nil + } + if elem.RamdiskId != nil { + ko.Spec.RAMDiskID = elem.RamdiskId + } else { + ko.Spec.RAMDiskID = nil + } + if elem.RootDeviceName != nil { + ko.Status.RootDeviceName = elem.RootDeviceName + } else { + ko.Status.RootDeviceName = nil + } + if elem.RootDeviceType != nil { + ko.Status.RootDeviceType = elem.RootDeviceType + } else { + ko.Status.RootDeviceType = nil + } + if elem.SecurityGroups != nil { + f38 := []*string{} + for _, f38iter := range elem.SecurityGroups { + var f38elem string + f38elem = *f38iter.GroupName + f38 = append(f38, &f38elem) + } + ko.Spec.SecurityGroups = f38 + } else { + ko.Spec.SecurityGroups = nil + } + if elem.SourceDestCheck != nil { + ko.Status.SourceDestCheck = elem.SourceDestCheck + } else { + ko.Status.SourceDestCheck = nil + } + if elem.SpotInstanceRequestId != nil { + ko.Status.SpotInstanceRequestID = elem.SpotInstanceRequestId + } else { + ko.Status.SpotInstanceRequestID = nil + } + if elem.SriovNetSupport != nil { + ko.Status.SRIOVNetSupport = elem.SriovNetSupport + } else { + ko.Status.SRIOVNetSupport = nil + } + if elem.State != nil { + f42 := &svcapitypes.InstanceState{} + if elem.State.Code != nil { + f42.Code = elem.State.Code + } + if elem.State.Name != nil { + f42.Name = elem.State.Name + } + ko.Status.State = f42 + } else { + ko.Status.State = nil + } + if elem.StateReason != nil { + f43 := &svcapitypes.StateReason{} + if elem.StateReason.Code != nil { + f43.Code = elem.StateReason.Code + } + if elem.StateReason.Message != nil { + f43.Message = elem.StateReason.Message + } + ko.Status.StateReason = f43 + } else { + ko.Status.StateReason = nil + } + if elem.StateTransitionReason != nil { + ko.Status.StateTransitionReason = elem.StateTransitionReason + } else { + ko.Status.StateTransitionReason = nil + } + if elem.SubnetId != nil { + ko.Spec.SubnetID = elem.SubnetId + } else { + ko.Spec.SubnetID = nil + } + if elem.Tags != nil { + f46 := []*svcapitypes.Tag{} + for _, f46iter := range elem.Tags { + f46elem := &svcapitypes.Tag{} + if f46iter.Key != nil { + f46elem.Key = f46iter.Key + } + if f46iter.Value != nil { + f46elem.Value = f46iter.Value + } + f46 = append(f46, f46elem) + } + ko.Spec.Tags = f46 + } else { + ko.Spec.Tags = nil + } + if elem.UsageOperation != nil { + ko.Status.UsageOperation = elem.UsageOperation + } else { + ko.Status.UsageOperation = nil + } + if elem.UsageOperationUpdateTime != nil { + ko.Status.UsageOperationUpdateTime = &metav1.Time{*elem.UsageOperationUpdateTime} + } else { + ko.Status.UsageOperationUpdateTime = nil + } + if elem.VirtualizationType != nil { + ko.Status.VirtualizationType = elem.VirtualizationType + } else { + ko.Status.VirtualizationType = nil + } + if elem.VpcId != nil { + ko.Status.VPCID = elem.VpcId + } else { + ko.Status.VPCID = nil + } + found = true + break + } + if !found { + return nil, ackerr.NotFound + } + + 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.BlockDeviceMappings != nil { + f0 := []*svcsdk.BlockDeviceMapping{} + for _, f0iter := range r.ko.Spec.BlockDeviceMappings { + f0elem := &svcsdk.BlockDeviceMapping{} + if f0iter.DeviceName != nil { + f0elem.SetDeviceName(*f0iter.DeviceName) + } + if f0iter.EBS != nil { + f0elemf1 := &svcsdk.EbsBlockDevice{} + if f0iter.EBS.DeleteOnTermination != nil { + f0elemf1.SetDeleteOnTermination(*f0iter.EBS.DeleteOnTermination) + } + if f0iter.EBS.Encrypted != nil { + f0elemf1.SetEncrypted(*f0iter.EBS.Encrypted) + } + if f0iter.EBS.IOPS != nil { + f0elemf1.SetIops(*f0iter.EBS.IOPS) + } + if f0iter.EBS.KMSKeyID != nil { + f0elemf1.SetKmsKeyId(*f0iter.EBS.KMSKeyID) + } + if f0iter.EBS.OutpostARN != nil { + f0elemf1.SetOutpostArn(*f0iter.EBS.OutpostARN) + } + if f0iter.EBS.SnapshotID != nil { + f0elemf1.SetSnapshotId(*f0iter.EBS.SnapshotID) + } + if f0iter.EBS.Throughput != nil { + f0elemf1.SetThroughput(*f0iter.EBS.Throughput) + } + if f0iter.EBS.VolumeSize != nil { + f0elemf1.SetVolumeSize(*f0iter.EBS.VolumeSize) + } + if f0iter.EBS.VolumeType != nil { + f0elemf1.SetVolumeType(*f0iter.EBS.VolumeType) + } + f0elem.SetEbs(f0elemf1) + } + if f0iter.NoDevice != nil { + f0elem.SetNoDevice(*f0iter.NoDevice) + } + if f0iter.VirtualName != nil { + f0elem.SetVirtualName(*f0iter.VirtualName) + } + f0 = append(f0, f0elem) + } + res.SetBlockDeviceMappings(f0) + } + if r.ko.Spec.CapacityReservationSpecification != nil { + f1 := &svcsdk.CapacityReservationSpecification{} + if r.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference != nil { + f1.SetCapacityReservationPreference(*r.ko.Spec.CapacityReservationSpecification.CapacityReservationPreference) + } + if r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget != nil { + f1f1 := &svcsdk.CapacityReservationTarget{} + if r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID != nil { + f1f1.SetCapacityReservationId(*r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID) + } + if r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN != nil { + f1f1.SetCapacityReservationResourceGroupArn(*r.ko.Spec.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN) + } + f1.SetCapacityReservationTarget(f1f1) + } + res.SetCapacityReservationSpecification(f1) + } + if r.ko.Spec.CPUOptions != nil { + f2 := &svcsdk.CpuOptionsRequest{} + if r.ko.Spec.CPUOptions.CoreCount != nil { + f2.SetCoreCount(*r.ko.Spec.CPUOptions.CoreCount) + } + if r.ko.Spec.CPUOptions.ThreadsPerCore != nil { + f2.SetThreadsPerCore(*r.ko.Spec.CPUOptions.ThreadsPerCore) + } + res.SetCpuOptions(f2) + } + if r.ko.Spec.CreditSpecification != nil { + f3 := &svcsdk.CreditSpecificationRequest{} + if r.ko.Spec.CreditSpecification.CPUCredits != nil { + f3.SetCpuCredits(*r.ko.Spec.CreditSpecification.CPUCredits) + } + res.SetCreditSpecification(f3) + } + 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 { + f6 := []*svcsdk.ElasticGpuSpecification{} + for _, f6iter := range r.ko.Spec.ElasticGPUSpecification { + f6elem := &svcsdk.ElasticGpuSpecification{} + if f6iter.Type != nil { + f6elem.SetType(*f6iter.Type) + } + f6 = append(f6, f6elem) + } + res.SetElasticGpuSpecification(f6) + } + if r.ko.Spec.ElasticInferenceAccelerators != nil { + f7 := []*svcsdk.ElasticInferenceAccelerator{} + for _, f7iter := range r.ko.Spec.ElasticInferenceAccelerators { + f7elem := &svcsdk.ElasticInferenceAccelerator{} + if f7iter.Count != nil { + f7elem.SetCount(*f7iter.Count) + } + if f7iter.Type != nil { + f7elem.SetType(*f7iter.Type) + } + f7 = append(f7, f7elem) + } + res.SetElasticInferenceAccelerators(f7) + } + if r.ko.Spec.EnclaveOptions != nil { + f8 := &svcsdk.EnclaveOptionsRequest{} + if r.ko.Spec.EnclaveOptions.Enabled != nil { + f8.SetEnabled(*r.ko.Spec.EnclaveOptions.Enabled) + } + res.SetEnclaveOptions(f8) + } + if r.ko.Spec.HibernationOptions != nil { + f9 := &svcsdk.HibernationOptionsRequest{} + if r.ko.Spec.HibernationOptions.Configured != nil { + f9.SetConfigured(*r.ko.Spec.HibernationOptions.Configured) + } + res.SetHibernationOptions(f9) + } + if r.ko.Spec.IAMInstanceProfile != nil { + f10 := &svcsdk.IamInstanceProfileSpecification{} + if r.ko.Spec.IAMInstanceProfile.ARN != nil { + f10.SetArn(*r.ko.Spec.IAMInstanceProfile.ARN) + } + if r.ko.Spec.IAMInstanceProfile.Name != nil { + f10.SetName(*r.ko.Spec.IAMInstanceProfile.Name) + } + res.SetIamInstanceProfile(f10) + } + 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 { + f13 := &svcsdk.InstanceMarketOptionsRequest{} + if r.ko.Spec.InstanceMarketOptions.MarketType != nil { + f13.SetMarketType(*r.ko.Spec.InstanceMarketOptions.MarketType) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions != nil { + f13f1 := &svcsdk.SpotMarketOptions{} + if r.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil { + f13f1.SetBlockDurationMinutes(*r.ko.Spec.InstanceMarketOptions.SpotOptions.BlockDurationMinutes) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil { + f13f1.SetInstanceInterruptionBehavior(*r.ko.Spec.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice != nil { + f13f1.SetMaxPrice(*r.ko.Spec.InstanceMarketOptions.SpotOptions.MaxPrice) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil { + f13f1.SetSpotInstanceType(*r.ko.Spec.InstanceMarketOptions.SpotOptions.SpotInstanceType) + } + if r.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil != nil { + f13f1.SetValidUntil(r.ko.Spec.InstanceMarketOptions.SpotOptions.ValidUntil.Time) + } + f13.SetSpotOptions(f13f1) + } + res.SetInstanceMarketOptions(f13) + } + 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 { + f16 := []*svcsdk.InstanceIpv6Address{} + for _, f16iter := range r.ko.Spec.IPv6Addresses { + f16elem := &svcsdk.InstanceIpv6Address{} + if f16iter.IPv6Address != nil { + f16elem.SetIpv6Address(*f16iter.IPv6Address) + } + f16 = append(f16, f16elem) + } + res.SetIpv6Addresses(f16) + } + 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 { + f19 := &svcsdk.LaunchTemplateSpecification{} + if r.ko.Spec.LaunchTemplate.LaunchTemplateID != nil { + f19.SetLaunchTemplateId(*r.ko.Spec.LaunchTemplate.LaunchTemplateID) + } + if r.ko.Spec.LaunchTemplate.LaunchTemplateName != nil { + f19.SetLaunchTemplateName(*r.ko.Spec.LaunchTemplate.LaunchTemplateName) + } + if r.ko.Spec.LaunchTemplate.Version != nil { + f19.SetVersion(*r.ko.Spec.LaunchTemplate.Version) + } + res.SetLaunchTemplate(f19) + } + if r.ko.Spec.LicenseSpecifications != nil { + f20 := []*svcsdk.LicenseConfigurationRequest{} + for _, f20iter := range r.ko.Spec.LicenseSpecifications { + f20elem := &svcsdk.LicenseConfigurationRequest{} + if f20iter.LicenseConfigurationARN != nil { + f20elem.SetLicenseConfigurationArn(*f20iter.LicenseConfigurationARN) + } + f20 = append(f20, f20elem) + } + res.SetLicenseSpecifications(f20) + } + res.SetMaxCount(1) + if r.ko.Spec.MetadataOptions != nil { + f22 := &svcsdk.InstanceMetadataOptionsRequest{} + if r.ko.Spec.MetadataOptions.HTTPEndpoint != nil { + f22.SetHttpEndpoint(*r.ko.Spec.MetadataOptions.HTTPEndpoint) + } + if r.ko.Spec.MetadataOptions.HTTPProtocolIPv6 != nil { + f22.SetHttpProtocolIpv6(*r.ko.Spec.MetadataOptions.HTTPProtocolIPv6) + } + if r.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit != nil { + f22.SetHttpPutResponseHopLimit(*r.ko.Spec.MetadataOptions.HTTPPutResponseHopLimit) + } + if r.ko.Spec.MetadataOptions.HTTPTokens != nil { + f22.SetHttpTokens(*r.ko.Spec.MetadataOptions.HTTPTokens) + } + res.SetMetadataOptions(f22) + } + res.SetMinCount(1) + if r.ko.Spec.Monitoring != nil { + f24 := &svcsdk.RunInstancesMonitoringEnabled{} + if r.ko.Spec.Monitoring.Enabled != nil { + f24.SetEnabled(*r.ko.Spec.Monitoring.Enabled) + } + res.SetMonitoring(f24) + } + if r.ko.Spec.NetworkInterfaces != nil { + f25 := []*svcsdk.InstanceNetworkInterfaceSpecification{} + for _, f25iter := range r.ko.Spec.NetworkInterfaces { + f25elem := &svcsdk.InstanceNetworkInterfaceSpecification{} + if f25iter.AssociateCarrierIPAddress != nil { + f25elem.SetAssociateCarrierIpAddress(*f25iter.AssociateCarrierIPAddress) + } + if f25iter.AssociatePublicIPAddress != nil { + f25elem.SetAssociatePublicIpAddress(*f25iter.AssociatePublicIPAddress) + } + if f25iter.DeleteOnTermination != nil { + f25elem.SetDeleteOnTermination(*f25iter.DeleteOnTermination) + } + if f25iter.Description != nil { + f25elem.SetDescription(*f25iter.Description) + } + if f25iter.DeviceIndex != nil { + f25elem.SetDeviceIndex(*f25iter.DeviceIndex) + } + if f25iter.InterfaceType != nil { + f25elem.SetInterfaceType(*f25iter.InterfaceType) + } + if f25iter.IPv4PrefixCount != nil { + f25elem.SetIpv4PrefixCount(*f25iter.IPv4PrefixCount) + } + if f25iter.IPv4Prefixes != nil { + f25elemf7 := []*svcsdk.Ipv4PrefixSpecificationRequest{} + for _, f25elemf7iter := range f25iter.IPv4Prefixes { + f25elemf7elem := &svcsdk.Ipv4PrefixSpecificationRequest{} + if f25elemf7iter.IPv4Prefix != nil { + f25elemf7elem.SetIpv4Prefix(*f25elemf7iter.IPv4Prefix) + } + f25elemf7 = append(f25elemf7, f25elemf7elem) + } + f25elem.SetIpv4Prefixes(f25elemf7) + } + if f25iter.IPv6AddressCount != nil { + f25elem.SetIpv6AddressCount(*f25iter.IPv6AddressCount) + } + if f25iter.IPv6Addresses != nil { + f25elemf9 := []*svcsdk.InstanceIpv6Address{} + for _, f25elemf9iter := range f25iter.IPv6Addresses { + f25elemf9elem := &svcsdk.InstanceIpv6Address{} + if f25elemf9iter.IPv6Address != nil { + f25elemf9elem.SetIpv6Address(*f25elemf9iter.IPv6Address) + } + f25elemf9 = append(f25elemf9, f25elemf9elem) + } + f25elem.SetIpv6Addresses(f25elemf9) + } + if f25iter.IPv6PrefixCount != nil { + f25elem.SetIpv6PrefixCount(*f25iter.IPv6PrefixCount) + } + if f25iter.IPv6Prefixes != nil { + f25elemf11 := []*svcsdk.Ipv6PrefixSpecificationRequest{} + for _, f25elemf11iter := range f25iter.IPv6Prefixes { + f25elemf11elem := &svcsdk.Ipv6PrefixSpecificationRequest{} + if f25elemf11iter.IPv6Prefix != nil { + f25elemf11elem.SetIpv6Prefix(*f25elemf11iter.IPv6Prefix) + } + f25elemf11 = append(f25elemf11, f25elemf11elem) + } + f25elem.SetIpv6Prefixes(f25elemf11) + } + if f25iter.NetworkCardIndex != nil { + f25elem.SetNetworkCardIndex(*f25iter.NetworkCardIndex) + } + if f25iter.NetworkInterfaceID != nil { + f25elem.SetNetworkInterfaceId(*f25iter.NetworkInterfaceID) + } + if f25iter.PrivateIPAddress != nil { + f25elem.SetPrivateIpAddress(*f25iter.PrivateIPAddress) + } + if f25iter.PrivateIPAddresses != nil { + f25elemf15 := []*svcsdk.PrivateIpAddressSpecification{} + for _, f25elemf15iter := range f25iter.PrivateIPAddresses { + f25elemf15elem := &svcsdk.PrivateIpAddressSpecification{} + if f25elemf15iter.Primary != nil { + f25elemf15elem.SetPrimary(*f25elemf15iter.Primary) + } + if f25elemf15iter.PrivateIPAddress != nil { + f25elemf15elem.SetPrivateIpAddress(*f25elemf15iter.PrivateIPAddress) + } + f25elemf15 = append(f25elemf15, f25elemf15elem) + } + f25elem.SetPrivateIpAddresses(f25elemf15) + } + if f25iter.SecondaryPrivateIPAddressCount != nil { + f25elem.SetSecondaryPrivateIpAddressCount(*f25iter.SecondaryPrivateIPAddressCount) + } + if f25iter.SubnetID != nil { + f25elem.SetSubnetId(*f25iter.SubnetID) + } + f25 = append(f25, f25elem) + } + res.SetNetworkInterfaces(f25) + } + if r.ko.Spec.Placement != nil { + f26 := &svcsdk.Placement{} + if r.ko.Spec.Placement.Affinity != nil { + f26.SetAffinity(*r.ko.Spec.Placement.Affinity) + } + if r.ko.Spec.Placement.AvailabilityZone != nil { + f26.SetAvailabilityZone(*r.ko.Spec.Placement.AvailabilityZone) + } + if r.ko.Spec.Placement.GroupName != nil { + f26.SetGroupName(*r.ko.Spec.Placement.GroupName) + } + if r.ko.Spec.Placement.HostID != nil { + f26.SetHostId(*r.ko.Spec.Placement.HostID) + } + if r.ko.Spec.Placement.HostResourceGroupARN != nil { + f26.SetHostResourceGroupArn(*r.ko.Spec.Placement.HostResourceGroupARN) + } + if r.ko.Spec.Placement.PartitionNumber != nil { + f26.SetPartitionNumber(*r.ko.Spec.Placement.PartitionNumber) + } + if r.ko.Spec.Placement.SpreadDomain != nil { + f26.SetSpreadDomain(*r.ko.Spec.Placement.SpreadDomain) + } + if r.ko.Spec.Placement.Tenancy != nil { + f26.SetTenancy(*r.ko.Spec.Placement.Tenancy) + } + res.SetPlacement(f26) + } + 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 { + f29 := []*string{} + for _, f29iter := range r.ko.Spec.SecurityGroupIDs { + var f29elem string + f29elem = *f29iter + f29 = append(f29, &f29elem) + } + res.SetSecurityGroupIds(f29) + } + if r.ko.Spec.SecurityGroups != nil { + f30 := []*string{} + for _, f30iter := range r.ko.Spec.SecurityGroups { + var f30elem string + f30elem = *f30iter + f30 = append(f30, &f30elem) + } + res.SetSecurityGroups(f30) + } + if r.ko.Spec.SubnetID != nil { + res.SetSubnetId(*r.ko.Spec.SubnetID) + } + 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.Instance, +) { + 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/instance/sdk_create_post_build_request.go.tpl b/templates/hooks/instance/sdk_create_post_build_request.go.tpl new file mode 100644 index 00000000..31eec6c0 --- /dev/null +++ b/templates/hooks/instance/sdk_create_post_build_request.go.tpl @@ -0,0 +1 @@ + updateTagSpecificationsInCreateRequest(desired, input) \ No newline at end of file diff --git a/templates/hooks/instance/sdk_delete_post_build_request.go.tpl b/templates/hooks/instance/sdk_delete_post_build_request.go.tpl new file mode 100644 index 00000000..ed6c7e22 --- /dev/null +++ b/templates/hooks/instance/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/test/e2e/resources/instance.yaml b/test/e2e/resources/instance.yaml new file mode 100644 index 00000000..3a9f2ab5 --- /dev/null +++ b/test/e2e/resources/instance.yaml @@ -0,0 +1,11 @@ +apiVersion: ec2.services.k8s.aws/v1alpha1 +kind: Instance +metadata: + name: $INSTANCE_NAME +spec: + imageID: $INSTANCE_AMI_ID + instanceType: $INSTANCE_TYPE + subnetID: $INSTANCE_SUBNET_ID + tags: + - key: $INSTANCE_TAG_KEY + value: $INSTANCE_TAG_VAL \ No newline at end of file diff --git a/test/e2e/tests/test_instance.py b/test/e2e/tests/test_instance.py new file mode 100644 index 00000000..bc9d746d --- /dev/null +++ b/test/e2e/tests/test_instance.py @@ -0,0 +1,165 @@ +# 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 Instance 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 = "instances" +# highly available instance type for deterministic testing +INSTANCE_TYPE = "m4.large" +INSTANCE_AMI = "Amazon Linux 2 Kernel" +INSTANCE_TAG_KEY = "owner" +INSTANCE_TAG_VAL = "ack-controller" + +CREATE_WAIT_AFTER_SECONDS = 10 +DELETE_WAIT_AFTER_SECONDS = 10 +TIMEOUT_SECONDS = 300 + +def get_instance(ec2_client, instance_id: str) -> dict: + instance = None + try: + resp = ec2_client.describe_instances( + InstanceIds=[instance_id] + ) + instance = resp["Reservations"][0]["Instances"][0] + except Exception as e: + logging.debug(e) + finally: + return instance + +def get_instance_state(ec2_client, instance_id): + instance_state = None + try: + instance = get_instance(ec2_client, instance_id) + instance_state = instance["State"]["Name"] + except Exception as e: + logging.debug(e) + finally: + return instance_state + +def wait_for_instance_or_die(ec2_client, instance_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_state = get_instance_state(ec2_client, instance_id) + if instance_state == desired_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) + + +@pytest.fixture +def instance(ec2_client): + test_resource_values = REPLACEMENT_VALUES.copy() + resource_name = random_suffix_name("instance-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["INSTANCE_NAME"] = resource_name + test_resource_values["INSTANCE_AMI_ID"] = ami_id + test_resource_values["INSTANCE_TYPE"] = INSTANCE_TYPE + test_resource_values["INSTANCE_SUBNET_ID"] = subnet_id + test_resource_values["INSTANCE_TAG_KEY"] = INSTANCE_TAG_KEY + test_resource_values["INSTANCE_TAG_VAL"] = INSTANCE_TAG_VAL + + # Load Instance CR + resource_data = load_ec2_resource( + "instance", + 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) + + yield (ref, cr) + + # Delete the instance when tests complete + try: + _, deleted = k8s.delete_custom_resource(ref, 3, 10) + assert deleted + except: + pass + +@service_marker +@pytest.mark.canary +class TestInstance: + def test_create_delete(self, ec2_client, instance): + (ref, cr) = instance + resource_id = cr["status"]["instanceID"] + + time.sleep(CREATE_WAIT_AFTER_SECONDS) + + # Check Instance exists + instance = get_instance(ec2_client, resource_id) + assert instance is not None + + # Give time for instance to come up + wait_for_instance_or_die(ec2_client, resource_id, 'running', TIMEOUT_SECONDS) + + # Validate instance tags + instance_tags = instance["Tags"] + tag_present = False + for t in instance_tags: + if (t['Key'] == INSTANCE_TAG_KEY and + t['Value'] == INSTANCE_TAG_VAL): + tag_present = True + assert tag_present + + # Delete k8s resource + _, deleted = k8s.delete_custom_resource(ref, 2, 5) + assert deleted is True + + # Reservation still exists, but instance will commence termination + # State needs to be 'terminated' in order to remove the dependency on the shared subnet + # for successful test cleanup + wait_for_instance_or_die(ec2_client, resource_id, 'terminated', TIMEOUT_SECONDS) \ No newline at end of file