// This file is auto-generated, don't edit it. Thanks.
package albb

import (
	"encoding/json"
	"fmt"
	openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
	openapiutil "github.com/alibabacloud-go/openapi-util/service"
	util "github.com/alibabacloud-go/tea-utils/v2/service"
	"github.com/alibabacloud-go/tea/tea"
	"time"
)


func RunInstances () (_err error) {
	fmt.Println("RunInstances New")
	client, _err := CreateClient()
	if _err != nil {
		return _err
	}

	params := &openapi.Params{
		// 接口名称
		Action: tea.String("RunInstances"),
		// 接口版本
		Version: tea.String("2014-05-26"),
		// 接口协议
		Protocol: tea.String("HTTPS"),
		// 接口 HTTP 方法
		Method: tea.String("POST"),
		AuthType: tea.String("AK"),
		Style: tea.String("RPC"),
		// 接口 PATH
		Pathname: tea.String("/"),
		// 接口请求体内容格式
		ReqBodyType: tea.String("json"),
		// 接口响应体内容格式
		BodyType: tea.String("json"),
	}
	// query params
	queries := map[string]interface{}{}
	queries["RegionId"] = tea.String("cn-hangzhou")
	// 获取当前时间
	now := time.Now()
	// 向后推移一个小时
	oneHourLater := now.Add(time.Minute * 58)
	//oneHourLater = oneHourLater.Add(-time.Hour * 8)
	println("AutoReleaseTime:",oneHourLater.Format("2006-01-02T15:04:05Z"))
	//queries["AutoReleaseTime"] = tea.String("2025-02-19T21:05:00Z")
	queries["AutoReleaseTime"] = tea.String(oneHourLater.Format(time.RFC3339) )
	//queries["LaunchTemplateId"] = tea.String("lt-bp17ecmtdol5eq0skeff")
	queries["LaunchTemplateName"] = tea.String("ecs-verify")
	queries["LaunchTemplateVersion"] = tea.Int(1)
	// runtime options
	runtime := &util.RuntimeOptions{}
	request := &openapi.OpenApiRequest{
		Query: openapiutil.Query(queries),
	}

	// 复制代码运行请自行打印 API 的返回值
	// 返回值实际为 Map 类型，可从 Map 中获得三类数据：响应体 body、响应头 headers、HTTP 返回的状态码 statusCode。
	_result, _err := client.CallApi(params, request, runtime)
	if _err != nil {
		return _err
	}
	data, _ := json.Marshal(_result)
	fmt.Println(string(data))
	return _err
}

