|
@@ -178,162 +178,34 @@ func Test_AcsRequest_InitParams(t *testing.T) {
|
|
|
// CreateContainerGroupRequest is the request struct for api CreateContainerGroup
|
|
// CreateContainerGroupRequest is the request struct for api CreateContainerGroup
|
|
|
type CreateContainerGroupRequest struct {
|
|
type CreateContainerGroupRequest struct {
|
|
|
*RpcRequest
|
|
*RpcRequest
|
|
|
- OwnerId Integer `position:"Query" name:"OwnerId"`
|
|
|
|
|
- ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
|
|
|
|
- ResourceOwnerId Integer `position:"Query" name:"ResourceOwnerId"`
|
|
|
|
|
- OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
|
|
|
|
- RegionId string `position:"Query" name:"RegionId"`
|
|
|
|
|
- ZoneId string `position:"Query" name:"ZoneId"`
|
|
|
|
|
- SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
|
|
|
|
- VSwitchId string `position:"Query" name:"VSwitchId"`
|
|
|
|
|
- ContainerGroupName string `position:"Query" name:"ContainerGroupName"`
|
|
|
|
|
- RestartPolicy string `position:"Query" name:"RestartPolicy"`
|
|
|
|
|
- Tag *[]CreateContainerGroup_Tag `position:"Query" name:"Tag" type:"Repeated"`
|
|
|
|
|
- ImageRegistryCredential *[]CreateContainerGroup_ImageRegistryCredential `position:"Query" name:"ImageRegistryCredential" type:"Repeated"`
|
|
|
|
|
- Container *[]CreateContainerGroup_Container `position:"Query" name:"Container" type:"Repeated"`
|
|
|
|
|
- Volume *[]CreateContainerGroup_Volume `position:"Query" name:"Volume" type:"Repeated"`
|
|
|
|
|
- EipInstanceId string `position:"Query" name:"EipInstanceId"`
|
|
|
|
|
- InitContainer *[]CreateContainerGroup_InitContainer `position:"Query" name:"InitContainer" type:"Repeated"`
|
|
|
|
|
- Cpu Float `position:"Query" name:"Cpu"`
|
|
|
|
|
- Memory Float `position:"Query" name:"Memory"`
|
|
|
|
|
- DnsConfig CreateContainerGroup_DnsConfig `position:"Query" name:"DnsConfig" type:"Struct"`
|
|
|
|
|
- OptionJson map[string]interface{} `position:"Query" name:"OptionJson"`
|
|
|
|
|
|
|
+ OwnerId Integer `position:"Query" name:"OwnerId"`
|
|
|
|
|
+ ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
|
|
|
|
+ Volume *[]CreateContainerGroupVolume `position:"Query" name:"Volume" type:"Repeated"`
|
|
|
|
|
+ Memory Float `position:"Query" name:"Memory"`
|
|
|
|
|
+ SlsEnable Boolean `position:"Query" name:"SlsEnable"`
|
|
|
|
|
+ DnsConfig CreateContainerGroupDnsConfig `position:"Query" name:"DnsConfig" type:"Struct"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-type CreateContainerGroup_Tag struct {
|
|
|
|
|
- Key string `name:"Key"`
|
|
|
|
|
- Value string `name:"Value"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_ImageRegistryCredential struct {
|
|
|
|
|
- Server string `name:"Server"`
|
|
|
|
|
- UserName string `name:"UserName"`
|
|
|
|
|
- Password string `name:"Password"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_Container struct {
|
|
|
|
|
- Image string `name:"Image"`
|
|
|
|
|
- Name string `name:"Name"`
|
|
|
|
|
- Cpu Float `name:"Cpu"`
|
|
|
|
|
- Memory Float `name:"Memory"`
|
|
|
|
|
- WorkingDir string `name:"WorkingDir"`
|
|
|
|
|
- ImagePullPolicy string `name:"ImagePullPolicy"`
|
|
|
|
|
- Command []string `name:"Command" type:"Repeated"`
|
|
|
|
|
- Arg []string `name:"Arg" type:"Repeated"`
|
|
|
|
|
- VolumeMount *[]CreateContainerGroup_VolumeMount `name:"VolumeMount" type:"Repeated"`
|
|
|
|
|
- Port *[]CreateContainerGroup_Port `name:"Port" type:"Repeated"`
|
|
|
|
|
- EnvironmentVar *[]CreateContainerGroup_EnvironmentVar `name:"EnvironmentVar" type:"Repeated"`
|
|
|
|
|
- ReadinessProbe CreateContainerGroup_ReadinessProbe `name:"ReadinessProbe" type:"Struct"`
|
|
|
|
|
- LivenessProbe CreateContainerGroup_LivenessProbe `name:"LivenessProbe" type:"Struct"`
|
|
|
|
|
- SecurityContext CreateContainerGroup_SecurityContext `name:"SecurityContext" type:"Struct"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_Volume struct {
|
|
|
|
|
- Name string `name:"Name"`
|
|
|
|
|
- Type string `name:"Type"`
|
|
|
|
|
- NFSVolume CreateContainerGroup_NFSVolume `name:"NFSVolume"`
|
|
|
|
|
- ConfigFileVolume CreateContainerGroup_ConfigFileVolume `name:"ConfigFileVolume"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_InitContainer struct {
|
|
|
|
|
- Name string `name:"Name"`
|
|
|
|
|
- Image string `name:"Image"`
|
|
|
|
|
- Cpu Float `name:"Cpu"`
|
|
|
|
|
- Memory Float `name:"Memory"`
|
|
|
|
|
- WorkingDir string `name:"WorkingDir"`
|
|
|
|
|
- ImagePullPolicy string `name:"ImagePullPolicy"`
|
|
|
|
|
- Command []string `name:"Command"`
|
|
|
|
|
- Arg []string `name:"Arg"`
|
|
|
|
|
- VolumeMount *[]CreateContainerGroup_VolumeMount `name:"VolumeMount"`
|
|
|
|
|
- Port *[]CreateContainerGroup_Port `name:"Port"`
|
|
|
|
|
- EnvironmentVar *[]CreateContainerGroup_EnvironmentVar `name:"EnvironmentVar"`
|
|
|
|
|
- SecurityContext CreateContainerGroup_SecurityContext `name:"SecurityContext"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_DnsConfig struct {
|
|
|
|
|
- NameServer []string `name:"NameServer"`
|
|
|
|
|
- Search []string `name:"Search"`
|
|
|
|
|
- Option *[]CreateContainerGroup_Option `name:"Option"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_VolumeMount struct {
|
|
|
|
|
- MountPath string `name:"MountPath"`
|
|
|
|
|
- ReadOnly Boolean `name:"ReadOnly"`
|
|
|
|
|
- Name string `name:"Name"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_Port struct {
|
|
|
|
|
- Protocol string `name:"Protocol"`
|
|
|
|
|
- Port Integer `name:"Port"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_EnvironmentVar struct {
|
|
|
|
|
- Key string `name:"Key"`
|
|
|
|
|
- Value string `name:"Value"`
|
|
|
|
|
|
|
+type CreateContainerGroupVolume struct {
|
|
|
|
|
+ Name string `name:"Name"`
|
|
|
|
|
+ Type string `name:"Type"`
|
|
|
|
|
+ NFSVolume CreateContainerGroupNFSVolume `name:"NFSVolume" type:"Struct"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-type CreateContainerGroup_ReadinessProbe struct {
|
|
|
|
|
- InitialDelaySeconds Integer `name:"InitialDelaySeconds"`
|
|
|
|
|
- PeriodSeconds Integer `name:"PeriodSeconds"`
|
|
|
|
|
- SuccessThreshold Integer `name:"SuccessThreshold"`
|
|
|
|
|
- FailureThreshold Integer `name:"FailureThreshold"`
|
|
|
|
|
- TimeoutSeconds Integer `name:"TimeoutSeconds"`
|
|
|
|
|
- HttpGet CreateContainerGroup_HttpGet `name:"HttpGet"`
|
|
|
|
|
- Exec CreateContainerGroup_Exec `name:"Exec"`
|
|
|
|
|
- TcpSocket CreateContainerGroup_TcpSocket `name:"TcpSocket"`
|
|
|
|
|
|
|
+type CreateContainerGroupDnsConfig struct {
|
|
|
|
|
+ NameServer []string `name:"NameServer"`
|
|
|
|
|
+ Search []string `name:"Search"`
|
|
|
|
|
+ Option *[]CreateContainerGroupOption `name:"Option"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-type CreateContainerGroup_HttpGet struct {
|
|
|
|
|
- Path string `name:"Path"`
|
|
|
|
|
- Port Integer `name:"Port"`
|
|
|
|
|
- Scheme string `name:"Scheme"`
|
|
|
|
|
|
|
+type CreateContainerGroupNFSVolume struct {
|
|
|
|
|
+ Server string `name:"Server"`
|
|
|
|
|
+ Path string `name:"Path"`
|
|
|
|
|
+ ReadOnly Boolean `name:"ReadOnly"`
|
|
|
|
|
+ Option CreateContainerGroupOption `name:"Option" type:"Struct"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-type CreateContainerGroup_Exec struct {
|
|
|
|
|
- Command []string `name:"Command"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_TcpSocket struct {
|
|
|
|
|
- Port Integer `name:"Port"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_LivenessProbe struct {
|
|
|
|
|
- InitialDelaySeconds Integer `name:"InitialDelaySeconds"`
|
|
|
|
|
- PeriodSeconds Integer `name:"PeriodSeconds"`
|
|
|
|
|
- SuccessThreshold Integer `name:"SuccessThreshold"`
|
|
|
|
|
- FailureThreshold Integer `name:"FailureThreshold"`
|
|
|
|
|
- TimeoutSeconds Integer `name:"TimeoutSeconds"`
|
|
|
|
|
- HttpGet CreateContainerGroup_HttpGet `name:"HttpGet"`
|
|
|
|
|
- Exec CreateContainerGroup_Exec `name:"Exec"`
|
|
|
|
|
- TcpSocket CreateContainerGroup_TcpSocket `name:"TcpSocket"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_SecurityContext struct {
|
|
|
|
|
- ReadOnlyRootFilesystem Boolean `name:"ReadOnlyRootFilesystem"`
|
|
|
|
|
- RunAsUser Integer `name:"RunAsUser"`
|
|
|
|
|
- Capability CreateContainerGroup_Capability `name:"Capability"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_Capability struct {
|
|
|
|
|
- Add []string `name:"Add"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_NFSVolume struct {
|
|
|
|
|
- Server string `name:"Server"`
|
|
|
|
|
- Path string `name:"Path"`
|
|
|
|
|
- ReadOnly Boolean `name:"ReadOnly"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_ConfigFileVolume struct {
|
|
|
|
|
- ConfigFileToPath *[]CreateContainerGroup_ConfigFileToPath `name:"ConfigFileToPath"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_ConfigFileToPath struct {
|
|
|
|
|
- Content string `name:"Content"`
|
|
|
|
|
- Path string `name:"Path"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-type CreateContainerGroup_Option struct {
|
|
|
|
|
|
|
+type CreateContainerGroupOption struct {
|
|
|
Name string `name:"Name"`
|
|
Name string `name:"Name"`
|
|
|
Value string `name:"Value"`
|
|
Value string `name:"Value"`
|
|
|
}
|
|
}
|
|
@@ -371,36 +243,37 @@ func Test_AcsRequest_InitParams2(t *testing.T) {
|
|
|
|
|
|
|
|
func Test_AcsRequest_InitParams3(t *testing.T) {
|
|
func Test_AcsRequest_InitParams3(t *testing.T) {
|
|
|
r := InitRequest()
|
|
r := InitRequest()
|
|
|
- r.RegionId = "regionid"
|
|
|
|
|
|
|
+ r.OwnerId = "OwnerId"
|
|
|
InitParams(r)
|
|
InitParams(r)
|
|
|
- assert.Equal(t, "RegionId=regionid&", GetQueryString(r))
|
|
|
|
|
|
|
+ assert.Equal(t, "OwnerId=OwnerId&", GetQueryString(r))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func Test_AcsRequest_InitParams4(t *testing.T) {
|
|
func Test_AcsRequest_InitParams4(t *testing.T) {
|
|
|
r := InitRequest()
|
|
r := InitRequest()
|
|
|
r.RegionId = "regionid"
|
|
r.RegionId = "regionid"
|
|
|
- r.DnsConfig = CreateContainerGroup_DnsConfig{
|
|
|
|
|
|
|
+ r.DnsConfig = CreateContainerGroupDnsConfig{
|
|
|
NameServer: []string{"nameserver1", "nameserver2"},
|
|
NameServer: []string{"nameserver1", "nameserver2"},
|
|
|
}
|
|
}
|
|
|
InitParams(r)
|
|
InitParams(r)
|
|
|
- assert.Equal(t, "DnsConfig.NameServer.1=nameserver1&DnsConfig.NameServer.2=nameserver2&RegionId=regionid&",
|
|
|
|
|
- GetQueryString(r))
|
|
|
|
|
|
|
+ assert.Equal(t, "DnsConfig.NameServer.1=nameserver1&DnsConfig.NameServer.2=nameserver2&", GetQueryString(r))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func Test_AcsRequest_InitParams5(t *testing.T) {
|
|
func Test_AcsRequest_InitParams5(t *testing.T) {
|
|
|
r := InitRequest()
|
|
r := InitRequest()
|
|
|
- r.Container = &[]CreateContainerGroup_Container{
|
|
|
|
|
|
|
+ r.Volume = &[]CreateContainerGroupVolume{
|
|
|
{
|
|
{
|
|
|
- Image: "nginx",
|
|
|
|
|
- Name: "nginx",
|
|
|
|
|
- Cpu: "1",
|
|
|
|
|
- Memory: "2",
|
|
|
|
|
- WorkingDir: "ddd",
|
|
|
|
|
|
|
+ Name: "nginx",
|
|
|
|
|
+ Type: "1",
|
|
|
|
|
+ NFSVolume: CreateContainerGroupNFSVolume{
|
|
|
|
|
+ Path: "/",
|
|
|
|
|
+ Option: CreateContainerGroupOption{
|
|
|
|
|
+ Name: "sdk",
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
InitParams(r)
|
|
InitParams(r)
|
|
|
- assert.Equal(t, "Container.1.Cpu=1&Container.1.Image=nginx&Container.1.Memory=2&Container.1.Name=nginx&Container.1.WorkingDir=ddd&",
|
|
|
|
|
- GetQueryString(r))
|
|
|
|
|
|
|
+ assert.Equal(t, "Volume.1.NFSVolume.Option.Name=sdk&Volume.1.NFSVolume.Path=/&Volume.1.Name=nginx&Volume.1.Type=1&", GetQueryString(r))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type StartMPUTaskRequest struct {
|
|
type StartMPUTaskRequest struct {
|