Closed sgkokocool1 closed 5 months ago
v1版本"github.com/aliyun/alibaba-cloud-sdk-go/services/eci // CreateContainerGroupWithChan invokes the eci.CreateContainerGroup API asynchronously // api document: https://help.aliyun.com/api/eci/createcontainergroup.html // asynchronous document: https://help.aliyun.com/document_detail/66220.html func (client Client) CreateContainerGroupWithChan(request CreateContainerGroupRequest) (<-chan CreateContainerGroupResponse, <-chan error) { responseChan := make(chan CreateContainerGroupResponse, 1) errChan := make(chan error, 1) err := client.AddAsyncTask(func() { defer close(responseChan) defer close(errChan) response, err := client.CreateContainerGroup(request) if err != nil { errChan <- err } else { responseChan <- response } }) if err != nil { errChan <- err close(responseChan) close(errChan) } return responseChan, errChan }
// CreateContainerGroupWithCallback invokes the eci.CreateContainerGroup API asynchronously // api document: https://help.aliyun.com/api/eci/createcontainergroup.html // asynchronous document: https://help.aliyun.com/document_detail/66220.html func (client Client) CreateContainerGroupWithCallback(request CreateContainerGroupRequest, callback func(response CreateContainerGroupResponse, err error)) <-chan int { result := make(chan int, 1) err := client.AddAsyncTask(func() { var response CreateContainerGroupResponse var err error defer close(result) response, err = client.CreateContainerGroup(request) callback(response, err) result <- 1 }) if err != nil { defer close(result) callback(nil, err) result <- 0 } return result }
eci目前不可使用这一版的SDK,请参考产品文档自行选择SDK。 https://help.aliyun.com/document_detail/91328.html
v1版本"github.com/aliyun/alibaba-cloud-sdk-go/services/eci // CreateContainerGroupWithChan invokes the eci.CreateContainerGroup API asynchronously // api document: https://help.aliyun.com/api/eci/createcontainergroup.html // asynchronous document: https://help.aliyun.com/document_detail/66220.html func (client Client) CreateContainerGroupWithChan(request CreateContainerGroupRequest) (<-chan CreateContainerGroupResponse, <-chan error) { responseChan := make(chan CreateContainerGroupResponse, 1) errChan := make(chan error, 1) err := client.AddAsyncTask(func() { defer close(responseChan) defer close(errChan) response, err := client.CreateContainerGroup(request) if err != nil { errChan <- err } else { responseChan <- response } }) if err != nil { errChan <- err close(responseChan) close(errChan) } return responseChan, errChan }
// CreateContainerGroupWithCallback invokes the eci.CreateContainerGroup API asynchronously // api document: https://help.aliyun.com/api/eci/createcontainergroup.html // asynchronous document: https://help.aliyun.com/document_detail/66220.html func (client Client) CreateContainerGroupWithCallback(request CreateContainerGroupRequest, callback func(response CreateContainerGroupResponse, err error)) <-chan int { result := make(chan int, 1) err := client.AddAsyncTask(func() { var response CreateContainerGroupResponse var err error defer close(result) response, err = client.CreateContainerGroup(request) callback(response, err) result <- 1 }) if err != nil { defer close(result) callback(nil, err) result <- 0 } return result }