update_container_group.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. // UpdateContainerGroup invokes the eci.UpdateContainerGroup API synchronously
  21. // api document: https://help.aliyun.com/api/eci/updatecontainergroup.html
  22. func (client *Client) UpdateContainerGroup(request *UpdateContainerGroupRequest) (response *UpdateContainerGroupResponse, err error) {
  23. response = CreateUpdateContainerGroupResponse()
  24. err = client.DoAction(request, response)
  25. return
  26. }
  27. // UpdateContainerGroupWithChan invokes the eci.UpdateContainerGroup API asynchronously
  28. // api document: https://help.aliyun.com/api/eci/updatecontainergroup.html
  29. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  30. func (client *Client) UpdateContainerGroupWithChan(request *UpdateContainerGroupRequest) (<-chan *UpdateContainerGroupResponse, <-chan error) {
  31. responseChan := make(chan *UpdateContainerGroupResponse, 1)
  32. errChan := make(chan error, 1)
  33. err := client.AddAsyncTask(func() {
  34. defer close(responseChan)
  35. defer close(errChan)
  36. response, err := client.UpdateContainerGroup(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. // UpdateContainerGroupWithCallback invokes the eci.UpdateContainerGroup API asynchronously
  51. // api document: https://help.aliyun.com/api/eci/updatecontainergroup.html
  52. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  53. func (client *Client) UpdateContainerGroupWithCallback(request *UpdateContainerGroupRequest, callback func(response *UpdateContainerGroupResponse, err error)) <-chan int {
  54. result := make(chan int, 1)
  55. err := client.AddAsyncTask(func() {
  56. var response *UpdateContainerGroupResponse
  57. var err error
  58. defer close(result)
  59. response, err = client.UpdateContainerGroup(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. // UpdateContainerGroupRequest is the request struct for api UpdateContainerGroup
  71. type UpdateContainerGroupRequest struct {
  72. *requests.RpcRequest
  73. OwnerId requests.Integer `position:"Query" name:"OwnerId"`
  74. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  75. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  76. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  77. RegionId string `position:"Query" name:"RegionId"`
  78. ContainerGroupId string `position:"Query" name:"ContainerGroupId"`
  79. RestartPolicy string `position:"Query" name:"RestartPolicy"`
  80. Tag *[]UpdateContainerGroupTag `position:"Query" name:"Tag" type:"Repeated"`
  81. Volume *[]UpdateContainerGroupVolume `position:"Query" name:"Volume" type:"Repeated"`
  82. Container *[]UpdateContainerGroupContainer `position:"Query" name:"Container" type:"Repeated"`
  83. InitContainer *[]UpdateContainerGroupInitContainer `position:"Query" name:"InitContainer" type:"Repeated"`
  84. ImageRegistryCredential *[]UpdateContainerGroupImageRegistryCredential `position:"Query" name:"ImageRegistryCredential" type:"Repeated"`
  85. ClientToken string `position:"Query" name:"ClientToken"`
  86. Cpu requests.Float `position:"Query" name:"Cpu"`
  87. Memory requests.Float `position:"Query" name:"Memory"`
  88. DnsConfig UpdateContainerGroupDnsConfig `position:"Query" name:"DnsConfig" type:"Struct"`
  89. }
  90. type UpdateContainerGroupTag struct {
  91. Key string `name:"Key"`
  92. Value string `name:"Value"`
  93. }
  94. type UpdateContainerGroupVolume struct {
  95. Name string `name:"Name"`
  96. Type string `name:"Type"`
  97. NFSVolume UpdateContainerGroupNFSVolume `name:"NFSVolume" type:"Struct"`
  98. ConfigFileVolume UpdateContainerGroupConfigFileVolume `name:"ConfigFileVolume" type:"Struct"`
  99. EmptyDirVolume UpdateContainerGroupEmptyDirVolume `name:"EmptyDirVolume" type:"Struct"`
  100. }
  101. type UpdateContainerGroupContainer struct {
  102. Name string `name:"Name"`
  103. Image string `name:"Image"`
  104. Cpu requests.Float `name:"Cpu"`
  105. Memory requests.Float `name:"Memory"`
  106. WorkingDir string `name:"WorkingDir"`
  107. ImagePullPolicy string `name:"ImagePullPolicy"`
  108. Stdin requests.Boolean `name:"Stdin"`
  109. StdinOnce requests.Boolean `name:"StdinOnce"`
  110. Tty requests.Boolean `name:"Tty"`
  111. Command []string `name:"Command" type:"Repeated"`
  112. Arg []string `name:"Arg" type:"Repeated"`
  113. EnvironmentVar []string `name:"EnvironmentVar" type:"Repeated"`
  114. Port []string `name:"Port" type:"Repeated"`
  115. VolumeMount []string `name:"VolumeMount" type:"Repeated"`
  116. Gpu requests.Integer `name:"Gpu"`
  117. ReadinessProbe UpdateContainerGroupReadinessProbe `name:"ReadinessProbe" type:"Struct"`
  118. LivenessProbe UpdateContainerGroupLivenessProbe `name:"LivenessProbe" type:"Struct"`
  119. SecurityContext UpdateContainerGroupSecurityContext `name:"SecurityContext" type:"Struct"`
  120. }
  121. type UpdateContainerGroupInitContainer struct {
  122. Name string `name:"Name"`
  123. Image string `name:"Image"`
  124. Cpu requests.Float `name:"Cpu"`
  125. Memory requests.Float `name:"Memory"`
  126. WorkingDir string `name:"WorkingDir"`
  127. ImagePullPolicy string `name:"ImagePullPolicy"`
  128. Stdin requests.Boolean `name:"Stdin"`
  129. StdinOnce requests.Boolean `name:"StdinOnce"`
  130. Tty requests.Boolean `name:"Tty"`
  131. Command []string `name:"Command" type:"Repeated"`
  132. Arg []string `name:"Arg" type:"Repeated"`
  133. EnvironmentVar *[]UpdateContainerGroupEnvironmentVar `name:"EnvironmentVar" type:"Repeated"`
  134. Port *[]UpdateContainerGroupPort `name:"Port" type:"Repeated"`
  135. VolumeMount *[]UpdateContainerGroupVolumeMount `name:"VolumeMount" type:"Repeated"`
  136. Gpu requests.Integer `name:"Gpu"`
  137. SecurityContext UpdateContainerGroupSecurityContext `name:"SecurityContext" type:"Struct"`
  138. }
  139. type UpdateContainerGroupImageRegistryCredential struct {
  140. Server string `name:"Server"`
  141. UserName string `name:"UserName"`
  142. Password string `name:"Password"`
  143. }
  144. type UpdateContainerGroupDnsConfig struct {
  145. NameServer []string `name:"NameServer" type:"Repeated"`
  146. Search []string `name:"Search" type:"Repeated"`
  147. Option *[]UpdateContainerGroupOption `name:"Option" type:"Repeated"`
  148. }
  149. type UpdateContainerGroupNFSVolume struct {
  150. Server string `name:"Server"`
  151. Path string `name:"Path"`
  152. ReadOnly requests.Boolean `name:"ReadOnly"`
  153. }
  154. type UpdateContainerGroupConfigFileVolume struct {
  155. ConfigFileToPath *[]UpdateContainerGroupConfigFileToPath `name:"ConfigFileToPath" type:"Repeated"`
  156. }
  157. type UpdateContainerGroupConfigFileToPath struct {
  158. Content string `name:"Content"`
  159. Path string `name:"Path"`
  160. }
  161. type UpdateContainerGroupEmptyDirVolume struct {
  162. Medium string `name:"Medium"`
  163. }
  164. type UpdateContainerGroupReadinessProbe struct {
  165. InitialDelaySeconds requests.Integer `name:"InitialDelaySeconds"`
  166. PeriodSeconds requests.Integer `name:"PeriodSeconds"`
  167. SuccessThreshold requests.Integer `name:"SuccessThreshold"`
  168. FailureThreshold requests.Integer `name:"FailureThreshold"`
  169. TimeoutSeconds requests.Integer `name:"TimeoutSeconds"`
  170. TcpSocket UpdateContainerGroupTcpSocket `name:"TcpSocket"`
  171. Exec UpdateContainerGroupExec `name:"Exec"`
  172. HttpGet UpdateContainerGroupHttpGet `name:"HttpGet"`
  173. }
  174. type UpdateContainerGroupTcpSocket struct {
  175. Port requests.Integer `name:"Port"`
  176. }
  177. type UpdateContainerGroupExec struct {
  178. Command []string `name:"Command" type:"Repeated"`
  179. }
  180. type UpdateContainerGroupHttpGet struct {
  181. Path string `name:"Path"`
  182. Port requests.Integer `name:"Port"`
  183. Scheme string `name:"Scheme"`
  184. }
  185. type UpdateContainerGroupLivenessProbe struct {
  186. InitialDelaySeconds requests.Integer `name:"InitialDelaySeconds"`
  187. PeriodSeconds requests.Integer `name:"PeriodSeconds"`
  188. SuccessThreshold requests.Integer `name:"SuccessThreshold"`
  189. FailureThreshold requests.Integer `name:"FailureThreshold"`
  190. TimeoutSeconds requests.Integer `name:"TimeoutSeconds"`
  191. TcpSocket UpdateContainerGroupTcpSocket `name:"TcpSocket"`
  192. Exec UpdateContainerGroupExec `name:"Exec"`
  193. HttpGet UpdateContainerGroupHttpGet `name:"HttpGet"`
  194. }
  195. type UpdateContainerGroupSecurityContext struct {
  196. ReadOnlyRootFilesystem requests.Boolean `name:"ReadOnlyRootFilesystem"`
  197. RunAsUser requests.Integer `name:"RunAsUser"`
  198. Capability UpdateContainerGroupCapability `name:"Capability"`
  199. }
  200. type UpdateContainerGroupCapability struct {
  201. Add []string `name:"Add" type:"Repeated"`
  202. }
  203. type UpdateContainerGroupEnvironmentVar struct {
  204. Key string `name:"Key"`
  205. Value string `name:"Value"`
  206. }
  207. type UpdateContainerGroupPort struct {
  208. Port requests.Integer `name:"Port"`
  209. Protocol string `name:"Protocol"`
  210. }
  211. type UpdateContainerGroupVolumeMount struct {
  212. Name string `name:"Name"`
  213. MountPath string `name:"MountPath"`
  214. SubPath string `name:"SubPath"`
  215. ReadOnly requests.Boolean `name:"ReadOnly"`
  216. }
  217. type UpdateContainerGroupOption struct {
  218. Name string `name:"Name"`
  219. Value string `name:"Value"`
  220. }
  221. // UpdateContainerGroupResponse is the response struct for api UpdateContainerGroup
  222. type UpdateContainerGroupResponse struct {
  223. *responses.BaseResponse
  224. RequestId string `json:"RequestId" xml:"RequestId"`
  225. }
  226. // CreateUpdateContainerGroupRequest creates a request to invoke UpdateContainerGroup API
  227. func CreateUpdateContainerGroupRequest() (request *UpdateContainerGroupRequest) {
  228. request = &UpdateContainerGroupRequest{
  229. RpcRequest: &requests.RpcRequest{},
  230. }
  231. request.InitWithApiInfo("Eci", "2018-08-08", "UpdateContainerGroup", "eci", "openAPI")
  232. return
  233. }
  234. // CreateUpdateContainerGroupResponse creates a response to parse from UpdateContainerGroup response
  235. func CreateUpdateContainerGroupResponse() (response *UpdateContainerGroupResponse) {
  236. response = &UpdateContainerGroupResponse{
  237. BaseResponse: &responses.BaseResponse{},
  238. }
  239. return
  240. }