Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no "DescribeScalingActivities" interface in ess sdk? #381

Open
halegreen opened this issue Apr 20, 2020 · 1 comment
Open

no "DescribeScalingActivities" interface in ess sdk? #381

halegreen opened this issue Apr 20, 2020 · 1 comment

Comments

@halegreen
Copy link

No description provided.

@ljluestc
Copy link

package main

import (
	"fmt"
	"log"

	"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
	"github.com/aliyun/alibaba-cloud-sdk-go/services/ess"
)

func main() {
	// Create an SDK client
	client, err := sdk.NewClientWithAccessKey("cn-hangzhou", "your-access-key-id", "your-access-key-secret")
	if err != nil {
		log.Fatalf("Create client failed: %v", err)
	}

	// Create ESS client
	essClient := ess.NewClient(client)

	// Describe Scaling Activities
	request := ess.CreateDescribeScalingActivitiesRequest()
	request.ScalingGroupId = "your-scaling-group-id" // replace with your actual Scaling Group ID

	// Optional: Add filters (optional parameters like activity statuses or start/end time)
	request.ActivityIds = "activity-id1,activity-id2" // comma-separated activity IDs if needed

	// Send the request
	response, err := essClient.DescribeScalingActivities(request)
	if err != nil {
		log.Fatalf("Error describing scaling activities: %v", err)
	}

	// Process the response
	for _, activity := range response.ScalingActivities.ScalingActivity {
		fmt.Printf("Activity ID: %s, Status: %s, CreateTime: %s\n", activity.ScalingActivityId, activity.Status, activity.CreationTime)
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants