Add Alibaba Cloud ECI SDK
Alibaba Cloud ECI(Elastic Container Instance) is a service that allow you run containers without having to manage servers or clusters. This commit add ECI sdk for virtual kubelet. Signed-off-by: xianwei.zw <xianwei.zw@alibaba-inc.com> Signed-off-by: shidao.ytt <shidao.ytt@alibaba-inc.com>
This commit is contained in:
81
providers/alicloud/eci/client.go
Normal file
81
providers/alicloud/eci/client.go
Normal file
@@ -0,0 +1,81 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
|
||||
)
|
||||
|
||||
// Client is the sdk client struct, each func corresponds to an OpenAPI
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
// NewClient creates a sdk client with environment variables
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.Init()
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential
|
||||
// this is the common api to create a sdk client
|
||||
func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithOptions(regionId, config, credential)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithAccessKey is a shortcut to create sdk client with accesskey
|
||||
// usage: https://help.aliyun.com/document_detail/66217.html
|
||||
func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithStsToken is a shortcut to create sdk client with sts token
|
||||
// usage: https://help.aliyun.com/document_detail/66222.html
|
||||
func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn
|
||||
// usage: https://help.aliyun.com/document_detail/66222.html
|
||||
func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role
|
||||
// usage: https://help.aliyun.com/document_detail/66223.html
|
||||
func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithEcsRamRole(regionId, roleName)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair
|
||||
// attention: rsa key pair auth is only Japan regions available
|
||||
func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)
|
||||
return
|
||||
}
|
||||
137
providers/alicloud/eci/create_container_group.go
Normal file
137
providers/alicloud/eci/create_container_group.go
Normal file
@@ -0,0 +1,137 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// CreateContainerGroup invokes the eci.CreateContainerGroup API synchronously
|
||||
// api document: https://help.aliyun.com/api/eci/createcontainergroup.html
|
||||
func (client *Client) CreateContainerGroup(request *CreateContainerGroupRequest) (response *CreateContainerGroupResponse, err error) {
|
||||
response = CreateCreateContainerGroupResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// CreateContainerGroupRequest is the request struct for api CreateContainerGroup
|
||||
type CreateContainerGroupRequest struct {
|
||||
*requests.RpcRequest
|
||||
Containers []CreateContainer `position:"Query" name:"Container" type:"Repeated"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
||||
ImageRegistryCredentials []ImageRegistryCredential `position:"Query" name:"ImageRegistryCredential" type:"Repeated"`
|
||||
Tags []Tag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
RestartPolicy string `position:"Query" name:"RestartPolicy"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
Volumes []Volume `position:"Query" name:"Volume" type:"Repeated"`
|
||||
ContainerGroupName string `position:"Query" name:"ContainerGroupName"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
}
|
||||
|
||||
type CreateContainer struct {
|
||||
Name string `position:"Query" name:"Name"`
|
||||
Image string `position:"Query" name:"Image"`
|
||||
Memory requests.Float `position:"Query" name:"Memory"`
|
||||
Cpu requests.Float `position:"Query" name:"Cpu"`
|
||||
WorkingDir string `position:"Query" name:"WorkingDir"`
|
||||
ImagePullPolicy string `position:"Query" name:"ImagePullPolicy"`
|
||||
Commands []string `position:"Query" name:"Command" type:"Repeated"`
|
||||
Args []string `position:"Query" name:"Arg" type:"Repeated"`
|
||||
VolumeMounts []VolumeMount `position:"Query" name:"VolumeMount" type:"Repeated"`
|
||||
Ports []ContainerPort `position:"Query" name:"Port" type:"Repeated"`
|
||||
EnvironmentVars []EnvironmentVar `position:"Query" name:"EnvironmentVar" type:"Repeated"`
|
||||
}
|
||||
|
||||
// CreateContainerGroupImageRegistryCredential is a repeated param struct in CreateContainerGroupRequest
|
||||
type ImageRegistryCredential struct {
|
||||
Server string `name:"Server"`
|
||||
UserName string `name:"UserName"`
|
||||
Password string `name:"Password"`
|
||||
}
|
||||
|
||||
// CreateContainerGroupResponse is the response struct for api CreateContainerGroup
|
||||
type CreateContainerGroupResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
ContainerGroupId string `json:"ContainerGroupId" xml:"ContainerGroupId"`
|
||||
}
|
||||
|
||||
// CreateCreateContainerGroupRequest creates a request to invoke CreateContainerGroup API
|
||||
func CreateCreateContainerGroupRequest() (request *CreateContainerGroupRequest) {
|
||||
request = &CreateContainerGroupRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Eci", "2018-08-08", "CreateContainerGroup", "eci", "openAPI")
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCreateContainerGroupResponse creates a response to parse from CreateContainerGroup response
|
||||
func CreateCreateContainerGroupResponse() (response *CreateContainerGroupResponse) {
|
||||
response = &CreateContainerGroupResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
107
providers/alicloud/eci/delete_container_group.go
Normal file
107
providers/alicloud/eci/delete_container_group.go
Normal file
@@ -0,0 +1,107 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// DeleteContainerGroup invokes the eci.DeleteContainerGroup API synchronously
|
||||
// api document: https://help.aliyun.com/api/eci/deletecontainergroup.html
|
||||
func (client *Client) DeleteContainerGroup(request *DeleteContainerGroupRequest) (response *DeleteContainerGroupResponse, err error) {
|
||||
response = CreateDeleteContainerGroupResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteContainerGroupWithChan invokes the eci.DeleteContainerGroup API asynchronously
|
||||
// api document: https://help.aliyun.com/api/eci/deletecontainergroup.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) DeleteContainerGroupWithChan(request *DeleteContainerGroupRequest) (<-chan *DeleteContainerGroupResponse, <-chan error) {
|
||||
responseChan := make(chan *DeleteContainerGroupResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.DeleteContainerGroup(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// DeleteContainerGroupWithCallback invokes the eci.DeleteContainerGroup API asynchronously
|
||||
// api document: https://help.aliyun.com/api/eci/deletecontainergroup.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) DeleteContainerGroupWithCallback(request *DeleteContainerGroupRequest, callback func(response *DeleteContainerGroupResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *DeleteContainerGroupResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.DeleteContainerGroup(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// DeleteContainerGroupRequest is the request struct for api DeleteContainerGroup
|
||||
type DeleteContainerGroupRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ContainerGroupId string `position:"Query" name:"ContainerGroupId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
}
|
||||
|
||||
// DeleteContainerGroupResponse is the response struct for api DeleteContainerGroup
|
||||
type DeleteContainerGroupResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
}
|
||||
|
||||
// CreateDeleteContainerGroupRequest creates a request to invoke DeleteContainerGroup API
|
||||
func CreateDeleteContainerGroupRequest() (request *DeleteContainerGroupRequest) {
|
||||
request = &DeleteContainerGroupRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Eci", "2018-08-08", "DeleteContainerGroup", "eci", "openAPI")
|
||||
return
|
||||
}
|
||||
|
||||
// CreateDeleteContainerGroupResponse creates a response to parse from DeleteContainerGroup response
|
||||
func CreateDeleteContainerGroupResponse() (response *DeleteContainerGroupResponse) {
|
||||
response = &DeleteContainerGroupResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
122
providers/alicloud/eci/describe_container_groups.go
Normal file
122
providers/alicloud/eci/describe_container_groups.go
Normal file
@@ -0,0 +1,122 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// DescribeContainerGroups invokes the eci.DescribeContainerGroups API synchronously
|
||||
// api document: https://help.aliyun.com/api/eci/describecontainergroups.html
|
||||
func (client *Client) DescribeContainerGroups(request *DescribeContainerGroupsRequest) (response *DescribeContainerGroupsResponse, err error) {
|
||||
response = CreateDescribeContainerGroupsResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// DescribeContainerGroupsWithChan invokes the eci.DescribeContainerGroups API asynchronously
|
||||
// api document: https://help.aliyun.com/api/eci/describecontainergroups.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) DescribeContainerGroupsWithChan(request *DescribeContainerGroupsRequest) (<-chan *DescribeContainerGroupsResponse, <-chan error) {
|
||||
responseChan := make(chan *DescribeContainerGroupsResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.DescribeContainerGroups(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// DescribeContainerGroupsWithCallback invokes the eci.DescribeContainerGroups API asynchronously
|
||||
// api document: https://help.aliyun.com/api/eci/describecontainergroups.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) DescribeContainerGroupsWithCallback(request *DescribeContainerGroupsRequest, callback func(response *DescribeContainerGroupsResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *DescribeContainerGroupsResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.DescribeContainerGroups(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// DescribeContainerGroupsRequest is the request struct for api DescribeContainerGroups
|
||||
type DescribeContainerGroupsRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
NextToken string `position:"Query" name:"NextToken"`
|
||||
Limit requests.Integer `position:"Query" name:"Limit"`
|
||||
Tags *[]DescribeContainerGroupsTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
ContainerGroupId string `position:"Query" name:"ContainerGroupId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
ContainerGroupName string `position:"Query" name:"ContainerGroupName"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
}
|
||||
|
||||
// DescribeContainerGroupsTag is a repeated param struct in DescribeContainerGroupsRequest
|
||||
type DescribeContainerGroupsTag struct {
|
||||
Key string `name:"Key"`
|
||||
Value string `name:"Value"`
|
||||
}
|
||||
|
||||
// DescribeContainerGroupsResponse is the response struct for api DescribeContainerGroups
|
||||
type DescribeContainerGroupsResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
NextToken string `json:"NextToken" xml:"NextToken"`
|
||||
TotalCount int `json:"TotalCount" xml:"TotalCount"`
|
||||
ContainerGroups []ContainerGroup `json:"ContainerGroups" xml:"ContainerGroups"`
|
||||
}
|
||||
|
||||
// CreateDescribeContainerGroupsRequest creates a request to invoke DescribeContainerGroups API
|
||||
func CreateDescribeContainerGroupsRequest() (request *DescribeContainerGroupsRequest) {
|
||||
request = &DescribeContainerGroupsRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Eci", "2018-08-08", "DescribeContainerGroups", "eci", "openAPI")
|
||||
return
|
||||
}
|
||||
|
||||
// CreateDescribeContainerGroupsResponse creates a response to parse from DescribeContainerGroups response
|
||||
func CreateDescribeContainerGroupsResponse() (response *DescribeContainerGroupsResponse) {
|
||||
response = &DescribeContainerGroupsResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
112
providers/alicloud/eci/describe_container_log.go
Normal file
112
providers/alicloud/eci/describe_container_log.go
Normal file
@@ -0,0 +1,112 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// DescribeContainerLog invokes the eci.DescribeContainerLog API synchronously
|
||||
// api document: https://help.aliyun.com/api/eci/describecontainerlog.html
|
||||
func (client *Client) DescribeContainerLog(request *DescribeContainerLogRequest) (response *DescribeContainerLogResponse, err error) {
|
||||
response = CreateDescribeContainerLogResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// DescribeContainerLogWithChan invokes the eci.DescribeContainerLog API asynchronously
|
||||
// api document: https://help.aliyun.com/api/eci/describecontainerlog.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) DescribeContainerLogWithChan(request *DescribeContainerLogRequest) (<-chan *DescribeContainerLogResponse, <-chan error) {
|
||||
responseChan := make(chan *DescribeContainerLogResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.DescribeContainerLog(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// DescribeContainerLogWithCallback invokes the eci.DescribeContainerLog API asynchronously
|
||||
// api document: https://help.aliyun.com/api/eci/describecontainerlog.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) DescribeContainerLogWithCallback(request *DescribeContainerLogRequest, callback func(response *DescribeContainerLogResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *DescribeContainerLogResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.DescribeContainerLog(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// DescribeContainerLogRequest is the request struct for api DescribeContainerLog
|
||||
type DescribeContainerLogRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ContainerName string `position:"Query" name:"ContainerName"`
|
||||
StartTime string `position:"Query" name:"StartTime"`
|
||||
ContainerGroupId string `position:"Query" name:"ContainerGroupId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
Tail requests.Integer `position:"Query" name:"Tail"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
}
|
||||
|
||||
// DescribeContainerLogResponse is the response struct for api DescribeContainerLog
|
||||
type DescribeContainerLogResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
ContainerName string `json:"ContainerName" xml:"ContainerName"`
|
||||
Content string `json:"Content" xml:"Content"`
|
||||
}
|
||||
|
||||
// CreateDescribeContainerLogRequest creates a request to invoke DescribeContainerLog API
|
||||
func CreateDescribeContainerLogRequest() (request *DescribeContainerLogRequest) {
|
||||
request = &DescribeContainerLogRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Eci", "2018-08-08", "DescribeContainerLog", "eci", "openAPI")
|
||||
return
|
||||
}
|
||||
|
||||
// CreateDescribeContainerLogResponse creates a response to parse from DescribeContainerLog response
|
||||
func CreateDescribeContainerLogResponse() (response *DescribeContainerLogResponse) {
|
||||
response = &DescribeContainerLogResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
22
providers/alicloud/eci/struct_config_file_to_path.go
Normal file
22
providers/alicloud/eci/struct_config_file_to_path.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// ConfigFileVolumeConfigFileToPath is a nested struct in eci response
|
||||
type ConfigFileToPath struct {
|
||||
Content string `json:"Content" xml:"Content" position:"Query" name:"Content"`
|
||||
Path string `json:"Path" xml:"Path" position:"Query" name:"Path"`
|
||||
}
|
||||
34
providers/alicloud/eci/struct_container.go
Normal file
34
providers/alicloud/eci/struct_container.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// Container is a nested struct in eci response
|
||||
type Container struct {
|
||||
Name string `json:"Name" xml:"Name" position:"Query" name:"Name"`
|
||||
Image string `json:"Image" xml:"Image" position:"Query" name:"Image"`
|
||||
Memory float64 `json:"Memory" xml:"Memory" position:"Query" name:"Memory"`
|
||||
Cpu float64 `json:"Cpu" xml:"Cpu" position:"Query" name:"Cpu" `
|
||||
RestartCount int `json:"RestartCount" xml:"RestartCount"`
|
||||
WorkingDir string `json:"WorkingDir" xml:"WorkingDir" position:"Query" name:"WorkingDir"`
|
||||
ImagePullPolicy string `json:"ImagePullPolicy" xml:"ImagePullPolicy" position:"Query" name:"ImagePullPolicy"`
|
||||
Commands []string `json:"Commands" xml:"Commands" position:"Query" name:"Command" type:"Repeated"`
|
||||
Args []string `json:"Args" xml:"Args" position:"Query" name:"Arg" type:"Repeated"`
|
||||
PreviousState ContainerState `json:"PreviousState" xml:"PreviousState"`
|
||||
CurrentState ContainerState `json:"CurrentState" xml:"CurrentState"`
|
||||
VolumeMounts []VolumeMount `json:"VolumeMounts" xml:"VolumeMounts" position:"Query" name:"VolumeMount" type:"Repeated"`
|
||||
Ports []ContainerPort `json:"Ports" xml:"Ports" position:"Query" name:"Port" type:"Repeated"`
|
||||
EnvironmentVars []EnvironmentVar `json:"EnvironmentVars" xml:"EnvironmentVars" position:"Query" name:"EnvironmentVar" type:"Repeated"`
|
||||
}
|
||||
38
providers/alicloud/eci/struct_container_group.go
Normal file
38
providers/alicloud/eci/struct_container_group.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// ContainerGroup is a nested struct in eci response
|
||||
type ContainerGroup struct {
|
||||
ContainerGroupId string `json:"ContainerGroupId" xml:"ContainerGroupId"`
|
||||
ContainerGroupName string `json:"ContainerGroupName" xml:"ContainerGroupName"`
|
||||
RegionId string `json:"RegionId" xml:"RegionId"`
|
||||
ZoneId string `json:"ZoneId" xml:"ZoneId"`
|
||||
Memory float64 `json:"Memory" xml:"Memory"`
|
||||
Cpu float64 `json:"Cpu" xml:"Cpu"`
|
||||
VSwitchId string `json:"VSwitchId" xml:"VSwitchId"`
|
||||
SecurityGroupId string `json:"SecurityGroupId" xml:"SecurityGroupId"`
|
||||
RestartPolicy string `json:"RestartPolicy" xml:"RestartPolicy"`
|
||||
IntranetIp string `json:"IntranetIp" xml:"IntranetIp"`
|
||||
Status string `json:"Status" xml:"Status"`
|
||||
InternetIp string `json:"InternetIp" xml:"InternetIp"`
|
||||
CreationTime string `json:"CreationTime" xml:"CreationTime"`
|
||||
SucceededTime string `json:"SucceededTime" xml:"SucceededTime"`
|
||||
Tags []Tag `json:"Tags" xml:"Tags"`
|
||||
Events []Event `json:"Events" xml:"Events"`
|
||||
Containers []Container `json:"Containers" xml:"Containers"`
|
||||
Volumes []Volume `json:"Volumes" xml:"Volumes"`
|
||||
}
|
||||
26
providers/alicloud/eci/struct_container_port.go
Normal file
26
providers/alicloud/eci/struct_container_port.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package eci
|
||||
|
||||
import (
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
)
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// ContainerPort is a nested struct in eci response
|
||||
type ContainerPort struct {
|
||||
Port requests.Integer `json:"Port" xml:"Port" position:"Query" name:"Port"`
|
||||
Protocol string `json:"Protocol" xml:"Protocol" position:"Query" name:"Protocol"`
|
||||
}
|
||||
25
providers/alicloud/eci/struct_container_state.go
Normal file
25
providers/alicloud/eci/struct_container_state.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// CurrentState is a nested struct in eci response
|
||||
type ContainerState struct {
|
||||
State string `json:"State" xml:"State"`
|
||||
DetailStatus string `json:"DetailStatus" xml:"DetailStatus"`
|
||||
ExitCode int `json:"ExitCode" xml:"ExitCode"`
|
||||
StartTime string `json:"StartTime" xml:"StartTime"`
|
||||
FinishTime string `json:"FinishTime" xml:"FinishTime"`
|
||||
}
|
||||
22
providers/alicloud/eci/struct_environment_var.go
Normal file
22
providers/alicloud/eci/struct_environment_var.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// EnvironmentVar is a nested struct in eci response
|
||||
type EnvironmentVar struct {
|
||||
Key string `json:"Key" xml:"Key" position:"Query" name:"Key"`
|
||||
Value string `json:"Value" xml:"Value" position:"Query" name:"Value"`
|
||||
}
|
||||
26
providers/alicloud/eci/struct_event.go
Normal file
26
providers/alicloud/eci/struct_event.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// Event is a nested struct in eci response
|
||||
type Event struct {
|
||||
Count int `json:"Count" xml:"Count"`
|
||||
Type string `json:"Type" xml:"Type"`
|
||||
Name string `json:"Name" xml:"Name"`
|
||||
Message string `json:"Message" xml:"Message"`
|
||||
FirstTimestamp string `json:"FirstTimestamp" xml:"FirstTimestamp"`
|
||||
LastTimestamp string `json:"LastTimestamp" xml:"LastTimestamp"`
|
||||
}
|
||||
22
providers/alicloud/eci/struct_tag.go
Normal file
22
providers/alicloud/eci/struct_tag.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package eci
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// Label is a nested struct in eci response
|
||||
type Tag struct {
|
||||
Key string `json:"Key" xml:"Key" position:"Query" name:"Key"`
|
||||
Value string `json:"Value" xml:"Value" position:"Query" name:"Value"`
|
||||
}
|
||||
35
providers/alicloud/eci/struct_volume.go
Normal file
35
providers/alicloud/eci/struct_volume.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package eci
|
||||
|
||||
import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// Volume is a nested struct in eci response
|
||||
const (
|
||||
VOL_TYPE_NFS = "NFSVolume"
|
||||
VOL_TYPE_EMPTYDIR = "EmptyDirVolume"
|
||||
VOL_TYPE_CONFIGFILEVOLUME = "ConfigFileVolume"
|
||||
)
|
||||
|
||||
type Volume struct {
|
||||
Type string `json:"Type" xml:"Type" position:"Query" name:"Type"`
|
||||
Name string `json:"Name" xml:"Name" position:"Query" name:"Name"`
|
||||
NfsVolumePath string `json:"NfsVolumePath" xml:"NfsVolumePath" position:"Query" name:"NFSVolume.Path"`
|
||||
NfsVolumeServer string `json:"NfsVolumeServer" xml:"NfsVolumeServer" position:"Query" name:"NFSVolume.Server"`
|
||||
NfsVolumeReadOnly requests.Boolean `json:"NfsVolumeReadOnly" xml:"NfsVolumeReadOnly" position:"Query" name:"NFSVolume.ReadOnly"`
|
||||
EmptyDirVolumeEnable requests.Boolean `json:"EmptyDirVolumeEnable" xml:"EmptyDirVolumeEnable" position:"Query" name:"EmptyDirVolume.Enable"`
|
||||
ConfigFileVolumeConfigFileToPaths []ConfigFileToPath `json:"ConfigFileVolumeConfigFileToPaths" xml:"ConfigFileVolume" position:"Query" name:"ConfigFileVolume.ConfigFileToPath" type:"Repeated"`
|
||||
}
|
||||
25
providers/alicloud/eci/struct_volume_mount.go
Normal file
25
providers/alicloud/eci/struct_volume_mount.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package eci
|
||||
|
||||
import "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//
|
||||
// Code generated by Alibaba Cloud SDK Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// VolumeMount is a nested struct in eci response
|
||||
type VolumeMount struct {
|
||||
MountPath string `json:"MountPath" xml:"MountPath" position:"Query" name:"MountPath"`
|
||||
ReadOnly requests.Boolean `json:"ReadOnly" xml:"ReadOnly" position:"Query" name:"ReadOnly"`
|
||||
Name string `json:"Name" xml:"Name" position:"Query" name:"Name"`
|
||||
}
|
||||
Reference in New Issue
Block a user