in pkg/fake/ec2api.go [426:452]
func (e *EC2API) DescribeLaunchTemplates(_ context.Context, input *ec2.DescribeLaunchTemplatesInput, _ ...func(*ec2.Options)) (*ec2.DescribeLaunchTemplatesOutput, error) {
if !e.NextError.IsNil() {
defer e.NextError.Reset()
return nil, e.NextError.Get()
}
if !e.DescribeLaunchTemplatesOutput.IsNil() {
return e.DescribeLaunchTemplatesOutput.Clone(), nil
}
output := &ec2.DescribeLaunchTemplatesOutput{}
e.LaunchTemplates.Range(func(key, value interface{}) bool {
launchTemplate := value.(ec2types.LaunchTemplate)
if lo.Contains(input.LaunchTemplateNames, lo.FromPtr(launchTemplate.LaunchTemplateName)) || len(input.Filters) != 0 && Filter(input.Filters, aws.ToString(launchTemplate.LaunchTemplateId), aws.ToString(launchTemplate.LaunchTemplateName), "", "", launchTemplate.Tags) {
output.LaunchTemplates = append(output.LaunchTemplates, launchTemplate)
}
return true
})
if len(input.Filters) != 0 {
return output, nil
}
if len(output.LaunchTemplates) == 0 {
return nil, &smithy.GenericAPIError{
Code: "InvalidLaunchTemplateName.NotFoundException",
Message: "At least one of the launch templates specified in the request does not exist.",
}
}
return output, nil
}