Documentation
¶
Overview ¶
Package cloudinfo contains functions and methods for search and detailing various resources located in the IBM Cloud
Index ¶
- type CloudInfoService
- func (infoSvc *CloudInfoService) GetAvailableVpcRegions() ([]vpcv1.Region, error)
- func (infoSvc *CloudInfoService) GetLeastVpcTestRegion() (string, error)
- func (infoSvc *CloudInfoService) GetTestRegionsByPriority() ([]RegionData, error)
- func (infoSvc *CloudInfoService) LoadRegionPrefsFromFile(filePath string) error
- func (infoSvc *CloudInfoService) LoadRegionsFromVpcAccount() error
- type CloudInfoServiceOptions
- type RegionData
- type SortedRegionsDataByPriority
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudInfoService ¶
type CloudInfoService struct {
// contains filtered or unexported fields
}
CloudInfoService is a structure that is used as the receiver to many methods in this package. It contains references to other important services and data structures needed to perform these methods.
func NewCloudInfoServiceFromEnv ¶
func NewCloudInfoServiceFromEnv(apiKeyEnv string, options CloudInfoServiceOptions) (*CloudInfoService, error)
NewCloudInfoServiceFromEnv is a factory function used for creating a new initialized service structure. This function can be called if the IBM Cloud API Key should be extracted from an existing OS level environment variable. Returns a pointer to an initialized CloudInfoService and error.
func NewCloudInfoServiceWithKey ¶
func NewCloudInfoServiceWithKey(options CloudInfoServiceOptions) (*CloudInfoService, error)
NewCloudInfoServiceWithKey is a factory function used for creating a new initialized service structure. This function can be called if an IBM Cloud API Key is known and passed in directly. Returns a pointer to an initialized CloudInfoService and error.
func (*CloudInfoService) GetAvailableVpcRegions ¶
func (infoSvc *CloudInfoService) GetAvailableVpcRegions() ([]vpcv1.Region, error)
GetAvailableVpcRegions is a method for receiver CloudInfoService that will query the caller account for all regions that support the VPC resource type and are available in the account. Returns an array of vpcv1.Region and error.
func (*CloudInfoService) GetLeastVpcTestRegion ¶
func (infoSvc *CloudInfoService) GetLeastVpcTestRegion() (string, error)
GetLeastVpcTestRegion is a method for receiver CloudInfoService that will determine a region available to the caller account that currently contains the least amount of deployed VPCs. The determination can be influenced by specifying CloudInfoService.regionsData. If no CloudInfoService.regionsData exists, it will simply loop through all available regions for the caller account and choose a region with lowest VPC count. Returns a string representing an IBM Cloud region name, and error.
func (*CloudInfoService) GetTestRegionsByPriority ¶
func (infoSvc *CloudInfoService) GetTestRegionsByPriority() ([]RegionData, error)
GetTestRegionsByPriority is a method for receiver CloudInfoService that will use the service regionsData to determine a priorty order and region eligibility for test resources to be deployed. The returned array will then be used by various methods to determine best region to use for different test scenarios. Returns an array of RegionData struct, and error.
func (*CloudInfoService) LoadRegionPrefsFromFile ¶
func (infoSvc *CloudInfoService) LoadRegionPrefsFromFile(filePath string) error
LoadRegionPrefsFromFile is a method for receiver CloudInfoService that will populate the CloudInfoService.regionsData by reading a file in the YAML format. Returns error.
func (*CloudInfoService) LoadRegionsFromVpcAccount ¶
func (infoSvc *CloudInfoService) LoadRegionsFromVpcAccount() error
LoadRegionsFromVpcAccount is a method for receiver CloudInfoService that will populate the CloudInfoService.regionsData by using an API call to retrieve all available regions for the caller account, and assuming all are for test use and same priority. Returns error.
type CloudInfoServiceOptions ¶
type CloudInfoServiceOptions struct { ApiKey string VpcService vpcService RegionPrefs []RegionData }
CloudInfoServiceOptions structure used as input params for service constructor.
type RegionData ¶
type RegionData struct { Name string UseForTest bool `yaml:"useForTest"` TestPriority int `yaml:"testPriority"` Endpoint string Status string VpcCount int }
RegionData is a data structure used for holding configurable information about a region. Most of this data is configured by the caller in order to affect certain processing routines.
type SortedRegionsDataByPriority ¶
type SortedRegionsDataByPriority []RegionData
SortedRegionsDataByPriority is an array of RegionData struct that is used as a receiver to implement the sort interface (Len/Less/Swap) with supplied methods to sort the array on the field RegionData.TestPriority.
func (SortedRegionsDataByPriority) Len ¶
func (regions SortedRegionsDataByPriority) Len() int
func (SortedRegionsDataByPriority) Less ¶
func (regions SortedRegionsDataByPriority) Less(i, j int) bool
func (SortedRegionsDataByPriority) Swap ¶
func (regions SortedRegionsDataByPriority) Swap(i, j int)