// GetEnabledCloudRegionIDs extracts and returns a slice of the unique IDs of all enabled regions
GetEnabledCloudRegionIDs extracts and returns a slice of the unique IDs of all enabled regions
// GetEnabledCloudRegionIDs extracts and returns a slice of the unique IDs of all enabled regions
func GetEnabledCloudRegionIDs(f *factory.Factory, providerID string, userAllowedAMSInstanceType *accountmgmtutil.QuotaSpec) ([]string, error) {
	validRegions := []string{}
	conn, err := f.Connection(connection.DefaultConfigSkipMasAuth)
	if err != nil {
		return validRegions, err
	}
	cloudProviderResponse, _, err := conn.API().
		KafkaMgmt().
		GetCloudProviderRegions(f.Context, providerID).
		Execute()
	if err != nil {
		return validRegions, err
	}
	regions := cloudProviderResponse.GetItems()
	var regionIDs []string
	for i, region := range regions {
		if region.GetEnabled() {
			if userAllowedAMSInstanceType != nil {
				if IsRegionAllowed(&regions[i], userAllowedAMSInstanceType) {
					regionIDs = append(regionIDs, region.GetId())
				}
			} else {
				regionIDs = append(regionIDs, region.GetId())
			}
		}
	}
	return regionIDs, err
}
func GetEnabledCloudRegionIDs ( f * factory . Factory , providerID string , userAllowedAMSInstanceType * accountmgmtutil . QuotaSpec ) ( [ ] string , error ) { validRegions := [ ] string { } conn , err := f . Connection ( connection . DefaultConfigSkipMasAuth ) if err != nil { return validRegions , err } cloudProviderResponse , _ , err := conn . API ( ) . KafkaMgmt ( ) . GetCloudProviderRegions ( f . Context , providerID ) . Execute ( ) if err != nil { return validRegions , err } regions := cloudProviderResponse . GetItems ( ) var regionIDs [ ] string for i , region := range regions { if region . GetEnabled ( ) { if userAllowedAMSInstanceType != nil { if IsRegionAllowed ( & regions [ i ] , userAllowedAMSInstanceType ) { regionIDs = append ( regionIDs , region . GetId ( ) ) } } else { regionIDs = append ( regionIDs , region . GetId ( ) ) } } } return regionIDs , err }
GetEnabledCloudRegionIDs extracts and returns a slice of the unique IDs of all enabled regions
GetEnabledCloudRegionIDs extracts and returns a slice of the unique IDs of all enabled regions