Documentation
¶
Index ¶
- func BatchDescribeInstanceStatuses(ctx context.Context, region string, instanceIds []string) (map[string]string, error)
- func BatchStartInstances(ctx context.Context, region string, instanceIds []string) (map[string]string, error)
- func BatchStopInstances(ctx context.Context, region string, instanceIds []string) (map[string]string, error)
- func BatchTerminateInstances(ctx context.Context, region string, instanceIds []string) (map[string]string, error)
- func BatchUpsertTags(ctx context.Context, region, zone, cspResourceId, resourceType string, ...) error
- func FetchAllNodePrices(ctx context.Context) (map[string]model.SpiderCloudPrice, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchDescribeInstanceStatuses ¶ added in v0.12.9
func BatchDescribeInstanceStatuses(ctx context.Context, region string, instanceIds []string) (map[string]string, error)
BatchDescribeInstanceStatuses queries EC2 DescribeInstances for the given AWS instance IDs (e.g. "i-0abc123def456") and returns a map of instanceId → TB status string.
Requests are batched in groups of 200 and fired sequentially within one call. The EC2 client reuses a pooled HTTP transport (no SetCloseConnection), so repeated calls across goroutines share keep-alive connections to AWS.
Instance IDs not found in AWS are omitted from the returned map; callers should treat a missing key as model.StatusUndefined.
func BatchStartInstances ¶ added in v0.12.9
func BatchStartInstances(ctx context.Context, region string, instanceIds []string) (map[string]string, error)
BatchStartInstances issues StartInstances for the given instance IDs and returns a map of instanceId → model.StatusResuming for each accepted instance.
func BatchStopInstances ¶ added in v0.12.9
func BatchStopInstances(ctx context.Context, region string, instanceIds []string) (map[string]string, error)
BatchStopInstances issues StopInstances for the given instance IDs and returns a map of instanceId → model.StatusSuspending for each accepted instance.
func BatchTerminateInstances ¶ added in v0.12.9
func BatchTerminateInstances(ctx context.Context, region string, instanceIds []string) (map[string]string, error)
BatchTerminateInstances issues TerminateInstances for the given instance IDs and returns a map of instanceId → model.StatusTerminating for each accepted instance.
func BatchUpsertTags ¶
func BatchUpsertTags(ctx context.Context, region, zone, cspResourceId, resourceType string, tags map[string]string) error
BatchUpsertTags sets multiple tags on an AWS EC2 resource in a single CreateTags call. Only resource types in ec2TaggableTypes are handled; others fall back to CB-Spider. For sshKey, cspResourceId is the key pair name; it is resolved to key-xxx before tagging.
func FetchAllNodePrices ¶
FetchAllNodePrices fetches EC2 Linux OnDemand pricing for ALL AWS regions in a single paginated query to the AWS Pricing API (no regionCode filter), then groups results by region code. This eliminates the N-Spider-calls overhead of the legacy per-region path.
Only one call chain is made regardless of how many AWS regions are configured in CB-TB. Returns map[regionCode] → SpiderCloudPrice, compatible with the existing BulkUpdateSpec path.
Types ¶
This section is empty.