diff --git a/apis/ec2/manualv1alpha1/instances_types.go b/apis/ec2/manualv1alpha1/instances_types.go index eb4588d624..6e4b09f13a 100644 --- a/apis/ec2/manualv1alpha1/instances_types.go +++ b/apis/ec2/manualv1alpha1/instances_types.go @@ -229,6 +229,9 @@ type InstanceParameters struct { // If you specify a network interface, you must specify any security groups // as part of the network interface. // +optional + // +crossplane:generate:reference:type=github.com/crossplane/provider-aws/apis/ec2/v1beta1.SecurityGroup + // +crossplane:generate:reference:refFieldName=SecurityGroupRefs + // +crossplane:generate:reference:selectorFieldName=SecurityGroupSelector SecurityGroupIDs []string `json:"securityGroupIds,omitempty"` // SecurityGroupsRefs is a list of references to SecurityGroups used to set @@ -246,6 +249,7 @@ type InstanceParameters struct { // If you specify a network interface, you must specify any subnets as part // of the network interface. // +optional + // +crossplane:generate:reference:type=github.com/crossplane/provider-aws/apis/ec2/v1beta1.Subnet SubnetID *string `json:"subnetId,omitempty"` // SubnetIDRef is a reference to a Subnet used to set the SubnetID. diff --git a/apis/ec2/manualv1alpha1/referencers.go b/apis/ec2/manualv1alpha1/zz_generated.resolvers.go similarity index 52% rename from apis/ec2/manualv1alpha1/referencers.go rename to apis/ec2/manualv1alpha1/zz_generated.resolvers.go index 6c16ac948d..821e19b479 100644 --- a/apis/ec2/manualv1alpha1/referencers.go +++ b/apis/ec2/manualv1alpha1/zz_generated.resolvers.go @@ -14,49 +14,56 @@ See the License for the specific language governing permissions and limitations under the License. */ +// Code generated by angryjet. DO NOT EDIT. + package manualv1alpha1 import ( "context" - - "github.com/aws/aws-sdk-go/aws" - "github.com/crossplane/crossplane-runtime/pkg/reference" - "github.com/pkg/errors" - "sigs.k8s.io/controller-runtime/pkg/client" - - "github.com/crossplane/provider-aws/apis/ec2/v1beta1" + reference "github.com/crossplane/crossplane-runtime/pkg/reference" + v1beta1 "github.com/crossplane/provider-aws/apis/ec2/v1beta1" + errors "github.com/pkg/errors" + client "sigs.k8s.io/controller-runtime/pkg/client" ) -// ResolveReferences of this Instance +// ResolveReferences of this Instance. func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) error { r := reference.NewAPIResolver(c, mg) - // Resolve spec.forProvider.securityGroups - rg, err := r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + var rsp reference.ResolutionResponse + var mrsp reference.MultiResolutionResponse + var err error + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ CurrentValues: mg.Spec.ForProvider.SecurityGroupIDs, + Extract: reference.ExternalName(), References: mg.Spec.ForProvider.SecurityGroupRefs, Selector: mg.Spec.ForProvider.SecurityGroupSelector, - To: reference.To{Managed: &v1beta1.SecurityGroup{}, List: &v1beta1.SecurityGroupList{}}, - Extract: reference.ExternalName(), + To: reference.To{ + List: &v1beta1.SecurityGroupList{}, + Managed: &v1beta1.SecurityGroup{}, + }, }) if err != nil { - return errors.Wrap(err, "spec.forProvider.securityGroupIDs") + return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIDs") } - mg.Spec.ForProvider.SecurityGroupIDs = rg.ResolvedValues - mg.Spec.ForProvider.SecurityGroupRefs = rg.ResolvedReferences + mg.Spec.ForProvider.SecurityGroupIDs = mrsp.ResolvedValues + mg.Spec.ForProvider.SecurityGroupRefs = mrsp.ResolvedReferences - // Resolve spec.forProvider.subnetId - rsp, err := r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: aws.StringValue(mg.Spec.ForProvider.SubnetID), + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), Reference: mg.Spec.ForProvider.SubnetIDRef, Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{Managed: &v1beta1.Subnet{}, List: &v1beta1.SubnetList{}}, - Extract: reference.ExternalName(), + To: reference.To{ + List: &v1beta1.SubnetList{}, + Managed: &v1beta1.Subnet{}, + }, }) if err != nil { - return errors.Wrapf(err, "spec.forProvider.subnetId") + return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } - mg.Spec.ForProvider.SubnetID = aws.String(rsp.ResolvedValue) + mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference return nil diff --git a/apis/ec2/v1alpha1/custom_types.go b/apis/ec2/v1alpha1/custom_types.go index 0873ef8811..30cd369ba2 100644 --- a/apis/ec2/v1alpha1/custom_types.go +++ b/apis/ec2/v1alpha1/custom_types.go @@ -20,6 +20,39 @@ import ( xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" ) +// CustomLaunchTemplateParameters includes the custom fields of LaunchTemplate. +type CustomLaunchTemplateParameters struct { + // Metadata tagging key value pairs + // +optional + Tags []Tag `json:"tags,omitempty"` +} + +// CustomLaunchTemplateVersionParameters includes the custom fields of LaunchTemplateVersion. +type CustomLaunchTemplateVersionParameters struct { + // The ID of the Launch Template. You must specify this parameter in the request. + // +crossplane:generate:reference:type=LaunchTemplate + LaunchTemplateID *string `json:"launchTemplateId,omitempty"` + // LaunchTemplateIDRef is a reference to an API used to set + // the LaunchTemplateID. + // +optional + LaunchTemplateIDRef *xpv1.Reference `json:"launchTemplateIdRef,omitempty"` + // LaunchTemplateIDSelector selects references to API used + // to set the LaunchTemplateID. + // +optional + LaunchTemplateIDSelector *xpv1.Selector `json:"launchTemplateIdSelector,omitempty"` + // The Name of the Launch Template. You must specify this parameter in the request. + // +crossplane:generate:reference:type=LaunchTemplate + LaunchTemplateName *string `json:"launchTemplateName,omitempty"` + // LaunchTemplateNameRef is a reference to an API used to set + // the LaunchTemplateName. + // +optional + LaunchTemplateNameRef *xpv1.Reference `json:"launchTemplateNameRef,omitempty"` + // LaunchTemplateNameSelector selects references to API used + // to set the LaunchTemplateName. + // +optional + LaunchTemplateNameSelector *xpv1.Selector `json:"launchTemplateNameSelector,omitempty"` +} + // CustomVolumeParameters contains the additional fields for VolumeParameters. type CustomVolumeParameters struct { // The identifier of the AWS Key Management Service (AWS KMS) customer master diff --git a/apis/ec2/v1alpha1/generator-config.yaml b/apis/ec2/v1alpha1/generator-config.yaml index bb0012192b..3079f05c20 100644 --- a/apis/ec2/v1alpha1/generator-config.yaml +++ b/apis/ec2/v1alpha1/generator-config.yaml @@ -17,8 +17,6 @@ ignore: - InstanceExportTask - InternetGateway - KeyPair - - LaunchTemplateVersion - - LaunchTemplate - LocalGatewayRouteTableVpcAssociation - LocalGatewayRoute - ManagedPrefixList @@ -101,9 +99,27 @@ ignore: - CreateVpcEndpointInput.DryRun - CreateVpcEndpointInput.RouteTableIds - Subnet.AvailableIpAddressCount + - CreateLaunchTemplateVersionInput.LaunchTemplateId + - DeleteLaunchTemplateVersionInput.LaunchTemplateId + - CreateLaunchTemplateVersionInput.LaunchTemplateName + - DeleteLaunchTemplateVersionInput.LaunchTemplateName + - CreateLaunchTemplateVersionInput.DryRun + - CreateLaunchTemplateVersionInput.ClientToken + - CreateLaunchTemplateInput.DryRun + - CreateLaunchTemplateInput.ClientToken resources: Volume: exceptions: errors: 404: code: InvalidVolume.NotFound + LaunchTemplate: + exceptions: + errors: + 404: + code: InvalidLaunchTemplateName.NotFoundException + LaunchTemplateVersion: + exceptions: + errors: + 404: + code: InvalidLaunchTemplateId.VersionNotFound diff --git a/apis/ec2/v1alpha1/zz_generated.deepcopy.go b/apis/ec2/v1alpha1/zz_generated.deepcopy.go index 39fe2715ea..3a48d7cda5 100644 --- a/apis/ec2/v1alpha1/zz_generated.deepcopy.go +++ b/apis/ec2/v1alpha1/zz_generated.deepcopy.go @@ -1157,9 +1157,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) @@ -2029,6 +2084,26 @@ func (in *CreateFleetError) DeepCopy() *CreateFleetError { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CreateFleetInstance) DeepCopyInto(out *CreateFleetInstance) { + *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 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 *CreateTransitGatewayVPCAttachmentRequestOptions) DeepCopyInto(out *CreateTransitGatewayVPCAttachmentRequestOptions) { *out = *in @@ -2119,6 +2194,73 @@ func (in *CreditSpecificationRequest) DeepCopy() *CreditSpecificationRequest { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomLaunchTemplateParameters) DeepCopyInto(out *CustomLaunchTemplateParameters) { + *out = *in + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]Tag, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomLaunchTemplateParameters. +func (in *CustomLaunchTemplateParameters) DeepCopy() *CustomLaunchTemplateParameters { + if in == nil { + return nil + } + out := new(CustomLaunchTemplateParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomLaunchTemplateVersionParameters) DeepCopyInto(out *CustomLaunchTemplateVersionParameters) { + *out = *in + if in.LaunchTemplateID != nil { + in, out := &in.LaunchTemplateID, &out.LaunchTemplateID + *out = new(string) + **out = **in + } + if in.LaunchTemplateIDRef != nil { + in, out := &in.LaunchTemplateIDRef, &out.LaunchTemplateIDRef + *out = new(v1.Reference) + **out = **in + } + if in.LaunchTemplateIDSelector != nil { + in, out := &in.LaunchTemplateIDSelector, &out.LaunchTemplateIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.LaunchTemplateName != nil { + in, out := &in.LaunchTemplateName, &out.LaunchTemplateName + *out = new(string) + **out = **in + } + if in.LaunchTemplateNameRef != nil { + in, out := &in.LaunchTemplateNameRef, &out.LaunchTemplateNameRef + *out = new(v1.Reference) + **out = **in + } + if in.LaunchTemplateNameSelector != nil { + in, out := &in.LaunchTemplateNameSelector, &out.LaunchTemplateNameSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomLaunchTemplateVersionParameters. +func (in *CustomLaunchTemplateVersionParameters) DeepCopy() *CustomLaunchTemplateVersionParameters { + if in == nil { + return nil + } + out := new(CustomLaunchTemplateVersionParameters) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CustomRouteParameters) DeepCopyInto(out *CustomRouteParameters) { *out = *in @@ -2855,6 +2997,26 @@ 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 + } +} + +// 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 *DirectoryServiceAuthentication) DeepCopyInto(out *DirectoryServiceAuthentication) { *out = *in @@ -4185,6 +4347,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) @@ -4215,6 +4382,11 @@ 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) @@ -4245,6 +4417,11 @@ func (in *FleetLaunchTemplateSpecification) DeepCopyInto(out *FleetLaunchTemplat *out = new(string) **out = **in } + if in.LaunchTemplateName != nil { + in, out := &in.LaunchTemplateName, &out.LaunchTemplateName + *out = new(string) + **out = **in + } if in.Version != nil { in, out := &in.Version, &out.Version *out = new(string) @@ -4265,6 +4442,16 @@ 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.LaunchTemplateName != nil { + in, out := &in.LaunchTemplateName, &out.LaunchTemplateName + *out = new(string) + **out = **in + } if in.Version != nil { in, out := &in.Version, &out.Version *out = new(string) @@ -5322,6 +5509,38 @@ func (in *ImportInstanceLaunchSpecification) DeepCopyInto(out *ImportInstanceLau *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) @@ -5705,6 +5924,26 @@ func (in *InstanceIPv6AddressRequest) DeepCopy() *InstanceIPv6AddressRequest { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceMarketOptionsRequest) DeepCopyInto(out *InstanceMarketOptionsRequest) { + *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 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 @@ -5778,6 +6017,17 @@ func (in *InstanceNetworkInterface) DeepCopyInto(out *InstanceNetworkInterface) *out = new(string) **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.MacAddress != nil { in, out := &in.MacAddress, &out.MacAddress *out = new(string) @@ -5932,6 +6182,17 @@ func (in *InstanceNetworkInterfaceSpecification) DeepCopyInto(out *InstanceNetwo *out = new(int64) **out = **in } + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } if in.InterfaceType != nil { in, out := &in.InterfaceType, &out.InterfaceType *out = new(string) @@ -5942,6 +6203,17 @@ func (in *InstanceNetworkInterfaceSpecification) DeepCopyInto(out *InstanceNetwo *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.NetworkCardIndex != nil { in, out := &in.NetworkCardIndex, &out.NetworkCardIndex *out = new(int64) @@ -5957,6 +6229,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) @@ -6170,6 +6453,46 @@ 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 *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 @@ -6355,6 +6678,11 @@ func (in *LaunchSpecification) DeepCopyInto(out *LaunchSpecification) { *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) @@ -6395,41 +6723,10 @@ func (in *LaunchSpecification) DeepCopy() *LaunchSpecification { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplate) DeepCopyInto(out *LaunchTemplate) { *out = *in - if in.CreateTime != nil { - in, out := &in.CreateTime, &out.CreateTime - *out = (*in).DeepCopy() - } - if in.CreatedBy != nil { - in, out := &in.CreatedBy, &out.CreatedBy - *out = new(string) - **out = **in - } - if in.DefaultVersionNumber != nil { - in, out := &in.DefaultVersionNumber, &out.DefaultVersionNumber - *out = new(int64) - **out = **in - } - if in.LatestVersionNumber != nil { - in, out := &in.LatestVersionNumber, &out.LatestVersionNumber - *out = new(int64) - **out = **in - } - if in.LaunchTemplateID != nil { - in, out := &in.LaunchTemplateID, &out.LaunchTemplateID - *out = new(string) - **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) - } - } - } + 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 LaunchTemplate. @@ -6442,6 +6739,14 @@ func (in *LaunchTemplate) DeepCopy() *LaunchTemplate { return out } +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LaunchTemplate) 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 *LaunchTemplateBlockDeviceMapping) DeepCopyInto(out *LaunchTemplateBlockDeviceMapping) { *out = *in @@ -6450,6 +6755,11 @@ func (in *LaunchTemplateBlockDeviceMapping) DeepCopyInto(out *LaunchTemplateBloc *out = new(string) **out = **in } + if in.EBS != nil { + in, out := &in.EBS, &out.EBS + *out = new(LaunchTemplateEBSBlockDevice) + (*in).DeepCopyInto(*out) + } if in.NoDevice != nil { in, out := &in.NoDevice, &out.NoDevice *out = new(string) @@ -6480,6 +6790,11 @@ func (in *LaunchTemplateBlockDeviceMappingRequest) DeepCopyInto(out *LaunchTempl *out = new(string) **out = **in } + if in.EBS != nil { + in, out := &in.EBS, &out.EBS + *out = new(LaunchTemplateEBSBlockDeviceRequest) + (*in).DeepCopyInto(*out) + } if in.NoDevice != nil { in, out := &in.NoDevice, &out.NoDevice *out = new(string) @@ -6552,6 +6867,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 @@ -6570,6 +6935,11 @@ func (in *LaunchTemplateEBSBlockDevice) DeepCopyInto(out *LaunchTemplateEBSBlock *out = new(int64) **out = **in } + if in.KMSKeyID != nil { + in, out := &in.KMSKeyID, &out.KMSKeyID + *out = new(string) + **out = **in + } if in.SnapshotID != nil { in, out := &in.SnapshotID, &out.SnapshotID *out = new(string) @@ -6620,6 +6990,11 @@ func (in *LaunchTemplateEBSBlockDeviceRequest) DeepCopyInto(out *LaunchTemplateE *out = new(int64) **out = **in } + if in.KMSKeyID != nil { + in, out := &in.KMSKeyID, &out.KMSKeyID + *out = new(string) + **out = **in + } if in.SnapshotID != nil { in, out := &in.SnapshotID, &out.SnapshotID *out = new(string) @@ -6655,6 +7030,11 @@ func (in *LaunchTemplateEBSBlockDeviceRequest) DeepCopy() *LaunchTemplateEBSBloc // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateElasticInferenceAccelerator) DeepCopyInto(out *LaunchTemplateElasticInferenceAccelerator) { *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) @@ -6827,14 +7207,79 @@ 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 + } + if in.SpotOptions != nil { + in, out := &in.SpotOptions, &out.SpotOptions + *out = new(LaunchTemplateSpotMarketOptions) + (*in).DeepCopyInto(*out) + } +} + +// 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 + } + if in.SpotOptions != nil { + in, out := &in.SpotOptions, &out.SpotOptions + *out = new(LaunchTemplateSpotMarketOptionsRequest) + (*in).DeepCopyInto(*out) + } +} + +// 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 + if in.HTTPEndpoint != nil { + in, out := &in.HTTPEndpoint, &out.HTTPEndpoint + *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 LaunchTemplateInstanceMetadataOptions. @@ -6850,11 +7295,21 @@ func (in *LaunchTemplateInstanceMetadataOptions) DeepCopy() *LaunchTemplateInsta // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateInstanceMetadataOptionsRequest) DeepCopyInto(out *LaunchTemplateInstanceMetadataOptionsRequest) { *out = *in + if in.HTTPEndpoint != nil { + in, out := &in.HTTPEndpoint, &out.HTTPEndpoint + *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 LaunchTemplateInstanceMetadataOptionsRequest. @@ -6895,6 +7350,17 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecification) DeepCopyInto(out *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) @@ -6905,6 +7371,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.NetworkCardIndex != nil { in, out := &in.NetworkCardIndex, &out.NetworkCardIndex *out = new(int64) @@ -6920,6 +7397,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) @@ -6970,6 +7458,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) @@ -6980,6 +7479,17 @@ func (in *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) DeepCopyIn *out = new(int64) **out = **in } + if in.IPv6Addresses != nil { + in, out := &in.IPv6Addresses, &out.IPv6Addresses + *out = make([]*InstanceIPv6AddressRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstanceIPv6AddressRequest) + (*in).DeepCopyInto(*out) + } + } + } if in.NetworkCardIndex != nil { in, out := &in.NetworkCardIndex, &out.NetworkCardIndex *out = new(int64) @@ -6995,6 +7505,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) @@ -7057,6 +7578,63 @@ func (in *LaunchTemplateLicenseConfigurationRequest) DeepCopy() *LaunchTemplateL return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateList) DeepCopyInto(out *LaunchTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LaunchTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateList. +func (in *LaunchTemplateList) DeepCopy() *LaunchTemplateList { + if in == nil { + return nil + } + out := new(LaunchTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LaunchTemplateList) 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 *LaunchTemplateObservation) DeepCopyInto(out *LaunchTemplateObservation) { + *out = *in + if in.LaunchTemplate != nil { + in, out := &in.LaunchTemplate, &out.LaunchTemplate + *out = new(LaunchTemplate_SDK) + (*in).DeepCopyInto(*out) + } + if in.Warning != nil { + in, out := &in.Warning, &out.Warning + *out = new(ValidationWarning) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateObservation. +func (in *LaunchTemplateObservation) DeepCopy() *LaunchTemplateObservation { + if in == nil { + return nil + } + out := new(LaunchTemplateObservation) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateOverrides) DeepCopyInto(out *LaunchTemplateOverrides) { *out = *in @@ -7065,6 +7643,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) @@ -7088,24 +7671,66 @@ func (in *LaunchTemplateOverrides) DeepCopy() *LaunchTemplateOverrides { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LaunchTemplatePlacement) DeepCopyInto(out *LaunchTemplatePlacement) { +func (in *LaunchTemplateParameters) DeepCopyInto(out *LaunchTemplateParameters) { *out = *in - if in.Affinity != nil { - in, out := &in.Affinity, &out.Affinity - *out = new(string) - **out = **in - } - if in.AvailabilityZone != nil { - in, out := &in.AvailabilityZone, &out.AvailabilityZone - *out = new(string) - **out = **in + if in.LaunchTemplateData != nil { + in, out := &in.LaunchTemplateData, &out.LaunchTemplateData + *out = new(RequestLaunchTemplateData) + (*in).DeepCopyInto(*out) } - if in.GroupName != nil { - in, out := &in.GroupName, &out.GroupName + if in.LaunchTemplateName != nil { + in, out := &in.LaunchTemplateName, &out.LaunchTemplateName *out = new(string) **out = **in } - if in.HostID != nil { + if in.TagSpecifications != nil { + in, out := &in.TagSpecifications, &out.TagSpecifications + *out = make([]*TagSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(TagSpecification) + (*in).DeepCopyInto(*out) + } + } + } + if in.VersionDescription != nil { + in, out := &in.VersionDescription, &out.VersionDescription + *out = new(string) + **out = **in + } + in.CustomLaunchTemplateParameters.DeepCopyInto(&out.CustomLaunchTemplateParameters) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateParameters. +func (in *LaunchTemplateParameters) DeepCopy() *LaunchTemplateParameters { + if in == nil { + return nil + } + out := new(LaunchTemplateParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplatePlacement) DeepCopyInto(out *LaunchTemplatePlacement) { + *out = *in + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(string) + **out = **in + } + if in.AvailabilityZone != nil { + in, out := &in.AvailabilityZone, &out.AvailabilityZone + *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) **out = **in @@ -7125,6 +7750,11 @@ func (in *LaunchTemplatePlacement) DeepCopyInto(out *LaunchTemplatePlacement) { *out = new(string) **out = **in } + if in.Tenancy != nil { + in, out := &in.Tenancy, &out.Tenancy + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplatePlacement. @@ -7150,6 +7780,16 @@ 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.HostID != nil { + in, out := &in.HostID, &out.HostID + *out = new(string) + **out = **in + } if in.HostResourceGroupARN != nil { in, out := &in.HostResourceGroupARN, &out.HostResourceGroupARN *out = new(string) @@ -7165,165 +7805,432 @@ func (in *LaunchTemplatePlacementRequest) DeepCopyInto(out *LaunchTemplatePlacem *out = new(string) **out = **in } + if in.Tenancy != nil { + in, out := &in.Tenancy, &out.Tenancy + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplatePlacementRequest. +func (in *LaunchTemplatePlacementRequest) DeepCopy() *LaunchTemplatePlacementRequest { + if in == nil { + return nil + } + out := new(LaunchTemplatePlacementRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateSpec) DeepCopyInto(out *LaunchTemplateSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpec. +func (in *LaunchTemplateSpec) DeepCopy() *LaunchTemplateSpec { + if in == nil { + return nil + } + out := new(LaunchTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// 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) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpecification. +func (in *LaunchTemplateSpecification) DeepCopy() *LaunchTemplateSpecification { + if in == nil { + return nil + } + out := new(LaunchTemplateSpecification) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateSpotMarketOptions) DeepCopyInto(out *LaunchTemplateSpotMarketOptions) { + *out = *in + if in.BlockDurationMinutes != nil { + in, out := &in.BlockDurationMinutes, &out.BlockDurationMinutes + *out = new(int64) + **out = **in + } + if in.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() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpotMarketOptions. +func (in *LaunchTemplateSpotMarketOptions) DeepCopy() *LaunchTemplateSpotMarketOptions { + if in == nil { + return nil + } + out := new(LaunchTemplateSpotMarketOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateSpotMarketOptionsRequest) DeepCopyInto(out *LaunchTemplateSpotMarketOptionsRequest) { + *out = *in + if in.BlockDurationMinutes != nil { + in, out := &in.BlockDurationMinutes, &out.BlockDurationMinutes + *out = new(int64) + **out = **in + } + if in.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() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpotMarketOptionsRequest. +func (in *LaunchTemplateSpotMarketOptionsRequest) DeepCopy() *LaunchTemplateSpotMarketOptionsRequest { + if in == nil { + return nil + } + out := new(LaunchTemplateSpotMarketOptionsRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateStatus) DeepCopyInto(out *LaunchTemplateStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateStatus. +func (in *LaunchTemplateStatus) DeepCopy() *LaunchTemplateStatus { + if in == nil { + return nil + } + out := new(LaunchTemplateStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateTagSpecification) DeepCopyInto(out *LaunchTemplateTagSpecification) { + *out = *in + if in.ResourceType != nil { + in, out := &in.ResourceType, &out.ResourceType + *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) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateTagSpecification. +func (in *LaunchTemplateTagSpecification) DeepCopy() *LaunchTemplateTagSpecification { + if in == nil { + return nil + } + out := new(LaunchTemplateTagSpecification) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateTagSpecificationRequest) DeepCopyInto(out *LaunchTemplateTagSpecificationRequest) { + *out = *in + if in.ResourceType != nil { + in, out := &in.ResourceType, &out.ResourceType + *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) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateTagSpecificationRequest. +func (in *LaunchTemplateTagSpecificationRequest) DeepCopy() *LaunchTemplateTagSpecificationRequest { + if in == nil { + return nil + } + out := new(LaunchTemplateTagSpecificationRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchTemplateVersion) DeepCopyInto(out *LaunchTemplateVersion) { + *out = *in + 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 LaunchTemplateVersion. +func (in *LaunchTemplateVersion) DeepCopy() *LaunchTemplateVersion { + if in == nil { + return nil + } + out := new(LaunchTemplateVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LaunchTemplateVersion) 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 *LaunchTemplateVersionList) DeepCopyInto(out *LaunchTemplateVersionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LaunchTemplateVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateVersionList. +func (in *LaunchTemplateVersionList) DeepCopy() *LaunchTemplateVersionList { + if in == nil { + return nil + } + out := new(LaunchTemplateVersionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LaunchTemplateVersionList) 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 *LaunchTemplateVersionObservation) DeepCopyInto(out *LaunchTemplateVersionObservation) { + *out = *in + if in.LaunchTemplateVersion != nil { + in, out := &in.LaunchTemplateVersion, &out.LaunchTemplateVersion + *out = new(LaunchTemplateVersion_SDK) + (*in).DeepCopyInto(*out) + } + if in.Warning != nil { + in, out := &in.Warning, &out.Warning + *out = new(ValidationWarning) + (*in).DeepCopyInto(*out) + } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplatePlacementRequest. -func (in *LaunchTemplatePlacementRequest) DeepCopy() *LaunchTemplatePlacementRequest { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateVersionObservation. +func (in *LaunchTemplateVersionObservation) DeepCopy() *LaunchTemplateVersionObservation { if in == nil { return nil } - out := new(LaunchTemplatePlacementRequest) + out := new(LaunchTemplateVersionObservation) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LaunchTemplateSpecification) DeepCopyInto(out *LaunchTemplateSpecification) { +func (in *LaunchTemplateVersionParameters) DeepCopyInto(out *LaunchTemplateVersionParameters) { *out = *in - if in.LaunchTemplateName != nil { - in, out := &in.LaunchTemplateName, &out.LaunchTemplateName + if in.LaunchTemplateData != nil { + in, out := &in.LaunchTemplateData, &out.LaunchTemplateData + *out = new(RequestLaunchTemplateData) + (*in).DeepCopyInto(*out) + } + if in.SourceVersion != nil { + in, out := &in.SourceVersion, &out.SourceVersion *out = new(string) **out = **in } - if in.Version != nil { - in, out := &in.Version, &out.Version + if in.VersionDescription != nil { + in, out := &in.VersionDescription, &out.VersionDescription *out = new(string) **out = **in } + in.CustomLaunchTemplateVersionParameters.DeepCopyInto(&out.CustomLaunchTemplateVersionParameters) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpecification. -func (in *LaunchTemplateSpecification) DeepCopy() *LaunchTemplateSpecification { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateVersionParameters. +func (in *LaunchTemplateVersionParameters) DeepCopy() *LaunchTemplateVersionParameters { if in == nil { return nil } - out := new(LaunchTemplateSpecification) + out := new(LaunchTemplateVersionParameters) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LaunchTemplateSpotMarketOptions) DeepCopyInto(out *LaunchTemplateSpotMarketOptions) { +func (in *LaunchTemplateVersionSpec) DeepCopyInto(out *LaunchTemplateVersionSpec) { *out = *in - if in.BlockDurationMinutes != nil { - in, out := &in.BlockDurationMinutes, &out.BlockDurationMinutes - *out = new(int64) - **out = **in - } - if in.MaxPrice != nil { - in, out := &in.MaxPrice, &out.MaxPrice - *out = new(string) - **out = **in - } - if in.ValidUntil != nil { - in, out := &in.ValidUntil, &out.ValidUntil - *out = (*in).DeepCopy() - } + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpotMarketOptions. -func (in *LaunchTemplateSpotMarketOptions) DeepCopy() *LaunchTemplateSpotMarketOptions { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateVersionSpec. +func (in *LaunchTemplateVersionSpec) DeepCopy() *LaunchTemplateVersionSpec { if in == nil { return nil } - out := new(LaunchTemplateSpotMarketOptions) + out := new(LaunchTemplateVersionSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LaunchTemplateSpotMarketOptionsRequest) DeepCopyInto(out *LaunchTemplateSpotMarketOptionsRequest) { +func (in *LaunchTemplateVersionStatus) DeepCopyInto(out *LaunchTemplateVersionStatus) { *out = *in - if in.BlockDurationMinutes != nil { - in, out := &in.BlockDurationMinutes, &out.BlockDurationMinutes - *out = new(int64) - **out = **in - } - if in.MaxPrice != nil { - in, out := &in.MaxPrice, &out.MaxPrice - *out = new(string) - **out = **in - } - if in.ValidUntil != nil { - in, out := &in.ValidUntil, &out.ValidUntil - *out = (*in).DeepCopy() - } + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpotMarketOptionsRequest. -func (in *LaunchTemplateSpotMarketOptionsRequest) DeepCopy() *LaunchTemplateSpotMarketOptionsRequest { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateVersionStatus. +func (in *LaunchTemplateVersionStatus) DeepCopy() *LaunchTemplateVersionStatus { if in == nil { return nil } - out := new(LaunchTemplateSpotMarketOptionsRequest) + out := new(LaunchTemplateVersionStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LaunchTemplateTagSpecification) DeepCopyInto(out *LaunchTemplateTagSpecification) { +func (in *LaunchTemplateVersion_SDK) DeepCopyInto(out *LaunchTemplateVersion_SDK) { *out = *in - if in.ResourceType != nil { - in, out := &in.ResourceType, &out.ResourceType + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = (*in).DeepCopy() + } + if in.CreatedBy != nil { + in, out := &in.CreatedBy, &out.CreatedBy *out = new(string) **out = **in } - if in.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.DefaultVersion != nil { + in, out := &in.DefaultVersion, &out.DefaultVersion + *out = new(bool) + **out = **in } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateTagSpecification. -func (in *LaunchTemplateTagSpecification) DeepCopy() *LaunchTemplateTagSpecification { - if in == nil { - return nil + if in.LaunchTemplateData != nil { + in, out := &in.LaunchTemplateData, &out.LaunchTemplateData + *out = new(ResponseLaunchTemplateData) + (*in).DeepCopyInto(*out) } - out := new(LaunchTemplateTagSpecification) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LaunchTemplateTagSpecificationRequest) DeepCopyInto(out *LaunchTemplateTagSpecificationRequest) { - *out = *in - if in.ResourceType != nil { - in, out := &in.ResourceType, &out.ResourceType + if in.LaunchTemplateID != nil { + in, out := &in.LaunchTemplateID, &out.LaunchTemplateID *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.LaunchTemplateName != nil { + in, out := &in.LaunchTemplateName, &out.LaunchTemplateName + *out = new(string) + **out = **in + } + if in.VersionDescription != nil { + in, out := &in.VersionDescription, &out.VersionDescription + *out = new(string) + **out = **in + } + if in.VersionNumber != nil { + in, out := &in.VersionNumber, &out.VersionNumber + *out = new(int64) + **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateTagSpecificationRequest. -func (in *LaunchTemplateTagSpecificationRequest) DeepCopy() *LaunchTemplateTagSpecificationRequest { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateVersion_SDK. +func (in *LaunchTemplateVersion_SDK) DeepCopy() *LaunchTemplateVersion_SDK { if in == nil { return nil } - out := new(LaunchTemplateTagSpecificationRequest) + out := new(LaunchTemplateVersion_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 *LaunchTemplateVersion) DeepCopyInto(out *LaunchTemplateVersion) { +func (in *LaunchTemplate_SDK) DeepCopyInto(out *LaunchTemplate_SDK) { *out = *in if in.CreateTime != nil { in, out := &in.CreateTime, &out.CreateTime @@ -7334,9 +8241,14 @@ func (in *LaunchTemplateVersion) DeepCopyInto(out *LaunchTemplateVersion) { *out = new(string) **out = **in } - if in.DefaultVersion != nil { - in, out := &in.DefaultVersion, &out.DefaultVersion - *out = new(bool) + if in.DefaultVersionNumber != nil { + in, out := &in.DefaultVersionNumber, &out.DefaultVersionNumber + *out = new(int64) + **out = **in + } + if in.LatestVersionNumber != nil { + in, out := &in.LatestVersionNumber, &out.LatestVersionNumber + *out = new(int64) **out = **in } if in.LaunchTemplateID != nil { @@ -7344,19 +8256,30 @@ func (in *LaunchTemplateVersion) DeepCopyInto(out *LaunchTemplateVersion) { *out = new(string) **out = **in } - if in.VersionNumber != nil { - in, out := &in.VersionNumber, &out.VersionNumber - *out = new(int64) + if in.LaunchTemplateName != nil { + in, out := &in.LaunchTemplateName, &out.LaunchTemplateName + *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) + } + } + } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateVersion. -func (in *LaunchTemplateVersion) DeepCopy() *LaunchTemplateVersion { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplate_SDK. +func (in *LaunchTemplate_SDK) DeepCopy() *LaunchTemplate_SDK { if in == nil { return nil } - out := new(LaunchTemplateVersion) + out := new(LaunchTemplate_SDK) in.DeepCopyInto(out) return out } @@ -9177,6 +10100,11 @@ func (in *Placement) DeepCopyInto(out *Placement) { *out = new(string) **out = **in } + if in.Tenancy != nil { + in, out := &in.Tenancy, &out.Tenancy + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Placement. @@ -9883,30 +10811,198 @@ func (in *RemovePrefixListEntry) DeepCopyInto(out *RemovePrefixListEntry) { *out = new(string) **out = **in } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemovePrefixListEntry. -func (in *RemovePrefixListEntry) DeepCopy() *RemovePrefixListEntry { - if in == nil { - return nil +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemovePrefixListEntry. +func (in *RemovePrefixListEntry) DeepCopy() *RemovePrefixListEntry { + if in == nil { + return nil + } + out := new(RemovePrefixListEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequestLaunchTemplateData) DeepCopyInto(out *RequestLaunchTemplateData) { + *out = *in + if in.BlockDeviceMappings != nil { + in, out := &in.BlockDeviceMappings, &out.BlockDeviceMappings + *out = make([]*LaunchTemplateBlockDeviceMappingRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateBlockDeviceMappingRequest) + (*in).DeepCopyInto(*out) + } + } + } + if in.CapacityReservationSpecification != nil { + in, out := &in.CapacityReservationSpecification, &out.CapacityReservationSpecification + *out = new(LaunchTemplateCapacityReservationSpecificationRequest) + (*in).DeepCopyInto(*out) + } + if in.CPUOptions != nil { + in, out := &in.CPUOptions, &out.CPUOptions + *out = new(LaunchTemplateCPUOptionsRequest) + (*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.ElasticGPUSpecifications != nil { + in, out := &in.ElasticGPUSpecifications, &out.ElasticGPUSpecifications + *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([]*LaunchTemplateElasticInferenceAccelerator, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateElasticInferenceAccelerator) + (*in).DeepCopyInto(*out) + } + } + } + if in.EnclaveOptions != nil { + in, out := &in.EnclaveOptions, &out.EnclaveOptions + *out = new(LaunchTemplateEnclaveOptionsRequest) + (*in).DeepCopyInto(*out) + } + if in.HibernationOptions != nil { + in, out := &in.HibernationOptions, &out.HibernationOptions + *out = new(LaunchTemplateHibernationOptionsRequest) + (*in).DeepCopyInto(*out) + } + if in.IAMInstanceProfile != nil { + in, out := &in.IAMInstanceProfile, &out.IAMInstanceProfile + *out = new(LaunchTemplateIAMInstanceProfileSpecificationRequest) + (*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(LaunchTemplateInstanceMarketOptionsRequest) + (*in).DeepCopyInto(*out) + } + 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.LicenseSpecifications != nil { + in, out := &in.LicenseSpecifications, &out.LicenseSpecifications + *out = make([]*LaunchTemplateLicenseConfigurationRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateLicenseConfigurationRequest) + (*in).DeepCopyInto(*out) + } + } + } + if in.MetadataOptions != nil { + in, out := &in.MetadataOptions, &out.MetadataOptions + *out = new(LaunchTemplateInstanceMetadataOptionsRequest) + (*in).DeepCopyInto(*out) + } + if in.Monitoring != nil { + in, out := &in.Monitoring, &out.Monitoring + *out = new(LaunchTemplatesMonitoringRequest) + (*in).DeepCopyInto(*out) + } + if in.NetworkInterfaces != nil { + in, out := &in.NetworkInterfaces, &out.NetworkInterfaces + *out = make([]*LaunchTemplateInstanceNetworkInterfaceSpecificationRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) + (*in).DeepCopyInto(*out) + } + } + } + if in.Placement != nil { + in, out := &in.Placement, &out.Placement + *out = new(LaunchTemplatePlacementRequest) + (*in).DeepCopyInto(*out) + } + 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 + } + } } - out := new(RemovePrefixListEntry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RequestLaunchTemplateData) DeepCopyInto(out *RequestLaunchTemplateData) { - *out = *in - if in.DisableAPITermination != nil { - in, out := &in.DisableAPITermination, &out.DisableAPITermination - *out = new(bool) - **out = **in + if in.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.EBSOptimized != nil { - in, out := &in.EBSOptimized, &out.EBSOptimized - *out = new(bool) - **out = **in + if in.TagSpecifications != nil { + in, out := &in.TagSpecifications, &out.TagSpecifications + *out = make([]*LaunchTemplateTagSpecificationRequest, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateTagSpecificationRequest) + (*in).DeepCopyInto(*out) + } + } } if in.UserData != nil { in, out := &in.UserData, &out.UserData @@ -9938,6 +11034,31 @@ func (in *RequestSpotLaunchSpecification) DeepCopyInto(out *RequestSpotLaunchSpe *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) @@ -10032,6 +11153,16 @@ func (in *ReservedInstances) DeepCopyInto(out *ReservedInstances) { *out = new(int64) **out = **in } + if in.InstanceTenancy != nil { + in, out := &in.InstanceTenancy, &out.InstanceTenancy + *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) @@ -10077,6 +11208,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) @@ -10248,6 +11384,16 @@ func (in *ReservedInstancesOffering) DeepCopyInto(out *ReservedInstancesOffering *out = new(int64) **out = **in } + if in.InstanceTenancy != nil { + in, out := &in.InstanceTenancy, &out.InstanceTenancy + *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) @@ -10293,6 +11439,32 @@ func (in *ResponseError) DeepCopy() *ResponseError { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResponseLaunchTemplateData) DeepCopyInto(out *ResponseLaunchTemplateData) { *out = *in + if in.BlockDeviceMappings != nil { + in, out := &in.BlockDeviceMappings, &out.BlockDeviceMappings + *out = make([]*LaunchTemplateBlockDeviceMapping, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateBlockDeviceMapping) + (*in).DeepCopyInto(*out) + } + } + } + if in.CapacityReservationSpecification != nil { + in, out := &in.CapacityReservationSpecification, &out.CapacityReservationSpecification + *out = new(LaunchTemplateCapacityReservationSpecificationResponse) + (*in).DeepCopyInto(*out) + } + if in.CPUOptions != nil { + in, out := &in.CPUOptions, &out.CPUOptions + *out = new(LaunchTemplateCPUOptions) + (*in).DeepCopyInto(*out) + } + if in.CreditSpecification != nil { + in, out := &in.CreditSpecification, &out.CreditSpecification + *out = new(CreditSpecification) + (*in).DeepCopyInto(*out) + } if in.DisableAPITermination != nil { in, out := &in.DisableAPITermination, &out.DisableAPITermination *out = new(bool) @@ -10303,11 +11475,63 @@ func (in *ResponseLaunchTemplateData) DeepCopyInto(out *ResponseLaunchTemplateDa *out = new(bool) **out = **in } + if in.ElasticGPUSpecifications != nil { + in, out := &in.ElasticGPUSpecifications, &out.ElasticGPUSpecifications + *out = make([]*ElasticGPUSpecificationResponse, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ElasticGPUSpecificationResponse) + (*in).DeepCopyInto(*out) + } + } + } + if in.ElasticInferenceAccelerators != nil { + in, out := &in.ElasticInferenceAccelerators, &out.ElasticInferenceAccelerators + *out = make([]*LaunchTemplateElasticInferenceAcceleratorResponse, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateElasticInferenceAcceleratorResponse) + (*in).DeepCopyInto(*out) + } + } + } + if in.EnclaveOptions != nil { + in, out := &in.EnclaveOptions, &out.EnclaveOptions + *out = new(LaunchTemplateEnclaveOptions) + (*in).DeepCopyInto(*out) + } + if in.HibernationOptions != nil { + in, out := &in.HibernationOptions, &out.HibernationOptions + *out = new(LaunchTemplateHibernationOptions) + (*in).DeepCopyInto(*out) + } + if in.IAMInstanceProfile != nil { + in, out := &in.IAMInstanceProfile, &out.IAMInstanceProfile + *out = new(LaunchTemplateIAMInstanceProfileSpecification) + (*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(LaunchTemplateInstanceMarketOptions) + (*in).DeepCopyInto(*out) + } + 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) @@ -10318,6 +11542,43 @@ func (in *ResponseLaunchTemplateData) DeepCopyInto(out *ResponseLaunchTemplateDa *out = new(string) **out = **in } + if in.LicenseSpecifications != nil { + in, out := &in.LicenseSpecifications, &out.LicenseSpecifications + *out = make([]*LaunchTemplateLicenseConfiguration, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateLicenseConfiguration) + (*in).DeepCopyInto(*out) + } + } + } + if in.MetadataOptions != nil { + in, out := &in.MetadataOptions, &out.MetadataOptions + *out = new(LaunchTemplateInstanceMetadataOptions) + (*in).DeepCopyInto(*out) + } + if in.Monitoring != nil { + in, out := &in.Monitoring, &out.Monitoring + *out = new(LaunchTemplatesMonitoring) + (*in).DeepCopyInto(*out) + } + if in.NetworkInterfaces != nil { + in, out := &in.NetworkInterfaces, &out.NetworkInterfaces + *out = make([]*LaunchTemplateInstanceNetworkInterfaceSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateInstanceNetworkInterfaceSpecification) + (*in).DeepCopyInto(*out) + } + } + } + if in.Placement != nil { + in, out := &in.Placement, &out.Placement + *out = new(LaunchTemplatePlacement) + (*in).DeepCopyInto(*out) + } if in.RamDiskID != nil { in, out := &in.RamDiskID, &out.RamDiskID *out = new(string) @@ -10345,6 +11606,17 @@ func (in *ResponseLaunchTemplateData) DeepCopyInto(out *ResponseLaunchTemplateDa } } } + if in.TagSpecifications != nil { + in, out := &in.TagSpecifications, &out.TagSpecifications + *out = make([]*LaunchTemplateTagSpecification, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(LaunchTemplateTagSpecification) + (*in).DeepCopyInto(*out) + } + } + } if in.UserData != nil { in, out := &in.UserData, &out.UserData *out = new(string) @@ -11099,11 +12371,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) @@ -11214,6 +12506,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. @@ -11844,6 +13141,11 @@ func (in *SpotFleetLaunchSpecification) DeepCopyInto(out *SpotFleetLaunchSpecifi *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) @@ -11954,6 +13256,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) @@ -12078,6 +13385,11 @@ func (in *SpotInstanceRequest) DeepCopyInto(out *SpotInstanceRequest) { in, out := &in.CreateTime, &out.CreateTime *out = (*in).DeepCopy() } + 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) @@ -12109,6 +13421,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() @@ -12191,11 +13508,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() @@ -12305,6 +13632,11 @@ func (in *SpotPlacement) DeepCopyInto(out *SpotPlacement) { *out = new(string) **out = **in } + if in.Tenancy != nil { + in, out := &in.Tenancy, &out.Tenancy + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpotPlacement. @@ -12325,6 +13657,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) @@ -15067,6 +16404,11 @@ func (in *VPC) DeepCopyInto(out *VPC) { *out = new(string) **out = **in } + if in.InstanceTenancy != nil { + in, out := &in.InstanceTenancy, &out.InstanceTenancy + *out = new(string) + **out = **in + } if in.IsDefault != nil { in, out := &in.IsDefault, &out.IsDefault *out = new(bool) @@ -16272,6 +17614,32 @@ func (in *ValidationError) DeepCopy() *ValidationError { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ValidationWarning) DeepCopyInto(out *ValidationWarning) { + *out = *in + if in.Errors != nil { + in, out := &in.Errors, &out.Errors + *out = make([]*ValidationError, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ValidationError) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidationWarning. +func (in *ValidationWarning) DeepCopy() *ValidationWarning { + if in == nil { + return nil + } + out := new(ValidationWarning) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Volume) DeepCopyInto(out *Volume) { *out = *in diff --git a/apis/ec2/v1alpha1/zz_generated.managed.go b/apis/ec2/v1alpha1/zz_generated.managed.go index 775cfd03d8..c251811242 100644 --- a/apis/ec2/v1alpha1/zz_generated.managed.go +++ b/apis/ec2/v1alpha1/zz_generated.managed.go @@ -20,6 +20,118 @@ package v1alpha1 import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +// GetCondition of this LaunchTemplate. +func (mg *LaunchTemplate) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this LaunchTemplate. +func (mg *LaunchTemplate) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetProviderConfigReference of this LaunchTemplate. +func (mg *LaunchTemplate) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +/* +GetProviderReference of this LaunchTemplate. +Deprecated: Use GetProviderConfigReference. +*/ +func (mg *LaunchTemplate) GetProviderReference() *xpv1.Reference { + return mg.Spec.ProviderReference +} + +// GetWriteConnectionSecretToReference of this LaunchTemplate. +func (mg *LaunchTemplate) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this LaunchTemplate. +func (mg *LaunchTemplate) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this LaunchTemplate. +func (mg *LaunchTemplate) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetProviderConfigReference of this LaunchTemplate. +func (mg *LaunchTemplate) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +/* +SetProviderReference of this LaunchTemplate. +Deprecated: Use SetProviderConfigReference. +*/ +func (mg *LaunchTemplate) SetProviderReference(r *xpv1.Reference) { + mg.Spec.ProviderReference = r +} + +// SetWriteConnectionSecretToReference of this LaunchTemplate. +func (mg *LaunchTemplate) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} + +// GetCondition of this LaunchTemplateVersion. +func (mg *LaunchTemplateVersion) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this LaunchTemplateVersion. +func (mg *LaunchTemplateVersion) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetProviderConfigReference of this LaunchTemplateVersion. +func (mg *LaunchTemplateVersion) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +/* +GetProviderReference of this LaunchTemplateVersion. +Deprecated: Use GetProviderConfigReference. +*/ +func (mg *LaunchTemplateVersion) GetProviderReference() *xpv1.Reference { + return mg.Spec.ProviderReference +} + +// GetWriteConnectionSecretToReference of this LaunchTemplateVersion. +func (mg *LaunchTemplateVersion) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this LaunchTemplateVersion. +func (mg *LaunchTemplateVersion) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this LaunchTemplateVersion. +func (mg *LaunchTemplateVersion) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetProviderConfigReference of this LaunchTemplateVersion. +func (mg *LaunchTemplateVersion) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +/* +SetProviderReference of this LaunchTemplateVersion. +Deprecated: Use SetProviderConfigReference. +*/ +func (mg *LaunchTemplateVersion) SetProviderReference(r *xpv1.Reference) { + mg.Spec.ProviderReference = r +} + +// SetWriteConnectionSecretToReference of this LaunchTemplateVersion. +func (mg *LaunchTemplateVersion) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} + // GetCondition of this Route. func (mg *Route) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) diff --git a/apis/ec2/v1alpha1/zz_generated.managedlist.go b/apis/ec2/v1alpha1/zz_generated.managedlist.go index 6c9e6b75cb..1d8eb79549 100644 --- a/apis/ec2/v1alpha1/zz_generated.managedlist.go +++ b/apis/ec2/v1alpha1/zz_generated.managedlist.go @@ -20,6 +20,24 @@ package v1alpha1 import resource "github.com/crossplane/crossplane-runtime/pkg/resource" +// GetItems of this LaunchTemplateList. +func (l *LaunchTemplateList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} + +// GetItems of this LaunchTemplateVersionList. +func (l *LaunchTemplateVersionList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} + // GetItems of this RouteList. func (l *RouteList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) diff --git a/apis/ec2/v1alpha1/zz_generated.resolvers.go b/apis/ec2/v1alpha1/zz_generated.resolvers.go index 4b6708cd5a..c660d691e0 100644 --- a/apis/ec2/v1alpha1/zz_generated.resolvers.go +++ b/apis/ec2/v1alpha1/zz_generated.resolvers.go @@ -28,6 +28,48 @@ import ( client "sigs.k8s.io/controller-runtime/pkg/client" ) +// ResolveReferences of this LaunchTemplateVersion. +func (mg *LaunchTemplateVersion) ResolveReferences(ctx context.Context, c client.Reader) error { + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var err error + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateIDRef, + Selector: mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateIDSelector, + To: reference.To{ + List: &LaunchTemplateList{}, + Managed: &LaunchTemplate{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateID") + } + mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateIDRef = rsp.ResolvedReference + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateNameRef, + Selector: mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateNameSelector, + To: reference.To{ + List: &LaunchTemplateList{}, + Managed: &LaunchTemplate{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateName") + } + mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateName = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.CustomLaunchTemplateVersionParameters.LaunchTemplateNameRef = rsp.ResolvedReference + + return nil +} + // ResolveReferences of this Route. func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { r := reference.NewAPIResolver(c, mg) diff --git a/apis/ec2/v1alpha1/zz_launch_template.go b/apis/ec2/v1alpha1/zz_launch_template.go new file mode 100644 index 0000000000..9172208724 --- /dev/null +++ b/apis/ec2/v1alpha1/zz_launch_template.go @@ -0,0 +1,101 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License 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 ( + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// LaunchTemplateParameters defines the desired state of LaunchTemplate +type LaunchTemplateParameters struct { + // Region is which region the LaunchTemplate will be created. + // +kubebuilder:validation:Required + Region string `json:"region"` + // The information for the launch template. + // +kubebuilder:validation:Required + LaunchTemplateData *RequestLaunchTemplateData `json:"launchTemplateData"` + // A name for the launch template. + // +kubebuilder:validation:Required + LaunchTemplateName *string `json:"launchTemplateName"` + // The tags to apply to the launch template during creation. + TagSpecifications []*TagSpecification `json:"tagSpecifications,omitempty"` + // A description for the first version of the launch template. + VersionDescription *string `json:"versionDescription,omitempty"` + CustomLaunchTemplateParameters `json:",inline"` +} + +// LaunchTemplateSpec defines the desired state of LaunchTemplate +type LaunchTemplateSpec struct { + xpv1.ResourceSpec `json:",inline"` + ForProvider LaunchTemplateParameters `json:"forProvider"` +} + +// LaunchTemplateObservation defines the observed state of LaunchTemplate +type LaunchTemplateObservation struct { + // Information about the launch template. + LaunchTemplate *LaunchTemplate_SDK `json:"launchTemplate,omitempty"` + // If the launch template contains parameters or parameter combinations that + // are not valid, an error code and an error message are returned for each issue + // that's found. + Warning *ValidationWarning `json:"warning,omitempty"` +} + +// LaunchTemplateStatus defines the observed state of LaunchTemplate. +type LaunchTemplateStatus struct { + xpv1.ResourceStatus `json:",inline"` + AtProvider LaunchTemplateObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true + +// LaunchTemplate is the Schema for the LaunchTemplates API +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} +type LaunchTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec LaunchTemplateSpec `json:"spec"` + Status LaunchTemplateStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// LaunchTemplateList contains a list of LaunchTemplates +type LaunchTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LaunchTemplate `json:"items"` +} + +// Repository type metadata. +var ( + LaunchTemplateKind = "LaunchTemplate" + LaunchTemplateGroupKind = schema.GroupKind{Group: Group, Kind: LaunchTemplateKind}.String() + LaunchTemplateKindAPIVersion = LaunchTemplateKind + "." + GroupVersion.String() + LaunchTemplateGroupVersionKind = GroupVersion.WithKind(LaunchTemplateKind) +) + +func init() { + SchemeBuilder.Register(&LaunchTemplate{}, &LaunchTemplateList{}) +} diff --git a/apis/ec2/v1alpha1/zz_launch_template_version.go b/apis/ec2/v1alpha1/zz_launch_template_version.go new file mode 100644 index 0000000000..fb5ff1b639 --- /dev/null +++ b/apis/ec2/v1alpha1/zz_launch_template_version.go @@ -0,0 +1,102 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License 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 ( + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// LaunchTemplateVersionParameters defines the desired state of LaunchTemplateVersion +type LaunchTemplateVersionParameters struct { + // Region is which region the LaunchTemplateVersion will be created. + // +kubebuilder:validation:Required + Region string `json:"region"` + // The information for the launch template. + // +kubebuilder:validation:Required + LaunchTemplateData *RequestLaunchTemplateData `json:"launchTemplateData"` + // The version number of the launch template version on which to base the new + // version. The new version inherits the same launch parameters as the source + // version, except for parameters that you specify in LaunchTemplateData. Snapshots + // applied to the block device mapping are ignored when creating a new version + // unless they are explicitly included. + SourceVersion *string `json:"sourceVersion,omitempty"` + // A description for the version of the launch template. + VersionDescription *string `json:"versionDescription,omitempty"` + CustomLaunchTemplateVersionParameters `json:",inline"` +} + +// LaunchTemplateVersionSpec defines the desired state of LaunchTemplateVersion +type LaunchTemplateVersionSpec struct { + xpv1.ResourceSpec `json:",inline"` + ForProvider LaunchTemplateVersionParameters `json:"forProvider"` +} + +// LaunchTemplateVersionObservation defines the observed state of LaunchTemplateVersion +type LaunchTemplateVersionObservation struct { + // Information about the launch template version. + LaunchTemplateVersion *LaunchTemplateVersion_SDK `json:"launchTemplateVersion,omitempty"` + // If the new version of the launch template contains parameters or parameter + // combinations that are not valid, an error code and an error message are returned + // for each issue that's found. + Warning *ValidationWarning `json:"warning,omitempty"` +} + +// LaunchTemplateVersionStatus defines the observed state of LaunchTemplateVersion. +type LaunchTemplateVersionStatus struct { + xpv1.ResourceStatus `json:",inline"` + AtProvider LaunchTemplateVersionObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true + +// LaunchTemplateVersion is the Schema for the LaunchTemplateVersions API +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} +type LaunchTemplateVersion struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec LaunchTemplateVersionSpec `json:"spec"` + Status LaunchTemplateVersionStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// LaunchTemplateVersionList contains a list of LaunchTemplateVersions +type LaunchTemplateVersionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LaunchTemplateVersion `json:"items"` +} + +// Repository type metadata. +var ( + LaunchTemplateVersionKind = "LaunchTemplateVersion" + LaunchTemplateVersionGroupKind = schema.GroupKind{Group: Group, Kind: LaunchTemplateVersionKind}.String() + LaunchTemplateVersionKindAPIVersion = LaunchTemplateVersionKind + "." + GroupVersion.String() + LaunchTemplateVersionGroupVersionKind = GroupVersion.WithKind(LaunchTemplateVersionKind) +) + +func init() { + SchemeBuilder.Register(&LaunchTemplateVersion{}, &LaunchTemplateVersionList{}) +} diff --git a/apis/ec2/v1alpha1/zz_types.go b/apis/ec2/v1alpha1/zz_types.go index 9abf2ca296..345f280bfa 100644 --- a/apis/ec2/v1alpha1/zz_types.go +++ b/apis/ec2/v1alpha1/zz_types.go @@ -363,8 +363,24 @@ type CapacityReservationGroup struct { OwnerID *string `json:"ownerID,omitempty"` } +// +kubebuilder:skipversion +type CapacityReservationSpecification struct { + CapacityReservationPreference *string `json:"capacityReservationPreference,omitempty"` + // Describes a target Capacity Reservation or Capacity Reservation group. + CapacityReservationTarget *CapacityReservationTarget `json:"capacityReservationTarget,omitempty"` +} + +// +kubebuilder:skipversion +type CapacityReservationSpecificationResponse struct { + CapacityReservationPreference *string `json:"capacityReservationPreference,omitempty"` + // Describes a target Capacity Reservation or Capacity Reservation group. + CapacityReservationTarget *CapacityReservationTargetResponse `json:"capacityReservationTarget,omitempty"` +} + // +kubebuilder:skipversion type CapacityReservationTarget struct { + CapacityReservationID *string `json:"capacityReservationID,omitempty"` + CapacityReservationResourceGroupARN *string `json:"capacityReservationResourceGroupARN,omitempty"` } @@ -610,6 +626,11 @@ type CreateFleetError struct { ErrorMessage *string `json:"errorMessage,omitempty"` } +// +kubebuilder:skipversion +type CreateFleetInstance struct { + InstanceType *string `json:"instanceType,omitempty"` +} + // +kubebuilder:skipversion type CreateTransitGatewayVPCAttachmentRequestOptions struct { ApplianceModeSupport *string `json:"applianceModeSupport,omitempty"` @@ -744,6 +765,11 @@ type DescribeFleetError struct { ErrorMessage *string `json:"errorMessage,omitempty"` } +// +kubebuilder:skipversion +type DescribeFleetsInstances struct { + InstanceType *string `json:"instanceType,omitempty"` +} + // +kubebuilder:skipversion type DirectoryServiceAuthentication struct { DirectoryID *string `json:"directoryID,omitempty"` @@ -1136,6 +1162,8 @@ type FleetData struct { type FleetLaunchTemplateOverrides struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` SubnetID *string `json:"subnetID,omitempty"` @@ -1145,6 +1173,8 @@ type FleetLaunchTemplateOverrides struct { type FleetLaunchTemplateOverridesRequest struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + MaxPrice *string `json:"maxPrice,omitempty"` SubnetID *string `json:"subnetID,omitempty"` @@ -1154,11 +1184,17 @@ type FleetLaunchTemplateOverridesRequest struct { type FleetLaunchTemplateSpecification struct { LaunchTemplateID *string `json:"launchTemplateID,omitempty"` + LaunchTemplateName *string `json:"launchTemplateName,omitempty"` + Version *string `json:"version,omitempty"` } // +kubebuilder:skipversion type FleetLaunchTemplateSpecificationRequest struct { + LaunchTemplateID *string `json:"launchTemplateID,omitempty"` + + LaunchTemplateName *string `json:"launchTemplateName,omitempty"` + Version *string `json:"version,omitempty"` } @@ -1481,6 +1517,14 @@ type ImportImageTask struct { type ImportInstanceLaunchSpecification struct { AdditionalInfo *string `json:"additionalInfo,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"` PrivateIPAddress *string `json:"privateIPAddress,omitempty"` @@ -1586,6 +1630,11 @@ type InstanceIPv6AddressRequest struct { IPv6Address *string `json:"ipv6Address,omitempty"` } +// +kubebuilder:skipversion +type InstanceMarketOptionsRequest struct { + MarketType *string `json:"marketType,omitempty"` +} + // +kubebuilder:skipversion type InstanceMetadataOptionsRequest struct { HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` @@ -1607,6 +1656,8 @@ type InstanceNetworkInterface struct { InterfaceType *string `json:"interfaceType,omitempty"` + IPv6Addresses []*InstanceIPv6Address `json:"ipv6Addresses,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` NetworkInterfaceID *string `json:"networkInterfaceID,omitempty"` @@ -1660,16 +1711,22 @@ type InstanceNetworkInterfaceSpecification struct { DeviceIndex *int64 `json:"deviceIndex,omitempty"` + Groups []*string `json:"groups,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + IPv6Addresses []*InstanceIPv6Address `json:"ipv6Addresses,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"` @@ -1729,6 +1786,16 @@ type InstanceTagNotificationAttribute struct { IncludeAllTagsOfInstance *bool `json:"includeAllTagsOfInstance,omitempty"` } +// +kubebuilder:skipversion +type InstanceTypeInfo struct { + InstanceType *string `json:"instanceType,omitempty"` +} + +// +kubebuilder:skipversion +type InstanceTypeOffering struct { + InstanceType *string `json:"instanceType,omitempty"` +} + // +kubebuilder:skipversion type InstanceUsage struct { AccountID *string `json:"accountID,omitempty"` @@ -1781,6 +1848,8 @@ type LaunchSpecification struct { ImageID *string `json:"imageID,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` KeyName *string `json:"keyName,omitempty"` @@ -1792,24 +1861,11 @@ type LaunchSpecification struct { UserData *string `json:"userData,omitempty"` } -// +kubebuilder:skipversion -type LaunchTemplate struct { - CreateTime *metav1.Time `json:"createTime,omitempty"` - - CreatedBy *string `json:"createdBy,omitempty"` - - DefaultVersionNumber *int64 `json:"defaultVersionNumber,omitempty"` - - LatestVersionNumber *int64 `json:"latestVersionNumber,omitempty"` - - LaunchTemplateID *string `json:"launchTemplateID,omitempty"` - - Tags []*Tag `json:"tags,omitempty"` -} - // +kubebuilder:skipversion type LaunchTemplateBlockDeviceMapping struct { DeviceName *string `json:"deviceName,omitempty"` + // Describes a block device for an EBS volume. + EBS *LaunchTemplateEBSBlockDevice `json:"ebs,omitempty"` NoDevice *string `json:"noDevice,omitempty"` @@ -1819,6 +1875,8 @@ type LaunchTemplateBlockDeviceMapping struct { // +kubebuilder:skipversion type LaunchTemplateBlockDeviceMappingRequest struct { DeviceName *string `json:"deviceName,omitempty"` + // The parameters for a block device for an EBS volume. + EBS *LaunchTemplateEBSBlockDeviceRequest `json:"ebs,omitempty"` NoDevice *string `json:"noDevice,omitempty"` @@ -1839,6 +1897,20 @@ type LaunchTemplateCPUOptionsRequest struct { ThreadsPerCore *int64 `json:"threadsPerCore,omitempty"` } +// +kubebuilder:skipversion +type LaunchTemplateCapacityReservationSpecificationRequest struct { + CapacityReservationPreference *string `json:"capacityReservationPreference,omitempty"` + // Describes a target Capacity Reservation or Capacity Reservation group. + CapacityReservationTarget *CapacityReservationTarget `json:"capacityReservationTarget,omitempty"` +} + +// +kubebuilder:skipversion +type LaunchTemplateCapacityReservationSpecificationResponse struct { + CapacityReservationPreference *string `json:"capacityReservationPreference,omitempty"` + // Describes a target Capacity Reservation or Capacity Reservation group. + CapacityReservationTarget *CapacityReservationTargetResponse `json:"capacityReservationTarget,omitempty"` +} + // +kubebuilder:skipversion type LaunchTemplateEBSBlockDevice struct { DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` @@ -1847,6 +1919,8 @@ type LaunchTemplateEBSBlockDevice struct { IOPS *int64 `json:"iops,omitempty"` + KMSKeyID *string `json:"kmsKeyID,omitempty"` + SnapshotID *string `json:"snapshotID,omitempty"` Throughput *int64 `json:"throughput,omitempty"` @@ -1864,6 +1938,8 @@ type LaunchTemplateEBSBlockDeviceRequest struct { IOPS *int64 `json:"iops,omitempty"` + KMSKeyID *string `json:"kmsKeyID,omitempty"` + SnapshotID *string `json:"snapshotID,omitempty"` Throughput *int64 `json:"throughput,omitempty"` @@ -1875,6 +1951,8 @@ type LaunchTemplateEBSBlockDeviceRequest struct { // +kubebuilder:skipversion type LaunchTemplateElasticInferenceAccelerator struct { + Count *int64 `json:"count,omitempty"` + Type *string `json:"type_,omitempty"` } @@ -1919,14 +1997,38 @@ type LaunchTemplateIAMInstanceProfileSpecificationRequest struct { Name *string `json:"name,omitempty"` } +// +kubebuilder:skipversion +type LaunchTemplateInstanceMarketOptions struct { + MarketType *string `json:"marketType,omitempty"` + // The options for Spot Instances. + SpotOptions *LaunchTemplateSpotMarketOptions `json:"spotOptions,omitempty"` +} + +// +kubebuilder:skipversion +type LaunchTemplateInstanceMarketOptionsRequest struct { + MarketType *string `json:"marketType,omitempty"` + // The options for Spot Instances. + SpotOptions *LaunchTemplateSpotMarketOptionsRequest `json:"spotOptions,omitempty"` +} + // +kubebuilder:skipversion type LaunchTemplateInstanceMetadataOptions struct { + HTTPEndpoint *string `json:"httpEndpoint,omitempty"` + HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` + + HTTPTokens *string `json:"httpTokens,omitempty"` + + State *string `json:"state,omitempty"` } // +kubebuilder:skipversion type LaunchTemplateInstanceMetadataOptionsRequest struct { + HTTPEndpoint *string `json:"httpEndpoint,omitempty"` + HTTPPutResponseHopLimit *int64 `json:"httpPutResponseHopLimit,omitempty"` + + HTTPTokens *string `json:"httpTokens,omitempty"` } // +kubebuilder:skipversion @@ -1941,16 +2043,22 @@ type LaunchTemplateInstanceNetworkInterfaceSpecification struct { DeviceIndex *int64 `json:"deviceIndex,omitempty"` + Groups []*string `json:"groups,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + IPv6Addresses []*InstanceIPv6Address `json:"ipv6Addresses,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"` @@ -1968,16 +2076,22 @@ type LaunchTemplateInstanceNetworkInterfaceSpecificationRequest struct { DeviceIndex *int64 `json:"deviceIndex,omitempty"` + Groups []*string `json:"groups,omitempty"` + InterfaceType *string `json:"interfaceType,omitempty"` IPv6AddressCount *int64 `json:"ipv6AddressCount,omitempty"` + IPv6Addresses []*InstanceIPv6AddressRequest `json:"ipv6Addresses,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"` @@ -1997,6 +2111,8 @@ type LaunchTemplateLicenseConfigurationRequest struct { type LaunchTemplateOverrides struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + SpotPrice *string `json:"spotPrice,omitempty"` SubnetID *string `json:"subnetID,omitempty"` @@ -2017,6 +2133,8 @@ type LaunchTemplatePlacement struct { PartitionNumber *int64 `json:"partitionNumber,omitempty"` SpreadDomain *string `json:"spreadDomain,omitempty"` + + Tenancy *string `json:"tenancy,omitempty"` } // +kubebuilder:skipversion @@ -2025,15 +2143,23 @@ type LaunchTemplatePlacementRequest struct { 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"` SpreadDomain *string `json:"spreadDomain,omitempty"` + + Tenancy *string `json:"tenancy,omitempty"` } // +kubebuilder:skipversion type LaunchTemplateSpecification struct { + LaunchTemplateID *string `json:"launchTemplateID,omitempty"` + LaunchTemplateName *string `json:"launchTemplateName,omitempty"` Version *string `json:"version,omitempty"` @@ -2043,8 +2169,12 @@ type LaunchTemplateSpecification struct { type LaunchTemplateSpotMarketOptions struct { 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"` } @@ -2052,8 +2182,12 @@ type LaunchTemplateSpotMarketOptions struct { type LaunchTemplateSpotMarketOptionsRequest struct { 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"` } @@ -2072,18 +2206,41 @@ type LaunchTemplateTagSpecificationRequest struct { } // +kubebuilder:skipversion -type LaunchTemplateVersion struct { +type LaunchTemplateVersion_SDK struct { CreateTime *metav1.Time `json:"createTime,omitempty"` CreatedBy *string `json:"createdBy,omitempty"` DefaultVersion *bool `json:"defaultVersion,omitempty"` + // The information for a launch template. + LaunchTemplateData *ResponseLaunchTemplateData `json:"launchTemplateData,omitempty"` LaunchTemplateID *string `json:"launchTemplateID,omitempty"` + LaunchTemplateName *string `json:"launchTemplateName,omitempty"` + + VersionDescription *string `json:"versionDescription,omitempty"` + VersionNumber *int64 `json:"versionNumber,omitempty"` } +// +kubebuilder:skipversion +type LaunchTemplate_SDK struct { + CreateTime *metav1.Time `json:"createTime,omitempty"` + + CreatedBy *string `json:"createdBy,omitempty"` + + DefaultVersionNumber *int64 `json:"defaultVersionNumber,omitempty"` + + LatestVersionNumber *int64 `json:"latestVersionNumber,omitempty"` + + LaunchTemplateID *string `json:"launchTemplateID,omitempty"` + + LaunchTemplateName *string `json:"launchTemplateName,omitempty"` + + Tags []*Tag `json:"tags,omitempty"` +} + // +kubebuilder:skipversion type LaunchTemplatesMonitoring struct { Enabled *bool `json:"enabled,omitempty"` @@ -2619,6 +2776,8 @@ type Placement struct { PartitionNumber *int64 `json:"partitionNumber,omitempty"` SpreadDomain *string `json:"spreadDomain,omitempty"` + + Tenancy *string `json:"tenancy,omitempty"` } // +kubebuilder:skipversion @@ -2821,10 +2980,69 @@ type RemovePrefixListEntry struct { // +kubebuilder:skipversion type RequestLaunchTemplateData struct { + BlockDeviceMappings []*LaunchTemplateBlockDeviceMappingRequest `json:"blockDeviceMappings,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. + CapacityReservationSpecification *LaunchTemplateCapacityReservationSpecificationRequest `json:"capacityReservationSpecification,omitempty"` + // The CPU options for the instance. Both the core count and threads per core + // must be specified in the request. + CPUOptions *LaunchTemplateCPUOptionsRequest `json:"cpuOptions,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"` + ElasticGPUSpecifications []*ElasticGPUSpecification `json:"elasticGPUSpecifications,omitempty"` + + ElasticInferenceAccelerators []*LaunchTemplateElasticInferenceAccelerator `json:"elasticInferenceAccelerators,omitempty"` + // Indicates whether the instance is enabled for AWS Nitro Enclaves. For more + // information, see What is AWS Nitro Enclaves? (https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html) + // in the AWS Nitro Enclaves User Guide. + EnclaveOptions *LaunchTemplateEnclaveOptionsRequest `json:"enclaveOptions,omitempty"` + // Indicates whether the 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). + HibernationOptions *LaunchTemplateHibernationOptionsRequest `json:"hibernationOptions,omitempty"` + // An IAM instance profile. + IAMInstanceProfile *LaunchTemplateIAMInstanceProfileSpecificationRequest `json:"iamInstanceProfile,omitempty"` + + ImageID *string `json:"imageID,omitempty"` + + InstanceInitiatedShutdownBehavior *string `json:"instanceInitiatedShutdownBehavior,omitempty"` + // The market (purchasing) option for the instances. + InstanceMarketOptions *LaunchTemplateInstanceMarketOptionsRequest `json:"instanceMarketOptions,omitempty"` + + InstanceType *string `json:"instanceType,omitempty"` + + KernelID *string `json:"kernelID,omitempty"` + + KeyName *string `json:"keyName,omitempty"` + + LicenseSpecifications []*LaunchTemplateLicenseConfigurationRequest `json:"licenseSpecifications,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. + MetadataOptions *LaunchTemplateInstanceMetadataOptionsRequest `json:"metadataOptions,omitempty"` + // Describes the monitoring for the instance. + Monitoring *LaunchTemplatesMonitoringRequest `json:"monitoring,omitempty"` + + NetworkInterfaces []*LaunchTemplateInstanceNetworkInterfaceSpecificationRequest `json:"networkInterfaces,omitempty"` + // Describes the placement of an instance. + Placement *LaunchTemplatePlacementRequest `json:"placement,omitempty"` + + RamDiskID *string `json:"ramDiskID,omitempty"` + + SecurityGroupIDs []*string `json:"securityGroupIDs,omitempty"` + + SecurityGroups []*string `json:"securityGroups,omitempty"` + + TagSpecifications []*LaunchTemplateTagSpecificationRequest `json:"tagSpecifications,omitempty"` + UserData *string `json:"userData,omitempty"` } @@ -2834,6 +3052,16 @@ type RequestSpotLaunchSpecification 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"` @@ -2863,6 +3091,10 @@ type ReservedInstances struct { 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"` @@ -2876,6 +3108,8 @@ type ReservedInstancesConfiguration struct { InstanceCount *int64 `json:"instanceCount,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + Platform *string `json:"platform,omitempty"` } @@ -2929,6 +3163,10 @@ type ReservedInstancesOffering struct { 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"` @@ -2941,22 +3179,60 @@ type ResponseError struct { // +kubebuilder:skipversion type ResponseLaunchTemplateData struct { + BlockDeviceMappings []*LaunchTemplateBlockDeviceMapping `json:"blockDeviceMappings,omitempty"` + // Information about the Capacity Reservation targeting option. + CapacityReservationSpecification *LaunchTemplateCapacityReservationSpecificationResponse `json:"capacityReservationSpecification,omitempty"` + // The CPU options for the instance. + CPUOptions *LaunchTemplateCPUOptions `json:"cpuOptions,omitempty"` + // Describes the credit option for CPU usage of a T2, T3, or T3a instance. + CreditSpecification *CreditSpecification `json:"creditSpecification,omitempty"` + DisableAPITermination *bool `json:"disableAPITermination,omitempty"` EBSOptimized *bool `json:"ebsOptimized,omitempty"` + ElasticGPUSpecifications []*ElasticGPUSpecificationResponse `json:"elasticGPUSpecifications,omitempty"` + + ElasticInferenceAccelerators []*LaunchTemplateElasticInferenceAcceleratorResponse `json:"elasticInferenceAccelerators,omitempty"` + // Indicates whether the instance is enabled for AWS Nitro Enclaves. + EnclaveOptions *LaunchTemplateEnclaveOptions `json:"enclaveOptions,omitempty"` + // Indicates whether an instance is configured for hibernation. + HibernationOptions *LaunchTemplateHibernationOptions `json:"hibernationOptions,omitempty"` + // Describes an IAM instance profile. + IAMInstanceProfile *LaunchTemplateIAMInstanceProfileSpecification `json:"iamInstanceProfile,omitempty"` + ImageID *string `json:"imageID,omitempty"` + InstanceInitiatedShutdownBehavior *string `json:"instanceInitiatedShutdownBehavior,omitempty"` + // The market (purchasing) option for the instances. + InstanceMarketOptions *LaunchTemplateInstanceMarketOptions `json:"instanceMarketOptions,omitempty"` + + InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` KeyName *string `json:"keyName,omitempty"` + LicenseSpecifications []*LaunchTemplateLicenseConfiguration `json:"licenseSpecifications,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. + MetadataOptions *LaunchTemplateInstanceMetadataOptions `json:"metadataOptions,omitempty"` + // Describes the monitoring for the instance. + Monitoring *LaunchTemplatesMonitoring `json:"monitoring,omitempty"` + + NetworkInterfaces []*LaunchTemplateInstanceNetworkInterfaceSpecification `json:"networkInterfaces,omitempty"` + // Describes the placement of an instance. + Placement *LaunchTemplatePlacement `json:"placement,omitempty"` + RamDiskID *string `json:"ramDiskID,omitempty"` SecurityGroupIDs []*string `json:"securityGroupIDs,omitempty"` SecurityGroups []*string `json:"securityGroups,omitempty"` + TagSpecifications []*LaunchTemplateTagSpecification `json:"tagSpecifications,omitempty"` + UserData *string `json:"userData,omitempty"` } @@ -3149,8 +3425,16 @@ type ScheduledInstancesIAMInstanceProfile struct { 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"` @@ -3185,6 +3469,8 @@ type ScheduledInstancesNetworkInterface struct { // +kubebuilder:skipversion type ScheduledInstancesPlacement struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + + GroupName *string `json:"groupName,omitempty"` } // +kubebuilder:skipversion @@ -3374,6 +3660,8 @@ type SpotFleetLaunchSpecification struct { ImageID *string `json:"imageID,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + KernelID *string `json:"kernelID,omitempty"` KeyName *string `json:"keyName,omitempty"` @@ -3407,6 +3695,8 @@ type SpotFleetRequestConfigData struct { IAMFleetRole *string `json:"iamFleetRole,omitempty"` + InstanceInterruptionBehavior *string `json:"instanceInterruptionBehavior,omitempty"` + InstancePoolsToUseCount *int64 `json:"instancePoolsToUseCount,omitempty"` OnDemandMaxTotalPrice *string `json:"onDemandMaxTotalPrice,omitempty"` @@ -3447,6 +3737,8 @@ type SpotInstanceRequest struct { CreateTime *metav1.Time `json:"createTime,omitempty"` + InstanceInterruptionBehavior *string `json:"instanceInterruptionBehavior,omitempty"` + LaunchGroup *string `json:"launchGroup,omitempty"` LaunchedAvailabilityZone *string `json:"launchedAvailabilityZone,omitempty"` @@ -3457,6 +3749,8 @@ type SpotInstanceRequest struct { Tags []*Tag `json:"tags,omitempty"` + Type *string `json:"type_,omitempty"` + ValidFrom *metav1.Time `json:"validFrom,omitempty"` ValidUntil *metav1.Time `json:"validUntil,omitempty"` @@ -3482,8 +3776,12 @@ type SpotInstanceStatus struct { type SpotMarketOptions struct { 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"` } @@ -3518,12 +3816,16 @@ type SpotPlacement struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` GroupName *string `json:"groupName,omitempty"` + + Tenancy *string `json:"tenancy,omitempty"` } // +kubebuilder:skipversion type SpotPrice struct { AvailabilityZone *string `json:"availabilityZone,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + SpotPrice *string `json:"spotPrice,omitempty"` Timestamp *metav1.Time `json:"timestamp,omitempty"` @@ -4222,6 +4524,8 @@ type VPC struct { DHCPOptionsID *string `json:"dhcpOptionsID,omitempty"` + InstanceTenancy *string `json:"instanceTenancy,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` OwnerID *string `json:"ownerID,omitempty"` @@ -4468,6 +4772,11 @@ type ValidationError struct { Message *string `json:"message,omitempty"` } +// +kubebuilder:skipversion +type ValidationWarning struct { + Errors []*ValidationError `json:"errors,omitempty"` +} + // +kubebuilder:skipversion type VolumeAttachment struct { AttachTime *metav1.Time `json:"attachTime,omitempty"` diff --git a/apis/eks/manualv1alpha1/nodegroup_types.go b/apis/eks/manualv1alpha1/nodegroup_types.go index 837e521844..8834d46952 100644 --- a/apis/eks/manualv1alpha1/nodegroup_types.go +++ b/apis/eks/manualv1alpha1/nodegroup_types.go @@ -224,11 +224,35 @@ type LaunchTemplateSpecification struct { ID *string `json:"id,omitempty"` // The name of the launch template. + // +crossplane:generate:reference:type=github.com/crossplane/provider-aws/apis/ec2/v1alpha1.LaunchTemplate Name *string `json:"name,omitempty"` + // NameRef is a reference to a LaunchTemplate used to set + // the Name. + // +immutable + // +optional + NameRef *xpv1.Reference `json:"nameRef,omitempty"` + + // NameSelector selects references to a LaunchTemplate used + // to set the Name. + // +optional + NameSelector *xpv1.Selector `json:"nameSelector,omitempty"` + // The version of the launch template to use. If no version is specified, then the // template's default version is used. + // +crossplane:generate:reference:type=github.com/crossplane/provider-aws/apis/ec2/v1alpha1.LaunchTemplateVersion Version *string `json:"version,omitempty"` + + // VersionRef is a reference to a LaunchTemplateVersion used to set + // the Version. + // +immutable + // +optional + VersionRef *xpv1.Reference `json:"versionRef,omitempty"` + + // VersionSelector selects references to a LaunchTemplateVersion used + // to set the Version. + // +optional + VersionSelector *xpv1.Selector `json:"versionSelector,omitempty"` } // RemoteAccessConfig is the configuration for remotely accessing a node. diff --git a/apis/eks/manualv1alpha1/zz_generated.deepcopy.go b/apis/eks/manualv1alpha1/zz_generated.deepcopy.go index c4b9dec332..34e2518641 100644 --- a/apis/eks/manualv1alpha1/zz_generated.deepcopy.go +++ b/apis/eks/manualv1alpha1/zz_generated.deepcopy.go @@ -421,11 +421,31 @@ func (in *LaunchTemplateSpecification) DeepCopyInto(out *LaunchTemplateSpecifica *out = new(string) **out = **in } + if in.NameRef != nil { + in, out := &in.NameRef, &out.NameRef + *out = new(v1.Reference) + **out = **in + } + if in.NameSelector != nil { + in, out := &in.NameSelector, &out.NameSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.Version != nil { in, out := &in.Version, &out.Version *out = new(string) **out = **in } + if in.VersionRef != nil { + in, out := &in.VersionRef, &out.VersionRef + *out = new(v1.Reference) + **out = **in + } + if in.VersionSelector != nil { + in, out := &in.VersionSelector, &out.VersionSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateSpecification. diff --git a/apis/eks/manualv1alpha1/zz_generated.resolvers.go b/apis/eks/manualv1alpha1/zz_generated.resolvers.go index 2afc630246..5cf37010e9 100644 --- a/apis/eks/manualv1alpha1/zz_generated.resolvers.go +++ b/apis/eks/manualv1alpha1/zz_generated.resolvers.go @@ -21,6 +21,7 @@ package manualv1alpha1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + v1alpha1 "github.com/crossplane/provider-aws/apis/ec2/v1alpha1" v1beta12 "github.com/crossplane/provider-aws/apis/ec2/v1beta1" v1beta1 "github.com/crossplane/provider-aws/apis/eks/v1beta1" v1beta11 "github.com/crossplane/provider-aws/apis/iam/v1beta1" @@ -78,6 +79,42 @@ func (mg *NodeGroup) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.ForProvider.ClusterName = rsp.ResolvedValue mg.Spec.ForProvider.ClusterNameRef = rsp.ResolvedReference + if mg.Spec.ForProvider.LaunchTemplate != nil { + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchTemplate.Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LaunchTemplate.NameRef, + Selector: mg.Spec.ForProvider.LaunchTemplate.NameSelector, + To: reference.To{ + List: &v1alpha1.LaunchTemplateList{}, + Managed: &v1alpha1.LaunchTemplate{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.LaunchTemplate.Name") + } + mg.Spec.ForProvider.LaunchTemplate.Name = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.LaunchTemplate.NameRef = rsp.ResolvedReference + + } + if mg.Spec.ForProvider.LaunchTemplate != nil { + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchTemplate.Version), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LaunchTemplate.VersionRef, + Selector: mg.Spec.ForProvider.LaunchTemplate.VersionSelector, + To: reference.To{ + List: &v1alpha1.LaunchTemplateVersionList{}, + Managed: &v1alpha1.LaunchTemplateVersion{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.LaunchTemplate.Version") + } + mg.Spec.ForProvider.LaunchTemplate.Version = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.LaunchTemplate.VersionRef = rsp.ResolvedReference + + } rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: mg.Spec.ForProvider.NodeRole, Extract: v1beta11.RoleARN(), diff --git a/examples/ec2/launchtemplate.yaml b/examples/ec2/launchtemplate.yaml new file mode 100644 index 0000000000..090b26bfb6 --- /dev/null +++ b/examples/ec2/launchtemplate.yaml @@ -0,0 +1,18 @@ +apiVersion: ec2.aws.crossplane.io/v1alpha1 +kind: LaunchTemplate +metadata: + name: test-crossplane-obj +spec: + forProvider: + launchTemplateName: test-crossplane-obj + launchTemplateData: + # resourceTags + tagSpecifications: + - resourceType: volume + tags: + - key: original + value: "1" + keyName: kube + region: us-east-1 + providerConfigRef: + name: example \ No newline at end of file diff --git a/examples/ec2/launchtemplateversion.yaml b/examples/ec2/launchtemplateversion.yaml new file mode 100644 index 0000000000..76f7114928 --- /dev/null +++ b/examples/ec2/launchtemplateversion.yaml @@ -0,0 +1,19 @@ +apiVersion: ec2.aws.crossplane.io/v1alpha1 +kind: LaunchTemplateVersion +metadata: + name: test-crossplane-v3 +spec: + forProvider: + sourceVersion: "1" + launchTemplateNameRef: + name: test-crossplane-obj + launchTemplateData: + # resourceTags + tagSpecifications: + - resourceType: volume + tags: + - key: version + value: "2" + region: us-east-1 + providerConfigRef: + name: example diff --git a/package/crds/ec2.aws.crossplane.io_launchtemplates.yaml b/package/crds/ec2.aws.crossplane.io_launchtemplates.yaml new file mode 100644 index 0000000000..ba9ab2bbb2 --- /dev/null +++ b/package/crds/ec2.aws.crossplane.io_launchtemplates.yaml @@ -0,0 +1,533 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null + name: launchtemplates.ec2.aws.crossplane.io +spec: + group: ec2.aws.crossplane.io + names: + categories: + - crossplane + - managed + - aws + kind: LaunchTemplate + listKind: LaunchTemplateList + plural: launchtemplates + singular: launchtemplate + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: LaunchTemplate is the Schema for the LaunchTemplates 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: LaunchTemplateSpec defines the desired state of LaunchTemplate + properties: + deletionPolicy: + default: Delete + description: DeletionPolicy specifies what will happen to the underlying + external when this managed resource is deleted - either "Delete" + or "Orphan" the external resource. + enum: + - Orphan + - Delete + type: string + forProvider: + description: LaunchTemplateParameters defines the desired state of + LaunchTemplate + properties: + launchTemplateData: + description: The information for the launch template. + properties: + blockDeviceMappings: + items: + properties: + deviceName: + type: string + ebs: + description: The parameters for a block device for an + EBS volume. + properties: + deleteOnTermination: + type: boolean + encrypted: + type: boolean + iops: + format: int64 + type: integer + kmsKeyID: + 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: 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. + 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. Both the core + count and threads per core must be specified in the request. + properties: + coreCount: + format: int64 + type: integer + threadsPerCore: + format: int64 + type: integer + type: object + creditSpecification: + description: The credit option for CPU usage of a T2, T3, + or T3a instance. + properties: + cpuCredits: + type: string + type: object + disableAPITermination: + type: boolean + ebsOptimized: + type: boolean + elasticGPUSpecifications: + items: + properties: + type_: + type: string + type: object + type: array + elasticInferenceAccelerators: + items: + properties: + count: + format: int64 + type: integer + type_: + type: string + type: object + type: array + enclaveOptions: + description: Indicates whether the instance is enabled for + AWS Nitro Enclaves. For more information, see What is AWS + Nitro Enclaves? (https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html) + in the AWS Nitro Enclaves User Guide. + properties: + enabled: + type: boolean + type: object + hibernationOptions: + description: Indicates whether the 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). + properties: + configured: + type: boolean + type: object + iamInstanceProfile: + description: An IAM instance profile. + properties: + arn: + type: string + name: + type: string + type: object + imageID: + type: string + instanceInitiatedShutdownBehavior: + type: string + instanceMarketOptions: + description: The market (purchasing) option for the instances. + 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: + type: string + kernelID: + type: string + keyName: + type: string + licenseSpecifications: + items: + properties: + licenseConfigurationARN: + type: string + type: object + type: array + 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) + in the Amazon Elastic Compute Cloud User Guide. + properties: + httpEndpoint: + type: string + httpPutResponseHopLimit: + format: int64 + type: integer + httpTokens: + type: string + type: object + monitoring: + description: Describes the monitoring for the instance. + properties: + enabled: + type: boolean + type: object + networkInterfaces: + items: + properties: + associateCarrierIPAddress: + type: boolean + associatePublicIPAddress: + type: boolean + deleteOnTermination: + type: boolean + description: + type: string + deviceIndex: + format: int64 + type: integer + groups: + items: + type: string + type: array + interfaceType: + type: string + ipv6AddressCount: + format: int64 + type: integer + ipv6Addresses: + items: + properties: + ipv6Address: + type: string + type: object + type: array + networkCardIndex: + format: int64 + type: integer + networkInterfaceID: + type: string + privateIPAddress: + type: string + privateIPAddresses: + items: + 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: Describes the placement of an instance. + properties: + affinity: + type: string + availabilityZone: + type: string + groupName: + type: string + hostID: + type: string + hostResourceGroupARN: + type: string + partitionNumber: + format: int64 + type: integer + spreadDomain: + type: string + tenancy: + type: string + type: object + ramDiskID: + type: string + securityGroupIDs: + items: + type: string + type: array + securityGroups: + items: + type: string + type: array + tagSpecifications: + items: + properties: + resourceType: + type: string + tags: + items: + properties: + key: + type: string + value: + type: string + type: object + type: array + type: object + type: array + userData: + type: string + type: object + launchTemplateName: + description: A name for the launch template. + type: string + region: + description: Region is which region the LaunchTemplate will be + created. + type: string + tagSpecifications: + description: The tags to apply to the launch template during creation. + items: + properties: + resourceType: + type: string + tags: + items: + properties: + key: + type: string + value: + type: string + type: object + type: array + type: object + type: array + tags: + description: Metadata tagging key value pairs + items: + properties: + key: + type: string + value: + type: string + type: object + type: array + versionDescription: + description: A description for the first version of the launch + template. + type: string + required: + - launchTemplateData + - launchTemplateName + - region + type: object + providerConfigRef: + default: + name: default + description: ProviderConfigReference specifies how the provider that + will be used to create, observe, update, and delete this managed + resource should be configured. + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + providerRef: + description: 'ProviderReference specifies the provider that will be + used to create, observe, update, and delete this managed resource. + Deprecated: Please use ProviderConfigReference, i.e. `providerConfigRef`' + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the namespace + and name of a Secret to which any connection details for this managed + resource should be written. Connection details frequently include + the endpoint, username, and password required to connect to the + managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + status: + description: LaunchTemplateStatus defines the observed state of LaunchTemplate. + properties: + atProvider: + description: LaunchTemplateObservation defines the observed state + of LaunchTemplate + properties: + launchTemplate: + description: Information about the launch template. + properties: + createTime: + format: date-time + type: string + createdBy: + type: string + defaultVersionNumber: + format: int64 + type: integer + latestVersionNumber: + format: int64 + type: integer + launchTemplateID: + type: string + launchTemplateName: + type: string + tags: + items: + properties: + key: + type: string + value: + type: string + type: object + type: array + type: object + warning: + description: If the launch template contains parameters or parameter + combinations that are not valid, an error code and an error + message are returned for each issue that's found. + properties: + errors: + items: + properties: + code: + type: string + message: + type: string + type: object + type: array + type: object + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this condition + transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this condition's + last transition from one status to another, if any. + type: string + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: Type of this condition. At most one of each condition + type may apply to a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/package/crds/ec2.aws.crossplane.io_launchtemplateversions.yaml b/package/crds/ec2.aws.crossplane.io_launchtemplateversions.yaml new file mode 100644 index 0000000000..a04611af41 --- /dev/null +++ b/package/crds/ec2.aws.crossplane.io_launchtemplateversions.yaml @@ -0,0 +1,840 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null + name: launchtemplateversions.ec2.aws.crossplane.io +spec: + group: ec2.aws.crossplane.io + names: + categories: + - crossplane + - managed + - aws + kind: LaunchTemplateVersion + listKind: LaunchTemplateVersionList + plural: launchtemplateversions + singular: launchtemplateversion + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: LaunchTemplateVersion is the Schema for the LaunchTemplateVersions + 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: LaunchTemplateVersionSpec defines the desired state of LaunchTemplateVersion + properties: + deletionPolicy: + default: Delete + description: DeletionPolicy specifies what will happen to the underlying + external when this managed resource is deleted - either "Delete" + or "Orphan" the external resource. + enum: + - Orphan + - Delete + type: string + forProvider: + description: LaunchTemplateVersionParameters defines the desired state + of LaunchTemplateVersion + properties: + launchTemplateData: + description: The information for the launch template. + properties: + blockDeviceMappings: + items: + properties: + deviceName: + type: string + ebs: + description: The parameters for a block device for an + EBS volume. + properties: + deleteOnTermination: + type: boolean + encrypted: + type: boolean + iops: + format: int64 + type: integer + kmsKeyID: + 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: 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. + 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. Both the core + count and threads per core must be specified in the request. + properties: + coreCount: + format: int64 + type: integer + threadsPerCore: + format: int64 + type: integer + type: object + creditSpecification: + description: The credit option for CPU usage of a T2, T3, + or T3a instance. + properties: + cpuCredits: + type: string + type: object + disableAPITermination: + type: boolean + ebsOptimized: + type: boolean + elasticGPUSpecifications: + items: + properties: + type_: + type: string + type: object + type: array + elasticInferenceAccelerators: + items: + properties: + count: + format: int64 + type: integer + type_: + type: string + type: object + type: array + enclaveOptions: + description: Indicates whether the instance is enabled for + AWS Nitro Enclaves. For more information, see What is AWS + Nitro Enclaves? (https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html) + in the AWS Nitro Enclaves User Guide. + properties: + enabled: + type: boolean + type: object + hibernationOptions: + description: Indicates whether the 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). + properties: + configured: + type: boolean + type: object + iamInstanceProfile: + description: An IAM instance profile. + properties: + arn: + type: string + name: + type: string + type: object + imageID: + type: string + instanceInitiatedShutdownBehavior: + type: string + instanceMarketOptions: + description: The market (purchasing) option for the instances. + 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: + type: string + kernelID: + type: string + keyName: + type: string + licenseSpecifications: + items: + properties: + licenseConfigurationARN: + type: string + type: object + type: array + 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) + in the Amazon Elastic Compute Cloud User Guide. + properties: + httpEndpoint: + type: string + httpPutResponseHopLimit: + format: int64 + type: integer + httpTokens: + type: string + type: object + monitoring: + description: Describes the monitoring for the instance. + properties: + enabled: + type: boolean + type: object + networkInterfaces: + items: + properties: + associateCarrierIPAddress: + type: boolean + associatePublicIPAddress: + type: boolean + deleteOnTermination: + type: boolean + description: + type: string + deviceIndex: + format: int64 + type: integer + groups: + items: + type: string + type: array + interfaceType: + type: string + ipv6AddressCount: + format: int64 + type: integer + ipv6Addresses: + items: + properties: + ipv6Address: + type: string + type: object + type: array + networkCardIndex: + format: int64 + type: integer + networkInterfaceID: + type: string + privateIPAddress: + type: string + privateIPAddresses: + items: + 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: Describes the placement of an instance. + properties: + affinity: + type: string + availabilityZone: + type: string + groupName: + type: string + hostID: + type: string + hostResourceGroupARN: + type: string + partitionNumber: + format: int64 + type: integer + spreadDomain: + type: string + tenancy: + type: string + type: object + ramDiskID: + type: string + securityGroupIDs: + items: + type: string + type: array + securityGroups: + items: + type: string + type: array + tagSpecifications: + items: + properties: + resourceType: + type: string + tags: + items: + properties: + key: + type: string + value: + type: string + type: object + type: array + type: object + type: array + userData: + type: string + type: object + launchTemplateId: + description: The ID of the Launch Template. You must specify this + parameter in the request. + type: string + launchTemplateIdRef: + description: LaunchTemplateIDRef is a reference to an API used + to set the LaunchTemplateID. + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + launchTemplateIdSelector: + description: LaunchTemplateIDSelector selects references to API + used to set the LaunchTemplateID. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with the + same controller reference as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + type: object + launchTemplateName: + description: The Name of the Launch Template. You must specify + this parameter in the request. + type: string + launchTemplateNameRef: + description: LaunchTemplateNameRef is a reference to an API used + to set the LaunchTemplateName. + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + launchTemplateNameSelector: + description: LaunchTemplateNameSelector selects references to + API used to set the LaunchTemplateName. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with the + same controller reference as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + type: object + region: + description: Region is which region the LaunchTemplateVersion + will be created. + type: string + sourceVersion: + description: The version number of the launch template version + on which to base the new version. The new version inherits the + same launch parameters as the source version, except for parameters + that you specify in LaunchTemplateData. Snapshots applied to + the block device mapping are ignored when creating a new version + unless they are explicitly included. + type: string + versionDescription: + description: A description for the version of the launch template. + type: string + required: + - launchTemplateData + - region + type: object + providerConfigRef: + default: + name: default + description: ProviderConfigReference specifies how the provider that + will be used to create, observe, update, and delete this managed + resource should be configured. + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + providerRef: + description: 'ProviderReference specifies the provider that will be + used to create, observe, update, and delete this managed resource. + Deprecated: Please use ProviderConfigReference, i.e. `providerConfigRef`' + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the namespace + and name of a Secret to which any connection details for this managed + resource should be written. Connection details frequently include + the endpoint, username, and password required to connect to the + managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + status: + description: LaunchTemplateVersionStatus defines the observed state of + LaunchTemplateVersion. + properties: + atProvider: + description: LaunchTemplateVersionObservation defines the observed + state of LaunchTemplateVersion + properties: + launchTemplateVersion: + description: Information about the launch template version. + properties: + createTime: + format: date-time + type: string + createdBy: + type: string + defaultVersion: + type: boolean + launchTemplateData: + description: The information for a launch template. + properties: + blockDeviceMappings: + items: + 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 + 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. + 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. + properties: + coreCount: + format: int64 + type: integer + threadsPerCore: + format: int64 + type: integer + type: object + creditSpecification: + description: Describes the credit option for CPU usage + of a T2, T3, or T3a instance. + properties: + cpuCredits: + type: string + type: object + disableAPITermination: + type: boolean + ebsOptimized: + type: boolean + elasticGPUSpecifications: + items: + properties: + type_: + type: string + type: object + type: array + elasticInferenceAccelerators: + items: + properties: + count: + format: int64 + type: integer + type_: + type: string + type: object + type: array + enclaveOptions: + description: Indicates whether the instance is enabled + for AWS Nitro Enclaves. + properties: + enabled: + type: boolean + type: object + hibernationOptions: + description: Indicates whether an instance is configured + for hibernation. + properties: + configured: + type: boolean + type: object + iamInstanceProfile: + description: Describes an IAM instance profile. + properties: + arn: + type: string + name: + type: string + type: object + imageID: + type: string + instanceInitiatedShutdownBehavior: + type: string + instanceMarketOptions: + description: The market (purchasing) option for the instances. + 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: + type: string + kernelID: + type: string + keyName: + type: string + licenseSpecifications: + items: + properties: + licenseConfigurationARN: + type: string + type: object + type: array + 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) + in the Amazon Elastic Compute Cloud User Guide. + properties: + httpEndpoint: + type: string + httpPutResponseHopLimit: + format: int64 + type: integer + httpTokens: + type: string + state: + type: string + type: object + monitoring: + description: Describes the monitoring for the instance. + properties: + enabled: + type: boolean + type: object + networkInterfaces: + items: + properties: + associateCarrierIPAddress: + type: boolean + associatePublicIPAddress: + type: boolean + deleteOnTermination: + type: boolean + description: + type: string + deviceIndex: + format: int64 + type: integer + groups: + items: + type: string + type: array + interfaceType: + type: string + ipv6AddressCount: + format: int64 + type: integer + ipv6Addresses: + items: + properties: + ipv6Address: + type: string + type: object + type: array + networkCardIndex: + format: int64 + type: integer + networkInterfaceID: + type: string + privateIPAddress: + type: string + privateIPAddresses: + items: + 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: Describes the placement of an instance. + properties: + affinity: + type: string + availabilityZone: + type: string + groupName: + type: string + hostID: + type: string + hostResourceGroupARN: + type: string + partitionNumber: + format: int64 + type: integer + spreadDomain: + type: string + tenancy: + type: string + type: object + ramDiskID: + type: string + securityGroupIDs: + items: + type: string + type: array + securityGroups: + items: + type: string + type: array + tagSpecifications: + items: + properties: + resourceType: + type: string + tags: + items: + properties: + key: + type: string + value: + type: string + type: object + type: array + type: object + type: array + userData: + type: string + type: object + launchTemplateID: + type: string + launchTemplateName: + type: string + versionDescription: + type: string + versionNumber: + format: int64 + type: integer + type: object + warning: + description: If the new version of the launch template contains + parameters or parameter combinations that are not valid, an + error code and an error message are returned for each issue + that's found. + properties: + errors: + items: + properties: + code: + type: string + message: + type: string + type: object + type: array + type: object + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this condition + transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this condition's + last transition from one status to another, if any. + type: string + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: Type of this condition. At most one of each condition + type may apply to a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/package/crds/eks.aws.crossplane.io_nodegroups.yaml b/package/crds/eks.aws.crossplane.io_nodegroups.yaml index ac55d1409e..6b76ba5a6f 100644 --- a/package/crds/eks.aws.crossplane.io_nodegroups.yaml +++ b/package/crds/eks.aws.crossplane.io_nodegroups.yaml @@ -141,11 +141,63 @@ spec: name: description: The name of the launch template. type: string + nameRef: + description: NameRef is a reference to a LaunchTemplate used + to set the Name. + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + nameSelector: + description: NameSelector selects references to a LaunchTemplate + used to set the Name. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with + the same controller reference as the selecting object + is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching + labels is selected. + type: object + type: object version: description: The version of the launch template to use. If no version is specified, then the template's default version is used. type: string + versionRef: + description: VersionRef is a reference to a LaunchTemplateVersion + used to set the Version. + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + versionSelector: + description: VersionSelector selects references to a LaunchTemplateVersion + used to set the Version. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with + the same controller reference as the selecting object + is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching + labels is selected. + type: object + type: object type: object nodeRole: description: "The Amazon Resource Name (ARN) of the IAM role to diff --git a/pkg/controller/aws.go b/pkg/controller/aws.go index 74dfee301f..9b728dcdc6 100644 --- a/pkg/controller/aws.go +++ b/pkg/controller/aws.go @@ -60,6 +60,8 @@ import ( "github.com/crossplane/provider-aws/pkg/controller/ec2/address" "github.com/crossplane/provider-aws/pkg/controller/ec2/instance" "github.com/crossplane/provider-aws/pkg/controller/ec2/internetgateway" + "github.com/crossplane/provider-aws/pkg/controller/ec2/launchtemplate" + "github.com/crossplane/provider-aws/pkg/controller/ec2/launchtemplateversion" "github.com/crossplane/provider-aws/pkg/controller/ec2/natgateway" ec2route "github.com/crossplane/provider-aws/pkg/controller/ec2/route" "github.com/crossplane/provider-aws/pkg/controller/ec2/routetable" @@ -170,6 +172,8 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll ti subnet.SetupSubnet, securitygroup.SetupSecurityGroup, internetgateway.SetupInternetGateway, + launchtemplate.SetupLaunchTemplate, + launchtemplateversion.SetupLaunchTemplateVersion, natgateway.SetupNatGateway, routetable.SetupRouteTable, dbsubnetgroup.SetupDBSubnetGroup, diff --git a/pkg/controller/ec2/launchtemplate/setup.go b/pkg/controller/ec2/launchtemplate/setup.go new file mode 100644 index 0000000000..2bf9a7b97c --- /dev/null +++ b/pkg/controller/ec2/launchtemplate/setup.go @@ -0,0 +1,126 @@ +package launchtemplate + +import ( + "context" + "sort" + "time" + + svcsdk "github.com/aws/aws-sdk-go/service/ec2" + "github.com/pkg/errors" + "k8s.io/client-go/util/workqueue" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/meta" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + svcapitypes "github.com/crossplane/provider-aws/apis/ec2/v1alpha1" + aws "github.com/crossplane/provider-aws/pkg/clients" +) + +// SetupLaunchTemplate adds a controller that reconciles LaunchTemplate. +func SetupLaunchTemplate(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { + name := managed.ControllerName(svcapitypes.LaunchTemplateGroupKind) + opts := []option{ + func(e *external) { + e.preObserve = preObserve + e.preUpdate = preUpdate + e.preDelete = preDelete + e.postCreate = postCreate + e.postObserve = postObserve + }, + } + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(controller.Options{ + RateLimiter: ratelimiter.NewController(rl), + }). + For(&svcapitypes.LaunchTemplate{}). + Complete(managed.NewReconciler(mgr, + resource.ManagedKind(svcapitypes.LaunchTemplateGroupVersionKind), + managed.WithExternalConnecter(&connector{kube: mgr.GetClient(), opts: opts}), + managed.WithPollInterval(poll), + managed.WithInitializers(managed.NewNameAsExternalName(mgr.GetClient()), &tagger{kube: mgr.GetClient()}), + managed.WithLogger(l.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) +} + +func preObserve(_ context.Context, cr *svcapitypes.LaunchTemplate, obj *svcsdk.DescribeLaunchTemplatesInput) error { + obj.LaunchTemplateNames = append(obj.LaunchTemplateNames, aws.String(meta.GetExternalName(cr))) + return nil +} + +func preUpdate(_ context.Context, cr *svcapitypes.LaunchTemplate, obj *svcsdk.ModifyLaunchTemplateInput) error { + obj.LaunchTemplateName = aws.String(meta.GetExternalName(cr)) + return nil +} + +func preDelete(_ context.Context, cr *svcapitypes.LaunchTemplate, obj *svcsdk.DeleteLaunchTemplateInput) (bool, error) { + obj.LaunchTemplateName = aws.String(meta.GetExternalName(cr)) + return false, nil +} + +func postCreate(_ context.Context, cr *svcapitypes.LaunchTemplate, resp *svcsdk.CreateLaunchTemplateOutput, cre managed.ExternalCreation, err error) (managed.ExternalCreation, error) { + if err != nil { + return managed.ExternalCreation{}, err + } + meta.SetExternalName(cr, aws.StringValue(resp.LaunchTemplate.LaunchTemplateName)) + return cre, nil +} + +func postObserve(_ context.Context, cr *svcapitypes.LaunchTemplate, _ *svcsdk.DescribeLaunchTemplatesOutput, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) { + if err != nil { + return managed.ExternalObservation{}, err + } + cr.SetConditions(xpv1.Available()) + return obs, nil +} + +const ( + errKubeUpdateFailed = "cannot update LaunchTemplate custom resource" +) + +type tagger struct { + kube client.Client +} + +func (t *tagger) Initialize(ctx context.Context, mgd resource.Managed) error { + cr, ok := mgd.(*svcapitypes.LaunchTemplate) + if !ok { + return errors.New(errUnexpectedObject) + } + var launchTemplateTags svcapitypes.TagSpecification + for _, tagSpecification := range cr.Spec.ForProvider.TagSpecifications { + if aws.StringValue(tagSpecification.ResourceType) == "launch-template" { + launchTemplateTags = *tagSpecification + } + } + + tagMap := map[string]string{} + tagMap["Name"] = cr.Name + for _, t := range launchTemplateTags.Tags { + tagMap[aws.StringValue(t.Key)] = aws.StringValue(t.Value) + } + for k, v := range resource.GetExternalTags(mgd) { + tagMap[k] = v + } + launchTemplateTags.Tags = make([]*svcapitypes.Tag, len(tagMap)) + launchTemplateTags.ResourceType = aws.String("launch-template") + i := 0 + for k, v := range tagMap { + launchTemplateTags.Tags[i] = &svcapitypes.Tag{Key: aws.String(k), Value: aws.String(v)} + i++ + } + sort.Slice(launchTemplateTags.Tags, func(i, j int) bool { + return aws.StringValue(launchTemplateTags.Tags[i].Key) < aws.StringValue(launchTemplateTags.Tags[j].Key) + }) + + cr.Spec.ForProvider.TagSpecifications = []*svcapitypes.TagSpecification{&launchTemplateTags} + return errors.Wrap(t.kube.Update(ctx, cr), errKubeUpdateFailed) +} diff --git a/pkg/controller/ec2/launchtemplate/zz_controller.go b/pkg/controller/ec2/launchtemplate/zz_controller.go new file mode 100644 index 0000000000..4cf0a359c3 --- /dev/null +++ b/pkg/controller/ec2/launchtemplate/zz_controller.go @@ -0,0 +1,289 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License 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 launchtemplate + +import ( + "context" + + svcapi "github.com/aws/aws-sdk-go/service/ec2" + svcsdk "github.com/aws/aws-sdk-go/service/ec2" + svcsdkapi "github.com/aws/aws-sdk-go/service/ec2/ec2iface" + "github.com/google/go-cmp/cmp" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/meta" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + cpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + + svcapitypes "github.com/crossplane/provider-aws/apis/ec2/v1alpha1" + awsclient "github.com/crossplane/provider-aws/pkg/clients" +) + +const ( + errUnexpectedObject = "managed resource is not an LaunchTemplate resource" + + errCreateSession = "cannot create a new session" + errCreate = "cannot create LaunchTemplate in AWS" + errUpdate = "cannot update LaunchTemplate in AWS" + errDescribe = "failed to describe LaunchTemplate" + errDelete = "failed to delete LaunchTemplate" +) + +type connector struct { + kube client.Client + opts []option +} + +func (c *connector) Connect(ctx context.Context, mg cpresource.Managed) (managed.ExternalClient, error) { + cr, ok := mg.(*svcapitypes.LaunchTemplate) + if !ok { + return nil, errors.New(errUnexpectedObject) + } + sess, err := awsclient.GetConfigV1(ctx, c.kube, mg, cr.Spec.ForProvider.Region) + if err != nil { + return nil, errors.Wrap(err, errCreateSession) + } + return newExternal(c.kube, svcapi.New(sess), c.opts), nil +} + +func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed.ExternalObservation, error) { + cr, ok := mg.(*svcapitypes.LaunchTemplate) + if !ok { + return managed.ExternalObservation{}, errors.New(errUnexpectedObject) + } + if meta.GetExternalName(cr) == "" { + return managed.ExternalObservation{ + ResourceExists: false, + }, nil + } + input := GenerateDescribeLaunchTemplatesInput(cr) + if err := e.preObserve(ctx, cr, input); err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "pre-observe failed") + } + resp, err := e.client.DescribeLaunchTemplatesWithContext(ctx, input) + if err != nil { + return managed.ExternalObservation{ResourceExists: false}, awsclient.Wrap(cpresource.Ignore(IsNotFound, err), errDescribe) + } + resp = e.filterList(cr, resp) + if len(resp.LaunchTemplates) == 0 { + return managed.ExternalObservation{ResourceExists: false}, nil + } + currentSpec := cr.Spec.ForProvider.DeepCopy() + if err := e.lateInitialize(&cr.Spec.ForProvider, resp); err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") + } + GenerateLaunchTemplate(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) + + upToDate, err := e.isUpToDate(cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } + return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ + ResourceExists: true, + ResourceUpToDate: upToDate, + ResourceLateInitialized: !cmp.Equal(&cr.Spec.ForProvider, currentSpec), + }, nil) +} + +func (e *external) Create(ctx context.Context, mg cpresource.Managed) (managed.ExternalCreation, error) { + cr, ok := mg.(*svcapitypes.LaunchTemplate) + if !ok { + return managed.ExternalCreation{}, errors.New(errUnexpectedObject) + } + cr.Status.SetConditions(xpv1.Creating()) + input := GenerateCreateLaunchTemplateInput(cr) + if err := e.preCreate(ctx, cr, input); err != nil { + return managed.ExternalCreation{}, errors.Wrap(err, "pre-create failed") + } + resp, err := e.client.CreateLaunchTemplateWithContext(ctx, input) + if err != nil { + return managed.ExternalCreation{}, awsclient.Wrap(err, errCreate) + } + + if resp.LaunchTemplate != nil { + f0 := &svcapitypes.LaunchTemplate_SDK{} + if resp.LaunchTemplate.CreateTime != nil { + f0.CreateTime = &metav1.Time{*resp.LaunchTemplate.CreateTime} + } + if resp.LaunchTemplate.CreatedBy != nil { + f0.CreatedBy = resp.LaunchTemplate.CreatedBy + } + if resp.LaunchTemplate.DefaultVersionNumber != nil { + f0.DefaultVersionNumber = resp.LaunchTemplate.DefaultVersionNumber + } + if resp.LaunchTemplate.LatestVersionNumber != nil { + f0.LatestVersionNumber = resp.LaunchTemplate.LatestVersionNumber + } + if resp.LaunchTemplate.LaunchTemplateId != nil { + f0.LaunchTemplateID = resp.LaunchTemplate.LaunchTemplateId + } + if resp.LaunchTemplate.LaunchTemplateName != nil { + f0.LaunchTemplateName = resp.LaunchTemplate.LaunchTemplateName + } + if resp.LaunchTemplate.Tags != nil { + f0f6 := []*svcapitypes.Tag{} + for _, f0f6iter := range resp.LaunchTemplate.Tags { + f0f6elem := &svcapitypes.Tag{} + if f0f6iter.Key != nil { + f0f6elem.Key = f0f6iter.Key + } + if f0f6iter.Value != nil { + f0f6elem.Value = f0f6iter.Value + } + f0f6 = append(f0f6, f0f6elem) + } + f0.Tags = f0f6 + } + cr.Status.AtProvider.LaunchTemplate = f0 + } else { + cr.Status.AtProvider.LaunchTemplate = nil + } + if resp.Warning != nil { + f1 := &svcapitypes.ValidationWarning{} + if resp.Warning.Errors != nil { + f1f0 := []*svcapitypes.ValidationError{} + for _, f1f0iter := range resp.Warning.Errors { + f1f0elem := &svcapitypes.ValidationError{} + if f1f0iter.Code != nil { + f1f0elem.Code = f1f0iter.Code + } + if f1f0iter.Message != nil { + f1f0elem.Message = f1f0iter.Message + } + f1f0 = append(f1f0, f1f0elem) + } + f1.Errors = f1f0 + } + cr.Status.AtProvider.Warning = f1 + } else { + cr.Status.AtProvider.Warning = nil + } + + return e.postCreate(ctx, cr, resp, managed.ExternalCreation{}, err) +} + +func (e *external) Update(ctx context.Context, mg cpresource.Managed) (managed.ExternalUpdate, error) { + cr, ok := mg.(*svcapitypes.LaunchTemplate) + if !ok { + return managed.ExternalUpdate{}, errors.New(errUnexpectedObject) + } + input := GenerateModifyLaunchTemplateInput(cr) + if err := e.preUpdate(ctx, cr, input); err != nil { + return managed.ExternalUpdate{}, errors.Wrap(err, "pre-update failed") + } + resp, err := e.client.ModifyLaunchTemplateWithContext(ctx, input) + return e.postUpdate(ctx, cr, resp, managed.ExternalUpdate{}, awsclient.Wrap(err, errUpdate)) +} + +func (e *external) Delete(ctx context.Context, mg cpresource.Managed) error { + cr, ok := mg.(*svcapitypes.LaunchTemplate) + if !ok { + return errors.New(errUnexpectedObject) + } + cr.Status.SetConditions(xpv1.Deleting()) + input := GenerateDeleteLaunchTemplateInput(cr) + ignore, err := e.preDelete(ctx, cr, input) + if err != nil { + return errors.Wrap(err, "pre-delete failed") + } + if ignore { + return nil + } + resp, err := e.client.DeleteLaunchTemplateWithContext(ctx, input) + return e.postDelete(ctx, cr, resp, awsclient.Wrap(cpresource.Ignore(IsNotFound, err), errDelete)) +} + +type option func(*external) + +func newExternal(kube client.Client, client svcsdkapi.EC2API, opts []option) *external { + e := &external{ + kube: kube, + client: client, + preObserve: nopPreObserve, + postObserve: nopPostObserve, + lateInitialize: nopLateInitialize, + isUpToDate: alwaysUpToDate, + filterList: nopFilterList, + preCreate: nopPreCreate, + postCreate: nopPostCreate, + preDelete: nopPreDelete, + postDelete: nopPostDelete, + preUpdate: nopPreUpdate, + postUpdate: nopPostUpdate, + } + for _, f := range opts { + f(e) + } + return e +} + +type external struct { + kube client.Client + client svcsdkapi.EC2API + preObserve func(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.DescribeLaunchTemplatesInput) error + postObserve func(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.DescribeLaunchTemplatesOutput, managed.ExternalObservation, error) (managed.ExternalObservation, error) + filterList func(*svcapitypes.LaunchTemplate, *svcsdk.DescribeLaunchTemplatesOutput) *svcsdk.DescribeLaunchTemplatesOutput + lateInitialize func(*svcapitypes.LaunchTemplateParameters, *svcsdk.DescribeLaunchTemplatesOutput) error + isUpToDate func(*svcapitypes.LaunchTemplate, *svcsdk.DescribeLaunchTemplatesOutput) (bool, error) + preCreate func(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.CreateLaunchTemplateInput) error + postCreate func(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.CreateLaunchTemplateOutput, managed.ExternalCreation, error) (managed.ExternalCreation, error) + preDelete func(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.DeleteLaunchTemplateInput) (bool, error) + postDelete func(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.DeleteLaunchTemplateOutput, error) error + preUpdate func(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.ModifyLaunchTemplateInput) error + postUpdate func(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.ModifyLaunchTemplateOutput, managed.ExternalUpdate, error) (managed.ExternalUpdate, error) +} + +func nopPreObserve(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.DescribeLaunchTemplatesInput) error { + return nil +} +func nopPostObserve(_ context.Context, _ *svcapitypes.LaunchTemplate, _ *svcsdk.DescribeLaunchTemplatesOutput, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) { + return obs, err +} +func nopFilterList(_ *svcapitypes.LaunchTemplate, list *svcsdk.DescribeLaunchTemplatesOutput) *svcsdk.DescribeLaunchTemplatesOutput { + return list +} + +func nopLateInitialize(*svcapitypes.LaunchTemplateParameters, *svcsdk.DescribeLaunchTemplatesOutput) error { + return nil +} +func alwaysUpToDate(*svcapitypes.LaunchTemplate, *svcsdk.DescribeLaunchTemplatesOutput) (bool, error) { + return true, nil +} + +func nopPreCreate(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.CreateLaunchTemplateInput) error { + return nil +} +func nopPostCreate(_ context.Context, _ *svcapitypes.LaunchTemplate, _ *svcsdk.CreateLaunchTemplateOutput, cre managed.ExternalCreation, err error) (managed.ExternalCreation, error) { + return cre, err +} +func nopPreDelete(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.DeleteLaunchTemplateInput) (bool, error) { + return false, nil +} +func nopPostDelete(_ context.Context, _ *svcapitypes.LaunchTemplate, _ *svcsdk.DeleteLaunchTemplateOutput, err error) error { + return err +} +func nopPreUpdate(context.Context, *svcapitypes.LaunchTemplate, *svcsdk.ModifyLaunchTemplateInput) error { + return nil +} +func nopPostUpdate(_ context.Context, _ *svcapitypes.LaunchTemplate, _ *svcsdk.ModifyLaunchTemplateOutput, upd managed.ExternalUpdate, err error) (managed.ExternalUpdate, error) { + return upd, err +} diff --git a/pkg/controller/ec2/launchtemplate/zz_conversions.go b/pkg/controller/ec2/launchtemplate/zz_conversions.go new file mode 100644 index 0000000000..e440d92917 --- /dev/null +++ b/pkg/controller/ec2/launchtemplate/zz_conversions.go @@ -0,0 +1,496 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License 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 launchtemplate + +import ( + "github.com/aws/aws-sdk-go/aws/awserr" + svcsdk "github.com/aws/aws-sdk-go/service/ec2" + + svcapitypes "github.com/crossplane/provider-aws/apis/ec2/v1alpha1" +) + +// NOTE(muvaf): We return pointers in case the function needs to start with an +// empty object, hence need to return a new pointer. + +// GenerateDescribeLaunchTemplatesInput returns input for read +// operation. +func GenerateDescribeLaunchTemplatesInput(cr *svcapitypes.LaunchTemplate) *svcsdk.DescribeLaunchTemplatesInput { + res := &svcsdk.DescribeLaunchTemplatesInput{} + + if cr.Spec.ForProvider.LaunchTemplateName != nil { + f3 := []*string{} + f3 = append(f3, cr.Spec.ForProvider.LaunchTemplateName) + res.SetLaunchTemplateNames(f3) + } + + return res +} + +// GenerateLaunchTemplate returns the current state in the form of *svcapitypes.LaunchTemplate. +func GenerateLaunchTemplate(resp *svcsdk.DescribeLaunchTemplatesOutput) *svcapitypes.LaunchTemplate { + cr := &svcapitypes.LaunchTemplate{} + + found := false + for _, elem := range resp.LaunchTemplates { + if elem.LaunchTemplateName != nil { + cr.Spec.ForProvider.LaunchTemplateName = elem.LaunchTemplateName + } else { + cr.Spec.ForProvider.LaunchTemplateName = nil + } + found = true + break + } + if !found { + return cr + } + + return cr +} + +// GenerateCreateLaunchTemplateInput returns a create input. +func GenerateCreateLaunchTemplateInput(cr *svcapitypes.LaunchTemplate) *svcsdk.CreateLaunchTemplateInput { + res := &svcsdk.CreateLaunchTemplateInput{} + + if cr.Spec.ForProvider.LaunchTemplateData != nil { + f0 := &svcsdk.RequestLaunchTemplateData{} + if cr.Spec.ForProvider.LaunchTemplateData.BlockDeviceMappings != nil { + f0f0 := []*svcsdk.LaunchTemplateBlockDeviceMappingRequest{} + for _, f0f0iter := range cr.Spec.ForProvider.LaunchTemplateData.BlockDeviceMappings { + f0f0elem := &svcsdk.LaunchTemplateBlockDeviceMappingRequest{} + if f0f0iter.DeviceName != nil { + f0f0elem.SetDeviceName(*f0f0iter.DeviceName) + } + if f0f0iter.EBS != nil { + f0f0elemf1 := &svcsdk.LaunchTemplateEbsBlockDeviceRequest{} + if f0f0iter.EBS.DeleteOnTermination != nil { + f0f0elemf1.SetDeleteOnTermination(*f0f0iter.EBS.DeleteOnTermination) + } + if f0f0iter.EBS.Encrypted != nil { + f0f0elemf1.SetEncrypted(*f0f0iter.EBS.Encrypted) + } + if f0f0iter.EBS.IOPS != nil { + f0f0elemf1.SetIops(*f0f0iter.EBS.IOPS) + } + if f0f0iter.EBS.KMSKeyID != nil { + f0f0elemf1.SetKmsKeyId(*f0f0iter.EBS.KMSKeyID) + } + if f0f0iter.EBS.SnapshotID != nil { + f0f0elemf1.SetSnapshotId(*f0f0iter.EBS.SnapshotID) + } + if f0f0iter.EBS.Throughput != nil { + f0f0elemf1.SetThroughput(*f0f0iter.EBS.Throughput) + } + if f0f0iter.EBS.VolumeSize != nil { + f0f0elemf1.SetVolumeSize(*f0f0iter.EBS.VolumeSize) + } + if f0f0iter.EBS.VolumeType != nil { + f0f0elemf1.SetVolumeType(*f0f0iter.EBS.VolumeType) + } + f0f0elem.SetEbs(f0f0elemf1) + } + if f0f0iter.NoDevice != nil { + f0f0elem.SetNoDevice(*f0f0iter.NoDevice) + } + if f0f0iter.VirtualName != nil { + f0f0elem.SetVirtualName(*f0f0iter.VirtualName) + } + f0f0 = append(f0f0, f0f0elem) + } + f0.SetBlockDeviceMappings(f0f0) + } + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification != nil { + f0f1 := &svcsdk.LaunchTemplateCapacityReservationSpecificationRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference != nil { + f0f1.SetCapacityReservationPreference(*cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference) + } + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget != nil { + f0f1f1 := &svcsdk.CapacityReservationTarget{} + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID != nil { + f0f1f1.SetCapacityReservationId(*cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID) + } + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN != nil { + f0f1f1.SetCapacityReservationResourceGroupArn(*cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN) + } + f0f1.SetCapacityReservationTarget(f0f1f1) + } + f0.SetCapacityReservationSpecification(f0f1) + } + if cr.Spec.ForProvider.LaunchTemplateData.CPUOptions != nil { + f0f2 := &svcsdk.LaunchTemplateCpuOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.CPUOptions.CoreCount != nil { + f0f2.SetCoreCount(*cr.Spec.ForProvider.LaunchTemplateData.CPUOptions.CoreCount) + } + if cr.Spec.ForProvider.LaunchTemplateData.CPUOptions.ThreadsPerCore != nil { + f0f2.SetThreadsPerCore(*cr.Spec.ForProvider.LaunchTemplateData.CPUOptions.ThreadsPerCore) + } + f0.SetCpuOptions(f0f2) + } + if cr.Spec.ForProvider.LaunchTemplateData.CreditSpecification != nil { + f0f3 := &svcsdk.CreditSpecificationRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.CreditSpecification.CPUCredits != nil { + f0f3.SetCpuCredits(*cr.Spec.ForProvider.LaunchTemplateData.CreditSpecification.CPUCredits) + } + f0.SetCreditSpecification(f0f3) + } + if cr.Spec.ForProvider.LaunchTemplateData.DisableAPITermination != nil { + f0.SetDisableApiTermination(*cr.Spec.ForProvider.LaunchTemplateData.DisableAPITermination) + } + if cr.Spec.ForProvider.LaunchTemplateData.EBSOptimized != nil { + f0.SetEbsOptimized(*cr.Spec.ForProvider.LaunchTemplateData.EBSOptimized) + } + if cr.Spec.ForProvider.LaunchTemplateData.ElasticGPUSpecifications != nil { + f0f6 := []*svcsdk.ElasticGpuSpecification{} + for _, f0f6iter := range cr.Spec.ForProvider.LaunchTemplateData.ElasticGPUSpecifications { + f0f6elem := &svcsdk.ElasticGpuSpecification{} + if f0f6iter.Type != nil { + f0f6elem.SetType(*f0f6iter.Type) + } + f0f6 = append(f0f6, f0f6elem) + } + f0.SetElasticGpuSpecifications(f0f6) + } + if cr.Spec.ForProvider.LaunchTemplateData.ElasticInferenceAccelerators != nil { + f0f7 := []*svcsdk.LaunchTemplateElasticInferenceAccelerator{} + for _, f0f7iter := range cr.Spec.ForProvider.LaunchTemplateData.ElasticInferenceAccelerators { + f0f7elem := &svcsdk.LaunchTemplateElasticInferenceAccelerator{} + if f0f7iter.Count != nil { + f0f7elem.SetCount(*f0f7iter.Count) + } + if f0f7iter.Type != nil { + f0f7elem.SetType(*f0f7iter.Type) + } + f0f7 = append(f0f7, f0f7elem) + } + f0.SetElasticInferenceAccelerators(f0f7) + } + if cr.Spec.ForProvider.LaunchTemplateData.EnclaveOptions != nil { + f0f8 := &svcsdk.LaunchTemplateEnclaveOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.EnclaveOptions.Enabled != nil { + f0f8.SetEnabled(*cr.Spec.ForProvider.LaunchTemplateData.EnclaveOptions.Enabled) + } + f0.SetEnclaveOptions(f0f8) + } + if cr.Spec.ForProvider.LaunchTemplateData.HibernationOptions != nil { + f0f9 := &svcsdk.LaunchTemplateHibernationOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.HibernationOptions.Configured != nil { + f0f9.SetConfigured(*cr.Spec.ForProvider.LaunchTemplateData.HibernationOptions.Configured) + } + f0.SetHibernationOptions(f0f9) + } + if cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile != nil { + f0f10 := &svcsdk.LaunchTemplateIamInstanceProfileSpecificationRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile.ARN != nil { + f0f10.SetArn(*cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile.ARN) + } + if cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile.Name != nil { + f0f10.SetName(*cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile.Name) + } + f0.SetIamInstanceProfile(f0f10) + } + if cr.Spec.ForProvider.LaunchTemplateData.ImageID != nil { + f0.SetImageId(*cr.Spec.ForProvider.LaunchTemplateData.ImageID) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceInitiatedShutdownBehavior != nil { + f0.SetInstanceInitiatedShutdownBehavior(*cr.Spec.ForProvider.LaunchTemplateData.InstanceInitiatedShutdownBehavior) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions != nil { + f0f13 := &svcsdk.LaunchTemplateInstanceMarketOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.MarketType != nil { + f0f13.SetMarketType(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.MarketType) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions != nil { + f0f13f1 := &svcsdk.LaunchTemplateSpotMarketOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil { + f0f13f1.SetBlockDurationMinutes(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil { + f0f13f1.SetInstanceInterruptionBehavior(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice != nil { + f0f13f1.SetMaxPrice(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil { + f0f13f1.SetSpotInstanceType(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil != nil { + f0f13f1.SetValidUntil(cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil.Time) + } + f0f13.SetSpotOptions(f0f13f1) + } + f0.SetInstanceMarketOptions(f0f13) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceType != nil { + f0.SetInstanceType(*cr.Spec.ForProvider.LaunchTemplateData.InstanceType) + } + if cr.Spec.ForProvider.LaunchTemplateData.KernelID != nil { + f0.SetKernelId(*cr.Spec.ForProvider.LaunchTemplateData.KernelID) + } + if cr.Spec.ForProvider.LaunchTemplateData.KeyName != nil { + f0.SetKeyName(*cr.Spec.ForProvider.LaunchTemplateData.KeyName) + } + if cr.Spec.ForProvider.LaunchTemplateData.LicenseSpecifications != nil { + f0f17 := []*svcsdk.LaunchTemplateLicenseConfigurationRequest{} + for _, f0f17iter := range cr.Spec.ForProvider.LaunchTemplateData.LicenseSpecifications { + f0f17elem := &svcsdk.LaunchTemplateLicenseConfigurationRequest{} + if f0f17iter.LicenseConfigurationARN != nil { + f0f17elem.SetLicenseConfigurationArn(*f0f17iter.LicenseConfigurationARN) + } + f0f17 = append(f0f17, f0f17elem) + } + f0.SetLicenseSpecifications(f0f17) + } + if cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions != nil { + f0f18 := &svcsdk.LaunchTemplateInstanceMetadataOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPEndpoint != nil { + f0f18.SetHttpEndpoint(*cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPEndpoint) + } + if cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPPutResponseHopLimit != nil { + f0f18.SetHttpPutResponseHopLimit(*cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPPutResponseHopLimit) + } + if cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPTokens != nil { + f0f18.SetHttpTokens(*cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPTokens) + } + f0.SetMetadataOptions(f0f18) + } + if cr.Spec.ForProvider.LaunchTemplateData.Monitoring != nil { + f0f19 := &svcsdk.LaunchTemplatesMonitoringRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.Monitoring.Enabled != nil { + f0f19.SetEnabled(*cr.Spec.ForProvider.LaunchTemplateData.Monitoring.Enabled) + } + f0.SetMonitoring(f0f19) + } + if cr.Spec.ForProvider.LaunchTemplateData.NetworkInterfaces != nil { + f0f20 := []*svcsdk.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} + for _, f0f20iter := range cr.Spec.ForProvider.LaunchTemplateData.NetworkInterfaces { + f0f20elem := &svcsdk.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} + if f0f20iter.AssociateCarrierIPAddress != nil { + f0f20elem.SetAssociateCarrierIpAddress(*f0f20iter.AssociateCarrierIPAddress) + } + if f0f20iter.AssociatePublicIPAddress != nil { + f0f20elem.SetAssociatePublicIpAddress(*f0f20iter.AssociatePublicIPAddress) + } + if f0f20iter.DeleteOnTermination != nil { + f0f20elem.SetDeleteOnTermination(*f0f20iter.DeleteOnTermination) + } + if f0f20iter.Description != nil { + f0f20elem.SetDescription(*f0f20iter.Description) + } + if f0f20iter.DeviceIndex != nil { + f0f20elem.SetDeviceIndex(*f0f20iter.DeviceIndex) + } + if f0f20iter.Groups != nil { + f0f20elemf5 := []*string{} + for _, f0f20elemf5iter := range f0f20iter.Groups { + var f0f20elemf5elem string + f0f20elemf5elem = *f0f20elemf5iter + f0f20elemf5 = append(f0f20elemf5, &f0f20elemf5elem) + } + f0f20elem.SetGroups(f0f20elemf5) + } + if f0f20iter.InterfaceType != nil { + f0f20elem.SetInterfaceType(*f0f20iter.InterfaceType) + } + if f0f20iter.IPv6AddressCount != nil { + f0f20elem.SetIpv6AddressCount(*f0f20iter.IPv6AddressCount) + } + if f0f20iter.IPv6Addresses != nil { + f0f20elemf8 := []*svcsdk.InstanceIpv6AddressRequest{} + for _, f0f20elemf8iter := range f0f20iter.IPv6Addresses { + f0f20elemf8elem := &svcsdk.InstanceIpv6AddressRequest{} + if f0f20elemf8iter.IPv6Address != nil { + f0f20elemf8elem.SetIpv6Address(*f0f20elemf8iter.IPv6Address) + } + f0f20elemf8 = append(f0f20elemf8, f0f20elemf8elem) + } + f0f20elem.SetIpv6Addresses(f0f20elemf8) + } + if f0f20iter.NetworkCardIndex != nil { + f0f20elem.SetNetworkCardIndex(*f0f20iter.NetworkCardIndex) + } + if f0f20iter.NetworkInterfaceID != nil { + f0f20elem.SetNetworkInterfaceId(*f0f20iter.NetworkInterfaceID) + } + if f0f20iter.PrivateIPAddress != nil { + f0f20elem.SetPrivateIpAddress(*f0f20iter.PrivateIPAddress) + } + if f0f20iter.PrivateIPAddresses != nil { + f0f20elemf12 := []*svcsdk.PrivateIpAddressSpecification{} + for _, f0f20elemf12iter := range f0f20iter.PrivateIPAddresses { + f0f20elemf12elem := &svcsdk.PrivateIpAddressSpecification{} + if f0f20elemf12iter.Primary != nil { + f0f20elemf12elem.SetPrimary(*f0f20elemf12iter.Primary) + } + if f0f20elemf12iter.PrivateIPAddress != nil { + f0f20elemf12elem.SetPrivateIpAddress(*f0f20elemf12iter.PrivateIPAddress) + } + f0f20elemf12 = append(f0f20elemf12, f0f20elemf12elem) + } + f0f20elem.SetPrivateIpAddresses(f0f20elemf12) + } + if f0f20iter.SecondaryPrivateIPAddressCount != nil { + f0f20elem.SetSecondaryPrivateIpAddressCount(*f0f20iter.SecondaryPrivateIPAddressCount) + } + if f0f20iter.SubnetID != nil { + f0f20elem.SetSubnetId(*f0f20iter.SubnetID) + } + f0f20 = append(f0f20, f0f20elem) + } + f0.SetNetworkInterfaces(f0f20) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement != nil { + f0f21 := &svcsdk.LaunchTemplatePlacementRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.Placement.Affinity != nil { + f0f21.SetAffinity(*cr.Spec.ForProvider.LaunchTemplateData.Placement.Affinity) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.AvailabilityZone != nil { + f0f21.SetAvailabilityZone(*cr.Spec.ForProvider.LaunchTemplateData.Placement.AvailabilityZone) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.GroupName != nil { + f0f21.SetGroupName(*cr.Spec.ForProvider.LaunchTemplateData.Placement.GroupName) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.HostID != nil { + f0f21.SetHostId(*cr.Spec.ForProvider.LaunchTemplateData.Placement.HostID) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.HostResourceGroupARN != nil { + f0f21.SetHostResourceGroupArn(*cr.Spec.ForProvider.LaunchTemplateData.Placement.HostResourceGroupARN) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.PartitionNumber != nil { + f0f21.SetPartitionNumber(*cr.Spec.ForProvider.LaunchTemplateData.Placement.PartitionNumber) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.SpreadDomain != nil { + f0f21.SetSpreadDomain(*cr.Spec.ForProvider.LaunchTemplateData.Placement.SpreadDomain) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.Tenancy != nil { + f0f21.SetTenancy(*cr.Spec.ForProvider.LaunchTemplateData.Placement.Tenancy) + } + f0.SetPlacement(f0f21) + } + if cr.Spec.ForProvider.LaunchTemplateData.RamDiskID != nil { + f0.SetRamDiskId(*cr.Spec.ForProvider.LaunchTemplateData.RamDiskID) + } + if cr.Spec.ForProvider.LaunchTemplateData.SecurityGroupIDs != nil { + f0f23 := []*string{} + for _, f0f23iter := range cr.Spec.ForProvider.LaunchTemplateData.SecurityGroupIDs { + var f0f23elem string + f0f23elem = *f0f23iter + f0f23 = append(f0f23, &f0f23elem) + } + f0.SetSecurityGroupIds(f0f23) + } + if cr.Spec.ForProvider.LaunchTemplateData.SecurityGroups != nil { + f0f24 := []*string{} + for _, f0f24iter := range cr.Spec.ForProvider.LaunchTemplateData.SecurityGroups { + var f0f24elem string + f0f24elem = *f0f24iter + f0f24 = append(f0f24, &f0f24elem) + } + f0.SetSecurityGroups(f0f24) + } + if cr.Spec.ForProvider.LaunchTemplateData.TagSpecifications != nil { + f0f25 := []*svcsdk.LaunchTemplateTagSpecificationRequest{} + for _, f0f25iter := range cr.Spec.ForProvider.LaunchTemplateData.TagSpecifications { + f0f25elem := &svcsdk.LaunchTemplateTagSpecificationRequest{} + if f0f25iter.ResourceType != nil { + f0f25elem.SetResourceType(*f0f25iter.ResourceType) + } + if f0f25iter.Tags != nil { + f0f25elemf1 := []*svcsdk.Tag{} + for _, f0f25elemf1iter := range f0f25iter.Tags { + f0f25elemf1elem := &svcsdk.Tag{} + if f0f25elemf1iter.Key != nil { + f0f25elemf1elem.SetKey(*f0f25elemf1iter.Key) + } + if f0f25elemf1iter.Value != nil { + f0f25elemf1elem.SetValue(*f0f25elemf1iter.Value) + } + f0f25elemf1 = append(f0f25elemf1, f0f25elemf1elem) + } + f0f25elem.SetTags(f0f25elemf1) + } + f0f25 = append(f0f25, f0f25elem) + } + f0.SetTagSpecifications(f0f25) + } + if cr.Spec.ForProvider.LaunchTemplateData.UserData != nil { + f0.SetUserData(*cr.Spec.ForProvider.LaunchTemplateData.UserData) + } + res.SetLaunchTemplateData(f0) + } + if cr.Spec.ForProvider.LaunchTemplateName != nil { + res.SetLaunchTemplateName(*cr.Spec.ForProvider.LaunchTemplateName) + } + if cr.Spec.ForProvider.TagSpecifications != nil { + f2 := []*svcsdk.TagSpecification{} + for _, f2iter := range cr.Spec.ForProvider.TagSpecifications { + f2elem := &svcsdk.TagSpecification{} + if f2iter.ResourceType != nil { + f2elem.SetResourceType(*f2iter.ResourceType) + } + if f2iter.Tags != nil { + f2elemf1 := []*svcsdk.Tag{} + for _, f2elemf1iter := range f2iter.Tags { + f2elemf1elem := &svcsdk.Tag{} + if f2elemf1iter.Key != nil { + f2elemf1elem.SetKey(*f2elemf1iter.Key) + } + if f2elemf1iter.Value != nil { + f2elemf1elem.SetValue(*f2elemf1iter.Value) + } + f2elemf1 = append(f2elemf1, f2elemf1elem) + } + f2elem.SetTags(f2elemf1) + } + f2 = append(f2, f2elem) + } + res.SetTagSpecifications(f2) + } + if cr.Spec.ForProvider.VersionDescription != nil { + res.SetVersionDescription(*cr.Spec.ForProvider.VersionDescription) + } + + return res +} + +// GenerateModifyLaunchTemplateInput returns an update input. +func GenerateModifyLaunchTemplateInput(cr *svcapitypes.LaunchTemplate) *svcsdk.ModifyLaunchTemplateInput { + res := &svcsdk.ModifyLaunchTemplateInput{} + + if cr.Spec.ForProvider.LaunchTemplateName != nil { + res.SetLaunchTemplateName(*cr.Spec.ForProvider.LaunchTemplateName) + } + + return res +} + +// GenerateDeleteLaunchTemplateInput returns a deletion input. +func GenerateDeleteLaunchTemplateInput(cr *svcapitypes.LaunchTemplate) *svcsdk.DeleteLaunchTemplateInput { + res := &svcsdk.DeleteLaunchTemplateInput{} + + if cr.Spec.ForProvider.LaunchTemplateName != nil { + res.SetLaunchTemplateName(*cr.Spec.ForProvider.LaunchTemplateName) + } + + return res +} + +// IsNotFound returns whether the given error is of type NotFound or not. +func IsNotFound(err error) bool { + awsErr, ok := err.(awserr.Error) + return ok && awsErr.Code() == "InvalidLaunchTemplateName.NotFoundException" +} diff --git a/pkg/controller/ec2/launchtemplateversion/setup.go b/pkg/controller/ec2/launchtemplateversion/setup.go new file mode 100644 index 0000000000..af92f0f929 --- /dev/null +++ b/pkg/controller/ec2/launchtemplateversion/setup.go @@ -0,0 +1,105 @@ +package launchtemplateversion + +import ( + "context" + "strconv" + "time" + + svcsdk "github.com/aws/aws-sdk-go/service/ec2" + "k8s.io/client-go/util/workqueue" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/controller" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/meta" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + cpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + + svcapitypes "github.com/crossplane/provider-aws/apis/ec2/v1alpha1" + aws "github.com/crossplane/provider-aws/pkg/clients" +) + +// SetupLaunchTemplateVersion adds a controller that reconciles LaunchTemplateVersion. +func SetupLaunchTemplateVersion(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { + name := managed.ControllerName(svcapitypes.LaunchTemplateVersionGroupKind) + opts := []option{ + func(e *external) { + e.preObserve = preObserve + e.postCreate = postCreate + e.postObserve = postObserve + e.preCreate = preCreate + e.delete = e.deleter + }, + } + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(controller.Options{ + RateLimiter: ratelimiter.NewController(rl), + }). + For(&svcapitypes.LaunchTemplateVersion{}). + Complete(managed.NewReconciler(mgr, + cpresource.ManagedKind(svcapitypes.LaunchTemplateVersionGroupVersionKind), + managed.WithExternalConnecter(&connector{kube: mgr.GetClient(), opts: opts}), + managed.WithInitializers(), + managed.WithPollInterval(poll), + managed.WithLogger(l.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) +} + +func preCreate(_ context.Context, cr *svcapitypes.LaunchTemplateVersion, obj *svcsdk.CreateLaunchTemplateVersionInput) error { + obj.LaunchTemplateName = cr.Spec.ForProvider.LaunchTemplateName + obj.LaunchTemplateId = cr.Spec.ForProvider.LaunchTemplateID + return nil +} + +func preObserve(_ context.Context, cr *svcapitypes.LaunchTemplateVersion, obj *svcsdk.DescribeLaunchTemplateVersionsInput) error { + obj.LaunchTemplateName = cr.Spec.ForProvider.LaunchTemplateName + obj.LaunchTemplateId = cr.Spec.ForProvider.LaunchTemplateID + obj.Versions = append(obj.Versions, aws.String(meta.GetExternalName(cr))) + return nil +} + +func postCreate(_ context.Context, cr *svcapitypes.LaunchTemplateVersion, resp *svcsdk.CreateLaunchTemplateVersionOutput, cre managed.ExternalCreation, err error) (managed.ExternalCreation, error) { + if err != nil { + return managed.ExternalCreation{}, err + } + meta.SetExternalName(cr, strconv.FormatInt(*resp.LaunchTemplateVersion.VersionNumber, 10)) + return cre, nil +} + +func postObserve(_ context.Context, cr *svcapitypes.LaunchTemplateVersion, obj *svcsdk.DescribeLaunchTemplateVersionsOutput, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) { + if err != nil { + return managed.ExternalObservation{}, err + } + cr.SetConditions(xpv1.Available()) + return obs, nil +} + +func (e *external) deleter(ctx context.Context, mg cpresource.Managed) error { + cr, _ := mg.(*svcapitypes.LaunchTemplateVersion) + input := GenerateDeleteLaunchTemplateVersionInput(cr) + _, err := e.client.DeleteLaunchTemplateVersionsWithContext(ctx, input) + if err != nil { + return err + } + return nil +} + +// GenerateDeleteLaunchTemplateVersionInput returns a deletion input. +func GenerateDeleteLaunchTemplateVersionInput(cr *svcapitypes.LaunchTemplateVersion) *svcsdk.DeleteLaunchTemplateVersionsInput { + res := &svcsdk.DeleteLaunchTemplateVersionsInput{} + res.SetDryRun(false) + if cr.Spec.ForProvider.LaunchTemplateName != nil { + res.SetLaunchTemplateName(aws.StringValue(cr.Spec.ForProvider.LaunchTemplateName)) + } + if cr.Spec.ForProvider.LaunchTemplateID != nil { + res.SetLaunchTemplateId(aws.StringValue(cr.Spec.ForProvider.LaunchTemplateID)) + } + if meta.GetExternalName(cr) != "" { + res.SetVersions(append(res.Versions, aws.String(meta.GetExternalName(cr)))) + } + return res +} diff --git a/pkg/controller/ec2/launchtemplateversion/zz_controller.go b/pkg/controller/ec2/launchtemplateversion/zz_controller.go new file mode 100644 index 0000000000..81a4e56a66 --- /dev/null +++ b/pkg/controller/ec2/launchtemplateversion/zz_controller.go @@ -0,0 +1,620 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License 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 launchtemplateversion + +import ( + "context" + + svcapi "github.com/aws/aws-sdk-go/service/ec2" + svcsdk "github.com/aws/aws-sdk-go/service/ec2" + svcsdkapi "github.com/aws/aws-sdk-go/service/ec2/ec2iface" + "github.com/google/go-cmp/cmp" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/meta" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + cpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + + svcapitypes "github.com/crossplane/provider-aws/apis/ec2/v1alpha1" + awsclient "github.com/crossplane/provider-aws/pkg/clients" +) + +const ( + errUnexpectedObject = "managed resource is not an LaunchTemplateVersion resource" + + errCreateSession = "cannot create a new session" + errCreate = "cannot create LaunchTemplateVersion in AWS" + errUpdate = "cannot update LaunchTemplateVersion in AWS" + errDescribe = "failed to describe LaunchTemplateVersion" + errDelete = "failed to delete LaunchTemplateVersion" +) + +type connector struct { + kube client.Client + opts []option +} + +func (c *connector) Connect(ctx context.Context, mg cpresource.Managed) (managed.ExternalClient, error) { + cr, ok := mg.(*svcapitypes.LaunchTemplateVersion) + if !ok { + return nil, errors.New(errUnexpectedObject) + } + sess, err := awsclient.GetConfigV1(ctx, c.kube, mg, cr.Spec.ForProvider.Region) + if err != nil { + return nil, errors.Wrap(err, errCreateSession) + } + return newExternal(c.kube, svcapi.New(sess), c.opts), nil +} + +func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed.ExternalObservation, error) { + cr, ok := mg.(*svcapitypes.LaunchTemplateVersion) + if !ok { + return managed.ExternalObservation{}, errors.New(errUnexpectedObject) + } + if meta.GetExternalName(cr) == "" { + return managed.ExternalObservation{ + ResourceExists: false, + }, nil + } + input := GenerateDescribeLaunchTemplateVersionsInput(cr) + if err := e.preObserve(ctx, cr, input); err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "pre-observe failed") + } + resp, err := e.client.DescribeLaunchTemplateVersionsWithContext(ctx, input) + if err != nil { + return managed.ExternalObservation{ResourceExists: false}, awsclient.Wrap(cpresource.Ignore(IsNotFound, err), errDescribe) + } + resp = e.filterList(cr, resp) + if len(resp.LaunchTemplateVersions) == 0 { + return managed.ExternalObservation{ResourceExists: false}, nil + } + currentSpec := cr.Spec.ForProvider.DeepCopy() + if err := e.lateInitialize(&cr.Spec.ForProvider, resp); err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") + } + GenerateLaunchTemplateVersion(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) + + upToDate, err := e.isUpToDate(cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } + return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ + ResourceExists: true, + ResourceUpToDate: upToDate, + ResourceLateInitialized: !cmp.Equal(&cr.Spec.ForProvider, currentSpec), + }, nil) +} + +func (e *external) Create(ctx context.Context, mg cpresource.Managed) (managed.ExternalCreation, error) { + cr, ok := mg.(*svcapitypes.LaunchTemplateVersion) + if !ok { + return managed.ExternalCreation{}, errors.New(errUnexpectedObject) + } + cr.Status.SetConditions(xpv1.Creating()) + input := GenerateCreateLaunchTemplateVersionInput(cr) + if err := e.preCreate(ctx, cr, input); err != nil { + return managed.ExternalCreation{}, errors.Wrap(err, "pre-create failed") + } + resp, err := e.client.CreateLaunchTemplateVersionWithContext(ctx, input) + if err != nil { + return managed.ExternalCreation{}, awsclient.Wrap(err, errCreate) + } + + if resp.LaunchTemplateVersion != nil { + f0 := &svcapitypes.LaunchTemplateVersion_SDK{} + if resp.LaunchTemplateVersion.CreateTime != nil { + f0.CreateTime = &metav1.Time{*resp.LaunchTemplateVersion.CreateTime} + } + if resp.LaunchTemplateVersion.CreatedBy != nil { + f0.CreatedBy = resp.LaunchTemplateVersion.CreatedBy + } + if resp.LaunchTemplateVersion.DefaultVersion != nil { + f0.DefaultVersion = resp.LaunchTemplateVersion.DefaultVersion + } + if resp.LaunchTemplateVersion.LaunchTemplateData != nil { + f0f3 := &svcapitypes.ResponseLaunchTemplateData{} + if resp.LaunchTemplateVersion.LaunchTemplateData.BlockDeviceMappings != nil { + f0f3f0 := []*svcapitypes.LaunchTemplateBlockDeviceMapping{} + for _, f0f3f0iter := range resp.LaunchTemplateVersion.LaunchTemplateData.BlockDeviceMappings { + f0f3f0elem := &svcapitypes.LaunchTemplateBlockDeviceMapping{} + if f0f3f0iter.DeviceName != nil { + f0f3f0elem.DeviceName = f0f3f0iter.DeviceName + } + if f0f3f0iter.Ebs != nil { + f0f3f0elemf1 := &svcapitypes.LaunchTemplateEBSBlockDevice{} + if f0f3f0iter.Ebs.DeleteOnTermination != nil { + f0f3f0elemf1.DeleteOnTermination = f0f3f0iter.Ebs.DeleteOnTermination + } + if f0f3f0iter.Ebs.Encrypted != nil { + f0f3f0elemf1.Encrypted = f0f3f0iter.Ebs.Encrypted + } + if f0f3f0iter.Ebs.Iops != nil { + f0f3f0elemf1.IOPS = f0f3f0iter.Ebs.Iops + } + if f0f3f0iter.Ebs.KmsKeyId != nil { + f0f3f0elemf1.KMSKeyID = f0f3f0iter.Ebs.KmsKeyId + } + if f0f3f0iter.Ebs.SnapshotId != nil { + f0f3f0elemf1.SnapshotID = f0f3f0iter.Ebs.SnapshotId + } + if f0f3f0iter.Ebs.Throughput != nil { + f0f3f0elemf1.Throughput = f0f3f0iter.Ebs.Throughput + } + if f0f3f0iter.Ebs.VolumeSize != nil { + f0f3f0elemf1.VolumeSize = f0f3f0iter.Ebs.VolumeSize + } + if f0f3f0iter.Ebs.VolumeType != nil { + f0f3f0elemf1.VolumeType = f0f3f0iter.Ebs.VolumeType + } + f0f3f0elem.EBS = f0f3f0elemf1 + } + if f0f3f0iter.NoDevice != nil { + f0f3f0elem.NoDevice = f0f3f0iter.NoDevice + } + if f0f3f0iter.VirtualName != nil { + f0f3f0elem.VirtualName = f0f3f0iter.VirtualName + } + f0f3f0 = append(f0f3f0, f0f3f0elem) + } + f0f3.BlockDeviceMappings = f0f3f0 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification != nil { + f0f3f1 := &svcapitypes.LaunchTemplateCapacityReservationSpecificationResponse{} + if resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference != nil { + f0f3f1.CapacityReservationPreference = resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference + } + if resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget != nil { + f0f3f1f1 := &svcapitypes.CapacityReservationTargetResponse{} + if resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId != nil { + f0f3f1f1.CapacityReservationID = resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId + } + if resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn != nil { + f0f3f1f1.CapacityReservationResourceGroupARN = resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn + } + f0f3f1.CapacityReservationTarget = f0f3f1f1 + } + f0f3.CapacityReservationSpecification = f0f3f1 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions != nil { + f0f3f2 := &svcapitypes.LaunchTemplateCPUOptions{} + if resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions.CoreCount != nil { + f0f3f2.CoreCount = resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions.CoreCount + } + if resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions.ThreadsPerCore != nil { + f0f3f2.ThreadsPerCore = resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions.ThreadsPerCore + } + f0f3.CPUOptions = f0f3f2 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.CreditSpecification != nil { + f0f3f3 := &svcapitypes.CreditSpecification{} + if resp.LaunchTemplateVersion.LaunchTemplateData.CreditSpecification.CpuCredits != nil { + f0f3f3.CPUCredits = resp.LaunchTemplateVersion.LaunchTemplateData.CreditSpecification.CpuCredits + } + f0f3.CreditSpecification = f0f3f3 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.DisableApiTermination != nil { + f0f3.DisableAPITermination = resp.LaunchTemplateVersion.LaunchTemplateData.DisableApiTermination + } + if resp.LaunchTemplateVersion.LaunchTemplateData.EbsOptimized != nil { + f0f3.EBSOptimized = resp.LaunchTemplateVersion.LaunchTemplateData.EbsOptimized + } + if resp.LaunchTemplateVersion.LaunchTemplateData.ElasticGpuSpecifications != nil { + f0f3f6 := []*svcapitypes.ElasticGPUSpecificationResponse{} + for _, f0f3f6iter := range resp.LaunchTemplateVersion.LaunchTemplateData.ElasticGpuSpecifications { + f0f3f6elem := &svcapitypes.ElasticGPUSpecificationResponse{} + if f0f3f6iter.Type != nil { + f0f3f6elem.Type = f0f3f6iter.Type + } + f0f3f6 = append(f0f3f6, f0f3f6elem) + } + f0f3.ElasticGPUSpecifications = f0f3f6 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.ElasticInferenceAccelerators != nil { + f0f3f7 := []*svcapitypes.LaunchTemplateElasticInferenceAcceleratorResponse{} + for _, f0f3f7iter := range resp.LaunchTemplateVersion.LaunchTemplateData.ElasticInferenceAccelerators { + f0f3f7elem := &svcapitypes.LaunchTemplateElasticInferenceAcceleratorResponse{} + if f0f3f7iter.Count != nil { + f0f3f7elem.Count = f0f3f7iter.Count + } + if f0f3f7iter.Type != nil { + f0f3f7elem.Type = f0f3f7iter.Type + } + f0f3f7 = append(f0f3f7, f0f3f7elem) + } + f0f3.ElasticInferenceAccelerators = f0f3f7 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.EnclaveOptions != nil { + f0f3f8 := &svcapitypes.LaunchTemplateEnclaveOptions{} + if resp.LaunchTemplateVersion.LaunchTemplateData.EnclaveOptions.Enabled != nil { + f0f3f8.Enabled = resp.LaunchTemplateVersion.LaunchTemplateData.EnclaveOptions.Enabled + } + f0f3.EnclaveOptions = f0f3f8 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.HibernationOptions != nil { + f0f3f9 := &svcapitypes.LaunchTemplateHibernationOptions{} + if resp.LaunchTemplateVersion.LaunchTemplateData.HibernationOptions.Configured != nil { + f0f3f9.Configured = resp.LaunchTemplateVersion.LaunchTemplateData.HibernationOptions.Configured + } + f0f3.HibernationOptions = f0f3f9 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile != nil { + f0f3f10 := &svcapitypes.LaunchTemplateIAMInstanceProfileSpecification{} + if resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile.Arn != nil { + f0f3f10.ARN = resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile.Arn + } + if resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile.Name != nil { + f0f3f10.Name = resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile.Name + } + f0f3.IAMInstanceProfile = f0f3f10 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.ImageId != nil { + f0f3.ImageID = resp.LaunchTemplateVersion.LaunchTemplateData.ImageId + } + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceInitiatedShutdownBehavior != nil { + f0f3.InstanceInitiatedShutdownBehavior = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceInitiatedShutdownBehavior + } + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions != nil { + f0f3f13 := &svcapitypes.LaunchTemplateInstanceMarketOptions{} + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.MarketType != nil { + f0f3f13.MarketType = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.MarketType + } + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions != nil { + f0f3f13f1 := &svcapitypes.LaunchTemplateSpotMarketOptions{} + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil { + f0f3f13f1.BlockDurationMinutes = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes + } + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil { + f0f3f13f1.InstanceInterruptionBehavior = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior + } + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice != nil { + f0f3f13f1.MaxPrice = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice + } + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil { + f0f3f13f1.SpotInstanceType = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType + } + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil != nil { + f0f3f13f1.ValidUntil = &metav1.Time{*resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil} + } + f0f3f13.SpotOptions = f0f3f13f1 + } + f0f3.InstanceMarketOptions = f0f3f13 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.InstanceType != nil { + f0f3.InstanceType = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceType + } + if resp.LaunchTemplateVersion.LaunchTemplateData.KernelId != nil { + f0f3.KernelID = resp.LaunchTemplateVersion.LaunchTemplateData.KernelId + } + if resp.LaunchTemplateVersion.LaunchTemplateData.KeyName != nil { + f0f3.KeyName = resp.LaunchTemplateVersion.LaunchTemplateData.KeyName + } + if resp.LaunchTemplateVersion.LaunchTemplateData.LicenseSpecifications != nil { + f0f3f17 := []*svcapitypes.LaunchTemplateLicenseConfiguration{} + for _, f0f3f17iter := range resp.LaunchTemplateVersion.LaunchTemplateData.LicenseSpecifications { + f0f3f17elem := &svcapitypes.LaunchTemplateLicenseConfiguration{} + if f0f3f17iter.LicenseConfigurationArn != nil { + f0f3f17elem.LicenseConfigurationARN = f0f3f17iter.LicenseConfigurationArn + } + f0f3f17 = append(f0f3f17, f0f3f17elem) + } + f0f3.LicenseSpecifications = f0f3f17 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions != nil { + f0f3f18 := &svcapitypes.LaunchTemplateInstanceMetadataOptions{} + if resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpEndpoint != nil { + f0f3f18.HTTPEndpoint = resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpEndpoint + } + if resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpPutResponseHopLimit != nil { + f0f3f18.HTTPPutResponseHopLimit = resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpPutResponseHopLimit + } + if resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpTokens != nil { + f0f3f18.HTTPTokens = resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpTokens + } + if resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.State != nil { + f0f3f18.State = resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.State + } + f0f3.MetadataOptions = f0f3f18 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.Monitoring != nil { + f0f3f19 := &svcapitypes.LaunchTemplatesMonitoring{} + if resp.LaunchTemplateVersion.LaunchTemplateData.Monitoring.Enabled != nil { + f0f3f19.Enabled = resp.LaunchTemplateVersion.LaunchTemplateData.Monitoring.Enabled + } + f0f3.Monitoring = f0f3f19 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.NetworkInterfaces != nil { + f0f3f20 := []*svcapitypes.LaunchTemplateInstanceNetworkInterfaceSpecification{} + for _, f0f3f20iter := range resp.LaunchTemplateVersion.LaunchTemplateData.NetworkInterfaces { + f0f3f20elem := &svcapitypes.LaunchTemplateInstanceNetworkInterfaceSpecification{} + if f0f3f20iter.AssociateCarrierIpAddress != nil { + f0f3f20elem.AssociateCarrierIPAddress = f0f3f20iter.AssociateCarrierIpAddress + } + if f0f3f20iter.AssociatePublicIpAddress != nil { + f0f3f20elem.AssociatePublicIPAddress = f0f3f20iter.AssociatePublicIpAddress + } + if f0f3f20iter.DeleteOnTermination != nil { + f0f3f20elem.DeleteOnTermination = f0f3f20iter.DeleteOnTermination + } + if f0f3f20iter.Description != nil { + f0f3f20elem.Description = f0f3f20iter.Description + } + if f0f3f20iter.DeviceIndex != nil { + f0f3f20elem.DeviceIndex = f0f3f20iter.DeviceIndex + } + if f0f3f20iter.Groups != nil { + f0f3f20elemf5 := []*string{} + for _, f0f3f20elemf5iter := range f0f3f20iter.Groups { + var f0f3f20elemf5elem string + f0f3f20elemf5elem = *f0f3f20elemf5iter + f0f3f20elemf5 = append(f0f3f20elemf5, &f0f3f20elemf5elem) + } + f0f3f20elem.Groups = f0f3f20elemf5 + } + if f0f3f20iter.InterfaceType != nil { + f0f3f20elem.InterfaceType = f0f3f20iter.InterfaceType + } + if f0f3f20iter.Ipv6AddressCount != nil { + f0f3f20elem.IPv6AddressCount = f0f3f20iter.Ipv6AddressCount + } + if f0f3f20iter.Ipv6Addresses != nil { + f0f3f20elemf8 := []*svcapitypes.InstanceIPv6Address{} + for _, f0f3f20elemf8iter := range f0f3f20iter.Ipv6Addresses { + f0f3f20elemf8elem := &svcapitypes.InstanceIPv6Address{} + if f0f3f20elemf8iter.Ipv6Address != nil { + f0f3f20elemf8elem.IPv6Address = f0f3f20elemf8iter.Ipv6Address + } + f0f3f20elemf8 = append(f0f3f20elemf8, f0f3f20elemf8elem) + } + f0f3f20elem.IPv6Addresses = f0f3f20elemf8 + } + if f0f3f20iter.NetworkCardIndex != nil { + f0f3f20elem.NetworkCardIndex = f0f3f20iter.NetworkCardIndex + } + if f0f3f20iter.NetworkInterfaceId != nil { + f0f3f20elem.NetworkInterfaceID = f0f3f20iter.NetworkInterfaceId + } + if f0f3f20iter.PrivateIpAddress != nil { + f0f3f20elem.PrivateIPAddress = f0f3f20iter.PrivateIpAddress + } + if f0f3f20iter.PrivateIpAddresses != nil { + f0f3f20elemf12 := []*svcapitypes.PrivateIPAddressSpecification{} + for _, f0f3f20elemf12iter := range f0f3f20iter.PrivateIpAddresses { + f0f3f20elemf12elem := &svcapitypes.PrivateIPAddressSpecification{} + if f0f3f20elemf12iter.Primary != nil { + f0f3f20elemf12elem.Primary = f0f3f20elemf12iter.Primary + } + if f0f3f20elemf12iter.PrivateIpAddress != nil { + f0f3f20elemf12elem.PrivateIPAddress = f0f3f20elemf12iter.PrivateIpAddress + } + f0f3f20elemf12 = append(f0f3f20elemf12, f0f3f20elemf12elem) + } + f0f3f20elem.PrivateIPAddresses = f0f3f20elemf12 + } + if f0f3f20iter.SecondaryPrivateIpAddressCount != nil { + f0f3f20elem.SecondaryPrivateIPAddressCount = f0f3f20iter.SecondaryPrivateIpAddressCount + } + if f0f3f20iter.SubnetId != nil { + f0f3f20elem.SubnetID = f0f3f20iter.SubnetId + } + f0f3f20 = append(f0f3f20, f0f3f20elem) + } + f0f3.NetworkInterfaces = f0f3f20 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.Placement != nil { + f0f3f21 := &svcapitypes.LaunchTemplatePlacement{} + if resp.LaunchTemplateVersion.LaunchTemplateData.Placement.Affinity != nil { + f0f3f21.Affinity = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.Affinity + } + if resp.LaunchTemplateVersion.LaunchTemplateData.Placement.AvailabilityZone != nil { + f0f3f21.AvailabilityZone = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.AvailabilityZone + } + if resp.LaunchTemplateVersion.LaunchTemplateData.Placement.GroupName != nil { + f0f3f21.GroupName = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.GroupName + } + if resp.LaunchTemplateVersion.LaunchTemplateData.Placement.HostId != nil { + f0f3f21.HostID = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.HostId + } + if resp.LaunchTemplateVersion.LaunchTemplateData.Placement.HostResourceGroupArn != nil { + f0f3f21.HostResourceGroupARN = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.HostResourceGroupArn + } + if resp.LaunchTemplateVersion.LaunchTemplateData.Placement.PartitionNumber != nil { + f0f3f21.PartitionNumber = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.PartitionNumber + } + if resp.LaunchTemplateVersion.LaunchTemplateData.Placement.SpreadDomain != nil { + f0f3f21.SpreadDomain = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.SpreadDomain + } + if resp.LaunchTemplateVersion.LaunchTemplateData.Placement.Tenancy != nil { + f0f3f21.Tenancy = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.Tenancy + } + f0f3.Placement = f0f3f21 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.RamDiskId != nil { + f0f3.RamDiskID = resp.LaunchTemplateVersion.LaunchTemplateData.RamDiskId + } + if resp.LaunchTemplateVersion.LaunchTemplateData.SecurityGroupIds != nil { + f0f3f23 := []*string{} + for _, f0f3f23iter := range resp.LaunchTemplateVersion.LaunchTemplateData.SecurityGroupIds { + var f0f3f23elem string + f0f3f23elem = *f0f3f23iter + f0f3f23 = append(f0f3f23, &f0f3f23elem) + } + f0f3.SecurityGroupIDs = f0f3f23 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.SecurityGroups != nil { + f0f3f24 := []*string{} + for _, f0f3f24iter := range resp.LaunchTemplateVersion.LaunchTemplateData.SecurityGroups { + var f0f3f24elem string + f0f3f24elem = *f0f3f24iter + f0f3f24 = append(f0f3f24, &f0f3f24elem) + } + f0f3.SecurityGroups = f0f3f24 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.TagSpecifications != nil { + f0f3f25 := []*svcapitypes.LaunchTemplateTagSpecification{} + for _, f0f3f25iter := range resp.LaunchTemplateVersion.LaunchTemplateData.TagSpecifications { + f0f3f25elem := &svcapitypes.LaunchTemplateTagSpecification{} + if f0f3f25iter.ResourceType != nil { + f0f3f25elem.ResourceType = f0f3f25iter.ResourceType + } + if f0f3f25iter.Tags != nil { + f0f3f25elemf1 := []*svcapitypes.Tag{} + for _, f0f3f25elemf1iter := range f0f3f25iter.Tags { + f0f3f25elemf1elem := &svcapitypes.Tag{} + if f0f3f25elemf1iter.Key != nil { + f0f3f25elemf1elem.Key = f0f3f25elemf1iter.Key + } + if f0f3f25elemf1iter.Value != nil { + f0f3f25elemf1elem.Value = f0f3f25elemf1iter.Value + } + f0f3f25elemf1 = append(f0f3f25elemf1, f0f3f25elemf1elem) + } + f0f3f25elem.Tags = f0f3f25elemf1 + } + f0f3f25 = append(f0f3f25, f0f3f25elem) + } + f0f3.TagSpecifications = f0f3f25 + } + if resp.LaunchTemplateVersion.LaunchTemplateData.UserData != nil { + f0f3.UserData = resp.LaunchTemplateVersion.LaunchTemplateData.UserData + } + f0.LaunchTemplateData = f0f3 + } + if resp.LaunchTemplateVersion.LaunchTemplateId != nil { + f0.LaunchTemplateID = resp.LaunchTemplateVersion.LaunchTemplateId + } + if resp.LaunchTemplateVersion.LaunchTemplateName != nil { + f0.LaunchTemplateName = resp.LaunchTemplateVersion.LaunchTemplateName + } + if resp.LaunchTemplateVersion.VersionDescription != nil { + f0.VersionDescription = resp.LaunchTemplateVersion.VersionDescription + } + if resp.LaunchTemplateVersion.VersionNumber != nil { + f0.VersionNumber = resp.LaunchTemplateVersion.VersionNumber + } + cr.Status.AtProvider.LaunchTemplateVersion = f0 + } else { + cr.Status.AtProvider.LaunchTemplateVersion = nil + } + if resp.Warning != nil { + f1 := &svcapitypes.ValidationWarning{} + if resp.Warning.Errors != nil { + f1f0 := []*svcapitypes.ValidationError{} + for _, f1f0iter := range resp.Warning.Errors { + f1f0elem := &svcapitypes.ValidationError{} + if f1f0iter.Code != nil { + f1f0elem.Code = f1f0iter.Code + } + if f1f0iter.Message != nil { + f1f0elem.Message = f1f0iter.Message + } + f1f0 = append(f1f0, f1f0elem) + } + f1.Errors = f1f0 + } + cr.Status.AtProvider.Warning = f1 + } else { + cr.Status.AtProvider.Warning = nil + } + + return e.postCreate(ctx, cr, resp, managed.ExternalCreation{}, err) +} + +func (e *external) Update(ctx context.Context, mg cpresource.Managed) (managed.ExternalUpdate, error) { + return e.update(ctx, mg) + +} + +func (e *external) Delete(ctx context.Context, mg cpresource.Managed) error { + cr, ok := mg.(*svcapitypes.LaunchTemplateVersion) + if !ok { + return errors.New(errUnexpectedObject) + } + cr.Status.SetConditions(xpv1.Deleting()) + return e.delete(ctx, mg) + +} + +type option func(*external) + +func newExternal(kube client.Client, client svcsdkapi.EC2API, opts []option) *external { + e := &external{ + kube: kube, + client: client, + preObserve: nopPreObserve, + postObserve: nopPostObserve, + lateInitialize: nopLateInitialize, + isUpToDate: alwaysUpToDate, + filterList: nopFilterList, + preCreate: nopPreCreate, + postCreate: nopPostCreate, + delete: nopDelete, + update: nopUpdate, + } + for _, f := range opts { + f(e) + } + return e +} + +type external struct { + kube client.Client + client svcsdkapi.EC2API + preObserve func(context.Context, *svcapitypes.LaunchTemplateVersion, *svcsdk.DescribeLaunchTemplateVersionsInput) error + postObserve func(context.Context, *svcapitypes.LaunchTemplateVersion, *svcsdk.DescribeLaunchTemplateVersionsOutput, managed.ExternalObservation, error) (managed.ExternalObservation, error) + filterList func(*svcapitypes.LaunchTemplateVersion, *svcsdk.DescribeLaunchTemplateVersionsOutput) *svcsdk.DescribeLaunchTemplateVersionsOutput + lateInitialize func(*svcapitypes.LaunchTemplateVersionParameters, *svcsdk.DescribeLaunchTemplateVersionsOutput) error + isUpToDate func(*svcapitypes.LaunchTemplateVersion, *svcsdk.DescribeLaunchTemplateVersionsOutput) (bool, error) + preCreate func(context.Context, *svcapitypes.LaunchTemplateVersion, *svcsdk.CreateLaunchTemplateVersionInput) error + postCreate func(context.Context, *svcapitypes.LaunchTemplateVersion, *svcsdk.CreateLaunchTemplateVersionOutput, managed.ExternalCreation, error) (managed.ExternalCreation, error) + delete func(context.Context, cpresource.Managed) error + update func(context.Context, cpresource.Managed) (managed.ExternalUpdate, error) +} + +func nopPreObserve(context.Context, *svcapitypes.LaunchTemplateVersion, *svcsdk.DescribeLaunchTemplateVersionsInput) error { + return nil +} +func nopPostObserve(_ context.Context, _ *svcapitypes.LaunchTemplateVersion, _ *svcsdk.DescribeLaunchTemplateVersionsOutput, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) { + return obs, err +} +func nopFilterList(_ *svcapitypes.LaunchTemplateVersion, list *svcsdk.DescribeLaunchTemplateVersionsOutput) *svcsdk.DescribeLaunchTemplateVersionsOutput { + return list +} + +func nopLateInitialize(*svcapitypes.LaunchTemplateVersionParameters, *svcsdk.DescribeLaunchTemplateVersionsOutput) error { + return nil +} +func alwaysUpToDate(*svcapitypes.LaunchTemplateVersion, *svcsdk.DescribeLaunchTemplateVersionsOutput) (bool, error) { + return true, nil +} + +func nopPreCreate(context.Context, *svcapitypes.LaunchTemplateVersion, *svcsdk.CreateLaunchTemplateVersionInput) error { + return nil +} +func nopPostCreate(_ context.Context, _ *svcapitypes.LaunchTemplateVersion, _ *svcsdk.CreateLaunchTemplateVersionOutput, cre managed.ExternalCreation, err error) (managed.ExternalCreation, error) { + return cre, err +} +func nopDelete(context.Context, cpresource.Managed) error { + return nil +} +func nopUpdate(context.Context, cpresource.Managed) (managed.ExternalUpdate, error) { + return managed.ExternalUpdate{}, nil +} diff --git a/pkg/controller/ec2/launchtemplateversion/zz_conversions.go b/pkg/controller/ec2/launchtemplateversion/zz_conversions.go new file mode 100644 index 0000000000..52dc2b3567 --- /dev/null +++ b/pkg/controller/ec2/launchtemplateversion/zz_conversions.go @@ -0,0 +1,811 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License 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 launchtemplateversion + +import ( + "github.com/aws/aws-sdk-go/aws/awserr" + svcsdk "github.com/aws/aws-sdk-go/service/ec2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + svcapitypes "github.com/crossplane/provider-aws/apis/ec2/v1alpha1" +) + +// NOTE(muvaf): We return pointers in case the function needs to start with an +// empty object, hence need to return a new pointer. + +// GenerateDescribeLaunchTemplateVersionsInput returns input for read +// operation. +func GenerateDescribeLaunchTemplateVersionsInput(cr *svcapitypes.LaunchTemplateVersion) *svcsdk.DescribeLaunchTemplateVersionsInput { + res := &svcsdk.DescribeLaunchTemplateVersionsInput{} + + return res +} + +// GenerateLaunchTemplateVersion returns the current state in the form of *svcapitypes.LaunchTemplateVersion. +func GenerateLaunchTemplateVersion(resp *svcsdk.DescribeLaunchTemplateVersionsOutput) *svcapitypes.LaunchTemplateVersion { + cr := &svcapitypes.LaunchTemplateVersion{} + + found := false + for _, elem := range resp.LaunchTemplateVersions { + if elem.LaunchTemplateData != nil { + f3 := &svcapitypes.RequestLaunchTemplateData{} + if elem.LaunchTemplateData.BlockDeviceMappings != nil { + f3f0 := []*svcapitypes.LaunchTemplateBlockDeviceMappingRequest{} + for _, f3f0iter := range elem.LaunchTemplateData.BlockDeviceMappings { + f3f0elem := &svcapitypes.LaunchTemplateBlockDeviceMappingRequest{} + if f3f0iter.DeviceName != nil { + f3f0elem.DeviceName = f3f0iter.DeviceName + } + if f3f0iter.Ebs != nil { + f3f0elemf1 := &svcapitypes.LaunchTemplateEBSBlockDeviceRequest{} + if f3f0iter.Ebs.DeleteOnTermination != nil { + f3f0elemf1.DeleteOnTermination = f3f0iter.Ebs.DeleteOnTermination + } + if f3f0iter.Ebs.Encrypted != nil { + f3f0elemf1.Encrypted = f3f0iter.Ebs.Encrypted + } + if f3f0iter.Ebs.Iops != nil { + f3f0elemf1.IOPS = f3f0iter.Ebs.Iops + } + if f3f0iter.Ebs.KmsKeyId != nil { + f3f0elemf1.KMSKeyID = f3f0iter.Ebs.KmsKeyId + } + if f3f0iter.Ebs.SnapshotId != nil { + f3f0elemf1.SnapshotID = f3f0iter.Ebs.SnapshotId + } + if f3f0iter.Ebs.Throughput != nil { + f3f0elemf1.Throughput = f3f0iter.Ebs.Throughput + } + if f3f0iter.Ebs.VolumeSize != nil { + f3f0elemf1.VolumeSize = f3f0iter.Ebs.VolumeSize + } + if f3f0iter.Ebs.VolumeType != nil { + f3f0elemf1.VolumeType = f3f0iter.Ebs.VolumeType + } + f3f0elem.EBS = f3f0elemf1 + } + if f3f0iter.NoDevice != nil { + f3f0elem.NoDevice = f3f0iter.NoDevice + } + if f3f0iter.VirtualName != nil { + f3f0elem.VirtualName = f3f0iter.VirtualName + } + f3f0 = append(f3f0, f3f0elem) + } + f3.BlockDeviceMappings = f3f0 + } + if elem.LaunchTemplateData.CapacityReservationSpecification != nil { + f3f1 := &svcapitypes.LaunchTemplateCapacityReservationSpecificationRequest{} + if elem.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference != nil { + f3f1.CapacityReservationPreference = elem.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference + } + if elem.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget != nil { + f3f1f1 := &svcapitypes.CapacityReservationTarget{} + if elem.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId != nil { + f3f1f1.CapacityReservationID = elem.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId + } + if elem.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn != nil { + f3f1f1.CapacityReservationResourceGroupARN = elem.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn + } + f3f1.CapacityReservationTarget = f3f1f1 + } + f3.CapacityReservationSpecification = f3f1 + } + if elem.LaunchTemplateData.CpuOptions != nil { + f3f2 := &svcapitypes.LaunchTemplateCPUOptionsRequest{} + if elem.LaunchTemplateData.CpuOptions.CoreCount != nil { + f3f2.CoreCount = elem.LaunchTemplateData.CpuOptions.CoreCount + } + if elem.LaunchTemplateData.CpuOptions.ThreadsPerCore != nil { + f3f2.ThreadsPerCore = elem.LaunchTemplateData.CpuOptions.ThreadsPerCore + } + f3.CPUOptions = f3f2 + } + if elem.LaunchTemplateData.CreditSpecification != nil { + f3f3 := &svcapitypes.CreditSpecificationRequest{} + if elem.LaunchTemplateData.CreditSpecification.CpuCredits != nil { + f3f3.CPUCredits = elem.LaunchTemplateData.CreditSpecification.CpuCredits + } + f3.CreditSpecification = f3f3 + } + if elem.LaunchTemplateData.DisableApiTermination != nil { + f3.DisableAPITermination = elem.LaunchTemplateData.DisableApiTermination + } + if elem.LaunchTemplateData.EbsOptimized != nil { + f3.EBSOptimized = elem.LaunchTemplateData.EbsOptimized + } + if elem.LaunchTemplateData.ElasticGpuSpecifications != nil { + f3f6 := []*svcapitypes.ElasticGPUSpecification{} + for _, f3f6iter := range elem.LaunchTemplateData.ElasticGpuSpecifications { + f3f6elem := &svcapitypes.ElasticGPUSpecification{} + if f3f6iter.Type != nil { + f3f6elem.Type = f3f6iter.Type + } + f3f6 = append(f3f6, f3f6elem) + } + f3.ElasticGPUSpecifications = f3f6 + } + if elem.LaunchTemplateData.ElasticInferenceAccelerators != nil { + f3f7 := []*svcapitypes.LaunchTemplateElasticInferenceAccelerator{} + for _, f3f7iter := range elem.LaunchTemplateData.ElasticInferenceAccelerators { + f3f7elem := &svcapitypes.LaunchTemplateElasticInferenceAccelerator{} + if f3f7iter.Count != nil { + f3f7elem.Count = f3f7iter.Count + } + if f3f7iter.Type != nil { + f3f7elem.Type = f3f7iter.Type + } + f3f7 = append(f3f7, f3f7elem) + } + f3.ElasticInferenceAccelerators = f3f7 + } + if elem.LaunchTemplateData.EnclaveOptions != nil { + f3f8 := &svcapitypes.LaunchTemplateEnclaveOptionsRequest{} + if elem.LaunchTemplateData.EnclaveOptions.Enabled != nil { + f3f8.Enabled = elem.LaunchTemplateData.EnclaveOptions.Enabled + } + f3.EnclaveOptions = f3f8 + } + if elem.LaunchTemplateData.HibernationOptions != nil { + f3f9 := &svcapitypes.LaunchTemplateHibernationOptionsRequest{} + if elem.LaunchTemplateData.HibernationOptions.Configured != nil { + f3f9.Configured = elem.LaunchTemplateData.HibernationOptions.Configured + } + f3.HibernationOptions = f3f9 + } + if elem.LaunchTemplateData.IamInstanceProfile != nil { + f3f10 := &svcapitypes.LaunchTemplateIAMInstanceProfileSpecificationRequest{} + if elem.LaunchTemplateData.IamInstanceProfile.Arn != nil { + f3f10.ARN = elem.LaunchTemplateData.IamInstanceProfile.Arn + } + if elem.LaunchTemplateData.IamInstanceProfile.Name != nil { + f3f10.Name = elem.LaunchTemplateData.IamInstanceProfile.Name + } + f3.IAMInstanceProfile = f3f10 + } + if elem.LaunchTemplateData.ImageId != nil { + f3.ImageID = elem.LaunchTemplateData.ImageId + } + if elem.LaunchTemplateData.InstanceInitiatedShutdownBehavior != nil { + f3.InstanceInitiatedShutdownBehavior = elem.LaunchTemplateData.InstanceInitiatedShutdownBehavior + } + if elem.LaunchTemplateData.InstanceMarketOptions != nil { + f3f13 := &svcapitypes.LaunchTemplateInstanceMarketOptionsRequest{} + if elem.LaunchTemplateData.InstanceMarketOptions.MarketType != nil { + f3f13.MarketType = elem.LaunchTemplateData.InstanceMarketOptions.MarketType + } + if elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions != nil { + f3f13f1 := &svcapitypes.LaunchTemplateSpotMarketOptionsRequest{} + if elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil { + f3f13f1.BlockDurationMinutes = elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes + } + if elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil { + f3f13f1.InstanceInterruptionBehavior = elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior + } + if elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice != nil { + f3f13f1.MaxPrice = elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice + } + if elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil { + f3f13f1.SpotInstanceType = elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType + } + if elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil != nil { + f3f13f1.ValidUntil = &metav1.Time{*elem.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil} + } + f3f13.SpotOptions = f3f13f1 + } + f3.InstanceMarketOptions = f3f13 + } + if elem.LaunchTemplateData.InstanceType != nil { + f3.InstanceType = elem.LaunchTemplateData.InstanceType + } + if elem.LaunchTemplateData.KernelId != nil { + f3.KernelID = elem.LaunchTemplateData.KernelId + } + if elem.LaunchTemplateData.KeyName != nil { + f3.KeyName = elem.LaunchTemplateData.KeyName + } + if elem.LaunchTemplateData.LicenseSpecifications != nil { + f3f17 := []*svcapitypes.LaunchTemplateLicenseConfigurationRequest{} + for _, f3f17iter := range elem.LaunchTemplateData.LicenseSpecifications { + f3f17elem := &svcapitypes.LaunchTemplateLicenseConfigurationRequest{} + if f3f17iter.LicenseConfigurationArn != nil { + f3f17elem.LicenseConfigurationARN = f3f17iter.LicenseConfigurationArn + } + f3f17 = append(f3f17, f3f17elem) + } + f3.LicenseSpecifications = f3f17 + } + if elem.LaunchTemplateData.MetadataOptions != nil { + f3f18 := &svcapitypes.LaunchTemplateInstanceMetadataOptionsRequest{} + if elem.LaunchTemplateData.MetadataOptions.HttpEndpoint != nil { + f3f18.HTTPEndpoint = elem.LaunchTemplateData.MetadataOptions.HttpEndpoint + } + if elem.LaunchTemplateData.MetadataOptions.HttpPutResponseHopLimit != nil { + f3f18.HTTPPutResponseHopLimit = elem.LaunchTemplateData.MetadataOptions.HttpPutResponseHopLimit + } + if elem.LaunchTemplateData.MetadataOptions.HttpTokens != nil { + f3f18.HTTPTokens = elem.LaunchTemplateData.MetadataOptions.HttpTokens + } + f3.MetadataOptions = f3f18 + } + if elem.LaunchTemplateData.Monitoring != nil { + f3f19 := &svcapitypes.LaunchTemplatesMonitoringRequest{} + if elem.LaunchTemplateData.Monitoring.Enabled != nil { + f3f19.Enabled = elem.LaunchTemplateData.Monitoring.Enabled + } + f3.Monitoring = f3f19 + } + if elem.LaunchTemplateData.NetworkInterfaces != nil { + f3f20 := []*svcapitypes.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} + for _, f3f20iter := range elem.LaunchTemplateData.NetworkInterfaces { + f3f20elem := &svcapitypes.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} + if f3f20iter.AssociateCarrierIpAddress != nil { + f3f20elem.AssociateCarrierIPAddress = f3f20iter.AssociateCarrierIpAddress + } + if f3f20iter.AssociatePublicIpAddress != nil { + f3f20elem.AssociatePublicIPAddress = f3f20iter.AssociatePublicIpAddress + } + if f3f20iter.DeleteOnTermination != nil { + f3f20elem.DeleteOnTermination = f3f20iter.DeleteOnTermination + } + if f3f20iter.Description != nil { + f3f20elem.Description = f3f20iter.Description + } + if f3f20iter.DeviceIndex != nil { + f3f20elem.DeviceIndex = f3f20iter.DeviceIndex + } + if f3f20iter.Groups != nil { + f3f20elemf5 := []*string{} + for _, f3f20elemf5iter := range f3f20iter.Groups { + var f3f20elemf5elem string + f3f20elemf5elem = *f3f20elemf5iter + f3f20elemf5 = append(f3f20elemf5, &f3f20elemf5elem) + } + f3f20elem.Groups = f3f20elemf5 + } + if f3f20iter.InterfaceType != nil { + f3f20elem.InterfaceType = f3f20iter.InterfaceType + } + if f3f20iter.Ipv6AddressCount != nil { + f3f20elem.IPv6AddressCount = f3f20iter.Ipv6AddressCount + } + if f3f20iter.Ipv6Addresses != nil { + f3f20elemf8 := []*svcapitypes.InstanceIPv6AddressRequest{} + for _, f3f20elemf8iter := range f3f20iter.Ipv6Addresses { + f3f20elemf8elem := &svcapitypes.InstanceIPv6AddressRequest{} + if f3f20elemf8iter.Ipv6Address != nil { + f3f20elemf8elem.IPv6Address = f3f20elemf8iter.Ipv6Address + } + f3f20elemf8 = append(f3f20elemf8, f3f20elemf8elem) + } + f3f20elem.IPv6Addresses = f3f20elemf8 + } + if f3f20iter.NetworkCardIndex != nil { + f3f20elem.NetworkCardIndex = f3f20iter.NetworkCardIndex + } + if f3f20iter.NetworkInterfaceId != nil { + f3f20elem.NetworkInterfaceID = f3f20iter.NetworkInterfaceId + } + if f3f20iter.PrivateIpAddress != nil { + f3f20elem.PrivateIPAddress = f3f20iter.PrivateIpAddress + } + if f3f20iter.PrivateIpAddresses != nil { + f3f20elemf12 := []*svcapitypes.PrivateIPAddressSpecification{} + for _, f3f20elemf12iter := range f3f20iter.PrivateIpAddresses { + f3f20elemf12elem := &svcapitypes.PrivateIPAddressSpecification{} + if f3f20elemf12iter.Primary != nil { + f3f20elemf12elem.Primary = f3f20elemf12iter.Primary + } + if f3f20elemf12iter.PrivateIpAddress != nil { + f3f20elemf12elem.PrivateIPAddress = f3f20elemf12iter.PrivateIpAddress + } + f3f20elemf12 = append(f3f20elemf12, f3f20elemf12elem) + } + f3f20elem.PrivateIPAddresses = f3f20elemf12 + } + if f3f20iter.SecondaryPrivateIpAddressCount != nil { + f3f20elem.SecondaryPrivateIPAddressCount = f3f20iter.SecondaryPrivateIpAddressCount + } + if f3f20iter.SubnetId != nil { + f3f20elem.SubnetID = f3f20iter.SubnetId + } + f3f20 = append(f3f20, f3f20elem) + } + f3.NetworkInterfaces = f3f20 + } + if elem.LaunchTemplateData.Placement != nil { + f3f21 := &svcapitypes.LaunchTemplatePlacementRequest{} + if elem.LaunchTemplateData.Placement.Affinity != nil { + f3f21.Affinity = elem.LaunchTemplateData.Placement.Affinity + } + if elem.LaunchTemplateData.Placement.AvailabilityZone != nil { + f3f21.AvailabilityZone = elem.LaunchTemplateData.Placement.AvailabilityZone + } + if elem.LaunchTemplateData.Placement.GroupName != nil { + f3f21.GroupName = elem.LaunchTemplateData.Placement.GroupName + } + if elem.LaunchTemplateData.Placement.HostId != nil { + f3f21.HostID = elem.LaunchTemplateData.Placement.HostId + } + if elem.LaunchTemplateData.Placement.HostResourceGroupArn != nil { + f3f21.HostResourceGroupARN = elem.LaunchTemplateData.Placement.HostResourceGroupArn + } + if elem.LaunchTemplateData.Placement.PartitionNumber != nil { + f3f21.PartitionNumber = elem.LaunchTemplateData.Placement.PartitionNumber + } + if elem.LaunchTemplateData.Placement.SpreadDomain != nil { + f3f21.SpreadDomain = elem.LaunchTemplateData.Placement.SpreadDomain + } + if elem.LaunchTemplateData.Placement.Tenancy != nil { + f3f21.Tenancy = elem.LaunchTemplateData.Placement.Tenancy + } + f3.Placement = f3f21 + } + if elem.LaunchTemplateData.RamDiskId != nil { + f3.RamDiskID = elem.LaunchTemplateData.RamDiskId + } + if elem.LaunchTemplateData.SecurityGroupIds != nil { + f3f23 := []*string{} + for _, f3f23iter := range elem.LaunchTemplateData.SecurityGroupIds { + var f3f23elem string + f3f23elem = *f3f23iter + f3f23 = append(f3f23, &f3f23elem) + } + f3.SecurityGroupIDs = f3f23 + } + if elem.LaunchTemplateData.SecurityGroups != nil { + f3f24 := []*string{} + for _, f3f24iter := range elem.LaunchTemplateData.SecurityGroups { + var f3f24elem string + f3f24elem = *f3f24iter + f3f24 = append(f3f24, &f3f24elem) + } + f3.SecurityGroups = f3f24 + } + if elem.LaunchTemplateData.TagSpecifications != nil { + f3f25 := []*svcapitypes.LaunchTemplateTagSpecificationRequest{} + for _, f3f25iter := range elem.LaunchTemplateData.TagSpecifications { + f3f25elem := &svcapitypes.LaunchTemplateTagSpecificationRequest{} + if f3f25iter.ResourceType != nil { + f3f25elem.ResourceType = f3f25iter.ResourceType + } + if f3f25iter.Tags != nil { + f3f25elemf1 := []*svcapitypes.Tag{} + for _, f3f25elemf1iter := range f3f25iter.Tags { + f3f25elemf1elem := &svcapitypes.Tag{} + if f3f25elemf1iter.Key != nil { + f3f25elemf1elem.Key = f3f25elemf1iter.Key + } + if f3f25elemf1iter.Value != nil { + f3f25elemf1elem.Value = f3f25elemf1iter.Value + } + f3f25elemf1 = append(f3f25elemf1, f3f25elemf1elem) + } + f3f25elem.Tags = f3f25elemf1 + } + f3f25 = append(f3f25, f3f25elem) + } + f3.TagSpecifications = f3f25 + } + if elem.LaunchTemplateData.UserData != nil { + f3.UserData = elem.LaunchTemplateData.UserData + } + cr.Spec.ForProvider.LaunchTemplateData = f3 + } else { + cr.Spec.ForProvider.LaunchTemplateData = nil + } + if elem.VersionDescription != nil { + cr.Spec.ForProvider.VersionDescription = elem.VersionDescription + } else { + cr.Spec.ForProvider.VersionDescription = nil + } + found = true + break + } + if !found { + return cr + } + + return cr +} + +// GenerateCreateLaunchTemplateVersionInput returns a create input. +func GenerateCreateLaunchTemplateVersionInput(cr *svcapitypes.LaunchTemplateVersion) *svcsdk.CreateLaunchTemplateVersionInput { + res := &svcsdk.CreateLaunchTemplateVersionInput{} + + if cr.Spec.ForProvider.LaunchTemplateData != nil { + f0 := &svcsdk.RequestLaunchTemplateData{} + if cr.Spec.ForProvider.LaunchTemplateData.BlockDeviceMappings != nil { + f0f0 := []*svcsdk.LaunchTemplateBlockDeviceMappingRequest{} + for _, f0f0iter := range cr.Spec.ForProvider.LaunchTemplateData.BlockDeviceMappings { + f0f0elem := &svcsdk.LaunchTemplateBlockDeviceMappingRequest{} + if f0f0iter.DeviceName != nil { + f0f0elem.SetDeviceName(*f0f0iter.DeviceName) + } + if f0f0iter.EBS != nil { + f0f0elemf1 := &svcsdk.LaunchTemplateEbsBlockDeviceRequest{} + if f0f0iter.EBS.DeleteOnTermination != nil { + f0f0elemf1.SetDeleteOnTermination(*f0f0iter.EBS.DeleteOnTermination) + } + if f0f0iter.EBS.Encrypted != nil { + f0f0elemf1.SetEncrypted(*f0f0iter.EBS.Encrypted) + } + if f0f0iter.EBS.IOPS != nil { + f0f0elemf1.SetIops(*f0f0iter.EBS.IOPS) + } + if f0f0iter.EBS.KMSKeyID != nil { + f0f0elemf1.SetKmsKeyId(*f0f0iter.EBS.KMSKeyID) + } + if f0f0iter.EBS.SnapshotID != nil { + f0f0elemf1.SetSnapshotId(*f0f0iter.EBS.SnapshotID) + } + if f0f0iter.EBS.Throughput != nil { + f0f0elemf1.SetThroughput(*f0f0iter.EBS.Throughput) + } + if f0f0iter.EBS.VolumeSize != nil { + f0f0elemf1.SetVolumeSize(*f0f0iter.EBS.VolumeSize) + } + if f0f0iter.EBS.VolumeType != nil { + f0f0elemf1.SetVolumeType(*f0f0iter.EBS.VolumeType) + } + f0f0elem.SetEbs(f0f0elemf1) + } + if f0f0iter.NoDevice != nil { + f0f0elem.SetNoDevice(*f0f0iter.NoDevice) + } + if f0f0iter.VirtualName != nil { + f0f0elem.SetVirtualName(*f0f0iter.VirtualName) + } + f0f0 = append(f0f0, f0f0elem) + } + f0.SetBlockDeviceMappings(f0f0) + } + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification != nil { + f0f1 := &svcsdk.LaunchTemplateCapacityReservationSpecificationRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference != nil { + f0f1.SetCapacityReservationPreference(*cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference) + } + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget != nil { + f0f1f1 := &svcsdk.CapacityReservationTarget{} + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID != nil { + f0f1f1.SetCapacityReservationId(*cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID) + } + if cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN != nil { + f0f1f1.SetCapacityReservationResourceGroupArn(*cr.Spec.ForProvider.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN) + } + f0f1.SetCapacityReservationTarget(f0f1f1) + } + f0.SetCapacityReservationSpecification(f0f1) + } + if cr.Spec.ForProvider.LaunchTemplateData.CPUOptions != nil { + f0f2 := &svcsdk.LaunchTemplateCpuOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.CPUOptions.CoreCount != nil { + f0f2.SetCoreCount(*cr.Spec.ForProvider.LaunchTemplateData.CPUOptions.CoreCount) + } + if cr.Spec.ForProvider.LaunchTemplateData.CPUOptions.ThreadsPerCore != nil { + f0f2.SetThreadsPerCore(*cr.Spec.ForProvider.LaunchTemplateData.CPUOptions.ThreadsPerCore) + } + f0.SetCpuOptions(f0f2) + } + if cr.Spec.ForProvider.LaunchTemplateData.CreditSpecification != nil { + f0f3 := &svcsdk.CreditSpecificationRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.CreditSpecification.CPUCredits != nil { + f0f3.SetCpuCredits(*cr.Spec.ForProvider.LaunchTemplateData.CreditSpecification.CPUCredits) + } + f0.SetCreditSpecification(f0f3) + } + if cr.Spec.ForProvider.LaunchTemplateData.DisableAPITermination != nil { + f0.SetDisableApiTermination(*cr.Spec.ForProvider.LaunchTemplateData.DisableAPITermination) + } + if cr.Spec.ForProvider.LaunchTemplateData.EBSOptimized != nil { + f0.SetEbsOptimized(*cr.Spec.ForProvider.LaunchTemplateData.EBSOptimized) + } + if cr.Spec.ForProvider.LaunchTemplateData.ElasticGPUSpecifications != nil { + f0f6 := []*svcsdk.ElasticGpuSpecification{} + for _, f0f6iter := range cr.Spec.ForProvider.LaunchTemplateData.ElasticGPUSpecifications { + f0f6elem := &svcsdk.ElasticGpuSpecification{} + if f0f6iter.Type != nil { + f0f6elem.SetType(*f0f6iter.Type) + } + f0f6 = append(f0f6, f0f6elem) + } + f0.SetElasticGpuSpecifications(f0f6) + } + if cr.Spec.ForProvider.LaunchTemplateData.ElasticInferenceAccelerators != nil { + f0f7 := []*svcsdk.LaunchTemplateElasticInferenceAccelerator{} + for _, f0f7iter := range cr.Spec.ForProvider.LaunchTemplateData.ElasticInferenceAccelerators { + f0f7elem := &svcsdk.LaunchTemplateElasticInferenceAccelerator{} + if f0f7iter.Count != nil { + f0f7elem.SetCount(*f0f7iter.Count) + } + if f0f7iter.Type != nil { + f0f7elem.SetType(*f0f7iter.Type) + } + f0f7 = append(f0f7, f0f7elem) + } + f0.SetElasticInferenceAccelerators(f0f7) + } + if cr.Spec.ForProvider.LaunchTemplateData.EnclaveOptions != nil { + f0f8 := &svcsdk.LaunchTemplateEnclaveOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.EnclaveOptions.Enabled != nil { + f0f8.SetEnabled(*cr.Spec.ForProvider.LaunchTemplateData.EnclaveOptions.Enabled) + } + f0.SetEnclaveOptions(f0f8) + } + if cr.Spec.ForProvider.LaunchTemplateData.HibernationOptions != nil { + f0f9 := &svcsdk.LaunchTemplateHibernationOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.HibernationOptions.Configured != nil { + f0f9.SetConfigured(*cr.Spec.ForProvider.LaunchTemplateData.HibernationOptions.Configured) + } + f0.SetHibernationOptions(f0f9) + } + if cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile != nil { + f0f10 := &svcsdk.LaunchTemplateIamInstanceProfileSpecificationRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile.ARN != nil { + f0f10.SetArn(*cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile.ARN) + } + if cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile.Name != nil { + f0f10.SetName(*cr.Spec.ForProvider.LaunchTemplateData.IAMInstanceProfile.Name) + } + f0.SetIamInstanceProfile(f0f10) + } + if cr.Spec.ForProvider.LaunchTemplateData.ImageID != nil { + f0.SetImageId(*cr.Spec.ForProvider.LaunchTemplateData.ImageID) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceInitiatedShutdownBehavior != nil { + f0.SetInstanceInitiatedShutdownBehavior(*cr.Spec.ForProvider.LaunchTemplateData.InstanceInitiatedShutdownBehavior) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions != nil { + f0f13 := &svcsdk.LaunchTemplateInstanceMarketOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.MarketType != nil { + f0f13.SetMarketType(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.MarketType) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions != nil { + f0f13f1 := &svcsdk.LaunchTemplateSpotMarketOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil { + f0f13f1.SetBlockDurationMinutes(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil { + f0f13f1.SetInstanceInterruptionBehavior(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice != nil { + f0f13f1.SetMaxPrice(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil { + f0f13f1.SetSpotInstanceType(*cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil != nil { + f0f13f1.SetValidUntil(cr.Spec.ForProvider.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil.Time) + } + f0f13.SetSpotOptions(f0f13f1) + } + f0.SetInstanceMarketOptions(f0f13) + } + if cr.Spec.ForProvider.LaunchTemplateData.InstanceType != nil { + f0.SetInstanceType(*cr.Spec.ForProvider.LaunchTemplateData.InstanceType) + } + if cr.Spec.ForProvider.LaunchTemplateData.KernelID != nil { + f0.SetKernelId(*cr.Spec.ForProvider.LaunchTemplateData.KernelID) + } + if cr.Spec.ForProvider.LaunchTemplateData.KeyName != nil { + f0.SetKeyName(*cr.Spec.ForProvider.LaunchTemplateData.KeyName) + } + if cr.Spec.ForProvider.LaunchTemplateData.LicenseSpecifications != nil { + f0f17 := []*svcsdk.LaunchTemplateLicenseConfigurationRequest{} + for _, f0f17iter := range cr.Spec.ForProvider.LaunchTemplateData.LicenseSpecifications { + f0f17elem := &svcsdk.LaunchTemplateLicenseConfigurationRequest{} + if f0f17iter.LicenseConfigurationARN != nil { + f0f17elem.SetLicenseConfigurationArn(*f0f17iter.LicenseConfigurationARN) + } + f0f17 = append(f0f17, f0f17elem) + } + f0.SetLicenseSpecifications(f0f17) + } + if cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions != nil { + f0f18 := &svcsdk.LaunchTemplateInstanceMetadataOptionsRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPEndpoint != nil { + f0f18.SetHttpEndpoint(*cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPEndpoint) + } + if cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPPutResponseHopLimit != nil { + f0f18.SetHttpPutResponseHopLimit(*cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPPutResponseHopLimit) + } + if cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPTokens != nil { + f0f18.SetHttpTokens(*cr.Spec.ForProvider.LaunchTemplateData.MetadataOptions.HTTPTokens) + } + f0.SetMetadataOptions(f0f18) + } + if cr.Spec.ForProvider.LaunchTemplateData.Monitoring != nil { + f0f19 := &svcsdk.LaunchTemplatesMonitoringRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.Monitoring.Enabled != nil { + f0f19.SetEnabled(*cr.Spec.ForProvider.LaunchTemplateData.Monitoring.Enabled) + } + f0.SetMonitoring(f0f19) + } + if cr.Spec.ForProvider.LaunchTemplateData.NetworkInterfaces != nil { + f0f20 := []*svcsdk.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} + for _, f0f20iter := range cr.Spec.ForProvider.LaunchTemplateData.NetworkInterfaces { + f0f20elem := &svcsdk.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} + if f0f20iter.AssociateCarrierIPAddress != nil { + f0f20elem.SetAssociateCarrierIpAddress(*f0f20iter.AssociateCarrierIPAddress) + } + if f0f20iter.AssociatePublicIPAddress != nil { + f0f20elem.SetAssociatePublicIpAddress(*f0f20iter.AssociatePublicIPAddress) + } + if f0f20iter.DeleteOnTermination != nil { + f0f20elem.SetDeleteOnTermination(*f0f20iter.DeleteOnTermination) + } + if f0f20iter.Description != nil { + f0f20elem.SetDescription(*f0f20iter.Description) + } + if f0f20iter.DeviceIndex != nil { + f0f20elem.SetDeviceIndex(*f0f20iter.DeviceIndex) + } + if f0f20iter.Groups != nil { + f0f20elemf5 := []*string{} + for _, f0f20elemf5iter := range f0f20iter.Groups { + var f0f20elemf5elem string + f0f20elemf5elem = *f0f20elemf5iter + f0f20elemf5 = append(f0f20elemf5, &f0f20elemf5elem) + } + f0f20elem.SetGroups(f0f20elemf5) + } + if f0f20iter.InterfaceType != nil { + f0f20elem.SetInterfaceType(*f0f20iter.InterfaceType) + } + if f0f20iter.IPv6AddressCount != nil { + f0f20elem.SetIpv6AddressCount(*f0f20iter.IPv6AddressCount) + } + if f0f20iter.IPv6Addresses != nil { + f0f20elemf8 := []*svcsdk.InstanceIpv6AddressRequest{} + for _, f0f20elemf8iter := range f0f20iter.IPv6Addresses { + f0f20elemf8elem := &svcsdk.InstanceIpv6AddressRequest{} + if f0f20elemf8iter.IPv6Address != nil { + f0f20elemf8elem.SetIpv6Address(*f0f20elemf8iter.IPv6Address) + } + f0f20elemf8 = append(f0f20elemf8, f0f20elemf8elem) + } + f0f20elem.SetIpv6Addresses(f0f20elemf8) + } + if f0f20iter.NetworkCardIndex != nil { + f0f20elem.SetNetworkCardIndex(*f0f20iter.NetworkCardIndex) + } + if f0f20iter.NetworkInterfaceID != nil { + f0f20elem.SetNetworkInterfaceId(*f0f20iter.NetworkInterfaceID) + } + if f0f20iter.PrivateIPAddress != nil { + f0f20elem.SetPrivateIpAddress(*f0f20iter.PrivateIPAddress) + } + if f0f20iter.PrivateIPAddresses != nil { + f0f20elemf12 := []*svcsdk.PrivateIpAddressSpecification{} + for _, f0f20elemf12iter := range f0f20iter.PrivateIPAddresses { + f0f20elemf12elem := &svcsdk.PrivateIpAddressSpecification{} + if f0f20elemf12iter.Primary != nil { + f0f20elemf12elem.SetPrimary(*f0f20elemf12iter.Primary) + } + if f0f20elemf12iter.PrivateIPAddress != nil { + f0f20elemf12elem.SetPrivateIpAddress(*f0f20elemf12iter.PrivateIPAddress) + } + f0f20elemf12 = append(f0f20elemf12, f0f20elemf12elem) + } + f0f20elem.SetPrivateIpAddresses(f0f20elemf12) + } + if f0f20iter.SecondaryPrivateIPAddressCount != nil { + f0f20elem.SetSecondaryPrivateIpAddressCount(*f0f20iter.SecondaryPrivateIPAddressCount) + } + if f0f20iter.SubnetID != nil { + f0f20elem.SetSubnetId(*f0f20iter.SubnetID) + } + f0f20 = append(f0f20, f0f20elem) + } + f0.SetNetworkInterfaces(f0f20) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement != nil { + f0f21 := &svcsdk.LaunchTemplatePlacementRequest{} + if cr.Spec.ForProvider.LaunchTemplateData.Placement.Affinity != nil { + f0f21.SetAffinity(*cr.Spec.ForProvider.LaunchTemplateData.Placement.Affinity) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.AvailabilityZone != nil { + f0f21.SetAvailabilityZone(*cr.Spec.ForProvider.LaunchTemplateData.Placement.AvailabilityZone) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.GroupName != nil { + f0f21.SetGroupName(*cr.Spec.ForProvider.LaunchTemplateData.Placement.GroupName) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.HostID != nil { + f0f21.SetHostId(*cr.Spec.ForProvider.LaunchTemplateData.Placement.HostID) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.HostResourceGroupARN != nil { + f0f21.SetHostResourceGroupArn(*cr.Spec.ForProvider.LaunchTemplateData.Placement.HostResourceGroupARN) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.PartitionNumber != nil { + f0f21.SetPartitionNumber(*cr.Spec.ForProvider.LaunchTemplateData.Placement.PartitionNumber) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.SpreadDomain != nil { + f0f21.SetSpreadDomain(*cr.Spec.ForProvider.LaunchTemplateData.Placement.SpreadDomain) + } + if cr.Spec.ForProvider.LaunchTemplateData.Placement.Tenancy != nil { + f0f21.SetTenancy(*cr.Spec.ForProvider.LaunchTemplateData.Placement.Tenancy) + } + f0.SetPlacement(f0f21) + } + if cr.Spec.ForProvider.LaunchTemplateData.RamDiskID != nil { + f0.SetRamDiskId(*cr.Spec.ForProvider.LaunchTemplateData.RamDiskID) + } + if cr.Spec.ForProvider.LaunchTemplateData.SecurityGroupIDs != nil { + f0f23 := []*string{} + for _, f0f23iter := range cr.Spec.ForProvider.LaunchTemplateData.SecurityGroupIDs { + var f0f23elem string + f0f23elem = *f0f23iter + f0f23 = append(f0f23, &f0f23elem) + } + f0.SetSecurityGroupIds(f0f23) + } + if cr.Spec.ForProvider.LaunchTemplateData.SecurityGroups != nil { + f0f24 := []*string{} + for _, f0f24iter := range cr.Spec.ForProvider.LaunchTemplateData.SecurityGroups { + var f0f24elem string + f0f24elem = *f0f24iter + f0f24 = append(f0f24, &f0f24elem) + } + f0.SetSecurityGroups(f0f24) + } + if cr.Spec.ForProvider.LaunchTemplateData.TagSpecifications != nil { + f0f25 := []*svcsdk.LaunchTemplateTagSpecificationRequest{} + for _, f0f25iter := range cr.Spec.ForProvider.LaunchTemplateData.TagSpecifications { + f0f25elem := &svcsdk.LaunchTemplateTagSpecificationRequest{} + if f0f25iter.ResourceType != nil { + f0f25elem.SetResourceType(*f0f25iter.ResourceType) + } + if f0f25iter.Tags != nil { + f0f25elemf1 := []*svcsdk.Tag{} + for _, f0f25elemf1iter := range f0f25iter.Tags { + f0f25elemf1elem := &svcsdk.Tag{} + if f0f25elemf1iter.Key != nil { + f0f25elemf1elem.SetKey(*f0f25elemf1iter.Key) + } + if f0f25elemf1iter.Value != nil { + f0f25elemf1elem.SetValue(*f0f25elemf1iter.Value) + } + f0f25elemf1 = append(f0f25elemf1, f0f25elemf1elem) + } + f0f25elem.SetTags(f0f25elemf1) + } + f0f25 = append(f0f25, f0f25elem) + } + f0.SetTagSpecifications(f0f25) + } + if cr.Spec.ForProvider.LaunchTemplateData.UserData != nil { + f0.SetUserData(*cr.Spec.ForProvider.LaunchTemplateData.UserData) + } + res.SetLaunchTemplateData(f0) + } + if cr.Spec.ForProvider.SourceVersion != nil { + res.SetSourceVersion(*cr.Spec.ForProvider.SourceVersion) + } + if cr.Spec.ForProvider.VersionDescription != nil { + res.SetVersionDescription(*cr.Spec.ForProvider.VersionDescription) + } + + return res +} + +// IsNotFound returns whether the given error is of type NotFound or not. +func IsNotFound(err error) bool { + awsErr, ok := err.(awserr.Error) + return ok && awsErr.Code() == "InvalidLaunchTemplateId.VersionNotFound" +}