// return list of the valid instance sizes for the specified region and ams instance types
return list of the valid instance sizes for the specified region and ams instance types
// return list of the valid instance sizes for the specified region and ams instance types
func FetchValidKafkaSizes(f *factory.Factory,
	providerID string, regionId string, amsType accountmgmtutil.QuotaSpec) ([]kafkamgmtclient.SupportedKafkaSize, error) {
	conn, err := f.Connection(connection.DefaultConfigSkipMasAuth)
	if err != nil {
		return nil, err
	}
	validSizes := []kafkamgmtclient.SupportedKafkaSize{}
	instanceTypes, _, err := conn.API().
		KafkaMgmt().
		GetInstanceTypesByCloudProviderAndRegion(f.Context, providerID, regionId).
		Execute()
	if err != nil {
		return nil, err
	}
	desiredInstanceType := mapAmsTypeToBackendType(&amsType)
	if desiredInstanceType == DeveloperType {
		for _, instanceType := range instanceTypes.GetInstanceTypes() {
			if desiredInstanceType == instanceType.GetId() {
				instanceSizes := instanceType.GetSizes()
				for i := range instanceSizes {
					validSizes = append(validSizes, instanceSizes[i])
				}
			}
		}
	} else {
		for _, instanceType := range instanceTypes.GetInstanceTypes() {
			if desiredInstanceType == instanceType.GetId() {
				instanceSizes := instanceType.GetSizes()
				for i := range instanceSizes {
					if instanceSizes[i].GetQuotaConsumed() <= int32(amsType.Quota) {
						validSizes = append(validSizes, instanceSizes[i])
					}
				}
			}
		}
	}
	return validSizes, nil
}
func FetchValidKafkaSizes ( f * factory . Factory , providerID string , regionId string , amsType accountmgmtutil . QuotaSpec ) ( [ ] kafkamgmtclient . SupportedKafkaSize , error ) { conn , err := f . Connection ( connection . DefaultConfigSkipMasAuth ) if err != nil { return nil , err } validSizes := [ ] kafkamgmtclient . SupportedKafkaSize { } instanceTypes , _ , err := conn . API ( ) . KafkaMgmt ( ) . GetInstanceTypesByCloudProviderAndRegion ( f . Context , providerID , regionId ) . Execute ( ) if err != nil { return nil , err } desiredInstanceType := mapAmsTypeToBackendType ( & amsType ) if desiredInstanceType == DeveloperType { for _ , instanceType := range instanceTypes . GetInstanceTypes ( ) { if desiredInstanceType == instanceType . GetId ( ) { instanceSizes := instanceType . GetSizes ( ) for i := range instanceSizes { validSizes = append ( validSizes , instanceSizes [ i ] ) } } } } else { for _ , instanceType := range instanceTypes . GetInstanceTypes ( ) { if desiredInstanceType == instanceType . GetId ( ) { instanceSizes := instanceType . GetSizes ( ) for i := range instanceSizes { if instanceSizes [ i ] . GetQuotaConsumed ( ) <= int32 ( amsType . Quota ) { validSizes = append ( validSizes , instanceSizes [ i ] ) } } } } } return validSizes , nil }
return list of the valid instance sizes for the specified region and ams instance types
return list of the valid instance sizes for the specified region and ams instance types
// Temporary workaround to be removed