Documentation
¶
Overview ¶
Package cloudinfo contains functions and methods for searching and detailing various resources located in the IBM Cloud
Index ¶
- Constants
- func GetRandomSchematicsLocation() string
- func GetSchematicServiceURLForRegion(region string) (string, error)
- func GetSchematicsLocations() []string
- func PrintResourceKey(keyList []string, resources []resourcecontrollerv2.ResourceInstance)
- func PrintResources(resources []resourcecontrollerv2.ResourceInstance)
- func ProjectsMemberIsDeployFailed(member *project.ProjectConfig) bool
- func ProjectsMemberIsDeploying(member *project.ProjectConfig) bool
- func ProjectsMemberIsUndeployed(member *project.ProjectConfig) bool
- type CatalogInput
- type CatalogJson
- type CloudInfoService
- func (infoSvc *CloudInfoService) ArePipelineActionsRunning(stackConfig *ConfigDetails) (bool, error)
- func (infoSvc *CloudInfoService) CreateConfig(configDetails *ConfigDetails) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) CreateConfigFromCatalogJson(configDetails *ConfigDetails, catalogJsonPath string) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) CreateDaConfig(configDetails *ConfigDetails) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) CreateNewStack(stackConfig *ConfigDetails) (result *project.StackDefinition, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) CreatePowerSession(instanceRegion string) (*ibmpisession.IBMPISession, error)
- func (infoSvc *CloudInfoService) CreatePowercloudConnectionClient(instanceId string, powerSession *ibmpisession.IBMPISession) *ibmpiinstance.IBMPICloudConnectionClient
- func (infoSvc *CloudInfoService) CreateProjectFromConfig(config *ProjectsConfig) (result *project.Project, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) CreateStackDefinitionWrapper(stackDefOptions *project.CreateStackDefinitionOptions, ...) (result *project.StackDefinition, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) CreateStackFromConfigFile(stackConfig *ConfigDetails, stackConfigPath string, catalogJsonPath string) (stackDefinition *project.StackDefinition, response *core.DetailedResponse, ...)
- func (infoSvc *CloudInfoService) DeleteIamPolicyByID(policyId string) error
- func (infoSvc *CloudInfoService) DeleteInstanceFromReclamationByCRN(CRN string) error
- func (infoSvc *CloudInfoService) DeleteInstanceFromReclamationId(reclamationID string) error
- func (infoSvc *CloudInfoService) DeleteProject(projectID string) (result *project.ProjectDeleteResponse, response *core.DetailedResponse, ...)
- func (infoSvc *CloudInfoService) DeployConfig(configDetails *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, ...)
- func (infoSvc *CloudInfoService) ForceDeployConfig(configDetails *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, ...)
- func (infoSvc *CloudInfoService) ForceValidateProjectConfig(configDetails *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, ...)
- func (infoSvc *CloudInfoService) GetAvailableIcdVersions(icdType string) ([]string, error)
- func (infoSvc *CloudInfoService) GetAvailableVpcRegions() ([]vpcv1.Region, error)
- func (infoSvc *CloudInfoService) GetCBRRuleByID(ruleID string) (*contextbasedrestrictionsv1.Rule, *core.DetailedResponse, error)
- func (infoSvc *CloudInfoService) GetCBRZoneByID(zoneID string) (*contextbasedrestrictionsv1.Zone, error)
- func (infoSvc *CloudInfoService) GetCatalogVersionByLocator(versionLocator string) (*catalogmanagementv1.Version, error)
- func (infoSvc *CloudInfoService) GetClusterAdminConfigPath(clusterId string) (string, error)
- func (infoSvc *CloudInfoService) GetClusterConfigConfigPath(clusterId string) (string, error)
- func (infoSvc *CloudInfoService) GetClusterConfigPath(clusterId string, basePath string, admin bool, createCalicoConfig bool, ...) (string, error)
- func (infoSvc *CloudInfoService) GetClusterConfigPathWithEndpoint(clusterId string, endpoint string) (string, error)
- func (infoSvc *CloudInfoService) GetClusterIngressStatus(clusterId string) (string, error)
- func (infoSvc *CloudInfoService) GetConfig(configDetails *ConfigDetails) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) GetLeastPowerConnectionZone() (string, error)
- func (infoSvc *CloudInfoService) GetLeastVpcTestRegion() (string, error)
- func (infoSvc *CloudInfoService) GetLeastVpcTestRegionO(options GetTestRegionOptions) (string, error)
- func (infoSvc *CloudInfoService) GetLeastVpcTestRegionWithoutActivityTracker() (string, error)
- func (infoSvc *CloudInfoService) GetProject(projectID string) (result *project.Project, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) GetProjectConfigVersion(configDetails *ConfigDetails, version int64) (result *project.ProjectConfigVersion, response *core.DetailedResponse, ...)
- func (infoSvc *CloudInfoService) GetProjectConfigs(projectID string) (results []project.ProjectConfigSummary, err error)
- func (infoSvc *CloudInfoService) GetReclamationIdFromCRN(CRN string) (string, error)
- func (infoSvc *CloudInfoService) GetResourceGroupIDByName(resourceGroupName string) (string, error)
- func (infoSvc *CloudInfoService) GetSchematicsJobFileData(jobID string, fileType string, location string) (*schematics.JobFileData, error)
- func (infoSvc *CloudInfoService) GetSchematicsJobLogs(jobID string, location string) (result *schematics.JobLog, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) GetSchematicsJobLogsForMember(member *project.ProjectConfig, memberName string, projectRegion string) (details string, terraformLogs string)
- func (infoSvc *CloudInfoService) GetSchematicsJobLogsText(jobID string, location string) (string, error)
- func (infoSvc *CloudInfoService) GetSchematicsJobPlanJson(jobID string, location string) (string, error)
- func (infoSvc *CloudInfoService) GetSchematicsServiceByLocation(location string) (schematicsService, error)
- func (infoSvc *CloudInfoService) GetStackMembers(stackConfig *ConfigDetails) (members []*project.ProjectConfig, err error)
- func (infoSvc *CloudInfoService) GetTestRegionsByPriority() ([]RegionData, error)
- func (infoSvc *CloudInfoService) GetThreadLock() *sync.Mutex
- func (infoSvc *CloudInfoService) HasRegionData() bool
- func (infoSvc *CloudInfoService) IsConfigDeployed(configDetails *ConfigDetails) (projectConfig *project.ProjectConfigVersion, isDeployed bool)
- func (infoSvc *CloudInfoService) IsUndeploying(details *ConfigDetails) (projectConfig *project.ProjectConfigVersion, isUndeploying bool)
- func (infoSvc *CloudInfoService) ListPowerConnectionsForAccount() ([]*PowerCloudConnectionDetail, error)
- func (infoSvc *CloudInfoService) ListPowerWorkspaceConnections(client ibmPICloudConnectionClient) ([]*ibmpimodels.CloudConnection, error)
- func (infoSvc *CloudInfoService) ListPowerWorkspaces() ([]resourcecontrollerv2.ResourceInstance, error)
- func (infoSvc *CloudInfoService) ListResourcesByCrnServiceName(crnServiceName string) ([]resourcecontrollerv2.ResourceInstance, error)
- func (infoSvc *CloudInfoService) ListResourcesByGroupID(resourceGroupId string) ([]resourcecontrollerv2.ResourceInstance, error)
- func (infoSvc *CloudInfoService) ListResourcesByGroupName(resourceGroupName string) ([]resourcecontrollerv2.ResourceInstance, error)
- func (infoSvc *CloudInfoService) LoadRegionPrefsFromFile(filePath string) error
- func (infoSvc *CloudInfoService) LoadRegionsFromVpcAccount() error
- func (infoSvc *CloudInfoService) LookupMemberNameByID(stackDetails *project.ProjectConfig, memberID string) (string, error)
- func (infoSvc *CloudInfoService) RemoveRegionForTest(regionID string)
- func (infoSvc *CloudInfoService) ReplaceCBRRule(updatedExistingRule *contextbasedrestrictionsv1.Rule, eTag *string) (*contextbasedrestrictionsv1.Rule, *core.DetailedResponse, error)
- func (infoSvc *CloudInfoService) SetCBREnforcementMode(ruleID string, mode string) error
- func (infoSvc *CloudInfoService) SyncConfig(projectID string, configID string) (response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) UndeployConfig(details *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, ...)
- func (infoSvc *CloudInfoService) UpdateConfig(configDetails *ConfigDetails, ...) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) UpdateConfigWithHeaders(configDetails *ConfigDetails, ...) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) UpdateStackFromConfig(stackConfig *ConfigDetails) (result *project.StackDefinition, response *core.DetailedResponse, err error)
- func (infoSvc *CloudInfoService) ValidateProjectConfig(configDetails *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, ...)
- type CloudInfoServiceI
- type CloudInfoServiceOptions
- type ConfigDetails
- type GetTestRegionOptions
- type PowerCloudConnectionDetail
- type ProjectsConfig
- type RegionData
- type SortedRegionsDataByPriority
- type Stack
- type StackDefinitionCreator
Constants ¶
const ( ErrPolicyInvalidToDelete = "policy was not valid to delete" ErrTokenInvalid = "the token provided is not valid" ErrNoAccessToDeletePolicy = "access to delete the policy is not granted" ErrPolicyNotFound = "policy was not found" ErrTooManyRequests = "too many requests have been made within a given time window" )
Variables ¶
This section is empty.
Functions ¶
func GetRandomSchematicsLocation ¶ added in v1.42.0
func GetRandomSchematicsLocation() string
returns a random selected region that is valid for Schematics Workspace creation
func GetSchematicServiceURLForRegion ¶ added in v1.42.0
returns the appropriate schematics API endpoint based on specific region the region can be geographic (us or eu) or specific (us-south)
func GetSchematicsLocations ¶ added in v1.42.0
func GetSchematicsLocations() []string
Returns a constant of supported locations for schematics service
func PrintResourceKey ¶ added in v1.28.0
func PrintResourceKey(keyList []string, resources []resourcecontrollerv2.ResourceInstance)
PrintResourceKey will print a formatted list of resources to stdout keyList is an ordered list of keys to print available keys are: Name, Location, State, ResourceID, CRN, ResourceGroupID, ResourcePlanID, SubType, Type, URL, AccountID, CreatedBy, DashboardURL, GUID, LastOperationState, LastOperationType, ScheduledReclaimBy resources is a list of resources to print
func PrintResources ¶ added in v1.28.0
func PrintResources(resources []resourcecontrollerv2.ResourceInstance)
PrintResources will print a formatted list of resources to stdout resources is a list of resources to print
func ProjectsMemberIsDeployFailed ¶ added in v1.39.0
func ProjectsMemberIsDeployFailed(member *project.ProjectConfig) bool
ProjectsMemberIsDeployFailed checks if a member is in a state that indicates deployment failure.
func ProjectsMemberIsDeploying ¶ added in v1.39.0
func ProjectsMemberIsDeploying(member *project.ProjectConfig) bool
ProjectsMemberIsDeploying checks if a member is in a state that indicates it is currently deploying.
func ProjectsMemberIsUndeployed ¶ added in v1.39.0
func ProjectsMemberIsUndeployed(member *project.ProjectConfig) bool
ProjectsMemberIsUndeployed checks if a member is in an undeployed state.
Types ¶
type CatalogInput ¶ added in v1.40.0
type CatalogInput struct { Key string `json:"key"` Type string `json:"type"` DefaultValue interface{} `json:"default_value"` Required bool `json:"required"` Description string `json:"description"` }
CatalogInput represents an input from the catalog configuration
type CatalogJson ¶ added in v1.31.0
type CatalogJson struct { Products []struct { Label string `json:"label"` Name string `json:"name"` ProductKind string `json:"product_kind"` Tags []string `json:"tags"` Keywords []string `json:"keywords"` ShortDescription string `json:"short_description"` LongDescription string `json:"long_description"` OfferingDocsURL string `json:"offering_docs_url"` OfferingIconURL string `json:"offering_icon_url"` ProviderName string `json:"provider_name"` Features []struct { Title string `json:"title"` Description string `json:"description"` } `json:"features"` SupportDetails string `json:"support_details"` Flavors []struct { Label string `json:"label"` Name string `json:"name"` WorkingDirectory string `json:"working_directory"` Compliance struct { Authority string `json:"authority"` Profiles []struct { ProfileName string `json:"profile_name"` ProfileVersion string `json:"profile_version"` } `json:"profiles"` } `json:"compliance"` IamPermissions []struct { ServiceName string `json:"service_name"` RoleCrns []string `json:"role_crns"` } `json:"iam_permissions"` Architecture struct { Features []struct { Title string `json:"title"` Description string `json:"description"` } `json:"features"` Diagrams []struct { Diagram struct { URL string `json:"url"` Caption string `json:"caption"` Type string `json:"type"` ThumbnailURL string `json:"thumbnail_url"` } `json:"diagram"` Description string `json:"description"` } `json:"diagrams"` } `json:"architecture"` Configuration []struct { Key string `json:"key"` Type string `json:"type"` Description string `json:"description"` DefaultValue interface{} `json:"default_value"` Required bool `json:"required"` DisplayName string `json:"display_name,omitempty"` CustomConfig struct { Type string `json:"type"` Grouping string `json:"grouping"` OriginalGrouping string `json:"original_grouping"` } `json:"custom_config,omitempty"` Options []struct { DisplayName string `json:"displayname"` Value string `json:"value"` } `json:"options,omitempty"` } `json:"configuration"` Outputs []struct { Key string `json:"key"` Description string `json:"description"` } `json:"outputs"` InstallType string `json:"install_type"` } `json:"flavors"` } `json:"products"` }
type CloudInfoService ¶
type CloudInfoService struct { ApiKey string // 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) ArePipelineActionsRunning ¶ added in v1.39.0
func (infoSvc *CloudInfoService) ArePipelineActionsRunning(stackConfig *ConfigDetails) (bool, error)
ArePipelineActionsRunning checks if any pipeline actions are running for the given stack
func (*CloudInfoService) CreateConfig ¶ added in v1.31.0
func (infoSvc *CloudInfoService) CreateConfig(configDetails *ConfigDetails) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
CreateConfig creates a project config
func (*CloudInfoService) CreateConfigFromCatalogJson ¶ added in v1.31.0
func (infoSvc *CloudInfoService) CreateConfigFromCatalogJson(configDetails *ConfigDetails, catalogJsonPath string) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
func (*CloudInfoService) CreateDaConfig ¶ added in v1.31.0
func (infoSvc *CloudInfoService) CreateDaConfig(configDetails *ConfigDetails) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
CreateDaConfig creates a DA project config
func (*CloudInfoService) CreateNewStack ¶ added in v1.31.0
func (infoSvc *CloudInfoService) CreateNewStack(stackConfig *ConfigDetails) (result *project.StackDefinition, response *core.DetailedResponse, err error)
func (*CloudInfoService) CreatePowerSession ¶ added in v1.1.0
func (infoSvc *CloudInfoService) CreatePowerSession(instanceRegion string) (*ibmpisession.IBMPISession, error)
CreatePowercloudSession will return a PowerPI session object that is tailored to a specific cloud account and region/zone
func (*CloudInfoService) CreatePowercloudConnectionClient ¶ added in v1.1.0
func (infoSvc *CloudInfoService) CreatePowercloudConnectionClient(instanceId string, powerSession *ibmpisession.IBMPISession) *ibmpiinstance.IBMPICloudConnectionClient
CreatePowercloudConnectionClient will return a Power PI Connection Client based on an existing session object and a Powercloud instance Id
func (*CloudInfoService) CreateProjectFromConfig ¶ added in v1.39.0
func (infoSvc *CloudInfoService) CreateProjectFromConfig(config *ProjectsConfig) (result *project.Project, response *core.DetailedResponse, err error)
CreateProjectFromConfig creates a project with the given config config: the config to use Returns an error if one occurs
func (*CloudInfoService) CreateStackDefinitionWrapper ¶ added in v1.40.0
func (infoSvc *CloudInfoService) CreateStackDefinitionWrapper(stackDefOptions *project.CreateStackDefinitionOptions, members []project.ProjectConfig) (result *project.StackDefinition, response *core.DetailedResponse, err error)
CreateStackDefinition is a wrapper around projectv1.CreateStackDefinition to allow correct mocking in the tests
func (*CloudInfoService) CreateStackFromConfigFile ¶ added in v1.31.0
func (infoSvc *CloudInfoService) CreateStackFromConfigFile(stackConfig *ConfigDetails, stackConfigPath string, catalogJsonPath string) (stackDefinition *project.StackDefinition, response *core.DetailedResponse, err error)
CreateStackFromConfigFile creates a stack from a config file This method orchestrates the stack creation process by managing stack configurations, member inputs, and handling catalog configurations.
func (*CloudInfoService) DeleteIamPolicyByID ¶ added in v1.27.0
func (infoSvc *CloudInfoService) DeleteIamPolicyByID(policyId string) error
DeleteIamPolicyByID will delete an IAM policy by ID
func (*CloudInfoService) DeleteInstanceFromReclamationByCRN ¶ added in v1.45.0
func (infoSvc *CloudInfoService) DeleteInstanceFromReclamationByCRN(CRN string) error
func (*CloudInfoService) DeleteInstanceFromReclamationId ¶ added in v1.45.0
func (infoSvc *CloudInfoService) DeleteInstanceFromReclamationId(reclamationID string) error
func (*CloudInfoService) DeleteProject ¶ added in v1.31.0
func (infoSvc *CloudInfoService) DeleteProject(projectID string) (result *project.ProjectDeleteResponse, response *core.DetailedResponse, err error)
func (*CloudInfoService) DeployConfig ¶ added in v1.31.0
func (infoSvc *CloudInfoService) DeployConfig(configDetails *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, err error)
DeployConfig deploys a project config
func (*CloudInfoService) ForceDeployConfig ¶ added in v1.34.0
func (infoSvc *CloudInfoService) ForceDeployConfig(configDetails *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, err error)
ForceDeployConfig forcefully deploys a project config
func (*CloudInfoService) ForceValidateProjectConfig ¶ added in v1.34.0
func (infoSvc *CloudInfoService) ForceValidateProjectConfig(configDetails *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, err error)
func (*CloudInfoService) GetAvailableIcdVersions ¶ added in v1.29.0
func (infoSvc *CloudInfoService) GetAvailableIcdVersions(icdType string) ([]string, error)
GetAvailableIcdVersions will retrieve the available versions of a specified ICD type. icdType is the type of the ICD returns a list of stable versions of a specified ICD type.
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) GetCBRRuleByID ¶ added in v1.6.0
func (infoSvc *CloudInfoService) GetCBRRuleByID(ruleID string) (*contextbasedrestrictionsv1.Rule, *core.DetailedResponse, error)
GetCBRRuleByID gets a rule by its ID using the Context-based Restrictions service
func (*CloudInfoService) GetCBRZoneByID ¶ added in v1.6.0
func (infoSvc *CloudInfoService) GetCBRZoneByID(zoneID string) (*contextbasedrestrictionsv1.Zone, error)
GetCBRZoneByID gets a zone by its ID using the Context-based Restrictions service
func (*CloudInfoService) GetCatalogVersionByLocator ¶ added in v1.33.0
func (infoSvc *CloudInfoService) GetCatalogVersionByLocator(versionLocator string) (*catalogmanagementv1.Version, error)
GetCatalogVersionByLocator gets a version by its locator using the Catalog Management service
func (*CloudInfoService) GetClusterAdminConfigPath ¶ added in v1.24.0
func (infoSvc *CloudInfoService) GetClusterAdminConfigPath(clusterId string) (string, error)
GetClusterAdminConfigPath retrieves the path to the cluster's Admin configuration file Uses public endpoint, and does not create a Calico configuration file clusterId: the ID or name of the cluster Returns the path to the configuration file
func (*CloudInfoService) GetClusterConfigConfigPath ¶ added in v1.24.0
func (infoSvc *CloudInfoService) GetClusterConfigConfigPath(clusterId string) (string, error)
GetClusterConfigConfigPath retrieves the path to the cluster's Admin configuration file Config for the current API keys user, uses public endpoint, and does not create a Calico configuration file clusterId: the ID or name of the cluster Returns the path to the configuration file
func (*CloudInfoService) GetClusterConfigPath ¶ added in v1.24.0
func (infoSvc *CloudInfoService) GetClusterConfigPath(clusterId string, basePath string, admin bool, createCalicoConfig bool, endpoint string) (string, error)
GetClusterConfigPath retrieves the path to the cluster's configuration file clusterId: the ID or name of the cluster basePath: the base directory path where the config file will be stored admin: whether to retrieve admin config createCalicoConfig: whether to create a Calico configuration file endpoint: the endpoint type to use Returns the path to the configuration file
func (*CloudInfoService) GetClusterConfigPathWithEndpoint ¶ added in v1.24.0
func (infoSvc *CloudInfoService) GetClusterConfigPathWithEndpoint(clusterId string, endpoint string) (string, error)
GetClusterConfigPathWithEndpoint retrieves the path to the cluster's configuration file Config for the current API keys user, and does not create a Calico configuration file clusterId: the ID or name of the cluster endpoint: the endpoint type to use
func (*CloudInfoService) GetClusterIngressStatus ¶ added in v1.38.0
func (infoSvc *CloudInfoService) GetClusterIngressStatus(clusterId string) (string, error)
GetClusterIngressStatus retrieves ingress status of the cluster clusterId: the ID or name of the cluster Returns the ingress status of the cluster
func (*CloudInfoService) GetConfig ¶ added in v1.31.0
func (infoSvc *CloudInfoService) GetConfig(configDetails *ConfigDetails) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
func (*CloudInfoService) GetLeastPowerConnectionZone ¶ added in v1.1.0
func (infoSvc *CloudInfoService) GetLeastPowerConnectionZone() (string, error)
GetLeastPowerConnectionZone is a method for receiver CloudInfoService that will determine a zone (data center) available to the caller account that currently contains the least amount of deployed PowerCloud connections. This determination requires specifying CloudInfoService.regionsData with valid data centers (regions) that are supported by the PowerCloud service. Returns a string representing an IBM Cloud region name, 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, using default options. Returns a string representing an IBM Cloud region name, and error.
func (*CloudInfoService) GetLeastVpcTestRegionO ¶ added in v1.2.0
func (infoSvc *CloudInfoService) GetLeastVpcTestRegionO(options GetTestRegionOptions) (string, error)
GetLeastVpcTestRegionO 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 and supplying appropriate options. 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) GetLeastVpcTestRegionWithoutActivityTracker ¶ added in v1.2.0
func (infoSvc *CloudInfoService) GetLeastVpcTestRegionWithoutActivityTracker() (string, error)
GetLeastVpcTestRegionWithoutActivityTracker 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 and does not currently contain an active Activity Tracker instance (can only have one per region). Returns a string representing an IBM Cloud region name, and error.
func (*CloudInfoService) GetProject ¶ added in v1.31.0
func (infoSvc *CloudInfoService) GetProject(projectID string) (result *project.Project, response *core.DetailedResponse, err error)
func (*CloudInfoService) GetProjectConfigVersion ¶ added in v1.34.0
func (infoSvc *CloudInfoService) GetProjectConfigVersion(configDetails *ConfigDetails, version int64) (result *project.ProjectConfigVersion, response *core.DetailedResponse, err error)
func (*CloudInfoService) GetProjectConfigs ¶ added in v1.31.0
func (infoSvc *CloudInfoService) GetProjectConfigs(projectID string) (results []project.ProjectConfigSummary, err error)
func (*CloudInfoService) GetReclamationIdFromCRN ¶ added in v1.45.0
func (infoSvc *CloudInfoService) GetReclamationIdFromCRN(CRN string) (string, error)
func (*CloudInfoService) GetResourceGroupIDByName ¶ added in v1.28.0
func (infoSvc *CloudInfoService) GetResourceGroupIDByName(resourceGroupName string) (string, error)
GetResourceGroupIDByName will retrieve the resource group ID for a given resource group name resourceGroupName is the name of the resource group returns the resource group ID
func (*CloudInfoService) GetSchematicsJobFileData ¶ added in v1.42.0
func (infoSvc *CloudInfoService) GetSchematicsJobFileData(jobID string, fileType string, location string) (*schematics.JobFileData, error)
GetSchematicsJobFileData will download a specific job file and return a JobFileData structure. Allowable values for fileType: state_file, plan_json location must be a valid geographical location supported by schematics: "us" or "eu"
func (*CloudInfoService) GetSchematicsJobLogs ¶ added in v1.39.0
func (infoSvc *CloudInfoService) GetSchematicsJobLogs(jobID string, location string) (result *schematics.JobLog, response *core.DetailedResponse, err error)
func (*CloudInfoService) GetSchematicsJobLogsForMember ¶ added in v1.39.0
func (infoSvc *CloudInfoService) GetSchematicsJobLogsForMember(member *project.ProjectConfig, memberName string, projectRegion string) (details string, terraformLogs string)
GetSchematicsJobLogsForMember gets the schematics job logs for a member
func (*CloudInfoService) GetSchematicsJobLogsText ¶ added in v1.39.0
func (infoSvc *CloudInfoService) GetSchematicsJobLogsText(jobID string, location string) (string, error)
GetSchematicsJobLogsText retrieves the logs of a Schematics job as a string The logs are returned as a string, or an error if the operation failed This is a temporary workaround until the Schematics GO SDK is fixed, ListJobLogs is broken as the response is text/plain and not application/json location must be a valid geographical location supported by schematics: "us" or "eu"
func (*CloudInfoService) GetSchematicsJobPlanJson ¶ added in v1.42.0
func (infoSvc *CloudInfoService) GetSchematicsJobPlanJson(jobID string, location string) (string, error)
Returns a string of the unmarshalled `Terraform Plan JSON` produced by a schematics job location must be a valid geographical location supported by schematics: "us" or "eu"
func (*CloudInfoService) GetSchematicsServiceByLocation ¶ added in v1.42.0
func (infoSvc *CloudInfoService) GetSchematicsServiceByLocation(location string) (schematicsService, error)
will return a previously configured schematics service based on location error returned if location not initialized location must be a valid geographical location supported by schematics: "us" or "eu"
func (*CloudInfoService) GetStackMembers ¶ added in v1.39.0
func (infoSvc *CloudInfoService) GetStackMembers(stackConfig *ConfigDetails) (members []*project.ProjectConfig, err error)
GetStackMembers gets the members of a stack
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) GetThreadLock ¶ added in v1.2.0
func (infoSvc *CloudInfoService) GetThreadLock() *sync.Mutex
func (*CloudInfoService) HasRegionData ¶ added in v1.2.0
func (infoSvc *CloudInfoService) HasRegionData() bool
HasRegionData is a method for receiver CloudInfoService that will respond with a boolean to verify that the service instance has region data loaded. You can use this method to determine if you need to load preference data.
func (*CloudInfoService) IsConfigDeployed ¶ added in v1.34.0
func (infoSvc *CloudInfoService) IsConfigDeployed(configDetails *ConfigDetails) (projectConfig *project.ProjectConfigVersion, isDeployed bool)
IsConfigDeployed checks if the config is deployed
func (*CloudInfoService) IsUndeploying ¶ added in v1.34.0
func (infoSvc *CloudInfoService) IsUndeploying(details *ConfigDetails) (projectConfig *project.ProjectConfigVersion, isUndeploying bool)
IsUndeploying checks if the config is undeploying
func (*CloudInfoService) ListPowerConnectionsForAccount ¶ added in v1.1.0
func (infoSvc *CloudInfoService) ListPowerConnectionsForAccount() ([]*PowerCloudConnectionDetail, error)
ListPowercloudConnectionsForAccount will return an array of CloudConnection that contains all unique connections in the current account (current account determined by API Key used)
func (*CloudInfoService) ListPowerWorkspaceConnections ¶ added in v1.1.0
func (infoSvc *CloudInfoService) ListPowerWorkspaceConnections(client ibmPICloudConnectionClient) ([]*ibmpimodels.CloudConnection, error)
ListPowerWorkspaceConnections will return an array of CloudConnection for a given existing connection client NOTE: the client passed into this method is derived from a specific PowerCloud Instance ID and Region/Zone. NOTE 2: the client object parameter is a reference to an interface to allow for unit test mocking
func (*CloudInfoService) ListPowerWorkspaces ¶ added in v1.1.0
func (infoSvc *CloudInfoService) ListPowerWorkspaces() ([]resourcecontrollerv2.ResourceInstance, error)
ListPowerWorkspaces will retrieve all PowerCloud parent instances for an account. There is no API to retrieve all Powercloud instances for an account. This function will loop through ALL resources of type "service_instance" in the account and then filter by looking for "power-iaas" in the CRN.
func (*CloudInfoService) ListResourcesByCrnServiceName ¶ added in v1.2.0
func (infoSvc *CloudInfoService) ListResourcesByCrnServiceName(crnServiceName string) ([]resourcecontrollerv2.ResourceInstance, error)
ListResourcesByCrnServiceName will retrieve all service instances of a provided type, for an account. This function will loop through ALL resources of type "service_instance" in the account and then filter by looking for the provided service type in the CRN.
func (*CloudInfoService) ListResourcesByGroupID ¶ added in v1.28.0
func (infoSvc *CloudInfoService) ListResourcesByGroupID(resourceGroupId string) ([]resourcecontrollerv2.ResourceInstance, error)
ListResourcesByGroupID will retrieve all service instances in a resource group.
func (*CloudInfoService) ListResourcesByGroupName ¶ added in v1.28.0
func (infoSvc *CloudInfoService) ListResourcesByGroupName(resourceGroupName string) ([]resourcecontrollerv2.ResourceInstance, error)
ListResourcesByGroupName will retrieve all service instances in a resource group.
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.
func (*CloudInfoService) LookupMemberNameByID ¶ added in v1.39.0
func (infoSvc *CloudInfoService) LookupMemberNameByID(stackDetails *project.ProjectConfig, memberID string) (string, error)
LookupMemberNameByID looks up the member name using the member ID from the stackDetails definition member list.
func (*CloudInfoService) RemoveRegionForTest ¶ added in v1.2.0
func (infoSvc *CloudInfoService) RemoveRegionForTest(regionID string)
RemoveRegionForTest is a method for receiver CloudInfoService that will remove a given region for use in test considerations by setting the UseForTest property for the region to false
func (*CloudInfoService) ReplaceCBRRule ¶ added in v1.22.0
func (infoSvc *CloudInfoService) ReplaceCBRRule(updatedExistingRule *contextbasedrestrictionsv1.Rule, eTag *string) (*contextbasedrestrictionsv1.Rule, *core.DetailedResponse, error)
ReplaceCBRRule replaces a CBR rule using the provided options. updatedExistingRule is the rule to be replaced with the changes already made. eTag is the eTag of the existing rule that is being replaced.
func (*CloudInfoService) SetCBREnforcementMode ¶ added in v1.22.0
func (infoSvc *CloudInfoService) SetCBREnforcementMode(ruleID string, mode string) error
SetCBREnforcementMode sets the enforcement mode of a rule using the Context-based Restrictions service
func (*CloudInfoService) SyncConfig ¶ added in v1.39.0
func (infoSvc *CloudInfoService) SyncConfig(projectID string, configID string) (response *core.DetailedResponse, err error)
SyncConfig syncs a project config with schematics
func (*CloudInfoService) UndeployConfig ¶ added in v1.34.0
func (infoSvc *CloudInfoService) UndeployConfig(details *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, err error)
UndeployConfig undeploys a project config
func (*CloudInfoService) UpdateConfig ¶ added in v1.31.0
func (infoSvc *CloudInfoService) UpdateConfig(configDetails *ConfigDetails, configuration project.ProjectConfigDefinitionPatchIntf) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
UpdateConfig updates a project config
func (*CloudInfoService) UpdateConfigWithHeaders ¶ added in v1.31.0
func (infoSvc *CloudInfoService) UpdateConfigWithHeaders(configDetails *ConfigDetails, configuration project.ProjectConfigDefinitionPatchIntf, headers map[string]string) (result *project.ProjectConfig, response *core.DetailedResponse, err error)
func (*CloudInfoService) UpdateStackFromConfig ¶ added in v1.31.0
func (infoSvc *CloudInfoService) UpdateStackFromConfig(stackConfig *ConfigDetails) (result *project.StackDefinition, response *core.DetailedResponse, err error)
func (*CloudInfoService) ValidateProjectConfig ¶ added in v1.34.0
func (infoSvc *CloudInfoService) ValidateProjectConfig(configDetails *ConfigDetails) (result *project.ProjectConfigVersion, response *core.DetailedResponse, err error)
type CloudInfoServiceI ¶ added in v1.4.0
type CloudInfoServiceI interface { GetLeastVpcTestRegion() (string, error) GetLeastVpcTestRegionWithoutActivityTracker() (string, error) GetLeastPowerConnectionZone() (string, error) LoadRegionPrefsFromFile(string) error HasRegionData() bool RemoveRegionForTest(string) ReplaceCBRRule(updatedExistingRule *contextbasedrestrictionsv1.Rule, eTag *string) (*contextbasedrestrictionsv1.Rule, *core.DetailedResponse, error) GetThreadLock() *sync.Mutex GetClusterIngressStatus(clusterId string) (string, error) GetCatalogVersionByLocator(string) (*catalogmanagementv1.Version, error) CreateProjectFromConfig(config *ProjectsConfig) (*projects.Project, *core.DetailedResponse, error) GetProject(projectID string) (*projects.Project, *core.DetailedResponse, error) GetProjectConfigs(projectID string) ([]projects.ProjectConfigSummary, error) GetConfig(configDetails *ConfigDetails) (result *projects.ProjectConfig, response *core.DetailedResponse, err error) DeleteProject(projectID string) (*projects.ProjectDeleteResponse, *core.DetailedResponse, error) CreateConfig(configDetails *ConfigDetails) (result *projects.ProjectConfig, response *core.DetailedResponse, err error) DeployConfig(configDetails *ConfigDetails) (result *projects.ProjectConfigVersion, response *core.DetailedResponse, err error) CreateDaConfig(configDetails *ConfigDetails) (result *projects.ProjectConfig, response *core.DetailedResponse, err error) CreateConfigFromCatalogJson(configDetails *ConfigDetails, catalogJson string) (result *projects.ProjectConfig, response *core.DetailedResponse, err error) UpdateConfig(configDetails *ConfigDetails, configuration projects.ProjectConfigDefinitionPatchIntf) (result *projects.ProjectConfig, response *core.DetailedResponse, err error) ValidateProjectConfig(configDetails *ConfigDetails) (result *projects.ProjectConfigVersion, response *core.DetailedResponse, err error) IsConfigDeployed(configDetails *ConfigDetails) (projectConfig *projects.ProjectConfigVersion, isDeployed bool) UndeployConfig(details *ConfigDetails) (result *projects.ProjectConfigVersion, response *core.DetailedResponse, err error) IsUndeploying(details *ConfigDetails) (projectConfig *projects.ProjectConfigVersion, isUndeploying bool) CreateStackFromConfigFile(stackConfig *ConfigDetails, stackConfigPath string, catalogJsonPath string) (result *projects.StackDefinition, response *core.DetailedResponse, err error) GetProjectConfigVersion(configDetails *ConfigDetails, version int64) (result *projects.ProjectConfigVersion, response *core.DetailedResponse, err error) GetStackMembers(stackConfig *ConfigDetails) ([]*projects.ProjectConfig, error) SyncConfig(projectID string, configID string) (response *core.DetailedResponse, err error) LookupMemberNameByID(stackDetails *projects.ProjectConfig, memberID string) (string, error) GetSchematicsJobLogs(jobID string, location string) (result *schematics.JobLog, response *core.DetailedResponse, err error) GetSchematicsJobLogsText(jobID string, location string) (logs string, err error) ArePipelineActionsRunning(stackConfig *ConfigDetails) (bool, error) GetSchematicsJobLogsForMember(member *projects.ProjectConfig, memberName string, projectRegion string) (string, string) GetSchematicsJobFileData(jobID string, fileType string, location string) (*schematics.JobFileData, error) GetSchematicsJobPlanJson(jobID string, location string) (string, error) GetSchematicsServiceByLocation(location string) (schematicsService, error) GetReclamationIdFromCRN(CRN string) (string, error) DeleteInstanceFromReclamationId(reclamationID string) error DeleteInstanceFromReclamationByCRN(CRN string) error }
interface for the cloudinfo service (can be mocked in tests)
type CloudInfoServiceOptions ¶
type CloudInfoServiceOptions struct { ApiKey string Authenticator *core.IamAuthenticator VpcService vpcService ResourceControllerService resourceControllerService ResourceManagerService resourceManagerService IamIdentityService iamIdentityService IamPolicyService iamPolicyService CbrService cbrService ContainerClient containerClient RegionPrefs []RegionData IcdService icdService ProjectsService projectsService CatalogService catalogService SchematicsServices map[string]schematicsService // StackDefinitionCreator is used to create stack definitions and only added to support testing/mocking StackDefinitionCreator StackDefinitionCreator }
CloudInfoServiceOptions structure used as input params for service constructor.
type ConfigDetails ¶ added in v1.39.0
type ConfigDetails struct { ProjectID string Name string Description string ConfigID string Authorizations *project.ProjectConfigAuth // Inputs used to override the default inputs Inputs map[string]interface{} // Settings used to override the default settings Settings map[string]interface{} // Stack specific StackLocatorID string StackDefinition *project.StackDefinitionBlockPrototype EnvironmentID *string Members []project.ProjectConfig // Member Config details used to override the default member inputs // Only need to set the name and inputs MemberConfigDetails []ConfigDetails MemberConfigs []project.StackConfigMember // CatalogProductName The name of the product in the catalog. Defaults to the first product in the catalog. CatalogProductName string // CatalogFlavorName The name of the flavor in the catalog. Defaults to the first flavor in the catalog. CatalogFlavorName string }
ConfigDetails Config details for a config or stack
type GetTestRegionOptions ¶ added in v1.2.0
type GetTestRegionOptions struct { // exclude a region if it contains an Activity Tracker ExcludeActivityTrackerRegions bool }
func NewGetTestRegionOptions ¶ added in v1.2.0
func NewGetTestRegionOptions() *GetTestRegionOptions
NewGetTestRegionOptions will return the option struct with defaults
type PowerCloudConnectionDetail ¶ added in v1.1.0
type PowerCloudConnectionDetail struct { *ibmpimodels.CloudConnection Zone *string }
extend the CloudConnection struct to add zone (region or datacenter)
type ProjectsConfig ¶ added in v1.39.0
type ProjectsConfig struct { ProjectID string `json:"project_id,omitempty"` Location string `json:"location,omitempty"` ProjectName string `json:"project_name,omitempty"` ProjectDescription string `json:"project_description,omitempty"` ResourceGroup string `json:"resource_group,omitempty"` DestroyOnDelete bool `json:"destroy_on_delete"` MonitoringEnabled bool `json:"monitoring_enabled"` AutoDeploy bool `json:"auto_deploy"` Configs []project.ProjectConfigPrototype `json:"configs,omitempty"` Environments []project.EnvironmentPrototype `json:"environments,omitempty"` Headers map[string]string `json:"headers,omitempty"` Store *project.ProjectDefinitionStore `json:"store,omitempty"` }
ProjectsConfig Config for creating a project
type RegionData ¶
type RegionData struct { Name string UseForTest bool `yaml:"useForTest"` TestPriority int `yaml:"testPriority"` Endpoint string Status string ResourceCount 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)
type Stack ¶ added in v1.31.0
type Stack struct { Inputs []struct { Name string `json:"name"` Description string `json:"description"` Required bool `json:"required"` Type string `json:"type"` Hidden bool `json:"hidden"` Default interface{} `json:"default"` } `json:"inputs"` Outputs []struct { Name string `json:"name"` Value string `json:"value"` } `json:"outputs"` Members []struct { Inputs []struct { Name string `json:"name"` Value interface{} `json:"value"` } `json:"inputs"` Name string `json:"name"` VersionLocator string `json:"version_locator"` } `json:"members"` }
type StackDefinitionCreator ¶ added in v1.40.0
type StackDefinitionCreator interface {
CreateStackDefinitionWrapper(options *projects.CreateStackDefinitionOptions, members []projects.ProjectConfig) (*projects.StackDefinition, *core.DetailedResponse, error)
}