日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

快速入門

本節(jié)介紹如何快速使用OOS Go SDK完成常見操作,如創(chuàng)建模板、啟動執(zhí)行、查詢執(zhí)行等。

創(chuàng)建模板

以下代碼用于創(chuàng)建模板:

package main

import (
	"fmt"
	
	"os"
    "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
    "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
	oos "github.com/aliyun/alibaba-cloud-sdk-go/services/oos"
  
)

func main() {
	config := sdk.NewConfig()
	/*
  阿里云賬號AccessKey擁有所有API的訪問權(quán)限,建議您使用RAM用戶進(jìn)行API訪問或日常運維。
  強(qiáng)烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導(dǎo)致AccessKey泄露,威脅您賬號下所有資源的安全。
  本示例使用了阿里云Credentials工具托管AccessKey,來實現(xiàn)API訪問的身份驗證。
  具體配置操作(或者配置環(huán)境變量),請參見http://bestwisewords.com/document_detail/378661.html。
	*/
	// Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
	credential := credentials.NewAccessKeyCredential(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"))
	/* use STS Token 
	credential := credentials.NewStsTokenCredential(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), os.Getenv("ALIBABA_CLOUD_SECURITY_TOKEN"))
	*/
    client, err := oos.NewClientWithOptions("cn-hangzhou", config, credential)
	if err != nil {
		panic(err)
	}

	request := oos.CreateCreateTemplateRequest()

	request.Scheme = "https"

	request.TemplateName = "MyTemplate"
	request.Content = "{\n  \\\"FormatVersion\\\": \\\"OOS-2019-06-01\\\",\n  \\\"Description\\\": \\\"Describe instances of given status\\\",\n  \\\"Parameters\\\": {\n    \\\"Status\\\": {\n      \\\"Type\\\": \\\"String\\\",\n      \\\"Description\\\": \\\"(Required) The status of the Ecs instance.\\\"\n    }\n  },\n  \\\"Tasks\\\": [\n    {\n      \\\"Properties\\\": {\n        \\\"Parameters\\\": { \\\"Status\\\": \\\"{{ Status }}\\\" },\n        \\\"API\\\": \\\"DescribeInstances\\\",\n        \\\"Service\\\": \\\"ECS\\\"\n      },\n      \\\"Name\\\": \\\"describeInstances\\\",\n      \\\"Action\\\": \\\"ACS::ExecuteAPI\\\"\n    }\n  ]\n}"


	response, err := client.CreateTemplate(request)
	if err != nil {
		fmt.Print(err.Error())
	}
	fmt.Printf("response is %#v\n", response)
}

啟動執(zhí)行

以下代碼用于啟動執(zhí)行:

package main

import (
	"fmt"
	
	"os"
    "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
    "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
	oos "github.com/aliyun/alibaba-cloud-sdk-go/services/oos"
  
)

func main() {
	config := sdk.NewConfig()
	/*
  阿里云賬號AccessKey擁有所有API的訪問權(quán)限,建議您使用RAM用戶進(jìn)行API訪問或日常運維。
  強(qiáng)烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導(dǎo)致AccessKey泄露,威脅您賬號下所有資源的安全。
  本示例使用了阿里云Credentials工具托管AccessKey,來實現(xiàn)API訪問的身份驗證。
  具體配置操作(或者配置環(huán)境變量),請參見http://bestwisewords.com/document_detail/378661.html。
	*/
	// Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
	credential := credentials.NewAccessKeyCredential(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"))
	/* use STS Token 
	credential := credentials.NewStsTokenCredential(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), os.Getenv("ALIBABA_CLOUD_SECURITY_TOKEN"))
	*/
    client, err := oos.NewClientWithOptions("cn-hangzhou", config, credential)
	if err != nil {
		panic(err)
	}

	request := oos.CreateStartExecutionRequest()

	request.Scheme = "https"

	request.TemplateName = "MyTemplate"


	response, err := client.StartExecution(request)
	if err != nil {
		fmt.Print(err.Error())
	}
	fmt.Printf("response is %#v\n", response)
}

查詢執(zhí)行

以下代碼用于查詢執(zhí)行:

package main

import (
	"fmt"
	
	"os"
    "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
    "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
	oos "github.com/aliyun/alibaba-cloud-sdk-go/services/oos"
  
)

func main() {
	config := sdk.NewConfig()
	/*
  阿里云賬號AccessKey擁有所有API的訪問權(quán)限,建議您使用RAM用戶進(jìn)行API訪問或日常運維。
  強(qiáng)烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導(dǎo)致AccessKey泄露,威脅您賬號下所有資源的安全。
  本示例使用了阿里云Credentials工具托管AccessKey,來實現(xiàn)API訪問的身份驗證。
  具體配置操作(或者配置環(huán)境變量),請參見http://bestwisewords.com/document_detail/378661.html。
	*/
	// Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
	credential := credentials.NewAccessKeyCredential(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"))
	/* use STS Token 
	credential := credentials.NewStsTokenCredential(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), os.Getenv("ALIBABA_CLOUD_SECURITY_TOKEN"))
	*/
    client, err := oos.NewClientWithOptions("cn-hangzhou", config, credential)
	if err != nil {
		panic(err)
	}

	request := oos.CreateListExecutionsRequest()

	request.Scheme = "https"

	request.ExecutionId = "<ExecutionId>"


	response, err := client.ListExecutions(request)
	if err != nil {
		fmt.Print(err.Error())
	}
	fmt.Printf("response is %#v\n", response)
}