github.com/openshift/installer@v1.4.17/pkg/asset/installconfig/aws/regions.go (about)

     1  package aws
     2  
     3  import (
     4  	"github.com/aws/aws-sdk-go/aws/endpoints"
     5  
     6  	"github.com/openshift/installer/pkg/rhcos"
     7  	"github.com/openshift/installer/pkg/types"
     8  )
     9  
    10  // knownPublicRegions is the subset of public AWS regions where RHEL CoreOS images are published.
    11  // This subset does not include supported regions which are found in other partitions, such as us-gov-east-1.
    12  // Returns: a map of region identifier to region description.
    13  func knownPublicRegions(architecture types.Architecture) map[string]string {
    14  	required := rhcos.AMIRegions(architecture)
    15  
    16  	regions := make(map[string]string)
    17  	for _, region := range endpoints.AwsPartition().Regions() {
    18  		if required.Has(region.ID()) {
    19  			regions[region.ID()] = region.Description()
    20  		}
    21  	}
    22  	return regions
    23  }
    24  
    25  // IsKnownPublicRegion returns true if a specified region is Known to the installer.
    26  // A known region is the subset of public AWS regions where RHEL CoreOS images are published.
    27  func IsKnownPublicRegion(region string, architecture types.Architecture) bool {
    28  	if _, ok := knownPublicRegions(architecture)[region]; ok {
    29  		return true
    30  	}
    31  	return false
    32  }