Merge pull request #10932 from hashicorp/remove-alicloud
extract alicloud plugin to its own repo
This commit is contained in:
commit
af34218909
|
@ -1,52 +0,0 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testAlicloudAccessConfig() *AlicloudAccessConfig {
|
||||
return &AlicloudAccessConfig{
|
||||
AlicloudAccessKey: "ak",
|
||||
AlicloudSecretKey: "acs",
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestAlicloudAccessConfigPrepareRegion(t *testing.T) {
|
||||
c := testAlicloudAccessConfig()
|
||||
|
||||
c.AlicloudRegion = ""
|
||||
if err := c.Prepare(nil); err == nil {
|
||||
t.Fatalf("should have err")
|
||||
}
|
||||
|
||||
c.AlicloudRegion = "cn-beijing"
|
||||
if err := c.Prepare(nil); err != nil {
|
||||
t.Fatalf("shouldn't have err: %s", err)
|
||||
}
|
||||
|
||||
os.Setenv("ALICLOUD_REGION", "cn-hangzhou")
|
||||
c.AlicloudRegion = ""
|
||||
if err := c.Prepare(nil); err != nil {
|
||||
t.Fatalf("shouldn't have err: %s", err)
|
||||
}
|
||||
|
||||
c.AlicloudAccessKey = ""
|
||||
if err := c.Prepare(nil); err == nil {
|
||||
t.Fatalf("should have err")
|
||||
}
|
||||
|
||||
c.AlicloudProfile = "default"
|
||||
if err := c.Prepare(nil); err != nil {
|
||||
t.Fatalf("shouldn't have err: %s", err)
|
||||
}
|
||||
|
||||
c.AlicloudProfile = ""
|
||||
os.Setenv("ALICLOUD_PROFILE", "default")
|
||||
if err := c.Prepare(nil); err != nil {
|
||||
t.Fatalf("shouldn't have err: %s", err)
|
||||
}
|
||||
|
||||
c.AlicloudSkipValidation = false
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
func TestArtifact_Impl(t *testing.T) {
|
||||
var _ packersdk.Artifact = new(Artifact)
|
||||
}
|
||||
|
||||
func TestArtifactId(t *testing.T) {
|
||||
expected := `east:foo,west:bar`
|
||||
|
||||
ecsImages := make(map[string]string)
|
||||
ecsImages["east"] = "foo"
|
||||
ecsImages["west"] = "bar"
|
||||
|
||||
a := &Artifact{
|
||||
AlicloudImages: ecsImages,
|
||||
}
|
||||
|
||||
result := a.Id()
|
||||
if result != expected {
|
||||
t.Fatalf("bad: %s", result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestArtifactState_atlasMetadata(t *testing.T) {
|
||||
a := &Artifact{
|
||||
AlicloudImages: map[string]string{
|
||||
"east": "foo",
|
||||
"west": "bar",
|
||||
},
|
||||
}
|
||||
|
||||
actual := a.State("atlas.artifact.metadata")
|
||||
expected := map[string]string{
|
||||
"region.east": "foo",
|
||||
"region.west": "bar",
|
||||
}
|
||||
if !reflect.DeepEqual(actual, expected) {
|
||||
t.Fatalf("bad: %#v", actual)
|
||||
}
|
||||
}
|
|
@ -1,891 +0,0 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
|
||||
builderT "github.com/hashicorp/packer/acctest"
|
||||
)
|
||||
|
||||
const defaultTestRegion = "cn-beijing"
|
||||
|
||||
func TestBuilderAcc_validateRegion(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if os.Getenv(builderT.TestEnvVar) == "" {
|
||||
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", builderT.TestEnvVar))
|
||||
return
|
||||
}
|
||||
|
||||
testAccPreCheck(t)
|
||||
|
||||
access := &AlicloudAccessConfig{AlicloudRegion: "cn-beijing"}
|
||||
err := access.Config()
|
||||
if err != nil {
|
||||
t.Fatalf("init AlicloudAccessConfig failed: %s", err)
|
||||
}
|
||||
|
||||
err = access.ValidateRegion("cn-hangzhou")
|
||||
if err != nil {
|
||||
t.Fatalf("Expect pass with valid region id but failed: %s", err)
|
||||
}
|
||||
|
||||
err = access.ValidateRegion("invalidRegionId")
|
||||
if err == nil {
|
||||
t.Fatal("Expect failure due to invalid region id but passed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderAcc_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: testBuilderAccBasic,
|
||||
})
|
||||
}
|
||||
|
||||
const testBuilderAccBasic = `
|
||||
{ "builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"io_optimized":"true",
|
||||
"ssh_username":"root",
|
||||
"image_name": "packer-test-basic_{{timestamp}}"
|
||||
}]
|
||||
}`
|
||||
|
||||
func TestBuilderAcc_withDiskSettings(t *testing.T) {
|
||||
t.Parallel()
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: testBuilderAccWithDiskSettings,
|
||||
Check: checkImageDisksSettings(),
|
||||
})
|
||||
}
|
||||
|
||||
const testBuilderAccWithDiskSettings = `
|
||||
{ "builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"io_optimized":"true",
|
||||
"ssh_username":"root",
|
||||
"image_name": "packer-test-withDiskSettings_{{timestamp}}",
|
||||
"system_disk_mapping": {
|
||||
"disk_size": 60
|
||||
},
|
||||
"image_disk_mappings": [
|
||||
{
|
||||
"disk_name": "datadisk1",
|
||||
"disk_size": 25,
|
||||
"disk_delete_with_instance": true
|
||||
},
|
||||
{
|
||||
"disk_name": "datadisk2",
|
||||
"disk_size": 25,
|
||||
"disk_delete_with_instance": true
|
||||
}
|
||||
]
|
||||
}]
|
||||
}`
|
||||
|
||||
func checkImageDisksSettings() builderT.TestCheckFunc {
|
||||
return func(artifacts []packersdk.Artifact) error {
|
||||
if len(artifacts) > 1 {
|
||||
return fmt.Errorf("more than 1 artifact")
|
||||
}
|
||||
|
||||
// Get the actual *Artifact pointer so we can access the AMIs directly
|
||||
artifactRaw := artifacts[0]
|
||||
artifact, ok := artifactRaw.(*Artifact)
|
||||
if !ok {
|
||||
return fmt.Errorf("unknown artifact: %#v", artifactRaw)
|
||||
}
|
||||
imageId := artifact.AlicloudImages[defaultTestRegion]
|
||||
|
||||
// describe the image, get block devices with a snapshot
|
||||
client, _ := testAliyunClient()
|
||||
|
||||
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
||||
describeImagesRequest.RegionId = defaultTestRegion
|
||||
describeImagesRequest.ImageId = imageId
|
||||
imagesResponse, err := client.DescribeImages(describeImagesRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe images failed due to %s", err)
|
||||
}
|
||||
|
||||
if len(imagesResponse.Images.Image) == 0 {
|
||||
return fmt.Errorf("image %s generated can not be found", imageId)
|
||||
}
|
||||
|
||||
image := imagesResponse.Images.Image[0]
|
||||
if image.Size != 60 {
|
||||
return fmt.Errorf("the size of image %s should be equal to 60G but got %dG", imageId, image.Size)
|
||||
}
|
||||
if len(image.DiskDeviceMappings.DiskDeviceMapping) != 3 {
|
||||
return fmt.Errorf("image %s should contains 3 disks", imageId)
|
||||
}
|
||||
|
||||
var snapshotIds []string
|
||||
for _, mapping := range image.DiskDeviceMappings.DiskDeviceMapping {
|
||||
if mapping.Type == DiskTypeSystem {
|
||||
if mapping.Size != "60" {
|
||||
return fmt.Errorf("the system snapshot size of image %s should be equal to 60G but got %sG", imageId, mapping.Size)
|
||||
}
|
||||
} else {
|
||||
if mapping.Size != "25" {
|
||||
return fmt.Errorf("the data disk size of image %s should be equal to 25G but got %sG", imageId, mapping.Size)
|
||||
}
|
||||
|
||||
snapshotIds = append(snapshotIds, mapping.SnapshotId)
|
||||
}
|
||||
}
|
||||
|
||||
data, _ := json.Marshal(snapshotIds)
|
||||
|
||||
describeSnapshotRequest := ecs.CreateDescribeSnapshotsRequest()
|
||||
describeSnapshotRequest.RegionId = defaultTestRegion
|
||||
describeSnapshotRequest.SnapshotIds = string(data)
|
||||
describeSnapshotsResponse, err := client.DescribeSnapshots(describeSnapshotRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe data snapshots failed due to %s", err)
|
||||
}
|
||||
if len(describeSnapshotsResponse.Snapshots.Snapshot) != 2 {
|
||||
return fmt.Errorf("expect %d data snapshots but got %d", len(snapshotIds), len(describeSnapshotsResponse.Snapshots.Snapshot))
|
||||
}
|
||||
|
||||
var dataDiskIds []string
|
||||
for _, snapshot := range describeSnapshotsResponse.Snapshots.Snapshot {
|
||||
dataDiskIds = append(dataDiskIds, snapshot.SourceDiskId)
|
||||
}
|
||||
data, _ = json.Marshal(dataDiskIds)
|
||||
|
||||
describeDisksRequest := ecs.CreateDescribeDisksRequest()
|
||||
describeDisksRequest.RegionId = defaultTestRegion
|
||||
describeDisksRequest.DiskIds = string(data)
|
||||
describeDisksResponse, err := client.DescribeDisks(describeDisksRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe snapshots failed due to %s", err)
|
||||
}
|
||||
if len(describeDisksResponse.Disks.Disk) != 0 {
|
||||
return fmt.Errorf("data disks should be deleted but %d left", len(describeDisksResponse.Disks.Disk))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderAcc_withIgnoreDataDisks(t *testing.T) {
|
||||
t.Parallel()
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: testBuilderAccIgnoreDataDisks,
|
||||
Check: checkIgnoreDataDisks(),
|
||||
})
|
||||
}
|
||||
|
||||
const testBuilderAccIgnoreDataDisks = `
|
||||
{ "builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.gn5-c8g1.2xlarge",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"io_optimized":"true",
|
||||
"ssh_username":"root",
|
||||
"image_name": "packer-test-ignoreDataDisks_{{timestamp}}",
|
||||
"image_ignore_data_disks": true
|
||||
}]
|
||||
}`
|
||||
|
||||
func checkIgnoreDataDisks() builderT.TestCheckFunc {
|
||||
return func(artifacts []packersdk.Artifact) error {
|
||||
if len(artifacts) > 1 {
|
||||
return fmt.Errorf("more than 1 artifact")
|
||||
}
|
||||
|
||||
// Get the actual *Artifact pointer so we can access the AMIs directly
|
||||
artifactRaw := artifacts[0]
|
||||
artifact, ok := artifactRaw.(*Artifact)
|
||||
if !ok {
|
||||
return fmt.Errorf("unknown artifact: %#v", artifactRaw)
|
||||
}
|
||||
imageId := artifact.AlicloudImages[defaultTestRegion]
|
||||
|
||||
// describe the image, get block devices with a snapshot
|
||||
client, _ := testAliyunClient()
|
||||
|
||||
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
||||
describeImagesRequest.RegionId = defaultTestRegion
|
||||
describeImagesRequest.ImageId = imageId
|
||||
imagesResponse, err := client.DescribeImages(describeImagesRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe images failed due to %s", err)
|
||||
}
|
||||
|
||||
if len(imagesResponse.Images.Image) == 0 {
|
||||
return fmt.Errorf("image %s generated can not be found", imageId)
|
||||
}
|
||||
|
||||
image := imagesResponse.Images.Image[0]
|
||||
if len(image.DiskDeviceMappings.DiskDeviceMapping) != 1 {
|
||||
return fmt.Errorf("image %s should only contain one disks", imageId)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderAcc_windows(t *testing.T) {
|
||||
t.Parallel()
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: testBuilderAccWindows,
|
||||
})
|
||||
}
|
||||
|
||||
const testBuilderAccWindows = `
|
||||
{ "builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"winsvr_64_dtcC_1809_en-us_40G_alibase_20190318.vhd",
|
||||
"io_optimized":"true",
|
||||
"communicator": "winrm",
|
||||
"winrm_port": 5985,
|
||||
"winrm_username": "Administrator",
|
||||
"winrm_password": "Test1234",
|
||||
"image_name": "packer-test-windows_{{timestamp}}",
|
||||
"user_data_file": "../../../examples/alicloud/basic/winrm_enable_userdata.ps1"
|
||||
}]
|
||||
}`
|
||||
|
||||
func TestBuilderAcc_regionCopy(t *testing.T) {
|
||||
t.Parallel()
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: testBuilderAccRegionCopy,
|
||||
Check: checkRegionCopy([]string{"cn-hangzhou", "cn-shenzhen"}),
|
||||
})
|
||||
}
|
||||
|
||||
const testBuilderAccRegionCopy = `
|
||||
{
|
||||
"builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"io_optimized":"true",
|
||||
"ssh_username":"root",
|
||||
"image_name": "packer-test-regionCopy_{{timestamp}}",
|
||||
"image_copy_regions": ["cn-hangzhou", "cn-shenzhen"],
|
||||
"image_copy_names": ["packer-copy-test-hz_{{timestamp}}", "packer-copy-test-sz_{{timestamp}}"]
|
||||
}]
|
||||
}
|
||||
`
|
||||
|
||||
func checkRegionCopy(regions []string) builderT.TestCheckFunc {
|
||||
return func(artifacts []packersdk.Artifact) error {
|
||||
if len(artifacts) > 1 {
|
||||
return fmt.Errorf("more than 1 artifact")
|
||||
}
|
||||
|
||||
// Get the actual *Artifact pointer so we can access the AMIs directly
|
||||
artifactRaw := artifacts[0]
|
||||
artifact, ok := artifactRaw.(*Artifact)
|
||||
if !ok {
|
||||
return fmt.Errorf("unknown artifact: %#v", artifactRaw)
|
||||
}
|
||||
|
||||
// Verify that we copied to only the regions given
|
||||
regionSet := make(map[string]struct{})
|
||||
for _, r := range regions {
|
||||
regionSet[r] = struct{}{}
|
||||
}
|
||||
|
||||
for r := range artifact.AlicloudImages {
|
||||
if r == "cn-beijing" {
|
||||
delete(regionSet, r)
|
||||
continue
|
||||
}
|
||||
|
||||
if _, ok := regionSet[r]; !ok {
|
||||
return fmt.Errorf("region %s is not the target region but found in artifacts", r)
|
||||
}
|
||||
|
||||
delete(regionSet, r)
|
||||
}
|
||||
|
||||
if len(regionSet) > 0 {
|
||||
return fmt.Errorf("following region(s) should be the copying targets but corresponding artifact(s) not found: %#v", regionSet)
|
||||
}
|
||||
|
||||
client, _ := testAliyunClient()
|
||||
for regionId, imageId := range artifact.AlicloudImages {
|
||||
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
||||
describeImagesRequest.RegionId = regionId
|
||||
describeImagesRequest.ImageId = imageId
|
||||
describeImagesRequest.Status = ImageStatusQueried
|
||||
describeImagesResponse, err := client.DescribeImages(describeImagesRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe generated image %s failed due to %s", imageId, err)
|
||||
}
|
||||
if len(describeImagesResponse.Images.Image) == 0 {
|
||||
return fmt.Errorf("image %s in artifacts can not be found", imageId)
|
||||
}
|
||||
|
||||
image := describeImagesResponse.Images.Image[0]
|
||||
if image.IsCopied && regionId == "cn-hangzhou" && !strings.HasPrefix(image.ImageName, "packer-copy-test-hz") {
|
||||
return fmt.Errorf("the name of image %s in artifacts should begin with %s but got %s", imageId, "packer-copy-test-hz", image.ImageName)
|
||||
}
|
||||
if image.IsCopied && regionId == "cn-shenzhen" && !strings.HasPrefix(image.ImageName, "packer-copy-test-sz") {
|
||||
return fmt.Errorf("the name of image %s in artifacts should begin with %s but got %s", imageId, "packer-copy-test-sz", image.ImageName)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderAcc_forceDelete(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Build the same alicloud image twice, with ecs_image_force_delete on the second run
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: buildForceDeregisterConfig("false", "delete"),
|
||||
SkipArtifactTeardown: true,
|
||||
})
|
||||
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: buildForceDeregisterConfig("true", "delete"),
|
||||
})
|
||||
}
|
||||
|
||||
func buildForceDeregisterConfig(val, name string) string {
|
||||
return fmt.Sprintf(testBuilderAccForceDelete, val, name)
|
||||
}
|
||||
|
||||
const testBuilderAccForceDelete = `
|
||||
{
|
||||
"builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"io_optimized":"true",
|
||||
"ssh_username":"root",
|
||||
"image_force_delete": "%s",
|
||||
"image_name": "packer-test-forceDelete_%s"
|
||||
}]
|
||||
}
|
||||
`
|
||||
|
||||
func TestBuilderAcc_ECSImageSharing(t *testing.T) {
|
||||
t.Parallel()
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: testBuilderAccSharing,
|
||||
Check: checkECSImageSharing("1309208528360047"),
|
||||
})
|
||||
}
|
||||
|
||||
const testBuilderAccSharing = `
|
||||
{
|
||||
"builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"io_optimized":"true",
|
||||
"ssh_username":"root",
|
||||
"image_name": "packer-test-ECSImageSharing_{{timestamp}}",
|
||||
"image_share_account":["1309208528360047"]
|
||||
}]
|
||||
}
|
||||
`
|
||||
|
||||
func checkECSImageSharing(uid string) builderT.TestCheckFunc {
|
||||
return func(artifacts []packersdk.Artifact) error {
|
||||
if len(artifacts) > 1 {
|
||||
return fmt.Errorf("more than 1 artifact")
|
||||
}
|
||||
|
||||
// Get the actual *Artifact pointer so we can access the AMIs directly
|
||||
artifactRaw := artifacts[0]
|
||||
artifact, ok := artifactRaw.(*Artifact)
|
||||
if !ok {
|
||||
return fmt.Errorf("unknown artifact: %#v", artifactRaw)
|
||||
}
|
||||
|
||||
// describe the image, get block devices with a snapshot
|
||||
client, _ := testAliyunClient()
|
||||
|
||||
describeImageShareRequest := ecs.CreateDescribeImageSharePermissionRequest()
|
||||
describeImageShareRequest.RegionId = "cn-beijing"
|
||||
describeImageShareRequest.ImageId = artifact.AlicloudImages["cn-beijing"]
|
||||
imageShareResponse, err := client.DescribeImageSharePermission(describeImageShareRequest)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error retrieving Image Attributes for ECS Image Artifact (%#v) "+
|
||||
"in ECS Image Sharing Test: %s", artifact, err)
|
||||
}
|
||||
|
||||
if len(imageShareResponse.Accounts.Account) != 1 && imageShareResponse.Accounts.Account[0].AliyunId != uid {
|
||||
return fmt.Errorf("share account is incorrect %d", len(imageShareResponse.Accounts.Account))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderAcc_forceDeleteSnapshot(t *testing.T) {
|
||||
t.Parallel()
|
||||
destImageName := "delete"
|
||||
|
||||
// Build the same alicloud image name twice, with force_delete_snapshot on the second run
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: buildForceDeleteSnapshotConfig("false", destImageName),
|
||||
SkipArtifactTeardown: true,
|
||||
})
|
||||
|
||||
// Get image data by image image name
|
||||
client, _ := testAliyunClient()
|
||||
|
||||
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
||||
describeImagesRequest.RegionId = "cn-beijing"
|
||||
describeImagesRequest.ImageName = "packer-test-" + destImageName
|
||||
images, _ := client.DescribeImages(describeImagesRequest)
|
||||
|
||||
image := images.Images.Image[0]
|
||||
|
||||
// Get snapshot ids for image
|
||||
snapshotIds := []string{}
|
||||
for _, device := range image.DiskDeviceMappings.DiskDeviceMapping {
|
||||
if device.Device != "" && device.SnapshotId != "" {
|
||||
snapshotIds = append(snapshotIds, device.SnapshotId)
|
||||
}
|
||||
}
|
||||
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: buildForceDeleteSnapshotConfig("true", destImageName),
|
||||
Check: checkSnapshotsDeleted(snapshotIds),
|
||||
})
|
||||
}
|
||||
|
||||
func buildForceDeleteSnapshotConfig(val, name string) string {
|
||||
return fmt.Sprintf(testBuilderAccForceDeleteSnapshot, val, val, name)
|
||||
}
|
||||
|
||||
const testBuilderAccForceDeleteSnapshot = `
|
||||
{
|
||||
"builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"io_optimized":"true",
|
||||
"ssh_username":"root",
|
||||
"image_force_delete_snapshots": "%s",
|
||||
"image_force_delete": "%s",
|
||||
"image_name": "packer-test-%s"
|
||||
}]
|
||||
}
|
||||
`
|
||||
|
||||
func checkSnapshotsDeleted(snapshotIds []string) builderT.TestCheckFunc {
|
||||
return func(artifacts []packersdk.Artifact) error {
|
||||
// Verify the snapshots are gone
|
||||
client, _ := testAliyunClient()
|
||||
data, err := json.Marshal(snapshotIds)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Marshal snapshotIds array failed %v", err)
|
||||
}
|
||||
|
||||
describeSnapshotsRequest := ecs.CreateDescribeSnapshotsRequest()
|
||||
describeSnapshotsRequest.RegionId = "cn-beijing"
|
||||
describeSnapshotsRequest.SnapshotIds = string(data)
|
||||
snapshotResp, err := client.DescribeSnapshots(describeSnapshotsRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Query snapshot failed %v", err)
|
||||
}
|
||||
snapshots := snapshotResp.Snapshots.Snapshot
|
||||
if len(snapshots) > 0 {
|
||||
return fmt.Errorf("Snapshots weren't successfully deleted by " +
|
||||
"`ecs_image_force_delete_snapshots`")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderAcc_imageTags(t *testing.T) {
|
||||
t.Parallel()
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: testBuilderAccImageTags,
|
||||
Check: checkImageTags(),
|
||||
})
|
||||
}
|
||||
|
||||
const testBuilderAccImageTags = `
|
||||
{ "builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"ssh_username": "root",
|
||||
"io_optimized":"true",
|
||||
"image_name": "packer-test-imageTags_{{timestamp}}",
|
||||
"tags": {
|
||||
"TagKey1": "TagValue1",
|
||||
"TagKey2": "TagValue2"
|
||||
}
|
||||
}]
|
||||
}`
|
||||
|
||||
func checkImageTags() builderT.TestCheckFunc {
|
||||
return func(artifacts []packersdk.Artifact) error {
|
||||
if len(artifacts) > 1 {
|
||||
return fmt.Errorf("more than 1 artifact")
|
||||
}
|
||||
// Get the actual *Artifact pointer so we can access the AMIs directly
|
||||
artifactRaw := artifacts[0]
|
||||
artifact, ok := artifactRaw.(*Artifact)
|
||||
if !ok {
|
||||
return fmt.Errorf("unknown artifact: %#v", artifactRaw)
|
||||
}
|
||||
imageId := artifact.AlicloudImages[defaultTestRegion]
|
||||
|
||||
// describe the image, get block devices with a snapshot
|
||||
client, _ := testAliyunClient()
|
||||
|
||||
describeImageTagsRequest := ecs.CreateDescribeTagsRequest()
|
||||
describeImageTagsRequest.RegionId = defaultTestRegion
|
||||
describeImageTagsRequest.ResourceType = TagResourceImage
|
||||
describeImageTagsRequest.ResourceId = imageId
|
||||
imageTagsResponse, err := client.DescribeTags(describeImageTagsRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error retrieving Image Attributes for ECS Image Artifact (%#v) "+
|
||||
"in ECS Image Tags Test: %s", artifact, err)
|
||||
}
|
||||
|
||||
if len(imageTagsResponse.Tags.Tag) != 2 {
|
||||
return fmt.Errorf("expect 2 tags set on image %s but got %d", imageId, len(imageTagsResponse.Tags.Tag))
|
||||
}
|
||||
|
||||
for _, tag := range imageTagsResponse.Tags.Tag {
|
||||
if tag.TagKey != "TagKey1" && tag.TagKey != "TagKey2" {
|
||||
return fmt.Errorf("tags on image %s should be within the list of TagKey1 and TagKey2 but got %s", imageId, tag.TagKey)
|
||||
}
|
||||
|
||||
if tag.TagKey == "TagKey1" && tag.TagValue != "TagValue1" {
|
||||
return fmt.Errorf("the value for tag %s on image %s should be TagValue1 but got %s", tag.TagKey, imageId, tag.TagValue)
|
||||
} else if tag.TagKey == "TagKey2" && tag.TagValue != "TagValue2" {
|
||||
return fmt.Errorf("the value for tag %s on image %s should be TagValue2 but got %s", tag.TagKey, imageId, tag.TagValue)
|
||||
}
|
||||
}
|
||||
|
||||
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
||||
describeImagesRequest.RegionId = defaultTestRegion
|
||||
describeImagesRequest.ImageId = imageId
|
||||
imagesResponse, err := client.DescribeImages(describeImagesRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe images failed due to %s", err)
|
||||
}
|
||||
|
||||
if len(imagesResponse.Images.Image) == 0 {
|
||||
return fmt.Errorf("image %s generated can not be found", imageId)
|
||||
}
|
||||
|
||||
image := imagesResponse.Images.Image[0]
|
||||
for _, mapping := range image.DiskDeviceMappings.DiskDeviceMapping {
|
||||
describeSnapshotTagsRequest := ecs.CreateDescribeTagsRequest()
|
||||
describeSnapshotTagsRequest.RegionId = defaultTestRegion
|
||||
describeSnapshotTagsRequest.ResourceType = TagResourceSnapshot
|
||||
describeSnapshotTagsRequest.ResourceId = mapping.SnapshotId
|
||||
snapshotTagsResponse, err := client.DescribeTags(describeSnapshotTagsRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get snapshot tags due to %s", err)
|
||||
}
|
||||
|
||||
if len(snapshotTagsResponse.Tags.Tag) != 2 {
|
||||
return fmt.Errorf("expect 2 tags set on snapshot %s but got %d", mapping.SnapshotId, len(snapshotTagsResponse.Tags.Tag))
|
||||
}
|
||||
|
||||
for _, tag := range snapshotTagsResponse.Tags.Tag {
|
||||
if tag.TagKey != "TagKey1" && tag.TagKey != "TagKey2" {
|
||||
return fmt.Errorf("tags on snapshot %s should be within the list of TagKey1 and TagKey2 but got %s", mapping.SnapshotId, tag.TagKey)
|
||||
}
|
||||
|
||||
if tag.TagKey == "TagKey1" && tag.TagValue != "TagValue1" {
|
||||
return fmt.Errorf("the value for tag %s on snapshot %s should be TagValue1 but got %s", tag.TagKey, mapping.SnapshotId, tag.TagValue)
|
||||
} else if tag.TagKey == "TagKey2" && tag.TagValue != "TagValue2" {
|
||||
return fmt.Errorf("the value for tag %s on snapshot %s should be TagValue2 but got %s", tag.TagKey, mapping.SnapshotId, tag.TagValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderAcc_dataDiskEncrypted(t *testing.T) {
|
||||
t.Parallel()
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: testBuilderAccDataDiskEncrypted,
|
||||
Check: checkDataDiskEncrypted(),
|
||||
})
|
||||
}
|
||||
|
||||
const testBuilderAccDataDiskEncrypted = `
|
||||
{ "builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"io_optimized":"true",
|
||||
"ssh_username":"root",
|
||||
"image_name": "packer-test-dataDiskEncrypted_{{timestamp}}",
|
||||
"image_disk_mappings": [
|
||||
{
|
||||
"disk_name": "data_disk1",
|
||||
"disk_size": 25,
|
||||
"disk_encrypted": true,
|
||||
"disk_delete_with_instance": true
|
||||
},
|
||||
{
|
||||
"disk_name": "data_disk2",
|
||||
"disk_size": 35,
|
||||
"disk_encrypted": false,
|
||||
"disk_delete_with_instance": true
|
||||
},
|
||||
{
|
||||
"disk_name": "data_disk3",
|
||||
"disk_size": 45,
|
||||
"disk_delete_with_instance": true
|
||||
}
|
||||
]
|
||||
}]
|
||||
}`
|
||||
|
||||
func checkDataDiskEncrypted() builderT.TestCheckFunc {
|
||||
return func(artifacts []packersdk.Artifact) error {
|
||||
if len(artifacts) > 1 {
|
||||
return fmt.Errorf("more than 1 artifact")
|
||||
}
|
||||
|
||||
// Get the actual *Artifact pointer so we can access the AMIs directly
|
||||
artifactRaw := artifacts[0]
|
||||
artifact, ok := artifactRaw.(*Artifact)
|
||||
if !ok {
|
||||
return fmt.Errorf("unknown artifact: %#v", artifactRaw)
|
||||
}
|
||||
imageId := artifact.AlicloudImages[defaultTestRegion]
|
||||
|
||||
// describe the image, get block devices with a snapshot
|
||||
client, _ := testAliyunClient()
|
||||
|
||||
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
||||
describeImagesRequest.RegionId = defaultTestRegion
|
||||
describeImagesRequest.ImageId = imageId
|
||||
imagesResponse, err := client.DescribeImages(describeImagesRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe images failed due to %s", err)
|
||||
}
|
||||
|
||||
if len(imagesResponse.Images.Image) == 0 {
|
||||
return fmt.Errorf("image %s generated can not be found", imageId)
|
||||
}
|
||||
image := imagesResponse.Images.Image[0]
|
||||
|
||||
var snapshotIds []string
|
||||
for _, mapping := range image.DiskDeviceMappings.DiskDeviceMapping {
|
||||
snapshotIds = append(snapshotIds, mapping.SnapshotId)
|
||||
}
|
||||
|
||||
data, _ := json.Marshal(snapshotIds)
|
||||
|
||||
describeSnapshotRequest := ecs.CreateDescribeSnapshotsRequest()
|
||||
describeSnapshotRequest.RegionId = defaultTestRegion
|
||||
describeSnapshotRequest.SnapshotIds = string(data)
|
||||
describeSnapshotsResponse, err := client.DescribeSnapshots(describeSnapshotRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe data snapshots failed due to %s", err)
|
||||
}
|
||||
if len(describeSnapshotsResponse.Snapshots.Snapshot) != 4 {
|
||||
return fmt.Errorf("expect %d data snapshots but got %d", len(snapshotIds), len(describeSnapshotsResponse.Snapshots.Snapshot))
|
||||
}
|
||||
snapshots := describeSnapshotsResponse.Snapshots.Snapshot
|
||||
for _, snapshot := range snapshots {
|
||||
if snapshot.SourceDiskType == DiskTypeSystem {
|
||||
if snapshot.Encrypted != false {
|
||||
return fmt.Errorf("the system snapshot expected to be non-encrypted but got true")
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if snapshot.SourceDiskSize == "25" && snapshot.Encrypted != true {
|
||||
return fmt.Errorf("the first snapshot expected to be encrypted but got false")
|
||||
}
|
||||
|
||||
if snapshot.SourceDiskSize == "35" && snapshot.Encrypted != false {
|
||||
return fmt.Errorf("the second snapshot expected to be non-encrypted but got true")
|
||||
}
|
||||
|
||||
if snapshot.SourceDiskSize == "45" && snapshot.Encrypted != false {
|
||||
return fmt.Errorf("the third snapshot expected to be non-encrypted but got true")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderAcc_systemDiskEncrypted(t *testing.T) {
|
||||
t.Parallel()
|
||||
builderT.Test(t, builderT.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Builder: &Builder{},
|
||||
Template: testBuilderAccSystemDiskEncrypted,
|
||||
Check: checkSystemDiskEncrypted(),
|
||||
})
|
||||
}
|
||||
|
||||
const testBuilderAccSystemDiskEncrypted = `
|
||||
{
|
||||
"builders": [{
|
||||
"type": "test",
|
||||
"region": "cn-beijing",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190509.vhd",
|
||||
"io_optimized":"true",
|
||||
"ssh_username":"root",
|
||||
"image_name": "packer-test_{{timestamp}}",
|
||||
"image_encrypted": "true"
|
||||
}]
|
||||
}`
|
||||
|
||||
func checkSystemDiskEncrypted() builderT.TestCheckFunc {
|
||||
return func(artifacts []packersdk.Artifact) error {
|
||||
if len(artifacts) > 1 {
|
||||
return fmt.Errorf("more than 1 artifact")
|
||||
}
|
||||
|
||||
// Get the actual *Artifact pointer so we can access the AMIs directly
|
||||
artifactRaw := artifacts[0]
|
||||
artifact, ok := artifactRaw.(*Artifact)
|
||||
if !ok {
|
||||
return fmt.Errorf("unknown artifact: %#v", artifactRaw)
|
||||
}
|
||||
|
||||
// describe the image, get block devices with a snapshot
|
||||
client, _ := testAliyunClient()
|
||||
imageId := artifact.AlicloudImages[defaultTestRegion]
|
||||
|
||||
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
||||
describeImagesRequest.RegionId = defaultTestRegion
|
||||
describeImagesRequest.ImageId = imageId
|
||||
describeImagesRequest.Status = ImageStatusQueried
|
||||
imagesResponse, err := client.DescribeImages(describeImagesRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe images failed due to %s", err)
|
||||
}
|
||||
|
||||
if len(imagesResponse.Images.Image) == 0 {
|
||||
return fmt.Errorf("image %s generated can not be found", imageId)
|
||||
}
|
||||
|
||||
image := imagesResponse.Images.Image[0]
|
||||
if image.IsCopied == false {
|
||||
return fmt.Errorf("image %s generated expexted to be copied but false", image.ImageId)
|
||||
}
|
||||
|
||||
describeSnapshotRequest := ecs.CreateDescribeSnapshotsRequest()
|
||||
describeSnapshotRequest.RegionId = defaultTestRegion
|
||||
describeSnapshotRequest.SnapshotIds = fmt.Sprintf("[\"%s\"]", image.DiskDeviceMappings.DiskDeviceMapping[0].SnapshotId)
|
||||
describeSnapshotsResponse, err := client.DescribeSnapshots(describeSnapshotRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("describe system snapshots failed due to %s", err)
|
||||
}
|
||||
snapshots := describeSnapshotsResponse.Snapshots.Snapshot[0]
|
||||
|
||||
if snapshots.Encrypted != true {
|
||||
return fmt.Errorf("system snapshot of image %s expected to be encrypted but got false", imageId)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func testAccPreCheck(t *testing.T) {
|
||||
if v := os.Getenv("ALICLOUD_ACCESS_KEY"); v == "" {
|
||||
t.Fatal("ALICLOUD_ACCESS_KEY must be set for acceptance tests")
|
||||
}
|
||||
|
||||
if v := os.Getenv("ALICLOUD_SECRET_KEY"); v == "" {
|
||||
t.Fatal("ALICLOUD_SECRET_KEY must be set for acceptance tests")
|
||||
}
|
||||
}
|
||||
|
||||
func testAliyunClient() (*ClientWrapper, error) {
|
||||
access := &AlicloudAccessConfig{AlicloudRegion: "cn-beijing"}
|
||||
err := access.Config()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := access.Client()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return client, nil
|
||||
}
|
|
@ -1,237 +0,0 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
|
||||
helperconfig "github.com/hashicorp/packer-plugin-sdk/template/config"
|
||||
)
|
||||
|
||||
func testBuilderConfig() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"access_key": "foo",
|
||||
"secret_key": "bar",
|
||||
"source_image": "foo",
|
||||
"instance_type": "ecs.n1.tiny",
|
||||
"region": "cn-beijing",
|
||||
"ssh_username": "root",
|
||||
"image_name": "foo",
|
||||
"io_optimized": true,
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||
var raw interface{}
|
||||
raw = &Builder{}
|
||||
if _, ok := raw.(packersdk.Builder); !ok {
|
||||
t.Fatalf("Builder should be a builder")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilder_Prepare_BadType(t *testing.T) {
|
||||
b := &Builder{}
|
||||
c := map[string]interface{}{
|
||||
"access_key": []string{},
|
||||
}
|
||||
|
||||
_, warnings, err := b.Prepare(c)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err == nil {
|
||||
t.Fatalf("prepare should fail")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderPrepare_ECSImageName(t *testing.T) {
|
||||
var b Builder
|
||||
config := testBuilderConfig()
|
||||
|
||||
// Test good
|
||||
config["image_name"] = "ecs.n1.tiny"
|
||||
_, warnings, err := b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("should not have error: %s", err)
|
||||
}
|
||||
|
||||
// Test bad
|
||||
config["ecs_image_name"] = "foo {{"
|
||||
b = Builder{}
|
||||
_, warnings, err = b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err == nil {
|
||||
t.Fatal("should have error")
|
||||
}
|
||||
|
||||
// Test bad
|
||||
delete(config, "image_name")
|
||||
b = Builder{}
|
||||
_, warnings, err = b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err == nil {
|
||||
t.Fatal("should have error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderPrepare_InvalidKey(t *testing.T) {
|
||||
var b Builder
|
||||
config := testBuilderConfig()
|
||||
|
||||
// Add a random key
|
||||
config["i_should_not_be_valid"] = true
|
||||
_, warnings, err := b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err == nil {
|
||||
t.Fatal("should have error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderPrepare_Devices(t *testing.T) {
|
||||
var b Builder
|
||||
config := testBuilderConfig()
|
||||
config["system_disk_mapping"] = map[string]interface{}{
|
||||
"disk_category": "cloud",
|
||||
"disk_description": "system disk",
|
||||
"disk_name": "system_disk",
|
||||
"disk_size": 60,
|
||||
}
|
||||
config["image_disk_mappings"] = []map[string]interface{}{
|
||||
{
|
||||
"disk_category": "cloud_efficiency",
|
||||
"disk_name": "data_disk1",
|
||||
"disk_size": 100,
|
||||
"disk_snapshot_id": "s-1",
|
||||
"disk_description": "data disk1",
|
||||
"disk_device": "/dev/xvdb",
|
||||
"disk_delete_with_instance": false,
|
||||
},
|
||||
{
|
||||
"disk_name": "data_disk2",
|
||||
"disk_device": "/dev/xvdc",
|
||||
},
|
||||
}
|
||||
_, warnings, err := b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("should not have error: %s", err)
|
||||
}
|
||||
expected := AlicloudDiskDevice{
|
||||
DiskCategory: "cloud",
|
||||
Description: "system disk",
|
||||
DiskName: "system_disk",
|
||||
DiskSize: 60,
|
||||
Encrypted: helperconfig.TriUnset,
|
||||
}
|
||||
if !reflect.DeepEqual(b.config.ECSSystemDiskMapping, expected) {
|
||||
t.Fatalf("system disk is not set properly, actual: %v; expected: %v", b.config.ECSSystemDiskMapping, expected)
|
||||
}
|
||||
if !reflect.DeepEqual(b.config.ECSImagesDiskMappings, []AlicloudDiskDevice{
|
||||
{
|
||||
DiskCategory: "cloud_efficiency",
|
||||
DiskName: "data_disk1",
|
||||
DiskSize: 100,
|
||||
SnapshotId: "s-1",
|
||||
Description: "data disk1",
|
||||
Device: "/dev/xvdb",
|
||||
DeleteWithInstance: false,
|
||||
},
|
||||
{
|
||||
DiskName: "data_disk2",
|
||||
Device: "/dev/xvdc",
|
||||
},
|
||||
}) {
|
||||
t.Fatalf("data disks are not set properly, actual: %#v", b.config.ECSImagesDiskMappings)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderPrepare_IgnoreDataDisks(t *testing.T) {
|
||||
var b Builder
|
||||
config := testBuilderConfig()
|
||||
|
||||
_, warnings, err := b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("should not have error: %s", err)
|
||||
}
|
||||
|
||||
if b.config.AlicloudImageIgnoreDataDisks != false {
|
||||
t.Fatalf("image_ignore_data_disks is not set properly, expect: %t, actual: %t", false, b.config.AlicloudImageIgnoreDataDisks)
|
||||
}
|
||||
|
||||
config["image_ignore_data_disks"] = "false"
|
||||
_, warnings, err = b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("should not have error: %s", err)
|
||||
}
|
||||
|
||||
if b.config.AlicloudImageIgnoreDataDisks != false {
|
||||
t.Fatalf("image_ignore_data_disks is not set properly, expect: %t, actual: %t", false, b.config.AlicloudImageIgnoreDataDisks)
|
||||
}
|
||||
|
||||
config["image_ignore_data_disks"] = "true"
|
||||
_, warnings, err = b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("should not have error: %s", err)
|
||||
}
|
||||
|
||||
if b.config.AlicloudImageIgnoreDataDisks != true {
|
||||
t.Fatalf("image_ignore_data_disks is not set properly, expect: %t, actual: %t", true, b.config.AlicloudImageIgnoreDataDisks)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderPrepare_WaitSnapshotReadyTimeout(t *testing.T) {
|
||||
var b Builder
|
||||
config := testBuilderConfig()
|
||||
|
||||
_, warnings, err := b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("should not have error: %s", err)
|
||||
}
|
||||
|
||||
if b.config.WaitSnapshotReadyTimeout != 0 {
|
||||
t.Fatalf("wait_snapshot_ready_timeout is not set properly, expect: %d, actual: %d", 0, b.config.WaitSnapshotReadyTimeout)
|
||||
}
|
||||
if b.getSnapshotReadyTimeout() != ALICLOUD_DEFAULT_LONG_TIMEOUT {
|
||||
t.Fatalf("default timeout is not set properly, expect: %d, actual: %d", ALICLOUD_DEFAULT_LONG_TIMEOUT, b.getSnapshotReadyTimeout())
|
||||
}
|
||||
|
||||
config["wait_snapshot_ready_timeout"] = ALICLOUD_DEFAULT_TIMEOUT
|
||||
_, warnings, err = b.Prepare(config)
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("should not have error: %s", err)
|
||||
}
|
||||
|
||||
if b.config.WaitSnapshotReadyTimeout != ALICLOUD_DEFAULT_TIMEOUT {
|
||||
t.Fatalf("wait_snapshot_ready_timeout is not set properly, expect: %d, actual: %d", ALICLOUD_DEFAULT_TIMEOUT, b.config.WaitSnapshotReadyTimeout)
|
||||
}
|
||||
|
||||
if b.getSnapshotReadyTimeout() != ALICLOUD_DEFAULT_TIMEOUT {
|
||||
t.Fatalf("default timeout is not set properly, expect: %d, actual: %d", ALICLOUD_DEFAULT_TIMEOUT, b.getSnapshotReadyTimeout())
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
func TestWaitForExpectedExceedRetryTimes(t *testing.T) {
|
||||
c := ClientWrapper{}
|
||||
|
||||
iter := 0
|
||||
waitDone := make(chan bool, 1)
|
||||
|
||||
go func() {
|
||||
_, _ = c.WaitForExpected(&WaitForExpectArgs{
|
||||
RequestFunc: func() (responses.AcsResponse, error) {
|
||||
iter++
|
||||
return nil, fmt.Errorf("test: let iteration %d failed", iter)
|
||||
},
|
||||
EvalFunc: func(response responses.AcsResponse, err error) WaitForExpectEvalResult {
|
||||
if err != nil {
|
||||
fmt.Printf("need retry: %s\n", err)
|
||||
return WaitForExpectToRetry
|
||||
}
|
||||
|
||||
return WaitForExpectSuccess
|
||||
},
|
||||
})
|
||||
|
||||
waitDone <- true
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-waitDone:
|
||||
if iter != defaultRetryTimes {
|
||||
t.Fatalf("WaitForExpected should terminate at the %d iterations", defaultRetryTimes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestWaitForExpectedExceedRetryTimeout(t *testing.T) {
|
||||
c := ClientWrapper{}
|
||||
|
||||
expectTimeout := 10 * time.Second
|
||||
iter := 0
|
||||
waitDone := make(chan bool, 1)
|
||||
|
||||
go func() {
|
||||
_, _ = c.WaitForExpected(&WaitForExpectArgs{
|
||||
RequestFunc: func() (responses.AcsResponse, error) {
|
||||
iter++
|
||||
return nil, fmt.Errorf("test: let iteration %d failed", iter)
|
||||
},
|
||||
EvalFunc: func(response responses.AcsResponse, err error) WaitForExpectEvalResult {
|
||||
if err != nil {
|
||||
fmt.Printf("need retry: %s\n", err)
|
||||
return WaitForExpectToRetry
|
||||
}
|
||||
|
||||
return WaitForExpectSuccess
|
||||
},
|
||||
RetryTimeout: expectTimeout,
|
||||
})
|
||||
|
||||
waitDone <- true
|
||||
}()
|
||||
|
||||
timeTolerance := 1 * time.Second
|
||||
select {
|
||||
case <-waitDone:
|
||||
if iter > int(expectTimeout/defaultRetryInterval) {
|
||||
t.Fatalf("WaitForExpected should terminate before the %d iterations", int(expectTimeout/defaultRetryInterval))
|
||||
}
|
||||
case <-time.After(expectTimeout + timeTolerance):
|
||||
t.Fatalf("WaitForExpected should terminate within %f seconds", (expectTimeout + timeTolerance).Seconds())
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testAlicloudImageConfig() *AlicloudImageConfig {
|
||||
return &AlicloudImageConfig{
|
||||
AlicloudImageName: "foo",
|
||||
}
|
||||
}
|
||||
|
||||
func TestECSImageConfigPrepare_name(t *testing.T) {
|
||||
c := testAlicloudImageConfig()
|
||||
if err := c.Prepare(nil); err != nil {
|
||||
t.Fatalf("shouldn't have err: %s", err)
|
||||
}
|
||||
|
||||
c.AlicloudImageName = ""
|
||||
if err := c.Prepare(nil); err == nil {
|
||||
t.Fatal("should have error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAMIConfigPrepare_regions(t *testing.T) {
|
||||
c := testAlicloudImageConfig()
|
||||
c.AlicloudImageDestinationRegions = nil
|
||||
if err := c.Prepare(nil); err != nil {
|
||||
t.Fatalf("shouldn't have err: %s", err)
|
||||
}
|
||||
|
||||
c.AlicloudImageDestinationRegions = []string{"cn-beijing", "cn-hangzhou", "eu-central-1"}
|
||||
if err := c.Prepare(nil); err != nil {
|
||||
t.Fatalf("bad: %s", err)
|
||||
}
|
||||
|
||||
c.AlicloudImageDestinationRegions = nil
|
||||
c.AlicloudImageSkipRegionValidation = true
|
||||
if err := c.Prepare(nil); err != nil {
|
||||
t.Fatal("shouldn't have error")
|
||||
}
|
||||
c.AlicloudImageSkipRegionValidation = false
|
||||
}
|
||||
|
||||
func TestECSImageConfigPrepare_imageTags(t *testing.T) {
|
||||
c := testAlicloudImageConfig()
|
||||
c.AlicloudImageTags = map[string]string{
|
||||
"TagKey1": "TagValue1",
|
||||
"TagKey2": "TagValue2",
|
||||
}
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if len(c.AlicloudImageTags) != 2 || c.AlicloudImageTags["TagKey1"] != "TagValue1" ||
|
||||
c.AlicloudImageTags["TagKey2"] != "TagValue2" {
|
||||
t.Fatalf("invalid value, expected: %s, actual: %s", map[string]string{
|
||||
"TagKey1": "TagValue1",
|
||||
"TagKey2": "TagValue2",
|
||||
}, c.AlicloudImageTags)
|
||||
}
|
||||
}
|
|
@ -1,178 +0,0 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer-plugin-sdk/communicator"
|
||||
)
|
||||
|
||||
func testConfig() *RunConfig {
|
||||
return &RunConfig{
|
||||
AlicloudSourceImage: "alicloud_images",
|
||||
InstanceType: "ecs.n1.tiny",
|
||||
Comm: communicator.Config{
|
||||
SSH: communicator.SSH{
|
||||
SSHUsername: "alicloud",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunConfigPrepare(t *testing.T) {
|
||||
c := testConfig()
|
||||
err := c.Prepare(nil)
|
||||
if len(err) > 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunConfigPrepare_InstanceType(t *testing.T) {
|
||||
c := testConfig()
|
||||
c.InstanceType = ""
|
||||
if err := c.Prepare(nil); len(err) != 1 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunConfigPrepare_SourceECSImage(t *testing.T) {
|
||||
c := testConfig()
|
||||
c.AlicloudSourceImage = ""
|
||||
if err := c.Prepare(nil); len(err) != 1 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunConfigPrepare_SSHPort(t *testing.T) {
|
||||
c := testConfig()
|
||||
c.Comm.SSHPort = 0
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
if c.Comm.SSHPort != 22 {
|
||||
t.Fatalf("invalid value: %d", c.Comm.SSHPort)
|
||||
}
|
||||
|
||||
c.Comm.SSHPort = 44
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
if c.Comm.SSHPort != 44 {
|
||||
t.Fatalf("invalid value: %d", c.Comm.SSHPort)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunConfigPrepare_UserData(t *testing.T) {
|
||||
c := testConfig()
|
||||
tf, err := ioutil.TempFile("", "packer")
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
defer os.Remove(tf.Name())
|
||||
defer tf.Close()
|
||||
|
||||
c.UserData = "foo"
|
||||
c.UserDataFile = tf.Name()
|
||||
if err := c.Prepare(nil); len(err) != 1 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunConfigPrepare_UserDataFile(t *testing.T) {
|
||||
c := testConfig()
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
c.UserDataFile = "idontexistidontthink"
|
||||
if err := c.Prepare(nil); len(err) != 1 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
tf, err := ioutil.TempFile("", "packer")
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
defer os.Remove(tf.Name())
|
||||
defer tf.Close()
|
||||
|
||||
c.UserDataFile = tf.Name()
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunConfigPrepare_TemporaryKeyPairName(t *testing.T) {
|
||||
c := testConfig()
|
||||
c.Comm.SSHTemporaryKeyPairName = ""
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
if c.Comm.SSHTemporaryKeyPairName == "" {
|
||||
t.Fatal("keypair name is empty")
|
||||
}
|
||||
|
||||
c.Comm.SSHTemporaryKeyPairName = "ssh-key-123"
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
if c.Comm.SSHTemporaryKeyPairName != "ssh-key-123" {
|
||||
t.Fatal("keypair name does not match")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunConfigPrepare_SSHPrivateIp(t *testing.T) {
|
||||
c := testConfig()
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if c.SSHPrivateIp != false {
|
||||
t.Fatalf("invalid value, expected: %t, actul: %t", false, c.SSHPrivateIp)
|
||||
}
|
||||
c.SSHPrivateIp = true
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if c.SSHPrivateIp != true {
|
||||
t.Fatalf("invalid value, expected: %t, actul: %t", true, c.SSHPrivateIp)
|
||||
}
|
||||
c.SSHPrivateIp = false
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if c.SSHPrivateIp != false {
|
||||
t.Fatalf("invalid value, expected: %t, actul: %t", false, c.SSHPrivateIp)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunConfigPrepare_DisableStopInstance(t *testing.T) {
|
||||
c := testConfig()
|
||||
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if c.DisableStopInstance != false {
|
||||
t.Fatalf("invalid value, expected: %t, actul: %t", false, c.DisableStopInstance)
|
||||
}
|
||||
|
||||
c.DisableStopInstance = true
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if c.DisableStopInstance != true {
|
||||
t.Fatalf("invalid value, expected: %t, actul: %t", true, c.DisableStopInstance)
|
||||
}
|
||||
|
||||
c.DisableStopInstance = false
|
||||
if err := c.Prepare(nil); len(err) != 0 {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if c.DisableStopInstance != false {
|
||||
t.Fatalf("invalid value, expected: %t, actul: %t", false, c.DisableStopInstance)
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"variables": {
|
||||
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
|
||||
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
|
||||
},
|
||||
"builders": [{
|
||||
"type":"alicloud-ecs",
|
||||
"access_key":"{{user `access_key`}}",
|
||||
"secret_key":"{{user `secret_key`}}",
|
||||
"region":"cn-beijing",
|
||||
"image_name":"packer_basic",
|
||||
"source_image":"centos_7_03_64_20G_alibase_20170818.vhd",
|
||||
"ssh_username":"root",
|
||||
"instance_type":"ecs.n1.tiny",
|
||||
"internet_charge_type":"PayByTraffic",
|
||||
"io_optimized":"true"
|
||||
}],
|
||||
"provisioners": [{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"sleep 30",
|
||||
"yum install redis.x86_64 -y"
|
||||
]
|
||||
}]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"variables": {
|
||||
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
|
||||
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
|
||||
},
|
||||
"builders": [{
|
||||
"type":"alicloud-ecs",
|
||||
"access_key":"{{user `access_key`}}",
|
||||
"secret_key":"{{user `secret_key`}}",
|
||||
"region":"cn-beijing",
|
||||
"image_name":"packer_test",
|
||||
"source_image":"winsvr_64_dtcC_1809_en-us_40G_alibase_20190318.vhd",
|
||||
"instance_type":"ecs.n1.tiny",
|
||||
"io_optimized":"true",
|
||||
"internet_charge_type":"PayByTraffic",
|
||||
"image_force_delete":"true",
|
||||
"communicator": "winrm",
|
||||
"winrm_port": 5985,
|
||||
"winrm_username": "Administrator",
|
||||
"winrm_password": "Test1234",
|
||||
"user_data_file": "examples/alicloud/basic/winrm_enable_userdata.ps1"
|
||||
}],
|
||||
"provisioners": [{
|
||||
"type": "powershell",
|
||||
"inline": ["dir c:\\"]
|
||||
}]
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
"variables": {
|
||||
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
|
||||
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
|
||||
},
|
||||
"builders": [{
|
||||
"type":"alicloud-ecs",
|
||||
"access_key":"{{user `access_key`}}",
|
||||
"secret_key":"{{user `secret_key`}}",
|
||||
"region":"cn-beijing",
|
||||
"image_name":"packer_with_data_disk",
|
||||
"source_image":"centos_7_03_64_20G_alibase_20170818.vhd",
|
||||
"ssh_username":"root",
|
||||
"instance_type":"ecs.n1.tiny",
|
||||
"internet_charge_type":"PayByTraffic",
|
||||
"io_optimized":"true",
|
||||
"image_disk_mappings":[
|
||||
{
|
||||
"disk_name":"data1",
|
||||
"disk_size":20,
|
||||
"disk_delete_with_instance": true
|
||||
},{
|
||||
"disk_name":"data2",
|
||||
"disk_size":20,
|
||||
"disk_device":"/dev/xvdz",
|
||||
"disk_delete_with_instance": true
|
||||
}
|
||||
]
|
||||
}],
|
||||
"provisioners": [{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"sleep 30",
|
||||
"yum install redis.x86_64 -y"
|
||||
]
|
||||
}]
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
#powershell
|
||||
write-output "Running User Data Script"
|
||||
write-host "(host) Running User Data Script"
|
||||
Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force -ErrorAction Ignore
|
||||
# Don't set this before Set-ExecutionPolicy as it throws an error
|
||||
$ErrorActionPreference = "stop"
|
||||
# Remove HTTP listener
|
||||
Remove-Item -Path WSMan:\Localhost\listener\listener* -Recurse
|
||||
# WinRM
|
||||
write-output "Setting up WinRM"
|
||||
write-host "(host) setting up WinRM"
|
||||
cmd.exe /c winrm quickconfig -q
|
||||
cmd.exe /c winrm quickconfig '-transport:http'
|
||||
cmd.exe /c winrm set "winrm/config" '@{MaxTimeoutms="1800000"}'
|
||||
cmd.exe /c winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="10240"}'
|
||||
cmd.exe /c winrm set "winrm/config/service" '@{AllowUnencrypted="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/client" '@{AllowUnencrypted="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/service/auth" '@{Basic="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/client/auth" '@{Basic="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/service/auth" '@{CredSSP="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/listener?Address=*+Transport=HTTP" '@{Port="5985"}'
|
||||
cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes
|
||||
cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985"
|
||||
cmd.exe /c net stop winrm
|
||||
cmd.exe /c sc config winrm start= auto
|
||||
cmd.exe /c net start winrm
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"variables": {
|
||||
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
|
||||
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
|
||||
},
|
||||
"builders": [{
|
||||
"type":"alicloud-ecs",
|
||||
"access_key":"{{user `access_key`}}",
|
||||
"secret_key":"{{user `secret_key`}}",
|
||||
"region":"cn-beijing",
|
||||
"image_name":"packer_chef2",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190223.vhd",
|
||||
"ssh_username":"root",
|
||||
"instance_type":"ecs.n1.medium",
|
||||
"io_optimized":"true",
|
||||
"image_force_delete":"true",
|
||||
"internet_charge_type":"PayByTraffic",
|
||||
"ssh_password":"Test1234",
|
||||
"user_data_file":"examples/alicloud/chef/user_data.sh"
|
||||
}],
|
||||
"provisioners": [{
|
||||
"type": "file",
|
||||
"source": "examples/alicloud/chef/chef.sh",
|
||||
"destination": "/root/"
|
||||
},{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"cd /root/",
|
||||
"chmod 755 chef.sh",
|
||||
"./chef.sh",
|
||||
"chef-server-ctl reconfigure"
|
||||
]
|
||||
}]
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
#!/bin/sh
|
||||
#if the related deb pkg not found, please replace with it other available repository url
|
||||
HOSTNAME=`ifconfig eth1|grep 'inet addr'|cut -d ":" -f2|cut -d " " -f1`
|
||||
if [ not $HOSTNAME ] ; then
|
||||
HOSTNAME=`ifconfig eth0|grep 'inet addr'|cut -d ":" -f2|cut -d " " -f1`
|
||||
fi
|
||||
CHEF_SERVER_URL='http://dubbo.oss-cn-shenzhen.aliyuncs.com/chef-server-core_12.8.0-1_amd64.deb'
|
||||
CHEF_CONSOLE_URL='http://dubbo.oss-cn-shenzhen.aliyuncs.com/chef-manage_2.4.3-1_amd64.deb'
|
||||
CHEF_SERVER_ADMIN='admin'
|
||||
CHEF_SERVER_ADMIN_PASSWORD='vmADMIN123'
|
||||
ORGANIZATION='aliyun'
|
||||
ORGANIZATION_FULL_NAME='Aliyun, Inc'
|
||||
#specify hostname
|
||||
hostname $HOSTNAME
|
||||
|
||||
mkdir ~/.pemfile
|
||||
#install chef server
|
||||
wget $CHEF_SERVER_URL
|
||||
sudo dpkg -i chef-server-core_*.deb
|
||||
sudo chef-server-ctl reconfigure
|
||||
|
||||
#create admin user
|
||||
sudo chef-server-ctl user-create $CHEF_SERVER_ADMIN $CHEF_SERVER_ADMIN $CHEF_SERVER_ADMIN 641002259@qq.com $CHEF_SERVER_ADMIN_PASSWORD -f ~/.pemfile/admin.pem
|
||||
|
||||
#create aliyun organization
|
||||
sudo chef-server-ctl org-create $ORGANIZATION $ORGANIZATION_FULL_NAME --association_user $CHEF_SERVER_ADMIN -f ~/.pemfile/aliyun-validator.pem
|
||||
|
||||
#install chef management console
|
||||
wget $CHEF_CONSOLE_URL
|
||||
sudo dpkg -i chef-manage_*.deb
|
||||
sudo chef-server-ctl reconfigure
|
||||
|
||||
type expect >/dev/null 2>&1 || { echo >&2 "Install Expect..."; apt-get -y install expect; }
|
||||
echo "spawn sudo chef-manage-ctl reconfigure" >> chef-manage-confirm.exp
|
||||
echo "expect \"*Press any key to continue\"" >> chef-manage-confirm.exp
|
||||
echo "send \"a\\\n\"" >> chef-manage-confirm.exp
|
||||
echo "expect \".*chef-manage 2.4.3 license: \\\"Chef-MLSA\\\".*\"" >> chef-manage-confirm.exp
|
||||
echo "send \"q\"" >> chef-manage-confirm.exp
|
||||
echo "expect \".*Type 'yes' to accept the software license agreement, or anything else to cancel.\"" >> chef-manage-confirm.exp
|
||||
echo "send \"yes\\\n\"" >> chef-manage-confirm.exp
|
||||
echo "interact" >> chef-manage-confirm.exp
|
||||
expect chef-manage-confirm.exp
|
||||
rm -f chef-manage-confirm.exp
|
||||
|
||||
#clean
|
||||
rm -rf chef-manage_2.4.3-1_amd64.deb
|
||||
rm -rf chef-server-core_12.8.0-1_amd64.deb
|
|
@ -1,6 +0,0 @@
|
|||
HOSTNAME=`ifconfig eth1|grep 'inet addr'|cut -d ":" -f2|cut -d " " -f1`
|
||||
if [ not $HOSTNAME ] ; then
|
||||
HOSTNAME=`ifconfig eth0|grep 'inet addr'|cut -d ":" -f2|cut -d " " -f1`
|
||||
fi
|
||||
hostname $HOSTNAME
|
||||
chef-server-ctl reconfigure
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"variables": {
|
||||
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
|
||||
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
|
||||
},
|
||||
"builders": [{
|
||||
"type":"alicloud-ecs",
|
||||
"access_key":"{{user `access_key`}}",
|
||||
"secret_key":"{{user `secret_key`}}",
|
||||
"region":"cn-beijing",
|
||||
"image_name":"packer_jenkins",
|
||||
"source_image":"ubuntu_18_04_64_20G_alibase_20190223.vhd",
|
||||
"ssh_username":"root",
|
||||
"instance_type":"ecs.n1.medium",
|
||||
"io_optimized":"true",
|
||||
"internet_charge_type":"PayByTraffic",
|
||||
"image_force_delete":"true",
|
||||
"ssh_password":"Test12345"
|
||||
}],
|
||||
"provisioners": [{
|
||||
"type": "file",
|
||||
"source": "examples/alicloud/jenkins/jenkins.sh",
|
||||
"destination": "/root/"
|
||||
},{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"cd /root/",
|
||||
"chmod 755 jenkins.sh",
|
||||
"./jenkins.sh"
|
||||
]
|
||||
}]
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
JENKINS_URL='http://mirrors.jenkins.io/war-stable/2.32.2/jenkins.war'
|
||||
|
||||
TOMCAT_VERSION='7.0.77'
|
||||
TOMCAT_NAME="apache-tomcat-$TOMCAT_VERSION"
|
||||
TOMCAT_PACKAGE="$TOMCAT_NAME.tar.gz"
|
||||
TOMCAT_URL="http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v$TOMCAT_VERSION/bin/$TOMCAT_PACKAGE"
|
||||
TOMCAT_PATH="/opt/$TOMCAT_NAME"
|
||||
|
||||
#install jdk
|
||||
if grep -Eqi "Ubuntu|Debian|Raspbian" /etc/issue || grep -Eq "Ubuntu|Debian|Raspbian" /etc/*-release; then
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y openjdk-7-jdk
|
||||
elif grep -Eqi "CentOS|Fedora|Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "CentOS|Fedora|Red Hat Enterprise Linux Server" /etc/*-release; then
|
||||
sudo yum update -y
|
||||
sudo yum install -y openjdk-7-jdk
|
||||
else
|
||||
echo "Unknown OS type."
|
||||
fi
|
||||
|
||||
#install jenkins server
|
||||
mkdir ~/work
|
||||
cd ~/work
|
||||
|
||||
#install tomcat
|
||||
wget $TOMCAT_URL
|
||||
tar -zxvf $TOMCAT_PACKAGE
|
||||
mv $TOMCAT_NAME /opt
|
||||
|
||||
#install
|
||||
wget $JENKINS_URL
|
||||
mv jenkins.war $TOMCAT_PATH/webapps/
|
||||
|
||||
#set environment
|
||||
echo "TOMCAT_PATH=\"$TOMCAT_PATH\"">>/etc/profile
|
||||
echo "JENKINS_HOME=\"$TOMCAT_PATH/webapps/jenkins\"">>/etc/profile
|
||||
echo PATH="\"\$PATH:\$TOMCAT_PATH:\$JENKINS_HOME\"">>/etc/profile
|
||||
. /etc/profile
|
||||
|
||||
#start tomcat & jenkins
|
||||
$TOMCAT_PATH/bin/startup.sh
|
||||
|
||||
#set start on boot
|
||||
sed -i "/#!\/bin\/sh/a$TOMCAT_PATH/bin/startup.sh" /etc/rc.local
|
||||
|
||||
#clean
|
||||
rm -rf ~/work
|
|
@ -1,59 +0,0 @@
|
|||
{"variables": {
|
||||
"box_basename": "centos-6.8",
|
||||
"build_timestamp": "{{isotime \"20060102150405\"}}",
|
||||
"cpus": "1",
|
||||
"disk_size": "4096",
|
||||
"git_revision": "__unknown_git_revision__",
|
||||
"headless": "",
|
||||
"http_proxy": "{{env `http_proxy`}}",
|
||||
"https_proxy": "{{env `https_proxy`}}",
|
||||
"iso_checksum": "md5:0ca12fe5f28c2ceed4f4084b41ff8a0b",
|
||||
"iso_name": "CentOS-6.8-x86_64-minimal.iso",
|
||||
"ks_path": "centos-6.8/ks.cfg",
|
||||
"memory": "512",
|
||||
"metadata": "floppy/dummy_metadata.json",
|
||||
"mirror": "http://mirrors.aliyun.com/centos",
|
||||
"mirror_directory": "6.8/isos/x86_64",
|
||||
"name": "centos-6.8",
|
||||
"no_proxy": "{{env `no_proxy`}}",
|
||||
"template": "centos-6.8-x86_64",
|
||||
"version": "2.1.TIMESTAMP"
|
||||
},
|
||||
"builders":[
|
||||
{
|
||||
"boot_command": [
|
||||
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}<enter><wait>"
|
||||
],
|
||||
"boot_wait": "10s",
|
||||
"disk_size": "{{user `disk_size`}}",
|
||||
"headless": "{{ user `headless` }}",
|
||||
"http_directory": "http",
|
||||
"iso_checksum": "{{user `iso_checksum`}}",
|
||||
"iso_checksum_type": "{{user `iso_checksum_type`}}",
|
||||
"iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}",
|
||||
"output_directory": "packer-{{user `template`}}-qemu",
|
||||
"shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
|
||||
"ssh_password": "vagrant",
|
||||
"ssh_port": 22,
|
||||
"ssh_username": "root",
|
||||
"ssh_timeout": "10000s",
|
||||
"type": "qemu",
|
||||
"vm_name": "{{ user `template` }}.raw",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"format": "raw"
|
||||
}
|
||||
],
|
||||
"post-processors":[
|
||||
{
|
||||
"type":"alicloud-import",
|
||||
"oss_bucket_name": "packer",
|
||||
"image_name": "packer_import",
|
||||
"image_os_type": "linux",
|
||||
"image_platform": "CentOS",
|
||||
"image_architecture": "x86_64",
|
||||
"image_system_size": "40",
|
||||
"region":"cn-beijing"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
install
|
||||
cdrom
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
network --bootproto=dhcp
|
||||
rootpw vagrant
|
||||
firewall --disabled
|
||||
selinux --permissive
|
||||
timezone UTC
|
||||
unsupported_hardware
|
||||
bootloader --location=mbr
|
||||
text
|
||||
skipx
|
||||
zerombr
|
||||
clearpart --all --initlabel
|
||||
autopart
|
||||
auth --enableshadow --passalgo=sha512 --kickstart
|
||||
firstboot --disabled
|
||||
reboot
|
||||
user --name=vagrant --plaintext --password vagrant
|
||||
key --skip
|
||||
|
||||
%packages --nobase --ignoremissing --excludedocs
|
||||
# vagrant needs this to copy initial files via scp
|
||||
openssh-clients
|
||||
sudo
|
||||
kernel-headers
|
||||
kernel-devel
|
||||
gcc
|
||||
make
|
||||
perl
|
||||
wget
|
||||
nfs-utils
|
||||
-fprintd-pam
|
||||
-intltool
|
||||
|
||||
# unnecessary firmware
|
||||
-aic94xx-firmware
|
||||
-atmel-firmware
|
||||
-b43-openfwwf
|
||||
-bfa-firmware
|
||||
-ipw2100-firmware
|
||||
-ipw2200-firmware
|
||||
-ivtv-firmware
|
||||
-iwl100-firmware
|
||||
-iwl1000-firmware
|
||||
-iwl3945-firmware
|
||||
-iwl4965-firmware
|
||||
-iwl5000-firmware
|
||||
-iwl5150-firmware
|
||||
-iwl6000-firmware
|
||||
-iwl6000g2a-firmware
|
||||
-iwl6050-firmware
|
||||
-libertas-usb8388-firmware
|
||||
-ql2100-firmware
|
||||
-ql2200-firmware
|
||||
-ql23xx-firmware
|
||||
-ql2400-firmware
|
||||
-ql2500-firmware
|
||||
-rt61pci-firmware
|
||||
-rt73usb-firmware
|
||||
-xorg-x11-drv-ati-firmware
|
||||
-zd1211-firmware
|
||||
|
||||
%post
|
||||
# Force to set SELinux to a permissive mode
|
||||
sed -i -e 's/\(^SELINUX=\).*$/\1permissive/' /etc/selinux/config
|
||||
# sudo
|
||||
echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
|
|
@ -1,13 +0,0 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer-plugin-sdk/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var AlicloudPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
AlicloudPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -13,7 +13,6 @@ import (
|
|||
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
|
||||
"github.com/hashicorp/packer-plugin-sdk/plugin"
|
||||
|
||||
alicloudecsbuilder "github.com/hashicorp/packer/builder/alicloud/ecs"
|
||||
azurearmbuilder "github.com/hashicorp/packer/builder/azure/arm"
|
||||
azurechrootbuilder "github.com/hashicorp/packer/builder/azure/chroot"
|
||||
azuredtlbuilder "github.com/hashicorp/packer/builder/azure/dtl"
|
||||
|
@ -39,7 +38,6 @@ import (
|
|||
uclouduhostbuilder "github.com/hashicorp/packer/builder/ucloud/uhost"
|
||||
vagrantbuilder "github.com/hashicorp/packer/builder/vagrant"
|
||||
yandexbuilder "github.com/hashicorp/packer/builder/yandex"
|
||||
alicloudimportpostprocessor "github.com/hashicorp/packer/post-processor/alicloud-import"
|
||||
artificepostprocessor "github.com/hashicorp/packer/post-processor/artifice"
|
||||
checksumpostprocessor "github.com/hashicorp/packer/post-processor/checksum"
|
||||
compresspostprocessor "github.com/hashicorp/packer/post-processor/compress"
|
||||
|
@ -74,7 +72,6 @@ type PluginCommand struct {
|
|||
}
|
||||
|
||||
var Builders = map[string]packersdk.Builder{
|
||||
"alicloud-ecs": new(alicloudecsbuilder.Builder),
|
||||
"azure-arm": new(azurearmbuilder.Builder),
|
||||
"azure-chroot": new(azurechrootbuilder.Builder),
|
||||
"azure-dtl": new(azuredtlbuilder.Builder),
|
||||
|
@ -122,7 +119,6 @@ var Provisioners = map[string]packersdk.Provisioner{
|
|||
}
|
||||
|
||||
var PostProcessors = map[string]packersdk.PostProcessor{
|
||||
"alicloud-import": new(alicloudimportpostprocessor.PostProcessor),
|
||||
"artifice": new(artificepostprocessor.PostProcessor),
|
||||
"checksum": new(checksumpostprocessor.PostProcessor),
|
||||
"compress": new(compresspostprocessor.PostProcessor),
|
||||
|
|
|
@ -7,6 +7,8 @@ import (
|
|||
// still vendored with Packer for now. Importing as library instead of
|
||||
// forcing use of packer init, until packer v1.8.0
|
||||
exoscaleimportpostprocessor "github.com/exoscale/packer-plugin-exoscale/post-processor/exoscale-import"
|
||||
alicloudecsbuilder "github.com/hashicorp/packer-plugin-alicloud/builder/ecs"
|
||||
alicloudimportpostprocessor "github.com/hashicorp/packer-plugin-alicloud/post-processor/alicloud-import"
|
||||
amazonchrootbuilder "github.com/hashicorp/packer-plugin-amazon/builder/chroot"
|
||||
amazonebsbuilder "github.com/hashicorp/packer-plugin-amazon/builder/ebs"
|
||||
amazonebssurrogatebuilder "github.com/hashicorp/packer-plugin-amazon/builder/ebssurrogate"
|
||||
|
@ -57,6 +59,7 @@ var VendoredDatasources = map[string]packersdk.Datasource{
|
|||
// VendoredBuilders are builder components that were once bundled with the
|
||||
// Packer core, but are now being imported from their counterpart plugin repos
|
||||
var VendoredBuilders = map[string]packersdk.Builder{
|
||||
"alicloud-ecs": new(alicloudecsbuilder.Builder),
|
||||
"amazon-ebs": new(amazonebsbuilder.Builder),
|
||||
"amazon-chroot": new(amazonchrootbuilder.Builder),
|
||||
"amazon-ebssurrogate": new(amazonebssurrogatebuilder.Builder),
|
||||
|
@ -95,6 +98,7 @@ var VendoredProvisioners = map[string]packersdk.Provisioner{
|
|||
// VendoredPostProcessors are post-processor components that were once bundled with the
|
||||
// Packer core, but are now being imported from their counterpart plugin repos
|
||||
var VendoredPostProcessors = map[string]packersdk.PostProcessor{
|
||||
"alicloud-import": new(alicloudimportpostprocessor.PostProcessor),
|
||||
"amazon-import": new(anazibimportpostprocessor.PostProcessor),
|
||||
"docker-import": new(dockerimportpostprocessor.PostProcessor),
|
||||
"docker-push": new(dockerpushpostprocessor.PostProcessor),
|
||||
|
|
3
go.mod
3
go.mod
|
@ -9,8 +9,6 @@ require (
|
|||
github.com/Azure/go-autorest/autorest/azure/cli v0.3.1
|
||||
github.com/Azure/go-autorest/autorest/date v0.2.0
|
||||
github.com/Azure/go-autorest/autorest/to v0.3.0
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190418113227-25233c783f4e
|
||||
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f
|
||||
github.com/approvals/go-approval-tests v0.0.0-20160714161514-ad96e53bea43
|
||||
github.com/aws/aws-sdk-go v1.38.22
|
||||
github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3
|
||||
|
@ -41,6 +39,7 @@ require (
|
|||
github.com/hashicorp/go-uuid v1.0.2
|
||||
github.com/hashicorp/go-version v1.3.0
|
||||
github.com/hashicorp/hcl/v2 v2.9.1
|
||||
github.com/hashicorp/packer-plugin-alicloud v0.0.2
|
||||
github.com/hashicorp/packer-plugin-amazon v0.0.1
|
||||
github.com/hashicorp/packer-plugin-ansible v0.0.2
|
||||
github.com/hashicorp/packer-plugin-docker v0.0.7
|
||||
|
|
14
go.sum
14
go.sum
|
@ -97,10 +97,12 @@ github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af h1:DBNMBMuMiWYu0b+8KM
|
|||
github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw=
|
||||
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
|
||||
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190418113227-25233c783f4e h1:/8wOj52pewmIX/8d5eVO3t7Rr3astkBI/ruyg4WNqRo=
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190418113227-25233c783f4e/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA=
|
||||
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f h1:jI4DIE5Vf4oRaHfthB0oRhU+yuYuoOTurDzwAlskP00=
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1028 h1:lBif3zUMR6sjgfONVqfnjjjdXIK09S4Lvkze20ApE8w=
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1028/go.mod h1:pUKYbK5JQ+1Dfxk80P0qxGqe5dkxDoabbZS7zOcouyA=
|
||||
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible h1:hLUNPbx10wawWW7DeNExvTrlb90db3UnnNTFKHZEFhE=
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
|
||||
github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk=
|
||||
github.com/antchfx/xpath v1.1.11 h1:WOFtK8TVAjLm3lbgqeP0arlHpvCEeTANeWZ/csPpJkQ=
|
||||
github.com/antchfx/xpath v1.1.11/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
||||
|
@ -160,6 +162,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.1.2 h1:7Kxqov7uQeP8WUEO0iHz3j9Bh0E1r
|
|||
github.com/aws/aws-sdk-go-v2/service/sts v1.1.2/go.mod h1:zu7rotIY9P4Aoc6ytqLP9jeYrECDHUODB5Gbp+BSHl8=
|
||||
github.com/aws/smithy-go v1.2.0 h1:0PoGBWXkXDIyVdPaZW9gMhaGzj3UOAgTdiVoHuuZAFA=
|
||||
github.com/aws/smithy-go v1.2.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
|
||||
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA=
|
||||
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=
|
||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
|
||||
|
@ -269,6 +273,7 @@ github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx
|
|||
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=
|
||||
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 h1:zN2lZNZRflqFyxVaTIU61KNKQ9C0055u9CAfpmqUvo4=
|
||||
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3/go.mod h1:nPpo7qLxd6XL3hWJG/O60sR8ZKfMCiIoNap5GvD12KU=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
|
@ -457,6 +462,8 @@ github.com/hashicorp/packer v1.6.7-0.20210217093213-201869d627bf/go.mod h1:+EWPP
|
|||
github.com/hashicorp/packer v1.7.0/go.mod h1:3KRJcwOctl2JaAGpQMI1bWQRArfWNWqcYjO6AOsVVGQ=
|
||||
github.com/hashicorp/packer v1.7.1/go.mod h1:ApnmMINvuhhnfPyTVqZu6jznDWPVYDJUw7e188DFCmo=
|
||||
github.com/hashicorp/packer v1.7.2/go.mod h1:c/QB/DWK5fSdtNWrTb9etWacmbm01UY23ZILpGundCY=
|
||||
github.com/hashicorp/packer-plugin-alicloud v0.0.2 h1:uBVp53+yOfzbhUjC8WtQ/7uLcfrpboykaNNBxFVkQw4=
|
||||
github.com/hashicorp/packer-plugin-alicloud v0.0.2/go.mod h1:RCU4CLSJwSqHoNLlA+UghRw1JXqqzCPOE6Pv/EYjtgU=
|
||||
github.com/hashicorp/packer-plugin-amazon v0.0.1 h1:EuyjNK9bL7WhQeIJzhBJxOx8nyc61ai5UbOsb1PIVwI=
|
||||
github.com/hashicorp/packer-plugin-amazon v0.0.1/go.mod h1:12c9msibyHdId+Mk/pCbdRb1KaLIhaNyxeJ6n8bZt30=
|
||||
github.com/hashicorp/packer-plugin-ansible v0.0.2 h1:nvBtCedXhUI5T6Up5+bmhlY7rmk8FjWuFv9A2joK7TU=
|
||||
|
@ -490,6 +497,7 @@ github.com/hashicorp/packer-plugin-sdk v0.1.1/go.mod h1:1d3nqB9LUsXMQaNUiL67Q+WY
|
|||
github.com/hashicorp/packer-plugin-sdk v0.1.2/go.mod h1:KRjczE1/c9NV5Re+PXt3myJsVTI/FxEHpZjRjOH0Fug=
|
||||
github.com/hashicorp/packer-plugin-sdk v0.1.3-0.20210407232143-c217d82aefb6/go.mod h1:xePpgQgQYv/bamiypx3hH9ukidxDdcN8q0R0wLi8IEQ=
|
||||
github.com/hashicorp/packer-plugin-sdk v0.1.3/go.mod h1:xePpgQgQYv/bamiypx3hH9ukidxDdcN8q0R0wLi8IEQ=
|
||||
github.com/hashicorp/packer-plugin-sdk v0.1.4/go.mod h1:xePpgQgQYv/bamiypx3hH9ukidxDdcN8q0R0wLi8IEQ=
|
||||
github.com/hashicorp/packer-plugin-sdk v0.2.0 h1:A4Dq7p4y1vscY4gMzp7GQaXyDJYYhP4ukp4fapPSOY4=
|
||||
github.com/hashicorp/packer-plugin-sdk v0.2.0/go.mod h1:0DiOMEBldmB0HEhp0npFSSygC8bIvW43pphEgWkp2WU=
|
||||
github.com/hashicorp/packer-plugin-virtualbox v0.0.1 h1:vTfy7a10RUVMdNnDLo0EQrCVbAG4rGWkaDTMC7MVBi4=
|
||||
|
@ -530,6 +538,7 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw
|
|||
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
||||
github.com/joyent/triton-go v0.0.0-20180628001255-830d2b111e62 h1:JHCT6xuyPUrbbgAPE/3dqlvUKzRHMNuTBKKUb6OeR/k=
|
||||
github.com/joyent/triton-go v0.0.0-20180628001255-830d2b111e62/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA=
|
||||
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
|
@ -709,6 +718,7 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
|
|||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer-plugin-sdk/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var AlicloudImportPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
AlicloudImportPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -186,7 +186,7 @@
|
|||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -0,0 +1,249 @@
|
|||
package sdk
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var apiTimeouts = `{
|
||||
"ecs": {
|
||||
"ActivateRouterInterface": 10,
|
||||
"AddTags": 61,
|
||||
"AllocateDedicatedHosts": 10,
|
||||
"AllocateEipAddress": 17,
|
||||
"AllocatePublicIpAddress": 36,
|
||||
"ApplyAutoSnapshotPolicy": 10,
|
||||
"AssignIpv6Addresses": 10,
|
||||
"AssignPrivateIpAddresses": 10,
|
||||
"AssociateEipAddress": 17,
|
||||
"AttachClassicLinkVpc": 14,
|
||||
"AttachDisk": 36,
|
||||
"AttachInstanceRamRole": 11,
|
||||
"AttachKeyPair": 16,
|
||||
"AttachNetworkInterface": 16,
|
||||
"AuthorizeSecurityGroupEgress": 16,
|
||||
"AuthorizeSecurityGroup": 16,
|
||||
"CancelAutoSnapshotPolicy": 10,
|
||||
"CancelCopyImage": 10,
|
||||
"CancelPhysicalConnection": 10,
|
||||
"CancelSimulatedSystemEvents": 10,
|
||||
"CancelTask": 10,
|
||||
"ConnectRouterInterface": 10,
|
||||
"ConvertNatPublicIpToEip": 12,
|
||||
"CopyImage": 10,
|
||||
"CreateAutoSnapshotPolicy": 10,
|
||||
"CreateCommand": 16,
|
||||
"CreateDeploymentSet": 16,
|
||||
"CreateDisk": 36,
|
||||
"CreateHpcCluster": 10,
|
||||
"CreateImage": 36,
|
||||
"CreateInstance": 86,
|
||||
"CreateKeyPair": 10,
|
||||
"CreateLaunchTemplate": 10,
|
||||
"CreateLaunchTemplateVersion": 10,
|
||||
"CreateNatGateway": 36,
|
||||
"CreateNetworkInterfacePermission": 13,
|
||||
"CreateNetworkInterface": 16,
|
||||
"CreatePhysicalConnection": 10,
|
||||
"CreateRouteEntry": 17,
|
||||
"CreateRouterInterface": 10,
|
||||
"CreateSecurityGroup": 86,
|
||||
"CreateSimulatedSystemEvents": 10,
|
||||
"CreateSnapshot": 86,
|
||||
"CreateVirtualBorderRouter": 10,
|
||||
"CreateVpc": 16,
|
||||
"CreateVSwitch": 17,
|
||||
"DeactivateRouterInterface": 10,
|
||||
"DeleteAutoSnapshotPolicy": 10,
|
||||
"DeleteBandwidthPackage": 10,
|
||||
"DeleteCommand": 16,
|
||||
"DeleteDeploymentSet": 12,
|
||||
"DeleteDisk": 16,
|
||||
"DeleteHpcCluster": 10,
|
||||
"DeleteImage": 36,
|
||||
"DeleteInstance": 66,
|
||||
"DeleteKeyPairs": 10,
|
||||
"DeleteLaunchTemplate": 10,
|
||||
"DeleteLaunchTemplateVersion": 10,
|
||||
"DeleteNatGateway": 10,
|
||||
"DeleteNetworkInterfacePermission": 10,
|
||||
"DeleteNetworkInterface": 16,
|
||||
"DeletePhysicalConnection": 10,
|
||||
"DeleteRouteEntry": 16,
|
||||
"DeleteRouterInterface": 10,
|
||||
"DeleteSecurityGroup": 87,
|
||||
"DeleteSnapshot": 17,
|
||||
"DeleteVirtualBorderRouter": 10,
|
||||
"DeleteVpc": 17,
|
||||
"DeleteVSwitch": 17,
|
||||
"DescribeAccessPoints": 10,
|
||||
"DescribeAccountAttributes": 10,
|
||||
"DescribeAutoSnapshotPolicyEx": 16,
|
||||
"DescribeAvailableResource": 10,
|
||||
"DescribeBandwidthLimitation": 16,
|
||||
"DescribeBandwidthPackages": 10,
|
||||
"DescribeClassicLinkInstances": 15,
|
||||
"DescribeCloudAssistantStatus": 16,
|
||||
"DescribeClusters": 10,
|
||||
"DescribeCommands": 16,
|
||||
"DescribeDedicatedHosts": 10,
|
||||
"DescribeDedicatedHostTypes": 10,
|
||||
"DescribeDeploymentSets": 26,
|
||||
"DescribeDiskMonitorData": 16,
|
||||
"DescribeDisksFullStatus": 14,
|
||||
"DescribeDisks": 19,
|
||||
"DescribeEipAddresses": 16,
|
||||
"DescribeEipMonitorData": 16,
|
||||
"DescribeEniMonitorData": 10,
|
||||
"DescribeHaVips": 10,
|
||||
"DescribeHpcClusters": 16,
|
||||
"DescribeImageSharePermission": 10,
|
||||
"DescribeImages": 38,
|
||||
"DescribeImageSupportInstanceTypes": 16,
|
||||
"DescribeInstanceAttribute": 36,
|
||||
"DescribeInstanceAutoRenewAttribute": 17,
|
||||
"DescribeInstanceHistoryEvents": 19,
|
||||
"DescribeInstanceMonitorData": 19,
|
||||
"DescribeInstancePhysicalAttribute": 10,
|
||||
"DescribeInstanceRamRole": 11,
|
||||
"DescribeInstancesFullStatus": 14,
|
||||
"DescribeInstances": 10,
|
||||
"DescribeInstanceStatus": 26,
|
||||
"DescribeInstanceTopology": 12,
|
||||
"DescribeInstanceTypeFamilies": 17,
|
||||
"DescribeInstanceTypes": 17,
|
||||
"DescribeInstanceVncPasswd": 10,
|
||||
"DescribeInstanceVncUrl": 36,
|
||||
"DescribeInvocationResults": 16,
|
||||
"DescribeInvocations": 16,
|
||||
"DescribeKeyPairs": 12,
|
||||
"DescribeLaunchTemplates": 16,
|
||||
"DescribeLaunchTemplateVersions": 16,
|
||||
"DescribeLimitation": 36,
|
||||
"DescribeNatGateways": 10,
|
||||
"DescribeNetworkInterfacePermissions": 13,
|
||||
"DescribeNetworkInterfaces": 16,
|
||||
"DescribeNewProjectEipMonitorData": 16,
|
||||
"DescribePhysicalConnections": 10,
|
||||
"DescribePrice": 16,
|
||||
"DescribeRecommendInstanceType": 10,
|
||||
"DescribeRegions": 19,
|
||||
"DescribeRenewalPrice": 16,
|
||||
"DescribeResourceByTags": 10,
|
||||
"DescribeResourcesModification": 17,
|
||||
"DescribeRouterInterfaces": 10,
|
||||
"DescribeRouteTables": 17,
|
||||
"DescribeSecurityGroupAttribute": 133,
|
||||
"DescribeSecurityGroupReferences": 16,
|
||||
"DescribeSecurityGroups": 25,
|
||||
"DescribeSnapshotLinks": 17,
|
||||
"DescribeSnapshotMonitorData": 12,
|
||||
"DescribeSnapshotPackage": 10,
|
||||
"DescribeSnapshots": 26,
|
||||
"DescribeSnapshotsUsage": 26,
|
||||
"DescribeSpotPriceHistory": 22,
|
||||
"DescribeTags": 17,
|
||||
"DescribeTaskAttribute": 10,
|
||||
"DescribeTasks": 11,
|
||||
"DescribeUserBusinessBehavior": 13,
|
||||
"DescribeUserData": 10,
|
||||
"DescribeVirtualBorderRoutersForPhysicalConnection": 10,
|
||||
"DescribeVirtualBorderRouters": 10,
|
||||
"DescribeVpcs": 41,
|
||||
"DescribeVRouters": 17,
|
||||
"DescribeVSwitches": 17,
|
||||
"DescribeZones": 103,
|
||||
"DetachClassicLinkVpc": 14,
|
||||
"DetachDisk": 17,
|
||||
"DetachInstanceRamRole": 10,
|
||||
"DetachKeyPair": 10,
|
||||
"DetachNetworkInterface": 16,
|
||||
"EipFillParams": 19,
|
||||
"EipFillProduct": 13,
|
||||
"EipNotifyPaid": 10,
|
||||
"EnablePhysicalConnection": 10,
|
||||
"ExportImage": 10,
|
||||
"GetInstanceConsoleOutput": 14,
|
||||
"GetInstanceScreenshot": 14,
|
||||
"ImportImage": 29,
|
||||
"ImportKeyPair": 10,
|
||||
"InstallCloudAssistant": 10,
|
||||
"InvokeCommand": 16,
|
||||
"JoinResourceGroup": 10,
|
||||
"JoinSecurityGroup": 66,
|
||||
"LeaveSecurityGroup": 66,
|
||||
"ModifyAutoSnapshotPolicyEx": 10,
|
||||
"ModifyBandwidthPackageSpec": 11,
|
||||
"ModifyCommand": 10,
|
||||
"ModifyDeploymentSetAttribute": 10,
|
||||
"ModifyDiskAttribute": 16,
|
||||
"ModifyDiskChargeType": 13,
|
||||
"ModifyEipAddressAttribute": 14,
|
||||
"ModifyImageAttribute": 10,
|
||||
"ModifyImageSharePermission": 16,
|
||||
"ModifyInstanceAttribute": 22,
|
||||
"ModifyInstanceAutoReleaseTime": 15,
|
||||
"ModifyInstanceAutoRenewAttribute": 16,
|
||||
"ModifyInstanceChargeType": 22,
|
||||
"ModifyInstanceDeployment": 10,
|
||||
"ModifyInstanceNetworkSpec": 36,
|
||||
"ModifyInstanceSpec": 62,
|
||||
"ModifyInstanceVncPasswd": 35,
|
||||
"ModifyInstanceVpcAttribute": 15,
|
||||
"ModifyLaunchTemplateDefaultVersion": 10,
|
||||
"ModifyNetworkInterfaceAttribute": 10,
|
||||
"ModifyPhysicalConnectionAttribute": 10,
|
||||
"ModifyPrepayInstanceSpec": 13,
|
||||
"ModifyRouterInterfaceAttribute": 10,
|
||||
"ModifySecurityGroupAttribute": 10,
|
||||
"ModifySecurityGroupEgressRule": 10,
|
||||
"ModifySecurityGroupPolicy": 10,
|
||||
"ModifySecurityGroupRule": 16,
|
||||
"ModifySnapshotAttribute": 10,
|
||||
"ModifyUserBusinessBehavior": 10,
|
||||
"ModifyVirtualBorderRouterAttribute": 10,
|
||||
"ModifyVpcAttribute": 10,
|
||||
"ModifyVRouterAttribute": 10,
|
||||
"ModifyVSwitchAttribute": 10,
|
||||
"ReActivateInstances": 10,
|
||||
"RebootInstance": 27,
|
||||
"RedeployInstance": 14,
|
||||
"ReInitDisk": 16,
|
||||
"ReleaseDedicatedHost": 10,
|
||||
"ReleaseEipAddress": 16,
|
||||
"ReleasePublicIpAddress": 10,
|
||||
"RemoveTags": 10,
|
||||
"RenewInstance": 19,
|
||||
"ReplaceSystemDisk": 36,
|
||||
"ResetDisk": 36,
|
||||
"ResizeDisk": 11,
|
||||
"RevokeSecurityGroupEgress": 13,
|
||||
"RevokeSecurityGroup": 16,
|
||||
"RunInstances": 86,
|
||||
"StartInstance": 46,
|
||||
"StopInstance": 27,
|
||||
"StopInvocation": 10,
|
||||
"TerminatePhysicalConnection": 10,
|
||||
"TerminateVirtualBorderRouter": 10,
|
||||
"UnassignIpv6Addresses": 10,
|
||||
"UnassignPrivateIpAddresses": 10,
|
||||
"UnassociateEipAddress": 16
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
func getAPIMaxTimeout(product, actionName string) (time.Duration, bool) {
|
||||
timeout := make(map[string]map[string]int)
|
||||
err := json.Unmarshal([]byte(apiTimeouts), &timeout)
|
||||
if err != nil {
|
||||
return 0 * time.Millisecond, false
|
||||
}
|
||||
|
||||
obj := timeout[strings.ToLower(product)]
|
||||
if obj != nil && obj[actionName] != 0 {
|
||||
return time.Duration(obj[actionName]) * time.Second, true
|
||||
}
|
||||
|
||||
return 0 * time.Millisecond, false
|
||||
}
|
|
@ -69,7 +69,7 @@ func (p *InstanceCredentialsProvider) Resolve() (auth.Credential, error) {
|
|||
|
||||
func get(url string) (status int, content []byte, err error) {
|
||||
httpClient := http.DefaultClient
|
||||
httpClient.Timeout = time.Second * 1
|
||||
httpClient.Timeout = 1 * time.Second
|
||||
resp, err := httpClient.Get(url)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
|
@ -40,7 +40,8 @@ func NewProfileProvider(name ...string) Provider {
|
|||
func (p *ProfileProvider) Resolve() (auth.Credential, error) {
|
||||
path, ok := os.LookupEnv(ENVCredentialFile)
|
||||
if !ok {
|
||||
path, err := checkDefaultPath()
|
||||
var err error
|
||||
path, err = checkDefaultPath()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
8
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/roa_signature_composer.go
generated
vendored
8
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/roa_signature_composer.go
generated
vendored
|
@ -37,12 +37,12 @@ func signRoaRequest(request requests.AcsRequest, signer Signer, regionId string)
|
|||
completeROASignParams(request, signer, regionId)
|
||||
stringToSign := buildRoaStringToSign(request)
|
||||
request.SetStringToSign(stringToSign)
|
||||
signature := signer.Sign(stringToSign, "")
|
||||
accessKeyId, err := signer.GetAccessKeyId()
|
||||
if err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
signature := signer.Sign(stringToSign, "")
|
||||
request.GetHeaders()["Authorization"] = "acs " + accessKeyId + ":" + signature
|
||||
|
||||
return
|
||||
|
@ -77,7 +77,9 @@ func completeROASignParams(request requests.AcsRequest, signer Signer, regionId
|
|||
if request.GetFormParams() != nil && len(request.GetFormParams()) > 0 {
|
||||
formString := utils.GetUrlFormedMap(request.GetFormParams())
|
||||
request.SetContent([]byte(formString))
|
||||
headerParams["Content-Type"] = requests.Form
|
||||
if headerParams["Content-Type"] == "" {
|
||||
headerParams["Content-Type"] = requests.Form
|
||||
}
|
||||
}
|
||||
contentMD5 := utils.GetMD5Base64(request.GetContent())
|
||||
headerParams["Content-MD5"] = contentMD5
|
||||
|
|
4
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/rpc_signature_composer.go
generated
vendored
4
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/rpc_signature_composer.go
generated
vendored
|
@ -22,7 +22,7 @@ import (
|
|||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils"
|
||||
)
|
||||
|
||||
var hookGetUUIDV4 = func(fn func() string) string {
|
||||
var hookGetNonce = func(fn func() string) string {
|
||||
return fn()
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ func completeRpcSignParams(request requests.AcsRequest, signer Signer, regionId
|
|||
queryParams["SignatureMethod"] = signer.GetName()
|
||||
queryParams["SignatureType"] = signer.GetType()
|
||||
queryParams["SignatureVersion"] = signer.GetVersion()
|
||||
queryParams["SignatureNonce"] = hookGetUUIDV4(utils.GetUUIDV4)
|
||||
queryParams["SignatureNonce"] = hookGetNonce(utils.GetUUID)
|
||||
queryParams["AccessKeyId"], err = signer.GetAccessKeyId()
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -22,16 +22,15 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
|
@ -71,17 +70,23 @@ type Client struct {
|
|||
asyncTaskQueue chan func()
|
||||
readTimeout time.Duration
|
||||
connectTimeout time.Duration
|
||||
|
||||
debug bool
|
||||
isRunning bool
|
||||
// void "panic(write to close channel)" cause of addAsync() after Shutdown()
|
||||
asyncChanLock *sync.RWMutex
|
||||
EndpointMap map[string]string
|
||||
EndpointType string
|
||||
Network string
|
||||
Domain string
|
||||
isOpenAsync bool
|
||||
}
|
||||
|
||||
func (client *Client) Init() (err error) {
|
||||
panic("not support yet")
|
||||
}
|
||||
|
||||
func (client *Client) SetEndpointRules(endpointMap map[string]string, endpointType string, netWork string) {
|
||||
client.EndpointMap = endpointMap
|
||||
client.Network = netWork
|
||||
client.EndpointType = endpointType
|
||||
}
|
||||
|
||||
func (client *Client) SetHTTPSInsecure(isInsecure bool) {
|
||||
client.isInsecure = isInsecure
|
||||
}
|
||||
|
@ -114,6 +119,13 @@ func (client *Client) GetNoProxy() string {
|
|||
return client.noProxy
|
||||
}
|
||||
|
||||
func (client *Client) SetTransport(transport http.RoundTripper) {
|
||||
if client.httpClient == nil {
|
||||
client.httpClient = &http.Client{}
|
||||
}
|
||||
client.httpClient.Transport = transport
|
||||
}
|
||||
|
||||
// InitWithProviderChain will get credential from the providerChain,
|
||||
// the RsaKeyPairCredential Only applicable to regionID `ap-northeast-1`,
|
||||
// if your providerChain may return a credential type with RsaKeyPairCredential,
|
||||
|
@ -128,13 +140,20 @@ func (client *Client) InitWithProviderChain(regionId string, provider provider.P
|
|||
}
|
||||
|
||||
func (client *Client) InitWithOptions(regionId string, config *Config, credential auth.Credential) (err error) {
|
||||
client.isRunning = true
|
||||
client.asyncChanLock = new(sync.RWMutex)
|
||||
if regionId != "" {
|
||||
match, _ := regexp.MatchString("^[a-zA-Z0-9_-]+$", regionId)
|
||||
if !match {
|
||||
return fmt.Errorf("regionId contains invalid characters")
|
||||
}
|
||||
}
|
||||
|
||||
client.regionId = regionId
|
||||
client.config = config
|
||||
client.httpClient = &http.Client{}
|
||||
|
||||
if config.HttpTransport != nil {
|
||||
if config.Transport != nil {
|
||||
client.httpClient.Transport = config.Transport
|
||||
} else if config.HttpTransport != nil {
|
||||
client.httpClient.Transport = config.HttpTransport
|
||||
}
|
||||
|
||||
|
@ -204,15 +223,20 @@ func (client *Client) getNoProxy(scheme string) []string {
|
|||
|
||||
// EnableAsync enable the async task queue
|
||||
func (client *Client) EnableAsync(routinePoolSize, maxTaskQueueSize int) {
|
||||
if client.isOpenAsync {
|
||||
fmt.Println("warning: Please not call EnableAsync repeatedly")
|
||||
return
|
||||
}
|
||||
client.isOpenAsync = true
|
||||
client.asyncTaskQueue = make(chan func(), maxTaskQueueSize)
|
||||
for i := 0; i < routinePoolSize; i++ {
|
||||
go func() {
|
||||
for client.isRunning {
|
||||
select {
|
||||
case task, notClosed := <-client.asyncTaskQueue:
|
||||
if notClosed {
|
||||
task()
|
||||
}
|
||||
for {
|
||||
task, notClosed := <-client.asyncTaskQueue
|
||||
if !notClosed {
|
||||
return
|
||||
} else {
|
||||
task()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
@ -221,7 +245,7 @@ func (client *Client) EnableAsync(routinePoolSize, maxTaskQueueSize int) {
|
|||
|
||||
func (client *Client) InitWithAccessKey(regionId, accessKeyId, accessKeySecret string) (err error) {
|
||||
config := client.InitClientConfig()
|
||||
credential := &credentials.BaseCredential{
|
||||
credential := &credentials.AccessKeyCredential{
|
||||
AccessKeyId: accessKeyId,
|
||||
AccessKeySecret: accessKeySecret,
|
||||
}
|
||||
|
@ -299,6 +323,25 @@ func (client *Client) DoAction(request requests.AcsRequest, response responses.A
|
|||
return client.DoActionWithSigner(request, response, nil)
|
||||
}
|
||||
|
||||
func (client *Client) GetEndpointRules(regionId string, product string) (endpointRaw string, err error) {
|
||||
if client.EndpointType == "regional" {
|
||||
if regionId == "" {
|
||||
err = fmt.Errorf("RegionId is empty, please set a valid RegionId.")
|
||||
return "", err
|
||||
}
|
||||
endpointRaw = strings.Replace("<product><network>.<region_id>.aliyuncs.com", "<region_id>", regionId, 1)
|
||||
} else {
|
||||
endpointRaw = "<product><network>.aliyuncs.com"
|
||||
}
|
||||
endpointRaw = strings.Replace(endpointRaw, "<product>", strings.ToLower(product), 1)
|
||||
if client.Network == "" || client.Network == "public" {
|
||||
endpointRaw = strings.Replace(endpointRaw, "<network>", "", 1)
|
||||
} else {
|
||||
endpointRaw = strings.Replace(endpointRaw, "<network>", "-"+client.Network, 1)
|
||||
}
|
||||
return endpointRaw, nil
|
||||
}
|
||||
|
||||
func (client *Client) buildRequestWithSigner(request requests.AcsRequest, signer auth.Signer) (httpRequest *http.Request, err error) {
|
||||
// add clientVersion
|
||||
request.GetHeaders()["x-sdk-core-version"] = Version
|
||||
|
@ -309,18 +352,45 @@ func (client *Client) buildRequestWithSigner(request requests.AcsRequest, signer
|
|||
}
|
||||
|
||||
// resolve endpoint
|
||||
resolveParam := &endpoints.ResolveParam{
|
||||
Domain: request.GetDomain(),
|
||||
Product: request.GetProduct(),
|
||||
RegionId: regionId,
|
||||
LocationProduct: request.GetLocationServiceCode(),
|
||||
LocationEndpointType: request.GetLocationEndpointType(),
|
||||
CommonApi: client.ProcessCommonRequest,
|
||||
endpoint := request.GetDomain()
|
||||
|
||||
if endpoint == "" && client.Domain != "" {
|
||||
endpoint = client.Domain
|
||||
}
|
||||
endpoint, err := endpoints.Resolve(resolveParam)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
if endpoint == "" {
|
||||
endpoint = endpoints.GetEndpointFromMap(regionId, request.GetProduct())
|
||||
}
|
||||
|
||||
if endpoint == "" && client.EndpointType != "" &&
|
||||
(request.GetProduct() != "Sts" || len(request.GetQueryParams()) == 0) {
|
||||
if client.EndpointMap != nil && client.Network == "" || client.Network == "public" {
|
||||
endpoint = client.EndpointMap[regionId]
|
||||
}
|
||||
|
||||
if endpoint == "" {
|
||||
endpoint, err = client.GetEndpointRules(regionId, request.GetProduct())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if endpoint == "" {
|
||||
resolveParam := &endpoints.ResolveParam{
|
||||
Domain: request.GetDomain(),
|
||||
Product: request.GetProduct(),
|
||||
RegionId: regionId,
|
||||
LocationProduct: request.GetLocationServiceCode(),
|
||||
LocationEndpointType: request.GetLocationEndpointType(),
|
||||
CommonApi: client.ProcessCommonRequest,
|
||||
}
|
||||
endpoint, err = endpoints.Resolve(resolveParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
request.SetDomain(endpoint)
|
||||
if request.GetScheme() == "" {
|
||||
request.SetScheme(client.config.Scheme)
|
||||
|
@ -350,7 +420,7 @@ func (client *Client) buildRequestWithSigner(request requests.AcsRequest, signer
|
|||
func getSendUserAgent(configUserAgent string, clientUserAgent, requestUserAgent map[string]string) string {
|
||||
realUserAgent := ""
|
||||
for key1, value1 := range clientUserAgent {
|
||||
for key2, _ := range requestUserAgent {
|
||||
for key2 := range requestUserAgent {
|
||||
if key1 == key2 {
|
||||
key1 = ""
|
||||
}
|
||||
|
@ -376,7 +446,7 @@ func (client *Client) AppendUserAgent(key, value string) {
|
|||
client.userAgent = make(map[string]string)
|
||||
}
|
||||
if strings.ToLower(key) != "core" && strings.ToLower(key) != "go" {
|
||||
for tag, _ := range client.userAgent {
|
||||
for tag := range client.userAgent {
|
||||
if tag == key {
|
||||
client.userAgent[tag] = value
|
||||
newkey = false
|
||||
|
@ -403,8 +473,10 @@ func (client *Client) getTimeout(request requests.AcsRequest) (time.Duration, ti
|
|||
readTimeout = reqReadTimeout
|
||||
} else if client.readTimeout != 0*time.Millisecond {
|
||||
readTimeout = client.readTimeout
|
||||
} else if client.httpClient.Timeout != 0 && client.httpClient.Timeout != 10000000000 {
|
||||
} else if client.httpClient.Timeout != 0 {
|
||||
readTimeout = client.httpClient.Timeout
|
||||
} else if timeout, ok := getAPIMaxTimeout(request.GetProduct(), request.GetActionName()); ok {
|
||||
readTimeout = timeout
|
||||
}
|
||||
|
||||
if reqConnectTimeout != 0*time.Millisecond {
|
||||
|
@ -430,7 +502,7 @@ func (client *Client) setTimeout(request requests.AcsRequest) {
|
|||
if trans, ok := client.httpClient.Transport.(*http.Transport); ok && trans != nil {
|
||||
trans.DialContext = Timeout(connectTimeout)
|
||||
client.httpClient.Transport = trans
|
||||
} else {
|
||||
} else if client.httpClient.Transport == nil {
|
||||
client.httpClient.Transport = &http.Transport{
|
||||
DialContext: Timeout(connectTimeout),
|
||||
}
|
||||
|
@ -447,7 +519,12 @@ func (client *Client) getHTTPSInsecure(request requests.AcsRequest) (insecure bo
|
|||
}
|
||||
|
||||
func (client *Client) DoActionWithSigner(request requests.AcsRequest, response responses.AcsResponse, signer auth.Signer) (err error) {
|
||||
|
||||
if client.Network != "" {
|
||||
match, _ := regexp.MatchString("^[a-zA-Z0-9_-]+$", client.Network)
|
||||
if !match {
|
||||
return fmt.Errorf("netWork contains invalid characters")
|
||||
}
|
||||
}
|
||||
fieldMap := make(map[string]string)
|
||||
initLogMsg(fieldMap)
|
||||
defer func() {
|
||||
|
@ -468,7 +545,14 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r
|
|||
|
||||
var flag bool
|
||||
for _, value := range noProxy {
|
||||
if value == httpRequest.Host {
|
||||
if strings.HasPrefix(value, "*") {
|
||||
value = fmt.Sprintf(".%s", value)
|
||||
}
|
||||
noProxyReg, err := regexp.Compile(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if noProxyReg.MatchString(httpRequest.Host) {
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
|
@ -477,8 +561,12 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r
|
|||
// Set whether to ignore certificate validation.
|
||||
// Default InsecureSkipVerify is false.
|
||||
if trans, ok := client.httpClient.Transport.(*http.Transport); ok && trans != nil {
|
||||
trans.TLSClientConfig = &tls.Config{
|
||||
InsecureSkipVerify: client.getHTTPSInsecure(request),
|
||||
if trans.TLSClientConfig != nil {
|
||||
trans.TLSClientConfig.InsecureSkipVerify = client.getHTTPSInsecure(request)
|
||||
} else {
|
||||
trans.TLSClientConfig = &tls.Config{
|
||||
InsecureSkipVerify: client.getHTTPSInsecure(request),
|
||||
}
|
||||
}
|
||||
if proxy != nil && !flag {
|
||||
trans.Proxy = http.ProxyURL(proxy)
|
||||
|
@ -509,7 +597,7 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r
|
|||
startTime := time.Now()
|
||||
fieldMap["{start_time}"] = startTime.Format("2006-01-02 15:04:05")
|
||||
httpResponse, err = hookDo(client.httpClient.Do)(httpRequest)
|
||||
fieldMap["{cost}"] = time.Now().Sub(startTime).String()
|
||||
fieldMap["{cost}"] = time.Since(startTime).String()
|
||||
if err == nil {
|
||||
fieldMap["{code}"] = strconv.Itoa(httpResponse.StatusCode)
|
||||
fieldMap["{res_headers}"] = TransToString(httpResponse.Header)
|
||||
|
@ -537,6 +625,10 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r
|
|||
return
|
||||
}
|
||||
}
|
||||
if isCertificateError(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// if status code >= 500 or timeout, will trigger retry
|
||||
if client.config.AutoRetry && (err != nil || isServerError(httpResponse)) {
|
||||
client.setTimeout(request)
|
||||
|
@ -552,6 +644,8 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r
|
|||
}
|
||||
|
||||
err = responses.Unmarshal(response, httpResponse, request.GetAcceptFormat())
|
||||
fieldMap["{res_body}"] = response.GetHttpContentString()
|
||||
debug("%s", response.GetHttpContentString())
|
||||
// wrap server errors
|
||||
if serverErr, ok := err.(*errors.ServerError); ok {
|
||||
var wrapInfo = map[string]string{}
|
||||
|
@ -561,6 +655,13 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r
|
|||
return
|
||||
}
|
||||
|
||||
func isCertificateError(err error) bool {
|
||||
if err != nil && strings.Contains(err.Error(), "x509: certificate signed by unknown authority") {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func putMsgToMap(fieldMap map[string]string, request *http.Request) {
|
||||
fieldMap["{host}"] = request.Host
|
||||
fieldMap["{method}"] = request.Method
|
||||
|
@ -606,9 +707,7 @@ only block when any one of the following occurs:
|
|||
**/
|
||||
func (client *Client) AddAsyncTask(task func()) (err error) {
|
||||
if client.asyncTaskQueue != nil {
|
||||
client.asyncChanLock.RLock()
|
||||
defer client.asyncChanLock.RUnlock()
|
||||
if client.isRunning {
|
||||
if client.isOpenAsync {
|
||||
client.asyncTaskQueue <- task
|
||||
}
|
||||
} else {
|
||||
|
@ -621,6 +720,14 @@ func (client *Client) GetConfig() *Config {
|
|||
return client.config
|
||||
}
|
||||
|
||||
func (client *Client) GetSigner() auth.Signer {
|
||||
return client.signer
|
||||
}
|
||||
|
||||
func (client *Client) SetSigner(signer auth.Signer) {
|
||||
client.signer = signer
|
||||
}
|
||||
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.Init()
|
||||
|
@ -705,13 +812,11 @@ func (client *Client) ProcessCommonRequestWithSigner(request *requests.CommonReq
|
|||
}
|
||||
|
||||
func (client *Client) Shutdown() {
|
||||
// lock the addAsync()
|
||||
client.asyncChanLock.Lock()
|
||||
defer client.asyncChanLock.Unlock()
|
||||
if client.asyncTaskQueue != nil {
|
||||
close(client.asyncTaskQueue)
|
||||
}
|
||||
client.isRunning = false
|
||||
|
||||
client.isOpenAsync = false
|
||||
}
|
||||
|
||||
// Deprecated: Use NewClientWithRamRoleArn in this package instead.
|
||||
|
|
|
@ -22,16 +22,17 @@ import (
|
|||
)
|
||||
|
||||
type Config struct {
|
||||
AutoRetry bool `default:"true"`
|
||||
MaxRetryTime int `default:"3"`
|
||||
UserAgent string `default:""`
|
||||
Debug bool `default:"false"`
|
||||
Timeout time.Duration `default:"10000000000"`
|
||||
HttpTransport *http.Transport `default:""`
|
||||
EnableAsync bool `default:"false"`
|
||||
MaxTaskQueueSize int `default:"1000"`
|
||||
GoRoutinePoolSize int `default:"5"`
|
||||
Scheme string `default:"HTTP"`
|
||||
AutoRetry bool `default:"false"`
|
||||
MaxRetryTime int `default:"3"`
|
||||
UserAgent string `default:""`
|
||||
Debug bool `default:"false"`
|
||||
HttpTransport *http.Transport `default:""`
|
||||
Transport http.RoundTripper `default:""`
|
||||
EnableAsync bool `default:"false"`
|
||||
MaxTaskQueueSize int `default:"1000"`
|
||||
GoRoutinePoolSize int `default:"5"`
|
||||
Scheme string `default:"HTTP"`
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
func NewConfig() (config *Config) {
|
||||
|
|
4966
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/endpoints_config.go
generated
vendored
4966
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/endpoints_config.go
generated
vendored
File diff suppressed because it is too large
Load Diff
37
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/mapping_resolver.go
generated
vendored
37
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/mapping_resolver.go
generated
vendored
|
@ -17,32 +17,33 @@ package endpoints
|
|||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
const keyFormatter = "%s::%s"
|
||||
|
||||
var endpointMapping = make(map[string]string)
|
||||
type EndpointMapping struct {
|
||||
sync.RWMutex
|
||||
endpoint map[string]string
|
||||
}
|
||||
|
||||
// AddEndpointMapping Use product id and region id as key to store the endpoint into inner map
|
||||
var endpointMapping = EndpointMapping{endpoint: make(map[string]string)}
|
||||
|
||||
// AddEndpointMapping use productId and regionId as key to store the endpoint into inner map
|
||||
// when using the same productId and regionId as key, the endpoint will be covered.
|
||||
func AddEndpointMapping(regionId, productId, endpoint string) (err error) {
|
||||
key := fmt.Sprintf(keyFormatter, strings.ToLower(regionId), strings.ToLower(productId))
|
||||
endpointMapping[key] = endpoint
|
||||
endpointMapping.Lock()
|
||||
endpointMapping.endpoint[key] = endpoint
|
||||
endpointMapping.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
// MappingResolver the mapping resolver type
|
||||
type MappingResolver struct {
|
||||
}
|
||||
|
||||
// GetName get the resolver name: "mapping resolver"
|
||||
func (resolver *MappingResolver) GetName() (name string) {
|
||||
name = "mapping resolver"
|
||||
return
|
||||
}
|
||||
|
||||
// TryResolve use Product and RegionId as key to find endpoint from inner map
|
||||
func (resolver *MappingResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error) {
|
||||
key := fmt.Sprintf(keyFormatter, strings.ToLower(param.RegionId), strings.ToLower(param.Product))
|
||||
endpoint, contains := endpointMapping[key]
|
||||
return endpoint, contains, nil
|
||||
// GetEndpointFromMap use Product and RegionId as key to find endpoint from inner map
|
||||
func GetEndpointFromMap(regionId, productId string) string {
|
||||
key := fmt.Sprintf(keyFormatter, strings.ToLower(regionId), strings.ToLower(productId))
|
||||
endpointMapping.RLock()
|
||||
endpoint := endpointMapping.endpoint[key]
|
||||
endpointMapping.RUnlock()
|
||||
return endpoint
|
||||
}
|
||||
|
|
|
@ -70,8 +70,6 @@ func Resolve(param *ResolveParam) (endpoint string, err error) {
|
|||
func getAllResolvers() []Resolver {
|
||||
once.Do(func() {
|
||||
resolvers = []Resolver{
|
||||
&SimpleHostResolver{},
|
||||
&MappingResolver{},
|
||||
&LocationResolver{},
|
||||
&LocalRegionalResolver{},
|
||||
&LocalGlobalResolver{},
|
||||
|
|
33
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/simple_host_resolver.go
generated
vendored
33
vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/simple_host_resolver.go
generated
vendored
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package endpoints
|
||||
|
||||
// SimpleHostResolver the simple host resolver type
|
||||
type SimpleHostResolver struct {
|
||||
}
|
||||
|
||||
// GetName get the resolver name: "simple host resolver"
|
||||
func (resolver *SimpleHostResolver) GetName() (name string) {
|
||||
name = "simple host resolver"
|
||||
return
|
||||
}
|
||||
|
||||
// TryResolve if the Domain exist in param, use it as endpoint
|
||||
func (resolver *SimpleHostResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error) {
|
||||
if support = len(param.Domain) > 0; support {
|
||||
endpoint = param.Domain
|
||||
}
|
||||
return
|
||||
}
|
|
@ -21,7 +21,7 @@ type Logger struct {
|
|||
}
|
||||
|
||||
var defaultLoggerTemplate = `{time} {channel}: "{method} {uri} HTTP/{version}" {code} {cost} {hostname}`
|
||||
var loggerParam = []string{"{time}", "{start_time}", "{ts}", "{channel}", "{pid}", "{host}", "{method}", "{uri}", "{version}", "{target}", "{hostname}", "{code}", "{error}", "{req_headers}", "{res_headers}", "{cost}"}
|
||||
var loggerParam = []string{"{time}", "{start_time}", "{ts}", "{channel}", "{pid}", "{host}", "{method}", "{uri}", "{version}", "{target}", "{hostname}", "{code}", "{error}", "{req_headers}", "{res_body}", "{res_headers}", "{cost}"}
|
||||
|
||||
func initLogMsg(fieldMap map[string]string) {
|
||||
for _, value := range loggerParam {
|
||||
|
|
|
@ -39,6 +39,7 @@ const (
|
|||
PUT = "PUT"
|
||||
POST = "POST"
|
||||
DELETE = "DELETE"
|
||||
PATCH = "PATCH"
|
||||
HEAD = "HEAD"
|
||||
OPTIONS = "OPTIONS"
|
||||
|
||||
|
@ -70,6 +71,7 @@ type AcsRequest interface {
|
|||
GetStyle() string
|
||||
GetProduct() string
|
||||
GetVersion() string
|
||||
SetVersion(version string)
|
||||
GetActionName() string
|
||||
GetAcceptFormat() string
|
||||
GetLocationServiceCode() string
|
||||
|
@ -166,6 +168,10 @@ func (request *baseRequest) GetContent() []byte {
|
|||
return request.Content
|
||||
}
|
||||
|
||||
func (request *baseRequest) SetVersion(version string) {
|
||||
request.version = version
|
||||
}
|
||||
|
||||
func (request *baseRequest) GetVersion() string {
|
||||
return request.version
|
||||
}
|
||||
|
@ -317,6 +323,9 @@ func flatRepeatedList(dataValue reflect.Value, request AcsRequest, position, pre
|
|||
if dataValue.Field(i).Kind().String() == "map" {
|
||||
byt, _ := json.Marshal(dataValue.Field(i).Interface())
|
||||
value = string(byt)
|
||||
if value == "null" {
|
||||
value = ""
|
||||
}
|
||||
}
|
||||
err = addParam(request, fieldPosition, key, value)
|
||||
if err != nil {
|
||||
|
@ -324,23 +333,84 @@ func flatRepeatedList(dataValue reflect.Value, request AcsRequest, position, pre
|
|||
}
|
||||
} else if typeTag == "Repeated" {
|
||||
// repeated param
|
||||
repeatedFieldValue := dataValue.Field(i)
|
||||
if repeatedFieldValue.Kind() != reflect.Slice {
|
||||
// possible value: {"[]string", "*[]struct"}, we must call Elem() in the last condition
|
||||
repeatedFieldValue = repeatedFieldValue.Elem()
|
||||
err = handleRepeatedParams(request, dataValue, prefix, name, fieldPosition, i)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if repeatedFieldValue.IsValid() && !repeatedFieldValue.IsNil() {
|
||||
for m := 0; m < repeatedFieldValue.Len(); m++ {
|
||||
elementValue := repeatedFieldValue.Index(m)
|
||||
key := prefix + name + "." + strconv.Itoa(m+1)
|
||||
if elementValue.Type().Kind().String() == "string" {
|
||||
value := elementValue.String()
|
||||
err = addParam(request, fieldPosition, key, value)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
err = flatRepeatedList(elementValue, request, fieldPosition, key+".")
|
||||
} else if typeTag == "Struct" {
|
||||
err = handleStruct(request, dataValue, prefix, name, fieldPosition, i)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func handleRepeatedParams(request AcsRequest, dataValue reflect.Value, prefix, name, fieldPosition string, index int) (err error) {
|
||||
repeatedFieldValue := dataValue.Field(index)
|
||||
if repeatedFieldValue.Kind() != reflect.Slice {
|
||||
// possible value: {"[]string", "*[]struct"}, we must call Elem() in the last condition
|
||||
repeatedFieldValue = repeatedFieldValue.Elem()
|
||||
}
|
||||
if repeatedFieldValue.IsValid() && !repeatedFieldValue.IsNil() {
|
||||
for m := 0; m < repeatedFieldValue.Len(); m++ {
|
||||
elementValue := repeatedFieldValue.Index(m)
|
||||
key := prefix + name + "." + strconv.Itoa(m+1)
|
||||
if elementValue.Type().Kind().String() == "string" {
|
||||
value := elementValue.String()
|
||||
err = addParam(request, fieldPosition, key, value)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
err = flatRepeatedList(elementValue, request, fieldPosition, key+".")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func handleStruct(request AcsRequest, dataValue reflect.Value, prefix, name, fieldPosition string, index int) (err error) {
|
||||
valueField := dataValue.Field(index)
|
||||
if valueField.IsValid() && valueField.String() != "" {
|
||||
valueFieldType := valueField.Type()
|
||||
for m := 0; m < valueFieldType.NumField(); m++ {
|
||||
fieldName := valueFieldType.Field(m).Name
|
||||
elementValue := valueField.FieldByName(fieldName)
|
||||
key := prefix + name + "." + fieldName
|
||||
if elementValue.Type().String() == "[]string" {
|
||||
if elementValue.IsNil() {
|
||||
continue
|
||||
}
|
||||
for j := 0; j < elementValue.Len(); j++ {
|
||||
err = addParam(request, fieldPosition, key+"."+strconv.Itoa(j+1), elementValue.Index(j).String())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if elementValue.Type().Kind().String() == "string" {
|
||||
value := elementValue.String()
|
||||
err = addParam(request, fieldPosition, key, value)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
} else if elementValue.Type().Kind().String() == "struct" {
|
||||
err = flatRepeatedList(elementValue, request, fieldPosition, key+".")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
} else if !elementValue.IsNil() {
|
||||
repeatedFieldValue := elementValue.Elem()
|
||||
if repeatedFieldValue.IsValid() && !repeatedFieldValue.IsNil() {
|
||||
for m := 0; m < repeatedFieldValue.Len(); m++ {
|
||||
elementValue := repeatedFieldValue.Index(m)
|
||||
err = flatRepeatedList(elementValue, request, fieldPosition, key+"."+strconv.Itoa(m+1)+".")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -350,7 +420,7 @@ func flatRepeatedList(dataValue reflect.Value, request AcsRequest, position, pre
|
|||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
func addParam(request AcsRequest, position, name, value string) (err error) {
|
||||
|
|
|
@ -11,10 +11,11 @@ import (
|
|||
type CommonRequest struct {
|
||||
*baseRequest
|
||||
|
||||
Version string
|
||||
ApiName string
|
||||
Product string
|
||||
ServiceCode string
|
||||
Version string
|
||||
ApiName string
|
||||
Product string
|
||||
ServiceCode string
|
||||
EndpointType string
|
||||
|
||||
// roa params
|
||||
PathPattern string
|
||||
|
@ -82,7 +83,10 @@ func (request *CommonRequest) TransToAcsRequest() {
|
|||
rpcRequest.product = request.Product
|
||||
rpcRequest.version = request.Version
|
||||
rpcRequest.locationServiceCode = request.ServiceCode
|
||||
rpcRequest.locationEndpointType = request.EndpointType
|
||||
rpcRequest.actionName = request.ApiName
|
||||
rpcRequest.Headers["x-acs-version"] = request.Version
|
||||
rpcRequest.Headers["x-acs-action"] = request.ApiName
|
||||
request.Ontology = rpcRequest
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,6 @@ func (request *RoaRequest) buildQueries() string {
|
|||
}
|
||||
}
|
||||
result := urlBuilder.String()
|
||||
result = popStandardUrlencode(result)
|
||||
return result
|
||||
}
|
||||
|
||||
|
@ -102,13 +101,6 @@ func (request *RoaRequest) buildQueryString() string {
|
|||
return q.Encode()
|
||||
}
|
||||
|
||||
func popStandardUrlencode(stringToSign string) (result string) {
|
||||
result = strings.Replace(stringToSign, "+", "%20", -1)
|
||||
result = strings.Replace(result, "*", "%2A", -1)
|
||||
result = strings.Replace(result, "%7E", "~", -1)
|
||||
return
|
||||
}
|
||||
|
||||
func (request *RoaRequest) BuildUrl() string {
|
||||
// for network trans, need url encoded
|
||||
scheme := strings.ToLower(request.Scheme)
|
||||
|
@ -131,12 +123,13 @@ func (request *RoaRequest) InitWithApiInfo(product, version, action, uriPattern,
|
|||
request.baseRequest = defaultBaseRequest()
|
||||
request.PathParams = make(map[string]string)
|
||||
request.Headers["x-acs-version"] = version
|
||||
request.Headers["x-acs-action"] = action
|
||||
request.pathPattern = uriPattern
|
||||
request.locationServiceCode = serviceCode
|
||||
request.locationEndpointType = endpointType
|
||||
request.product = product
|
||||
//request.version = version
|
||||
//request.actionName = action
|
||||
request.actionName = action
|
||||
}
|
||||
|
||||
func (request *RoaRequest) initWithCommonRequest(commonRequest *CommonRequest) {
|
||||
|
@ -145,7 +138,10 @@ func (request *RoaRequest) initWithCommonRequest(commonRequest *CommonRequest) {
|
|||
request.product = commonRequest.Product
|
||||
//request.version = commonRequest.Version
|
||||
request.Headers["x-acs-version"] = commonRequest.Version
|
||||
//request.actionName = commonRequest.ApiName
|
||||
if commonRequest.ApiName != "" {
|
||||
request.Headers["x-acs-action"] = commonRequest.ApiName
|
||||
}
|
||||
request.actionName = commonRequest.ApiName
|
||||
request.pathPattern = commonRequest.PathPattern
|
||||
request.locationServiceCode = commonRequest.ServiceCode
|
||||
request.locationEndpointType = ""
|
||||
|
|
|
@ -76,4 +76,6 @@ func (request *RpcRequest) InitWithApiInfo(product, version, action, serviceCode
|
|||
request.actionName = action
|
||||
request.locationServiceCode = serviceCode
|
||||
request.locationEndpointType = endpointType
|
||||
request.Headers["x-acs-version"] = version
|
||||
request.Headers["x-acs-action"] = action
|
||||
}
|
||||
|
|
|
@ -4,12 +4,13 @@ import (
|
|||
"encoding/json"
|
||||
"io"
|
||||
"math"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"unsafe"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/modern-go/reflect2"
|
||||
)
|
||||
|
||||
const maxUint = ^uint(0)
|
||||
|
@ -17,145 +18,145 @@ const maxInt = int(maxUint >> 1)
|
|||
const minInt = -maxInt - 1
|
||||
|
||||
var jsonParser jsoniter.API
|
||||
var initJson = &sync.Once{}
|
||||
|
||||
func initJsonParserOnce() {
|
||||
initJson.Do(func() {
|
||||
registerBetterFuzzyDecoder()
|
||||
jsonParser = jsoniter.Config{
|
||||
EscapeHTML: true,
|
||||
SortMapKeys: true,
|
||||
ValidateJsonRawMessage: true,
|
||||
CaseSensitive: true,
|
||||
}.Froze()
|
||||
})
|
||||
func init() {
|
||||
jsonParser = jsoniter.Config{
|
||||
EscapeHTML: true,
|
||||
SortMapKeys: true,
|
||||
ValidateJsonRawMessage: true,
|
||||
CaseSensitive: true,
|
||||
}.Froze()
|
||||
|
||||
jsonParser.RegisterExtension(newBetterFuzzyExtension())
|
||||
}
|
||||
|
||||
func registerBetterFuzzyDecoder() {
|
||||
jsoniter.RegisterTypeDecoder("string", &nullableFuzzyStringDecoder{})
|
||||
jsoniter.RegisterTypeDecoder("bool", &fuzzyBoolDecoder{})
|
||||
jsoniter.RegisterTypeDecoder("float32", &nullableFuzzyFloat32Decoder{})
|
||||
jsoniter.RegisterTypeDecoder("float64", &nullableFuzzyFloat64Decoder{})
|
||||
jsoniter.RegisterTypeDecoder("int", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(maxInt) || val < float64(minInt) {
|
||||
iter.ReportError("fuzzy decode int", "exceed range")
|
||||
return
|
||||
func newBetterFuzzyExtension() jsoniter.DecoderExtension {
|
||||
return jsoniter.DecoderExtension{
|
||||
reflect2.DefaultTypeOfKind(reflect.String): &nullableFuzzyStringDecoder{},
|
||||
reflect2.DefaultTypeOfKind(reflect.Bool): &fuzzyBoolDecoder{},
|
||||
reflect2.DefaultTypeOfKind(reflect.Float32): &nullableFuzzyFloat32Decoder{},
|
||||
reflect2.DefaultTypeOfKind(reflect.Float64): &nullableFuzzyFloat64Decoder{},
|
||||
reflect2.DefaultTypeOfKind(reflect.Int): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(maxInt) || val < float64(minInt) {
|
||||
iter.ReportError("fuzzy decode int", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*int)(ptr)) = int(val)
|
||||
} else {
|
||||
*((*int)(ptr)) = iter.ReadInt()
|
||||
}
|
||||
*((*int)(ptr)) = int(val)
|
||||
} else {
|
||||
*((*int)(ptr)) = iter.ReadInt()
|
||||
}
|
||||
}})
|
||||
jsoniter.RegisterTypeDecoder("uint", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(maxUint) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint", "exceed range")
|
||||
return
|
||||
}},
|
||||
reflect2.DefaultTypeOfKind(reflect.Uint): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(maxUint) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*uint)(ptr)) = uint(val)
|
||||
} else {
|
||||
*((*uint)(ptr)) = iter.ReadUint()
|
||||
}
|
||||
*((*uint)(ptr)) = uint(val)
|
||||
} else {
|
||||
*((*uint)(ptr)) = iter.ReadUint()
|
||||
}
|
||||
}})
|
||||
jsoniter.RegisterTypeDecoder("int8", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxInt8) || val < float64(math.MinInt8) {
|
||||
iter.ReportError("fuzzy decode int8", "exceed range")
|
||||
return
|
||||
}},
|
||||
reflect2.DefaultTypeOfKind(reflect.Int8): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxInt8) || val < float64(math.MinInt8) {
|
||||
iter.ReportError("fuzzy decode int8", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*int8)(ptr)) = int8(val)
|
||||
} else {
|
||||
*((*int8)(ptr)) = iter.ReadInt8()
|
||||
}
|
||||
*((*int8)(ptr)) = int8(val)
|
||||
} else {
|
||||
*((*int8)(ptr)) = iter.ReadInt8()
|
||||
}
|
||||
}})
|
||||
jsoniter.RegisterTypeDecoder("uint8", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxUint8) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint8", "exceed range")
|
||||
return
|
||||
}},
|
||||
reflect2.DefaultTypeOfKind(reflect.Uint8): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxUint8) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint8", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*uint8)(ptr)) = uint8(val)
|
||||
} else {
|
||||
*((*uint8)(ptr)) = iter.ReadUint8()
|
||||
}
|
||||
*((*uint8)(ptr)) = uint8(val)
|
||||
} else {
|
||||
*((*uint8)(ptr)) = iter.ReadUint8()
|
||||
}
|
||||
}})
|
||||
jsoniter.RegisterTypeDecoder("int16", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxInt16) || val < float64(math.MinInt16) {
|
||||
iter.ReportError("fuzzy decode int16", "exceed range")
|
||||
return
|
||||
}},
|
||||
reflect2.DefaultTypeOfKind(reflect.Int16): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxInt16) || val < float64(math.MinInt16) {
|
||||
iter.ReportError("fuzzy decode int16", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*int16)(ptr)) = int16(val)
|
||||
} else {
|
||||
*((*int16)(ptr)) = iter.ReadInt16()
|
||||
}
|
||||
*((*int16)(ptr)) = int16(val)
|
||||
} else {
|
||||
*((*int16)(ptr)) = iter.ReadInt16()
|
||||
}
|
||||
}})
|
||||
jsoniter.RegisterTypeDecoder("uint16", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxUint16) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint16", "exceed range")
|
||||
return
|
||||
}},
|
||||
reflect2.DefaultTypeOfKind(reflect.Uint16): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxUint16) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint16", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*uint16)(ptr)) = uint16(val)
|
||||
} else {
|
||||
*((*uint16)(ptr)) = iter.ReadUint16()
|
||||
}
|
||||
*((*uint16)(ptr)) = uint16(val)
|
||||
} else {
|
||||
*((*uint16)(ptr)) = iter.ReadUint16()
|
||||
}
|
||||
}})
|
||||
jsoniter.RegisterTypeDecoder("int32", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxInt32) || val < float64(math.MinInt32) {
|
||||
iter.ReportError("fuzzy decode int32", "exceed range")
|
||||
return
|
||||
}},
|
||||
reflect2.DefaultTypeOfKind(reflect.Int32): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxInt32) || val < float64(math.MinInt32) {
|
||||
iter.ReportError("fuzzy decode int32", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*int32)(ptr)) = int32(val)
|
||||
} else {
|
||||
*((*int32)(ptr)) = iter.ReadInt32()
|
||||
}
|
||||
*((*int32)(ptr)) = int32(val)
|
||||
} else {
|
||||
*((*int32)(ptr)) = iter.ReadInt32()
|
||||
}
|
||||
}})
|
||||
jsoniter.RegisterTypeDecoder("uint32", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxUint32) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint32", "exceed range")
|
||||
return
|
||||
}},
|
||||
reflect2.DefaultTypeOfKind(reflect.Uint32): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxUint32) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint32", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*uint32)(ptr)) = uint32(val)
|
||||
} else {
|
||||
*((*uint32)(ptr)) = iter.ReadUint32()
|
||||
}
|
||||
*((*uint32)(ptr)) = uint32(val)
|
||||
} else {
|
||||
*((*uint32)(ptr)) = iter.ReadUint32()
|
||||
}
|
||||
}})
|
||||
jsoniter.RegisterTypeDecoder("int64", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxInt64) || val < float64(math.MinInt64) {
|
||||
iter.ReportError("fuzzy decode int64", "exceed range")
|
||||
return
|
||||
}},
|
||||
reflect2.DefaultTypeOfKind(reflect.Int64): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxInt64) || val < float64(math.MinInt64) {
|
||||
iter.ReportError("fuzzy decode int64", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*int64)(ptr)) = int64(val)
|
||||
} else {
|
||||
*((*int64)(ptr)) = iter.ReadInt64()
|
||||
}
|
||||
*((*int64)(ptr)) = int64(val)
|
||||
} else {
|
||||
*((*int64)(ptr)) = iter.ReadInt64()
|
||||
}
|
||||
}})
|
||||
jsoniter.RegisterTypeDecoder("uint64", &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxUint64) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint64", "exceed range")
|
||||
return
|
||||
}},
|
||||
reflect2.DefaultTypeOfKind(reflect.Uint64): &nullableFuzzyIntegerDecoder{func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) {
|
||||
if isFloat {
|
||||
val := iter.ReadFloat64()
|
||||
if val > float64(math.MaxUint64) || val < 0 {
|
||||
iter.ReportError("fuzzy decode uint64", "exceed range")
|
||||
return
|
||||
}
|
||||
*((*uint64)(ptr)) = uint64(val)
|
||||
} else {
|
||||
*((*uint64)(ptr)) = iter.ReadUint64()
|
||||
}
|
||||
*((*uint64)(ptr)) = uint64(val)
|
||||
} else {
|
||||
*((*uint64)(ptr)) = iter.ReadUint64()
|
||||
}
|
||||
}})
|
||||
}},
|
||||
}
|
||||
}
|
||||
|
||||
type nullableFuzzyStringDecoder struct {
|
||||
|
|
|
@ -23,7 +23,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils"
|
||||
)
|
||||
|
||||
type AcsResponse interface {
|
||||
|
@ -36,11 +35,6 @@ type AcsResponse interface {
|
|||
parseFromHttpResponse(httpResponse *http.Response) error
|
||||
}
|
||||
|
||||
var debug utils.Debug
|
||||
|
||||
func init() {
|
||||
debug = utils.Init("sdk")
|
||||
}
|
||||
// Unmarshal object from http response body to target Response
|
||||
func Unmarshal(response AcsResponse, httpResponse *http.Response, format string) (err error) {
|
||||
err = response.parseFromHttpResponse(httpResponse)
|
||||
|
@ -62,7 +56,6 @@ func Unmarshal(response AcsResponse, httpResponse *http.Response, format string)
|
|||
}
|
||||
|
||||
if strings.ToUpper(format) == "JSON" {
|
||||
initJsonParserOnce()
|
||||
err = jsonParser.Unmarshal(response.GetHttpContentBytes(), response)
|
||||
if err != nil {
|
||||
err = errors.NewClientError(errors.JsonUnmarshalErrorCode, errors.JsonUnmarshalErrorMessage, err)
|
||||
|
@ -115,7 +108,6 @@ func (baseResponse *BaseResponse) parseFromHttpResponse(httpResponse *http.Respo
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
debug("%s", string(body))
|
||||
baseResponse.httpStatus = httpResponse.StatusCode
|
||||
baseResponse.httpHeaders = httpResponse.Header
|
||||
baseResponse.httpContentBytes = body
|
||||
|
|
|
@ -16,22 +16,35 @@ package utils
|
|||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"hash"
|
||||
rand2 "math/rand"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/satori/go.uuid"
|
||||
)
|
||||
|
||||
func GetUUIDV4() (uuidHex string) {
|
||||
uuidV4 := uuid.NewV4()
|
||||
uuidHex = hex.EncodeToString(uuidV4.Bytes())
|
||||
type UUID [16]byte
|
||||
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
func GetUUID() (uuidHex string) {
|
||||
uuid := NewUUID()
|
||||
uuidHex = hex.EncodeToString(uuid[:])
|
||||
return
|
||||
}
|
||||
|
||||
func RandStringBytes(n int) string {
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letterBytes[rand2.Intn(len(letterBytes))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func GetMD5Base64(bytes []byte) (base64Value string) {
|
||||
md5Ctx := md5.New()
|
||||
md5Ctx.Write(bytes)
|
||||
|
@ -85,3 +98,44 @@ func InitStructWithDefaultTag(bean interface{}) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func NewUUID() UUID {
|
||||
ns := UUID{}
|
||||
safeRandom(ns[:])
|
||||
u := newFromHash(md5.New(), ns, RandStringBytes(16))
|
||||
u[6] = (u[6] & 0x0f) | (byte(2) << 4)
|
||||
u[8] = (u[8]&(0xff>>2) | (0x02 << 6))
|
||||
|
||||
return u
|
||||
}
|
||||
|
||||
func newFromHash(h hash.Hash, ns UUID, name string) UUID {
|
||||
u := UUID{}
|
||||
h.Write(ns[:])
|
||||
h.Write([]byte(name))
|
||||
copy(u[:], h.Sum(nil))
|
||||
|
||||
return u
|
||||
}
|
||||
|
||||
func safeRandom(dest []byte) {
|
||||
if _, err := rand.Read(dest); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (u UUID) String() string {
|
||||
buf := make([]byte, 36)
|
||||
|
||||
hex.Encode(buf[0:8], u[0:4])
|
||||
buf[8] = '-'
|
||||
hex.Encode(buf[9:13], u[4:6])
|
||||
buf[13] = '-'
|
||||
hex.Encode(buf[14:18], u[6:8])
|
||||
buf[18] = '-'
|
||||
hex.Encode(buf[19:23], u[8:10])
|
||||
buf[23] = '-'
|
||||
hex.Encode(buf[24:], u[10:])
|
||||
|
||||
return string(buf)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AcceptInquiredSystemEvent invokes the ecs.AcceptInquiredSystemEvent API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/acceptinquiredsystemevent.html
|
||||
func (client *Client) AcceptInquiredSystemEvent(request *AcceptInquiredSystemEventRequest) (response *AcceptInquiredSystemEventResponse, err error) {
|
||||
response = CreateAcceptInquiredSystemEventResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AcceptInquiredSystemEvent(request *AcceptInquiredSystemEve
|
|||
}
|
||||
|
||||
// AcceptInquiredSystemEventWithChan invokes the ecs.AcceptInquiredSystemEvent API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/acceptinquiredsystemevent.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AcceptInquiredSystemEventWithChan(request *AcceptInquiredSystemEventRequest) (<-chan *AcceptInquiredSystemEventResponse, <-chan error) {
|
||||
responseChan := make(chan *AcceptInquiredSystemEventResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AcceptInquiredSystemEventWithChan(request *AcceptInquiredS
|
|||
}
|
||||
|
||||
// AcceptInquiredSystemEventWithCallback invokes the ecs.AcceptInquiredSystemEvent API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/acceptinquiredsystemevent.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AcceptInquiredSystemEventWithCallback(request *AcceptInquiredSystemEventRequest, callback func(response *AcceptInquiredSystemEventResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -95,6 +90,7 @@ func CreateAcceptInquiredSystemEventRequest() (request *AcceptInquiredSystemEven
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AcceptInquiredSystemEvent", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// ActivateRouterInterface invokes the ecs.ActivateRouterInterface API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/activaterouterinterface.html
|
||||
func (client *Client) ActivateRouterInterface(request *ActivateRouterInterfaceRequest) (response *ActivateRouterInterfaceResponse, err error) {
|
||||
response = CreateActivateRouterInterfaceResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) ActivateRouterInterface(request *ActivateRouterInterfaceRe
|
|||
}
|
||||
|
||||
// ActivateRouterInterfaceWithChan invokes the ecs.ActivateRouterInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/activaterouterinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) ActivateRouterInterfaceWithChan(request *ActivateRouterInterfaceRequest) (<-chan *ActivateRouterInterfaceResponse, <-chan error) {
|
||||
responseChan := make(chan *ActivateRouterInterfaceResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) ActivateRouterInterfaceWithChan(request *ActivateRouterInt
|
|||
}
|
||||
|
||||
// ActivateRouterInterfaceWithCallback invokes the ecs.ActivateRouterInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/activaterouterinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) ActivateRouterInterfaceWithCallback(request *ActivateRouterInterfaceRequest, callback func(response *ActivateRouterInterfaceResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -94,6 +89,7 @@ func CreateActivateRouterInterfaceRequest() (request *ActivateRouterInterfaceReq
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "ActivateRouterInterface", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AddBandwidthPackageIps invokes the ecs.AddBandwidthPackageIps API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/addbandwidthpackageips.html
|
||||
func (client *Client) AddBandwidthPackageIps(request *AddBandwidthPackageIpsRequest) (response *AddBandwidthPackageIpsResponse, err error) {
|
||||
response = CreateAddBandwidthPackageIpsResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AddBandwidthPackageIps(request *AddBandwidthPackageIpsRequ
|
|||
}
|
||||
|
||||
// AddBandwidthPackageIpsWithChan invokes the ecs.AddBandwidthPackageIps API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/addbandwidthpackageips.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AddBandwidthPackageIpsWithChan(request *AddBandwidthPackageIpsRequest) (<-chan *AddBandwidthPackageIpsResponse, <-chan error) {
|
||||
responseChan := make(chan *AddBandwidthPackageIpsResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AddBandwidthPackageIpsWithChan(request *AddBandwidthPackag
|
|||
}
|
||||
|
||||
// AddBandwidthPackageIpsWithCallback invokes the ecs.AddBandwidthPackageIps API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/addbandwidthpackageips.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AddBandwidthPackageIpsWithCallback(request *AddBandwidthPackageIpsRequest, callback func(response *AddBandwidthPackageIpsResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,9 +72,9 @@ func (client *Client) AddBandwidthPackageIpsWithCallback(request *AddBandwidthPa
|
|||
type AddBandwidthPackageIpsRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
BandwidthPackageId string `position:"Query" name:"BandwidthPackageId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
IpCount string `position:"Query" name:"IpCount"`
|
||||
|
@ -97,6 +92,7 @@ func CreateAddBandwidthPackageIpsRequest() (request *AddBandwidthPackageIpsReque
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AddBandwidthPackageIps", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AddTags invokes the ecs.AddTags API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/addtags.html
|
||||
func (client *Client) AddTags(request *AddTagsRequest) (response *AddTagsResponse, err error) {
|
||||
response = CreateAddTagsResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AddTags(request *AddTagsRequest) (response *AddTagsRespons
|
|||
}
|
||||
|
||||
// AddTagsWithChan invokes the ecs.AddTags API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/addtags.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AddTagsWithChan(request *AddTagsRequest) (<-chan *AddTagsResponse, <-chan error) {
|
||||
responseChan := make(chan *AddTagsResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AddTagsWithChan(request *AddTagsRequest) (<-chan *AddTagsR
|
|||
}
|
||||
|
||||
// AddTagsWithCallback invokes the ecs.AddTags API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/addtags.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AddTagsWithCallback(request *AddTagsRequest, callback func(response *AddTagsResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,9 +72,9 @@ func (client *Client) AddTagsWithCallback(request *AddTagsRequest, callback func
|
|||
type AddTagsRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
Tag *[]AddTagsTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
ResourceId string `position:"Query" name:"ResourceId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
Tag *[]AddTagsTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
ResourceType string `position:"Query" name:"ResourceType"`
|
||||
}
|
||||
|
@ -102,6 +97,7 @@ func CreateAddTagsRequest() (request *AddTagsRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AddTags", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
10
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_dedicated_hosts.go
generated
vendored
10
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_dedicated_hosts.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AllocateDedicatedHosts invokes the ecs.AllocateDedicatedHosts API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/allocatededicatedhosts.html
|
||||
func (client *Client) AllocateDedicatedHosts(request *AllocateDedicatedHostsRequest) (response *AllocateDedicatedHostsResponse, err error) {
|
||||
response = CreateAllocateDedicatedHostsResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AllocateDedicatedHosts(request *AllocateDedicatedHostsRequ
|
|||
}
|
||||
|
||||
// AllocateDedicatedHostsWithChan invokes the ecs.AllocateDedicatedHosts API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/allocatededicatedhosts.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AllocateDedicatedHostsWithChan(request *AllocateDedicatedHostsRequest) (<-chan *AllocateDedicatedHostsResponse, <-chan error) {
|
||||
responseChan := make(chan *AllocateDedicatedHostsResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AllocateDedicatedHostsWithChan(request *AllocateDedicatedH
|
|||
}
|
||||
|
||||
// AllocateDedicatedHostsWithCallback invokes the ecs.AllocateDedicatedHosts API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/allocatededicatedhosts.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AllocateDedicatedHostsWithCallback(request *AllocateDedicatedHostsRequest, callback func(response *AllocateDedicatedHostsResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -79,8 +74,11 @@ type AllocateDedicatedHostsRequest struct {
|
|||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
CpuOverCommitRatio requests.Float `position:"Query" name:"CpuOverCommitRatio"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
MinQuantity requests.Integer `position:"Query" name:"MinQuantity"`
|
||||
ActionOnMaintenance string `position:"Query" name:"ActionOnMaintenance"`
|
||||
DedicatedHostClusterId string `position:"Query" name:"DedicatedHostClusterId"`
|
||||
Tag *[]AllocateDedicatedHostsTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
DedicatedHostType string `position:"Query" name:"DedicatedHostType"`
|
||||
AutoRenewPeriod requests.Integer `position:"Query" name:"AutoRenewPeriod"`
|
||||
|
@ -95,6 +93,7 @@ type AllocateDedicatedHostsRequest struct {
|
|||
AutoRenew requests.Boolean `position:"Query" name:"AutoRenew"`
|
||||
NetworkAttributesSlbUdpTimeout requests.Integer `position:"Query" name:"NetworkAttributes.SlbUdpTimeout"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
AutoPlacement string `position:"Query" name:"AutoPlacement"`
|
||||
ChargeType string `position:"Query" name:"ChargeType"`
|
||||
NetworkAttributesUdpTimeout requests.Integer `position:"Query" name:"NetworkAttributes.UdpTimeout"`
|
||||
}
|
||||
|
@ -118,6 +117,7 @@ func CreateAllocateDedicatedHostsRequest() (request *AllocateDedicatedHostsReque
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AllocateDedicatedHosts", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
13
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_eip_address.go
generated
vendored
13
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_eip_address.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AllocateEipAddress invokes the ecs.AllocateEipAddress API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/allocateeipaddress.html
|
||||
func (client *Client) AllocateEipAddress(request *AllocateEipAddressRequest) (response *AllocateEipAddressResponse, err error) {
|
||||
response = CreateAllocateEipAddressResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AllocateEipAddress(request *AllocateEipAddressRequest) (re
|
|||
}
|
||||
|
||||
// AllocateEipAddressWithChan invokes the ecs.AllocateEipAddress API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/allocateeipaddress.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AllocateEipAddressWithChan(request *AllocateEipAddressRequest) (<-chan *AllocateEipAddressResponse, <-chan error) {
|
||||
responseChan := make(chan *AllocateEipAddressResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AllocateEipAddressWithChan(request *AllocateEipAddressRequ
|
|||
}
|
||||
|
||||
// AllocateEipAddressWithCallback invokes the ecs.AllocateEipAddress API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/allocateeipaddress.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AllocateEipAddressWithCallback(request *AllocateEipAddressRequest, callback func(response *AllocateEipAddressResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,13 +72,14 @@ func (client *Client) AllocateEipAddressWithCallback(request *AllocateEipAddress
|
|||
type AllocateEipAddressRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
ISP string `position:"Query" name:"ISP"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
Bandwidth string `position:"Query" name:"Bandwidth"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
InternetChargeType string `position:"Query" name:"InternetChargeType"`
|
||||
ISP string `position:"Query" name:"ISP"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
ActivityId requests.Integer `position:"Query" name:"ActivityId"`
|
||||
InternetChargeType string `position:"Query" name:"InternetChargeType"`
|
||||
}
|
||||
|
||||
// AllocateEipAddressResponse is the response struct for api AllocateEipAddress
|
||||
|
@ -100,6 +96,7 @@ func CreateAllocateEipAddressRequest() (request *AllocateEipAddressRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AllocateEipAddress", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
10
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_public_ip_address.go
generated
vendored
10
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/allocate_public_ip_address.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AllocatePublicIpAddress invokes the ecs.AllocatePublicIpAddress API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/allocatepublicipaddress.html
|
||||
func (client *Client) AllocatePublicIpAddress(request *AllocatePublicIpAddressRequest) (response *AllocatePublicIpAddressResponse, err error) {
|
||||
response = CreateAllocatePublicIpAddressResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AllocatePublicIpAddress(request *AllocatePublicIpAddressRe
|
|||
}
|
||||
|
||||
// AllocatePublicIpAddressWithChan invokes the ecs.AllocatePublicIpAddress API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/allocatepublicipaddress.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AllocatePublicIpAddressWithChan(request *AllocatePublicIpAddressRequest) (<-chan *AllocatePublicIpAddressResponse, <-chan error) {
|
||||
responseChan := make(chan *AllocatePublicIpAddressResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AllocatePublicIpAddressWithChan(request *AllocatePublicIpA
|
|||
}
|
||||
|
||||
// AllocatePublicIpAddressWithCallback invokes the ecs.AllocatePublicIpAddress API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/allocatepublicipaddress.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AllocatePublicIpAddressWithCallback(request *AllocatePublicIpAddressRequest, callback func(response *AllocatePublicIpAddressResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -78,11 +73,11 @@ type AllocatePublicIpAddressRequest struct {
|
|||
*requests.RpcRequest
|
||||
IpAddress string `position:"Query" name:"IpAddress"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
VlanId string `position:"Query" name:"VlanId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
}
|
||||
|
||||
// AllocatePublicIpAddressResponse is the response struct for api AllocatePublicIpAddress
|
||||
|
@ -98,6 +93,7 @@ func CreateAllocatePublicIpAddressRequest() (request *AllocatePublicIpAddressReq
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AllocatePublicIpAddress", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// ApplyAutoSnapshotPolicy invokes the ecs.ApplyAutoSnapshotPolicy API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/applyautosnapshotpolicy.html
|
||||
func (client *Client) ApplyAutoSnapshotPolicy(request *ApplyAutoSnapshotPolicyRequest) (response *ApplyAutoSnapshotPolicyResponse, err error) {
|
||||
response = CreateApplyAutoSnapshotPolicyResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) ApplyAutoSnapshotPolicy(request *ApplyAutoSnapshotPolicyRe
|
|||
}
|
||||
|
||||
// ApplyAutoSnapshotPolicyWithChan invokes the ecs.ApplyAutoSnapshotPolicy API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/applyautosnapshotpolicy.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) ApplyAutoSnapshotPolicyWithChan(request *ApplyAutoSnapshotPolicyRequest) (<-chan *ApplyAutoSnapshotPolicyResponse, <-chan error) {
|
||||
responseChan := make(chan *ApplyAutoSnapshotPolicyResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) ApplyAutoSnapshotPolicyWithChan(request *ApplyAutoSnapshot
|
|||
}
|
||||
|
||||
// ApplyAutoSnapshotPolicyWithCallback invokes the ecs.ApplyAutoSnapshotPolicy API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/applyautosnapshotpolicy.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) ApplyAutoSnapshotPolicyWithCallback(request *ApplyAutoSnapshotPolicyRequest, callback func(response *ApplyAutoSnapshotPolicyResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,9 +72,9 @@ func (client *Client) ApplyAutoSnapshotPolicyWithCallback(request *ApplyAutoSnap
|
|||
type ApplyAutoSnapshotPolicyRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
AutoSnapshotPolicyId string `position:"Query" name:"autoSnapshotPolicyId"`
|
||||
DiskIds string `position:"Query" name:"diskIds"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
}
|
||||
|
||||
|
@ -95,6 +90,7 @@ func CreateApplyAutoSnapshotPolicyRequest() (request *ApplyAutoSnapshotPolicyReq
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "ApplyAutoSnapshotPolicy", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
6
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/assign_ipv6_addresses.go
generated
vendored
6
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/assign_ipv6_addresses.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AssignIpv6Addresses invokes the ecs.AssignIpv6Addresses API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/assignipv6addresses.html
|
||||
func (client *Client) AssignIpv6Addresses(request *AssignIpv6AddressesRequest) (response *AssignIpv6AddressesResponse, err error) {
|
||||
response = CreateAssignIpv6AddressesResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AssignIpv6Addresses(request *AssignIpv6AddressesRequest) (
|
|||
}
|
||||
|
||||
// AssignIpv6AddressesWithChan invokes the ecs.AssignIpv6Addresses API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/assignipv6addresses.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AssignIpv6AddressesWithChan(request *AssignIpv6AddressesRequest) (<-chan *AssignIpv6AddressesResponse, <-chan error) {
|
||||
responseChan := make(chan *AssignIpv6AddressesResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AssignIpv6AddressesWithChan(request *AssignIpv6AddressesRe
|
|||
}
|
||||
|
||||
// AssignIpv6AddressesWithCallback invokes the ecs.AssignIpv6Addresses API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/assignipv6addresses.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AssignIpv6AddressesWithCallback(request *AssignIpv6AddressesRequest, callback func(response *AssignIpv6AddressesResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -97,6 +92,7 @@ func CreateAssignIpv6AddressesRequest() (request *AssignIpv6AddressesRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AssignIpv6Addresses", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AssignPrivateIpAddresses invokes the ecs.AssignPrivateIpAddresses API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/assignprivateipaddresses.html
|
||||
func (client *Client) AssignPrivateIpAddresses(request *AssignPrivateIpAddressesRequest) (response *AssignPrivateIpAddressesResponse, err error) {
|
||||
response = CreateAssignPrivateIpAddressesResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AssignPrivateIpAddresses(request *AssignPrivateIpAddresses
|
|||
}
|
||||
|
||||
// AssignPrivateIpAddressesWithChan invokes the ecs.AssignPrivateIpAddresses API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/assignprivateipaddresses.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AssignPrivateIpAddressesWithChan(request *AssignPrivateIpAddressesRequest) (<-chan *AssignPrivateIpAddressesResponse, <-chan error) {
|
||||
responseChan := make(chan *AssignPrivateIpAddressesResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AssignPrivateIpAddressesWithChan(request *AssignPrivateIpA
|
|||
}
|
||||
|
||||
// AssignPrivateIpAddressesWithCallback invokes the ecs.AssignPrivateIpAddresses API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/assignprivateipaddresses.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AssignPrivateIpAddressesWithCallback(request *AssignPrivateIpAddressesRequest, callback func(response *AssignPrivateIpAddressesResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,6 +72,7 @@ func (client *Client) AssignPrivateIpAddressesWithCallback(request *AssignPrivat
|
|||
type AssignPrivateIpAddressesRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
SecondaryPrivateIpAddressCount requests.Integer `position:"Query" name:"SecondaryPrivateIpAddressCount"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
|
@ -88,7 +84,8 @@ type AssignPrivateIpAddressesRequest struct {
|
|||
// AssignPrivateIpAddressesResponse is the response struct for api AssignPrivateIpAddresses
|
||||
type AssignPrivateIpAddressesResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
AssignedPrivateIpAddressesSet AssignedPrivateIpAddressesSet `json:"AssignedPrivateIpAddressesSet" xml:"AssignedPrivateIpAddressesSet"`
|
||||
}
|
||||
|
||||
// CreateAssignPrivateIpAddressesRequest creates a request to invoke AssignPrivateIpAddresses API
|
||||
|
@ -97,6 +94,7 @@ func CreateAssignPrivateIpAddressesRequest() (request *AssignPrivateIpAddressesR
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AssignPrivateIpAddresses", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
12
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/associate_eip_address.go
generated
vendored
12
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/associate_eip_address.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AssociateEipAddress invokes the ecs.AssociateEipAddress API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/associateeipaddress.html
|
||||
func (client *Client) AssociateEipAddress(request *AssociateEipAddressRequest) (response *AssociateEipAddressResponse, err error) {
|
||||
response = CreateAssociateEipAddressResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AssociateEipAddress(request *AssociateEipAddressRequest) (
|
|||
}
|
||||
|
||||
// AssociateEipAddressWithChan invokes the ecs.AssociateEipAddress API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/associateeipaddress.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AssociateEipAddressWithChan(request *AssociateEipAddressRequest) (<-chan *AssociateEipAddressResponse, <-chan error) {
|
||||
responseChan := make(chan *AssociateEipAddressResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AssociateEipAddressWithChan(request *AssociateEipAddressRe
|
|||
}
|
||||
|
||||
// AssociateEipAddressWithCallback invokes the ecs.AssociateEipAddress API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/associateeipaddress.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AssociateEipAddressWithCallback(request *AssociateEipAddressRequest, callback func(response *AssociateEipAddressResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,12 +72,12 @@ func (client *Client) AssociateEipAddressWithCallback(request *AssociateEipAddre
|
|||
type AssociateEipAddressRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
AllocationId string `position:"Query" name:"AllocationId"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
AllocationId string `position:"Query" name:"AllocationId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
}
|
||||
|
||||
// AssociateEipAddressResponse is the response struct for api AssociateEipAddress
|
||||
|
@ -97,6 +92,7 @@ func CreateAssociateEipAddressRequest() (request *AssociateEipAddressRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AssociateEipAddress", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
12
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/associate_ha_vip.go
generated
vendored
12
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/associate_ha_vip.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AssociateHaVip invokes the ecs.AssociateHaVip API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/associatehavip.html
|
||||
func (client *Client) AssociateHaVip(request *AssociateHaVipRequest) (response *AssociateHaVipResponse, err error) {
|
||||
response = CreateAssociateHaVipResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AssociateHaVip(request *AssociateHaVipRequest) (response *
|
|||
}
|
||||
|
||||
// AssociateHaVipWithChan invokes the ecs.AssociateHaVip API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/associatehavip.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AssociateHaVipWithChan(request *AssociateHaVipRequest) (<-chan *AssociateHaVipResponse, <-chan error) {
|
||||
responseChan := make(chan *AssociateHaVipResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AssociateHaVipWithChan(request *AssociateHaVipRequest) (<-
|
|||
}
|
||||
|
||||
// AssociateHaVipWithCallback invokes the ecs.AssociateHaVip API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/associatehavip.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AssociateHaVipWithCallback(request *AssociateHaVipRequest, callback func(response *AssociateHaVipResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,13 +71,13 @@ func (client *Client) AssociateHaVipWithCallback(request *AssociateHaVipRequest,
|
|||
// AssociateHaVipRequest is the request struct for api AssociateHaVip
|
||||
type AssociateHaVipRequest struct {
|
||||
*requests.RpcRequest
|
||||
HaVipId string `position:"Query" name:"HaVipId"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
HaVipId string `position:"Query" name:"HaVipId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
}
|
||||
|
||||
// AssociateHaVipResponse is the response struct for api AssociateHaVip
|
||||
|
@ -97,6 +92,7 @@ func CreateAssociateHaVipRequest() (request *AssociateHaVipRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AssociateHaVip", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
10
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/attach_classic_link_vpc.go
generated
vendored
10
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/attach_classic_link_vpc.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AttachClassicLinkVpc invokes the ecs.AttachClassicLinkVpc API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachclassiclinkvpc.html
|
||||
func (client *Client) AttachClassicLinkVpc(request *AttachClassicLinkVpcRequest) (response *AttachClassicLinkVpcResponse, err error) {
|
||||
response = CreateAttachClassicLinkVpcResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AttachClassicLinkVpc(request *AttachClassicLinkVpcRequest)
|
|||
}
|
||||
|
||||
// AttachClassicLinkVpcWithChan invokes the ecs.AttachClassicLinkVpc API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachclassiclinkvpc.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachClassicLinkVpcWithChan(request *AttachClassicLinkVpcRequest) (<-chan *AttachClassicLinkVpcResponse, <-chan error) {
|
||||
responseChan := make(chan *AttachClassicLinkVpcResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AttachClassicLinkVpcWithChan(request *AttachClassicLinkVpc
|
|||
}
|
||||
|
||||
// AttachClassicLinkVpcWithCallback invokes the ecs.AttachClassicLinkVpc API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachclassiclinkvpc.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachClassicLinkVpcWithCallback(request *AttachClassicLinkVpcRequest, callback func(response *AttachClassicLinkVpcResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,10 +72,10 @@ func (client *Client) AttachClassicLinkVpcWithCallback(request *AttachClassicLin
|
|||
type AttachClassicLinkVpcRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
VpcId string `position:"Query" name:"VpcId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
VpcId string `position:"Query" name:"VpcId"`
|
||||
}
|
||||
|
||||
// AttachClassicLinkVpcResponse is the response struct for api AttachClassicLinkVpc
|
||||
|
@ -95,6 +90,7 @@ func CreateAttachClassicLinkVpcRequest() (request *AttachClassicLinkVpcRequest)
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AttachClassicLinkVpc", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AttachDisk invokes the ecs.AttachDisk API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachdisk.html
|
||||
func (client *Client) AttachDisk(request *AttachDiskRequest) (response *AttachDiskResponse, err error) {
|
||||
response = CreateAttachDiskResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AttachDisk(request *AttachDiskRequest) (response *AttachDi
|
|||
}
|
||||
|
||||
// AttachDiskWithChan invokes the ecs.AttachDisk API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachdisk.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachDiskWithChan(request *AttachDiskRequest) (<-chan *AttachDiskResponse, <-chan error) {
|
||||
responseChan := make(chan *AttachDiskResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AttachDiskWithChan(request *AttachDiskRequest) (<-chan *At
|
|||
}
|
||||
|
||||
// AttachDiskWithCallback invokes the ecs.AttachDisk API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachdisk.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachDiskWithCallback(request *AttachDiskRequest, callback func(response *AttachDiskResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,13 +72,16 @@ func (client *Client) AttachDiskWithCallback(request *AttachDiskRequest, callbac
|
|||
type AttachDiskRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
KeyPairName string `position:"Query" name:"KeyPairName"`
|
||||
Bootable requests.Boolean `position:"Query" name:"Bootable"`
|
||||
Password string `position:"Query" name:"Password"`
|
||||
DiskId string `position:"Query" name:"DiskId"`
|
||||
DeleteWithInstance requests.Boolean `position:"Query" name:"DeleteWithInstance"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
DiskId string `position:"Query" name:"DiskId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
Device string `position:"Query" name:"Device"`
|
||||
DeleteWithInstance requests.Boolean `position:"Query" name:"DeleteWithInstance"`
|
||||
}
|
||||
|
||||
// AttachDiskResponse is the response struct for api AttachDisk
|
||||
|
@ -98,6 +96,7 @@ func CreateAttachDiskRequest() (request *AttachDiskRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AttachDisk", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AttachInstanceRamRole invokes the ecs.AttachInstanceRamRole API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachinstanceramrole.html
|
||||
func (client *Client) AttachInstanceRamRole(request *AttachInstanceRamRoleRequest) (response *AttachInstanceRamRoleResponse, err error) {
|
||||
response = CreateAttachInstanceRamRoleResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AttachInstanceRamRole(request *AttachInstanceRamRoleReques
|
|||
}
|
||||
|
||||
// AttachInstanceRamRoleWithChan invokes the ecs.AttachInstanceRamRole API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachinstanceramrole.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachInstanceRamRoleWithChan(request *AttachInstanceRamRoleRequest) (<-chan *AttachInstanceRamRoleResponse, <-chan error) {
|
||||
responseChan := make(chan *AttachInstanceRamRoleResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AttachInstanceRamRoleWithChan(request *AttachInstanceRamRo
|
|||
}
|
||||
|
||||
// AttachInstanceRamRoleWithCallback invokes the ecs.AttachInstanceRamRole API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachinstanceramrole.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachInstanceRamRoleWithCallback(request *AttachInstanceRamRoleRequest, callback func(response *AttachInstanceRamRoleResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,10 +72,11 @@ func (client *Client) AttachInstanceRamRoleWithCallback(request *AttachInstanceR
|
|||
type AttachInstanceRamRoleRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
Policy string `position:"Query" name:"Policy"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
InstanceIds string `position:"Query" name:"InstanceIds"`
|
||||
RamRoleName string `position:"Query" name:"RamRoleName"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceIds string `position:"Query" name:"InstanceIds"`
|
||||
}
|
||||
|
||||
// AttachInstanceRamRoleResponse is the response struct for api AttachInstanceRamRole
|
||||
|
@ -99,6 +95,7 @@ func CreateAttachInstanceRamRoleRequest() (request *AttachInstanceRamRoleRequest
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AttachInstanceRamRole", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AttachKeyPair invokes the ecs.AttachKeyPair API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachkeypair.html
|
||||
func (client *Client) AttachKeyPair(request *AttachKeyPairRequest) (response *AttachKeyPairResponse, err error) {
|
||||
response = CreateAttachKeyPairResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AttachKeyPair(request *AttachKeyPairRequest) (response *At
|
|||
}
|
||||
|
||||
// AttachKeyPairWithChan invokes the ecs.AttachKeyPair API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachkeypair.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachKeyPairWithChan(request *AttachKeyPairRequest) (<-chan *AttachKeyPairResponse, <-chan error) {
|
||||
responseChan := make(chan *AttachKeyPairResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AttachKeyPairWithChan(request *AttachKeyPairRequest) (<-ch
|
|||
}
|
||||
|
||||
// AttachKeyPairWithCallback invokes the ecs.AttachKeyPair API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachkeypair.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachKeyPairWithCallback(request *AttachKeyPairRequest, callback func(response *AttachKeyPairResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,10 +72,10 @@ func (client *Client) AttachKeyPairWithCallback(request *AttachKeyPairRequest, c
|
|||
type AttachKeyPairRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
InstanceIds string `position:"Query" name:"InstanceIds"`
|
||||
KeyPairName string `position:"Query" name:"KeyPairName"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceIds string `position:"Query" name:"InstanceIds"`
|
||||
}
|
||||
|
||||
// AttachKeyPairResponse is the response struct for api AttachKeyPair
|
||||
|
@ -99,6 +94,7 @@ func CreateAttachKeyPairRequest() (request *AttachKeyPairRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AttachKeyPair", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
20
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/attach_network_interface.go
generated
vendored
20
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/attach_network_interface.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AttachNetworkInterface invokes the ecs.AttachNetworkInterface API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachnetworkinterface.html
|
||||
func (client *Client) AttachNetworkInterface(request *AttachNetworkInterfaceRequest) (response *AttachNetworkInterfaceResponse, err error) {
|
||||
response = CreateAttachNetworkInterfaceResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AttachNetworkInterface(request *AttachNetworkInterfaceRequ
|
|||
}
|
||||
|
||||
// AttachNetworkInterfaceWithChan invokes the ecs.AttachNetworkInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachnetworkinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachNetworkInterfaceWithChan(request *AttachNetworkInterfaceRequest) (<-chan *AttachNetworkInterfaceResponse, <-chan error) {
|
||||
responseChan := make(chan *AttachNetworkInterfaceResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AttachNetworkInterfaceWithChan(request *AttachNetworkInter
|
|||
}
|
||||
|
||||
// AttachNetworkInterfaceWithCallback invokes the ecs.AttachNetworkInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/attachnetworkinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AttachNetworkInterfaceWithCallback(request *AttachNetworkInterfaceRequest, callback func(response *AttachNetworkInterfaceResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,12 +71,14 @@ func (client *Client) AttachNetworkInterfaceWithCallback(request *AttachNetworkI
|
|||
// AttachNetworkInterfaceRequest is the request struct for api AttachNetworkInterface
|
||||
type AttachNetworkInterfaceRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
NetworkInterfaceId string `position:"Query" name:"NetworkInterfaceId"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
TrunkNetworkInstanceId string `position:"Query" name:"TrunkNetworkInstanceId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
WaitForNetworkConfigurationReady requests.Boolean `position:"Query" name:"WaitForNetworkConfigurationReady"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
NetworkInterfaceId string `position:"Query" name:"NetworkInterfaceId"`
|
||||
}
|
||||
|
||||
// AttachNetworkInterfaceResponse is the response struct for api AttachNetworkInterface
|
||||
|
@ -96,6 +93,7 @@ func CreateAttachNetworkInterfaceRequest() (request *AttachNetworkInterfaceReque
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AttachNetworkInterface", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AuthorizeSecurityGroup invokes the ecs.AuthorizeSecurityGroup API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/authorizesecuritygroup.html
|
||||
func (client *Client) AuthorizeSecurityGroup(request *AuthorizeSecurityGroupRequest) (response *AuthorizeSecurityGroupResponse, err error) {
|
||||
response = CreateAuthorizeSecurityGroupResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AuthorizeSecurityGroup(request *AuthorizeSecurityGroupRequ
|
|||
}
|
||||
|
||||
// AuthorizeSecurityGroupWithChan invokes the ecs.AuthorizeSecurityGroup API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/authorizesecuritygroup.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AuthorizeSecurityGroupWithChan(request *AuthorizeSecurityGroupRequest) (<-chan *AuthorizeSecurityGroupResponse, <-chan error) {
|
||||
responseChan := make(chan *AuthorizeSecurityGroupResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AuthorizeSecurityGroupWithChan(request *AuthorizeSecurityG
|
|||
}
|
||||
|
||||
// AuthorizeSecurityGroupWithCallback invokes the ecs.AuthorizeSecurityGroup API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/authorizesecuritygroup.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AuthorizeSecurityGroupWithCallback(request *AuthorizeSecurityGroupRequest, callback func(response *AuthorizeSecurityGroupResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -110,6 +105,7 @@ func CreateAuthorizeSecurityGroupRequest() (request *AuthorizeSecurityGroupReque
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AuthorizeSecurityGroup", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// AuthorizeSecurityGroupEgress invokes the ecs.AuthorizeSecurityGroupEgress API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/authorizesecuritygroupegress.html
|
||||
func (client *Client) AuthorizeSecurityGroupEgress(request *AuthorizeSecurityGroupEgressRequest) (response *AuthorizeSecurityGroupEgressResponse, err error) {
|
||||
response = CreateAuthorizeSecurityGroupEgressResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) AuthorizeSecurityGroupEgress(request *AuthorizeSecurityGro
|
|||
}
|
||||
|
||||
// AuthorizeSecurityGroupEgressWithChan invokes the ecs.AuthorizeSecurityGroupEgress API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/authorizesecuritygroupegress.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AuthorizeSecurityGroupEgressWithChan(request *AuthorizeSecurityGroupEgressRequest) (<-chan *AuthorizeSecurityGroupEgressResponse, <-chan error) {
|
||||
responseChan := make(chan *AuthorizeSecurityGroupEgressResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) AuthorizeSecurityGroupEgressWithChan(request *AuthorizeSec
|
|||
}
|
||||
|
||||
// AuthorizeSecurityGroupEgressWithCallback invokes the ecs.AuthorizeSecurityGroupEgress API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/authorizesecuritygroupegress.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) AuthorizeSecurityGroupEgressWithCallback(request *AuthorizeSecurityGroupEgressRequest, callback func(response *AuthorizeSecurityGroupEgressResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -110,6 +105,7 @@ func CreateAuthorizeSecurityGroupEgressRequest() (request *AuthorizeSecurityGrou
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "AuthorizeSecurityGroupEgress", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CancelAutoSnapshotPolicy invokes the ecs.CancelAutoSnapshotPolicy API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelautosnapshotpolicy.html
|
||||
func (client *Client) CancelAutoSnapshotPolicy(request *CancelAutoSnapshotPolicyRequest) (response *CancelAutoSnapshotPolicyResponse, err error) {
|
||||
response = CreateCancelAutoSnapshotPolicyResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CancelAutoSnapshotPolicy(request *CancelAutoSnapshotPolicy
|
|||
}
|
||||
|
||||
// CancelAutoSnapshotPolicyWithChan invokes the ecs.CancelAutoSnapshotPolicy API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelautosnapshotpolicy.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelAutoSnapshotPolicyWithChan(request *CancelAutoSnapshotPolicyRequest) (<-chan *CancelAutoSnapshotPolicyResponse, <-chan error) {
|
||||
responseChan := make(chan *CancelAutoSnapshotPolicyResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CancelAutoSnapshotPolicyWithChan(request *CancelAutoSnapsh
|
|||
}
|
||||
|
||||
// CancelAutoSnapshotPolicyWithCallback invokes the ecs.CancelAutoSnapshotPolicy API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelautosnapshotpolicy.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelAutoSnapshotPolicyWithCallback(request *CancelAutoSnapshotPolicyRequest, callback func(response *CancelAutoSnapshotPolicyResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,8 +72,8 @@ func (client *Client) CancelAutoSnapshotPolicyWithCallback(request *CancelAutoSn
|
|||
type CancelAutoSnapshotPolicyRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
DiskIds string `position:"Query" name:"diskIds"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
}
|
||||
|
||||
|
@ -94,6 +89,7 @@ func CreateCancelAutoSnapshotPolicyRequest() (request *CancelAutoSnapshotPolicyR
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CancelAutoSnapshotPolicy", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
6
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/cancel_copy_image.go
generated
vendored
6
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/cancel_copy_image.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CancelCopyImage invokes the ecs.CancelCopyImage API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelcopyimage.html
|
||||
func (client *Client) CancelCopyImage(request *CancelCopyImageRequest) (response *CancelCopyImageResponse, err error) {
|
||||
response = CreateCancelCopyImageResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CancelCopyImage(request *CancelCopyImageRequest) (response
|
|||
}
|
||||
|
||||
// CancelCopyImageWithChan invokes the ecs.CancelCopyImage API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelcopyimage.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelCopyImageWithChan(request *CancelCopyImageRequest) (<-chan *CancelCopyImageResponse, <-chan error) {
|
||||
responseChan := make(chan *CancelCopyImageResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CancelCopyImageWithChan(request *CancelCopyImageRequest) (
|
|||
}
|
||||
|
||||
// CancelCopyImageWithCallback invokes the ecs.CancelCopyImage API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelcopyimage.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelCopyImageWithCallback(request *CancelCopyImageRequest, callback func(response *CancelCopyImageResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -95,6 +90,7 @@ func CreateCancelCopyImageRequest() (request *CancelCopyImageRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CancelCopyImage", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
110
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/cancel_image_pipeline_execution.go
generated
vendored
Normal file
110
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/cancel_image_pipeline_execution.go
generated
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CancelImagePipelineExecution invokes the ecs.CancelImagePipelineExecution API synchronously
|
||||
func (client *Client) CancelImagePipelineExecution(request *CancelImagePipelineExecutionRequest) (response *CancelImagePipelineExecutionResponse, err error) {
|
||||
response = CreateCancelImagePipelineExecutionResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CancelImagePipelineExecutionWithChan invokes the ecs.CancelImagePipelineExecution API asynchronously
|
||||
func (client *Client) CancelImagePipelineExecutionWithChan(request *CancelImagePipelineExecutionRequest) (<-chan *CancelImagePipelineExecutionResponse, <-chan error) {
|
||||
responseChan := make(chan *CancelImagePipelineExecutionResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CancelImagePipelineExecution(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CancelImagePipelineExecutionWithCallback invokes the ecs.CancelImagePipelineExecution API asynchronously
|
||||
func (client *Client) CancelImagePipelineExecutionWithCallback(request *CancelImagePipelineExecutionRequest, callback func(response *CancelImagePipelineExecutionResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CancelImagePipelineExecutionResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CancelImagePipelineExecution(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CancelImagePipelineExecutionRequest is the request struct for api CancelImagePipelineExecution
|
||||
type CancelImagePipelineExecutionRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ExecutionId string `position:"Query" name:"ExecutionId"`
|
||||
TemplateTag *[]CancelImagePipelineExecutionTemplateTag `position:"Query" name:"TemplateTag" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
}
|
||||
|
||||
// CancelImagePipelineExecutionTemplateTag is a repeated param struct in CancelImagePipelineExecutionRequest
|
||||
type CancelImagePipelineExecutionTemplateTag struct {
|
||||
Key string `name:"Key"`
|
||||
Value string `name:"Value"`
|
||||
}
|
||||
|
||||
// CancelImagePipelineExecutionResponse is the response struct for api CancelImagePipelineExecution
|
||||
type CancelImagePipelineExecutionResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
}
|
||||
|
||||
// CreateCancelImagePipelineExecutionRequest creates a request to invoke CancelImagePipelineExecution API
|
||||
func CreateCancelImagePipelineExecutionRequest() (request *CancelImagePipelineExecutionRequest) {
|
||||
request = &CancelImagePipelineExecutionRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CancelImagePipelineExecution", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCancelImagePipelineExecutionResponse creates a response to parse from CancelImagePipelineExecution response
|
||||
func CreateCancelImagePipelineExecutionResponse() (response *CancelImagePipelineExecutionResponse) {
|
||||
response = &CancelImagePipelineExecutionResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
12
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/cancel_physical_connection.go
generated
vendored
12
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/cancel_physical_connection.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CancelPhysicalConnection invokes the ecs.CancelPhysicalConnection API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelphysicalconnection.html
|
||||
func (client *Client) CancelPhysicalConnection(request *CancelPhysicalConnectionRequest) (response *CancelPhysicalConnectionResponse, err error) {
|
||||
response = CreateCancelPhysicalConnectionResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CancelPhysicalConnection(request *CancelPhysicalConnection
|
|||
}
|
||||
|
||||
// CancelPhysicalConnectionWithChan invokes the ecs.CancelPhysicalConnection API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelphysicalconnection.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelPhysicalConnectionWithChan(request *CancelPhysicalConnectionRequest) (<-chan *CancelPhysicalConnectionResponse, <-chan error) {
|
||||
responseChan := make(chan *CancelPhysicalConnectionResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CancelPhysicalConnectionWithChan(request *CancelPhysicalCo
|
|||
}
|
||||
|
||||
// CancelPhysicalConnectionWithCallback invokes the ecs.CancelPhysicalConnection API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelphysicalconnection.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelPhysicalConnectionWithCallback(request *CancelPhysicalConnectionRequest, callback func(response *CancelPhysicalConnectionResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,12 +72,12 @@ func (client *Client) CancelPhysicalConnectionWithCallback(request *CancelPhysic
|
|||
type CancelPhysicalConnectionRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
PhysicalConnectionId string `position:"Query" name:"PhysicalConnectionId"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
UserCidr string `position:"Query" name:"UserCidr"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
PhysicalConnectionId string `position:"Query" name:"PhysicalConnectionId"`
|
||||
}
|
||||
|
||||
// CancelPhysicalConnectionResponse is the response struct for api CancelPhysicalConnection
|
||||
|
@ -97,6 +92,7 @@ func CreateCancelPhysicalConnectionRequest() (request *CancelPhysicalConnectionR
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CancelPhysicalConnection", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CancelSimulatedSystemEvents invokes the ecs.CancelSimulatedSystemEvents API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelsimulatedsystemevents.html
|
||||
func (client *Client) CancelSimulatedSystemEvents(request *CancelSimulatedSystemEventsRequest) (response *CancelSimulatedSystemEventsResponse, err error) {
|
||||
response = CreateCancelSimulatedSystemEventsResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CancelSimulatedSystemEvents(request *CancelSimulatedSystem
|
|||
}
|
||||
|
||||
// CancelSimulatedSystemEventsWithChan invokes the ecs.CancelSimulatedSystemEvents API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelsimulatedsystemevents.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelSimulatedSystemEventsWithChan(request *CancelSimulatedSystemEventsRequest) (<-chan *CancelSimulatedSystemEventsResponse, <-chan error) {
|
||||
responseChan := make(chan *CancelSimulatedSystemEventsResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CancelSimulatedSystemEventsWithChan(request *CancelSimulat
|
|||
}
|
||||
|
||||
// CancelSimulatedSystemEventsWithCallback invokes the ecs.CancelSimulatedSystemEvents API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/cancelsimulatedsystemevents.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelSimulatedSystemEventsWithCallback(request *CancelSimulatedSystemEventsRequest, callback func(response *CancelSimulatedSystemEventsResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -95,6 +90,7 @@ func CreateCancelSimulatedSystemEventsRequest() (request *CancelSimulatedSystemE
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CancelSimulatedSystemEvents", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CancelTask invokes the ecs.CancelTask API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/canceltask.html
|
||||
func (client *Client) CancelTask(request *CancelTaskRequest) (response *CancelTaskResponse, err error) {
|
||||
response = CreateCancelTaskResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CancelTask(request *CancelTaskRequest) (response *CancelTa
|
|||
}
|
||||
|
||||
// CancelTaskWithChan invokes the ecs.CancelTask API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/canceltask.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelTaskWithChan(request *CancelTaskRequest) (<-chan *CancelTaskResponse, <-chan error) {
|
||||
responseChan := make(chan *CancelTaskResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CancelTaskWithChan(request *CancelTaskRequest) (<-chan *Ca
|
|||
}
|
||||
|
||||
// CancelTaskWithCallback invokes the ecs.CancelTask API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/canceltask.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CancelTaskWithCallback(request *CancelTaskRequest, callback func(response *CancelTaskResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,9 +72,9 @@ func (client *Client) CancelTaskWithCallback(request *CancelTaskRequest, callbac
|
|||
type CancelTaskRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
TaskId string `position:"Query" name:"TaskId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
TaskId string `position:"Query" name:"TaskId"`
|
||||
}
|
||||
|
||||
// CancelTaskResponse is the response struct for api CancelTask
|
||||
|
@ -94,6 +89,7 @@ func CreateCancelTaskRequest() (request *CancelTaskRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CancelTask", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,11 @@ package ecs
|
|||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider"
|
||||
)
|
||||
|
||||
// Client is the sdk client struct, each func corresponds to an OpenAPI
|
||||
|
@ -25,10 +28,40 @@ type Client struct {
|
|||
sdk.Client
|
||||
}
|
||||
|
||||
// SetClientProperty Set Property by Reflect
|
||||
func SetClientProperty(client *Client, propertyName string, propertyValue interface{}) {
|
||||
v := reflect.ValueOf(client).Elem()
|
||||
if v.FieldByName(propertyName).IsValid() && v.FieldByName(propertyName).CanSet() {
|
||||
v.FieldByName(propertyName).Set(reflect.ValueOf(propertyValue))
|
||||
}
|
||||
}
|
||||
|
||||
// SetEndpointDataToClient Set EndpointMap and ENdpointType
|
||||
func SetEndpointDataToClient(client *Client) {
|
||||
SetClientProperty(client, "EndpointMap", GetEndpointMap())
|
||||
SetClientProperty(client, "EndpointType", GetEndpointType())
|
||||
}
|
||||
|
||||
// NewClient creates a sdk client with environment variables
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.Init()
|
||||
SetEndpointDataToClient(client)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithProvider creates a sdk client with providers
|
||||
// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
|
||||
func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
var pc provider.Provider
|
||||
if len(providers) == 0 {
|
||||
pc = provider.DefaultChain
|
||||
} else {
|
||||
pc = provider.NewProviderChain(providers)
|
||||
}
|
||||
err = client.InitWithProviderChain(regionId, pc)
|
||||
SetEndpointDataToClient(client)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -37,45 +70,60 @@ func NewClient() (client *Client, err error) {
|
|||
func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithOptions(regionId, config, credential)
|
||||
SetEndpointDataToClient(client)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithAccessKey is a shortcut to create sdk client with accesskey
|
||||
// usage: https://help.aliyun.com/document_detail/66217.html
|
||||
// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
|
||||
func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
|
||||
SetEndpointDataToClient(client)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithStsToken is a shortcut to create sdk client with sts token
|
||||
// usage: https://help.aliyun.com/document_detail/66222.html
|
||||
// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
|
||||
func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
|
||||
SetEndpointDataToClient(client)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn
|
||||
// usage: https://help.aliyun.com/document_detail/66222.html
|
||||
// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
|
||||
func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
|
||||
SetEndpointDataToClient(client)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy
|
||||
// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
|
||||
func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy)
|
||||
SetEndpointDataToClient(client)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role
|
||||
// usage: https://help.aliyun.com/document_detail/66223.html
|
||||
// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
|
||||
func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithEcsRamRole(regionId, roleName)
|
||||
SetEndpointDataToClient(client)
|
||||
return
|
||||
}
|
||||
|
||||
// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair
|
||||
// attention: rsa key pair auth is only Japan regions available
|
||||
// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
|
||||
func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)
|
||||
SetEndpointDataToClient(client)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// ConnectRouterInterface invokes the ecs.ConnectRouterInterface API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/connectrouterinterface.html
|
||||
func (client *Client) ConnectRouterInterface(request *ConnectRouterInterfaceRequest) (response *ConnectRouterInterfaceResponse, err error) {
|
||||
response = CreateConnectRouterInterfaceResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) ConnectRouterInterface(request *ConnectRouterInterfaceRequ
|
|||
}
|
||||
|
||||
// ConnectRouterInterfaceWithChan invokes the ecs.ConnectRouterInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/connectrouterinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) ConnectRouterInterfaceWithChan(request *ConnectRouterInterfaceRequest) (<-chan *ConnectRouterInterfaceResponse, <-chan error) {
|
||||
responseChan := make(chan *ConnectRouterInterfaceResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) ConnectRouterInterfaceWithChan(request *ConnectRouterInter
|
|||
}
|
||||
|
||||
// ConnectRouterInterfaceWithCallback invokes the ecs.ConnectRouterInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/connectrouterinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) ConnectRouterInterfaceWithCallback(request *ConnectRouterInterfaceRequest, callback func(response *ConnectRouterInterfaceResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -94,6 +89,7 @@ func CreateConnectRouterInterfaceRequest() (request *ConnectRouterInterfaceReque
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "ConnectRouterInterface", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// ConvertNatPublicIpToEip invokes the ecs.ConvertNatPublicIpToEip API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/convertnatpubliciptoeip.html
|
||||
func (client *Client) ConvertNatPublicIpToEip(request *ConvertNatPublicIpToEipRequest) (response *ConvertNatPublicIpToEipResponse, err error) {
|
||||
response = CreateConvertNatPublicIpToEipResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) ConvertNatPublicIpToEip(request *ConvertNatPublicIpToEipRe
|
|||
}
|
||||
|
||||
// ConvertNatPublicIpToEipWithChan invokes the ecs.ConvertNatPublicIpToEip API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/convertnatpubliciptoeip.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) ConvertNatPublicIpToEipWithChan(request *ConvertNatPublicIpToEipRequest) (<-chan *ConvertNatPublicIpToEipResponse, <-chan error) {
|
||||
responseChan := make(chan *ConvertNatPublicIpToEipResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) ConvertNatPublicIpToEipWithChan(request *ConvertNatPublicI
|
|||
}
|
||||
|
||||
// ConvertNatPublicIpToEipWithCallback invokes the ecs.ConvertNatPublicIpToEip API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/convertnatpubliciptoeip.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) ConvertNatPublicIpToEipWithCallback(request *ConvertNatPublicIpToEipRequest, callback func(response *ConvertNatPublicIpToEipResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -94,6 +89,7 @@ func CreateConvertNatPublicIpToEipRequest() (request *ConvertNatPublicIpToEipReq
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "ConvertNatPublicIpToEip", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CopyImage invokes the ecs.CopyImage API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/copyimage.html
|
||||
func (client *Client) CopyImage(request *CopyImageRequest) (response *CopyImageResponse, err error) {
|
||||
response = CreateCopyImageResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CopyImage(request *CopyImageRequest) (response *CopyImageR
|
|||
}
|
||||
|
||||
// CopyImageWithChan invokes the ecs.CopyImage API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/copyimage.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CopyImageWithChan(request *CopyImageRequest) (<-chan *CopyImageResponse, <-chan error) {
|
||||
responseChan := make(chan *CopyImageResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CopyImageWithChan(request *CopyImageRequest) (<-chan *Copy
|
|||
}
|
||||
|
||||
// CopyImageWithCallback invokes the ecs.CopyImage API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/copyimage.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CopyImageWithCallback(request *CopyImageRequest, callback func(response *CopyImageResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -78,13 +73,16 @@ type CopyImageRequest struct {
|
|||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ImageId string `position:"Query" name:"ImageId"`
|
||||
EncryptAlgorithm string `position:"Query" name:"EncryptAlgorithm"`
|
||||
DestinationRegionId string `position:"Query" name:"DestinationRegionId"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
Tag *[]CopyImageTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
DestinationImageName string `position:"Query" name:"DestinationImageName"`
|
||||
DestinationRegionId string `position:"Query" name:"DestinationRegionId"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
Encrypted requests.Boolean `position:"Query" name:"Encrypted"`
|
||||
Tag *[]CopyImageTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
KMSKeyId string `position:"Query" name:"KMSKeyId"`
|
||||
DestinationDescription string `position:"Query" name:"DestinationDescription"`
|
||||
}
|
||||
|
||||
|
@ -107,6 +105,7 @@ func CreateCopyImageRequest() (request *CopyImageRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CopyImage", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
115
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/copy_snapshot.go
generated
vendored
Normal file
115
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/copy_snapshot.go
generated
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CopySnapshot invokes the ecs.CopySnapshot API synchronously
|
||||
func (client *Client) CopySnapshot(request *CopySnapshotRequest) (response *CopySnapshotResponse, err error) {
|
||||
response = CreateCopySnapshotResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CopySnapshotWithChan invokes the ecs.CopySnapshot API asynchronously
|
||||
func (client *Client) CopySnapshotWithChan(request *CopySnapshotRequest) (<-chan *CopySnapshotResponse, <-chan error) {
|
||||
responseChan := make(chan *CopySnapshotResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CopySnapshot(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CopySnapshotWithCallback invokes the ecs.CopySnapshot API asynchronously
|
||||
func (client *Client) CopySnapshotWithCallback(request *CopySnapshotRequest, callback func(response *CopySnapshotResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CopySnapshotResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CopySnapshot(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CopySnapshotRequest is the request struct for api CopySnapshot
|
||||
type CopySnapshotRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
SnapshotId string `position:"Query" name:"SnapshotId"`
|
||||
DestinationRegionId string `position:"Query" name:"DestinationRegionId"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
Tag *[]CopySnapshotTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
DestinationSnapshotName string `position:"Query" name:"DestinationSnapshotName"`
|
||||
DestinationSnapshotDescription string `position:"Query" name:"DestinationSnapshotDescription"`
|
||||
RetentionDays requests.Integer `position:"Query" name:"RetentionDays"`
|
||||
}
|
||||
|
||||
// CopySnapshotTag is a repeated param struct in CopySnapshotRequest
|
||||
type CopySnapshotTag struct {
|
||||
Key string `name:"Key"`
|
||||
Value string `name:"Value"`
|
||||
}
|
||||
|
||||
// CopySnapshotResponse is the response struct for api CopySnapshot
|
||||
type CopySnapshotResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
SnapshotId string `json:"SnapshotId" xml:"SnapshotId"`
|
||||
}
|
||||
|
||||
// CreateCopySnapshotRequest creates a request to invoke CopySnapshot API
|
||||
func CreateCopySnapshotRequest() (request *CopySnapshotRequest) {
|
||||
request = &CopySnapshotRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CopySnapshot", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCopySnapshotResponse creates a response to parse from CopySnapshot response
|
||||
func CreateCopySnapshotResponse() (response *CopySnapshotResponse) {
|
||||
response = &CopySnapshotResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
109
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_activation.go
generated
vendored
Normal file
109
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_activation.go
generated
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CreateActivation invokes the ecs.CreateActivation API synchronously
|
||||
func (client *Client) CreateActivation(request *CreateActivationRequest) (response *CreateActivationResponse, err error) {
|
||||
response = CreateCreateActivationResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateActivationWithChan invokes the ecs.CreateActivation API asynchronously
|
||||
func (client *Client) CreateActivationWithChan(request *CreateActivationRequest) (<-chan *CreateActivationResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateActivationResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CreateActivation(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CreateActivationWithCallback invokes the ecs.CreateActivation API asynchronously
|
||||
func (client *Client) CreateActivationWithCallback(request *CreateActivationRequest, callback func(response *CreateActivationResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CreateActivationResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CreateActivation(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CreateActivationRequest is the request struct for api CreateActivation
|
||||
type CreateActivationRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
InstanceCount requests.Integer `position:"Query" name:"InstanceCount"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceName string `position:"Query" name:"InstanceName"`
|
||||
TimeToLiveInHours requests.Integer `position:"Query" name:"TimeToLiveInHours"`
|
||||
IpAddressRange string `position:"Query" name:"IpAddressRange"`
|
||||
}
|
||||
|
||||
// CreateActivationResponse is the response struct for api CreateActivation
|
||||
type CreateActivationResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
ActivationId string `json:"ActivationId" xml:"ActivationId"`
|
||||
ActivationCode string `json:"ActivationCode" xml:"ActivationCode"`
|
||||
}
|
||||
|
||||
// CreateCreateActivationRequest creates a request to invoke CreateActivation API
|
||||
func CreateCreateActivationRequest() (request *CreateActivationRequest) {
|
||||
request = &CreateActivationRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateActivation", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCreateActivationResponse creates a response to parse from CreateActivation response
|
||||
func CreateCreateActivationResponse() (response *CreateActivationResponse) {
|
||||
response = &CreateActivationResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
192
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_auto_provisioning_group.go
generated
vendored
Normal file
192
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_auto_provisioning_group.go
generated
vendored
Normal file
|
@ -0,0 +1,192 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CreateAutoProvisioningGroup invokes the ecs.CreateAutoProvisioningGroup API synchronously
|
||||
func (client *Client) CreateAutoProvisioningGroup(request *CreateAutoProvisioningGroupRequest) (response *CreateAutoProvisioningGroupResponse, err error) {
|
||||
response = CreateCreateAutoProvisioningGroupResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateAutoProvisioningGroupWithChan invokes the ecs.CreateAutoProvisioningGroup API asynchronously
|
||||
func (client *Client) CreateAutoProvisioningGroupWithChan(request *CreateAutoProvisioningGroupRequest) (<-chan *CreateAutoProvisioningGroupResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateAutoProvisioningGroupResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CreateAutoProvisioningGroup(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CreateAutoProvisioningGroupWithCallback invokes the ecs.CreateAutoProvisioningGroup API asynchronously
|
||||
func (client *Client) CreateAutoProvisioningGroupWithCallback(request *CreateAutoProvisioningGroupRequest, callback func(response *CreateAutoProvisioningGroupResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CreateAutoProvisioningGroupResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CreateAutoProvisioningGroup(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CreateAutoProvisioningGroupRequest is the request struct for api CreateAutoProvisioningGroup
|
||||
type CreateAutoProvisioningGroupRequest struct {
|
||||
*requests.RpcRequest
|
||||
LaunchConfigurationDataDisk *[]CreateAutoProvisioningGroupLaunchConfigurationDataDisk `position:"Query" name:"LaunchConfiguration.DataDisk" type:"Repeated"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
LaunchConfigurationSystemDiskCategory string `position:"Query" name:"LaunchConfiguration.SystemDiskCategory"`
|
||||
AutoProvisioningGroupType string `position:"Query" name:"AutoProvisioningGroupType"`
|
||||
LaunchConfigurationSystemDiskPerformanceLevel string `position:"Query" name:"LaunchConfiguration.SystemDiskPerformanceLevel"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
LaunchConfigurationImageId string `position:"Query" name:"LaunchConfiguration.ImageId"`
|
||||
LaunchConfigurationResourceGroupId string `position:"Query" name:"LaunchConfiguration.ResourceGroupId"`
|
||||
LaunchConfigurationPassword string `position:"Query" name:"LaunchConfiguration.Password"`
|
||||
PayAsYouGoAllocationStrategy string `position:"Query" name:"PayAsYouGoAllocationStrategy"`
|
||||
DefaultTargetCapacityType string `position:"Query" name:"DefaultTargetCapacityType"`
|
||||
LaunchConfigurationKeyPairName string `position:"Query" name:"LaunchConfiguration.KeyPairName"`
|
||||
SystemDiskConfig *[]CreateAutoProvisioningGroupSystemDiskConfig `position:"Query" name:"SystemDiskConfig" type:"Repeated"`
|
||||
DataDiskConfig *[]CreateAutoProvisioningGroupDataDiskConfig `position:"Query" name:"DataDiskConfig" type:"Repeated"`
|
||||
ValidUntil string `position:"Query" name:"ValidUntil"`
|
||||
LaunchTemplateId string `position:"Query" name:"LaunchTemplateId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
LaunchConfigurationSystemDiskSize requests.Integer `position:"Query" name:"LaunchConfiguration.SystemDiskSize"`
|
||||
LaunchConfigurationInternetMaxBandwidthOut requests.Integer `position:"Query" name:"LaunchConfiguration.InternetMaxBandwidthOut"`
|
||||
LaunchConfigurationHostName string `position:"Query" name:"LaunchConfiguration.HostName"`
|
||||
MaxSpotPrice requests.Float `position:"Query" name:"MaxSpotPrice"`
|
||||
LaunchConfigurationPasswordInherit requests.Boolean `position:"Query" name:"LaunchConfiguration.PasswordInherit"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
LaunchConfigurationSecurityGroupId string `position:"Query" name:"LaunchConfiguration.SecurityGroupId"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
TerminateInstancesWithExpiration requests.Boolean `position:"Query" name:"TerminateInstancesWithExpiration"`
|
||||
LaunchConfigurationUserData string `position:"Query" name:"LaunchConfiguration.UserData"`
|
||||
LaunchConfigurationCreditSpecification string `position:"Query" name:"LaunchConfiguration.CreditSpecification"`
|
||||
LaunchConfigurationInstanceName string `position:"Query" name:"LaunchConfiguration.InstanceName"`
|
||||
LaunchConfigurationInstanceDescription string `position:"Query" name:"LaunchConfiguration.InstanceDescription"`
|
||||
SpotAllocationStrategy string `position:"Query" name:"SpotAllocationStrategy"`
|
||||
TerminateInstances requests.Boolean `position:"Query" name:"TerminateInstances"`
|
||||
LaunchConfigurationSystemDiskName string `position:"Query" name:"LaunchConfiguration.SystemDiskName"`
|
||||
LaunchConfigurationSystemDiskDescription string `position:"Query" name:"LaunchConfiguration.SystemDiskDescription"`
|
||||
ExcessCapacityTerminationPolicy string `position:"Query" name:"ExcessCapacityTerminationPolicy"`
|
||||
LaunchTemplateConfig *[]CreateAutoProvisioningGroupLaunchTemplateConfig `position:"Query" name:"LaunchTemplateConfig" type:"Repeated"`
|
||||
LaunchConfigurationRamRoleName string `position:"Query" name:"LaunchConfiguration.RamRoleName"`
|
||||
LaunchConfigurationInternetMaxBandwidthIn requests.Integer `position:"Query" name:"LaunchConfiguration.InternetMaxBandwidthIn"`
|
||||
SpotInstanceInterruptionBehavior string `position:"Query" name:"SpotInstanceInterruptionBehavior"`
|
||||
LaunchConfigurationSecurityEnhancementStrategy string `position:"Query" name:"LaunchConfiguration.SecurityEnhancementStrategy"`
|
||||
LaunchConfigurationTag *[]CreateAutoProvisioningGroupLaunchConfigurationTag `position:"Query" name:"LaunchConfiguration.Tag" type:"Repeated"`
|
||||
LaunchConfigurationDeploymentSetId string `position:"Query" name:"LaunchConfiguration.DeploymentSetId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
SpotInstancePoolsToUseCount requests.Integer `position:"Query" name:"SpotInstancePoolsToUseCount"`
|
||||
LaunchConfigurationInternetChargeType string `position:"Query" name:"LaunchConfiguration.InternetChargeType"`
|
||||
LaunchTemplateVersion string `position:"Query" name:"LaunchTemplateVersion"`
|
||||
LaunchConfigurationIoOptimized string `position:"Query" name:"LaunchConfiguration.IoOptimized"`
|
||||
PayAsYouGoTargetCapacity string `position:"Query" name:"PayAsYouGoTargetCapacity"`
|
||||
TotalTargetCapacity string `position:"Query" name:"TotalTargetCapacity"`
|
||||
SpotTargetCapacity string `position:"Query" name:"SpotTargetCapacity"`
|
||||
ValidFrom string `position:"Query" name:"ValidFrom"`
|
||||
AutoProvisioningGroupName string `position:"Query" name:"AutoProvisioningGroupName"`
|
||||
}
|
||||
|
||||
// CreateAutoProvisioningGroupLaunchConfiguration.DataDisk is a repeated param struct in CreateAutoProvisioningGroupRequest
|
||||
type CreateAutoProvisioningGroupLaunchConfigurationDataDisk struct {
|
||||
Size string `name:"Size"`
|
||||
Category string `name:"Category"`
|
||||
PerformanceLevel string `name:"PerformanceLevel"`
|
||||
Device string `name:"Device"`
|
||||
SnapshotId string `name:"SnapshotId"`
|
||||
DeleteWithInstance string `name:"DeleteWithInstance"`
|
||||
Encrypted string `name:"Encrypted"`
|
||||
KmsKeyId string `name:"KmsKeyId"`
|
||||
DiskName string `name:"DiskName"`
|
||||
Description string `name:"Description"`
|
||||
}
|
||||
|
||||
// CreateAutoProvisioningGroupSystemDiskConfig is a repeated param struct in CreateAutoProvisioningGroupRequest
|
||||
type CreateAutoProvisioningGroupSystemDiskConfig struct {
|
||||
DiskCategory string `name:"DiskCategory"`
|
||||
}
|
||||
|
||||
// CreateAutoProvisioningGroupDataDiskConfig is a repeated param struct in CreateAutoProvisioningGroupRequest
|
||||
type CreateAutoProvisioningGroupDataDiskConfig struct {
|
||||
DiskCategory string `name:"DiskCategory"`
|
||||
}
|
||||
|
||||
// CreateAutoProvisioningGroupLaunchTemplateConfig is a repeated param struct in CreateAutoProvisioningGroupRequest
|
||||
type CreateAutoProvisioningGroupLaunchTemplateConfig struct {
|
||||
InstanceType string `name:"InstanceType"`
|
||||
MaxPrice string `name:"MaxPrice"`
|
||||
VSwitchId string `name:"VSwitchId"`
|
||||
WeightedCapacity string `name:"WeightedCapacity"`
|
||||
Priority string `name:"Priority"`
|
||||
}
|
||||
|
||||
// CreateAutoProvisioningGroupLaunchConfiguration.Tag is a repeated param struct in CreateAutoProvisioningGroupRequest
|
||||
type CreateAutoProvisioningGroupLaunchConfigurationTag struct {
|
||||
Key string `name:"Key"`
|
||||
Value string `name:"Value"`
|
||||
}
|
||||
|
||||
// CreateAutoProvisioningGroupResponse is the response struct for api CreateAutoProvisioningGroup
|
||||
type CreateAutoProvisioningGroupResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
AutoProvisioningGroupId string `json:"AutoProvisioningGroupId" xml:"AutoProvisioningGroupId"`
|
||||
LaunchResults LaunchResults `json:"LaunchResults" xml:"LaunchResults"`
|
||||
}
|
||||
|
||||
// CreateCreateAutoProvisioningGroupRequest creates a request to invoke CreateAutoProvisioningGroup API
|
||||
func CreateCreateAutoProvisioningGroupRequest() (request *CreateAutoProvisioningGroupRequest) {
|
||||
request = &CreateAutoProvisioningGroupRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateAutoProvisioningGroup", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCreateAutoProvisioningGroupResponse creates a response to parse from CreateAutoProvisioningGroup response
|
||||
func CreateCreateAutoProvisioningGroupResponse() (response *CreateAutoProvisioningGroupResponse) {
|
||||
response = &CreateAutoProvisioningGroupResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateAutoSnapshotPolicy invokes the ecs.CreateAutoSnapshotPolicy API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createautosnapshotpolicy.html
|
||||
func (client *Client) CreateAutoSnapshotPolicy(request *CreateAutoSnapshotPolicyRequest) (response *CreateAutoSnapshotPolicyResponse, err error) {
|
||||
response = CreateCreateAutoSnapshotPolicyResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateAutoSnapshotPolicy(request *CreateAutoSnapshotPolicy
|
|||
}
|
||||
|
||||
// CreateAutoSnapshotPolicyWithChan invokes the ecs.CreateAutoSnapshotPolicy API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createautosnapshotpolicy.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateAutoSnapshotPolicyWithChan(request *CreateAutoSnapshotPolicyRequest) (<-chan *CreateAutoSnapshotPolicyResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateAutoSnapshotPolicyResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateAutoSnapshotPolicyWithChan(request *CreateAutoSnapsh
|
|||
}
|
||||
|
||||
// CreateAutoSnapshotPolicyWithCallback invokes the ecs.CreateAutoSnapshotPolicy API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createautosnapshotpolicy.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateAutoSnapshotPolicyWithCallback(request *CreateAutoSnapshotPolicyRequest, callback func(response *CreateAutoSnapshotPolicyResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,13 +71,23 @@ func (client *Client) CreateAutoSnapshotPolicyWithCallback(request *CreateAutoSn
|
|||
// CreateAutoSnapshotPolicyRequest is the request struct for api CreateAutoSnapshotPolicy
|
||||
type CreateAutoSnapshotPolicyRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
TimePoints string `position:"Query" name:"timePoints"`
|
||||
RetentionDays requests.Integer `position:"Query" name:"retentionDays"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
RepeatWeekdays string `position:"Query" name:"repeatWeekdays"`
|
||||
AutoSnapshotPolicyName string `position:"Query" name:"autoSnapshotPolicyName"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
CopiedSnapshotsRetentionDays requests.Integer `position:"Query" name:"CopiedSnapshotsRetentionDays"`
|
||||
TimePoints string `position:"Query" name:"timePoints"`
|
||||
RepeatWeekdays string `position:"Query" name:"repeatWeekdays"`
|
||||
Tag *[]CreateAutoSnapshotPolicyTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
EnableCrossRegionCopy requests.Boolean `position:"Query" name:"EnableCrossRegionCopy"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
AutoSnapshotPolicyName string `position:"Query" name:"autoSnapshotPolicyName"`
|
||||
RetentionDays requests.Integer `position:"Query" name:"retentionDays"`
|
||||
TargetCopyRegions string `position:"Query" name:"TargetCopyRegions"`
|
||||
}
|
||||
|
||||
// CreateAutoSnapshotPolicyTag is a repeated param struct in CreateAutoSnapshotPolicyRequest
|
||||
type CreateAutoSnapshotPolicyTag struct {
|
||||
Value string `name:"Value"`
|
||||
Key string `name:"Key"`
|
||||
}
|
||||
|
||||
// CreateAutoSnapshotPolicyResponse is the response struct for api CreateAutoSnapshotPolicy
|
||||
|
@ -98,6 +103,7 @@ func CreateCreateAutoSnapshotPolicyRequest() (request *CreateAutoSnapshotPolicyR
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateAutoSnapshotPolicy", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
130
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_capacity_reservation.go
generated
vendored
Normal file
130
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_capacity_reservation.go
generated
vendored
Normal file
|
@ -0,0 +1,130 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CreateCapacityReservation invokes the ecs.CreateCapacityReservation API synchronously
|
||||
func (client *Client) CreateCapacityReservation(request *CreateCapacityReservationRequest) (response *CreateCapacityReservationResponse, err error) {
|
||||
response = CreateCreateCapacityReservationResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCapacityReservationWithChan invokes the ecs.CreateCapacityReservation API asynchronously
|
||||
func (client *Client) CreateCapacityReservationWithChan(request *CreateCapacityReservationRequest) (<-chan *CreateCapacityReservationResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateCapacityReservationResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CreateCapacityReservation(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CreateCapacityReservationWithCallback invokes the ecs.CreateCapacityReservation API asynchronously
|
||||
func (client *Client) CreateCapacityReservationWithCallback(request *CreateCapacityReservationRequest, callback func(response *CreateCapacityReservationResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CreateCapacityReservationResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CreateCapacityReservation(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CreateCapacityReservationRequest is the request struct for api CreateCapacityReservation
|
||||
type CreateCapacityReservationRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
StartTime string `position:"Query" name:"StartTime"`
|
||||
Platform string `position:"Query" name:"Platform"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
PrivatePoolOptionsMatchCriteria string `position:"Query" name:"PrivatePoolOptions.MatchCriteria"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
Tag *[]CreateCapacityReservationTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
|
||||
EfficientStatus requests.Integer `position:"Query" name:"EfficientStatus"`
|
||||
Period requests.Integer `position:"Query" name:"Period"`
|
||||
EndTimeType string `position:"Query" name:"EndTimeType"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
PrivatePoolOptionsName string `position:"Query" name:"PrivatePoolOptions.Name"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
EndTime string `position:"Query" name:"EndTime"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
ResourceType string `position:"Query" name:"ResourceType"`
|
||||
PeriodUnit string `position:"Query" name:"PeriodUnit"`
|
||||
TimeSlot string `position:"Query" name:"TimeSlot"`
|
||||
ZoneId *[]string `position:"Query" name:"ZoneId" type:"Repeated"`
|
||||
ChargeType string `position:"Query" name:"ChargeType"`
|
||||
PackageType string `position:"Query" name:"PackageType"`
|
||||
InstanceAmount requests.Integer `position:"Query" name:"InstanceAmount"`
|
||||
}
|
||||
|
||||
// CreateCapacityReservationTag is a repeated param struct in CreateCapacityReservationRequest
|
||||
type CreateCapacityReservationTag struct {
|
||||
Key string `name:"Key"`
|
||||
Value string `name:"Value"`
|
||||
}
|
||||
|
||||
// CreateCapacityReservationResponse is the response struct for api CreateCapacityReservation
|
||||
type CreateCapacityReservationResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
PrivatePoolOptionsId string `json:"PrivatePoolOptionsId" xml:"PrivatePoolOptionsId"`
|
||||
}
|
||||
|
||||
// CreateCreateCapacityReservationRequest creates a request to invoke CreateCapacityReservation API
|
||||
func CreateCreateCapacityReservationRequest() (request *CreateCapacityReservationRequest) {
|
||||
request = &CreateCapacityReservationRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateCapacityReservation", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCreateCapacityReservationResponse creates a response to parse from CreateCapacityReservation response
|
||||
func CreateCreateCapacityReservationResponse() (response *CreateCapacityReservationResponse) {
|
||||
response = &CreateCapacityReservationResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateCommand invokes the ecs.CreateCommand API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createcommand.html
|
||||
func (client *Client) CreateCommand(request *CreateCommandRequest) (response *CreateCommandResponse, err error) {
|
||||
response = CreateCreateCommandResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateCommand(request *CreateCommandRequest) (response *Cr
|
|||
}
|
||||
|
||||
// CreateCommandWithChan invokes the ecs.CreateCommand API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createcommand.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateCommandWithChan(request *CreateCommandRequest) (<-chan *CreateCommandResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateCommandResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateCommandWithChan(request *CreateCommandRequest) (<-ch
|
|||
}
|
||||
|
||||
// CreateCommandWithCallback invokes the ecs.CreateCommand API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createcommand.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateCommandWithCallback(request *CreateCommandRequest, callback func(response *CreateCommandResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -86,6 +81,7 @@ type CreateCommandRequest struct {
|
|||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
Name string `position:"Query" name:"Name"`
|
||||
EnableParameter requests.Boolean `position:"Query" name:"EnableParameter"`
|
||||
}
|
||||
|
||||
// CreateCommandResponse is the response struct for api CreateCommand
|
||||
|
@ -101,6 +97,7 @@ func CreateCreateCommandRequest() (request *CreateCommandRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateCommand", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
115
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_dedicated_host_cluster.go
generated
vendored
Normal file
115
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_dedicated_host_cluster.go
generated
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CreateDedicatedHostCluster invokes the ecs.CreateDedicatedHostCluster API synchronously
|
||||
func (client *Client) CreateDedicatedHostCluster(request *CreateDedicatedHostClusterRequest) (response *CreateDedicatedHostClusterResponse, err error) {
|
||||
response = CreateCreateDedicatedHostClusterResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateDedicatedHostClusterWithChan invokes the ecs.CreateDedicatedHostCluster API asynchronously
|
||||
func (client *Client) CreateDedicatedHostClusterWithChan(request *CreateDedicatedHostClusterRequest) (<-chan *CreateDedicatedHostClusterResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateDedicatedHostClusterResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CreateDedicatedHostCluster(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CreateDedicatedHostClusterWithCallback invokes the ecs.CreateDedicatedHostCluster API asynchronously
|
||||
func (client *Client) CreateDedicatedHostClusterWithCallback(request *CreateDedicatedHostClusterRequest, callback func(response *CreateDedicatedHostClusterResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CreateDedicatedHostClusterResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CreateDedicatedHostCluster(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CreateDedicatedHostClusterRequest is the request struct for api CreateDedicatedHostCluster
|
||||
type CreateDedicatedHostClusterRequest struct {
|
||||
*requests.RpcRequest
|
||||
DedicatedHostClusterName string `position:"Query" name:"DedicatedHostClusterName"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
Tag *[]CreateDedicatedHostClusterTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
DryRun requests.Boolean `position:"Query" name:"DryRun"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
}
|
||||
|
||||
// CreateDedicatedHostClusterTag is a repeated param struct in CreateDedicatedHostClusterRequest
|
||||
type CreateDedicatedHostClusterTag struct {
|
||||
Key string `name:"Key"`
|
||||
Value string `name:"Value"`
|
||||
}
|
||||
|
||||
// CreateDedicatedHostClusterResponse is the response struct for api CreateDedicatedHostCluster
|
||||
type CreateDedicatedHostClusterResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
DedicatedHostClusterId string `json:"DedicatedHostClusterId" xml:"DedicatedHostClusterId"`
|
||||
}
|
||||
|
||||
// CreateCreateDedicatedHostClusterRequest creates a request to invoke CreateDedicatedHostCluster API
|
||||
func CreateCreateDedicatedHostClusterRequest() (request *CreateDedicatedHostClusterRequest) {
|
||||
request = &CreateDedicatedHostClusterRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateDedicatedHostCluster", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCreateDedicatedHostClusterResponse creates a response to parse from CreateDedicatedHostCluster response
|
||||
func CreateCreateDedicatedHostClusterResponse() (response *CreateDedicatedHostClusterResponse) {
|
||||
response = &CreateDedicatedHostClusterResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
114
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_demand.go
generated
vendored
Normal file
114
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_demand.go
generated
vendored
Normal file
|
@ -0,0 +1,114 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CreateDemand invokes the ecs.CreateDemand API synchronously
|
||||
func (client *Client) CreateDemand(request *CreateDemandRequest) (response *CreateDemandResponse, err error) {
|
||||
response = CreateCreateDemandResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateDemandWithChan invokes the ecs.CreateDemand API asynchronously
|
||||
func (client *Client) CreateDemandWithChan(request *CreateDemandRequest) (<-chan *CreateDemandResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateDemandResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CreateDemand(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CreateDemandWithCallback invokes the ecs.CreateDemand API asynchronously
|
||||
func (client *Client) CreateDemandWithCallback(request *CreateDemandRequest, callback func(response *CreateDemandResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CreateDemandResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CreateDemand(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CreateDemandRequest is the request struct for api CreateDemand
|
||||
type CreateDemandRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
StartTime string `position:"Query" name:"StartTime"`
|
||||
DemandDescription string `position:"Query" name:"DemandDescription"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
|
||||
DemandName string `position:"Query" name:"DemandName"`
|
||||
Amount requests.Integer `position:"Query" name:"Amount"`
|
||||
Period requests.Integer `position:"Query" name:"Period"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
EndTime string `position:"Query" name:"EndTime"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
PeriodUnit string `position:"Query" name:"PeriodUnit"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
}
|
||||
|
||||
// CreateDemandResponse is the response struct for api CreateDemand
|
||||
type CreateDemandResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
DemandId string `json:"DemandId" xml:"DemandId"`
|
||||
}
|
||||
|
||||
// CreateCreateDemandRequest creates a request to invoke CreateDemand API
|
||||
func CreateCreateDemandRequest() (request *CreateDemandRequest) {
|
||||
request = &CreateDemandRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateDemand", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCreateDemandResponse creates a response to parse from CreateDemand response
|
||||
func CreateCreateDemandResponse() (response *CreateDemandResponse) {
|
||||
response = &CreateDemandResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
11
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_deployment_set.go
generated
vendored
11
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_deployment_set.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateDeploymentSet invokes the ecs.CreateDeploymentSet API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createdeploymentset.html
|
||||
func (client *Client) CreateDeploymentSet(request *CreateDeploymentSetRequest) (response *CreateDeploymentSetResponse, err error) {
|
||||
response = CreateCreateDeploymentSetResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateDeploymentSet(request *CreateDeploymentSetRequest) (
|
|||
}
|
||||
|
||||
// CreateDeploymentSetWithChan invokes the ecs.CreateDeploymentSet API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createdeploymentset.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateDeploymentSetWithChan(request *CreateDeploymentSetRequest) (<-chan *CreateDeploymentSetResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateDeploymentSetResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateDeploymentSetWithChan(request *CreateDeploymentSetRe
|
|||
}
|
||||
|
||||
// CreateDeploymentSetWithCallback invokes the ecs.CreateDeploymentSet API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createdeploymentset.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateDeploymentSetWithCallback(request *CreateDeploymentSetRequest, callback func(response *CreateDeploymentSetResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,10 +72,11 @@ func (client *Client) CreateDeploymentSetWithCallback(request *CreateDeploymentS
|
|||
type CreateDeploymentSetRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
GroupCount requests.Integer `position:"Query" name:"GroupCount"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
DeploymentSetName string `position:"Query" name:"DeploymentSetName"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
OnUnableToRedeployFailedInstance string `position:"Query" name:"OnUnableToRedeployFailedInstance"`
|
||||
|
@ -102,6 +98,7 @@ func CreateCreateDeploymentSetRequest() (request *CreateDeploymentSetRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateDeploymentSet", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateDisk invokes the ecs.CreateDisk API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createdisk.html
|
||||
func (client *Client) CreateDisk(request *CreateDiskRequest) (response *CreateDiskResponse, err error) {
|
||||
response = CreateCreateDiskResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateDisk(request *CreateDiskRequest) (response *CreateDi
|
|||
}
|
||||
|
||||
// CreateDiskWithChan invokes the ecs.CreateDisk API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createdisk.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateDiskWithChan(request *CreateDiskRequest) (<-chan *CreateDiskResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateDiskResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateDiskWithChan(request *CreateDiskRequest) (<-chan *Cr
|
|||
}
|
||||
|
||||
// CreateDiskWithCallback invokes the ecs.CreateDisk API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createdisk.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateDiskWithCallback(request *CreateDiskRequest, callback func(response *CreateDiskResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,23 +71,28 @@ func (client *Client) CreateDiskWithCallback(request *CreateDiskRequest, callbac
|
|||
// CreateDiskRequest is the request struct for api CreateDisk
|
||||
type CreateDiskRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
SnapshotId string `position:"Query" name:"SnapshotId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
DiskName string `position:"Query" name:"DiskName"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
Size requests.Integer `position:"Query" name:"Size"`
|
||||
Encrypted requests.Boolean `position:"Query" name:"Encrypted"`
|
||||
DiskCategory string `position:"Query" name:"DiskCategory"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
Tag *[]CreateDiskTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
Arn *[]CreateDiskArn `position:"Query" name:"Arn" type:"Repeated"`
|
||||
KMSKeyId string `position:"Query" name:"KMSKeyId"`
|
||||
AdvancedFeatures string `position:"Query" name:"AdvancedFeatures"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
SnapshotId string `position:"Query" name:"SnapshotId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
EncryptAlgorithm string `position:"Query" name:"EncryptAlgorithm"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
DiskName string `position:"Query" name:"DiskName"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
DiskCategory string `position:"Query" name:"DiskCategory"`
|
||||
StorageSetPartitionNumber requests.Integer `position:"Query" name:"StorageSetPartitionNumber"`
|
||||
Tag *[]CreateDiskTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
Arn *[]CreateDiskArn `position:"Query" name:"Arn" type:"Repeated"`
|
||||
AdvancedFeatures string `position:"Query" name:"AdvancedFeatures"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
PerformanceLevel string `position:"Query" name:"PerformanceLevel"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
StorageSetId string `position:"Query" name:"StorageSetId"`
|
||||
Size requests.Integer `position:"Query" name:"Size"`
|
||||
Encrypted requests.Boolean `position:"Query" name:"Encrypted"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
KMSKeyId string `position:"Query" name:"KMSKeyId"`
|
||||
}
|
||||
|
||||
// CreateDiskTag is a repeated param struct in CreateDiskRequest
|
||||
|
@ -113,6 +113,7 @@ type CreateDiskResponse struct {
|
|||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
DiskId string `json:"DiskId" xml:"DiskId"`
|
||||
OrderId string `json:"OrderId" xml:"OrderId"`
|
||||
}
|
||||
|
||||
// CreateCreateDiskRequest creates a request to invoke CreateDisk API
|
||||
|
@ -121,6 +122,7 @@ func CreateCreateDiskRequest() (request *CreateDiskRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateDisk", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
129
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_elasticity_assurance.go
generated
vendored
Normal file
129
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_elasticity_assurance.go
generated
vendored
Normal file
|
@ -0,0 +1,129 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CreateElasticityAssurance invokes the ecs.CreateElasticityAssurance API synchronously
|
||||
func (client *Client) CreateElasticityAssurance(request *CreateElasticityAssuranceRequest) (response *CreateElasticityAssuranceResponse, err error) {
|
||||
response = CreateCreateElasticityAssuranceResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateElasticityAssuranceWithChan invokes the ecs.CreateElasticityAssurance API asynchronously
|
||||
func (client *Client) CreateElasticityAssuranceWithChan(request *CreateElasticityAssuranceRequest) (<-chan *CreateElasticityAssuranceResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateElasticityAssuranceResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CreateElasticityAssurance(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CreateElasticityAssuranceWithCallback invokes the ecs.CreateElasticityAssurance API asynchronously
|
||||
func (client *Client) CreateElasticityAssuranceWithCallback(request *CreateElasticityAssuranceRequest, callback func(response *CreateElasticityAssuranceResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CreateElasticityAssuranceResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CreateElasticityAssurance(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CreateElasticityAssuranceRequest is the request struct for api CreateElasticityAssurance
|
||||
type CreateElasticityAssuranceRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
StartTime string `position:"Query" name:"StartTime"`
|
||||
Platform string `position:"Query" name:"Platform"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
PrivatePoolOptionsMatchCriteria string `position:"Query" name:"PrivatePoolOptions.MatchCriteria"`
|
||||
InstanceType *[]string `position:"Query" name:"InstanceType" type:"Repeated"`
|
||||
Tag *[]CreateElasticityAssuranceTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
|
||||
Period requests.Integer `position:"Query" name:"Period"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
PrivatePoolOptionsName string `position:"Query" name:"PrivatePoolOptions.Name"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
AssuranceTimes string `position:"Query" name:"AssuranceTimes"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
ResourceType string `position:"Query" name:"ResourceType"`
|
||||
InstanceCpuCoreCount requests.Integer `position:"Query" name:"InstanceCpuCoreCount"`
|
||||
PeriodUnit string `position:"Query" name:"PeriodUnit"`
|
||||
ZoneId *[]string `position:"Query" name:"ZoneId" type:"Repeated"`
|
||||
ChargeType string `position:"Query" name:"ChargeType"`
|
||||
PackageType string `position:"Query" name:"PackageType"`
|
||||
InstanceAmount requests.Integer `position:"Query" name:"InstanceAmount"`
|
||||
}
|
||||
|
||||
// CreateElasticityAssuranceTag is a repeated param struct in CreateElasticityAssuranceRequest
|
||||
type CreateElasticityAssuranceTag struct {
|
||||
Key string `name:"Key"`
|
||||
Value string `name:"Value"`
|
||||
}
|
||||
|
||||
// CreateElasticityAssuranceResponse is the response struct for api CreateElasticityAssurance
|
||||
type CreateElasticityAssuranceResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
PrivatePoolOptionsId string `json:"PrivatePoolOptionsId" xml:"PrivatePoolOptionsId"`
|
||||
OrderId string `json:"OrderId" xml:"OrderId"`
|
||||
}
|
||||
|
||||
// CreateCreateElasticityAssuranceRequest creates a request to invoke CreateElasticityAssurance API
|
||||
func CreateCreateElasticityAssuranceRequest() (request *CreateElasticityAssuranceRequest) {
|
||||
request = &CreateElasticityAssuranceRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateElasticityAssurance", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCreateElasticityAssuranceResponse creates a response to parse from CreateElasticityAssurance response
|
||||
func CreateCreateElasticityAssuranceResponse() (response *CreateElasticityAssuranceResponse) {
|
||||
response = &CreateElasticityAssuranceResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
14
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_forward_entry.go
generated
vendored
14
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_forward_entry.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateForwardEntry invokes the ecs.CreateForwardEntry API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createforwardentry.html
|
||||
func (client *Client) CreateForwardEntry(request *CreateForwardEntryRequest) (response *CreateForwardEntryResponse, err error) {
|
||||
response = CreateCreateForwardEntryResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateForwardEntry(request *CreateForwardEntryRequest) (re
|
|||
}
|
||||
|
||||
// CreateForwardEntryWithChan invokes the ecs.CreateForwardEntry API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createforwardentry.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateForwardEntryWithChan(request *CreateForwardEntryRequest) (<-chan *CreateForwardEntryResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateForwardEntryResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateForwardEntryWithChan(request *CreateForwardEntryRequ
|
|||
}
|
||||
|
||||
// CreateForwardEntryWithCallback invokes the ecs.CreateForwardEntry API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createforwardentry.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateForwardEntryWithCallback(request *CreateForwardEntryRequest, callback func(response *CreateForwardEntryResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,15 +72,15 @@ func (client *Client) CreateForwardEntryWithCallback(request *CreateForwardEntry
|
|||
type CreateForwardEntryRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ForwardTableId string `position:"Query" name:"ForwardTableId"`
|
||||
InternalIp string `position:"Query" name:"InternalIp"`
|
||||
ExternalIp string `position:"Query" name:"ExternalIp"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
IpProtocol string `position:"Query" name:"IpProtocol"`
|
||||
InternalPort string `position:"Query" name:"InternalPort"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
ForwardTableId string `position:"Query" name:"ForwardTableId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
ExternalIp string `position:"Query" name:"ExternalIp"`
|
||||
InternalPort string `position:"Query" name:"InternalPort"`
|
||||
ExternalPort string `position:"Query" name:"ExternalPort"`
|
||||
InternalIp string `position:"Query" name:"InternalIp"`
|
||||
}
|
||||
|
||||
// CreateForwardEntryResponse is the response struct for api CreateForwardEntry
|
||||
|
@ -101,6 +96,7 @@ func CreateCreateForwardEntryRequest() (request *CreateForwardEntryRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateForwardEntry", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateHaVip invokes the ecs.CreateHaVip API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createhavip.html
|
||||
func (client *Client) CreateHaVip(request *CreateHaVipRequest) (response *CreateHaVipResponse, err error) {
|
||||
response = CreateCreateHaVipResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateHaVip(request *CreateHaVipRequest) (response *Create
|
|||
}
|
||||
|
||||
// CreateHaVipWithChan invokes the ecs.CreateHaVip API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createhavip.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateHaVipWithChan(request *CreateHaVipRequest) (<-chan *CreateHaVipResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateHaVipResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateHaVipWithChan(request *CreateHaVipRequest) (<-chan *
|
|||
}
|
||||
|
||||
// CreateHaVipWithCallback invokes the ecs.CreateHaVip API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createhavip.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateHaVipWithCallback(request *CreateHaVipRequest, callback func(response *CreateHaVipResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,14 +71,14 @@ func (client *Client) CreateHaVipWithCallback(request *CreateHaVipRequest, callb
|
|||
// CreateHaVipRequest is the request struct for api CreateHaVip
|
||||
type CreateHaVipRequest struct {
|
||||
*requests.RpcRequest
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
IpAddress string `position:"Query" name:"IpAddress"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// CreateHaVipResponse is the response struct for api CreateHaVip
|
||||
|
@ -99,6 +94,7 @@ func CreateCreateHaVipRequest() (request *CreateHaVipRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateHaVip", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
6
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_hpc_cluster.go
generated
vendored
6
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_hpc_cluster.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateHpcCluster invokes the ecs.CreateHpcCluster API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createhpccluster.html
|
||||
func (client *Client) CreateHpcCluster(request *CreateHpcClusterRequest) (response *CreateHpcClusterResponse, err error) {
|
||||
response = CreateCreateHpcClusterResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateHpcCluster(request *CreateHpcClusterRequest) (respon
|
|||
}
|
||||
|
||||
// CreateHpcClusterWithChan invokes the ecs.CreateHpcCluster API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createhpccluster.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateHpcClusterWithChan(request *CreateHpcClusterRequest) (<-chan *CreateHpcClusterResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateHpcClusterResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateHpcClusterWithChan(request *CreateHpcClusterRequest)
|
|||
}
|
||||
|
||||
// CreateHpcClusterWithCallback invokes the ecs.CreateHpcCluster API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createhpccluster.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateHpcClusterWithCallback(request *CreateHpcClusterRequest, callback func(response *CreateHpcClusterResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -98,6 +93,7 @@ func CreateCreateHpcClusterRequest() (request *CreateHpcClusterRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateHpcCluster", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateImage invokes the ecs.CreateImage API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createimage.html
|
||||
func (client *Client) CreateImage(request *CreateImageRequest) (response *CreateImageResponse, err error) {
|
||||
response = CreateCreateImageResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateImage(request *CreateImageRequest) (response *Create
|
|||
}
|
||||
|
||||
// CreateImageWithChan invokes the ecs.CreateImage API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createimage.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateImageWithChan(request *CreateImageRequest) (<-chan *CreateImageResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateImageResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateImageWithChan(request *CreateImageRequest) (<-chan *
|
|||
}
|
||||
|
||||
// CreateImageWithCallback invokes the ecs.CreateImage API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createimage.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateImageWithCallback(request *CreateImageRequest, callback func(response *CreateImageResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -79,18 +74,19 @@ type CreateImageRequest struct {
|
|||
DiskDeviceMapping *[]CreateImageDiskDeviceMapping `position:"Query" name:"DiskDeviceMapping" type:"Repeated"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
SnapshotId string `position:"Query" name:"SnapshotId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
Platform string `position:"Query" name:"Platform"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
ImageName string `position:"Query" name:"ImageName"`
|
||||
ImageVersion string `position:"Query" name:"ImageVersion"`
|
||||
Tag *[]CreateImageTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
Architecture string `position:"Query" name:"Architecture"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
InstanceId string `position:"Query" name:"InstanceId"`
|
||||
ImageFamily string `position:"Query" name:"ImageFamily"`
|
||||
ImageVersion string `position:"Query" name:"ImageVersion"`
|
||||
}
|
||||
|
||||
// CreateImageDiskDeviceMapping is a repeated param struct in CreateImageRequest
|
||||
|
@ -120,6 +116,7 @@ func CreateCreateImageRequest() (request *CreateImageRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateImage", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
117
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_component.go
generated
vendored
Normal file
117
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_component.go
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CreateImageComponent invokes the ecs.CreateImageComponent API synchronously
|
||||
func (client *Client) CreateImageComponent(request *CreateImageComponentRequest) (response *CreateImageComponentResponse, err error) {
|
||||
response = CreateCreateImageComponentResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateImageComponentWithChan invokes the ecs.CreateImageComponent API asynchronously
|
||||
func (client *Client) CreateImageComponentWithChan(request *CreateImageComponentRequest) (<-chan *CreateImageComponentResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateImageComponentResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CreateImageComponent(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CreateImageComponentWithCallback invokes the ecs.CreateImageComponent API asynchronously
|
||||
func (client *Client) CreateImageComponentWithCallback(request *CreateImageComponentRequest, callback func(response *CreateImageComponentResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CreateImageComponentResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CreateImageComponent(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CreateImageComponentRequest is the request struct for api CreateImageComponent
|
||||
type CreateImageComponentRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
SystemType string `position:"Query" name:"SystemType"`
|
||||
Content string `position:"Query" name:"Content"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
Tag *[]CreateImageComponentTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
ComponentType string `position:"Query" name:"ComponentType"`
|
||||
Name string `position:"Query" name:"Name"`
|
||||
}
|
||||
|
||||
// CreateImageComponentTag is a repeated param struct in CreateImageComponentRequest
|
||||
type CreateImageComponentTag struct {
|
||||
Key string `name:"Key"`
|
||||
Value string `name:"Value"`
|
||||
}
|
||||
|
||||
// CreateImageComponentResponse is the response struct for api CreateImageComponent
|
||||
type CreateImageComponentResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
ImageComponentId string `json:"ImageComponentId" xml:"ImageComponentId"`
|
||||
}
|
||||
|
||||
// CreateCreateImageComponentRequest creates a request to invoke CreateImageComponent API
|
||||
func CreateCreateImageComponentRequest() (request *CreateImageComponentRequest) {
|
||||
request = &CreateImageComponentRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateImageComponent", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCreateImageComponentResponse creates a response to parse from CreateImageComponent response
|
||||
func CreateCreateImageComponentResponse() (response *CreateImageComponentResponse) {
|
||||
response = &CreateImageComponentResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
125
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_pipeline.go
generated
vendored
Normal file
125
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_image_pipeline.go
generated
vendored
Normal file
|
@ -0,0 +1,125 @@
|
|||
package ecs
|
||||
|
||||
//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"
|
||||
)
|
||||
|
||||
// CreateImagePipeline invokes the ecs.CreateImagePipeline API synchronously
|
||||
func (client *Client) CreateImagePipeline(request *CreateImagePipelineRequest) (response *CreateImagePipelineResponse, err error) {
|
||||
response = CreateCreateImagePipelineResponse()
|
||||
err = client.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateImagePipelineWithChan invokes the ecs.CreateImagePipeline API asynchronously
|
||||
func (client *Client) CreateImagePipelineWithChan(request *CreateImagePipelineRequest) (<-chan *CreateImagePipelineResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateImagePipelineResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
defer close(responseChan)
|
||||
defer close(errChan)
|
||||
response, err := client.CreateImagePipeline(request)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
} else {
|
||||
responseChan <- response
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
close(responseChan)
|
||||
close(errChan)
|
||||
}
|
||||
return responseChan, errChan
|
||||
}
|
||||
|
||||
// CreateImagePipelineWithCallback invokes the ecs.CreateImagePipeline API asynchronously
|
||||
func (client *Client) CreateImagePipelineWithCallback(request *CreateImagePipelineRequest, callback func(response *CreateImagePipelineResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
var response *CreateImagePipelineResponse
|
||||
var err error
|
||||
defer close(result)
|
||||
response, err = client.CreateImagePipeline(request)
|
||||
callback(response, err)
|
||||
result <- 1
|
||||
})
|
||||
if err != nil {
|
||||
defer close(result)
|
||||
callback(nil, err)
|
||||
result <- 0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CreateImagePipelineRequest is the request struct for api CreateImagePipeline
|
||||
type CreateImagePipelineRequest struct {
|
||||
*requests.RpcRequest
|
||||
BaseImageType string `position:"Query" name:"BaseImageType"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
ToRegionId *[]string `position:"Query" name:"ToRegionId" type:"Repeated"`
|
||||
InternetMaxBandwidthOut requests.Integer `position:"Query" name:"InternetMaxBandwidthOut"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
ImageName string `position:"Query" name:"ImageName"`
|
||||
SystemDiskSize requests.Integer `position:"Query" name:"SystemDiskSize"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
Tag *[]CreateImagePipelineTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
BaseImage string `position:"Query" name:"BaseImage"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
AddAccount *[]string `position:"Query" name:"AddAccount" type:"Repeated"`
|
||||
DeleteInstanceOnFailure requests.Boolean `position:"Query" name:"DeleteInstanceOnFailure"`
|
||||
Name string `position:"Query" name:"Name"`
|
||||
BuildContent string `position:"Query" name:"BuildContent"`
|
||||
}
|
||||
|
||||
// CreateImagePipelineTag is a repeated param struct in CreateImagePipelineRequest
|
||||
type CreateImagePipelineTag struct {
|
||||
Key string `name:"Key"`
|
||||
Value string `name:"Value"`
|
||||
}
|
||||
|
||||
// CreateImagePipelineResponse is the response struct for api CreateImagePipeline
|
||||
type CreateImagePipelineResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
ImagePipelineId string `json:"ImagePipelineId" xml:"ImagePipelineId"`
|
||||
}
|
||||
|
||||
// CreateCreateImagePipelineRequest creates a request to invoke CreateImagePipeline API
|
||||
func CreateCreateImagePipelineRequest() (request *CreateImagePipelineRequest) {
|
||||
request = &CreateImagePipelineRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateImagePipeline", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateCreateImagePipelineResponse creates a response to parse from CreateImagePipeline response
|
||||
func CreateCreateImagePipelineResponse() (response *CreateImagePipelineResponse) {
|
||||
response = &CreateImagePipelineResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
134
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_instance.go
generated
vendored
134
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_instance.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateInstance invokes the ecs.CreateInstance API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createinstance.html
|
||||
func (client *Client) CreateInstance(request *CreateInstanceRequest) (response *CreateInstanceResponse, err error) {
|
||||
response = CreateCreateInstanceResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateInstance(request *CreateInstanceRequest) (response *
|
|||
}
|
||||
|
||||
// CreateInstanceWithChan invokes the ecs.CreateInstance API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createinstance.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateInstanceWithChan(request *CreateInstanceRequest) (<-chan *CreateInstanceResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateInstanceResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateInstanceWithChan(request *CreateInstanceRequest) (<-
|
|||
}
|
||||
|
||||
// CreateInstanceWithCallback invokes the ecs.CreateInstance API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createinstance.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateInstanceWithCallback(request *CreateInstanceRequest, callback func(response *CreateInstanceResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,59 +71,73 @@ func (client *Client) CreateInstanceWithCallback(request *CreateInstanceRequest,
|
|||
// CreateInstanceRequest is the request struct for api CreateInstance
|
||||
type CreateInstanceRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
HpcClusterId string `position:"Query" name:"HpcClusterId"`
|
||||
SecurityEnhancementStrategy string `position:"Query" name:"SecurityEnhancementStrategy"`
|
||||
KeyPairName string `position:"Query" name:"KeyPairName"`
|
||||
SpotPriceLimit requests.Float `position:"Query" name:"SpotPriceLimit"`
|
||||
DeletionProtection requests.Boolean `position:"Query" name:"DeletionProtection"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
HostName string `position:"Query" name:"HostName"`
|
||||
Password string `position:"Query" name:"Password"`
|
||||
Tag *[]CreateInstanceTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
AutoRenewPeriod requests.Integer `position:"Query" name:"AutoRenewPeriod"`
|
||||
NodeControllerId string `position:"Query" name:"NodeControllerId"`
|
||||
Period requests.Integer `position:"Query" name:"Period"`
|
||||
DryRun requests.Boolean `position:"Query" name:"DryRun"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
CapacityReservationPreference string `position:"Query" name:"CapacityReservationPreference"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"`
|
||||
SpotStrategy string `position:"Query" name:"SpotStrategy"`
|
||||
PeriodUnit string `position:"Query" name:"PeriodUnit"`
|
||||
InstanceName string `position:"Query" name:"InstanceName"`
|
||||
AutoRenew requests.Boolean `position:"Query" name:"AutoRenew"`
|
||||
InternetChargeType string `position:"Query" name:"InternetChargeType"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
InternetMaxBandwidthIn requests.Integer `position:"Query" name:"InternetMaxBandwidthIn"`
|
||||
UseAdditionalService requests.Boolean `position:"Query" name:"UseAdditionalService"`
|
||||
ImageId string `position:"Query" name:"ImageId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
VlanId string `position:"Query" name:"VlanId"`
|
||||
SpotInterruptionBehavior string `position:"Query" name:"SpotInterruptionBehavior"`
|
||||
IoOptimized string `position:"Query" name:"IoOptimized"`
|
||||
SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
||||
InternetMaxBandwidthOut requests.Integer `position:"Query" name:"InternetMaxBandwidthOut"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
SystemDiskCategory string `position:"Query" name:"SystemDisk.Category"`
|
||||
CapacityReservationId string `position:"Query" name:"CapacityReservationId"`
|
||||
UserData string `position:"Query" name:"UserData"`
|
||||
PasswordInherit requests.Boolean `position:"Query" name:"PasswordInherit"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
Arn *[]CreateInstanceArn `position:"Query" name:"Arn" type:"Repeated"`
|
||||
InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
|
||||
DeploymentSetId string `position:"Query" name:"DeploymentSetId"`
|
||||
InnerIpAddress string `position:"Query" name:"InnerIpAddress"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
SystemDiskDiskName string `position:"Query" name:"SystemDisk.DiskName"`
|
||||
RamRoleName string `position:"Query" name:"RamRoleName"`
|
||||
DedicatedHostId string `position:"Query" name:"DedicatedHostId"`
|
||||
ClusterId string `position:"Query" name:"ClusterId"`
|
||||
CreditSpecification string `position:"Query" name:"CreditSpecification"`
|
||||
DataDisk *[]CreateInstanceDataDisk `position:"Query" name:"DataDisk" type:"Repeated"`
|
||||
SystemDiskSize requests.Integer `position:"Query" name:"SystemDisk.Size"`
|
||||
SystemDiskDescription string `position:"Query" name:"SystemDisk.Description"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
HpcClusterId string `position:"Query" name:"HpcClusterId"`
|
||||
HttpPutResponseHopLimit requests.Integer `position:"Query" name:"HttpPutResponseHopLimit"`
|
||||
SecurityEnhancementStrategy string `position:"Query" name:"SecurityEnhancementStrategy"`
|
||||
KeyPairName string `position:"Query" name:"KeyPairName"`
|
||||
SpotPriceLimit requests.Float `position:"Query" name:"SpotPriceLimit"`
|
||||
DeletionProtection requests.Boolean `position:"Query" name:"DeletionProtection"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
PrivatePoolOptionsMatchCriteria string `position:"Query" name:"PrivatePoolOptions.MatchCriteria"`
|
||||
HostName string `position:"Query" name:"HostName"`
|
||||
Password string `position:"Query" name:"Password"`
|
||||
DeploymentSetGroupNo requests.Integer `position:"Query" name:"DeploymentSetGroupNo"`
|
||||
StorageSetPartitionNumber requests.Integer `position:"Query" name:"StorageSetPartitionNumber"`
|
||||
Tag *[]CreateInstanceTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
PrivatePoolOptionsId string `position:"Query" name:"PrivatePoolOptions.Id"`
|
||||
AutoRenewPeriod requests.Integer `position:"Query" name:"AutoRenewPeriod"`
|
||||
NodeControllerId string `position:"Query" name:"NodeControllerId"`
|
||||
Period requests.Integer `position:"Query" name:"Period"`
|
||||
DryRun requests.Boolean `position:"Query" name:"DryRun"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
CapacityReservationPreference string `position:"Query" name:"CapacityReservationPreference"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"`
|
||||
SpotStrategy string `position:"Query" name:"SpotStrategy"`
|
||||
PeriodUnit string `position:"Query" name:"PeriodUnit"`
|
||||
InstanceName string `position:"Query" name:"InstanceName"`
|
||||
AutoRenew requests.Boolean `position:"Query" name:"AutoRenew"`
|
||||
InternetChargeType string `position:"Query" name:"InternetChargeType"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
InternetMaxBandwidthIn requests.Integer `position:"Query" name:"InternetMaxBandwidthIn"`
|
||||
UseAdditionalService requests.Boolean `position:"Query" name:"UseAdditionalService"`
|
||||
Affinity string `position:"Query" name:"Affinity"`
|
||||
ImageId string `position:"Query" name:"ImageId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
VlanId string `position:"Query" name:"VlanId"`
|
||||
SpotInterruptionBehavior string `position:"Query" name:"SpotInterruptionBehavior"`
|
||||
IoOptimized string `position:"Query" name:"IoOptimized"`
|
||||
SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
||||
InternetMaxBandwidthOut requests.Integer `position:"Query" name:"InternetMaxBandwidthOut"`
|
||||
HibernationOptionsConfigured requests.Boolean `position:"Query" name:"HibernationOptions.Configured"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
SystemDiskCategory string `position:"Query" name:"SystemDisk.Category"`
|
||||
CapacityReservationId string `position:"Query" name:"CapacityReservationId"`
|
||||
SystemDiskPerformanceLevel string `position:"Query" name:"SystemDisk.PerformanceLevel"`
|
||||
UserData string `position:"Query" name:"UserData"`
|
||||
PasswordInherit requests.Boolean `position:"Query" name:"PasswordInherit"`
|
||||
HttpEndpoint string `position:"Query" name:"HttpEndpoint"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
Arn *[]CreateInstanceArn `position:"Query" name:"Arn" type:"Repeated"`
|
||||
InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
|
||||
DeploymentSetId string `position:"Query" name:"DeploymentSetId"`
|
||||
InnerIpAddress string `position:"Query" name:"InnerIpAddress"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
Tenancy string `position:"Query" name:"Tenancy"`
|
||||
SystemDiskDiskName string `position:"Query" name:"SystemDisk.DiskName"`
|
||||
RamRoleName string `position:"Query" name:"RamRoleName"`
|
||||
DedicatedHostId string `position:"Query" name:"DedicatedHostId"`
|
||||
ClusterId string `position:"Query" name:"ClusterId"`
|
||||
CreditSpecification string `position:"Query" name:"CreditSpecification"`
|
||||
SpotDuration requests.Integer `position:"Query" name:"SpotDuration"`
|
||||
DataDisk *[]CreateInstanceDataDisk `position:"Query" name:"DataDisk" type:"Repeated"`
|
||||
StorageSetId string `position:"Query" name:"StorageSetId"`
|
||||
SystemDiskSize requests.Integer `position:"Query" name:"SystemDisk.Size"`
|
||||
ImageFamily string `position:"Query" name:"ImageFamily"`
|
||||
HttpTokens string `position:"Query" name:"HttpTokens"`
|
||||
SystemDiskDescription string `position:"Query" name:"SystemDisk.Description"`
|
||||
}
|
||||
|
||||
// CreateInstanceTag is a repeated param struct in CreateInstanceRequest
|
||||
|
@ -150,6 +159,8 @@ type CreateInstanceDataDisk struct {
|
|||
SnapshotId string `name:"SnapshotId"`
|
||||
Size string `name:"Size"`
|
||||
Encrypted string `name:"Encrypted"`
|
||||
PerformanceLevel string `name:"PerformanceLevel"`
|
||||
EncryptAlgorithm string `name:"EncryptAlgorithm"`
|
||||
Description string `name:"Description"`
|
||||
Category string `name:"Category"`
|
||||
KMSKeyId string `name:"KMSKeyId"`
|
||||
|
@ -160,8 +171,10 @@ type CreateInstanceDataDisk struct {
|
|||
// CreateInstanceResponse is the response struct for api CreateInstance
|
||||
type CreateInstanceResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
InstanceId string `json:"InstanceId" xml:"InstanceId"`
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
InstanceId string `json:"InstanceId" xml:"InstanceId"`
|
||||
TradePrice float64 `json:"TradePrice" xml:"TradePrice"`
|
||||
OrderId string `json:"OrderId" xml:"OrderId"`
|
||||
}
|
||||
|
||||
// CreateCreateInstanceRequest creates a request to invoke CreateInstance API
|
||||
|
@ -170,6 +183,7 @@ func CreateCreateInstanceRequest() (request *CreateInstanceRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateInstance", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateKeyPair invokes the ecs.CreateKeyPair API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createkeypair.html
|
||||
func (client *Client) CreateKeyPair(request *CreateKeyPairRequest) (response *CreateKeyPairResponse, err error) {
|
||||
response = CreateCreateKeyPairResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateKeyPair(request *CreateKeyPairRequest) (response *Cr
|
|||
}
|
||||
|
||||
// CreateKeyPairWithChan invokes the ecs.CreateKeyPair API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createkeypair.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateKeyPairWithChan(request *CreateKeyPairRequest) (<-chan *CreateKeyPairResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateKeyPairResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateKeyPairWithChan(request *CreateKeyPairRequest) (<-ch
|
|||
}
|
||||
|
||||
// CreateKeyPairWithCallback invokes the ecs.CreateKeyPair API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createkeypair.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateKeyPairWithCallback(request *CreateKeyPairRequest, callback func(response *CreateKeyPairResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,11 +71,11 @@ func (client *Client) CreateKeyPairWithCallback(request *CreateKeyPairRequest, c
|
|||
// CreateKeyPairRequest is the request struct for api CreateKeyPair
|
||||
type CreateKeyPairRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
KeyPairName string `position:"Query" name:"KeyPairName"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
Tag *[]CreateKeyPairTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
}
|
||||
|
||||
|
@ -106,6 +101,7 @@ func CreateCreateKeyPairRequest() (request *CreateKeyPairRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateKeyPair", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
111
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_launch_template.go
generated
vendored
111
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_launch_template.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateLaunchTemplate invokes the ecs.CreateLaunchTemplate API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createlaunchtemplate.html
|
||||
func (client *Client) CreateLaunchTemplate(request *CreateLaunchTemplateRequest) (response *CreateLaunchTemplateResponse, err error) {
|
||||
response = CreateCreateLaunchTemplateResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateLaunchTemplate(request *CreateLaunchTemplateRequest)
|
|||
}
|
||||
|
||||
// CreateLaunchTemplateWithChan invokes the ecs.CreateLaunchTemplate API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createlaunchtemplate.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateLaunchTemplateWithChan(request *CreateLaunchTemplateRequest) (<-chan *CreateLaunchTemplateResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateLaunchTemplateResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateLaunchTemplateWithChan(request *CreateLaunchTemplate
|
|||
}
|
||||
|
||||
// CreateLaunchTemplateWithCallback invokes the ecs.CreateLaunchTemplate API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createlaunchtemplate.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateLaunchTemplateWithCallback(request *CreateLaunchTemplateRequest, callback func(response *CreateLaunchTemplateResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,50 +71,55 @@ func (client *Client) CreateLaunchTemplateWithCallback(request *CreateLaunchTemp
|
|||
// CreateLaunchTemplateRequest is the request struct for api CreateLaunchTemplate
|
||||
type CreateLaunchTemplateRequest struct {
|
||||
*requests.RpcRequest
|
||||
LaunchTemplateName string `position:"Query" name:"LaunchTemplateName"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
SecurityEnhancementStrategy string `position:"Query" name:"SecurityEnhancementStrategy"`
|
||||
NetworkType string `position:"Query" name:"NetworkType"`
|
||||
KeyPairName string `position:"Query" name:"KeyPairName"`
|
||||
SpotPriceLimit requests.Float `position:"Query" name:"SpotPriceLimit"`
|
||||
ImageOwnerAlias string `position:"Query" name:"ImageOwnerAlias"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
HostName string `position:"Query" name:"HostName"`
|
||||
SystemDiskIops requests.Integer `position:"Query" name:"SystemDisk.Iops"`
|
||||
TemplateTag *[]CreateLaunchTemplateTemplateTag `position:"Query" name:"TemplateTag" type:"Repeated"`
|
||||
Tag *[]CreateLaunchTemplateTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
Period requests.Integer `position:"Query" name:"Period"`
|
||||
TemplateResourceGroupId string `position:"Query" name:"TemplateResourceGroupId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
SpotStrategy string `position:"Query" name:"SpotStrategy"`
|
||||
InstanceName string `position:"Query" name:"InstanceName"`
|
||||
InternetChargeType string `position:"Query" name:"InternetChargeType"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
InternetMaxBandwidthIn requests.Integer `position:"Query" name:"InternetMaxBandwidthIn"`
|
||||
VersionDescription string `position:"Query" name:"VersionDescription"`
|
||||
ImageId string `position:"Query" name:"ImageId"`
|
||||
IoOptimized string `position:"Query" name:"IoOptimized"`
|
||||
SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
||||
InternetMaxBandwidthOut requests.Integer `position:"Query" name:"InternetMaxBandwidthOut"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
SystemDiskCategory string `position:"Query" name:"SystemDisk.Category"`
|
||||
UserData string `position:"Query" name:"UserData"`
|
||||
PasswordInherit requests.Boolean `position:"Query" name:"PasswordInherit"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
|
||||
EnableVmOsConfig requests.Boolean `position:"Query" name:"EnableVmOsConfig"`
|
||||
NetworkInterface *[]CreateLaunchTemplateNetworkInterface `position:"Query" name:"NetworkInterface" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
SystemDiskDiskName string `position:"Query" name:"SystemDisk.DiskName"`
|
||||
RamRoleName string `position:"Query" name:"RamRoleName"`
|
||||
AutoReleaseTime string `position:"Query" name:"AutoReleaseTime"`
|
||||
SpotDuration requests.Integer `position:"Query" name:"SpotDuration"`
|
||||
DataDisk *[]CreateLaunchTemplateDataDisk `position:"Query" name:"DataDisk" type:"Repeated"`
|
||||
SystemDiskSize requests.Integer `position:"Query" name:"SystemDisk.Size"`
|
||||
VpcId string `position:"Query" name:"VpcId"`
|
||||
SystemDiskDescription string `position:"Query" name:"SystemDisk.Description"`
|
||||
LaunchTemplateName string `position:"Query" name:"LaunchTemplateName"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
SecurityEnhancementStrategy string `position:"Query" name:"SecurityEnhancementStrategy"`
|
||||
NetworkType string `position:"Query" name:"NetworkType"`
|
||||
KeyPairName string `position:"Query" name:"KeyPairName"`
|
||||
SpotPriceLimit requests.Float `position:"Query" name:"SpotPriceLimit"`
|
||||
ImageOwnerAlias string `position:"Query" name:"ImageOwnerAlias"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
HostName string `position:"Query" name:"HostName"`
|
||||
SystemDiskIops requests.Integer `position:"Query" name:"SystemDisk.Iops"`
|
||||
TemplateTag *[]CreateLaunchTemplateTemplateTag `position:"Query" name:"TemplateTag" type:"Repeated"`
|
||||
Tag *[]CreateLaunchTemplateTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
Period requests.Integer `position:"Query" name:"Period"`
|
||||
TemplateResourceGroupId string `position:"Query" name:"TemplateResourceGroupId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
SpotStrategy string `position:"Query" name:"SpotStrategy"`
|
||||
PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"`
|
||||
InstanceName string `position:"Query" name:"InstanceName"`
|
||||
InternetChargeType string `position:"Query" name:"InternetChargeType"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
InternetMaxBandwidthIn requests.Integer `position:"Query" name:"InternetMaxBandwidthIn"`
|
||||
VersionDescription string `position:"Query" name:"VersionDescription"`
|
||||
SystemDiskDeleteWithInstance requests.Boolean `position:"Query" name:"SystemDisk.DeleteWithInstance"`
|
||||
ImageId string `position:"Query" name:"ImageId"`
|
||||
IoOptimized string `position:"Query" name:"IoOptimized"`
|
||||
SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
||||
InternetMaxBandwidthOut requests.Integer `position:"Query" name:"InternetMaxBandwidthOut"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
SystemDiskCategory string `position:"Query" name:"SystemDisk.Category"`
|
||||
SystemDiskPerformanceLevel string `position:"Query" name:"SystemDisk.PerformanceLevel"`
|
||||
UserData string `position:"Query" name:"UserData"`
|
||||
PasswordInherit requests.Boolean `position:"Query" name:"PasswordInherit"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
|
||||
EnableVmOsConfig requests.Boolean `position:"Query" name:"EnableVmOsConfig"`
|
||||
NetworkInterface *[]CreateLaunchTemplateNetworkInterface `position:"Query" name:"NetworkInterface" type:"Repeated"`
|
||||
DeploymentSetId string `position:"Query" name:"DeploymentSetId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
SystemDiskDiskName string `position:"Query" name:"SystemDisk.DiskName"`
|
||||
RamRoleName string `position:"Query" name:"RamRoleName"`
|
||||
AutoReleaseTime string `position:"Query" name:"AutoReleaseTime"`
|
||||
SpotDuration requests.Integer `position:"Query" name:"SpotDuration"`
|
||||
SecurityGroupIds *[]string `position:"Query" name:"SecurityGroupIds" type:"Repeated"`
|
||||
DataDisk *[]CreateLaunchTemplateDataDisk `position:"Query" name:"DataDisk" type:"Repeated"`
|
||||
SystemDiskSize requests.Integer `position:"Query" name:"SystemDisk.Size"`
|
||||
VpcId string `position:"Query" name:"VpcId"`
|
||||
SystemDiskDescription string `position:"Query" name:"SystemDisk.Description"`
|
||||
}
|
||||
|
||||
// CreateLaunchTemplateTemplateTag is a repeated param struct in CreateLaunchTemplateRequest
|
||||
|
@ -136,11 +136,12 @@ type CreateLaunchTemplateTag struct {
|
|||
|
||||
// CreateLaunchTemplateNetworkInterface is a repeated param struct in CreateLaunchTemplateRequest
|
||||
type CreateLaunchTemplateNetworkInterface struct {
|
||||
PrimaryIpAddress string `name:"PrimaryIpAddress"`
|
||||
VSwitchId string `name:"VSwitchId"`
|
||||
SecurityGroupId string `name:"SecurityGroupId"`
|
||||
NetworkInterfaceName string `name:"NetworkInterfaceName"`
|
||||
Description string `name:"Description"`
|
||||
PrimaryIpAddress string `name:"PrimaryIpAddress"`
|
||||
VSwitchId string `name:"VSwitchId"`
|
||||
SecurityGroupId string `name:"SecurityGroupId"`
|
||||
NetworkInterfaceName string `name:"NetworkInterfaceName"`
|
||||
Description string `name:"Description"`
|
||||
SecurityGroupIds *[]string `name:"SecurityGroupIds" type:"Repeated"`
|
||||
}
|
||||
|
||||
// CreateLaunchTemplateDataDisk is a repeated param struct in CreateLaunchTemplateRequest
|
||||
|
@ -153,6 +154,7 @@ type CreateLaunchTemplateDataDisk struct {
|
|||
Description string `name:"Description"`
|
||||
DeleteWithInstance string `name:"DeleteWithInstance"`
|
||||
Device string `name:"Device"`
|
||||
PerformanceLevel string `name:"PerformanceLevel"`
|
||||
}
|
||||
|
||||
// CreateLaunchTemplateResponse is the response struct for api CreateLaunchTemplate
|
||||
|
@ -168,6 +170,7 @@ func CreateCreateLaunchTemplateRequest() (request *CreateLaunchTemplateRequest)
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateLaunchTemplate", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
111
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_launch_template_version.go
generated
vendored
111
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_launch_template_version.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateLaunchTemplateVersion invokes the ecs.CreateLaunchTemplateVersion API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createlaunchtemplateversion.html
|
||||
func (client *Client) CreateLaunchTemplateVersion(request *CreateLaunchTemplateVersionRequest) (response *CreateLaunchTemplateVersionResponse, err error) {
|
||||
response = CreateCreateLaunchTemplateVersionResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateLaunchTemplateVersion(request *CreateLaunchTemplateV
|
|||
}
|
||||
|
||||
// CreateLaunchTemplateVersionWithChan invokes the ecs.CreateLaunchTemplateVersion API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createlaunchtemplateversion.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateLaunchTemplateVersionWithChan(request *CreateLaunchTemplateVersionRequest) (<-chan *CreateLaunchTemplateVersionResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateLaunchTemplateVersionResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateLaunchTemplateVersionWithChan(request *CreateLaunchT
|
|||
}
|
||||
|
||||
// CreateLaunchTemplateVersionWithCallback invokes the ecs.CreateLaunchTemplateVersion API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createlaunchtemplateversion.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateLaunchTemplateVersionWithCallback(request *CreateLaunchTemplateVersionRequest, callback func(response *CreateLaunchTemplateVersionResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,49 +71,54 @@ func (client *Client) CreateLaunchTemplateVersionWithCallback(request *CreateLau
|
|||
// CreateLaunchTemplateVersionRequest is the request struct for api CreateLaunchTemplateVersion
|
||||
type CreateLaunchTemplateVersionRequest struct {
|
||||
*requests.RpcRequest
|
||||
LaunchTemplateName string `position:"Query" name:"LaunchTemplateName"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
SecurityEnhancementStrategy string `position:"Query" name:"SecurityEnhancementStrategy"`
|
||||
NetworkType string `position:"Query" name:"NetworkType"`
|
||||
KeyPairName string `position:"Query" name:"KeyPairName"`
|
||||
SpotPriceLimit requests.Float `position:"Query" name:"SpotPriceLimit"`
|
||||
ImageOwnerAlias string `position:"Query" name:"ImageOwnerAlias"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
HostName string `position:"Query" name:"HostName"`
|
||||
SystemDiskIops requests.Integer `position:"Query" name:"SystemDisk.Iops"`
|
||||
Tag *[]CreateLaunchTemplateVersionTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
Period requests.Integer `position:"Query" name:"Period"`
|
||||
LaunchTemplateId string `position:"Query" name:"LaunchTemplateId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
SpotStrategy string `position:"Query" name:"SpotStrategy"`
|
||||
InstanceName string `position:"Query" name:"InstanceName"`
|
||||
InternetChargeType string `position:"Query" name:"InternetChargeType"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
InternetMaxBandwidthIn requests.Integer `position:"Query" name:"InternetMaxBandwidthIn"`
|
||||
VersionDescription string `position:"Query" name:"VersionDescription"`
|
||||
ImageId string `position:"Query" name:"ImageId"`
|
||||
IoOptimized string `position:"Query" name:"IoOptimized"`
|
||||
SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
||||
InternetMaxBandwidthOut requests.Integer `position:"Query" name:"InternetMaxBandwidthOut"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
SystemDiskCategory string `position:"Query" name:"SystemDisk.Category"`
|
||||
UserData string `position:"Query" name:"UserData"`
|
||||
PasswordInherit requests.Boolean `position:"Query" name:"PasswordInherit"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
|
||||
EnableVmOsConfig requests.Boolean `position:"Query" name:"EnableVmOsConfig"`
|
||||
NetworkInterface *[]CreateLaunchTemplateVersionNetworkInterface `position:"Query" name:"NetworkInterface" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
SystemDiskDiskName string `position:"Query" name:"SystemDisk.DiskName"`
|
||||
RamRoleName string `position:"Query" name:"RamRoleName"`
|
||||
AutoReleaseTime string `position:"Query" name:"AutoReleaseTime"`
|
||||
SpotDuration requests.Integer `position:"Query" name:"SpotDuration"`
|
||||
DataDisk *[]CreateLaunchTemplateVersionDataDisk `position:"Query" name:"DataDisk" type:"Repeated"`
|
||||
SystemDiskSize requests.Integer `position:"Query" name:"SystemDisk.Size"`
|
||||
VpcId string `position:"Query" name:"VpcId"`
|
||||
SystemDiskDescription string `position:"Query" name:"SystemDisk.Description"`
|
||||
LaunchTemplateName string `position:"Query" name:"LaunchTemplateName"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
SecurityEnhancementStrategy string `position:"Query" name:"SecurityEnhancementStrategy"`
|
||||
NetworkType string `position:"Query" name:"NetworkType"`
|
||||
KeyPairName string `position:"Query" name:"KeyPairName"`
|
||||
SpotPriceLimit requests.Float `position:"Query" name:"SpotPriceLimit"`
|
||||
ImageOwnerAlias string `position:"Query" name:"ImageOwnerAlias"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
HostName string `position:"Query" name:"HostName"`
|
||||
SystemDiskIops requests.Integer `position:"Query" name:"SystemDisk.Iops"`
|
||||
Tag *[]CreateLaunchTemplateVersionTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
Period requests.Integer `position:"Query" name:"Period"`
|
||||
LaunchTemplateId string `position:"Query" name:"LaunchTemplateId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
SpotStrategy string `position:"Query" name:"SpotStrategy"`
|
||||
PrivateIpAddress string `position:"Query" name:"PrivateIpAddress"`
|
||||
InstanceName string `position:"Query" name:"InstanceName"`
|
||||
InternetChargeType string `position:"Query" name:"InternetChargeType"`
|
||||
ZoneId string `position:"Query" name:"ZoneId"`
|
||||
InternetMaxBandwidthIn requests.Integer `position:"Query" name:"InternetMaxBandwidthIn"`
|
||||
VersionDescription string `position:"Query" name:"VersionDescription"`
|
||||
SystemDiskDeleteWithInstance requests.Boolean `position:"Query" name:"SystemDisk.DeleteWithInstance"`
|
||||
ImageId string `position:"Query" name:"ImageId"`
|
||||
IoOptimized string `position:"Query" name:"IoOptimized"`
|
||||
SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
||||
InternetMaxBandwidthOut requests.Integer `position:"Query" name:"InternetMaxBandwidthOut"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
SystemDiskCategory string `position:"Query" name:"SystemDisk.Category"`
|
||||
SystemDiskPerformanceLevel string `position:"Query" name:"SystemDisk.PerformanceLevel"`
|
||||
UserData string `position:"Query" name:"UserData"`
|
||||
PasswordInherit requests.Boolean `position:"Query" name:"PasswordInherit"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
|
||||
EnableVmOsConfig requests.Boolean `position:"Query" name:"EnableVmOsConfig"`
|
||||
NetworkInterface *[]CreateLaunchTemplateVersionNetworkInterface `position:"Query" name:"NetworkInterface" type:"Repeated"`
|
||||
DeploymentSetId string `position:"Query" name:"DeploymentSetId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
SystemDiskDiskName string `position:"Query" name:"SystemDisk.DiskName"`
|
||||
RamRoleName string `position:"Query" name:"RamRoleName"`
|
||||
AutoReleaseTime string `position:"Query" name:"AutoReleaseTime"`
|
||||
SpotDuration requests.Integer `position:"Query" name:"SpotDuration"`
|
||||
SecurityGroupIds *[]string `position:"Query" name:"SecurityGroupIds" type:"Repeated"`
|
||||
DataDisk *[]CreateLaunchTemplateVersionDataDisk `position:"Query" name:"DataDisk" type:"Repeated"`
|
||||
SystemDiskSize requests.Integer `position:"Query" name:"SystemDisk.Size"`
|
||||
VpcId string `position:"Query" name:"VpcId"`
|
||||
SystemDiskDescription string `position:"Query" name:"SystemDisk.Description"`
|
||||
}
|
||||
|
||||
// CreateLaunchTemplateVersionTag is a repeated param struct in CreateLaunchTemplateVersionRequest
|
||||
|
@ -129,11 +129,12 @@ type CreateLaunchTemplateVersionTag struct {
|
|||
|
||||
// CreateLaunchTemplateVersionNetworkInterface is a repeated param struct in CreateLaunchTemplateVersionRequest
|
||||
type CreateLaunchTemplateVersionNetworkInterface struct {
|
||||
PrimaryIpAddress string `name:"PrimaryIpAddress"`
|
||||
VSwitchId string `name:"VSwitchId"`
|
||||
SecurityGroupId string `name:"SecurityGroupId"`
|
||||
NetworkInterfaceName string `name:"NetworkInterfaceName"`
|
||||
Description string `name:"Description"`
|
||||
PrimaryIpAddress string `name:"PrimaryIpAddress"`
|
||||
VSwitchId string `name:"VSwitchId"`
|
||||
SecurityGroupId string `name:"SecurityGroupId"`
|
||||
NetworkInterfaceName string `name:"NetworkInterfaceName"`
|
||||
Description string `name:"Description"`
|
||||
SecurityGroupIds *[]string `name:"SecurityGroupIds" type:"Repeated"`
|
||||
}
|
||||
|
||||
// CreateLaunchTemplateVersionDataDisk is a repeated param struct in CreateLaunchTemplateVersionRequest
|
||||
|
@ -146,13 +147,14 @@ type CreateLaunchTemplateVersionDataDisk struct {
|
|||
Description string `name:"Description"`
|
||||
DeleteWithInstance string `name:"DeleteWithInstance"`
|
||||
Device string `name:"Device"`
|
||||
PerformanceLevel string `name:"PerformanceLevel"`
|
||||
}
|
||||
|
||||
// CreateLaunchTemplateVersionResponse is the response struct for api CreateLaunchTemplateVersion
|
||||
type CreateLaunchTemplateVersionResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
LaunchTemplateVersionNumber int `json:"LaunchTemplateVersionNumber" xml:"LaunchTemplateVersionNumber"`
|
||||
LaunchTemplateVersionNumber int64 `json:"LaunchTemplateVersionNumber" xml:"LaunchTemplateVersionNumber"`
|
||||
}
|
||||
|
||||
// CreateCreateLaunchTemplateVersionRequest creates a request to invoke CreateLaunchTemplateVersion API
|
||||
|
@ -161,6 +163,7 @@ func CreateCreateLaunchTemplateVersionRequest() (request *CreateLaunchTemplateVe
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateLaunchTemplateVersion", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
14
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_nat_gateway.go
generated
vendored
14
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_nat_gateway.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateNatGateway invokes the ecs.CreateNatGateway API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createnatgateway.html
|
||||
func (client *Client) CreateNatGateway(request *CreateNatGatewayRequest) (response *CreateNatGatewayResponse, err error) {
|
||||
response = CreateCreateNatGatewayResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateNatGateway(request *CreateNatGatewayRequest) (respon
|
|||
}
|
||||
|
||||
// CreateNatGatewayWithChan invokes the ecs.CreateNatGateway API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createnatgateway.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateNatGatewayWithChan(request *CreateNatGatewayRequest) (<-chan *CreateNatGatewayResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateNatGatewayResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateNatGatewayWithChan(request *CreateNatGatewayRequest)
|
|||
}
|
||||
|
||||
// CreateNatGatewayWithCallback invokes the ecs.CreateNatGateway API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createnatgateway.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateNatGatewayWithCallback(request *CreateNatGatewayRequest, callback func(response *CreateNatGatewayResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,14 +72,14 @@ func (client *Client) CreateNatGatewayWithCallback(request *CreateNatGatewayRequ
|
|||
type CreateNatGatewayRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
BandwidthPackage *[]CreateNatGatewayBandwidthPackage `position:"Query" name:"BandwidthPackage" type:"Repeated"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
VpcId string `position:"Query" name:"VpcId"`
|
||||
Name string `position:"Query" name:"Name"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
BandwidthPackage *[]CreateNatGatewayBandwidthPackage `position:"Query" name:"BandwidthPackage" type:"Repeated"`
|
||||
}
|
||||
|
||||
// CreateNatGatewayBandwidthPackage is a repeated param struct in CreateNatGatewayRequest
|
||||
|
@ -109,6 +104,7 @@ func CreateCreateNatGatewayRequest() (request *CreateNatGatewayRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateNatGateway", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
59
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_network_interface.go
generated
vendored
59
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_network_interface.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateNetworkInterface invokes the ecs.CreateNetworkInterface API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createnetworkinterface.html
|
||||
func (client *Client) CreateNetworkInterface(request *CreateNetworkInterfaceRequest) (response *CreateNetworkInterfaceResponse, err error) {
|
||||
response = CreateCreateNetworkInterfaceResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateNetworkInterface(request *CreateNetworkInterfaceRequ
|
|||
}
|
||||
|
||||
// CreateNetworkInterfaceWithChan invokes the ecs.CreateNetworkInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createnetworkinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateNetworkInterfaceWithChan(request *CreateNetworkInterfaceRequest) (<-chan *CreateNetworkInterfaceResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateNetworkInterfaceResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateNetworkInterfaceWithChan(request *CreateNetworkInter
|
|||
}
|
||||
|
||||
// CreateNetworkInterfaceWithCallback invokes the ecs.CreateNetworkInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createnetworkinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateNetworkInterfaceWithCallback(request *CreateNetworkInterfaceRequest, callback func(response *CreateNetworkInterfaceResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -76,20 +71,25 @@ func (client *Client) CreateNetworkInterfaceWithCallback(request *CreateNetworkI
|
|||
// CreateNetworkInterfaceRequest is the request struct for api CreateNetworkInterface
|
||||
type CreateNetworkInterfaceRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
BusinessType string `position:"Query" name:"BusinessType"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
Tag *[]CreateNetworkInterfaceTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
NetworkInterfaceName string `position:"Query" name:"NetworkInterfaceName"`
|
||||
Visible requests.Boolean `position:"Query" name:"Visible"`
|
||||
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"`
|
||||
PrimaryIpAddress string `position:"Query" name:"PrimaryIpAddress"`
|
||||
QueueNumber requests.Integer `position:"Query" name:"QueueNumber"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
SecondaryPrivateIpAddressCount requests.Integer `position:"Query" name:"SecondaryPrivateIpAddressCount"`
|
||||
BusinessType string `position:"Query" name:"BusinessType"`
|
||||
ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
|
||||
InstanceType string `position:"Query" name:"InstanceType"`
|
||||
Tag *[]CreateNetworkInterfaceTag `position:"Query" name:"Tag" type:"Repeated"`
|
||||
NetworkInterfaceName string `position:"Query" name:"NetworkInterfaceName"`
|
||||
Visible requests.Boolean `position:"Query" name:"Visible"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
SecurityGroupIds *[]string `position:"Query" name:"SecurityGroupIds" type:"Repeated"`
|
||||
VSwitchId string `position:"Query" name:"VSwitchId"`
|
||||
PrivateIpAddress *[]string `position:"Query" name:"PrivateIpAddress" type:"Repeated"`
|
||||
PrimaryIpAddress string `position:"Query" name:"PrimaryIpAddress"`
|
||||
}
|
||||
|
||||
// CreateNetworkInterfaceTag is a repeated param struct in CreateNetworkInterfaceRequest
|
||||
|
@ -101,8 +101,24 @@ type CreateNetworkInterfaceTag struct {
|
|||
// CreateNetworkInterfaceResponse is the response struct for api CreateNetworkInterface
|
||||
type CreateNetworkInterfaceResponse struct {
|
||||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
NetworkInterfaceId string `json:"NetworkInterfaceId" xml:"NetworkInterfaceId"`
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
NetworkInterfaceId string `json:"NetworkInterfaceId" xml:"NetworkInterfaceId"`
|
||||
Status string `json:"Status" xml:"Status"`
|
||||
Type string `json:"Type" xml:"Type"`
|
||||
VpcId string `json:"VpcId" xml:"VpcId"`
|
||||
VSwitchId string `json:"VSwitchId" xml:"VSwitchId"`
|
||||
ZoneId string `json:"ZoneId" xml:"ZoneId"`
|
||||
PrivateIpAddress string `json:"PrivateIpAddress" xml:"PrivateIpAddress"`
|
||||
MacAddress string `json:"MacAddress" xml:"MacAddress"`
|
||||
NetworkInterfaceName string `json:"NetworkInterfaceName" xml:"NetworkInterfaceName"`
|
||||
Description string `json:"Description" xml:"Description"`
|
||||
ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"`
|
||||
ServiceID int64 `json:"ServiceID" xml:"ServiceID"`
|
||||
ServiceManaged bool `json:"ServiceManaged" xml:"ServiceManaged"`
|
||||
OwnerId string `json:"OwnerId" xml:"OwnerId"`
|
||||
SecurityGroupIds SecurityGroupIdsInCreateNetworkInterface `json:"SecurityGroupIds" xml:"SecurityGroupIds"`
|
||||
PrivateIpSets PrivateIpSetsInCreateNetworkInterface `json:"PrivateIpSets" xml:"PrivateIpSets"`
|
||||
Tags TagsInCreateNetworkInterface `json:"Tags" xml:"Tags"`
|
||||
}
|
||||
|
||||
// CreateCreateNetworkInterfaceRequest creates a request to invoke CreateNetworkInterface API
|
||||
|
@ -111,6 +127,7 @@ func CreateCreateNetworkInterfaceRequest() (request *CreateNetworkInterfaceReque
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateNetworkInterface", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateNetworkInterfacePermission invokes the ecs.CreateNetworkInterfacePermission API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createnetworkinterfacepermission.html
|
||||
func (client *Client) CreateNetworkInterfacePermission(request *CreateNetworkInterfacePermissionRequest) (response *CreateNetworkInterfacePermissionResponse, err error) {
|
||||
response = CreateCreateNetworkInterfacePermissionResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateNetworkInterfacePermission(request *CreateNetworkInt
|
|||
}
|
||||
|
||||
// CreateNetworkInterfacePermissionWithChan invokes the ecs.CreateNetworkInterfacePermission API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createnetworkinterfacepermission.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateNetworkInterfacePermissionWithChan(request *CreateNetworkInterfacePermissionRequest) (<-chan *CreateNetworkInterfacePermissionResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateNetworkInterfacePermissionResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateNetworkInterfacePermissionWithChan(request *CreateNe
|
|||
}
|
||||
|
||||
// CreateNetworkInterfacePermissionWithCallback invokes the ecs.CreateNetworkInterfacePermission API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createnetworkinterfacepermission.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateNetworkInterfacePermissionWithCallback(request *CreateNetworkInterfacePermissionRequest, callback func(response *CreateNetworkInterfacePermissionResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -98,6 +93,7 @@ func CreateCreateNetworkInterfacePermissionRequest() (request *CreateNetworkInte
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateNetworkInterfacePermission", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
18
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_physical_connection.go
generated
vendored
18
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_physical_connection.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreatePhysicalConnection invokes the ecs.CreatePhysicalConnection API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createphysicalconnection.html
|
||||
func (client *Client) CreatePhysicalConnection(request *CreatePhysicalConnectionRequest) (response *CreatePhysicalConnectionResponse, err error) {
|
||||
response = CreateCreatePhysicalConnectionResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreatePhysicalConnection(request *CreatePhysicalConnection
|
|||
}
|
||||
|
||||
// CreatePhysicalConnectionWithChan invokes the ecs.CreatePhysicalConnection API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createphysicalconnection.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreatePhysicalConnectionWithChan(request *CreatePhysicalConnectionRequest) (<-chan *CreatePhysicalConnectionResponse, <-chan error) {
|
||||
responseChan := make(chan *CreatePhysicalConnectionResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreatePhysicalConnectionWithChan(request *CreatePhysicalCo
|
|||
}
|
||||
|
||||
// CreatePhysicalConnectionWithCallback invokes the ecs.CreatePhysicalConnection API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createphysicalconnection.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreatePhysicalConnectionWithCallback(request *CreatePhysicalConnectionRequest, callback func(response *CreatePhysicalConnectionResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,21 +72,21 @@ func (client *Client) CreatePhysicalConnectionWithCallback(request *CreatePhysic
|
|||
type CreatePhysicalConnectionRequest struct {
|
||||
*requests.RpcRequest
|
||||
AccessPointId string `position:"Query" name:"AccessPointId"`
|
||||
RedundantPhysicalConnectionId string `position:"Query" name:"RedundantPhysicalConnectionId"`
|
||||
PeerLocation string `position:"Query" name:"PeerLocation"`
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
PortType string `position:"Query" name:"PortType"`
|
||||
CircuitCode string `position:"Query" name:"CircuitCode"`
|
||||
Bandwidth requests.Integer `position:"Query" name:"bandwidth"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
Description string `position:"Query" name:"Description"`
|
||||
Type string `position:"Query" name:"Type"`
|
||||
UserCidr string `position:"Query" name:"UserCidr"`
|
||||
RedundantPhysicalConnectionId string `position:"Query" name:"RedundantPhysicalConnectionId"`
|
||||
PeerLocation string `position:"Query" name:"PeerLocation"`
|
||||
Bandwidth requests.Integer `position:"Query" name:"bandwidth"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
LineOperator string `position:"Query" name:"LineOperator"`
|
||||
Name string `position:"Query" name:"Name"`
|
||||
UserCidr string `position:"Query" name:"UserCidr"`
|
||||
}
|
||||
|
||||
// CreatePhysicalConnectionResponse is the response struct for api CreatePhysicalConnection
|
||||
|
@ -107,6 +102,7 @@ func CreateCreatePhysicalConnectionRequest() (request *CreatePhysicalConnectionR
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreatePhysicalConnection", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
14
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_route_entry.go
generated
vendored
14
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/create_route_entry.go
generated
vendored
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateRouteEntry invokes the ecs.CreateRouteEntry API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createrouteentry.html
|
||||
func (client *Client) CreateRouteEntry(request *CreateRouteEntryRequest) (response *CreateRouteEntryResponse, err error) {
|
||||
response = CreateCreateRouteEntryResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateRouteEntry(request *CreateRouteEntryRequest) (respon
|
|||
}
|
||||
|
||||
// CreateRouteEntryWithChan invokes the ecs.CreateRouteEntry API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createrouteentry.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateRouteEntryWithChan(request *CreateRouteEntryRequest) (<-chan *CreateRouteEntryResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateRouteEntryResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateRouteEntryWithChan(request *CreateRouteEntryRequest)
|
|||
}
|
||||
|
||||
// CreateRouteEntryWithCallback invokes the ecs.CreateRouteEntry API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createrouteentry.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateRouteEntryWithCallback(request *CreateRouteEntryRequest, callback func(response *CreateRouteEntryResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -77,15 +72,15 @@ func (client *Client) CreateRouteEntryWithCallback(request *CreateRouteEntryRequ
|
|||
type CreateRouteEntryRequest struct {
|
||||
*requests.RpcRequest
|
||||
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
ClientToken string `position:"Query" name:"ClientToken"`
|
||||
NextHopId string `position:"Query" name:"NextHopId"`
|
||||
NextHopType string `position:"Query" name:"NextHopType"`
|
||||
RouteTableId string `position:"Query" name:"RouteTableId"`
|
||||
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
|
||||
DestinationCidrBlock string `position:"Query" name:"DestinationCidrBlock"`
|
||||
OwnerAccount string `position:"Query" name:"OwnerAccount"`
|
||||
NextHopId string `position:"Query" name:"NextHopId"`
|
||||
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
|
||||
NextHopType string `position:"Query" name:"NextHopType"`
|
||||
NextHopList *[]CreateRouteEntryNextHopList `position:"Query" name:"NextHopList" type:"Repeated"`
|
||||
RouteTableId string `position:"Query" name:"RouteTableId"`
|
||||
}
|
||||
|
||||
// CreateRouteEntryNextHopList is a repeated param struct in CreateRouteEntryRequest
|
||||
|
@ -106,6 +101,7 @@ func CreateCreateRouteEntryRequest() (request *CreateRouteEntryRequest) {
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateRouteEntry", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
// CreateRouterInterface invokes the ecs.CreateRouterInterface API synchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createrouterinterface.html
|
||||
func (client *Client) CreateRouterInterface(request *CreateRouterInterfaceRequest) (response *CreateRouterInterfaceResponse, err error) {
|
||||
response = CreateCreateRouterInterfaceResponse()
|
||||
err = client.DoAction(request, response)
|
||||
|
@ -29,8 +28,6 @@ func (client *Client) CreateRouterInterface(request *CreateRouterInterfaceReques
|
|||
}
|
||||
|
||||
// CreateRouterInterfaceWithChan invokes the ecs.CreateRouterInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createrouterinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateRouterInterfaceWithChan(request *CreateRouterInterfaceRequest) (<-chan *CreateRouterInterfaceResponse, <-chan error) {
|
||||
responseChan := make(chan *CreateRouterInterfaceResponse, 1)
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -53,8 +50,6 @@ func (client *Client) CreateRouterInterfaceWithChan(request *CreateRouterInterfa
|
|||
}
|
||||
|
||||
// CreateRouterInterfaceWithCallback invokes the ecs.CreateRouterInterface API asynchronously
|
||||
// api document: https://help.aliyun.com/api/ecs/createrouterinterface.html
|
||||
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
|
||||
func (client *Client) CreateRouterInterfaceWithCallback(request *CreateRouterInterfaceRequest, callback func(response *CreateRouterInterfaceResponse, err error)) <-chan int {
|
||||
result := make(chan int, 1)
|
||||
err := client.AddAsyncTask(func() {
|
||||
|
@ -108,7 +103,7 @@ type CreateRouterInterfaceResponse struct {
|
|||
*responses.BaseResponse
|
||||
RequestId string `json:"RequestId" xml:"RequestId"`
|
||||
RouterInterfaceId string `json:"RouterInterfaceId" xml:"RouterInterfaceId"`
|
||||
OrderId int `json:"OrderId" xml:"OrderId"`
|
||||
OrderId int64 `json:"OrderId" xml:"OrderId"`
|
||||
}
|
||||
|
||||
// CreateCreateRouterInterfaceRequest creates a request to invoke CreateRouterInterface API
|
||||
|
@ -117,6 +112,7 @@ func CreateCreateRouterInterfaceRequest() (request *CreateRouterInterfaceRequest
|
|||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
request.InitWithApiInfo("Ecs", "2014-05-26", "CreateRouterInterface", "ecs", "openAPI")
|
||||
request.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue