create_container_group.go 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. //Licensed under the Apache License, Version 2.0 (the "License");
  2. //you may not use this file except in compliance with the License.
  3. //You may obtain a copy of the License at
  4. //
  5. //http://www.apache.org/licenses/LICENSE-2.0
  6. //
  7. //Unless required by applicable law or agreed to in writing, software
  8. //distributed under the License is distributed on an "AS IS" BASIS,
  9. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. //See the License for the specific language governing permissions and
  11. //limitations under the License.
  12. //
  13. // Code generated by Alibaba Cloud SDK Code Generator.
  14. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  15. package eci
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. // CreateContainerGroup invokes the eci.CreateContainerGroup API synchronously
  21. // api document: https://help.aliyun.com/api/eci/createcontainergroup.html
  22. func (client *Client) CreateContainerGroup(request *CreateContainerGroupRequest) (response *CreateContainerGroupResponse, err error) {
  23. response = CreateCreateContainerGroupResponse()
  24. err = client.DoAction(request, response)
  25. return
  26. }
  27. // CreateContainerGroupWithChan invokes the eci.CreateContainerGroup API asynchronously
  28. // api document: https://help.aliyun.com/api/eci/createcontainergroup.html
  29. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  30. func (client *Client) CreateContainerGroupWithChan(request *CreateContainerGroupRequest) (<-chan *CreateContainerGroupResponse, <-chan error) {
  31. responseChan := make(chan *CreateContainerGroupResponse, 1)
  32. errChan := make(chan error, 1)
  33. err := client.AddAsyncTask(func() {
  34. defer close(responseChan)
  35. defer close(errChan)
  36. response, err := client.CreateContainerGroup(request)
  37. if err != nil {
  38. errChan <- err
  39. } else {
  40. responseChan <- response
  41. }
  42. })
  43. if err != nil {
  44. errChan <- err
  45. close(responseChan)
  46. close(errChan)
  47. }
  48. return responseChan, errChan
  49. }
  50. // CreateContainerGroupWithCallback invokes the eci.CreateContainerGroup API asynchronously
  51. // api document: https://help.aliyun.com/api/eci/createcontainergroup.html
  52. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  53. func (client *Client) CreateContainerGroupWithCallback(request *CreateContainerGroupRequest, callback func(response *CreateContainerGroupResponse, err error)) <-chan int {
  54. result := make(chan int, 1)
  55. err := client.AddAsyncTask(func() {
  56. var response *CreateContainerGroupResponse
  57. var err error
  58. defer close(result)
  59. response, err = client.CreateContainerGroup(request)
  60. callback(response, err)
  61. result <- 1
  62. })
  63. if err != nil {
  64. defer close(result)
  65. callback(nil, err)
  66. result <- 0
  67. }
  68. return result
  69. }
  70. // CreateContainerGroupRequest is the request struct for api CreateContainerGroup
  71. type CreateContainerGroupRequest struct {
  72. *requests.RpcRequest
  73. Action string `position:"Query" name:"Action"`
  74. OwnerId requests.Integer `position:"Query" name:"OwnerId"`
  75. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  76. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  77. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  78. RegionId string `position:"Query" name:"RegionId"`
  79. ZoneId string `position:"Query" name:"ZoneId"`
  80. SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
  81. VSwitchId string `position:"Query" name:"VSwitchId"`
  82. ContainerGroupName string `position:"Query" name:"ContainerGroupName"`
  83. RestartPolicy string `position:"Query" name:"RestartPolicy"`
  84. Tag *[]CreateContainerGroup_Tag `position:"Query" name:"Tag"`
  85. ImageRegistryCredential *[]CreateContainerGroup_ImageRegistryCredential `position:"Query" name:"ImageRegistryCredential"`
  86. Container *[]CreateContainerGroup_Container `position:"Query" name:"Container"`
  87. Volume *[]CreateContainerGroup_Volume `position:"Query" name:"Volume"`
  88. EipInstanceId string `position:"Query" name:"EipInstanceId"`
  89. InitContainer *[]CreateContainerGroup_InitContainer `position:"Query" name:"InitContainer"`
  90. DnsConfig_NameServer []string `position:"Query" name:"DnsConfig.NameServer"`
  91. DnsConfig_Search []string `position:"Query" name:"DnsConfig.Search"`
  92. DnsConfig_Option *[]CreateContainerGroup_DnsConfig_Option `position:"Query" name:"DnsConfig.Option"`
  93. Cpu requests.Float `position:"Query" name:"Cpu"`
  94. Memory requests.Float `position:"Query" name:"Memory"`
  95. }
  96. type CreateContainerGroup_Tag struct {
  97. Key string `json:"Key" xml:"Key"`
  98. Value string `json:"Value" xml:"Value"`
  99. }
  100. type CreateContainerGroup_ImageRegistryCredential struct {
  101. Server string `json:"Server" xml:"Server"`
  102. UserName string `json:"UserName" xml:"UserName"`
  103. Password string `json:"Password" xml:"Password"`
  104. }
  105. type CreateContainerGroup_Container struct {
  106. Image string `json:"Image" xml:"Image"`
  107. Name string `json:"Name" xml:"Name"`
  108. Cpu requests.Float `json:"Cpu" xml:"Cpu"`
  109. Memory requests.Float `json:"Memory" xml:"Memory"`
  110. WorkingDir string `json:"WorkingDir" xml:"WorkingDir"`
  111. ImagePullPolicy string `json:"ImagePullPolicy" xml:"ImagePullPolicy"`
  112. Command []string `json:"Command" xml:"Command"`
  113. Arg []string `json:"Arg" xml:"Arg"`
  114. VolumeMount *[]CreateContainerGroup_VolumeMount `json:"VolumeMount" xml:"VolumeMount"`
  115. Port *[]CreateContainerGroup_Port `json:"Port" xml:"Port"`
  116. EnvironmentVar *[]CreateContainerGroup_EnvironmentVar `json:"EnvironmentVar" xml:"EnvironmentVar"`
  117. ReadinessProbe_HttpGet_Path string `json:"ReadinessProbe.HttpGet.Path" xml:"ReadinessProbe.HttpGet.Path"`
  118. ReadinessProbe_HttpGet_Port requests.Integer `json:"ReadinessProbe.HttpGet.Port" xml:"ReadinessProbe.HttpGet.Port"`
  119. ReadinessProbe_HttpGet_Scheme string `json:"ReadinessProbe.HttpGet.Scheme" xml:"ReadinessProbe.HttpGet.Scheme"`
  120. ReadinessProbe_InitialDelaySeconds requests.Integer `json:"ReadinessProbe.InitialDelaySeconds" xml:"ReadinessProbe.InitialDelaySeconds"`
  121. ReadinessProbe_PeriodSeconds requests.Integer `json:"ReadinessProbe.PeriodSeconds" xml:"ReadinessProbe.PeriodSeconds"`
  122. ReadinessProbe_SuccessThreshold requests.Integer `json:"ReadinessProbe.SuccessThreshold" xml:"ReadinessProbe.SuccessThreshold"`
  123. ReadinessProbe_FailureThreshold requests.Integer `json:"ReadinessProbe.FailureThreshold" xml:"ReadinessProbe.FailureThreshold"`
  124. ReadinessProbe_TimeoutSeconds requests.Integer `json:"ReadinessProbe.TimeoutSeconds" xml:"ReadinessProbe.TimeoutSeconds"`
  125. ReadinessProbe_Exec_Command []string `json:"ReadinessProbe.Exec.Command" xml:"ReadinessProbe.Exec.Command"`
  126. LivenessProbe_HttpGet_Path string `json:"LivenessProbe.HttpGet.Path" xml:"LivenessProbe.HttpGet.Path"`
  127. LivenessProbe_HttpGet_Port requests.Integer `json:"LivenessProbe.HttpGet.Port" xml:"LivenessProbe.HttpGet.Port"`
  128. LivenessProbe_HttpGet_Scheme string `json:"LivenessProbe.HttpGet.Scheme" xml:"LivenessProbe.HttpGet.Scheme"`
  129. LivenessProbe_InitialDelaySeconds requests.Integer `json:"LivenessProbe.InitialDelaySeconds" xml:"LivenessProbe.InitialDelaySeconds"`
  130. LivenessProbe_PeriodSeconds requests.Integer `json:"LivenessProbe.PeriodSeconds" xml:"LivenessProbe.PeriodSeconds"`
  131. LivenessProbe_SuccessThreshold requests.Integer `json:"LivenessProbe.SuccessThreshold" xml:"LivenessProbe.SuccessThreshold"`
  132. LivenessProbe_FailureThreshold requests.Integer `json:"LivenessProbe.FailureThreshold" xml:"LivenessProbe.FailureThreshold"`
  133. LivenessProbe_TimeoutSeconds requests.Integer `json:"LivenessProbe.TimeoutSeconds" xml:"LivenessProbe.TimeoutSeconds"`
  134. LivenessProbe_Exec_Command []string `json:"LivenessProbe.Exec.Command" xml:"LivenessProbe.Exec.Command"`
  135. SecurityContext_Capability_Add []string `json:"SecurityContext.Capability.Add" xml:"SecurityContext.Capability.Add"`
  136. SecurityContext_ReadOnlyRootFilesystem requests.Boolean `json:"SecurityContext.ReadOnlyRootFilesystem" xml:"SecurityContext.ReadOnlyRootFilesystem"`
  137. SecurityContext_RunAsUser requests.Integer `json:"SecurityContext.RunAsUser" xml:"SecurityContext.RunAsUser"`
  138. ReadinessProbe_TcpSocket_Port requests.Integer `json:"ReadinessProbe.TcpSocket.Port" xml:"ReadinessProbe.TcpSocket.Port"`
  139. LivenessProbe_TcpSocket_Port requests.Integer `json:"LivenessProbe.TcpSocket.Port" xml:"LivenessProbe.TcpSocket.Port"`
  140. }
  141. type CreateContainerGroup_Volume struct {
  142. Name string `json:"Name" xml:"Name"`
  143. NFSVolume_Server string `json:"NFSVolume.Server" xml:"NFSVolume.Server"`
  144. NFSVolume_Path string `json:"NFSVolume.Path" xml:"NFSVolume.Path"`
  145. NFSVolume_ReadOnly requests.Boolean `json:"NFSVolume.ReadOnly" xml:"NFSVolume.ReadOnly"`
  146. ConfigFileVolume_ConfigFileToPath *[]CreateContainerGroup_ConfigFileVolume_ConfigFileToPath `json:"ConfigFileVolume.ConfigFileToPath" xml:"ConfigFileVolume.ConfigFileToPath"`
  147. Type string `json:"Type" xml:"Type"`
  148. }
  149. type CreateContainerGroup_InitContainer struct {
  150. Name string `json:"Name" xml:"Name"`
  151. Image string `json:"Image" xml:"Image"`
  152. Cpu requests.Float `json:"Cpu" xml:"Cpu"`
  153. Memory requests.Float `json:"Memory" xml:"Memory"`
  154. WorkingDir string `json:"WorkingDir" xml:"WorkingDir"`
  155. ImagePullPolicy string `json:"ImagePullPolicy" xml:"ImagePullPolicy"`
  156. Command []string `json:"Command" xml:"Command"`
  157. Arg []string `json:"Arg" xml:"Arg"`
  158. VolumeMount *[]CreateContainerGroup_VolumeMount `json:"VolumeMount" xml:"VolumeMount"`
  159. Port *[]CreateContainerGroup_Port `json:"Port" xml:"Port"`
  160. EnvironmentVar *[]CreateContainerGroup_EnvironmentVar `json:"EnvironmentVar" xml:"EnvironmentVar"`
  161. SecurityContext_Capability_Add []string `json:"SecurityContext.Capability.Add" xml:"SecurityContext.Capability.Add"`
  162. SecurityContext_ReadOnlyRootFilesystem requests.Boolean `json:"SecurityContext.ReadOnlyRootFilesystem" xml:"SecurityContext.ReadOnlyRootFilesystem"`
  163. SecurityContext_RunAsUser requests.Integer `json:"SecurityContext.RunAsUser" xml:"SecurityContext.RunAsUser"`
  164. }
  165. type CreateContainerGroup_DnsConfig_Option struct {
  166. Name string `json:"Name" xml:"Name"`
  167. Value string `json:"Value" xml:"Value"`
  168. }
  169. type CreateContainerGroup_VolumeMount struct {
  170. MountPath string `json:"MountPath" xml:"MountPath"`
  171. ReadOnly requests.Boolean `json:"ReadOnly" xml:"ReadOnly"`
  172. Name string `json:"Name" xml:"Name"`
  173. }
  174. type CreateContainerGroup_Port struct {
  175. Protocol string `json:"Protocol" xml:"Protocol"`
  176. Port requests.Integer `json:"Port" xml:"Port"`
  177. }
  178. type CreateContainerGroup_EnvironmentVar struct {
  179. Key string `json:"Key" xml:"Key"`
  180. Value string `json:"Value" xml:"Value"`
  181. }
  182. type CreateContainerGroup_ConfigFileVolume_ConfigFileToPath struct {
  183. Content string `json:"Content" xml:"Content"`
  184. Path string `json:"Path" xml:"Path"`
  185. }
  186. // CreateContainerGroupResponse is the response struct for api CreateContainerGroup
  187. type CreateContainerGroupResponse struct {
  188. *responses.BaseResponse
  189. RequestId string `json:"RequestId" xml:"RequestId"`
  190. ContainerGroupId string `json:"ContainerGroupId" xml:"ContainerGroupId"`
  191. }
  192. // CreateCreateContainerGroupRequest creates a request to invoke CreateContainerGroup API
  193. func CreateCreateContainerGroupRequest() (request *CreateContainerGroupRequest) {
  194. request = &CreateContainerGroupRequest{
  195. RpcRequest: &requests.RpcRequest{},
  196. }
  197. request.InitWithApiInfo("Eci", "2018-08-08", "CreateContainerGroup", "eci", "openAPI")
  198. return
  199. }
  200. // CreateCreateContainerGroupResponse creates a response to parse from CreateContainerGroup response
  201. func CreateCreateContainerGroupResponse() (response *CreateContainerGroupResponse) {
  202. response = &CreateContainerGroupResponse{
  203. BaseResponse: &responses.BaseResponse{},
  204. }
  205. return
  206. }