diff --git a/CHANGELOG.md b/CHANGELOG.md index eb69ad092..4f871ccd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,28 +1,167 @@ -## 1.4.2 (upcoming) +## 1.4.4 (Upcoming) ### IMPROVEMENTS: +* builder/openstack: Store WinRM password for provisioners to use [GH-7940] + +### BUG FIXES: +* core: Fix bug where sensitive variables contianing commas were not being + properly sanitized in UI calls. [GH-7997] + +## 1.4.3 (August 14, 2019) + +### IMPROVEMENTS: +* **new builder** UCloud builder [GH-7775] +* **new builder** Outscale [GH-7459] +* **new builder** VirtualBox Snapshot [GH-7780] +* **new builder** JDCloud [GH-7962] +* **new post-processor** Exoscale Import post-processor [GH-7822] [GH-7946] +* build: Change Makefile to behave differently inside and outside the gopath + when generating code. [GH-7827] +* builder/amazon: Don't calculate spot bids; Amazon has changed spot pricing to + no longer require this. [GH-7813] +* builder/google: Add suse-byos-cloud to list of public GCP cloud image + projects [GH-7935] +* builder/openstack: New `image_min_disk` option [GH-7290] +* builder/openstack: New option `use_blockstorage_volume` to set openstack + image metadata [GH-7792] +* builder/openstack: Select instance network on which to assign floating ip + [GH-7884] +* builder/qemu: Implement VNC password functionality [GH-7836] +* builder/scaleway: Allow removing volume after image creation for Scaleway + builder [GH-7887] +* builder/tencent: Add `run_tags` to option to tag instance. [GH-7810] +* builder/tencent: Remove unnecessary image name validation check. [GH-7786] +* builder/tencent: Support data disks for tencentcloud builder [GH-7815] +* builder/vmware: Fix intense CPU usage because of poorly handled errors. + [GH-7877] +* communicator: Use context for timeouts, interruption in ssh and winrm + communicators [GH-7868] +* core: Change how on-error=abort is handled to prevent EOF errors that mask + real issues [GH-7913] +* core: Clean up logging vs ui call in step download [GH-7936] +* core: New environment var option to allow user to set location of config + directory [GH-7912] +* core: Remove obsolete Cancel functions from builtin provisioners [GH-7917] +* post-processor/vagrant: Add option to allow box Vagrantfiles to be generated + during the build [GH-7951] +* provisioner/ansible: Add support for installing roles with ansible-galaxy + [GH-7916 +* provisioner/salt-masterless: Modify file upload to handle non-root case. + [GH-7833] + +### BUG FIXES: +* builder/amazon: Add error to warn users of spot_tags regression. [GH-7989] +* builder/amazon: Allow EC2 Spot Fleet packer instances to run in parallel + [GH-7818] +* builder/amazon: Fix failures and duplication in Amazon region copy and + encryption step. [GH-7870] [GH-7923] +* builder/amazon: No longer store names of volumes which get deleted on + termination inside ebssurrogate artifact. [GH-7829] +* builder/amazon: Update aws-sdk-go to v1.22.2, resolving some AssumeRole + issues [GH-7967] +* builder/azure: Create configurable polling duration and set higher default + for image copies to prevent timeouts on successful copies [GH-7920] +* builder/digitalocean: increase timeout for Digital Ocean snapshot creation. + [GH-7841] +* builder/docker: Check container os, not host os, when creating container dir + default [GH-7939] +* builder/docker: Fix bug where PACKER_TMP_DIR was created with root perms on + linux [GH-7905] +* builder/docker: Fix file download hang caused by blocking ReadAll call + [GH-7814] +* builder/google: Fix outdated oauth URL. [GH-7835] [GH-7927] +* builder/hyperv: Improve code for detecting IP address [GH-7880] +* builder/ucloud: Update the api about stop instance to fix the read-only image + build by ucloud-uhost [GH-7914] +* builder/vagrant: Fix bug where source_path was being used instead of box_name + when generating the Vagrantfile. [GH-7859] +* builder/virtualbox: Honor value of 'Comment' field in ssh keypair generation. + [GH-7922] +* builder/vmware: Fix validation regression that occurred when user provided a + checksum file [GH-7804] +* buildere/azure: Fix crash with managed images not published to shared image + gallery. [GH-7837] +* communicator/ssh: Move ssh_interface back into individual builders from ssh + communicator to prevent validation issues where it isn't implemented. + [GH-7831] +* console: Fix console help text [GH-7960] +* core: Fix bug in template parsing where function errors were getting + swallowed. [GH-7854] +* core: Fix regression where a local filepath containing `//` was no longer + properly resolving to `/`. [GH-7888] +* core: Fix regression where we could no longer access isos on SMB shares. + [GH-7800] +* core: Make ssh_host template option always override all builders' IP + discovery. [GH-7832] +* core: Regenerate boot_command PEG code [GH-7977] +* fix: clean up help text and fixer order to make sure all fixers are called + [GH-7903] +* provisioner/inspec: Use --input-file instead of --attrs to avoid deprecation + warning [GH-7893] +* provisioner/salt-masterless: Make salt-masterless provisioner respect + disable_sudo directive for all commands [GH-7774] + +## 1.4.2 (June 26, 2019) + +### IMPROVEMENTS: +* **new feature:** Packer console [GH-7726] +* builder/alicloud: cleanup image and snapshot if target image is still not + available after timeout [GH-7744] +* builder/alicloud: let product API determine the default value of io_optimized + [GH-7747] +* builder/amazon: Add new `skip_save_build_region` option to fix naming + conflicts when building in a region you don't want the final image saved + in. [GH-7759] +* builder/amazon: Add retry for temp key-pair generation in amazon-ebs + [GH-7731] * builder/amazon: Enable encrypted AMI sharing across accounts [GH-7707] * builder/amazon: New SpotInstanceTypes feature for spot instance users. [GH-7682] +* builder/azure: Allow users to publish Managed Images to Azure Shared Image + Gallery (same Subscription) [GH-7778] * builder/azure: Update Azure SDK for Go to v30.0.0 [GH-7706] -* builder/cloudstack: Add tags to instance upon creation [GH0-7526] +* builder/cloudstack: Add tags to instance upon creation [GH-7526] * builder/docker: Better windows defaults [GH-7678] +* builder/google: Add feature to import user-data from a file [GH-7720] +* builder/hyperv: Abort build if there's a name collision [GH-7746] +* builder/hyperv: Clarify pathing requirements for hyperv-vmcx [GH-7790] +* builder/hyperv: Increase MaxRamSize to match modern Windows [GH-7785] * builder/openstack: Add image filtering on properties. [GH-7597] -* provisioner/powershell: Fix null file descriptor error that occurred when - remote_path provided is a directory and not a file. [GH-7705] - +* builder/qemu: Add additional disk support [GH-7791] +* builder/vagrant: Allow user to override vagrant ssh-config details [GH-7782] +* builder/yandex: Gracefully shutdown instance, allow metadata from file, and + create preemptible instance type [GH-7734] +* core: scrub out sensitive variables in scrub out sensitive variables logs + [GH-7743] ### BUG FIXES: +* builder/alicloud: Fix describing snapshots issue when image_ignore_data_disks + is provided [GH-7736] * builder/amazon: Fix bug in region copy which produced badly-named AMIs in the build region. [GH-7691] * builder/amazon: Fix failure that happened when spot_tags was set but ami_tags - wasn't [GH-7699] + wasn't [GH-7712] * builder/cloudstack: Update go-cloudstack sdk, fixing compatability with CloudStack v 4.12 [GH-7694] +* builder/proxmox: Update proxmox-api-go dependency, fixing issue calculating + VMIDs. [GH-7755] +* builder/tencent: Correctly remove tencentcloud temporary keypair. [GH-7787] +* core: Allow timestamped AND colorless ui messages [GH-7769] +* core: Apply logSecretFilter to output from ui.Say [GH-7739] +* core: Fix "make bin" command to use reasonbale defaults. [GH-7752] +* core: Fix user var interpolation for variables set via -var-file and from + command line [GH-7733] +* core: machine-readable UI now writes UI calls to logs. [GH-7745] +* core: Switch makefile to use "GO111MODULE=auto" to allow for modern gomodule + usage. [GH-7753] +* provisioner/ansible: prevent nil pointer dereference after a language change + [GH-7738] * provisioner/chef: Accept chef license by default to prevent hangs in latest Chef [GH-7653] * provisioner/powershell: Fix crash caused by error in retry logic check in powershell provisioner [GH-7657] +* provisioner/powershell: Fix null file descriptor error that occurred when + remote_path provided is a directory and not a file. [GH-7705] ## 1.4.1 (May 15, 2019) diff --git a/CODEOWNERS b/CODEOWNERS index 2edcc5e1e..d69a9ab9e 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -16,7 +16,9 @@ /builder/scaleway/ @sieben @mvaude @jqueuniet @fflorens @brmzkw /builder/hcloud/ @LKaemmerling /builder/hyperone @m110 @gregorybrzeski @ad-m +/builder/ucloud/ @shawnmssu /builder/yandex @GennadySpb @alexanderKhaustov @seukyaso +/builder/osc @marinsalinas # provisioners @@ -27,5 +29,6 @@ /post-processor/alicloud-import/ dongxiao.zzh@alibaba-inc.com /post-processor/checksum/ v.tolstov@selfip.ru +/post-processor/exoscale-import/ @falzm @mcorbin /post-processor/googlecompute-export/ crunkleton@google.com /post-processor/vsphere-template/ nelson@bennu.cl diff --git a/Makefile b/Makefile index 18cccca19..10dd3edfd 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,12 @@ install-build-deps: ## Install dependencies for bin build install-gen-deps: ## Install dependencies for code generation @go get golang.org/x/tools/cmd/goimports - @go get -u github.com/mna/pigeon + @./scripts/off_gopath.sh; if [ $$? -eq 0 ]; then \ + go get github.com/mna/pigeon@master; \ + else \ + go get -u github.com/mna/pigeon; \ + fi + @go get github.com/alvaroloes/enumer @go install ./cmd/struct-markdown diff --git a/builder/alicloud/ecs/step_check_source_image.go b/builder/alicloud/ecs/step_check_source_image.go index 073d84b12..541bd19eb 100644 --- a/builder/alicloud/ecs/step_check_source_image.go +++ b/builder/alicloud/ecs/step_check_source_image.go @@ -28,7 +28,7 @@ func (s *stepCheckAlicloudSourceImage) Run(ctx context.Context, state multistep. images := imagesResponse.Images.Image - // Describe markerplace image + // Describe marketplace image describeImagesRequest.ImageOwnerAlias = "marketplace" marketImagesResponse, err := client.DescribeImages(describeImagesRequest) if err != nil { diff --git a/builder/amazon/common/access_config.go b/builder/amazon/common/access_config.go index c1b9ed2fb..cc28dc17f 100644 --- a/builder/amazon/common/access_config.go +++ b/builder/amazon/common/access_config.go @@ -253,7 +253,7 @@ func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error { } // Make sure it's obvious from the config how we're getting credentials: - // Vault, Packer config, or environemnt. + // Vault, Packer config, or environment. if !c.VaultAWSEngine.Empty() { if len(c.AccessKey) > 0 { errs = append(errs, diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go index b43b0ed13..b810df1f6 100644 --- a/builder/amazon/common/ami_config.go +++ b/builder/amazon/common/ami_config.go @@ -12,6 +12,7 @@ import ( // AMIConfig is for common configuration related to creating AMIs. type AMIConfig struct { + // The name of the resulting AMI that will appear when // managing AMIs in the AWS console or via APIs. This must be unique. To help // make this unique, use a function like timestamp (see [template @@ -96,7 +97,18 @@ type AMIConfig struct { // conjunction with `snapshot_users` -- in that situation you must use // custom keys. For valid formats see *KmsKeyId* in the [AWS API docs - // CopyImage](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopyImage.html). + // + // This option supercedes the `kms_key_id` option -- if you set both, and + // they are different, Packer will respect the value in + // `region_kms_key_ids` for your build region and silently disregard the + // value provided in `kms_key_id`. AMIRegionKMSKeyIDs map[string]string `mapstructure:"region_kms_key_ids" required:"false"` + // If true, Packer will not check whether an AMI with the `ami_name` exists + // in the region it is building in. It will use an intermediary AMI name, + // which it will not convert to an AMI in the build region. It will copy + // the intermediary AMI into any regions provided in `ami_regions`, then + // delete the intermediary AMI. Default `false`. + AMISkipBuildRegion bool `mapstructure:"skip_save_build_region"` // Tags to apply to snapshot. // They will override AMI tags if already applied to snapshot. This is a // [template engine](../templates/engine.html), see [Build template diff --git a/builder/amazon/common/block_device.go b/builder/amazon/common/block_device.go index b951b1867..ca0b74793 100644 --- a/builder/amazon/common/block_device.go +++ b/builder/amazon/common/block_device.go @@ -55,6 +55,14 @@ type BlockDevice struct { // The size of the volume, in GiB. Required if not specifying a // snapshot_id. VolumeSize int64 `mapstructure:"volume_size" required:"false"` + // ID, alias or ARN of the KMS key to use for boot volume encryption. This + // only applies to the main region, other regions where the AMI will be + // copied will be encrypted by the default EBS KMS key. For valid formats + // see KmsKeyId in the [AWS API docs - + // CopyImage](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopyImage.html) + // This field is validated by Packer, when using an alias, you will have to + // prefix kms_key_id with alias/. + KmsKeyId string `mapstructure:"kms_key_id" required:"false"` } type BlockDevices []BlockDevice @@ -117,6 +125,11 @@ func (b *BlockDevice) Prepare(ctx *interpolate.Context) error { return fmt.Errorf("The `device_name` must be specified " + "for every device in the block device mapping.") } + // Warn that encrypted must be true or nil when setting kms_key_id + if b.KmsKeyId != "" && b.Encrypted != nil && *b.Encrypted == false { + return fmt.Errorf("The device %v, must also have `encrypted: "+ + "true` when setting a kms_key_id.", b.DeviceName) + } return nil } diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go index 0f038f0d6..6b42aa03f 100644 --- a/builder/amazon/common/run_config.go +++ b/builder/amazon/common/run_config.go @@ -314,7 +314,8 @@ type RunConfig struct { WindowsPasswordTimeout time.Duration `mapstructure:"windows_password_timeout" required:"false"` // Communicator settings - Comm communicator.Config `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + SSHInterface string `mapstructure:"ssh_interface"` } func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { @@ -340,12 +341,12 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { errs := c.Comm.Prepare(ctx) // Validating ssh_interface - if c.Comm.SSHInterface != "public_ip" && - c.Comm.SSHInterface != "private_ip" && - c.Comm.SSHInterface != "public_dns" && - c.Comm.SSHInterface != "private_dns" && - c.Comm.SSHInterface != "" { - errs = append(errs, fmt.Errorf("Unknown interface type: %s", c.Comm.SSHInterface)) + if c.SSHInterface != "public_ip" && + c.SSHInterface != "private_ip" && + c.SSHInterface != "public_dns" && + c.SSHInterface != "private_dns" && + c.SSHInterface != "" { + errs = append(errs, fmt.Errorf("Unknown interface type: %s", c.SSHInterface)) } if c.Comm.SSHKeyPairName != "" { @@ -379,20 +380,6 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { "block_duration_minutes must be multiple of 60")) } - if c.SpotPrice == "auto" { - if c.SpotPriceAutoProduct == "" { - errs = append(errs, fmt.Errorf( - "spot_price_auto_product must be specified when spot_price is auto")) - } - } - - if c.SpotPriceAutoProduct != "" { - if c.SpotPrice != "auto" { - errs = append(errs, fmt.Errorf( - "spot_price should be set to auto when spot_price_auto_product is specified")) - } - } - if c.SpotTags != nil { if c.SpotPrice == "" || c.SpotPrice == "0" { errs = append(errs, fmt.Errorf( diff --git a/builder/amazon/common/run_config_test.go b/builder/amazon/common/run_config_test.go index 2ea0406b0..c876f4ce7 100644 --- a/builder/amazon/common/run_config_test.go +++ b/builder/amazon/common/run_config_test.go @@ -119,7 +119,6 @@ func TestRunConfigPrepare_EnableT2UnlimitedBadWithSpotInstanceRequest(t *testing c.InstanceType = "t2.micro" c.EnableT2Unlimited = true c.SpotPrice = "auto" - c.SpotPriceAutoProduct = "Linux/UNIX" err := c.Prepare(nil) if len(err) != 1 { t.Fatalf("Should error if T2 Unlimited has been used in conjuntion with a Spot Price request") @@ -129,19 +128,14 @@ func TestRunConfigPrepare_EnableT2UnlimitedBadWithSpotInstanceRequest(t *testing func TestRunConfigPrepare_SpotAuto(t *testing.T) { c := testConfig() c.SpotPrice = "auto" - if err := c.Prepare(nil); len(err) != 1 { - t.Fatalf("Should error if spot_price_auto_product is not set and spot_price is set to auto") - } - - // Good - SpotPrice and SpotPriceAutoProduct are correctly set - c.SpotPriceAutoProduct = "foo" if err := c.Prepare(nil); len(err) != 0 { t.Fatalf("err: %s", err) } - c.SpotPrice = "" - if err := c.Prepare(nil); len(err) != 1 { - t.Fatalf("Should error if spot_price is not set to auto and spot_price_auto_product is set") + // Shouldn't error (YET) even though SpotPriceAutoProduct is deprecated + c.SpotPriceAutoProduct = "Linux/Unix" + if err := c.Prepare(nil); len(err) != 0 { + t.Fatalf("err: %s", err) } } diff --git a/builder/amazon/common/state.go b/builder/amazon/common/state.go index 4064d4020..fc6e10027 100644 --- a/builder/amazon/common/state.go +++ b/builder/amazon/common/state.go @@ -35,7 +35,7 @@ type StateChangeConf struct { } // Following are wrapper functions that use Packer's environment-variables to -// determing retry logic, then call the AWS SDK's built-in waiters. +// determine retry logic, then call the AWS SDK's built-in waiters. func WaitUntilAMIAvailable(ctx aws.Context, conn ec2iface.EC2API, imageId string) error { imageInput := ec2.DescribeImagesInput{ diff --git a/builder/amazon/common/step_ami_region_copy.go b/builder/amazon/common/step_ami_region_copy.go index 620715d27..ca77c6e63 100644 --- a/builder/amazon/common/step_ami_region_copy.go +++ b/builder/amazon/common/step_ami_region_copy.go @@ -21,19 +21,58 @@ type StepAMIRegionCopy struct { Name string OriginalRegion string - toDelete string - getRegionConn func(*AccessConfig, string) (ec2iface.EC2API, error) + toDelete string + getRegionConn func(*AccessConfig, string) (ec2iface.EC2API, error) + AMISkipBuildRegion bool +} + +func (s *StepAMIRegionCopy) DeduplicateRegions(intermediary bool) { + // Deduplicates regions by looping over the list of regions and storing + // the regions as keys in a map. This saves users from accidentally copying + // regions twice if they've added a region to a map twice. + + RegionMap := map[string]bool{} + RegionSlice := []string{} + + // Original build region may or may not be present in the Regions list, so + // let's make absolutely sure it's in our map. + RegionMap[s.OriginalRegion] = true + for _, r := range s.Regions { + RegionMap[r] = true + } + + if !intermediary || s.AMISkipBuildRegion { + // We don't want to copy back into the original region if we aren't + // using an intermediary image, so remove the original region from our + // map. + + // We also don't want to copy back into the original region if the + // intermediary image is because we're skipping the build region. + delete(RegionMap, s.OriginalRegion) + + } + + // Now print all those keys into the region slice again + for k, _ := range RegionMap { + RegionSlice = append(RegionSlice, k) + } + + s.Regions = RegionSlice } func (s *StepAMIRegionCopy) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) amis := state.Get("amis").(map[string]string) snapshots := state.Get("snapshots").(map[string][]string) + intermediary, _ := state.Get("intermediary_image").(bool) + s.DeduplicateRegions(intermediary) ami := amis[s.OriginalRegion] - // Always copy back into original region to preserve the ami name - s.toDelete = ami - s.Regions = append(s.Regions, s.OriginalRegion) + + // Make a note to delete the intermediary AMI if necessary. + if intermediary { + s.toDelete = ami + } if s.EncryptBootVolume != nil && *s.EncryptBootVolume { // encrypt_boot is true, so we have to copy the temporary @@ -42,7 +81,11 @@ func (s *StepAMIRegionCopy) Run(ctx context.Context, state multistep.StateBag) m if s.RegionKeyIds == nil { s.RegionKeyIds = make(map[string]string) } - s.RegionKeyIds[s.OriginalRegion] = s.AMIKmsKeyId + + // Make sure the kms_key_id for the original region is in the map + if _, ok := s.RegionKeyIds[s.OriginalRegion]; !ok { + s.RegionKeyIds[s.OriginalRegion] = s.AMIKmsKeyId + } } if len(s.Regions) == 0 { @@ -53,15 +96,18 @@ func (s *StepAMIRegionCopy) Run(ctx context.Context, state multistep.StateBag) m var lock sync.Mutex var wg sync.WaitGroup - var regKeyID string errs := new(packer.MultiError) - wg.Add(len(s.Regions)) for _, region := range s.Regions { + var regKeyID string ui.Message(fmt.Sprintf("Copying to: %s", region)) if s.EncryptBootVolume != nil && *s.EncryptBootVolume { + // Encrypt is true, explicitly regKeyID = s.RegionKeyIds[region] + } else { + // Encrypt is nil or false; Make sure region key is empty + regKeyID = "" } go func(region string) { @@ -96,6 +142,10 @@ func (s *StepAMIRegionCopy) Cleanup(state multistep.StateBag) { ec2conn := state.Get("ec2").(*ec2.EC2) ui := state.Get("ui").(packer.Ui) + if len(s.toDelete) == 0 { + return + } + // Delete the unencrypted amis and snapshots ui.Say("Deregistering the AMI and deleting unencrypted temporary " + "AMIs and snapshots") diff --git a/builder/amazon/common/step_ami_region_copy_test.go b/builder/amazon/common/step_ami_region_copy_test.go index bd3c4fed0..2e1628aab 100644 --- a/builder/amazon/common/step_ami_region_copy_test.go +++ b/builder/amazon/common/step_ami_region_copy_test.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "fmt" + "sync" "testing" "github.com/aws/aws-sdk-go/aws" @@ -25,10 +26,14 @@ type mockEC2Conn struct { deregisterImageCount int deleteSnapshotCount int waitCount int + + lock sync.Mutex } func (m *mockEC2Conn) CopyImage(copyInput *ec2.CopyImageInput) (*ec2.CopyImageOutput, error) { + m.lock.Lock() m.copyImageCount++ + m.lock.Unlock() copiedImage := fmt.Sprintf("%s-copied-%d", *copyInput.SourceImageId, m.copyImageCount) output := &ec2.CopyImageOutput{ ImageId: &copiedImage, @@ -38,7 +43,9 @@ func (m *mockEC2Conn) CopyImage(copyInput *ec2.CopyImageInput) (*ec2.CopyImageOu // functions we have to create mock responses for in order for test to run func (m *mockEC2Conn) DescribeImages(*ec2.DescribeImagesInput) (*ec2.DescribeImagesOutput, error) { + m.lock.Lock() m.describeImagesCount++ + m.lock.Unlock() output := &ec2.DescribeImagesOutput{ Images: []*ec2.Image{{}}, } @@ -46,19 +53,25 @@ func (m *mockEC2Conn) DescribeImages(*ec2.DescribeImagesInput) (*ec2.DescribeIma } func (m *mockEC2Conn) DeregisterImage(*ec2.DeregisterImageInput) (*ec2.DeregisterImageOutput, error) { + m.lock.Lock() m.deregisterImageCount++ + m.lock.Unlock() output := &ec2.DeregisterImageOutput{} return output, nil } func (m *mockEC2Conn) DeleteSnapshot(*ec2.DeleteSnapshotInput) (*ec2.DeleteSnapshotOutput, error) { + m.lock.Lock() m.deleteSnapshotCount++ + m.lock.Unlock() output := &ec2.DeleteSnapshotOutput{} return output, nil } func (m *mockEC2Conn) WaitUntilImageAvailableWithContext(aws.Context, *ec2.DescribeImagesInput, ...request.WaiterOption) error { + m.lock.Lock() m.waitCount++ + m.lock.Unlock() return nil } @@ -84,6 +97,128 @@ func tState() multistep.StateBag { return state } +func TestStepAMIRegionCopy_duplicates(t *testing.T) { + // ------------------------------------------------------------------------ + // Test that if the original region is added to both Regions and Region, + // the ami is only copied once (with encryption). + // ------------------------------------------------------------------------ + + stepAMIRegionCopy := StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + Regions: []string{"us-east-1"}, + AMIKmsKeyId: "12345", + // Original region key in regionkeyids is different than in amikmskeyid + RegionKeyIds: map[string]string{"us-east-1": "12345"}, + EncryptBootVolume: aws.Bool(true), + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + } + // mock out the region connection code + stepAMIRegionCopy.getRegionConn = getMockConn + + state := tState() + state.Put("intermediary_image", true) + stepAMIRegionCopy.Run(context.Background(), state) + + if len(stepAMIRegionCopy.Regions) != 1 { + t.Fatalf("Should have added original ami to Regions one time only") + } + + // ------------------------------------------------------------------------ + // Both Region and Regions set, but no encryption - shouldn't copy anything + // ------------------------------------------------------------------------ + + // the ami is only copied once. + stepAMIRegionCopy = StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + Regions: []string{"us-east-1"}, + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + } + // mock out the region connection code + state.Put("intermediary_image", false) + stepAMIRegionCopy.getRegionConn = getMockConn + stepAMIRegionCopy.Run(context.Background(), state) + + if len(stepAMIRegionCopy.Regions) != 0 { + t.Fatalf("Should not have added original ami to Regions; not encrypting") + } + + // ------------------------------------------------------------------------ + // Both Region and Regions set, but no encryption - shouldn't copy anything, + // this tests false as opposed to nil value above. + // ------------------------------------------------------------------------ + + // the ami is only copied once. + stepAMIRegionCopy = StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + Regions: []string{"us-east-1"}, + EncryptBootVolume: aws.Bool(false), + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + } + // mock out the region connection code + state.Put("intermediary_image", false) + stepAMIRegionCopy.getRegionConn = getMockConn + stepAMIRegionCopy.Run(context.Background(), state) + + if len(stepAMIRegionCopy.Regions) != 0 { + t.Fatalf("Should not have added original ami to Regions once; not" + + "encrypting") + } + + // ------------------------------------------------------------------------ + // Multiple regions, many duplicates, and encryption (this shouldn't ever + // happen because of our template validation, but good to test it.) + // ------------------------------------------------------------------------ + + stepAMIRegionCopy = StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + // Many duplicates for only 3 actual values + Regions: []string{"us-east-1", "us-west-2", "us-west-2", "ap-east-1", "ap-east-1", "ap-east-1"}, + AMIKmsKeyId: "IlikePancakes", + // Original region key in regionkeyids is different than in amikmskeyid + RegionKeyIds: map[string]string{"us-east-1": "12345", "us-west-2": "abcde", "ap-east-1": "xyz"}, + EncryptBootVolume: aws.Bool(true), + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + } + // mock out the region connection code + stepAMIRegionCopy.getRegionConn = getMockConn + state.Put("intermediary_image", true) + stepAMIRegionCopy.Run(context.Background(), state) + + if len(stepAMIRegionCopy.Regions) != 3 { + t.Fatalf("Each AMI should have been added to Regions one time only.") + } + + // Also verify that we respect RegionKeyIds over AMIKmsKeyIds: + if stepAMIRegionCopy.RegionKeyIds["us-east-1"] != "12345" { + t.Fatalf("RegionKeyIds should take precedence over AmiKmsKeyIds") + } + + // ------------------------------------------------------------------------ + // Multiple regions, many duplicates, NO encryption + // ------------------------------------------------------------------------ + + stepAMIRegionCopy = StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + // Many duplicates for only 3 actual values + Regions: []string{"us-east-1", "us-west-2", "us-west-2", "ap-east-1", "ap-east-1", "ap-east-1"}, + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + } + // mock out the region connection code + stepAMIRegionCopy.getRegionConn = getMockConn + state.Put("intermediary_image", false) + stepAMIRegionCopy.Run(context.Background(), state) + + if len(stepAMIRegionCopy.Regions) != 2 { + t.Fatalf("Each AMI should have been added to Regions one time only, " + + "and original region shouldn't be added at all") + } +} + func TestStepAmiRegionCopy_nil_encryption(t *testing.T) { // create step stepAMIRegionCopy := StepAMIRegionCopy{ @@ -99,38 +234,14 @@ func TestStepAmiRegionCopy_nil_encryption(t *testing.T) { stepAMIRegionCopy.getRegionConn = getMockConn state := tState() + state.Put("intermediary_image", false) stepAMIRegionCopy.Run(context.Background(), state) - if stepAMIRegionCopy.toDelete != "ami-12345" { - t.Fatalf("Should delete original intermediary ami even if not encrypted") + if stepAMIRegionCopy.toDelete != "" { + t.Fatalf("Shouldn't have an intermediary ami if encrypt is nil") } - if len(stepAMIRegionCopy.Regions) == 0 { - t.Fatalf("Should have added original ami to original region") - } -} - -func TestStepAmiRegionCopy_false_encryption(t *testing.T) { - // create step - stepAMIRegionCopy := StepAMIRegionCopy{ - AccessConfig: testAccessConfig(), - Regions: make([]string, 0), - AMIKmsKeyId: "", - RegionKeyIds: make(map[string]string), - EncryptBootVolume: aws.Bool(false), - Name: "fake-ami-name", - OriginalRegion: "us-east-1", - } - // mock out the region connection code - stepAMIRegionCopy.getRegionConn = getMockConn - - state := tState() - stepAMIRegionCopy.Run(context.Background(), state) - - if stepAMIRegionCopy.toDelete != "ami-12345" { - t.Fatalf("should be deleting the original intermediary ami") - } - if len(stepAMIRegionCopy.Regions) == 0 { - t.Fatalf("Should have added original ami to Regions") + if len(stepAMIRegionCopy.Regions) != 0 { + t.Fatalf("Should not have added original ami to original region") } } @@ -149,6 +260,7 @@ func TestStepAmiRegionCopy_true_encryption(t *testing.T) { stepAMIRegionCopy.getRegionConn = getMockConn state := tState() + state.Put("intermediary_image", true) stepAMIRegionCopy.Run(context.Background(), state) if stepAMIRegionCopy.toDelete == "" { @@ -158,3 +270,134 @@ func TestStepAmiRegionCopy_true_encryption(t *testing.T) { t.Fatalf("Should have added original ami to Regions") } } + +func TestStepAmiRegionCopy_nil_intermediary(t *testing.T) { + // create step + stepAMIRegionCopy := StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + Regions: make([]string, 0), + AMIKmsKeyId: "", + RegionKeyIds: make(map[string]string), + EncryptBootVolume: aws.Bool(false), + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + } + // mock out the region connection code + stepAMIRegionCopy.getRegionConn = getMockConn + + state := tState() + stepAMIRegionCopy.Run(context.Background(), state) + + if stepAMIRegionCopy.toDelete != "" { + t.Fatalf("Should not delete original AMI if no intermediary") + } + if len(stepAMIRegionCopy.Regions) != 0 { + t.Fatalf("Should not have added original ami to Regions") + } +} + +func TestStepAmiRegionCopy_AMISkipBuildRegion(t *testing.T) { + // ------------------------------------------------------------------------ + // skip build region is true + // ------------------------------------------------------------------------ + + stepAMIRegionCopy := StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + Regions: []string{"us-west-1"}, + AMIKmsKeyId: "", + RegionKeyIds: map[string]string{"us-west-1": "abcde"}, + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + AMISkipBuildRegion: true, + } + // mock out the region connection code + stepAMIRegionCopy.getRegionConn = getMockConn + + state := tState() + state.Put("intermediary_image", true) + stepAMIRegionCopy.Run(context.Background(), state) + + if stepAMIRegionCopy.toDelete == "" { + t.Fatalf("Should delete original AMI if skip_save_build_region=true") + } + if len(stepAMIRegionCopy.Regions) != 1 { + t.Fatalf("Should not have added original ami to Regions; Regions: %#v", stepAMIRegionCopy.Regions) + } + + // ------------------------------------------------------------------------ + // skip build region is false. + // ------------------------------------------------------------------------ + stepAMIRegionCopy = StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + Regions: []string{"us-west-1"}, + AMIKmsKeyId: "", + RegionKeyIds: make(map[string]string), + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + AMISkipBuildRegion: false, + } + // mock out the region connection code + stepAMIRegionCopy.getRegionConn = getMockConn + + state.Put("intermediary_image", false) // not encrypted + stepAMIRegionCopy.Run(context.Background(), state) + + if stepAMIRegionCopy.toDelete != "" { + t.Fatalf("Shouldn't have an intermediary AMI, so dont delete original ami") + } + if len(stepAMIRegionCopy.Regions) != 1 { + t.Fatalf("Should not have added original ami to Regions; Regions: %#v", stepAMIRegionCopy.Regions) + } + + // ------------------------------------------------------------------------ + // skip build region is false, but encrypt is true + // ------------------------------------------------------------------------ + stepAMIRegionCopy = StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + Regions: []string{"us-west-1"}, + AMIKmsKeyId: "", + RegionKeyIds: map[string]string{"us-west-1": "abcde"}, + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + AMISkipBuildRegion: false, + EncryptBootVolume: aws.Bool(true), + } + // mock out the region connection code + stepAMIRegionCopy.getRegionConn = getMockConn + + state.Put("intermediary_image", true) //encrypted + stepAMIRegionCopy.Run(context.Background(), state) + + if stepAMIRegionCopy.toDelete == "" { + t.Fatalf("Have to delete intermediary AMI") + } + if len(stepAMIRegionCopy.Regions) != 2 { + t.Fatalf("Should have added original ami to Regions; Regions: %#v", stepAMIRegionCopy.Regions) + } + + // ------------------------------------------------------------------------ + // skip build region is true, and encrypt is true + // ------------------------------------------------------------------------ + stepAMIRegionCopy = StepAMIRegionCopy{ + AccessConfig: testAccessConfig(), + Regions: []string{"us-west-1"}, + AMIKmsKeyId: "", + RegionKeyIds: map[string]string{"us-west-1": "abcde"}, + Name: "fake-ami-name", + OriginalRegion: "us-east-1", + AMISkipBuildRegion: true, + EncryptBootVolume: aws.Bool(true), + } + // mock out the region connection code + stepAMIRegionCopy.getRegionConn = getMockConn + + state.Put("intermediary_image", true) //encrypted + stepAMIRegionCopy.Run(context.Background(), state) + + if stepAMIRegionCopy.toDelete == "" { + t.Fatalf("Have to delete intermediary AMI") + } + if len(stepAMIRegionCopy.Regions) != 1 { + t.Fatalf("Should not have added original ami to Regions; Regions: %#v", stepAMIRegionCopy.Regions) + } +} diff --git a/builder/amazon/common/step_pre_validate.go b/builder/amazon/common/step_pre_validate.go index f8ba32b16..592f9d539 100644 --- a/builder/amazon/common/step_pre_validate.go +++ b/builder/amazon/common/step_pre_validate.go @@ -18,8 +18,9 @@ import ( // the build before actually doing any time consuming work // type StepPreValidate struct { - DestAmiName string - ForceDeregister bool + DestAmiName string + ForceDeregister bool + AMISkipBuildRegion bool } func (s *StepPreValidate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { @@ -76,6 +77,10 @@ func (s *StepPreValidate) Run(ctx context.Context, state multistep.StateBag) mul ui.Say("Force Deregister flag found, skipping prevalidating AMI Name") return multistep.ActionContinue } + if s.AMISkipBuildRegion { + ui.Say("skip_build_region was set; not prevalidating AMI name") + return multistep.ActionContinue + } ec2conn := state.Get("ec2").(*ec2.EC2) diff --git a/builder/amazon/common/step_run_spot_instance.go b/builder/amazon/common/step_run_spot_instance.go index 05a4f521c..d45db0208 100644 --- a/builder/amazon/common/step_run_spot_instance.go +++ b/builder/amazon/common/step_run_spot_instance.go @@ -6,14 +6,12 @@ import ( "fmt" "io/ioutil" "log" - "strconv" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ec2" - - "github.com/aws/aws-sdk-go/service/ec2/ec2iface" + "github.com/hashicorp/packer/common/random" "github.com/hashicorp/packer/common/retry" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" @@ -38,7 +36,6 @@ type StepRunSpotInstance struct { InstanceType string SourceAMI string SpotPrice string - SpotPriceProduct string SpotTags TagMap SpotInstanceTypes []string Tags TagMap @@ -47,57 +44,7 @@ type StepRunSpotInstance struct { UserDataFile string Ctx interpolate.Context - instanceId string - spotRequest *ec2.SpotInstanceRequest -} - -func (s *StepRunSpotInstance) CalculateSpotPrice(az string, ec2conn ec2iface.EC2API) (string, error) { - // Calculate the spot price for a given availability zone - spotPrice := s.SpotPrice - - if spotPrice == "auto" { - // Detect the spot price - startTime := time.Now().Add(-1 * time.Hour) - resp, err := ec2conn.DescribeSpotPriceHistory(&ec2.DescribeSpotPriceHistoryInput{ - InstanceTypes: []*string{&s.InstanceType}, - ProductDescriptions: []*string{&s.SpotPriceProduct}, - AvailabilityZone: &az, - StartTime: &startTime, - }) - if err != nil { - return "", fmt.Errorf("Error finding spot price: %s", err) - } - - var price float64 - for _, history := range resp.SpotPriceHistory { - log.Printf("[INFO] Candidate spot price: %s", *history.SpotPrice) - current, err := strconv.ParseFloat(*history.SpotPrice, 64) - if err != nil { - log.Printf("[ERR] Error parsing spot price: %s", err) - continue - } - if price == 0 || current < price { - price = current - if az == "" { - az = *history.AvailabilityZone - } - } - } - if price == 0 { - return "", fmt.Errorf("No candidate spot prices found!") - } else { - // Add 0.5 cents to minimum spot bid to ensure capacity will be available - // Avoids price-too-low error in active markets which can fluctuate - price = price + 0.005 - } - - spotPrice = strconv.FormatFloat(price, 'f', -1, 64) - } - - s.SpotPrice = spotPrice - - return spotPrice, nil - + instanceId string } func (s *StepRunSpotInstance) CreateTemplateData(userData *string, az string, @@ -216,17 +163,6 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) } az := azConfig - ui.Message(fmt.Sprintf("Finding spot price for %s %s...", - s.SpotPriceProduct, s.InstanceType)) - spotPrice, err := s.CalculateSpotPrice(az, ec2conn) - if err != nil { - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - } - - ui.Message(fmt.Sprintf("Determined spot instance price of: %s.", spotPrice)) - var instanceId string ui.Say("Interpolating tags for spot instance...") @@ -250,8 +186,10 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) // instance yet ec2Tags.Report(ui) - spotOptions := ec2.LaunchTemplateSpotMarketOptionsRequest{ - MaxPrice: &s.SpotPrice, + spotOptions := ec2.LaunchTemplateSpotMarketOptionsRequest{} + // The default is to set the maximum price to the OnDemand price. + if s.SpotPrice != "auto" { + spotOptions.SetMaxPrice(s.SpotPrice) } if s.BlockDurationMinutes != 0 { spotOptions.BlockDurationMinutes = &s.BlockDurationMinutes @@ -263,6 +201,14 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) // Create a launch template for the instance ui.Message("Loading User Data File...") + + // Generate a random name to avoid conflicting with other + // instances of packer running in this AWS account + launchTemplateName := fmt.Sprintf( + "packer-fleet-launch-template-%s", + random.AlphaNum(7)) + state.Put("launchTemplateName", launchTemplateName) // For the cleanup step + userData, err := s.LoadUserData() if err != nil { state.Put("error", err) @@ -272,7 +218,7 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) templateData := s.CreateTemplateData(&userData, az, state, marketOptions) launchTemplate := &ec2.CreateLaunchTemplateInput{ LaunchTemplateData: templateData, - LaunchTemplateName: aws.String("packer-fleet-launch-template"), + LaunchTemplateName: aws.String(launchTemplateName), VersionDescription: aws.String("template generated by packer for launching spot instances"), } @@ -298,7 +244,7 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) LaunchTemplateConfigs: []*ec2.FleetLaunchTemplateConfigRequest{ { LaunchTemplateSpecification: &ec2.FleetLaunchTemplateSpecificationRequest{ - LaunchTemplateName: aws.String("packer-fleet-launch-template"), + LaunchTemplateName: aws.String(launchTemplateName), Version: aws.String("1"), }, Overrides: overrides, @@ -315,7 +261,31 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) // Create the request for the spot instance. req, createOutput := ec2conn.CreateFleetRequest(createFleetInput) ui.Message(fmt.Sprintf("Sending spot request (%s)...", req.RequestID)) + // Actually send the spot connection request. + err = req.Send() + if err != nil { + if createOutput.FleetId != nil { + err = fmt.Errorf("Error waiting for fleet request (%s): %s", *createOutput.FleetId, err) + } else { + err = fmt.Errorf("Error waiting for fleet request: %s", err) + } + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + if len(createOutput.Errors) > 0 { + errString := fmt.Sprintf("Error waiting for fleet request (%s) to become ready:", *createOutput.FleetId) + for _, outErr := range createOutput.Errors { + errString = errString + fmt.Sprintf("%s", *outErr.ErrorMessage) + } + err = fmt.Errorf(errString) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + instanceId = *createOutput.Instances[0].InstanceIds[0] // Tag the spot instance request (not the eventual spot instance) spotTags, err := s.SpotTags.EC2Tags(s.Ctx, *ec2conn.Config.Region, state) if err != nil { @@ -324,9 +294,36 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) ui.Error(err.Error()) return multistep.ActionHalt } - spotTags.Report(ui) if len(spotTags) > 0 && s.SpotTags.IsSet() { + spotTags.Report(ui) + + // Use the instance ID to find out the SIR, so that we can tag the spot + // request associated with this instance. + + err = retry.Config{ + Tries: 11, + ShouldRetry: func(error) bool { return true }, + RetryDelay: (&retry.Backoff{InitialBackoff: 200 * time.Millisecond, MaxBackoff: 30 * time.Second, Multiplier: 2}).Linear, + }.Run(ctx, func(ctx context.Context) error { + _, err := ec2conn.DescribeInstances(&ec2.DescribeInstancesInput{ + InstanceIds: []*string{aws.String(instanceId)}, + }) + return err + }) + if err != nil { + err := fmt.Errorf("Error describing instance for spot request tags: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + describeOutput, err := ec2conn.DescribeInstances(&ec2.DescribeInstancesInput{ + InstanceIds: []*string{aws.String(instanceId)}, + }) + sir := describeOutput.Reservations[0].Instances[0].SpotInstanceRequestId + + // Apply tags to the spot request. err = retry.Config{ Tries: 11, ShouldRetry: func(error) bool { return false }, @@ -334,7 +331,7 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) }.Run(ctx, func(ctx context.Context) error { _, err := ec2conn.CreateTags(&ec2.CreateTagsInput{ Tags: spotTags, - Resources: []*string{aws.String(req.RequestID)}, + Resources: []*string{sir}, }) return err }) @@ -346,24 +343,6 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) } } - // Actually send the spot connection request. - err = req.Send() - if err != nil { - err := fmt.Errorf("Error waiting for spot request (%s) to become ready: %s", req.RequestID, err) - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - } - - if len(createOutput.Errors) > 0 { - err := fmt.Errorf("error sending spot request: %s", *createOutput.Errors[0]) - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - } - - instanceId = *createOutput.Instances[0].InstanceIds[0] - // Set the instance ID so that the cleanup works properly s.instanceId = instanceId @@ -461,27 +440,9 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) } func (s *StepRunSpotInstance) Cleanup(state multistep.StateBag) { - ec2conn := state.Get("ec2").(*ec2.EC2) ui := state.Get("ui").(packer.Ui) - - // Cancel the spot request if it exists - if s.spotRequest != nil { - ui.Say("Cancelling the spot request...") - input := &ec2.CancelSpotInstanceRequestsInput{ - SpotInstanceRequestIds: []*string{s.spotRequest.SpotInstanceRequestId}, - } - if _, err := ec2conn.CancelSpotInstanceRequests(input); err != nil { - ui.Error(fmt.Sprintf("Error cancelling the spot request, may still be around: %s", err)) - return - } - - err := WaitUntilSpotRequestFulfilled(aws.BackgroundContext(), ec2conn, *s.spotRequest.SpotInstanceRequestId) - if err != nil { - ui.Error(err.Error()) - } - - } + launchTemplateName := state.Get("launchTemplateName").(string) // Terminate the source instance if it exists if s.instanceId != "" { @@ -498,7 +459,7 @@ func (s *StepRunSpotInstance) Cleanup(state multistep.StateBag) { // Delete the launch template used to create the spot fleet deleteInput := &ec2.DeleteLaunchTemplateInput{ - LaunchTemplateName: aws.String("packer-fleet-launch-template"), + LaunchTemplateName: aws.String(launchTemplateName), } if _, err := ec2conn.DeleteLaunchTemplate(deleteInput); err != nil { ui.Error(err.Error()) diff --git a/builder/amazon/common/step_run_spot_instance_test.go b/builder/amazon/common/step_run_spot_instance_test.go index 0be395463..62f2e7f6f 100644 --- a/builder/amazon/common/step_run_spot_instance_test.go +++ b/builder/amazon/common/step_run_spot_instance_test.go @@ -2,7 +2,6 @@ package common import ( "bytes" - "strconv" "testing" "time" @@ -97,7 +96,6 @@ func getBasicStep() *StepRunSpotInstance { InstanceType: "t2.micro", SourceAMI: "", SpotPrice: "auto", - SpotPriceProduct: "Linux/UNIX", SpotTags: TagMap(nil), Tags: TagMap{}, VolumeTags: TagMap(nil), @@ -107,20 +105,31 @@ func getBasicStep() *StepRunSpotInstance { return &stepRunSpotInstance } -func TestCalculateSpotPrice(t *testing.T) { + +func TestCreateTemplateData(t *testing.T) { + state := tStateSpot() stepRunSpotInstance := getBasicStep() - // Set spot price and spot price product - stepRunSpotInstance.SpotPrice = "auto" - stepRunSpotInstance.SpotPriceProduct = "Linux/UNIX" - ec2conn := getMockConnSpot() - // state := tStateSpot() - spotPrice, err := stepRunSpotInstance.CalculateSpotPrice("", ec2conn) - if err != nil { - t.Fatalf("Should not have had an error calculating spot price") + template := stepRunSpotInstance.CreateTemplateData(aws.String("userdata"), "az", state, + &ec2.LaunchTemplateInstanceMarketOptionsRequest{}) + + // expected := []*ec2.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{ + // &ec2.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{ + // DeleteOnTermination: aws.Bool(true), + // DeviceIndex: aws.Int64(0), + // Groups: aws.StringSlice([]string{"sg-0b8984db72f213dc3"}), + // SubnetId: aws.String("subnet-077fde4e"), + // }, + // } + // if expected != template.NetworkInterfaces { + if template.NetworkInterfaces == nil { + t.Fatalf("Template should have contained a networkInterface object: recieved %#v", template.NetworkInterfaces) } - sp, _ := strconv.ParseFloat(spotPrice, 64) - expected := 0.008500 - if sp != expected { // 0.003500 (from spot history) + .005 - t.Fatalf("Expected spot price of \"0.008500\", not %s", spotPrice) + + // Rerun, this time testing that we set security group IDs + state.Put("subnet_id", "") + template = stepRunSpotInstance.CreateTemplateData(aws.String("userdata"), "az", state, + &ec2.LaunchTemplateInstanceMarketOptionsRequest{}) + if template.NetworkInterfaces != nil { + t.Fatalf("Template shouldn't contain network interfaces object if subnet_id is unset.") } } diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index b46a16487..3c7916008 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -86,6 +86,8 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { // Accumulate any errors var errs *packer.MultiError + var warns []string + errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.AMIConfig.Prepare(&b.config.AccessConfig, &b.config.ctx)...) @@ -100,12 +102,20 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { "you use an AMI that already has either SR-IOV or ENA enabled.")) } + if b.config.RunConfig.SpotPriceAutoProduct != "" { + warns = append(warns, "spot_price_auto_product is deprecated and no "+ + "longer necessary for Packer builds. In future versions of "+ + "Packer, inclusion of spot_price_auto_product will error your "+ + "builds. Please take a look at our current documentation to "+ + "understand how Packer requests Spot instances.") + } + if errs != nil && len(errs.Errors) > 0 { - return nil, errs + return warns, errs } packer.LogSecretFilter.Set(b.config.AccessKey, b.config.SecretKey, b.config.Token) - return nil, nil + return warns, nil } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { @@ -144,7 +154,6 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack InstanceType: b.config.InstanceType, SourceAMI: b.config.SourceAmi, SpotPrice: b.config.SpotPrice, - SpotPriceProduct: b.config.SpotPriceAutoProduct, SpotTags: b.config.SpotTags, Tags: b.config.RunTags, SpotInstanceTypes: b.config.SpotInstanceTypes, @@ -177,8 +186,9 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack // Build the steps steps := []multistep.Step{ &awscommon.StepPreValidate{ - DestAmiName: b.config.AMIName, - ForceDeregister: b.config.AMIForceDeregister, + DestAmiName: b.config.AMIName, + ForceDeregister: b.config.AMIForceDeregister, + AMISkipBuildRegion: b.config.AMISkipBuildRegion, }, &awscommon.StepSourceAMIInfo{ SourceAmi: b.config.SourceAmi, @@ -221,7 +231,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack Config: &b.config.RunConfig.Comm, Host: awscommon.SSHHost( ec2conn, - b.config.Comm.SSHInterface), + b.config.SSHInterface), SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), }, &common.StepProvision{}, @@ -243,15 +253,18 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack AMIName: b.config.AMIName, Regions: b.config.AMIRegions, }, - &stepCreateAMI{}, + &stepCreateAMI{ + AMISkipBuildRegion: b.config.AMISkipBuildRegion, + }, &awscommon.StepAMIRegionCopy{ - AccessConfig: &b.config.AccessConfig, - Regions: b.config.AMIRegions, - AMIKmsKeyId: b.config.AMIKmsKeyId, - RegionKeyIds: b.config.AMIRegionKMSKeyIDs, - EncryptBootVolume: b.config.AMIEncryptBootVolume, - Name: b.config.AMIName, - OriginalRegion: *ec2conn.Config.Region, + AccessConfig: &b.config.AccessConfig, + Regions: b.config.AMIRegions, + AMIKmsKeyId: b.config.AMIKmsKeyId, + RegionKeyIds: b.config.AMIRegionKMSKeyIDs, + EncryptBootVolume: b.config.AMIEncryptBootVolume, + Name: b.config.AMIName, + OriginalRegion: *ec2conn.Config.Region, + AMISkipBuildRegion: b.config.AMISkipBuildRegion, }, &awscommon.StepModifyAMIAttributes{ Description: b.config.AMIDescription, diff --git a/builder/amazon/ebs/step_create_ami.go b/builder/amazon/ebs/step_create_ami.go index 9d0fd4811..1f607afe1 100644 --- a/builder/amazon/ebs/step_create_ami.go +++ b/builder/amazon/ebs/step_create_ami.go @@ -14,7 +14,8 @@ import ( ) type stepCreateAMI struct { - image *ec2.Image + image *ec2.Image + AMISkipBuildRegion bool } func (s *stepCreateAMI) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { @@ -25,9 +26,18 @@ func (s *stepCreateAMI) Run(ctx context.Context, state multistep.StateBag) multi // Create the image amiName := config.AMIName - if config.AMIEncryptBootVolume != nil { - // encrypt_boot was set, so we will create a temporary image - // and then create a copy of it with the correct encrypt_boot + state.Put("intermediary_image", false) + if config.AMIEncryptBootVolume != nil && *config.AMIEncryptBootVolume != false || s.AMISkipBuildRegion { + state.Put("intermediary_image", true) + + // From AWS SDK docs: You can encrypt a copy of an unencrypted snapshot, + // but you cannot use it to create an unencrypted copy of an encrypted + // snapshot. Your default CMK for EBS is used unless you specify a + // non-default key using KmsKeyId. + + // If encrypt_boot is nil or true, we need to create a temporary image + // so that in step_region_copy, we can copy it with the correct + // encryption amiName = random.AlphaNum(7) } diff --git a/builder/amazon/ebssurrogate/builder.go b/builder/amazon/ebssurrogate/builder.go index c1c841340..4e4b80910 100644 --- a/builder/amazon/ebssurrogate/builder.go +++ b/builder/amazon/ebssurrogate/builder.go @@ -95,6 +95,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { // Accumulate any errors var errs *packer.MultiError + var warns []string errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.RunConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, @@ -128,6 +129,14 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { "you use an AMI that already has either SR-IOV or ENA enabled.")) } + if b.config.RunConfig.SpotPriceAutoProduct != "" { + warns = append(warns, "spot_price_auto_product is deprecated and no "+ + "longer necessary for Packer builds. In future versions of "+ + "Packer, inclusion of spot_price_auto_product will error your "+ + "builds. Please take a look at our current documentation to "+ + "understand how Packer requests Spot instances.") + } + if b.config.Architecture == "" { b.config.Architecture = "x86_64" } @@ -142,11 +151,12 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs = packer.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "x86_64" and "arm64"`)) } if errs != nil && len(errs.Errors) > 0 { - return nil, errs + return warns, errs } packer.LogSecretFilter.Set(b.config.AccessKey, b.config.SecretKey, b.config.Token) - return nil, nil + + return warns, nil } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { @@ -183,7 +193,6 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack InstanceType: b.config.InstanceType, SourceAMI: b.config.SourceAmi, SpotPrice: b.config.SpotPrice, - SpotPriceProduct: b.config.SpotPriceAutoProduct, SpotInstanceTypes: b.config.SpotInstanceTypes, SpotTags: b.config.SpotTags, Tags: b.config.RunTags, @@ -263,7 +272,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack Config: &b.config.RunConfig.Comm, Host: awscommon.SSHHost( ec2conn, - b.config.Comm.SSHInterface), + b.config.SSHInterface), SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/amazon/ebsvolume/builder.go b/builder/amazon/ebsvolume/builder.go index 808c7c3ce..8efbc369a 100644 --- a/builder/amazon/ebsvolume/builder.go +++ b/builder/amazon/ebsvolume/builder.go @@ -81,6 +81,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { // Accumulate any errors var errs *packer.MultiError + var warns []string errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.RunConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.launchBlockDevices.Prepare(&b.config.ctx)...) @@ -103,12 +104,20 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { "you use an AMI that already has either SR-IOV or ENA enabled.")) } + if b.config.RunConfig.SpotPriceAutoProduct != "" { + warns = append(warns, "spot_price_auto_product is deprecated and no "+ + "longer necessary for Packer builds. In future versions of "+ + "Packer, inclusion of spot_price_auto_product will error your "+ + "builds. Please take a look at our current documentation to "+ + "understand how Packer requests Spot instances.") + } + if errs != nil && len(errs.Errors) > 0 { - return nil, errs + return warns, errs } packer.LogSecretFilter.Set(b.config.AccessKey, b.config.SecretKey, b.config.Token) - return nil, nil + return warns, nil } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { @@ -143,7 +152,6 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack InstanceType: b.config.InstanceType, SourceAMI: b.config.SourceAmi, SpotPrice: b.config.SpotPrice, - SpotPriceProduct: b.config.SpotPriceAutoProduct, SpotInstanceTypes: b.config.SpotInstanceTypes, SpotTags: b.config.SpotTags, Tags: b.config.RunTags, @@ -214,7 +222,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack Config: &b.config.RunConfig.Comm, Host: awscommon.SSHHost( ec2conn, - b.config.Comm.SSHInterface), + b.config.SSHInterface), SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/amazon/ebsvolume/step_tag_ebs_volumes.go b/builder/amazon/ebsvolume/step_tag_ebs_volumes.go index eee1882b6..e58cb98de 100644 --- a/builder/amazon/ebsvolume/step_tag_ebs_volumes.go +++ b/builder/amazon/ebsvolume/step_tag_ebs_volumes.go @@ -24,6 +24,9 @@ func (s *stepTagEBSVolumes) Run(ctx context.Context, state multistep.StateBag) m for _, instanceBlockDevices := range instance.BlockDeviceMappings { for _, configVolumeMapping := range s.VolumeMapping { if configVolumeMapping.DeviceName == *instanceBlockDevices.DeviceName { + if configVolumeMapping.DeleteOnTermination { + continue + } volumes[*ec2conn.Config.Region] = append( volumes[*ec2conn.Config.Region], *instanceBlockDevices.Ebs.VolumeId) diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index 8acea943b..5695f9eba 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -169,6 +169,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { // Accumulate any errors var errs *packer.MultiError + var warns []string errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.AMIMappings.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.LaunchMappings.Prepare(&b.config.ctx)...) @@ -207,11 +208,19 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { "you use an AMI that already has either SR-IOV or ENA enabled.")) } + if b.config.RunConfig.SpotPriceAutoProduct != "" { + warns = append(warns, "spot_price_auto_product is deprecated and no "+ + "longer necessary for Packer builds. In future versions of "+ + "Packer, inclusion of spot_price_auto_product will error your "+ + "builds. Please take a look at our current documentation to "+ + "understand how Packer requests Spot instances.") + } + if errs != nil && len(errs.Errors) > 0 { - return nil, errs + return warns, errs } packer.LogSecretFilter.Set(b.config.AccessKey, b.config.SecretKey, b.config.Token) - return nil, nil + return warns, nil } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { @@ -247,7 +256,6 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack SourceAMI: b.config.SourceAmi, SpotPrice: b.config.SpotPrice, SpotInstanceTypes: b.config.SpotInstanceTypes, - SpotPriceProduct: b.config.SpotPriceAutoProduct, Tags: b.config.RunTags, SpotTags: b.config.SpotTags, UserData: b.config.UserData, @@ -316,7 +324,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack Config: &b.config.RunConfig.Comm, Host: awscommon.SSHHost( ec2conn, - b.config.Comm.SSHInterface), + b.config.SSHInterface), SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/azure/arm/artifact.go b/builder/azure/arm/artifact.go index f9bb25d81..522e08160 100644 --- a/builder/azure/arm/artifact.go +++ b/builder/azure/arm/artifact.go @@ -35,6 +35,8 @@ type Artifact struct { ManagedImageId string ManagedImageOSDiskSnapshotName string ManagedImageDataDiskSnapshotPrefix string + // ARM resource id for Shared Image Gallery + ManagedImageSharedImageGalleryId string // Additional Disks AdditionalDisks *[]AdditionalDiskArtifact @@ -52,6 +54,19 @@ func NewManagedImageArtifact(osType, resourceGroup, name, location, id, osDiskSn }, nil } +func NewManagedImageArtifactWithSIGAsDestination(osType, resourceGroup, name, location, id, osDiskSnapshotName, dataDiskSnapshotPrefix, destinationSharedImageGalleryId string) (*Artifact, error) { + return &Artifact{ + ManagedImageResourceGroupName: resourceGroup, + ManagedImageName: name, + ManagedImageLocation: location, + ManagedImageId: id, + OSType: osType, + ManagedImageOSDiskSnapshotName: osDiskSnapshotName, + ManagedImageDataDiskSnapshotPrefix: dataDiskSnapshotPrefix, + ManagedImageSharedImageGalleryId: destinationSharedImageGalleryId, + }, nil +} + func NewArtifact(template *CaptureTemplate, getSasUrl func(name string) string, osType string) (*Artifact, error) { if template == nil { return nil, fmt.Errorf("nil capture template") @@ -168,6 +183,9 @@ func (a *Artifact) String() string { if a.ManagedImageDataDiskSnapshotPrefix != "" { buf.WriteString(fmt.Sprintf("ManagedImageDataDiskSnapshotPrefix: %s\n", a.ManagedImageDataDiskSnapshotPrefix)) } + if a.ManagedImageSharedImageGalleryId != "" { + buf.WriteString(fmt.Sprintf("ManagedImageSharedImageGalleryId: %s\n", a.ManagedImageSharedImageGalleryId)) + } } else { buf.WriteString(fmt.Sprintf("StorageAccountLocation: %s\n", a.StorageAccountLocation)) buf.WriteString(fmt.Sprintf("OSDiskUri: %s\n", a.OSDiskUri)) diff --git a/builder/azure/arm/artifact_test.go b/builder/azure/arm/artifact_test.go index 11b8c3b2a..4556b4619 100644 --- a/builder/azure/arm/artifact_test.go +++ b/builder/azure/arm/artifact_test.go @@ -108,6 +108,30 @@ ManagedImageOSDiskSnapshotName: fakeOsDiskSnapshotName } } +func TestArtifactIDManagedImageWithSharedImageGalleryId(t *testing.T) { + artifact, err := NewManagedImageArtifactWithSIGAsDestination("Linux", "fakeResourceGroup", "fakeName", "fakeLocation", "fakeID", "fakeOsDiskSnapshotName", "fakeDataDiskSnapshotPrefix", "fakeSharedImageGallery") + if err != nil { + t.Fatalf("err=%s", err) + } + + expected := `Azure.ResourceManagement.VMImage: + +OSType: Linux +ManagedImageResourceGroupName: fakeResourceGroup +ManagedImageName: fakeName +ManagedImageId: fakeID +ManagedImageLocation: fakeLocation +ManagedImageOSDiskSnapshotName: fakeOsDiskSnapshotName +ManagedImageDataDiskSnapshotPrefix: fakeDataDiskSnapshotPrefix +ManagedImageSharedImageGalleryId: fakeSharedImageGallery +` + + result := artifact.String() + if result != expected { + t.Fatalf("bad: %s", result) + } +} + func TestArtifactString(t *testing.T) { template := CaptureTemplate{ Resources: []CaptureResources{ diff --git a/builder/azure/arm/azure_client.go b/builder/azure/arm/azure_client.go index a225ee618..ab4330e37 100644 --- a/builder/azure/arm/azure_client.go +++ b/builder/azure/arm/azure_client.go @@ -9,8 +9,10 @@ import ( "net/url" "os" "strconv" + "time" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute" + newCompute "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network" "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources" armStorage "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage" @@ -41,6 +43,8 @@ type AzureClient struct { armStorage.AccountsClient compute.DisksClient compute.SnapshotsClient + newCompute.GalleryImageVersionsClient + newCompute.GalleryImagesClient InspectorMaxLength int Template *CaptureTemplate @@ -123,7 +127,7 @@ func byConcatDecorators(decorators ...autorest.RespondDecorator) autorest.Respon } func NewAzureClient(subscriptionID, resourceGroupName, storageAccountName string, - cloud *azure.Environment, + cloud *azure.Environment, SharedGalleryTimeout time.Duration, servicePrincipalToken, servicePrincipalTokenVault *adal.ServicePrincipalToken) (*AzureClient, error) { var azureClient = &AzureClient{} @@ -202,6 +206,19 @@ func NewAzureClient(subscriptionID, resourceGroupName, storageAccountName string azureClient.AccountsClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient)) azureClient.AccountsClient.UserAgent = fmt.Sprintf("%s %s", useragent.String(), azureClient.AccountsClient.UserAgent) + azureClient.GalleryImageVersionsClient = newCompute.NewGalleryImageVersionsClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID) + azureClient.GalleryImageVersionsClient.Authorizer = autorest.NewBearerAuthorizer(servicePrincipalToken) + azureClient.GalleryImageVersionsClient.RequestInspector = withInspection(maxlen) + azureClient.GalleryImageVersionsClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient)) + azureClient.GalleryImageVersionsClient.UserAgent = fmt.Sprintf("%s %s", useragent.String(), azureClient.GalleryImageVersionsClient.UserAgent) + azureClient.GalleryImageVersionsClient.Client.PollingDuration = SharedGalleryTimeout + + azureClient.GalleryImagesClient = newCompute.NewGalleryImagesClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID) + azureClient.GalleryImagesClient.Authorizer = autorest.NewBearerAuthorizer(servicePrincipalToken) + azureClient.GalleryImagesClient.RequestInspector = withInspection(maxlen) + azureClient.GalleryImagesClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient)) + azureClient.GalleryImagesClient.UserAgent = fmt.Sprintf("%s %s", useragent.String(), azureClient.GalleryImagesClient.UserAgent) + keyVaultURL, err := url.Parse(cloud.KeyVaultEndpoint) if err != nil { return nil, err diff --git a/builder/azure/arm/builder.go b/builder/azure/arm/builder.go index b67f3bec9..2be58819d 100644 --- a/builder/azure/arm/builder.go +++ b/builder/azure/arm/builder.go @@ -90,6 +90,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack b.config.ResourceGroupName, b.config.StorageAccount, b.config.cloudEnvironment, + b.config.SharedGalleryTimeout, spnCloud, spnKeyVault) @@ -177,6 +178,31 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack deploymentName := b.stateBag.Get(constants.ArmDeploymentName).(string) + // For Managed Images, validate that Shared Gallery Image exists before publishing to SIG + if b.config.isManagedImage() && b.config.SharedGalleryDestination.SigDestinationGalleryName != "" { + _, err = azureClient.GalleryImagesClient.Get(ctx, b.config.SharedGalleryDestination.SigDestinationResourceGroup, b.config.SharedGalleryDestination.SigDestinationGalleryName, b.config.SharedGalleryDestination.SigDestinationImageName) + if err != nil { + return nil, fmt.Errorf("the Shared Gallery Image to which to publish the managed image version to does not exist in the resource group %s", b.config.SharedGalleryDestination.SigDestinationResourceGroup) + } + // SIG requires that replication regions include the region in which the Managed Image resides + managedImageLocation := normalizeAzureRegion(b.stateBag.Get(constants.ArmLocation).(string)) + foundMandatoryReplicationRegion := false + var normalizedReplicationRegions []string + for _, region := range b.config.SharedGalleryDestination.SigDestinationReplicationRegions { + // change region to lower-case and strip spaces + normalizedRegion := normalizeAzureRegion(region) + normalizedReplicationRegions = append(normalizedReplicationRegions, normalizedRegion) + if strings.EqualFold(normalizedRegion, managedImageLocation) { + foundMandatoryReplicationRegion = true + continue + } + } + if foundMandatoryReplicationRegion == false { + b.config.SharedGalleryDestination.SigDestinationReplicationRegions = append(normalizedReplicationRegions, managedImageLocation) + } + b.stateBag.Put(constants.ArmManagedImageSharedGalleryReplicationRegions, b.config.SharedGalleryDestination.SigDestinationReplicationRegions) + } + if b.config.OSType == constants.Target_Linux { steps = []multistep.Step{ NewStepCreateResourceGroup(azureClient, ui), @@ -198,6 +224,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack NewStepSnapshotOSDisk(azureClient, ui, b.config), NewStepSnapshotDataDisks(azureClient, ui, b.config), NewStepCaptureImage(azureClient, ui), + NewStepPublishToSharedImageGallery(azureClient, ui, b.config), NewStepDeleteResourceGroup(azureClient, ui), NewStepDeleteOSDisk(azureClient, ui), NewStepDeleteAdditionalDisks(azureClient, ui), @@ -236,6 +263,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack NewStepSnapshotOSDisk(azureClient, ui, b.config), NewStepSnapshotDataDisks(azureClient, ui, b.config), NewStepCaptureImage(azureClient, ui), + NewStepPublishToSharedImageGallery(azureClient, ui, b.config), NewStepDeleteResourceGroup(azureClient, ui), NewStepDeleteOSDisk(azureClient, ui), NewStepDeleteAdditionalDisks(azureClient, ui), @@ -275,6 +303,9 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack if b.config.isManagedImage() { managedImageID := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/images/%s", b.config.SubscriptionID, b.config.ManagedImageResourceGroupName, b.config.ManagedImageName) + if b.config.SharedGalleryDestination.SigDestinationGalleryName != "" { + return NewManagedImageArtifactWithSIGAsDestination(b.config.OSType, b.config.ManagedImageResourceGroupName, b.config.ManagedImageName, b.config.manageImageLocation, managedImageID, b.config.ManagedImageOSDiskSnapshotName, b.config.ManagedImageDataDiskSnapshotPrefix, b.stateBag.Get(constants.ArmManagedImageSharedGalleryId).(string)) + } return NewManagedImageArtifact(b.config.OSType, b.config.ManagedImageResourceGroupName, b.config.ManagedImageName, b.config.manageImageLocation, managedImageID, b.config.ManagedImageOSDiskSnapshotName, b.config.ManagedImageDataDiskSnapshotPrefix) } else if template, ok := b.stateBag.GetOk(constants.ArmCaptureTemplate); ok { return NewArtifact( @@ -369,6 +400,13 @@ func (b *Builder) configureStateBag(stateBag multistep.StateBag) { stateBag.Put(constants.ArmManagedImageOSDiskSnapshotName, b.config.ManagedImageOSDiskSnapshotName) stateBag.Put(constants.ArmManagedImageDataDiskSnapshotPrefix, b.config.ManagedImageDataDiskSnapshotPrefix) stateBag.Put(constants.ArmAsyncResourceGroupDelete, b.config.AsyncResourceGroupDelete) + if b.config.isManagedImage() && b.config.SharedGalleryDestination.SigDestinationGalleryName != "" { + stateBag.Put(constants.ArmManagedImageSigPublishResourceGroup, b.config.SharedGalleryDestination.SigDestinationResourceGroup) + stateBag.Put(constants.ArmManagedImageSharedGalleryName, b.config.SharedGalleryDestination.SigDestinationGalleryName) + stateBag.Put(constants.ArmManagedImageSharedGalleryImageName, b.config.SharedGalleryDestination.SigDestinationImageName) + stateBag.Put(constants.ArmManagedImageSharedGalleryImageVersion, b.config.SharedGalleryDestination.SigDestinationImageVersion) + stateBag.Put(constants.ArmManagedImageSubscription, b.config.SubscriptionID) + } } // Parameters that are only known at runtime after querying Azure. @@ -404,3 +442,7 @@ func getObjectIdFromToken(ui packer.Ui, token *adal.ServicePrincipalToken) strin return claims["oid"].(string) } + +func normalizeAzureRegion(name string) string { + return strings.ToLower(strings.Replace(name, " ", "", -1)) +} diff --git a/builder/azure/arm/builder_acc_test.go b/builder/azure/arm/builder_acc_test.go index 124ee939e..57e48a4cb 100644 --- a/builder/azure/arm/builder_acc_test.go +++ b/builder/azure/arm/builder_acc_test.go @@ -11,7 +11,7 @@ package arm // // The subscription in question should have a resource group // called "packer-acceptance-test" in "South Central US" region. The -// storage account refered to in the above variable should +// storage account referred to in the above variable should // be inside this resource group and in "South Central US" as well. // // In addition, the PACKER_ACC variable should also be set to diff --git a/builder/azure/arm/config.go b/builder/azure/arm/config.go index d577584cf..eb8f37ad7 100644 --- a/builder/azure/arm/config.go +++ b/builder/azure/arm/config.go @@ -80,6 +80,14 @@ type SharedImageGallery struct { ImageVersion string `mapstructure:"image_version" required:"false"` } +type SharedImageGalleryDestination struct { + SigDestinationResourceGroup string `mapstructure:"resource_group"` + SigDestinationGalleryName string `mapstructure:"gallery_name"` + SigDestinationImageName string `mapstructure:"image_name"` + SigDestinationImageVersion string `mapstructure:"image_version"` + SigDestinationReplicationRegions []string `mapstructure:"replication_regions"` +} + type Config struct { common.PackerConfig `mapstructure:",squash"` @@ -104,6 +112,30 @@ type Config struct { // "managed_image_name": "TargetImageName", // "managed_image_resource_group_name": "TargetResourceGroup" SharedGallery SharedImageGallery `mapstructure:"shared_image_gallery" required:"false"` + // The name of the Shared Image Gallery under which the managed image will be published as Shared Gallery Image version. + // + // Following is an example. + // + // + // + // "shared_image_gallery_destination": { + // "resource_group": "ResourceGroup", + // "gallery_name": "GalleryName", + // "image_name": "ImageName", + // "image_version": "1.0.0", + // "replication_regions": ["regionA", "regionB", "regionC"] + // } + // "managed_image_name": "TargetImageName", + // "managed_image_resource_group_name": "TargetResourceGroup" + SharedGalleryDestination SharedImageGalleryDestination `mapstructure:"shared_image_gallery_destination"` + // How long to wait for an image to be published to the shared image + // gallery before timing out. If your Packer build is failing on the + // Publishing to Shared Image Gallery step with the error `Original Error: + // context deadline exceeded`, but the image is present when you check your + // Azure dashboard, then you probably need to increase this timeout from + // its default of "60m" (valid time units include `s` for seconds, `m` for + // minutes, and `h` for hours.) + SharedGalleryTimeout time.Duration `mapstructure:"shared_image_gallery_timeout"` // PublisherName for your base image. See // [documentation](https://azure.microsoft.com/en-us/documentation/articles/resource-groups-vm-searching/) // for details. @@ -721,16 +753,16 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) { } } else if c.ImageUrl == "" && c.ImagePublisher == "" { if c.CustomManagedImageResourceGroupName == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("An custom_managed_image_resource_group_name must be specified")) + errs = packer.MultiErrorAppend(errs, fmt.Errorf("A custom_managed_image_resource_group_name must be specified")) } if c.CustomManagedImageName == "" { errs = packer.MultiErrorAppend(errs, fmt.Errorf("A custom_managed_image_name must be specified")) } if c.ManagedImageResourceGroupName == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("An managed_image_resource_group_name must be specified")) + errs = packer.MultiErrorAppend(errs, fmt.Errorf("A managed_image_resource_group_name must be specified")) } if c.ManagedImageName == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("An managed_image_name must be specified")) + errs = packer.MultiErrorAppend(errs, fmt.Errorf("A managed_image_name must be specified")) } } else { if c.ImagePublisher != "" || c.ImageOffer != "" || c.ImageSku != "" || c.ImageVersion != "" { @@ -785,6 +817,25 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) { } } + if c.ManagedImageName != "" && c.ManagedImageResourceGroupName != "" && c.SharedGalleryDestination.SigDestinationGalleryName != "" { + if c.SharedGalleryDestination.SigDestinationResourceGroup == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("A resource_group must be specified for shared_image_gallery_destination")) + } + if c.SharedGalleryDestination.SigDestinationImageName == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("An image_name must be specified for shared_image_gallery_destination")) + } + if c.SharedGalleryDestination.SigDestinationImageVersion == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("An image_version must be specified for shared_image_gallery_destination")) + } + if len(c.SharedGalleryDestination.SigDestinationReplicationRegions) == 0 { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("A list of replication_regions must be specified for shared_image_gallery_destination")) + } + } + if c.SharedGalleryTimeout == 0 { + // default to a one-hour timeout. In the sdk, the default is 15 m. + c.SharedGalleryTimeout = 60 * time.Minute + } + if c.ManagedImageOSDiskSnapshotName != "" { if ok, err := assertManagedImageOSDiskSnapshotName(c.ManagedImageOSDiskSnapshotName, "managed_image_os_disk_snapshot_name"); !ok { errs = packer.MultiErrorAppend(errs, err) diff --git a/builder/azure/arm/step_delete_resource_group.go b/builder/azure/arm/step_delete_resource_group.go index ee8e2a08e..8e873c2d7 100644 --- a/builder/azure/arm/step_delete_resource_group.go +++ b/builder/azure/arm/step_delete_resource_group.go @@ -56,7 +56,7 @@ func (s *StepDeleteResourceGroup) deleteResourceGroup(ctx context.Context, state f, err := s.client.GroupsClient.Delete(ctx, resourceGroupName) if err == nil { if state.Get(constants.ArmAsyncResourceGroupDelete).(bool) { - // No need to wait for the complition for delete if request is Accepted + // No need to wait for the completion for delete if request is Accepted s.say(fmt.Sprintf("\nResource Group is being deleted, not waiting for deletion due to config. Resource Group Name '%s'", resourceGroupName)) } else { f.WaitForCompletionRef(ctx, s.client.GroupsClient.Client) diff --git a/builder/azure/arm/step_publish_to_shared_image_gallery.go b/builder/azure/arm/step_publish_to_shared_image_gallery.go new file mode 100644 index 000000000..347a9002c --- /dev/null +++ b/builder/azure/arm/step_publish_to_shared_image_gallery.go @@ -0,0 +1,125 @@ +package arm + +import ( + "context" + "fmt" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute" + "github.com/hashicorp/packer/builder/azure/common/constants" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type StepPublishToSharedImageGallery struct { + client *AzureClient + publish func(ctx context.Context, mdiID, miSigPubRg, miSIGalleryName, miSGImageName, miSGImageVersion string, miSigReplicationRegions []string, location string, tags map[string]*string) (string, error) + say func(message string) + error func(e error) + toSIG func() bool +} + +func NewStepPublishToSharedImageGallery(client *AzureClient, ui packer.Ui, config *Config) *StepPublishToSharedImageGallery { + var step = &StepPublishToSharedImageGallery{ + client: client, + say: func(message string) { + ui.Say(message) + }, + error: func(e error) { + ui.Error(e.Error()) + }, + toSIG: func() bool { + return config.isManagedImage() && config.SharedGalleryDestination.SigDestinationGalleryName != "" + }, + } + + step.publish = step.publishToSig + return step +} + +func (s *StepPublishToSharedImageGallery) publishToSig(ctx context.Context, mdiID string, miSigPubRg string, miSIGalleryName string, miSGImageName string, miSGImageVersion string, miSigReplicationRegions []string, location string, tags map[string]*string) (string, error) { + + replicationRegions := make([]compute.TargetRegion, len(miSigReplicationRegions)) + for i, v := range miSigReplicationRegions { + regionName := v + replicationRegions[i] = compute.TargetRegion{Name: ®ionName} + } + + galleryImageVersion := compute.GalleryImageVersion{ + Location: &location, + Tags: tags, + GalleryImageVersionProperties: &compute.GalleryImageVersionProperties{ + PublishingProfile: &compute.GalleryImageVersionPublishingProfile{ + Source: &compute.GalleryArtifactSource{ + ManagedImage: &compute.ManagedArtifact{ + ID: &mdiID, + }, + }, + TargetRegions: &replicationRegions, + }, + }, + } + + f, err := s.client.GalleryImageVersionsClient.CreateOrUpdate(ctx, miSigPubRg, miSIGalleryName, miSGImageName, miSGImageVersion, galleryImageVersion) + + if err != nil { + s.say(s.client.LastError.Error()) + return "", err + } + + err = f.WaitForCompletionRef(ctx, s.client.GalleryImageVersionsClient.Client) + + if err != nil { + s.say(s.client.LastError.Error()) + return "", err + } + + createdSGImageVersion, err := f.Result(s.client.GalleryImageVersionsClient) + + if err != nil { + s.say(s.client.LastError.Error()) + return "", err + } + + s.say(fmt.Sprintf(" -> Shared Gallery Image Version ID : '%s'", *(createdSGImageVersion.ID))) + return *(createdSGImageVersion.ID), nil +} + +func (s *StepPublishToSharedImageGallery) Run(ctx context.Context, stateBag multistep.StateBag) multistep.StepAction { + if !s.toSIG() { + return multistep.ActionContinue + } + + s.say("Publishing to Shared Image Gallery ...") + + var miSigPubRg = stateBag.Get(constants.ArmManagedImageSigPublishResourceGroup).(string) + var miSIGalleryName = stateBag.Get(constants.ArmManagedImageSharedGalleryName).(string) + var miSGImageName = stateBag.Get(constants.ArmManagedImageSharedGalleryImageName).(string) + var miSGImageVersion = stateBag.Get(constants.ArmManagedImageSharedGalleryImageVersion).(string) + var location = stateBag.Get(constants.ArmLocation).(string) + var tags = stateBag.Get(constants.ArmTags).(map[string]*string) + var miSigReplicationRegions = stateBag.Get(constants.ArmManagedImageSharedGalleryReplicationRegions).([]string) + var targetManagedImageResourceGroupName = stateBag.Get(constants.ArmManagedImageResourceGroupName).(string) + var targetManagedImageName = stateBag.Get(constants.ArmManagedImageName).(string) + var managedImageSubscription = stateBag.Get(constants.ArmManagedImageSubscription).(string) + var mdiID = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/images/%s", managedImageSubscription, targetManagedImageResourceGroupName, targetManagedImageName) + + s.say(fmt.Sprintf(" -> MDI ID used for SIG publish : '%s'", mdiID)) + s.say(fmt.Sprintf(" -> SIG publish resource group : '%s'", miSigPubRg)) + s.say(fmt.Sprintf(" -> SIG gallery name : '%s'", miSIGalleryName)) + s.say(fmt.Sprintf(" -> SIG image name : '%s'", miSGImageName)) + s.say(fmt.Sprintf(" -> SIG image version : '%s'", miSGImageVersion)) + s.say(fmt.Sprintf(" -> SIG replication regions : '%v'", miSigReplicationRegions)) + createdGalleryImageVersionID, err := s.publish(ctx, mdiID, miSigPubRg, miSIGalleryName, miSGImageName, miSGImageVersion, miSigReplicationRegions, location, tags) + + if err != nil { + stateBag.Put(constants.Error, err) + s.error(err) + + return multistep.ActionHalt + } + + stateBag.Put(constants.ArmManagedImageSharedGalleryId, createdGalleryImageVersionID) + return multistep.ActionContinue +} + +func (*StepPublishToSharedImageGallery) Cleanup(multistep.StateBag) { +} diff --git a/builder/azure/arm/step_publish_to_shared_image_gallery_test.go b/builder/azure/arm/step_publish_to_shared_image_gallery_test.go new file mode 100644 index 000000000..97c7aa289 --- /dev/null +++ b/builder/azure/arm/step_publish_to_shared_image_gallery_test.go @@ -0,0 +1,84 @@ +package arm + +import ( + "context" + "github.com/hashicorp/packer/builder/azure/common/constants" + "github.com/hashicorp/packer/helper/multistep" + "testing" +) + +func TestStepPublishToSharedImageGalleryShouldNotPublishForVhd(t *testing.T) { + var testSubject = &StepPublishToSharedImageGallery{ + publish: func(context.Context, string, string, string, string, string, []string, string, map[string]*string) (string, error) { + return "test", nil + }, + say: func(message string) {}, + error: func(e error) {}, + toSIG: func() bool { return false }, + } + + stateBag := createTestStateBagStepPublishToSharedImageGalleryForVhd() + var result = testSubject.Run(context.Background(), stateBag) + if result != multistep.ActionContinue { + t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result) + } + + if _, ok := stateBag.GetOk(constants.Error); ok == true { + t.Fatalf("Expected the step to not set stateBag['%s'], but it was.", constants.Error) + } +} + +func TestStepPublishToSharedImageGalleryShouldPublishForManagedImageWithSig(t *testing.T) { + var testSubject = &StepPublishToSharedImageGallery{ + publish: func(context.Context, string, string, string, string, string, []string, string, map[string]*string) (string, error) { + return "", nil + }, + say: func(message string) {}, + error: func(e error) {}, + toSIG: func() bool { return true }, + } + + stateBag := createTestStateBagStepPublishToSharedImageGallery() + var result = testSubject.Run(context.Background(), stateBag) + if result != multistep.ActionContinue { + t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result) + } + + if _, ok := stateBag.GetOk(constants.Error); ok == true { + t.Fatalf("Expected the step to not set stateBag['%s'], but it was.", constants.Error) + } +} + +func createTestStateBagStepPublishToSharedImageGallery() multistep.StateBag { + stateBag := new(multistep.BasicStateBag) + + stateBag.Put(constants.ArmManagedImageSigPublishResourceGroup, "Unit Test: ManagedImageSigPublishResourceGroup") + stateBag.Put(constants.ArmManagedImageSharedGalleryName, "Unit Test: ManagedImageSharedGalleryName") + stateBag.Put(constants.ArmManagedImageSharedGalleryImageName, "Unit Test: ManagedImageSharedGalleryImageName") + stateBag.Put(constants.ArmManagedImageSharedGalleryImageVersion, "Unit Test: ManagedImageSharedGalleryImageVersion") + stateBag.Put(constants.ArmLocation, "Unit Test: Location") + value := "Unit Test: Tags" + tags := map[string]*string{ + "tag01": &value, + } + stateBag.Put(constants.ArmTags, tags) + stateBag.Put(constants.ArmManagedImageSharedGalleryReplicationRegions, []string{"ManagedImageSharedGalleryReplicationRegionA", "ManagedImageSharedGalleryReplicationRegionB"}) + stateBag.Put(constants.ArmManagedImageResourceGroupName, "Unit Test: ManagedImageResourceGroupName") + stateBag.Put(constants.ArmManagedImageName, "Unit Test: ManagedImageName") + stateBag.Put(constants.ArmManagedImageSubscription, "Unit Test: ManagedImageSubscription") + + return stateBag +} + +func createTestStateBagStepPublishToSharedImageGalleryForVhd() multistep.StateBag { + stateBag := new(multistep.BasicStateBag) + + stateBag.Put(constants.ArmLocation, "Unit Test: Location") + value := "Unit Test: Tags" + tags := map[string]*string{ + "tag01": &value, + } + stateBag.Put(constants.ArmTags, tags) + + return stateBag +} diff --git a/builder/azure/common/constants/stateBag.go b/builder/azure/common/constants/stateBag.go index f57f5e5a5..c68afd508 100644 --- a/builder/azure/common/constants/stateBag.go +++ b/builder/azure/common/constants/stateBag.go @@ -30,11 +30,18 @@ const ( ArmVirtualMachineCaptureParameters string = "arm.VirtualMachineCaptureParameters" ArmIsExistingResourceGroup string = "arm.IsExistingResourceGroup" - ArmIsManagedImage string = "arm.IsManagedImage" - ArmManagedImageResourceGroupName string = "arm.ManagedImageResourceGroupName" - ArmManagedImageLocation string = "arm.ManagedImageLocation" - ArmManagedImageName string = "arm.ManagedImageName" - ArmAsyncResourceGroupDelete string = "arm.AsyncResourceGroupDelete" - ArmManagedImageOSDiskSnapshotName string = "arm.ManagedImageOSDiskSnapshotName" - ArmManagedImageDataDiskSnapshotPrefix string = "arm.ManagedImageDataDiskSnapshotPrefix" + ArmIsManagedImage string = "arm.IsManagedImage" + ArmManagedImageResourceGroupName string = "arm.ManagedImageResourceGroupName" + ArmManagedImageLocation string = "arm.ManagedImageLocation" + ArmManagedImageName string = "arm.ManagedImageName" + ArmManagedImageSigPublishResourceGroup string = "arm.ManagedImageSigPublishResourceGroup" + ArmManagedImageSharedGalleryName string = "arm.ManagedImageSharedGalleryName" + ArmManagedImageSharedGalleryImageName string = "arm.ManagedImageSharedGalleryImageName" + ArmManagedImageSharedGalleryImageVersion string = "arm.ManagedImageSharedGalleryImageVersion" + ArmManagedImageSharedGalleryReplicationRegions string = "arm.ManagedImageSharedGalleryReplicationRegions" + ArmManagedImageSharedGalleryId string = "arm.ArmManagedImageSharedGalleryId" + ArmManagedImageSubscription string = "arm.ArmManagedImageSubscription" + ArmAsyncResourceGroupDelete string = "arm.AsyncResourceGroupDelete" + ArmManagedImageOSDiskSnapshotName string = "arm.ManagedImageOSDiskSnapshotName" + ArmManagedImageDataDiskSnapshotPrefix string = "arm.ManagedImageDataDiskSnapshotPrefix" ) diff --git a/builder/cloudstack/builder.go b/builder/cloudstack/builder.go index c40b112a3..fe376125f 100644 --- a/builder/cloudstack/builder.go +++ b/builder/cloudstack/builder.go @@ -77,7 +77,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack &stepSetupNetworking{}, &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "ipaddress"), SSHConfig: b.config.Comm.SSHConfigFunc(), SSHPort: commPort, WinRMPort: commPort, diff --git a/builder/cloudstack/ssh.go b/builder/cloudstack/ssh.go index ec9fbe123..269c2a583 100644 --- a/builder/cloudstack/ssh.go +++ b/builder/cloudstack/ssh.go @@ -6,15 +6,6 @@ import ( "github.com/hashicorp/packer/helper/multistep" ) -func commHost(state multistep.StateBag) (string, error) { - ip, hasIP := state.Get("ipaddress").(string) - if !hasIP { - return "", fmt.Errorf("Failed to retrieve IP address") - } - - return ip, nil -} - func commPort(state multistep.StateBag) (int, error) { commPort, hasPort := state.Get("commPort").(int) if !hasPort { diff --git a/builder/digitalocean/builder.go b/builder/digitalocean/builder.go index 4b5f6e36d..4c515b900 100644 --- a/builder/digitalocean/builder.go +++ b/builder/digitalocean/builder.go @@ -86,7 +86,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack new(stepDropletInfo), &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "droplet_ip"), SSHConfig: b.config.Comm.SSHConfigFunc(), }, new(common.StepProvision), @@ -95,7 +95,9 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, new(stepShutdown), new(stepPowerOff), - new(stepSnapshot), + &stepSnapshot{ + snapshotTimeout: b.config.SnapshotTimeout, + }, } // Run the steps diff --git a/builder/digitalocean/builder_test.go b/builder/digitalocean/builder_test.go index 9ef7c0ad7..70ec6fea9 100644 --- a/builder/digitalocean/builder_test.go +++ b/builder/digitalocean/builder_test.go @@ -190,7 +190,46 @@ func TestBuilderPrepare_StateTimeout(t *testing.T) { if err == nil { t.Fatal("should have error") } +} +func TestBuilderPrepare_SnapshotTimeout(t *testing.T) { + var b Builder + config := testConfig() + + // Test default + 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.SnapshotTimeout != 60*time.Minute { + t.Errorf("invalid: %s", b.config.SnapshotTimeout) + } + + // Test set + config["snapshot_timeout"] = "15m" + b = Builder{} + 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["snapshot_timeout"] = "badstring" + 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_PrivateNetworking(t *testing.T) { diff --git a/builder/digitalocean/config.go b/builder/digitalocean/config.go index a03d15522..5d0a2b9b7 100644 --- a/builder/digitalocean/config.go +++ b/builder/digitalocean/config.go @@ -64,6 +64,14 @@ type Config struct { // droplet to enter a desired state (such as "active") before timing out. The // default state timeout is "6m". StateTimeout time.Duration `mapstructure:"state_timeout" required:"false"` + // How long to wait for an image to be published to the shared image + // gallery before timing out. If your Packer build is failing on the + // Publishing to Shared Image Gallery step with the error `Original Error: + // context deadline exceeded`, but the image is present when you check your + // Azure dashboard, then you probably need to increase this timeout from + // its default of "60m" (valid time units include `s` for seconds, `m` for + // minutes, and `h` for hours.) + SnapshotTimeout time.Duration `mapstructure:"snapshot_timeout" required:"false"` // The name assigned to the droplet. DigitalOcean // sets the hostname of the machine to this value. DropletName string `mapstructure:"droplet_name" required:"false"` @@ -127,6 +135,11 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { c.StateTimeout = 6 * time.Minute } + if c.SnapshotTimeout == 0 { + // Default to 60 minutes timeout, waiting for snapshot action to finish + c.SnapshotTimeout = 60 * time.Minute + } + var errs *packer.MultiError if es := c.Comm.Prepare(&c.ctx); len(es) > 0 { errs = packer.MultiErrorAppend(errs, es...) diff --git a/builder/digitalocean/ssh.go b/builder/digitalocean/ssh.go deleted file mode 100644 index b47628ba8..000000000 --- a/builder/digitalocean/ssh.go +++ /dev/null @@ -1,10 +0,0 @@ -package digitalocean - -import ( - "github.com/hashicorp/packer/helper/multistep" -) - -func commHost(state multistep.StateBag) (string, error) { - ipAddress := state.Get("droplet_ip").(string) - return ipAddress, nil -} diff --git a/builder/digitalocean/step_snapshot.go b/builder/digitalocean/step_snapshot.go index f3c9430f1..511c3a377 100644 --- a/builder/digitalocean/step_snapshot.go +++ b/builder/digitalocean/step_snapshot.go @@ -12,7 +12,9 @@ import ( "github.com/hashicorp/packer/packer" ) -type stepSnapshot struct{} +type stepSnapshot struct { + snapshotTimeout time.Duration +} func (s *stepSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*godo.Client) @@ -31,9 +33,11 @@ func (s *stepSnapshot) Run(ctx context.Context, state multistep.StateBag) multis } // With the pending state over, verify that we're in the active state + // because action can take a long time and may depend on the size of the final snapshot, + // the timeout is parameterized ui.Say("Waiting for snapshot to complete...") if err := waitForActionState(godo.ActionCompleted, dropletId, action.ID, - client, 20*time.Minute); err != nil { + client, s.snapshotTimeout); err != nil { // If we get an error the first time, actually report it err := fmt.Errorf("Error waiting for snapshot: %s", err) state.Put("error", err) diff --git a/builder/docker/builder.go b/builder/docker/builder.go index 493e9b6de..63cb8f55d 100644 --- a/builder/docker/builder.go +++ b/builder/docker/builder.go @@ -48,7 +48,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack &StepRun{}, &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, + Host: commHost(b.config.Comm.SSHHost), SSHConfig: b.config.Comm.SSHConfigFunc(), CustomConnect: map[string]multistep.Step{ "docker": &StepConnectDocker{}, diff --git a/builder/docker/comm.go b/builder/docker/comm.go index e11a0eaf2..aa21405c5 100644 --- a/builder/docker/comm.go +++ b/builder/docker/comm.go @@ -1,11 +1,19 @@ package docker import ( + "log" + "github.com/hashicorp/packer/helper/multistep" ) -func commHost(state multistep.StateBag) (string, error) { - containerId := state.Get("container_id").(string) - driver := state.Get("driver").(Driver) - return driver.IPAddress(containerId) +func commHost(host string) func(multistep.StateBag) (string, error) { + return func(state multistep.StateBag) (string, error) { + if host != "" { + log.Printf("Using ssh_host value: %s", host) + return host, nil + } + containerId := state.Get("container_id").(string) + driver := state.Get("driver").(Driver) + return driver.IPAddress(containerId) + } } diff --git a/builder/docker/communicator.go b/builder/docker/communicator.go index aec668c35..e3e673051 100644 --- a/builder/docker/communicator.go +++ b/builder/docker/communicator.go @@ -246,18 +246,16 @@ func (c *Communicator) Download(src string, dst io.Writer) error { // enables it to work with directories. We don't actually support // directories in Download() but we still need to handle the tar format. - stderrOut, err := ioutil.ReadAll(stderrP) - if err != nil { - return err - } - - if string(stderrOut) != "" { - return fmt.Errorf("Error downloading file: %s", string(stderrOut)) - } - archive := tar.NewReader(pipe) _, err = archive.Next() if err != nil { + // see if we can get a useful error message from stderr, since stdout + // is messed up. + if stderrOut, err := ioutil.ReadAll(stderrP); err == nil { + if string(stderrOut) != "" { + return fmt.Errorf("Error downloading file: %s", string(stderrOut)) + } + } return fmt.Errorf("Failed to read header from tar stream: %s", err) } diff --git a/builder/docker/config.go b/builder/docker/config.go index b37d63d0c..8ba8873e3 100644 --- a/builder/docker/config.go +++ b/builder/docker/config.go @@ -5,7 +5,6 @@ package docker import ( "fmt" "os" - "runtime" "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" @@ -179,7 +178,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } if c.ContainerDir == "" { - if runtime.GOOS == "windows" { + if c.WindowsContainer { c.ContainerDir = "c:/packer-files" } else { c.ContainerDir = "/packer-files" diff --git a/builder/docker/step_temp_dir.go b/builder/docker/step_temp_dir.go index 827236a15..c9578076e 100644 --- a/builder/docker/step_temp_dir.go +++ b/builder/docker/step_temp_dir.go @@ -3,6 +3,7 @@ package docker import ( "context" "fmt" + "log" "os" "path/filepath" @@ -18,22 +19,32 @@ type StepTempDir struct { // ConfigTmpDir returns the configuration tmp directory for Docker func ConfigTmpDir() (string, error) { - if tmpdir := os.Getenv("PACKER_TMP_DIR"); tmpdir != "" { - return filepath.Abs(tmpdir) - } configdir, err := packer.ConfigDir() if err != nil { return "", err } + if tmpdir := os.Getenv("PACKER_TMP_DIR"); tmpdir != "" { + // override the config dir with tmp dir. Still stat it and mkdirall if + // necessary. + fp, err := filepath.Abs(tmpdir) + log.Printf("found PACKER_TMP_DIR env variable; setting tmpdir to %s", fp) + if err != nil { + return "", err + } + configdir = fp + } + td := filepath.Join(configdir, "tmp") _, err = os.Stat(td) if os.IsNotExist(err) { + log.Printf("Creating tempdir in %s", td) if err = os.MkdirAll(td, 0755); err != nil { return "", err } } else if err != nil { return "", err } + log.Printf("Set Packer temp dir to %s", td) return td, nil } diff --git a/builder/googlecompute/account.go b/builder/googlecompute/account.go index 75734e279..c8cb3fc13 100644 --- a/builder/googlecompute/account.go +++ b/builder/googlecompute/account.go @@ -1,52 +1,34 @@ package googlecompute import ( - "encoding/json" "fmt" "io/ioutil" "os" - "strings" + + "golang.org/x/oauth2/google" + "golang.org/x/oauth2/jwt" ) -// accountFile represents the structure of the account file JSON file. -type AccountFile struct { - PrivateKeyId string `json:"private_key_id"` - PrivateKey string `json:"private_key"` - ClientEmail string `json:"client_email"` - ClientId string `json:"client_id"` -} - -func parseJSON(result interface{}, text string) error { - r := strings.NewReader(text) - dec := json.NewDecoder(r) - return dec.Decode(result) -} - -func ProcessAccountFile(account_file *AccountFile, text string) error { +func ProcessAccountFile(text string) (*jwt.Config, error) { // Assume text is a JSON string - if err := parseJSON(account_file, text); err != nil { + conf, err := google.JWTConfigFromJSON([]byte(text), DriverScopes...) + if err != nil { // If text was not JSON, assume it is a file path instead if _, err := os.Stat(text); os.IsNotExist(err) { - return fmt.Errorf( + return nil, fmt.Errorf( "account_file path does not exist: %s", text) } - - b, err := ioutil.ReadFile(text) + data, err := ioutil.ReadFile(text) if err != nil { - return fmt.Errorf( + return nil, fmt.Errorf( "Error reading account_file from path '%s': %s", text, err) } - - contents := string(b) - - if err := parseJSON(account_file, contents); err != nil { - return fmt.Errorf( - "Error parsing account file '%s': %s", - contents, err) + conf, err = google.JWTConfigFromJSON(data, DriverScopes...) + if err != nil { + return nil, fmt.Errorf("Error parsing account_file: %s", err) } } - - return nil + return conf, nil } diff --git a/builder/googlecompute/builder.go b/builder/googlecompute/builder.go index 9a2b4fecc..d23481a50 100644 --- a/builder/googlecompute/builder.go +++ b/builder/googlecompute/builder.go @@ -36,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { // representing a GCE machine image. func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { driver, err := NewDriverGCE( - ui, b.config.ProjectId, &b.config.Account) + ui, b.config.ProjectId, b.config.Account) if err != nil { return nil, err } @@ -67,7 +67,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"), SSHConfig: b.config.Comm.SSHConfigFunc(), WinRMConfig: winrmConfig, }, diff --git a/builder/googlecompute/config.go b/builder/googlecompute/config.go index c9433be19..370b288ca 100644 --- a/builder/googlecompute/config.go +++ b/builder/googlecompute/config.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" + "golang.org/x/oauth2/jwt" compute "google.golang.org/api/compute/v1" ) @@ -167,7 +168,7 @@ type Config struct { // Example: "us-central1-a" Zone string `mapstructure:"zone" required:"true"` - Account AccountFile + Account *jwt.Config stateTimeout time.Duration imageAlreadyExists bool ctx interpolate.Context @@ -311,9 +312,11 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } if c.AccountFile != "" { - if err := ProcessAccountFile(&c.Account, c.AccountFile); err != nil { + cfg, err := ProcessAccountFile(c.AccountFile) + if err != nil { errs = packer.MultiErrorAppend(errs, err) } + c.Account = cfg } if c.OmitExternalIP && c.Address != "" { diff --git a/builder/googlecompute/config_test.go b/builder/googlecompute/config_test.go index f562d4b8f..f247775d6 100644 --- a/builder/googlecompute/config_test.go +++ b/builder/googlecompute/config_test.go @@ -500,6 +500,16 @@ func testMetadataFile(t *testing.T) string { return tf.Name() } -// This is just some dummy data that doesn't actually work (it was revoked -// a long time ago). -const testAccountContent = `{}` +// This is just some dummy data that doesn't actually work +const testAccountContent = `{ + "type": "service_account", + "project_id": "test-project-123456789", + "private_key_id": "bananaphone", + "private_key": "-----BEGIN PRIVATE KEY-----\nring_ring_ring_ring_ring_ring_ring_BANANAPHONE\n-----END PRIVATE KEY-----\n", + "client_email": "raffi-compute@developer.gserviceaccount.com", + "client_id": "1234567890", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://accounts.google.com/o/oauth2/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/12345-compute%40developer.gserviceaccount.com" +}` diff --git a/builder/googlecompute/driver_gce.go b/builder/googlecompute/driver_gce.go index 400ec9c02..c7e1fecb0 100644 --- a/builder/googlecompute/driver_gce.go +++ b/builder/googlecompute/driver_gce.go @@ -35,24 +35,17 @@ type driverGCE struct { var DriverScopes = []string{"https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.full_control"} -func NewClientGCE(a *AccountFile) (*http.Client, error) { +func NewClientGCE(conf *jwt.Config) (*http.Client, error) { var err error var client *http.Client // Auth with AccountFile first if provided - if a.PrivateKey != "" { - log.Printf("[INFO] Requesting Google token via AccountFile...") - log.Printf("[INFO] -- Email: %s", a.ClientEmail) + if conf != nil && len(conf.PrivateKey) > 0 { + log.Printf("[INFO] Requesting Google token via account_file...") + log.Printf("[INFO] -- Email: %s", conf.Email) log.Printf("[INFO] -- Scopes: %s", DriverScopes) - log.Printf("[INFO] -- Private Key Length: %d", len(a.PrivateKey)) - - conf := jwt.Config{ - Email: a.ClientEmail, - PrivateKey: []byte(a.PrivateKey), - Scopes: DriverScopes, - TokenURL: "https://accounts.google.com/o/oauth2/token", - } + log.Printf("[INFO] -- Private Key Length: %d", len(conf.PrivateKey)) // Initiate an http.Client. The following GET request will be // authorized and authenticated on the behalf of @@ -82,8 +75,8 @@ func NewClientGCE(a *AccountFile) (*http.Client, error) { return client, nil } -func NewDriverGCE(ui packer.Ui, p string, a *AccountFile) (Driver, error) { - client, err := NewClientGCE(a) +func NewDriverGCE(ui packer.Ui, p string, conf *jwt.Config) (Driver, error) { + client, err := NewClientGCE(conf) if err != nil { return nil, err } @@ -191,6 +184,7 @@ func (d *driverGCE) GetImage(name string, fromFamily bool) (*Image, error) { "rhel-sap-cloud", "suse-cloud", "suse-sap-cloud", + "suse-byos-cloud", "ubuntu-os-cloud", "windows-cloud", "windows-sql-cloud", diff --git a/builder/googlecompute/ssh.go b/builder/googlecompute/ssh.go deleted file mode 100644 index e498ed43b..000000000 --- a/builder/googlecompute/ssh.go +++ /dev/null @@ -1,10 +0,0 @@ -package googlecompute - -import ( - "github.com/hashicorp/packer/helper/multistep" -) - -func commHost(state multistep.StateBag) (string, error) { - ipAddress := state.Get("instance_ip").(string) - return ipAddress, nil -} diff --git a/builder/googlecompute/step_create_windows_password.go b/builder/googlecompute/step_create_windows_password.go index fda606245..2fe8595ff 100644 --- a/builder/googlecompute/step_create_windows_password.go +++ b/builder/googlecompute/step_create_windows_password.go @@ -60,7 +60,7 @@ func (s *StepCreateWindowsPassword) Run(ctx context.Context, state multistep.Sta UserName: c.Comm.WinRMUser, Modulus: base64.StdEncoding.EncodeToString(priv.N.Bytes()), Exponent: base64.StdEncoding.EncodeToString(buf[1:]), - Email: c.Account.ClientEmail, + Email: c.Account.Email, ExpireOn: time.Now().Add(time.Minute * 5), } diff --git a/builder/hcloud/config.go b/builder/hcloud/config.go index 1fd5758f7..3a7d49fb5 100644 --- a/builder/hcloud/config.go +++ b/builder/hcloud/config.go @@ -25,10 +25,11 @@ type Config struct { Endpoint string `mapstructure:"endpoint"` PollInterval time.Duration `mapstructure:"poll_interval"` - ServerName string `mapstructure:"server_name"` - Location string `mapstructure:"location"` - ServerType string `mapstructure:"server_type"` - Image string `mapstructure:"image"` + ServerName string `mapstructure:"server_name"` + Location string `mapstructure:"location"` + ServerType string `mapstructure:"server_type"` + Image string `mapstructure:"image"` + ImageFilter *imageFilter `mapstructure:"image_filter"` SnapshotName string `mapstructure:"snapshot_name"` SnapshotLabels map[string]string `mapstructure:"snapshot_labels"` @@ -41,6 +42,11 @@ type Config struct { ctx interpolate.Context } +type imageFilter struct { + WithSelector []string `mapstructure:"with_selector"` + MostRecent bool `mapstructure:"most_recent"` +} + func NewConfig(raws ...interface{}) (*Config, []string, error) { c := new(Config) @@ -108,9 +114,18 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs, errors.New("server type is required")) } - if c.Image == "" { + if c.Image == "" && c.ImageFilter == nil { errs = packer.MultiErrorAppend( - errs, errors.New("image is required")) + errs, errors.New("image or image_filter is required")) + } + if c.ImageFilter != nil { + if len(c.ImageFilter.WithSelector) == 0 { + errs = packer.MultiErrorAppend( + errs, errors.New("image_filter.with_selector is required when specifying filter")) + } else if c.Image != "" { + errs = packer.MultiErrorAppend( + errs, errors.New("only one of image or image_filter can be specified")) + } } if c.UserData != "" && c.UserDataFile != "" { diff --git a/builder/hcloud/step_create_server.go b/builder/hcloud/step_create_server.go index d3605e254..c5c38b9ad 100644 --- a/builder/hcloud/step_create_server.go +++ b/builder/hcloud/step_create_server.go @@ -3,8 +3,9 @@ package hcloud import ( "context" "fmt" - "io/ioutil" + "sort" + "strings" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" @@ -50,10 +51,24 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu sshKeys = append(sshKeys, sshKey) } + var image *hcloud.Image + if c.Image != "" { + image = &hcloud.Image{Name: c.Image} + } else { + var err error + image, err = getImageWithSelectors(ctx, client, c) + if err != nil { + ui.Error(err.Error()) + state.Put("error", err) + return multistep.ActionHalt + } + ui.Message(fmt.Sprintf("Using image %s with ID %d", image.Description, image.ID)) + } + serverCreateResult, _, err := client.Server.Create(ctx, hcloud.ServerCreateOpts{ Name: c.ServerName, ServerType: &hcloud.ServerType{Name: c.ServerType}, - Image: &hcloud.Image{Name: c.Image}, + Image: image, SSHKeys: sshKeys, Location: &hcloud.Location{Name: c.Location}, UserData: userData, @@ -185,3 +200,32 @@ func waitForAction(ctx context.Context, client *hcloud.Client, action *hcloud.Ac } return nil } + +func getImageWithSelectors(ctx context.Context, client *hcloud.Client, c *Config) (*hcloud.Image, error) { + var allImages []*hcloud.Image + + var selector = strings.Join(c.ImageFilter.WithSelector, ",") + opts := hcloud.ImageListOpts{ + ListOpts: hcloud.ListOpts{LabelSelector: selector}, + Status: []hcloud.ImageStatus{hcloud.ImageStatusAvailable}, + } + + allImages, err := client.Image.AllWithOpts(ctx, opts) + if err != nil { + return nil, err + } + if len(allImages) == 0 { + return nil, fmt.Errorf("no image found for selector %q", selector) + } + if len(allImages) > 1 { + if !c.ImageFilter.MostRecent { + return nil, fmt.Errorf("more than one image found for selector %q", selector) + } + + sort.Slice(allImages, func(i, j int) bool { + return allImages[i].Created.After(allImages[j].Created) + }) + } + + return allImages[0], nil +} diff --git a/builder/hyperv/common/step_run.go b/builder/hyperv/common/step_run.go index a897b203e..3c8a988b9 100644 --- a/builder/hyperv/common/step_run.go +++ b/builder/hyperv/common/step_run.go @@ -5,6 +5,7 @@ import ( "fmt" "log" + "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" ) @@ -12,6 +13,7 @@ import ( type StepRun struct { GuiCancelFunc context.CancelFunc Headless bool + SwitchName string vmName string } @@ -20,9 +22,29 @@ func (s *StepRun) Run(ctx context.Context, state multistep.StateBag) multistep.S ui := state.Get("ui").(packer.Ui) vmName := state.Get("vmName").(string) + ui.Say("Determine Host IP for HyperV machine...") + hostIp, err := driver.GetHostAdapterIpAddressForSwitch(s.SwitchName) + if err != nil { + err := fmt.Errorf("Error getting host adapter ip address: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + ui.Say(fmt.Sprintf("Host IP for the HyperV machine: %s", hostIp)) + common.SetHTTPIP(hostIp) + + if !s.Headless { + ui.Say("Attempting to connect with vmconnect...") + s.GuiCancelFunc, err = driver.Connect(vmName) + if err != nil { + log.Printf(fmt.Sprintf("Non-fatal error starting vmconnect: %s. continuing...", err)) + } + } + ui.Say("Starting the virtual machine...") - err := driver.Start(vmName) + err = driver.Start(vmName) if err != nil { err := fmt.Errorf("Error starting vm: %s", err) state.Put("error", err) @@ -32,13 +54,6 @@ func (s *StepRun) Run(ctx context.Context, state multistep.StateBag) multistep.S s.vmName = vmName - if !s.Headless { - ui.Say("Attempting to connect with vmconnect...") - s.GuiCancelFunc, err = driver.Connect(vmName) - if err != nil { - log.Printf(fmt.Sprintf("Non-fatal error starting vmconnect: %s. continuing...", err)) - } - } return multistep.ActionContinue } diff --git a/builder/hyperv/common/step_type_boot_command.go b/builder/hyperv/common/step_type_boot_command.go index 0d296ce8c..2d4a9942a 100644 --- a/builder/hyperv/common/step_type_boot_command.go +++ b/builder/hyperv/common/step_type_boot_command.go @@ -33,6 +33,7 @@ func (s *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) ui := state.Get("ui").(packer.Ui) driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) + hostIp := common.GetHTTPIP() // Wait the for the vm to boot. if int64(s.BootWait) > 0 { @@ -45,18 +46,6 @@ func (s *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) } } - hostIp, err := driver.GetHostAdapterIpAddressForSwitch(s.SwitchName) - - if err != nil { - err := fmt.Errorf("Error getting host adapter ip address: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - } - - ui.Say(fmt.Sprintf("Host IP for the HyperV machine: %s", hostIp)) - - common.SetHTTPIP(hostIp) s.Ctx.Data = &bootCommandTemplateData{ hostIp, httpPort, diff --git a/builder/hyperv/iso/builder.go b/builder/hyperv/iso/builder.go index 6529f0a9e..f0e566bae 100644 --- a/builder/hyperv/iso/builder.go +++ b/builder/hyperv/iso/builder.go @@ -527,7 +527,8 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, &hypervcommon.StepRun{ - Headless: b.config.Headless, + Headless: b.config.Headless, + SwitchName: b.config.SwitchName, }, &hypervcommon.StepTypeBootCommand{ diff --git a/builder/hyperv/vmcx/builder.go b/builder/hyperv/vmcx/builder.go index 324f26c68..eb05ee104 100644 --- a/builder/hyperv/vmcx/builder.go +++ b/builder/hyperv/vmcx/builder.go @@ -24,10 +24,10 @@ import ( ) const ( - DefaultRamSize = 1 * 1024 // 1GB - MinRamSize = 32 // 32MB - MaxRamSize = 32 * 1024 // 32GB - MinNestedVirtualizationRamSize = 4 * 1024 // 4GB + DefaultRamSize = 1 * 1024 // 1GB + MinRamSize = 32 // 32MB + MaxRamSize = 1024 * 1024 // 1TB + MinNestedVirtualizationRamSize = 4 * 1024 // 4GB LowRam = 256 // 256MB @@ -286,6 +286,21 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs, fmt.Errorf("CloneFromVMCXPath does not exist: %s", err)) } } + if strings.HasSuffix(strings.ToLower(b.config.CloneFromVMCXPath), ".vmcx") { + // User has provided the vmcx file itself rather than the containing + // folder. + if strings.Contains(b.config.CloneFromVMCXPath, "Virtual Machines") { + keep := strings.Split(b.config.CloneFromVMCXPath, "Virtual Machines") + b.config.CloneFromVMCXPath = keep[0] + } else { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Unable to "+ + "parse the clone_from_vmcx_path to find the vm directory. "+ + "Please provide the path to the folder containing the "+ + "vmcx file, not the file itself. Example: instead of "+ + "C:\\path\\to\\output-hyperv-iso\\Virtual Machines\\filename.vmcx"+ + ", provide C:\\path\\to\\output-hyperv-iso\\.")) + } + } } if b.config.Generation < 1 || b.config.Generation > 2 { @@ -536,7 +551,8 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, &hypervcommon.StepRun{ - Headless: b.config.Headless, + Headless: b.config.Headless, + SwitchName: b.config.SwitchName, }, &hypervcommon.StepTypeBootCommand{ diff --git a/builder/jdcloud/artifact.go b/builder/jdcloud/artifact.go new file mode 100644 index 000000000..a56d231b0 --- /dev/null +++ b/builder/jdcloud/artifact.go @@ -0,0 +1,43 @@ +package jdcloud + +import ( + "fmt" + "sort" + "strings" +) + +type Artifact struct { + ImageId string + RegionID string +} + +func (*Artifact) BuilderId() string { + return BUILDER_ID +} + +func (*Artifact) Files() []string { + return nil +} + +// Plan +// Though this part is supposed to be an array of Image Ids associated +// with its region, but currently only a single image is supported +func (a *Artifact) Id() string { + parts := []string{fmt.Sprintf("%s:%s", a.RegionID, a.ImageId)} + sort.Strings(parts) + return strings.Join(parts, ",") +} + +func (a *Artifact) String() string { + return fmt.Sprintf("A VMImage was created: %s", a.ImageId) +} + +// Plan +// State and destroy function is abandoned +func (a *Artifact) State(name string) interface{} { + return nil +} + +func (a *Artifact) Destroy() error { + return nil +} diff --git a/builder/jdcloud/builder.go b/builder/jdcloud/builder.go new file mode 100644 index 000000000..4b3700f11 --- /dev/null +++ b/builder/jdcloud/builder.go @@ -0,0 +1,91 @@ +package jdcloud + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" +) + +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + err := config.Decode(&b.config, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &b.config.ctx, + InterpolateFilter: &interpolate.RenderFilter{ + Exclude: []string{ + "boot_command", + }, + }, + }, raws...) + if err != nil { + return nil, fmt.Errorf("[ERROR] Failed in decoding JSON->mapstructure") + } + + errs := &packer.MultiError{} + errs = packer.MultiErrorAppend(errs, b.config.JDCloudCredentialConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.JDCloudInstanceSpecConfig.Prepare(&b.config.ctx)...) + if errs != nil && len(errs.Errors) != 0 { + return nil, errs + } + + packer.LogSecretFilter.Set(b.config.AccessKey, b.config.SecretKey) + + return nil, nil +} + +func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { + + state := new(multistep.BasicStateBag) + state.Put("hook", hook) + state.Put("ui", ui) + state.Put("config", b.config) + + steps := []multistep.Step{ + + &stepValidateParameters{ + InstanceSpecConfig: &b.config.JDCloudInstanceSpecConfig, + }, + + &stepConfigCredentials{ + InstanceSpecConfig: &b.config.JDCloudInstanceSpecConfig, + }, + + &stepCreateJDCloudInstance{ + InstanceSpecConfig: &b.config.JDCloudInstanceSpecConfig, + CredentialConfig: &b.config.JDCloudCredentialConfig, + }, + + &communicator.StepConnect{ + Config: &b.config.JDCloudInstanceSpecConfig.Comm, + SSHConfig: b.config.JDCloudInstanceSpecConfig.Comm.SSHConfigFunc(), + Host: instanceHost, + }, + + &common.StepProvision{}, + + &stepStopJDCloudInstance{ + InstanceSpecConfig: &b.config.JDCloudInstanceSpecConfig, + }, + + &stepCreateJDCloudImage{ + InstanceSpecConfig: &b.config.JDCloudInstanceSpecConfig, + }, + } + + b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state) + b.runner.Run(ctx, state) + + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) + } + + artifact := &Artifact{ + ImageId: b.config.ArtifactId, + RegionID: b.config.RegionId, + } + return artifact, nil +} diff --git a/builder/jdcloud/common.go b/builder/jdcloud/common.go new file mode 100644 index 000000000..d94d9c976 --- /dev/null +++ b/builder/jdcloud/common.go @@ -0,0 +1,432 @@ +package jdcloud + +import ( + "fmt" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/template/interpolate" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/client" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/client" + "log" + "strings" + "sync" + "time" +) + +const ( + FINE = 0 + CONNECT_FAILED = "Client.Timeout exceeded" + VM_PENDING = "pending" + VM_RUNNING = "running" + VM_STARTING = "starting" + VM_STOPPING = "stopping" + VM_STOPPED = "stopped" + READY = "ready" + BUILDER_ID = "hashicorp.jdcloud" +) + +var ( + VmClient *vm.VmClient + VpcClient *vpc.VpcClient + Region string +) + +type Config struct { + JDCloudCredentialConfig `mapstructure:",squash"` + JDCloudInstanceSpecConfig `mapstructure:",squash"` + common.PackerConfig `mapstructure:",squash"` + ctx interpolate.Context +} + +type Builder struct { + config Config + runner multistep.Runner +} + +func Retry(timeout time.Duration, f RetryFunc) error { + // These are used to pull the error out of the function; need a mutex to + // avoid a data race. + var resultErr error + var resultErrMu sync.Mutex + + c := &StateChangeConf{ + Pending: []string{"retryableerror"}, + Target: []string{"success"}, + Timeout: timeout, + MinTimeout: 500 * time.Millisecond, + Refresh: func() (interface{}, string, error) { + rerr := f() + + resultErrMu.Lock() + defer resultErrMu.Unlock() + + if rerr == nil { + resultErr = nil + return 42, "success", nil + } + + resultErr = rerr.Err + + if rerr.Retryable { + return 42, "retryableerror", nil + } + return nil, "quit", rerr.Err + }, + } + + _, waitErr := c.WaitForState() + + // Need to acquire the lock here to be able to avoid race using resultErr as + // the return value + resultErrMu.Lock() + defer resultErrMu.Unlock() + + // resultErr may be nil because the wait timed out and resultErr was never + // set; this is still an error + if resultErr == nil { + return waitErr + } + // resultErr takes precedence over waitErr if both are set because it is + // more likely to be useful + return resultErr +} + +// RetryFunc is the function retried until it succeeds. +type RetryFunc func() *RetryError + +// RetryError is the required return type of RetryFunc. It forces client code +// to choose whether or not a given error is retryable. +type RetryError struct { + Err error + Retryable bool +} + +// RetryableError is a helper to create a RetryError that's retryable from a +// given error. +func RetryableError(err error) *RetryError { + if err == nil { + return nil + } + return &RetryError{Err: err, Retryable: true} +} + +// NonRetryableError is a helper to create a RetryError that's _not_ retryable +// from a given error. +func NonRetryableError(err error) *RetryError { + if err == nil { + return nil + } + return &RetryError{Err: err, Retryable: false} +} + +// WaitForState watches an object and waits for it to achieve the state +// specified in the configuration using the specified Refresh() func, +// waiting the number of seconds specified in the timeout configuration. +// +// If the Refresh function returns an error, exit immediately with that error. +// +// If the Refresh function returns a state other than the Target state or one +// listed in Pending, return immediately with an error. +// +// If the Timeout is exceeded before reaching the Target state, return an +// error. +// +// Otherwise, the result is the result of the first call to the Refresh function to +// reach the target state. +func (conf *StateChangeConf) WaitForState() (interface{}, error) { + log.Printf("[DEBUG] Waiting for state to become: %s", conf.Target) + + notfoundTick := 0 + targetOccurence := 0 + + // Set a default for times to check for not found + if conf.NotFoundChecks == 0 { + conf.NotFoundChecks = 20 + } + + if conf.ContinuousTargetOccurence == 0 { + conf.ContinuousTargetOccurence = 1 + } + + type Result struct { + Result interface{} + State string + Error error + Done bool + } + + // Read every result from the refresh loop, waiting for a positive result.Done. + resCh := make(chan Result, 1) + // cancellation channel for the refresh loop + cancelCh := make(chan struct{}) + + result := Result{} + + go func() { + defer close(resCh) + + time.Sleep(conf.Delay) + + // start with 0 delay for the first loop + var wait time.Duration + + for { + // store the last result + resCh <- result + + // wait and watch for cancellation + select { + case <-cancelCh: + return + case <-time.After(wait): + // first round had no wait + if wait == 0 { + wait = 100 * time.Millisecond + } + } + + res, currentState, err := conf.Refresh() + result = Result{ + Result: res, + State: currentState, + Error: err, + } + + if err != nil { + resCh <- result + return + } + + // If we're waiting for the absence of a thing, then return + if res == nil && len(conf.Target) == 0 { + targetOccurence++ + if conf.ContinuousTargetOccurence == targetOccurence { + result.Done = true + resCh <- result + return + } + continue + } + + if res == nil { + // If we didn't find the resource, check if we have been + // not finding it for awhile, and if so, report an error. + notfoundTick++ + if notfoundTick > conf.NotFoundChecks { + result.Error = &NotFoundError{ + LastError: err, + Retries: notfoundTick, + } + resCh <- result + return + } + } else { + // Reset the counter for when a resource isn't found + notfoundTick = 0 + found := false + + for _, allowed := range conf.Target { + if currentState == allowed { + found = true + targetOccurence++ + if conf.ContinuousTargetOccurence == targetOccurence { + result.Done = true + resCh <- result + return + } + continue + } + } + + for _, allowed := range conf.Pending { + if currentState == allowed { + found = true + targetOccurence = 0 + break + } + } + + if !found && len(conf.Pending) > 0 { + result.Error = &UnexpectedStateError{ + LastError: err, + State: result.State, + ExpectedState: conf.Target, + } + resCh <- result + return + } + } + + // Wait between refreshes using exponential backoff, except when + // waiting for the target state to reoccur. + if targetOccurence == 0 { + wait *= 2 + } + + // If a poll interval has been specified, choose that interval. + // Otherwise bound the default value. + if conf.PollInterval > 0 && conf.PollInterval < 180*time.Second { + wait = conf.PollInterval + } else { + if wait < conf.MinTimeout { + wait = conf.MinTimeout + } else if wait > 10*time.Second { + wait = 10 * time.Second + } + } + + log.Printf("[TRACE] Waiting %s before next try", wait) + } + }() + + // store the last value result from the refresh loop + lastResult := Result{} + + timeout := time.After(conf.Timeout) + for { + select { + case r, ok := <-resCh: + // channel closed, so return the last result + if !ok { + return lastResult.Result, lastResult.Error + } + + // we reached the intended state + if r.Done { + return r.Result, r.Error + } + + // still waiting, store the last result + lastResult = r + + case <-timeout: + log.Printf("[WARN] WaitForState timeout after %s", conf.Timeout) + log.Printf("[WARN] WaitForState starting %s refresh grace period", 30*time.Second) + + // cancel the goroutine and start our grace period timer + close(cancelCh) + timeout := time.After(30 * time.Second) + + // we need a for loop and a label to break on, because we may have + // an extra response value to read, but still want to wait for the + // channel to close. + forSelect: + for { + select { + case r, ok := <-resCh: + if r.Done { + // the last refresh loop reached the desired state + return r.Result, r.Error + } + + if !ok { + // the goroutine returned + break forSelect + } + + // target state not reached, save the result for the + // TimeoutError and wait for the channel to close + lastResult = r + case <-timeout: + log.Println("[ERROR] WaitForState exceeded refresh grace period") + break forSelect + } + } + + return nil, &TimeoutError{ + LastError: lastResult.Error, + LastState: lastResult.State, + Timeout: conf.Timeout, + ExpectedState: conf.Target, + } + } + } +} + +type StateChangeConf struct { + Delay time.Duration // Wait this time before starting checks + Pending []string // States that are "allowed" and will continue trying + Refresh StateRefreshFunc // Refreshes the current state + Target []string // Target state + Timeout time.Duration // The amount of time to wait before timeout + MinTimeout time.Duration // Smallest time to wait before refreshes + PollInterval time.Duration // Override MinTimeout/backoff and only poll this often + NotFoundChecks int // Number of times to allow not found + + // This is to work around inconsistent APIs + ContinuousTargetOccurence int // Number of times the Target state has to occur continuously +} + +type NotFoundError struct { + LastError error + LastRequest interface{} + LastResponse interface{} + Message string + Retries int +} + +func (e *NotFoundError) Error() string { + if e.Message != "" { + return e.Message + } + + if e.Retries > 0 { + return fmt.Sprintf("couldn't find resource (%d retries)", e.Retries) + } + + return "couldn't find resource" +} + +// UnexpectedStateError is returned when Refresh returns a state that's neither in Target nor Pending +type UnexpectedStateError struct { + LastError error + State string + ExpectedState []string +} + +func (e *UnexpectedStateError) Error() string { + return fmt.Sprintf( + "unexpected state '%s', wanted target '%s'. last error: %s", + e.State, + strings.Join(e.ExpectedState, ", "), + e.LastError, + ) +} + +// TimeoutError is returned when WaitForState times out +type TimeoutError struct { + LastError error + LastState string + Timeout time.Duration + ExpectedState []string +} + +func (e *TimeoutError) Error() string { + expectedState := "resource to be gone" + if len(e.ExpectedState) > 0 { + expectedState = fmt.Sprintf("state to become '%s'", strings.Join(e.ExpectedState, ", ")) + } + + extraInfo := make([]string, 0) + if e.LastState != "" { + extraInfo = append(extraInfo, fmt.Sprintf("last state: '%s'", e.LastState)) + } + if e.Timeout > 0 { + extraInfo = append(extraInfo, fmt.Sprintf("timeout: %s", e.Timeout.String())) + } + + suffix := "" + if len(extraInfo) > 0 { + suffix = fmt.Sprintf(" (%s)", strings.Join(extraInfo, ", ")) + } + + if e.LastError != nil { + return fmt.Sprintf("timeout while waiting for %s%s: %s", + expectedState, suffix, e.LastError) + } + + return fmt.Sprintf("timeout while waiting for %s%s", + expectedState, suffix) +} + +type StateRefreshFunc func() (result interface{}, state string, err error) diff --git a/builder/jdcloud/credential_config.go b/builder/jdcloud/credential_config.go new file mode 100644 index 000000000..75d07309d --- /dev/null +++ b/builder/jdcloud/credential_config.go @@ -0,0 +1,86 @@ +package jdcloud + +import ( + "fmt" + "github.com/hashicorp/packer/template/interpolate" + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/client" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/client" + "os" +) + +type JDCloudCredentialConfig struct { + AccessKey string `mapstructure:"access_key"` + SecretKey string `mapstructure:"secret_key"` + RegionId string `mapstructure:"region_id"` + Az string `mapstructure:"az"` +} + +func (jd *JDCloudCredentialConfig) Prepare(ctx *interpolate.Context) []error { + + errorArray := []error{} + + if jd == nil { + return append(errorArray, fmt.Errorf("[PRE-FLIGHT] Empty JDCloudCredentialConfig detected")) + } + + if err := jd.ValidateKeyPair(); err != nil { + errorArray = append(errorArray, err) + } + + if err := jd.validateRegion(); err != nil { + errorArray = append(errorArray, err) + } + + if err := jd.validateAz(); err != nil { + errorArray = append(errorArray, err) + } + + if len(errorArray) != 0 { + return errorArray + } + + credential := core.NewCredentials(jd.AccessKey, jd.SecretKey) + VmClient = vm.NewVmClient(credential) + VpcClient = vpc.NewVpcClient(credential) + Region = jd.RegionId + + return nil +} + +func (jd *JDCloudCredentialConfig) ValidateKeyPair() error { + + if jd.AccessKey == "" { + jd.AccessKey = os.Getenv("JDCLOUD_ACCESS_KEY") + } + + if jd.SecretKey == "" { + jd.SecretKey = os.Getenv("JDCLOUD_SECRET_KEY") + } + + if jd.AccessKey == "" || jd.SecretKey == "" { + return fmt.Errorf("[PRE-FLIGHT] We can't find your key pairs," + + "write them here {access_key=xxx , secret_key=xxx} " + + "or export them as env-variable, {export JDCLOUD_ACCESS_KEY=xxx, export JDCLOUD_SECRET_KEY=xxx} ") + } + + return nil +} + +func (config *JDCloudCredentialConfig) validateRegion() error { + regionArray := []string{"cn-north-1", "cn-south-1", "cn-east-1", "cn-east-2"} + for _, item := range regionArray { + if item == config.RegionId { + return nil + } + } + return fmt.Errorf("[PRE-FLIGHT] Invalid RegionId:%s. "+ + "Legit RegionId are: {cn-north-1, cn-south-1, cn-east-1, cn-east-2}", config.RegionId) +} + +func (config *JDCloudCredentialConfig) validateAz() error { + if len(config.Az) == 0 { + return fmt.Errorf("[PRE-FLIGHT] az info missing") + } + return nil +} diff --git a/builder/jdcloud/credential_config_test.go b/builder/jdcloud/credential_config_test.go new file mode 100644 index 000000000..ca245a1b4 --- /dev/null +++ b/builder/jdcloud/credential_config_test.go @@ -0,0 +1,34 @@ +package jdcloud + +import ( + "testing" +) + +func TestJDCloudCredentialConfig_Prepare(t *testing.T) { + + creds := &JDCloudCredentialConfig{} + + if err := creds.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when there's nothing set") + } + + creds.AccessKey = "abc" + if err := creds.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when theres no Secret key") + } + + creds.SecretKey = "123" + if err := creds.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when theres no Az and region") + } + + creds.RegionId = "cn-west-1" + creds.Az = "cn-north-1c" + if err := creds.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when region_id illegal") + } + creds.RegionId = "cn-north-1" + if err := creds.Prepare(nil); err != nil { + t.Fatalf("Test shouldn't fail...") + } +} diff --git a/builder/jdcloud/instance_config.go b/builder/jdcloud/instance_config.go new file mode 100644 index 000000000..93f6a6115 --- /dev/null +++ b/builder/jdcloud/instance_config.go @@ -0,0 +1,53 @@ +package jdcloud + +import ( + "fmt" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/template/interpolate" +) + +type JDCloudInstanceSpecConfig struct { + ImageId string `mapstructure:"image_id"` + InstanceName string `mapstructure:"instance_name"` + InstanceType string `mapstructure:"instance_type"` + ImageName string `mapstructure:"image_name"` + SubnetId string `mapstructure:"subnet_id"` + Comm communicator.Config `mapstructure:",squash"` + InstanceId string + ArtifactId string + PublicIpAddress string + PublicIpId string +} + +func (jd *JDCloudInstanceSpecConfig) Prepare(ctx *interpolate.Context) []error { + + errs := jd.Comm.Prepare(ctx) + + if jd == nil { + return append(errs, fmt.Errorf("[PRE-FLIGHT] Configuration appears to be empty")) + } + + if len(jd.ImageId) == 0 { + errs = append(errs, fmt.Errorf("[PRE-FLIGHT] 'image_id' empty")) + } + + if len(jd.InstanceName) == 0 { + errs = append(errs, fmt.Errorf("[PRE-FLIGHT] 'instance_name' empty")) + } + + if len(jd.InstanceType) == 0 { + errs = append(errs, fmt.Errorf("[PRE-FLIGHT] 'instance-type' empty")) + } + + noPassword := len(jd.Comm.SSHPassword) == 0 + noKeys := len(jd.Comm.SSHKeyPairName) == 0 && len(jd.Comm.SSHPrivateKeyFile) == 0 + noTempKey := len(jd.Comm.SSHTemporaryKeyPairName) == 0 + if noPassword && noKeys && noTempKey { + errs = append(errs, fmt.Errorf("[PRE-FLIGHT] Didn't detect any credentials, you have to specify either "+ + "{password} or "+ + "{key_name+local_private_key_path} or "+ + "{temporary_key_pair_name} cheers :)")) + } + + return errs +} diff --git a/builder/jdcloud/instance_config_test.go b/builder/jdcloud/instance_config_test.go new file mode 100644 index 000000000..36ede82ca --- /dev/null +++ b/builder/jdcloud/instance_config_test.go @@ -0,0 +1,54 @@ +package jdcloud + +import ( + "testing" +) + +func TestJDCloudInstanceSpecConfig_Prepare(t *testing.T) { + + specs := &JDCloudInstanceSpecConfig{} + if err := specs.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when there's nothing set") + } + + specs.InstanceName = "packer_test_instance_name" + specs.InstanceType = "packer_test_instance_type" + if err := specs.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when base-image not given") + } + + specs.ImageId = "img-packer-test" + if err := specs.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when credentials not set") + } + + specs.Comm.SSHPassword = "abc123" + if err := specs.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when username = nil") + } + + specs.Comm.SSHUsername = "root" + if err := specs.Prepare(nil); err != nil { + t.Fatalf("Test shouldn't fail when password set ") + } + + specs.Comm.SSHPassword = "" + specs.Comm.SSHTemporaryKeyPairName = "abc" + if err := specs.Prepare(nil); err != nil { + t.Fatalf("Test shouldn't fail when temp password set") + } + + specs.Comm.SSHTemporaryKeyPairName = "" + specs.Comm.SSHPrivateKeyFile = "abc" + specs.Comm.SSHKeyPairName = "" + if err := specs.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when SSHKeypairName missing") + } + + specs.Comm.SSHPrivateKeyFile = "abc" + specs.Comm.SSHKeyPairName = "123" + if err := specs.Prepare(nil); err == nil { + t.Fatalf("Test shouldn't pass when private key pair path is wrong ") + } + +} diff --git a/builder/jdcloud/step_config_credentials.go b/builder/jdcloud/step_config_credentials.go new file mode 100644 index 000000000..1c6fdfc76 --- /dev/null +++ b/builder/jdcloud/step_config_credentials.go @@ -0,0 +1,73 @@ +package jdcloud + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" + "io/ioutil" +) + +type stepConfigCredentials struct { + InstanceSpecConfig *JDCloudInstanceSpecConfig + ui packer.Ui +} + +func (s *stepConfigCredentials) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + + s.ui = state.Get("ui").(packer.Ui) + password := s.InstanceSpecConfig.Comm.SSHPassword + privateKeyPath := s.InstanceSpecConfig.Comm.SSHPrivateKeyFile + privateKeyName := s.InstanceSpecConfig.Comm.SSHKeyPairName + newKeyName := s.InstanceSpecConfig.Comm.SSHTemporaryKeyPairName + + if len(privateKeyPath) > 0 && len(privateKeyName) > 0 { + s.ui.Message("\t Private key detected, we are going to login with this private key :)") + return s.ReadExistingPair() + } + + if len(newKeyName) > 0 { + s.ui.Message("\t We are going to create a new key pair with its name=" + newKeyName) + return s.CreateRandomKeyPair(newKeyName) + } + + if len(password) > 0 { + s.ui.Message("\t Password detected, we are going to login with this password :)") + return multistep.ActionContinue + } + + s.ui.Error("[ERROR] Didn't detect any credentials, you have to specify either " + + "{password} or " + + "{key_name+local_private_key_path} or " + + "{temporary_key_pair_name} cheers :)") + return multistep.ActionHalt +} + +func (s *stepConfigCredentials) ReadExistingPair() multistep.StepAction { + privateKeyBytes, err := ioutil.ReadFile(s.InstanceSpecConfig.Comm.SSHPrivateKeyFile) + if err != nil { + s.ui.Error("Cannot read local private-key, were they correctly placed? Here's the error" + err.Error()) + return multistep.ActionHalt + } + s.ui.Message("\t\t Keys read successfully :)") + s.InstanceSpecConfig.Comm.SSHPrivateKey = privateKeyBytes + return multistep.ActionContinue +} + +func (s *stepConfigCredentials) CreateRandomKeyPair(keyName string) multistep.StepAction { + req := apis.NewCreateKeypairRequest(Region, keyName) + resp, err := VmClient.CreateKeypair(req) + if err != nil || resp.Error.Code != FINE { + s.ui.Error(fmt.Sprintf("[ERROR] Cannot create a new key pair for you, \n error=%v \n response=%v", err, resp)) + return multistep.ActionHalt + } + s.ui.Message("\t\t Keys created successfully :)") + s.InstanceSpecConfig.Comm.SSHPrivateKey = []byte(resp.Result.PrivateKey) + s.InstanceSpecConfig.Comm.SSHKeyPairName = keyName + return multistep.ActionContinue +} + +func (s *stepConfigCredentials) Cleanup(state multistep.StateBag) { + +} diff --git a/builder/jdcloud/step_create_image.go b/builder/jdcloud/step_create_image.go new file mode 100644 index 000000000..03e2d3b60 --- /dev/null +++ b/builder/jdcloud/step_create_image.go @@ -0,0 +1,74 @@ +package jdcloud + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" + "time" +) + +type stepCreateJDCloudImage struct { + InstanceSpecConfig *JDCloudInstanceSpecConfig +} + +func (s *stepCreateJDCloudImage) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + + ui := state.Get("ui").(packer.Ui) + ui.Say("Creating images") + + req := apis.NewCreateImageRequest(Region, s.InstanceSpecConfig.InstanceId, s.InstanceSpecConfig.ImageName, "") + resp, err := VmClient.CreateImage(req) + if err != nil || resp.Error.Code != FINE { + ui.Error(fmt.Sprintf("[ERROR] Creating image: Error-%v ,Resp:%v", err, resp)) + return multistep.ActionHalt + } + + s.InstanceSpecConfig.ArtifactId = resp.Result.ImageId + if err := ImageStatusWaiter(s.InstanceSpecConfig.ArtifactId); err != nil { + ui.Error(err.Error()) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func ImageStatusWaiter(imageId string) error { + req := apis.NewDescribeImageRequest(Region, imageId) + + return Retry(5*time.Minute, func() *RetryError { + resp, err := VmClient.DescribeImage(req) + if err == nil && resp.Result.Image.Status == READY { + return nil + } + if connectionError(err) { + return RetryableError(err) + } else { + return NonRetryableError(err) + } + }) + +} + +// Delete created instance image on error +func (s *stepCreateJDCloudImage) Cleanup(state multistep.StateBag) { + + if s.InstanceSpecConfig.ArtifactId != "" { + + req := apis.NewDeleteImageRequest(Region, s.InstanceSpecConfig.ArtifactId) + + _ = Retry(time.Minute, func() *RetryError { + _, err := VmClient.DeleteImage(req) + if err == nil { + return nil + } + if connectionError(err) { + return RetryableError(err) + } else { + return NonRetryableError(err) + } + }) + } + +} diff --git a/builder/jdcloud/step_create_instance.go b/builder/jdcloud/step_create_instance.go new file mode 100644 index 000000000..fe66f464d --- /dev/null +++ b/builder/jdcloud/step_create_instance.go @@ -0,0 +1,223 @@ +package jdcloud + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/jdcloud-api/jdcloud-sdk-go/core" + "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" + vpcApis "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis" + vpcClient "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/client" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + "regexp" + "time" +) + +type stepCreateJDCloudInstance struct { + InstanceSpecConfig *JDCloudInstanceSpecConfig + CredentialConfig *JDCloudCredentialConfig + ui packer.Ui +} + +func (s *stepCreateJDCloudInstance) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + + privateKey := s.InstanceSpecConfig.Comm.SSHPrivateKey + keyName := s.InstanceSpecConfig.Comm.SSHKeyPairName + password := s.InstanceSpecConfig.Comm.SSHPassword + s.ui = state.Get("ui").(packer.Ui) + s.ui.Say("Creating instances") + + instanceSpec := vm.InstanceSpec{ + Az: &s.CredentialConfig.Az, + InstanceType: &s.InstanceSpecConfig.InstanceType, + ImageId: &s.InstanceSpecConfig.ImageId, + Name: s.InstanceSpecConfig.InstanceName, + PrimaryNetworkInterface: &vm.InstanceNetworkInterfaceAttachmentSpec{ + NetworkInterface: &vpc.NetworkInterfaceSpec{ + SubnetId: s.InstanceSpecConfig.SubnetId, + Az: &s.CredentialConfig.Az, + }, + }, + } + + if len(password) > 0 { + instanceSpec.Password = &password + } + if len(keyName) > 0 && len(privateKey) > 0 { + instanceSpec.KeyNames = []string{keyName} + } + + req := apis.NewCreateInstancesRequest(Region, &instanceSpec) + resp, err := VmClient.CreateInstances(req) + + if err != nil || resp.Error.Code != FINE { + err := fmt.Errorf("Error creating instance, error-%v response:%v", err, resp) + s.ui.Error(err.Error()) + return multistep.ActionHalt + } + + s.InstanceSpecConfig.InstanceId = resp.Result.InstanceIds[0] + instanceInterface, err := InstanceStatusRefresher(s.InstanceSpecConfig.InstanceId, []string{VM_PENDING, VM_STARTING}, []string{VM_RUNNING}) + if err != nil { + s.ui.Error(err.Error()) + return multistep.ActionHalt + } + + instance := instanceInterface.(vm.Instance) + privateIpAddress := instance.PrivateIpAddress + networkInterfaceId := instance.PrimaryNetworkInterface.NetworkInterface.NetworkInterfaceId + + s.ui.Message("Creating public-ip") + s.InstanceSpecConfig.PublicIpId, err = createElasticIp(state) + if err != nil { + s.ui.Error(err.Error()) + return multistep.ActionHalt + } + + s.ui.Message("Associating public-ip with instance") + err = associatePublicIp(networkInterfaceId, s.InstanceSpecConfig.PublicIpId, privateIpAddress) + if err != nil { + s.ui.Error(err.Error()) + return multistep.ActionHalt + } + + req_ := vpcApis.NewDescribeElasticIpRequest(Region, s.InstanceSpecConfig.PublicIpId) + eip, err := VpcClient.DescribeElasticIp(req_) + if err != nil || eip.Error.Code != FINE { + s.ui.Error(fmt.Sprintf("[ERROR] Failed in getting eip,error:%v \n response:%v", err, eip)) + return multistep.ActionHalt + } + + s.InstanceSpecConfig.PublicIpAddress = eip.Result.ElasticIp.ElasticIpAddress + state.Put("eip", s.InstanceSpecConfig.PublicIpAddress) + s.ui.Message(fmt.Sprintf( + "Hi, we have created the instance, its name=%v , "+ + "its id=%v, "+ + "and its eip=%v :) ", instance.InstanceName, s.InstanceSpecConfig.InstanceId, eip.Result.ElasticIp.ElasticIpAddress)) + return multistep.ActionContinue +} + +// Delete created resources {instance,ip} on error +func (s *stepCreateJDCloudInstance) Cleanup(state multistep.StateBag) { + + if s.InstanceSpecConfig.PublicIpId != "" { + + req := vpcApis.NewDeleteElasticIpRequest(Region, s.InstanceSpecConfig.PublicIpId) + + _ = Retry(time.Minute, func() *RetryError { + _, err := VpcClient.DeleteElasticIp(req) + if err == nil { + return nil + } + if connectionError(err) { + return RetryableError(err) + } else { + return NonRetryableError(err) + } + }) + } + + if s.InstanceSpecConfig.InstanceId != "" { + + req := apis.NewDeleteInstanceRequest(Region, s.InstanceSpecConfig.InstanceId) + _ = Retry(time.Minute, func() *RetryError { + _, err := VmClient.DeleteInstance(req) + if err == nil { + return nil + } + if connectionError(err) { + return RetryableError(err) + } else { + return NonRetryableError(err) + } + }) + } +} + +func createElasticIp(state multistep.StateBag) (string, error) { + + generalConfig := state.Get("config").(Config) + regionId := generalConfig.RegionId + credential := core.NewCredentials(generalConfig.AccessKey, generalConfig.SecretKey) + vpcclient := vpcClient.NewVpcClient(credential) + + req := vpcApis.NewCreateElasticIpsRequest(regionId, 1, &vpc.ElasticIpSpec{ + BandwidthMbps: 1, + Provider: "bgp", + }) + + resp, err := vpcclient.CreateElasticIps(req) + + if err != nil || resp.Error.Code != 0 { + return "", fmt.Errorf("[ERROR] Failed in creating new publicIp, Error-%v, Response:%v", err, resp) + } + return resp.Result.ElasticIpIds[0], nil +} + +func associatePublicIp(networkInterfaceId string, eipId string, privateIpAddress string) error { + req := vpcApis.NewAssociateElasticIpRequest(Region, networkInterfaceId) + req.ElasticIpId = &eipId + req.PrivateIpAddress = &privateIpAddress + resp, err := VpcClient.AssociateElasticIp(req) + if err != nil || resp.Error.Code != FINE { + return fmt.Errorf("[ERROR] Failed in associating publicIp, Error-%v, Response:%v", err, resp) + } + return nil +} +func instanceHost(state multistep.StateBag) (string, error) { + return state.Get("eip").(string), nil +} + +func InstanceStatusRefresher(id string, pending, target []string) (instance interface{}, err error) { + + stateConf := &StateChangeConf{ + Pending: pending, + Target: target, + Refresh: instanceStatusRefresher(id), + Delay: 3 * time.Second, + Timeout: 10 * time.Minute, + MinTimeout: 1 * time.Second, + } + if instance, err = stateConf.WaitForState(); err != nil { + return nil, fmt.Errorf("[ERROR] Failed in creating instance ,err message:%v", err) + } + return instance, nil +} + +func instanceStatusRefresher(instanceId string) StateRefreshFunc { + + return func() (instance interface{}, status string, err error) { + + err = Retry(time.Minute, func() *RetryError { + + req := apis.NewDescribeInstanceRequest(Region, instanceId) + resp, err := VmClient.DescribeInstance(req) + + if err == nil && resp.Error.Code == FINE { + instance = resp.Result.Instance + status = resp.Result.Instance.Status + return nil + } + + instance = nil + status = "" + if connectionError(err) { + return RetryableError(err) + } else { + return NonRetryableError(err) + } + }) + return instance, status, err + } +} + +func connectionError(e error) bool { + + if e == nil { + return false + } + ok, _ := regexp.MatchString(CONNECT_FAILED, e.Error()) + return ok +} diff --git a/builder/jdcloud/step_stop_instance.go b/builder/jdcloud/step_stop_instance.go new file mode 100644 index 000000000..1cf249c2c --- /dev/null +++ b/builder/jdcloud/step_stop_instance.go @@ -0,0 +1,39 @@ +package jdcloud + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" +) + +type stepStopJDCloudInstance struct { + InstanceSpecConfig *JDCloudInstanceSpecConfig +} + +func (s *stepStopJDCloudInstance) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + + ui := state.Get("ui").(packer.Ui) + ui.Say("Stopping this instance") + + req := apis.NewStopInstanceRequest(Region, s.InstanceSpecConfig.InstanceId) + resp, err := VmClient.StopInstance(req) + if err != nil || resp.Error.Code != FINE { + ui.Error(fmt.Sprintf("[ERROR] Failed in trying to stop this vm: Error-%v ,Resp:%v", err, resp)) + return multistep.ActionHalt + } + + _, err = InstanceStatusRefresher(s.InstanceSpecConfig.InstanceId, []string{VM_RUNNING, VM_STOPPING}, []string{VM_STOPPED}) + if err != nil { + ui.Error(err.Error()) + return multistep.ActionHalt + } + + ui.Message("Instance has been stopped :)") + return multistep.ActionContinue +} + +func (s *stepStopJDCloudInstance) Cleanup(multistep.StateBag) { + return +} diff --git a/builder/jdcloud/step_validate_parameters.go b/builder/jdcloud/step_validate_parameters.go new file mode 100644 index 000000000..62c04078b --- /dev/null +++ b/builder/jdcloud/step_validate_parameters.go @@ -0,0 +1,109 @@ +package jdcloud + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis" +) + +type stepValidateParameters struct { + InstanceSpecConfig *JDCloudInstanceSpecConfig + ui packer.Ui + state multistep.StateBag +} + +func (s *stepValidateParameters) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + + s.ui = state.Get("ui").(packer.Ui) + s.state = state + s.ui.Say("Validating parameters...") + + if err := s.ValidateSubnetFunc(); err != nil { + s.ui.Error(err.Error()) + return multistep.ActionHalt + } + + if err := s.ValidateImageFunc(); err != nil { + s.ui.Error(err.Error()) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *stepValidateParameters) ValidateSubnetFunc() error { + + subnetId := s.InstanceSpecConfig.SubnetId + if len(subnetId) == 0 { + s.ui.Message("\t 'subnet' is not specified, we will create a new one for you :) ") + return s.CreateRandomSubnet() + } + + s.ui.Message("\t validating your subnet:" + s.InstanceSpecConfig.SubnetId) + req := vpc.NewDescribeSubnetRequest(Region, subnetId) + resp, err := VpcClient.DescribeSubnet(req) + if err != nil { + return fmt.Errorf("[ERROR] Failed in validating subnet->%s, reasons:%v", subnetId, err) + } + if resp != nil && resp.Error.Code != FINE { + return fmt.Errorf("[ERROR] Something wrong with your subnet->%s, reasons:%v", subnetId, resp.Error) + } + + s.ui.Message("\t subnet found:" + resp.Result.Subnet.SubnetName) + return nil + +} + +func (s *stepValidateParameters) ValidateImageFunc() error { + + s.ui.Message("\t validating your base image:" + s.InstanceSpecConfig.ImageId) + imageId := s.InstanceSpecConfig.ImageId + req := vm.NewDescribeImageRequest(Region, imageId) + resp, err := VmClient.DescribeImage(req) + if err != nil { + return fmt.Errorf("[ERROR] Failed in validating your image->%s, reasons:%v", imageId, err) + } + if resp != nil && resp.Error.Code != FINE { + return fmt.Errorf("[ERROR] Something wrong with your image->%s, reasons:%v", imageId, resp.Error) + } + + s.ui.Message("\t image found:" + resp.Result.Image.Name) + s.state.Put("source_image", &resp.Result.Image) + return nil +} + +func (s *stepValidateParameters) CreateRandomSubnet() error { + + newVpc, err := s.CreateRandomVpc() + if err != nil { + return err + } + + req := vpc.NewCreateSubnetRequest(Region, newVpc, "created_by_packer", "192.168.0.0/20") + resp, err := VpcClient.CreateSubnet(req) + if err != nil || resp.Error.Code != FINE { + errorMessage := fmt.Sprintf("[ERROR] Failed in creating new subnet :( \n error:%v \n response:%v", err, resp) + s.ui.Error(errorMessage) + return fmt.Errorf(errorMessage) + } + + s.InstanceSpecConfig.SubnetId = resp.Result.SubnetId + s.ui.Message("\t\t Hi, we have created a new subnet for you :) its name is 'created_by_packer' and its id=" + resp.Result.SubnetId) + return nil +} + +func (s *stepValidateParameters) CreateRandomVpc() (string, error) { + req := vpc.NewCreateVpcRequest(Region, "created_by_packer") + resp, err := VpcClient.CreateVpc(req) + if err != nil || resp.Error.Code != FINE { + errorMessage := fmt.Sprintf("[ERROR] Failed in creating new vpc :( \n error :%v, \n response:%v", err, resp) + s.ui.Error(errorMessage) + return "", fmt.Errorf(errorMessage) + } + return resp.Result.VpcId, nil +} + +func (s *stepValidateParameters) Cleanup(state multistep.StateBag) {} diff --git a/builder/linode/builder.go b/builder/linode/builder.go index 2837b1e7b..def4b1f2e 100644 --- a/builder/linode/builder.go +++ b/builder/linode/builder.go @@ -56,7 +56,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (ret &stepCreateLinode{client}, &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, + Host: commHost(b.config.Comm.SSHHost), SSHConfig: b.config.Comm.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/linode/ssh.go b/builder/linode/ssh.go index 6380ecb0e..8f291c450 100644 --- a/builder/linode/ssh.go +++ b/builder/linode/ssh.go @@ -2,18 +2,26 @@ package linode import ( "fmt" + "log" "github.com/hashicorp/packer/helper/multistep" "github.com/linode/linodego" "golang.org/x/crypto/ssh" ) -func commHost(state multistep.StateBag) (string, error) { - instance := state.Get("instance").(*linodego.Instance) - if len(instance.IPv4) == 0 { - return "", fmt.Errorf("Linode instance %d has no IPv4 addresses!", instance.ID) +func commHost(host string) func(multistep.StateBag) (string, error) { + return func(state multistep.StateBag) (string, error) { + if host != "" { + log.Printf("Using ssh_host value: %s", host) + return host, nil + } + + instance := state.Get("instance").(*linodego.Instance) + if len(instance.IPv4) == 0 { + return "", fmt.Errorf("Linode instance %d has no IPv4 addresses!", instance.ID) + } + return instance.IPv4[0].String(), nil } - return instance.IPv4[0].String(), nil } func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { diff --git a/builder/oneandone/builder.go b/builder/oneandone/builder.go index a67329c6d..5ea7674bc 100644 --- a/builder/oneandone/builder.go +++ b/builder/oneandone/builder.go @@ -44,7 +44,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack new(stepCreateServer), &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "server_ip"), SSHConfig: b.config.Comm.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/oneandone/ssh.go b/builder/oneandone/ssh.go deleted file mode 100644 index 4068b87af..000000000 --- a/builder/oneandone/ssh.go +++ /dev/null @@ -1,10 +0,0 @@ -package oneandone - -import ( - "github.com/hashicorp/packer/helper/multistep" -) - -func commHost(state multistep.StateBag) (string, error) { - ipAddress := state.Get("server_ip").(string) - return ipAddress, nil -} diff --git a/builder/openstack/builder.go b/builder/openstack/builder.go index 661913dd0..f802e2523 100644 --- a/builder/openstack/builder.go +++ b/builder/openstack/builder.go @@ -126,16 +126,18 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack Wait: b.config.RackconnectWait, }, &StepAllocateIp{ - FloatingIPNetwork: b.config.FloatingIPNetwork, - FloatingIP: b.config.FloatingIP, - ReuseIPs: b.config.ReuseIPs, + FloatingIPNetwork: b.config.FloatingIPNetwork, + FloatingIP: b.config.FloatingIP, + ReuseIPs: b.config.ReuseIPs, + InstanceFloatingIPNet: b.config.InstanceFloatingIPNet, }, &communicator.StepConnect{ Config: &b.config.RunConfig.Comm, Host: CommHost( + b.config.RunConfig.Comm.SSHHost, computeClient, - b.config.Comm.SSHInterface, - b.config.Comm.SSHIPVersion), + b.config.SSHInterface, + b.config.SSHIPVersion), SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), }, &common.StepProvision{}, @@ -152,6 +154,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack &stepUpdateImageTags{}, &stepUpdateImageVisibility{}, &stepAddImageMembers{}, + &stepUpdateImageMinDisk{}, } // Run! diff --git a/builder/openstack/image_config.go b/builder/openstack/image_config.go index 88a4f4013..8a8d66938 100644 --- a/builder/openstack/image_config.go +++ b/builder/openstack/image_config.go @@ -27,6 +27,8 @@ type ImageConfig struct { ImageDiskFormat string `mapstructure:"image_disk_format" required:"false"` // List of tags to add to the image after creation. ImageTags []string `mapstructure:"image_tags" required:"false"` + // Minimum disk size needed to boot image, in gigabytes. + ImageMinDisk int `mapstructure:"image_min_disk" required:"false"` } func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error { @@ -63,6 +65,10 @@ func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error { } } + if c.ImageMinDisk < 0 { + errs = append(errs, fmt.Errorf("An image min disk size must be greater than or equal to 0")) + } + if len(errs) > 0 { return errs } diff --git a/builder/openstack/networks.go b/builder/openstack/networks.go index 30c435ee8..537d9ce5a 100644 --- a/builder/openstack/networks.go +++ b/builder/openstack/networks.go @@ -2,6 +2,7 @@ package openstack import ( "fmt" + "log" "github.com/google/uuid" "github.com/gophercloud/gophercloud" @@ -66,7 +67,10 @@ func FindFreeFloatingIP(client *gophercloud.ServiceClient) (*floatingips.Floatin // GetInstancePortID returns internal port of the instance that can be used for // the association of a floating IP. // It will return an ID of a first port if there are many. -func GetInstancePortID(client *gophercloud.ServiceClient, id string) (string, error) { +func GetInstancePortID(client *gophercloud.ServiceClient, id string, instance_float_net string) (string, error) { + + selected_interface := 0 + interfacesPage, err := attachinterfaces.List(client, id).AllPages() if err != nil { return "", err @@ -79,7 +83,16 @@ func GetInstancePortID(client *gophercloud.ServiceClient, id string) (string, er return "", fmt.Errorf("instance '%s' has no interfaces", id) } - return interfaces[0].PortID, nil + for i := 0; i < len(interfaces); i++ { + log.Printf("Instance interface: %v: %+v\n", i, interfaces[i]) + if interfaces[i].NetID == instance_float_net { + log.Printf("Found preferred interface: %v\n", i) + selected_interface = i + log.Printf("Using interface value: %v", selected_interface) + } + } + + return interfaces[selected_interface].PortID, nil } // CheckFloatingIPNetwork checks provided network reference and returns a valid diff --git a/builder/openstack/run_config.go b/builder/openstack/run_config.go index 391bd4aea..841b3d1ab 100644 --- a/builder/openstack/run_config.go +++ b/builder/openstack/run_config.go @@ -16,6 +16,15 @@ import ( // and details on how to access that launched image. type RunConfig struct { Comm communicator.Config `mapstructure:",squash"` + // The type of interface to connect via SSH. Values useful for Rackspace + // are "public" or "private", and the default behavior is to connect via + // whichever is returned first from the OpenStack API. + SSHInterface string `mapstructure:"ssh_interface" required:"false"` + // The IP version to use for SSH connections, valid values are `4` and `6`. + // Useful on dual stacked instances where the default behavior is to + // connect via whichever IP address is returned first from the OpenStack + // API. + SSHIPVersion string `mapstructure:"ssh_ip_version" required:"false"` // The ID or full URL to the base image to use. This is the image that will // be used to launch a new server and provision it. Unless you specify // completely custom SSH settings, the source image must have cloud-init @@ -86,6 +95,13 @@ type RunConfig struct { // The ID or name of an external network that can be used for creation of a // new floating IP. FloatingIPNetwork string `mapstructure:"floating_ip_network" required:"false"` + // The ID of the network to which the instance is attached and which should + // be used to associate with the floating IP. This provides control over + // the floating ip association on multi-homed instances. The association + // otherwise depends on a first-returned-interface policy which could fail + // if the network to which it is connected is unreachable from the floating + // IP network. + InstanceFloatingIPNet string `mapstructure:"instance_floating_ip_net" required:"false"` // A specific floating IP to assign to this instance. FloatingIP string `mapstructure:"floating_ip" required:"false"` // Whether or not to attempt to reuse existing unassigned floating ips in @@ -239,7 +255,7 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { errs = append(errs, errors.New("A flavor must be specified")) } - if c.Comm.SSHIPVersion != "" && c.Comm.SSHIPVersion != "4" && c.Comm.SSHIPVersion != "6" { + if c.SSHIPVersion != "" && c.SSHIPVersion != "4" && c.SSHIPVersion != "6" { errs = append(errs, errors.New("SSH IP version must be either 4 or 6")) } diff --git a/builder/openstack/ssh.go b/builder/openstack/ssh.go index 0fd9f794b..1f93363c4 100644 --- a/builder/openstack/ssh.go +++ b/builder/openstack/ssh.go @@ -14,10 +14,16 @@ import ( // CommHost looks up the host for the communicator. func CommHost( + host string, client *gophercloud.ServiceClient, sshinterface string, sshipversion string) func(multistep.StateBag) (string, error) { return func(state multistep.StateBag) (string, error) { + if host != "" { + log.Printf("Using ssh_host value: %s", host) + return host, nil + } + s := state.Get("server").(*servers.Server) // If we have a specific interface, try that diff --git a/builder/openstack/step_allocate_ip.go b/builder/openstack/step_allocate_ip.go index a63faa836..8b0701491 100644 --- a/builder/openstack/step_allocate_ip.go +++ b/builder/openstack/step_allocate_ip.go @@ -11,9 +11,10 @@ import ( ) type StepAllocateIp struct { - FloatingIPNetwork string - FloatingIP string - ReuseIPs bool + FloatingIPNetwork string + FloatingIP string + ReuseIPs bool + InstanceFloatingIPNet string } func (s *StepAllocateIp) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { @@ -114,7 +115,7 @@ func (s *StepAllocateIp) Run(ctx context.Context, state multistep.StateBag) mult ui.Say(fmt.Sprintf("Associating floating IP '%s' (%s) with instance port...", instanceIP.ID, instanceIP.FloatingIP)) - portID, err := GetInstancePortID(computeClient, server.ID) + portID, err := GetInstancePortID(computeClient, server.ID, s.InstanceFloatingIPNet) if err != nil { err := fmt.Errorf("Error getting interfaces of the instance '%s': %s", server.ID, err) state.Put("error", err) diff --git a/builder/openstack/step_create_image.go b/builder/openstack/step_create_image.go index c50d3eb3e..27dce4a1b 100644 --- a/builder/openstack/step_create_image.go +++ b/builder/openstack/step_create_image.go @@ -64,6 +64,15 @@ func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) mul ui.Error(err.Error()) return multistep.ActionHalt } + err = volumeactions.SetImageMetadata(blockStorageClient, volume, volumeactions.ImageMetadataOpts{ + Metadata: config.ImageMetadata, + }).ExtractErr() + if err != nil { + err := fmt.Errorf("Error setting image metadata: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } imageId = image.ImageID } else { imageId, err = servers.CreateImage(computeClient, server.ID, servers.CreateImageOpts{ diff --git a/builder/openstack/step_create_volume.go b/builder/openstack/step_create_volume.go index a1ed7e68a..93207c744 100644 --- a/builder/openstack/step_create_volume.go +++ b/builder/openstack/step_create_volume.go @@ -125,7 +125,7 @@ func (s *StepCreateVolume) Cleanup(state multistep.StateBag) { } } ui.Say(fmt.Sprintf("Deleting volume: %s ...", s.volumeID)) - err = volumes.Delete(blockStorageClient, s.volumeID).ExtractErr() + err = volumes.Delete(blockStorageClient, s.volumeID, volumes.DeleteOpts{}).ExtractErr() if err != nil { ui.Error(fmt.Sprintf( "Error cleaning up volume. Please delete the volume manually: %s", s.volumeID)) diff --git a/builder/openstack/step_get_password.go b/builder/openstack/step_get_password.go index 0c173fa7a..c97bc4944 100644 --- a/builder/openstack/step_get_password.go +++ b/builder/openstack/step_get_password.go @@ -8,6 +8,7 @@ import ( "time" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" + commonhelper "github.com/hashicorp/packer/helper/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" @@ -17,8 +18,9 @@ import ( // StepGetPassword reads the password from a booted OpenStack server and sets // it on the WinRM config. type StepGetPassword struct { - Debug bool - Comm *communicator.Config + Debug bool + Comm *communicator.Config + BuildName string } func (s *StepGetPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { @@ -76,7 +78,12 @@ func (s *StepGetPassword) Run(ctx context.Context, state multistep.StateBag) mul "Password (since debug is enabled) \"%s\"", s.Comm.WinRMPassword)) } + commonhelper.SetSharedState("winrm_password", s.Comm.WinRMPassword, s.BuildName) + packer.LogSecretFilter.Set(s.Comm.WinRMPassword) + return multistep.ActionContinue } -func (s *StepGetPassword) Cleanup(multistep.StateBag) {} +func (s *StepGetPassword) Cleanup(multistep.StateBag) { + commonhelper.RemoveSharedStateFile("winrm_password", s.BuildName) +} diff --git a/builder/openstack/step_update_image_mindisk.go b/builder/openstack/step_update_image_mindisk.go new file mode 100644 index 000000000..63ec2709d --- /dev/null +++ b/builder/openstack/step_update_image_mindisk.go @@ -0,0 +1,52 @@ +package openstack + +import ( + "context" + "fmt" + + "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type stepUpdateImageMinDisk struct{} + +func (s *stepUpdateImageMinDisk) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + imageId := state.Get("image").(string) + ui := state.Get("ui").(packer.Ui) + config := state.Get("config").(*Config) + + if config.ImageMinDisk == 0 { + return multistep.ActionContinue + } + imageClient, err := config.imageV2Client() + if err != nil { + err := fmt.Errorf("Error initializing image service client: %s", err) + state.Put("error", err) + return multistep.ActionHalt + } + + ui.Say(fmt.Sprintf("Updating image min disk to %d", config.ImageMinDisk)) + + r := images.Update( + imageClient, + imageId, + images.UpdateOpts{ + images.ReplaceImageMinDisk{ + NewMinDisk: config.ImageMinDisk, + }, + }, + ) + + if _, err := r.Extract(); err != nil { + err = fmt.Errorf("Error updating image min disk: %s", err) + state.Put("error", err) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *stepUpdateImageMinDisk) Cleanup(multistep.StateBag) { + // No cleanup... +} diff --git a/builder/oracle/classic/builder.go b/builder/oracle/classic/builder.go index eb0ce97d8..d97b3be10 100644 --- a/builder/oracle/classic/builder.go +++ b/builder/oracle/classic/builder.go @@ -99,7 +99,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, &communicator.StepConnect{ Config: &b.config.Comm, - Host: ocommon.CommHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"), SSHConfig: b.config.Comm.SSHConfigFunc(), }, &common.StepProvision{}, @@ -129,7 +129,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack KeyName: fmt.Sprintf("packer-generated-key_%s", runID), StepConnectSSH: &communicator.StepConnectSSH{ Config: &b.config.BuilderComm, - Host: ocommon.CommHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"), SSHConfig: b.config.BuilderComm.SSHConfigFunc(), }, }, @@ -162,7 +162,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack &stepCreateInstance{}, &communicator.StepConnect{ Config: &b.config.Comm, - Host: ocommon.CommHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"), SSHConfig: b.config.Comm.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/oracle/common/ssh.go b/builder/oracle/common/ssh.go deleted file mode 100644 index 53b5d349a..000000000 --- a/builder/oracle/common/ssh.go +++ /dev/null @@ -1,10 +0,0 @@ -package common - -import ( - "github.com/hashicorp/packer/helper/multistep" -) - -func CommHost(state multistep.StateBag) (string, error) { - ipAddress := state.Get("instance_ip").(string) - return ipAddress, nil -} diff --git a/builder/oracle/oci/builder.go b/builder/oracle/oci/builder.go index bf34eafc5..7822b144f 100644 --- a/builder/oracle/oci/builder.go +++ b/builder/oracle/oci/builder.go @@ -65,7 +65,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, &communicator.StepConnect{ Config: &b.config.Comm, - Host: ocommon.CommHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"), SSHConfig: b.config.Comm.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/osc/bsu/builder.go b/builder/osc/bsu/builder.go new file mode 100644 index 000000000..798371723 --- /dev/null +++ b/builder/osc/bsu/builder.go @@ -0,0 +1,219 @@ +// Package bsu contains a packer.Builder implementation that +// builds OMIs for Outscale OAPI. +// +// In general, there are two types of OMIs that can be created: ebs-backed or +// instance-store. This builder _only_ builds ebs-backed images. +package bsu + +import ( + "context" + "crypto/tls" + "fmt" + "net/http" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +// The unique ID for this builder +const BuilderId = "oapi.outscale.bsu" + +type Config struct { + common.PackerConfig `mapstructure:",squash"` + osccommon.AccessConfig `mapstructure:",squash"` + osccommon.OMIConfig `mapstructure:",squash"` + osccommon.BlockDevices `mapstructure:",squash"` + osccommon.RunConfig `mapstructure:",squash"` + VolumeRunTags osccommon.TagMap `mapstructure:"run_volume_tags"` + + ctx interpolate.Context +} + +type Builder struct { + config Config + runner multistep.Runner +} + +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + b.config.ctx.Funcs = osccommon.TemplateFuncs + err := config.Decode(&b.config, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &b.config.ctx, + InterpolateFilter: &interpolate.RenderFilter{ + Exclude: []string{ + "omi_description", + "run_tags", + "run_volume_tags", + "spot_tags", + "snapshot_tags", + "tags", + }, + }, + }, raws...) + if err != nil { + return nil, err + } + + if b.config.PackerConfig.PackerForce { + b.config.OMIForceDeregister = true + } + + // Accumulate any errors + var errs *packer.MultiError + errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, + b.config.OMIConfig.Prepare(&b.config.AccessConfig, &b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.BlockDevices.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.RunConfig.Prepare(&b.config.ctx)...) + + if errs != nil && len(errs.Errors) > 0 { + return nil, errs + } + + packer.LogSecretFilter.Set(b.config.AccessKey, b.config.SecretKey, b.config.Token) + return nil, nil +} + +func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { + clientConfig, err := b.config.Config() + if err != nil { + return nil, err + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + oapiconn := oapi.NewClient(clientConfig, skipClient) + + // Setup the state bag and initial state for the steps + state := new(multistep.BasicStateBag) + state.Put("config", &b.config) + state.Put("oapi", oapiconn) + state.Put("clientConfig", clientConfig) + state.Put("hook", hook) + state.Put("ui", ui) + + steps := []multistep.Step{ + &osccommon.StepPreValidate{ + DestOmiName: b.config.OMIName, + ForceDeregister: b.config.OMIForceDeregister, + }, + &osccommon.StepSourceOMIInfo{ + SourceOmi: b.config.SourceOmi, + OmiFilters: b.config.SourceOmiFilter, + OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used + }, + &osccommon.StepNetworkInfo{ + NetId: b.config.NetId, + NetFilter: b.config.NetFilter, + SecurityGroupIds: b.config.SecurityGroupIds, + SecurityGroupFilter: b.config.SecurityGroupFilter, + SubnetId: b.config.SubnetId, + SubnetFilter: b.config.SubnetFilter, + SubregionName: b.config.Subregion, + }, + &osccommon.StepKeyPair{ + Debug: b.config.PackerDebug, + Comm: &b.config.RunConfig.Comm, + DebugKeyPath: fmt.Sprintf("oapi_%s", b.config.PackerBuildName), + }, + &osccommon.StepSecurityGroup{ + SecurityGroupFilter: b.config.SecurityGroupFilter, + SecurityGroupIds: b.config.SecurityGroupIds, + CommConfig: &b.config.RunConfig.Comm, + TemporarySGSourceCidr: b.config.TemporarySGSourceCidr, + }, + &osccommon.StepCleanupVolumes{ + BlockDevices: b.config.BlockDevices, + }, + &osccommon.StepRunSourceVm{ + AssociatePublicIpAddress: b.config.AssociatePublicIpAddress, + BlockDevices: b.config.BlockDevices, + Comm: &b.config.RunConfig.Comm, + Ctx: b.config.ctx, + Debug: b.config.PackerDebug, + BsuOptimized: b.config.BsuOptimized, + EnableT2Unlimited: b.config.EnableT2Unlimited, + ExpectedRootDevice: osccommon.RunSourceVmBSUExpectedRootDevice, + IamVmProfile: b.config.IamVmProfile, + VmInitiatedShutdownBehavior: b.config.VmInitiatedShutdownBehavior, + VmType: b.config.VmType, + IsRestricted: false, + SourceOMI: b.config.SourceOmi, + Tags: b.config.RunTags, + UserData: b.config.UserData, + UserDataFile: b.config.UserDataFile, + VolumeTags: b.config.VolumeRunTags, + }, + &osccommon.StepGetPassword{ + Debug: b.config.PackerDebug, + Comm: &b.config.RunConfig.Comm, + Timeout: b.config.WindowsPasswordTimeout, + BuildName: b.config.PackerBuildName, + }, + &communicator.StepConnect{ + Config: &b.config.RunConfig.Comm, + Host: osccommon.SSHHost( + oapiconn, + b.config.SSHInterface), + SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), + }, + &common.StepProvision{}, + &common.StepCleanupTempKeys{ + Comm: &b.config.RunConfig.Comm, + }, + &osccommon.StepStopBSUBackedVm{ + Skip: false, + DisableStopVm: b.config.DisableStopVm, + }, + &osccommon.StepDeregisterOMI{ + AccessConfig: &b.config.AccessConfig, + ForceDeregister: b.config.OMIForceDeregister, + ForceDeleteSnapshot: b.config.OMIForceDeleteSnapshot, + OMIName: b.config.OMIName, + Regions: b.config.OMIRegions, + }, + &stepCreateOMI{}, + &osccommon.StepUpdateOMIAttributes{ + AccountIds: b.config.OMIAccountIDs, + SnapshotAccountIds: b.config.SnapshotAccountIDs, + Ctx: b.config.ctx, + }, + &osccommon.StepCreateTags{ + Tags: b.config.OMITags, + SnapshotTags: b.config.SnapshotTags, + Ctx: b.config.ctx, + }, + } + + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) + b.runner.Run(ctx, state) + + // If there was an error, return that + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) + } + + //Build the artifact + if omis, ok := state.GetOk("omis"); ok { + // Build the artifact and return it + artifact := &osccommon.Artifact{ + Omis: omis.(map[string]string), + BuilderIdValue: BuilderId, + Config: clientConfig, + } + + return artifact, nil + } + + return nil, nil +} diff --git a/builder/osc/bsu/builder_acc_test.go b/builder/osc/bsu/builder_acc_test.go new file mode 100644 index 000000000..2bce61683 --- /dev/null +++ b/builder/osc/bsu/builder_acc_test.go @@ -0,0 +1,53 @@ +//TODO: explain how to delete the image. +package bsu + +import ( + "crypto/tls" + "net/http" + "testing" + + "github.com/hashicorp/packer/builder/osc/common" + builderT "github.com/hashicorp/packer/helper/builder/testing" + "github.com/outscale/osc-go/oapi" +) + +func TestBuilderAcc_basic(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Builder: &Builder{}, + Template: testBuilderAccBasic, + SkipArtifactTeardown: true, + }) +} + +func testAccPreCheck(t *testing.T) { +} + +func testOAPIConn() (*oapi.Client, error) { + access := &common.AccessConfig{RawRegion: "us-east-1"} + clientConfig, err := access.Config() + if err != nil { + return nil, err + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + return oapi.NewClient(clientConfig, skipClient), nil +} + +const testBuilderAccBasic = ` +{ + "builders": [{ + "type": "test", + "region": "eu-west-2", + "vm_type": "t2.micro", + "source_omi": "ami-65efcc11", + "ssh_username": "outscale", + "omi_name": "packer-test {{timestamp}}" + }] +} +` diff --git a/builder/osc/bsu/builder_test.go b/builder/osc/bsu/builder_test.go new file mode 100644 index 000000000..1736044df --- /dev/null +++ b/builder/osc/bsu/builder_test.go @@ -0,0 +1,131 @@ +package bsu + +import ( + "testing" + + "github.com/hashicorp/packer/packer" +) + +func testConfig() map[string]interface{} { + return map[string]interface{}{ + "access_key": "foo", + "secret_key": "bar", + "source_omi": "foo", + "vm_type": "foo", + "region": "us-east-1", + "ssh_username": "root", + "omi_name": "foo", + } +} + +func TestBuilder_ImplementsBuilder(t *testing.T) { + var raw interface{} + raw = &Builder{} + if _, ok := raw.(packer.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_OMIName(t *testing.T) { + var b Builder + config := testConfig() + + // Test good + config["omi_name"] = "foo" + config["skip_region_validation"] = 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) + } + + // Test bad + config["omi_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, "omi_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 := testConfig() + + // 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_InvalidShutdownBehavior(t *testing.T) { + var b Builder + config := testConfig() + + // Test good + config["shutdown_behavior"] = "terminate" + config["skip_region_validation"] = 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) + } + + // Test good + config["shutdown_behavior"] = "stop" + 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["shutdown_behavior"] = "foobar" + warnings, err = b.Prepare(config) + if len(warnings) > 0 { + t.Fatalf("bad: %#v", warnings) + } + if err == nil { + t.Fatal("should have error") + } +} diff --git a/builder/osc/bsu/step_create_omi.go b/builder/osc/bsu/step_create_omi.go new file mode 100644 index 000000000..2ccd538e3 --- /dev/null +++ b/builder/osc/bsu/step_create_omi.go @@ -0,0 +1,116 @@ +package bsu + +import ( + "context" + "fmt" + "log" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +type stepCreateOMI struct { + image *oapi.Image +} + +func (s *stepCreateOMI) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + oapiconn := state.Get("oapi").(*oapi.Client) + vm := state.Get("vm").(oapi.Vm) + ui := state.Get("ui").(packer.Ui) + + // Create the image + omiName := config.OMIName + + ui.Say(fmt.Sprintf("Creating OMI %s from vm %s", omiName, vm.VmId)) + createOpts := oapi.CreateImageRequest{ + VmId: vm.VmId, + ImageName: omiName, + BlockDeviceMappings: config.BlockDevices.BuildOMIDevices(), + } + + resp, err := oapiconn.POST_CreateImage(createOpts) + if err != nil || resp.OK == nil { + err := fmt.Errorf("Error creating OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + image := resp.OK.Image + + // Set the OMI ID in the state + ui.Message(fmt.Sprintf("OMI: %s", image.ImageId)) + omis := make(map[string]string) + omis[oapiconn.GetConfig().Region] = image.ImageId + state.Put("omis", omis) + + // Wait for the image to become ready + ui.Say("Waiting for OMI to become ready...") + if err := osccommon.WaitUntilImageAvailable(oapiconn, image.ImageId); err != nil { + log.Printf("Error waiting for OMI: %s", err) + imagesResp, err := oapiconn.POST_ReadImages(oapi.ReadImagesRequest{ + Filters: oapi.FiltersImage{ + ImageIds: []string{image.ImageId}, + }, + }) + if err != nil { + log.Printf("Unable to determine reason waiting for OMI failed: %s", err) + err = fmt.Errorf("Unknown error waiting for OMI.") + } else { + stateReason := imagesResp.OK.Images[0].StateComment + err = fmt.Errorf("Error waiting for OMI. Reason: %s", stateReason) + } + + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + imagesResp, err := oapiconn.POST_ReadImages(oapi.ReadImagesRequest{ + Filters: oapi.FiltersImage{ + ImageIds: []string{image.ImageId}, + }, + }) + if err != nil { + err := fmt.Errorf("Error searching for OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + s.image = &imagesResp.OK.Images[0] + + snapshots := make(map[string][]string) + for _, blockDeviceMapping := range imagesResp.OK.Images[0].BlockDeviceMappings { + if blockDeviceMapping.Bsu.SnapshotId != "" { + snapshots[oapiconn.GetConfig().Region] = append(snapshots[oapiconn.GetConfig().Region], blockDeviceMapping.Bsu.SnapshotId) + } + } + state.Put("snapshots", snapshots) + + return multistep.ActionContinue +} + +func (s *stepCreateOMI) Cleanup(state multistep.StateBag) { + if s.image == nil { + return + } + + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + if !cancelled && !halted { + return + } + + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + + ui.Say("Deregistering the OMI because cancellation or error...") + DeleteOpts := oapi.DeleteImageRequest{ImageId: s.image.ImageId} + if _, err := oapiconn.POST_DeleteImage(DeleteOpts); err != nil { + ui.Error(fmt.Sprintf("Error Deleting OMI, may still be around: %s", err)) + return + } +} diff --git a/builder/osc/bsusurrogate/builder.go b/builder/osc/bsusurrogate/builder.go new file mode 100644 index 000000000..1186a5bdc --- /dev/null +++ b/builder/osc/bsusurrogate/builder.go @@ -0,0 +1,249 @@ +// Package bsusurrogate contains a packer.Builder implementation that +// builds a new EBS-backed OMI using an ephemeral instance. +package bsusurrogate + +import ( + "context" + "crypto/tls" + "errors" + "fmt" + "net/http" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +const BuilderId = "oapi.outscale.bsusurrogate" + +type Config struct { + common.PackerConfig `mapstructure:",squash"` + osccommon.AccessConfig `mapstructure:",squash"` + osccommon.RunConfig `mapstructure:",squash"` + osccommon.BlockDevices `mapstructure:",squash"` + osccommon.OMIConfig `mapstructure:",squash"` + + RootDevice RootBlockDevice `mapstructure:"omi_root_device"` + VolumeRunTags osccommon.TagMap `mapstructure:"run_volume_tags"` + + ctx interpolate.Context +} + +type Builder struct { + config Config + runner multistep.Runner +} + +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + + b.config.ctx.Funcs = osccommon.TemplateFuncs + + err := config.Decode(&b.config, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &b.config.ctx, + InterpolateFilter: &interpolate.RenderFilter{ + Exclude: []string{ + "omi_description", + "run_tags", + "run_volume_tags", + "snapshot_tags", + "spot_tags", + "tags", + }, + }, + }, raws...) + if err != nil { + return nil, err + } + + if b.config.PackerConfig.PackerForce { + b.config.OMIForceDeregister = true + } + + // Accumulate any errors + var errs *packer.MultiError + errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.RunConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, + b.config.OMIConfig.Prepare(&b.config.AccessConfig, &b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.BlockDevices.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.RootDevice.Prepare(&b.config.ctx)...) + + if b.config.OMIVirtType == "" { + errs = packer.MultiErrorAppend(errs, errors.New("omi_virtualization_type is required.")) + } + + foundRootVolume := false + for _, launchDevice := range b.config.BlockDevices.LaunchMappings { + if launchDevice.DeviceName == b.config.RootDevice.SourceDeviceName { + foundRootVolume = true + } + } + + if !foundRootVolume { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("no volume with name '%s' is found", b.config.RootDevice.SourceDeviceName)) + } + + if errs != nil && len(errs.Errors) > 0 { + return nil, errs + } + + packer.LogSecretFilter.Set(b.config.AccessKey, b.config.SecretKey, b.config.Token) + return nil, nil + +} + +func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { + clientConfig, err := b.config.Config() + if err != nil { + return nil, err + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + oapiconn := oapi.NewClient(clientConfig, skipClient) + + // Setup the state bag and initial state for the steps + state := new(multistep.BasicStateBag) + state.Put("config", &b.config) + state.Put("oapi", oapiconn) + state.Put("clientConfig", clientConfig) + state.Put("hook", hook) + state.Put("ui", ui) + + //VMStep + + omiDevices := b.config.BuildOMIDevices() + launchDevices := b.config.BuildLaunchDevices() + + steps := []multistep.Step{ + &osccommon.StepPreValidate{ + DestOmiName: b.config.OMIName, + ForceDeregister: b.config.OMIForceDeregister, + }, + &osccommon.StepSourceOMIInfo{ + SourceOmi: b.config.SourceOmi, + OmiFilters: b.config.SourceOmiFilter, + OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used + }, + &osccommon.StepNetworkInfo{ + NetId: b.config.NetId, + NetFilter: b.config.NetFilter, + SecurityGroupIds: b.config.SecurityGroupIds, + SecurityGroupFilter: b.config.SecurityGroupFilter, + SubnetId: b.config.SubnetId, + SubnetFilter: b.config.SubnetFilter, + SubregionName: b.config.Subregion, + }, + &osccommon.StepKeyPair{ + Debug: b.config.PackerDebug, + Comm: &b.config.RunConfig.Comm, + DebugKeyPath: fmt.Sprintf("oapi_%s", b.config.PackerBuildName), + }, + &osccommon.StepSecurityGroup{ + SecurityGroupFilter: b.config.SecurityGroupFilter, + SecurityGroupIds: b.config.SecurityGroupIds, + CommConfig: &b.config.RunConfig.Comm, + TemporarySGSourceCidr: b.config.TemporarySGSourceCidr, + }, + &osccommon.StepCleanupVolumes{ + BlockDevices: b.config.BlockDevices, + }, + &osccommon.StepRunSourceVm{ + AssociatePublicIpAddress: b.config.AssociatePublicIpAddress, + BlockDevices: b.config.BlockDevices, + Comm: &b.config.RunConfig.Comm, + Ctx: b.config.ctx, + Debug: b.config.PackerDebug, + BsuOptimized: b.config.BsuOptimized, + EnableT2Unlimited: b.config.EnableT2Unlimited, + ExpectedRootDevice: osccommon.RunSourceVmBSUExpectedRootDevice, + IamVmProfile: b.config.IamVmProfile, + VmInitiatedShutdownBehavior: b.config.VmInitiatedShutdownBehavior, + VmType: b.config.VmType, + IsRestricted: false, + SourceOMI: b.config.SourceOmi, + Tags: b.config.RunTags, + UserData: b.config.UserData, + UserDataFile: b.config.UserDataFile, + VolumeTags: b.config.VolumeRunTags, + }, + &osccommon.StepGetPassword{ + Debug: b.config.PackerDebug, + Comm: &b.config.RunConfig.Comm, + Timeout: b.config.WindowsPasswordTimeout, + BuildName: b.config.PackerBuildName, + }, + &communicator.StepConnect{ + Config: &b.config.RunConfig.Comm, + Host: osccommon.SSHHost( + oapiconn, + b.config.SSHInterface), + SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), + }, + &common.StepProvision{}, + &common.StepCleanupTempKeys{ + Comm: &b.config.RunConfig.Comm, + }, + &osccommon.StepStopBSUBackedVm{ + Skip: false, + DisableStopVm: b.config.DisableStopVm, + }, + &StepSnapshotVolumes{ + LaunchDevices: launchDevices, + }, + &osccommon.StepDeregisterOMI{ + AccessConfig: &b.config.AccessConfig, + ForceDeregister: b.config.OMIForceDeregister, + ForceDeleteSnapshot: b.config.OMIForceDeleteSnapshot, + OMIName: b.config.OMIName, + Regions: b.config.OMIRegions, + }, + &StepRegisterOMI{ + RootDevice: b.config.RootDevice, + OMIDevices: omiDevices, + LaunchDevices: launchDevices, + }, + &osccommon.StepUpdateOMIAttributes{ + AccountIds: b.config.OMIAccountIDs, + SnapshotAccountIds: b.config.SnapshotAccountIDs, + Ctx: b.config.ctx, + }, + &osccommon.StepCreateTags{ + Tags: b.config.OMITags, + SnapshotTags: b.config.SnapshotTags, + Ctx: b.config.ctx, + }, + } + + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) + b.runner.Run(ctx, state) + + // If there was an error, return that + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) + } + + //Build the artifact + if omis, ok := state.GetOk("omis"); ok { + // Build the artifact and return it + artifact := &osccommon.Artifact{ + Omis: omis.(map[string]string), + BuilderIdValue: BuilderId, + Config: clientConfig, + } + + return artifact, nil + } + + return nil, nil +} diff --git a/builder/osc/bsusurrogate/builder_acc_test.go b/builder/osc/bsusurrogate/builder_acc_test.go new file mode 100644 index 000000000..243246d8f --- /dev/null +++ b/builder/osc/bsusurrogate/builder_acc_test.go @@ -0,0 +1,51 @@ +package bsusurrogate + +import ( + "testing" + + builderT "github.com/hashicorp/packer/helper/builder/testing" +) + +func TestBuilderAcc_basic(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Builder: &Builder{}, + Template: testBuilderAccBasic, + SkipArtifactTeardown: true, + }) +} + +func testAccPreCheck(t *testing.T) { +} + +const testBuilderAccBasic = ` +{ + "builders": [{ + "type": "test", + "region": "eu-west-2", + "vm_type": "t2.micro", + "source_omi": "ami-65efcc11", + "ssh_username": "outscale", + "omi_name": "packer-test {{timestamp}}", + "omi_virtualization_type": "hvm", + "subregion_name": "eu-west-2a", + "launch_block_device_mappings" : [ + { + "volume_type" : "io1", + "device_name" : "/dev/xvdf", + "delete_on_vm_deletion" : false, + "volume_size" : 10, + "iops": 300 + } + ], + "omi_root_device":{ + "source_device_name": "/dev/xvdf", + "device_name": "/dev/sda1", + "delete_on_vm_deletion": true, + "volume_size": 10, + "volume_type": "standard" + } + + }] +} +` diff --git a/builder/osc/bsusurrogate/builder_test.go b/builder/osc/bsusurrogate/builder_test.go new file mode 100644 index 000000000..d91f46af8 --- /dev/null +++ b/builder/osc/bsusurrogate/builder_test.go @@ -0,0 +1,15 @@ +package bsusurrogate + +import ( + "testing" + + "github.com/hashicorp/packer/packer" +) + +func TestBuilder_ImplementsBuilder(t *testing.T) { + var raw interface{} + raw = &Builder{} + if _, ok := raw.(packer.Builder); !ok { + t.Fatal("Builder should be a builder") + } +} diff --git a/builder/osc/bsusurrogate/root_block_device.go b/builder/osc/bsusurrogate/root_block_device.go new file mode 100644 index 000000000..78616f3d4 --- /dev/null +++ b/builder/osc/bsusurrogate/root_block_device.go @@ -0,0 +1,46 @@ +package bsusurrogate + +import ( + "errors" + + "github.com/hashicorp/packer/template/interpolate" +) + +type RootBlockDevice struct { + SourceDeviceName string `mapstructure:"source_device_name"` + DeviceName string `mapstructure:"device_name"` + DeleteOnVmDeletion bool `mapstructure:"delete_on_vm_deletion"` + IOPS int64 `mapstructure:"iops"` + VolumeType string `mapstructure:"volume_type"` + VolumeSize int64 `mapstructure:"volume_size"` +} + +func (c *RootBlockDevice) Prepare(ctx *interpolate.Context) []error { + var errs []error + + if c.SourceDeviceName == "" { + errs = append(errs, errors.New("source_device_name for the root_device must be specified")) + } + + if c.DeviceName == "" { + errs = append(errs, errors.New("device_name for the root_device must be specified")) + } + + if c.VolumeType == "gp2" && c.IOPS != 0 { + errs = append(errs, errors.New("iops may not be specified for a gp2 volume")) + } + + if c.IOPS < 0 { + errs = append(errs, errors.New("iops must be greater than 0")) + } + + if c.VolumeSize < 0 { + errs = append(errs, errors.New("volume_size must be greater than 0")) + } + + if len(errs) > 0 { + return errs + } + + return nil +} diff --git a/builder/osc/bsusurrogate/step_register_omi.go b/builder/osc/bsusurrogate/step_register_omi.go new file mode 100644 index 000000000..1dd4c1f00 --- /dev/null +++ b/builder/osc/bsusurrogate/step_register_omi.go @@ -0,0 +1,148 @@ +package bsusurrogate + +import ( + "context" + "fmt" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepRegisterOMI creates the OMI. +type StepRegisterOMI struct { + RootDevice RootBlockDevice + OMIDevices []oapi.BlockDeviceMappingImage + LaunchDevices []oapi.BlockDeviceMappingVmCreation + image *oapi.Image +} + +func (s *StepRegisterOMI) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + oapiconn := state.Get("oapi").(*oapi.Client) + snapshotIds := state.Get("snapshot_ids").(map[string]string) + ui := state.Get("ui").(packer.Ui) + + ui.Say("Registering the OMI...") + + blockDevices := s.combineDevices(snapshotIds) + + registerOpts := oapi.CreateImageRequest{ + ImageName: config.OMIName, + Architecture: "x86_64", + RootDeviceName: s.RootDevice.DeviceName, + BlockDeviceMappings: blockDevices, + } + + registerResp, err := oapiconn.POST_CreateImage(registerOpts) + if err != nil { + state.Put("error", fmt.Errorf("Error registering OMI: %s", err)) + ui.Error(state.Get("error").(error).Error()) + return multistep.ActionHalt + } + + // Set the OMI ID in the state + ui.Say(fmt.Sprintf("OMI: %s", registerResp.OK.Image.ImageId)) + omis := make(map[string]string) + omis[oapiconn.GetConfig().Region] = registerResp.OK.Image.ImageId + state.Put("omis", omis) + + // Wait for the image to become ready + ui.Say("Waiting for OMI to become ready...") + if err := osccommon.WaitUntilImageAvailable(oapiconn, registerResp.OK.Image.ImageId); err != nil { + err := fmt.Errorf("Error waiting for OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + imagesResp, err := oapiconn.POST_ReadImages(oapi.ReadImagesRequest{ + Filters: oapi.FiltersImage{ + ImageIds: []string{registerResp.OK.Image.ImageId}, + }, + }) + + if err != nil { + err := fmt.Errorf("Error searching for OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + s.image = &imagesResp.OK.Images[0] + + snapshots := make(map[string][]string) + for _, blockDeviceMapping := range imagesResp.OK.Images[0].BlockDeviceMappings { + if blockDeviceMapping.Bsu.SnapshotId != "" { + snapshots[oapiconn.GetConfig().Region] = append(snapshots[oapiconn.GetConfig().Region], blockDeviceMapping.Bsu.SnapshotId) + } + } + state.Put("snapshots", snapshots) + + return multistep.ActionContinue +} + +func (s *StepRegisterOMI) Cleanup(state multistep.StateBag) { + if s.image == nil { + return + } + + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + if !cancelled && !halted { + return + } + + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + + ui.Say("Deregistering the OMI because cancellation or error...") + deregisterOpts := oapi.DeleteImageRequest{ImageId: s.image.ImageId} + if _, err := oapiconn.POST_DeleteImage(deregisterOpts); err != nil { + ui.Error(fmt.Sprintf("Error deregistering OMI, may still be around: %s", err)) + return + } +} + +func (s *StepRegisterOMI) combineDevices(snapshotIds map[string]string) []oapi.BlockDeviceMappingImage { + devices := map[string]oapi.BlockDeviceMappingImage{} + + for _, device := range s.OMIDevices { + devices[device.DeviceName] = device + } + + // Devices in launch_block_device_mappings override any with + // the same name in ami_block_device_mappings, except for the + // one designated as the root device in ami_root_device + for _, device := range s.LaunchDevices { + snapshotId, ok := snapshotIds[device.DeviceName] + if ok { + device.Bsu.SnapshotId = snapshotId + } + if device.DeviceName == s.RootDevice.SourceDeviceName { + device.DeviceName = s.RootDevice.DeviceName + } + devices[device.DeviceName] = copyToDeviceMappingImage(device) + } + + blockDevices := []oapi.BlockDeviceMappingImage{} + for _, device := range devices { + blockDevices = append(blockDevices, device) + } + return blockDevices +} + +func copyToDeviceMappingImage(device oapi.BlockDeviceMappingVmCreation) oapi.BlockDeviceMappingImage { + deviceImage := oapi.BlockDeviceMappingImage{ + DeviceName: device.DeviceName, + VirtualDeviceName: device.VirtualDeviceName, + Bsu: oapi.BsuToCreate{ + DeleteOnVmDeletion: device.Bsu.DeleteOnVmDeletion, + Iops: device.Bsu.Iops, + SnapshotId: device.Bsu.SnapshotId, + VolumeSize: device.Bsu.VolumeSize, + VolumeType: device.Bsu.VolumeType, + }, + } + return deviceImage +} diff --git a/builder/osc/bsusurrogate/step_snapshop_volumes.go b/builder/osc/bsusurrogate/step_snapshop_volumes.go new file mode 100644 index 000000000..faf19b0a8 --- /dev/null +++ b/builder/osc/bsusurrogate/step_snapshop_volumes.go @@ -0,0 +1,107 @@ +package bsusurrogate + +import ( + "context" + "fmt" + "sync" + "time" + + multierror "github.com/hashicorp/go-multierror" + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepSnapshotVolumes creates snapshots of the created volumes. +// +// Produces: +// snapshot_ids map[string]string - IDs of the created snapshots +type StepSnapshotVolumes struct { + LaunchDevices []oapi.BlockDeviceMappingVmCreation + snapshotIds map[string]string +} + +func (s *StepSnapshotVolumes) snapshotVolume(ctx context.Context, deviceName string, state multistep.StateBag) error { + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(oapi.Vm) + + var volumeId string + for _, volume := range vm.BlockDeviceMappings { + if volume.DeviceName == deviceName { + volumeId = volume.Bsu.VolumeId + } + } + if volumeId == "" { + return fmt.Errorf("Volume ID for device %s not found", deviceName) + } + + ui.Say(fmt.Sprintf("Creating snapshot of EBS Volume %s...", volumeId)) + description := fmt.Sprintf("Packer: %s", time.Now().String()) + + createSnapResp, err := oapiconn.POST_CreateSnapshot(oapi.CreateSnapshotRequest{ + VolumeId: volumeId, + Description: description, + }) + if err != nil { + return err + } + + // Set the snapshot ID so we can delete it later + s.snapshotIds[deviceName] = createSnapResp.OK.Snapshot.SnapshotId + + // Wait for snapshot to be created + err = osccommon.WaitUntilSnapshotCompleted(oapiconn, createSnapResp.OK.Snapshot.SnapshotId) + return err +} + +func (s *StepSnapshotVolumes) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + + s.snapshotIds = map[string]string{} + + var wg sync.WaitGroup + var errs *multierror.Error + for _, device := range s.LaunchDevices { + wg.Add(1) + go func(device oapi.BlockDeviceMappingVmCreation) { + defer wg.Done() + if err := s.snapshotVolume(ctx, device.DeviceName, state); err != nil { + errs = multierror.Append(errs, err) + } + }(device) + } + + wg.Wait() + + if errs != nil { + state.Put("error", errs) + ui.Error(errs.Error()) + return multistep.ActionHalt + } + + state.Put("snapshot_ids", s.snapshotIds) + return multistep.ActionContinue +} + +func (s *StepSnapshotVolumes) Cleanup(state multistep.StateBag) { + if len(s.snapshotIds) == 0 { + return + } + + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + + if cancelled || halted { + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + ui.Say("Removing snapshots since we cancelled or halted...") + for _, snapshotId := range s.snapshotIds { + _, err := oapiconn.POST_DeleteSnapshot(oapi.DeleteSnapshotRequest{SnapshotId: snapshotId}) + if err != nil { + ui.Error(fmt.Sprintf("Error: %s", err)) + } + } + } +} diff --git a/builder/osc/bsuvolume/artifact.go b/builder/osc/bsuvolume/artifact.go new file mode 100644 index 000000000..61d92b6a2 --- /dev/null +++ b/builder/osc/bsuvolume/artifact.go @@ -0,0 +1,87 @@ +package bsuvolume + +import ( + "fmt" + "log" + "sort" + "strings" + + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// map of region to list of volume IDs +type BsuVolumes map[string][]string + +// Artifact is an artifact implementation that contains built AMIs. +type Artifact struct { + // A map of regions to EBS Volume IDs. + Volumes BsuVolumes + + // BuilderId is the unique ID for the builder that created this AMI + BuilderIdValue string + + // Client connection for performing API stuff. + Conn *oapi.Client +} + +func (a *Artifact) BuilderId() string { + return a.BuilderIdValue +} + +func (*Artifact) Files() []string { + // We have no files + return nil +} + +// returns a sorted list of region:ID pairs +func (a *Artifact) idList() []string { + parts := make([]string, 0, len(a.Volumes)) + for region, volumeIDs := range a.Volumes { + for _, volumeID := range volumeIDs { + parts = append(parts, fmt.Sprintf("%s:%s", region, volumeID)) + } + } + + sort.Strings(parts) + return parts +} + +func (a *Artifact) Id() string { + return strings.Join(a.idList(), ",") +} + +func (a *Artifact) String() string { + return fmt.Sprintf("EBS Volumes were created:\n\n%s", strings.Join(a.idList(), "\n")) +} + +func (a *Artifact) State(name string) interface{} { + return nil +} + +func (a *Artifact) Destroy() error { + errors := make([]error, 0) + + for region, volumeIDs := range a.Volumes { + for _, volumeID := range volumeIDs { + log.Printf("Deregistering Volume ID (%s) from region (%s)", volumeID, region) + + input := oapi.DeleteVolumeRequest{ + VolumeId: volumeID, + } + if _, err := a.Conn.POST_DeleteVolume(input); err != nil { + errors = append(errors, err) + } + } + } + + if len(errors) > 0 { + if len(errors) == 1 { + return errors[0] + } else { + return &packer.MultiError{Errors: errors} + } + } + + return nil +} diff --git a/builder/osc/bsuvolume/block_device.go b/builder/osc/bsuvolume/block_device.go new file mode 100644 index 000000000..3217fef7f --- /dev/null +++ b/builder/osc/bsuvolume/block_device.go @@ -0,0 +1,29 @@ +package bsuvolume + +import ( + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/template/interpolate" +) + +type BlockDevice struct { + osccommon.BlockDevice `mapstructure:"-,squash"` + Tags osccommon.TagMap `mapstructure:"tags"` +} + +func commonBlockDevices(mappings []BlockDevice, ctx *interpolate.Context) (osccommon.BlockDevices, error) { + result := make([]osccommon.BlockDevice, len(mappings)) + + for i, mapping := range mappings { + interpolateBlockDev, err := interpolate.RenderInterface(&mapping.BlockDevice, ctx) + if err != nil { + return osccommon.BlockDevices{}, err + } + result[i] = *interpolateBlockDev.(*osccommon.BlockDevice) + } + + return osccommon.BlockDevices{ + LaunchBlockDevices: osccommon.LaunchBlockDevices{ + LaunchMappings: result, + }, + }, nil +} diff --git a/builder/osc/bsuvolume/builder.go b/builder/osc/bsuvolume/builder.go new file mode 100644 index 000000000..96d5531d3 --- /dev/null +++ b/builder/osc/bsuvolume/builder.go @@ -0,0 +1,198 @@ +// The ebsvolume package contains a packer.Builder implementation that +// builds EBS volumes for Outscale using an ephemeral instance, +package bsuvolume + +import ( + "context" + "crypto/tls" + "fmt" + "log" + "net/http" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +const BuilderId = "oapi.outscale.bsuvolume" + +type Config struct { + common.PackerConfig `mapstructure:",squash"` + osccommon.AccessConfig `mapstructure:",squash"` + osccommon.RunConfig `mapstructure:",squash"` + + VolumeMappings []BlockDevice `mapstructure:"bsu_volumes"` + + launchBlockDevices osccommon.BlockDevices + ctx interpolate.Context +} + +type Builder struct { + config Config + runner multistep.Runner +} + +type EngineVarsTemplate struct { + BuildRegion string + SourceOMI string +} + +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + b.config.ctx.Funcs = osccommon.TemplateFuncs + // Create passthrough for {{ .BuildRegion }} and {{ .SourceOMI }} variables + // so we can fill them in later + b.config.ctx.Data = &EngineVarsTemplate{ + BuildRegion: `{{ .BuildRegion }}`, + SourceOMI: `{{ .SourceOMI }} `, + } + err := config.Decode(&b.config, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &b.config.ctx, + }, raws...) + if err != nil { + return nil, err + } + + // Accumulate any errors + var errs *packer.MultiError + errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.RunConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.launchBlockDevices.Prepare(&b.config.ctx)...) + + for _, d := range b.config.VolumeMappings { + if err := d.Prepare(&b.config.ctx); err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("OMIMapping: %s", err.Error())) + } + } + + b.config.launchBlockDevices, err = commonBlockDevices(b.config.VolumeMappings, &b.config.ctx) + if err != nil { + errs = packer.MultiErrorAppend(errs, err) + } + + if errs != nil && len(errs.Errors) > 0 { + return nil, errs + } + + packer.LogSecretFilter.Set(b.config.AccessKey, b.config.SecretKey, b.config.Token) + return nil, nil +} + +func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { + clientConfig, err := b.config.Config() + if err != nil { + return nil, err + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + oapiconn := oapi.NewClient(clientConfig, skipClient) + + // Setup the state bag and initial state for the steps + state := new(multistep.BasicStateBag) + state.Put("config", &b.config) + state.Put("oapi", oapiconn) + state.Put("hook", hook) + state.Put("ui", ui) + + log.Printf("[DEBUG] launch block devices %#v", b.config.launchBlockDevices) + + instanceStep := &osccommon.StepRunSourceVm{ + AssociatePublicIpAddress: b.config.AssociatePublicIpAddress, + BlockDevices: b.config.launchBlockDevices, + Comm: &b.config.RunConfig.Comm, + Ctx: b.config.ctx, + Debug: b.config.PackerDebug, + BsuOptimized: b.config.BsuOptimized, + EnableT2Unlimited: b.config.EnableT2Unlimited, + ExpectedRootDevice: "ebs", + IamVmProfile: b.config.IamVmProfile, + VmInitiatedShutdownBehavior: b.config.VmInitiatedShutdownBehavior, + VmType: b.config.VmType, + SourceOMI: b.config.SourceOmi, + Tags: b.config.RunTags, + UserData: b.config.UserData, + UserDataFile: b.config.UserDataFile, + } + + // Build the steps + steps := []multistep.Step{ + &osccommon.StepSourceOMIInfo{ + SourceOmi: b.config.SourceOmi, + OmiFilters: b.config.SourceOmiFilter, + }, + &osccommon.StepNetworkInfo{ + NetId: b.config.NetId, + NetFilter: b.config.NetFilter, + SecurityGroupIds: b.config.SecurityGroupIds, + SecurityGroupFilter: b.config.SecurityGroupFilter, + SubnetId: b.config.SubnetId, + SubnetFilter: b.config.SubnetFilter, + SubregionName: b.config.Subregion, + }, + &osccommon.StepKeyPair{ + Debug: b.config.PackerDebug, + Comm: &b.config.RunConfig.Comm, + DebugKeyPath: fmt.Sprintf("oapi_%s.pem", b.config.PackerBuildName), + }, + &osccommon.StepSecurityGroup{ + SecurityGroupFilter: b.config.SecurityGroupFilter, + SecurityGroupIds: b.config.SecurityGroupIds, + CommConfig: &b.config.RunConfig.Comm, + TemporarySGSourceCidr: b.config.TemporarySGSourceCidr, + }, + instanceStep, + &stepTagBSUVolumes{ + VolumeMapping: b.config.VolumeMappings, + Ctx: b.config.ctx, + }, + &osccommon.StepGetPassword{ + Debug: b.config.PackerDebug, + Comm: &b.config.RunConfig.Comm, + Timeout: b.config.WindowsPasswordTimeout, + BuildName: b.config.PackerBuildName, + }, + &communicator.StepConnect{ + Config: &b.config.RunConfig.Comm, + Host: osccommon.SSHHost( + oapiconn, + b.config.SSHInterface), + SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), + }, + &common.StepProvision{}, + &common.StepCleanupTempKeys{ + Comm: &b.config.RunConfig.Comm, + }, + &osccommon.StepStopBSUBackedVm{ + Skip: b.config.IsSpotVm(), + DisableStopVm: b.config.DisableStopVm, + }, + } + + // Run! + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) + b.runner.Run(ctx, state) + + // If there was an error, return that + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) + } + + // Build the artifact and return it + artifact := &Artifact{ + Volumes: state.Get("bsuvolumes").(BsuVolumes), + BuilderIdValue: BuilderId, + Conn: oapiconn, + } + ui.Say(fmt.Sprintf("Created Volumes: %s", artifact)) + return artifact, nil +} diff --git a/builder/osc/bsuvolume/builder_acc_test.go b/builder/osc/bsuvolume/builder_acc_test.go new file mode 100644 index 000000000..835ff9ba3 --- /dev/null +++ b/builder/osc/bsuvolume/builder_acc_test.go @@ -0,0 +1,86 @@ +//TODO: explain how to delete the image. +package bsuvolume + +import ( + "crypto/tls" + "net/http" + "testing" + + "github.com/hashicorp/packer/builder/osc/common" + builderT "github.com/hashicorp/packer/helper/builder/testing" + "github.com/outscale/osc-go/oapi" +) + +func TestBuilderAcc_basic(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Builder: &Builder{}, + Template: testBuilderAccBasic, + SkipArtifactTeardown: true, + }) +} + +func testAccPreCheck(t *testing.T) { +} + +func testOAPIConn() (*oapi.Client, error) { + access := &common.AccessConfig{RawRegion: "us-east-1"} + clientConfig, err := access.Config() + if err != nil { + return nil, err + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + return oapi.NewClient(clientConfig, skipClient), nil +} + +const testBuilderAccBasic = ` +{ + "builders": [ + { + "type": "test", + "region": "eu-west-2", + "vm_type": "t2.micro", + "source_omi": "ami-65efcc11", + "ssh_username": "outscale", + "bsu_volumes": [ + { + "volume_type": "gp2", + "device_name": "/dev/xvdf", + "delete_on_vm_deletion": false, + "tags": { + "zpool": "data", + "Name": "Data1" + }, + "volume_size": 10 + }, + { + "volume_type": "gp2", + "device_name": "/dev/xvdg", + "tags": { + "zpool": "data", + "Name": "Data2" + }, + "delete_on_vm_deletion": false, + "volume_size": 10 + }, + { + "volume_size": 10, + "tags": { + "Name": "Data3", + "zpool": "data" + }, + "delete_on_vm_deletion": false, + "device_name": "/dev/xvdh", + "volume_type": "gp2" + } + ] + } + ] +} +` diff --git a/builder/osc/bsuvolume/builder_test.go b/builder/osc/bsuvolume/builder_test.go new file mode 100644 index 000000000..956fba60f --- /dev/null +++ b/builder/osc/bsuvolume/builder_test.go @@ -0,0 +1,92 @@ +package bsuvolume + +import ( + "testing" + + "github.com/hashicorp/packer/packer" +) + +func testConfig() map[string]interface{} { + return map[string]interface{}{ + "access_key": "foo", + "secret_key": "bar", + "source_omi": "foo", + "vm_type": "foo", + "region": "us-east-1", + "ssh_username": "root", + } +} + +func TestBuilder_ImplementsBuilder(t *testing.T) { + var raw interface{} + raw = &Builder{} + if _, ok := raw.(packer.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_InvalidKey(t *testing.T) { + var b Builder + config := testConfig() + + // 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_InvalidShutdownBehavior(t *testing.T) { + var b Builder + config := testConfig() + + // Test good + config["shutdown_behavior"] = "terminate" + config["skip_region_validation"] = 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) + } + + // Test good + config["shutdown_behavior"] = "stop" + 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["shutdown_behavior"] = "foobar" + warnings, err = b.Prepare(config) + if len(warnings) > 0 { + t.Fatalf("bad: %#v", warnings) + } + if err == nil { + t.Fatal("should have error") + } +} diff --git a/builder/osc/bsuvolume/step_tag_bsu_volumes.go b/builder/osc/bsuvolume/step_tag_bsu_volumes.go new file mode 100644 index 000000000..c02f77112 --- /dev/null +++ b/builder/osc/bsuvolume/step_tag_bsu_volumes.go @@ -0,0 +1,81 @@ +package bsuvolume + +import ( + "context" + "fmt" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +type stepTagBSUVolumes struct { + VolumeMapping []BlockDevice + Ctx interpolate.Context +} + +func (s *stepTagBSUVolumes) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + vm := state.Get("vm").(oapi.Vm) + ui := state.Get("ui").(packer.Ui) + + volumes := make(BsuVolumes) + for _, instanceBlockDevices := range vm.BlockDeviceMappings { + for _, configVolumeMapping := range s.VolumeMapping { + if configVolumeMapping.DeviceName == instanceBlockDevices.DeviceName { + volumes[oapiconn.GetConfig().Region] = append( + volumes[oapiconn.GetConfig().Region], + instanceBlockDevices.Bsu.VolumeId) + } + } + } + state.Put("bsuvolumes", volumes) + + if len(s.VolumeMapping) > 0 { + ui.Say("Tagging BSU volumes...") + + toTag := map[string][]oapi.ResourceTag{} + for _, mapping := range s.VolumeMapping { + if len(mapping.Tags) == 0 { + ui.Say(fmt.Sprintf("No tags specified for volume on %s...", mapping.DeviceName)) + continue + } + + tags, err := mapping.Tags.OAPITags(s.Ctx, oapiconn.GetConfig().Region, state) + if err != nil { + err := fmt.Errorf("Error tagging device %s with %s", mapping.DeviceName, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + tags.Report(ui) + + for _, v := range vm.BlockDeviceMappings { + if v.DeviceName == mapping.DeviceName { + toTag[v.Bsu.VolumeId] = tags + } + } + } + + for volumeId, tags := range toTag { + _, err := oapiconn.POST_CreateTags(oapi.CreateTagsRequest{ + ResourceIds: []string{volumeId}, + Tags: tags, + }) + if err != nil { + err := fmt.Errorf("Error tagging BSU Volume %s on %s: %s", volumeId, vm.VmId, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + } + } + + return multistep.ActionContinue +} + +func (s *stepTagBSUVolumes) Cleanup(state multistep.StateBag) { + // No cleanup... +} diff --git a/builder/osc/chroot/builder.go b/builder/osc/chroot/builder.go new file mode 100644 index 000000000..ab52eba43 --- /dev/null +++ b/builder/osc/chroot/builder.go @@ -0,0 +1,309 @@ +// Package chroot is able to create an Outscale OMI without requiring +// the launch of a new instance for every build. It does this by attaching +// and mounting the root volume of another OMI and chrooting into that +// directory. It then creates an OMI from that attached drive. +package chroot + +import ( + "context" + "crypto/tls" + "errors" + "net/http" + "runtime" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +// The unique ID for this builder +const BuilderId = "oapi.outscale.chroot" + +// Config is the configuration that is chained through the steps and +// settable from the template. +type Config struct { + common.PackerConfig `mapstructure:",squash"` + osccommon.OMIBlockDevices `mapstructure:",squash"` + osccommon.OMIConfig `mapstructure:",squash"` + osccommon.AccessConfig `mapstructure:",squash"` + + ChrootMounts [][]string `mapstructure:"chroot_mounts"` + CommandWrapper string `mapstructure:"command_wrapper"` + CopyFiles []string `mapstructure:"copy_files"` + DevicePath string `mapstructure:"device_path"` + NVMEDevicePath string `mapstructure:"nvme_device_path"` + FromScratch bool `mapstructure:"from_scratch"` + MountOptions []string `mapstructure:"mount_options"` + MountPartition string `mapstructure:"mount_partition"` + MountPath string `mapstructure:"mount_path"` + PostMountCommands []string `mapstructure:"post_mount_commands"` + PreMountCommands []string `mapstructure:"pre_mount_commands"` + RootDeviceName string `mapstructure:"root_device_name"` + RootVolumeSize int64 `mapstructure:"root_volume_size"` + RootVolumeType string `mapstructure:"root_volume_type"` + SourceOMI string `mapstructure:"source_omi"` + SourceOMIFilter osccommon.OmiFilterOptions `mapstructure:"source_omi_filter"` + RootVolumeTags osccommon.TagMap `mapstructure:"root_volume_tags"` + + ctx interpolate.Context +} + +type wrappedCommandTemplate struct { + Command string +} + +type Builder struct { + config Config + runner multistep.Runner +} + +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + b.config.ctx.Funcs = osccommon.TemplateFuncs + err := config.Decode(&b.config, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &b.config.ctx, + InterpolateFilter: &interpolate.RenderFilter{ + Exclude: []string{ + "omi_description", + "snapshot_tags", + "tags", + "root_volume_tags", + "command_wrapper", + "post_mount_commands", + "pre_mount_commands", + "mount_path", + }, + }, + }, raws...) + if err != nil { + return nil, err + } + + if b.config.PackerConfig.PackerForce { + b.config.OMIForceDeregister = true + } + + // Defaults + if b.config.ChrootMounts == nil { + b.config.ChrootMounts = make([][]string, 0) + } + + if len(b.config.ChrootMounts) == 0 { + b.config.ChrootMounts = [][]string{ + {"proc", "proc", "/proc"}, + {"sysfs", "sysfs", "/sys"}, + {"bind", "/dev", "/dev"}, + {"devpts", "devpts", "/dev/pts"}, + {"binfmt_misc", "binfmt_misc", "/proc/sys/fs/binfmt_misc"}, + } + } + + // set default copy file if we're not giving our own + if b.config.CopyFiles == nil { + b.config.CopyFiles = make([]string, 0) + if !b.config.FromScratch { + b.config.CopyFiles = []string{"/etc/resolv.conf"} + } + } + + if b.config.CommandWrapper == "" { + b.config.CommandWrapper = "{{.Command}}" + } + + if b.config.MountPath == "" { + b.config.MountPath = "/mnt/packer-outscale-chroot-volumes/{{.Device}}" + } + + if b.config.MountPartition == "" { + b.config.MountPartition = "1" + } + + // Accumulate any errors or warnings + var errs *packer.MultiError + var warns []string + + errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, + b.config.OMIConfig.Prepare(&b.config.AccessConfig, &b.config.ctx)...) + + for _, mounts := range b.config.ChrootMounts { + if len(mounts) != 3 { + errs = packer.MultiErrorAppend( + errs, errors.New("Each chroot_mounts entry should be three elements.")) + break + } + } + + if b.config.FromScratch { + if b.config.SourceOMI != "" || !b.config.SourceOMIFilter.Empty() { + warns = append(warns, "source_omi and source_omi_filter are unused when from_scratch is true") + } + if b.config.RootVolumeSize == 0 { + errs = packer.MultiErrorAppend( + errs, errors.New("root_volume_size is required with from_scratch.")) + } + if len(b.config.PreMountCommands) == 0 { + errs = packer.MultiErrorAppend( + errs, errors.New("pre_mount_commands is required with from_scratch.")) + } + if b.config.OMIVirtType == "" { + errs = packer.MultiErrorAppend( + errs, errors.New("omi_virtualization_type is required with from_scratch.")) + } + if b.config.RootDeviceName == "" { + errs = packer.MultiErrorAppend( + errs, errors.New("root_device_name is required with from_scratch.")) + } + if len(b.config.OMIMappings) == 0 { + errs = packer.MultiErrorAppend( + errs, errors.New("omi_block_device_mappings is required with from_scratch.")) + } + } else { + if b.config.SourceOMI == "" && b.config.SourceOMIFilter.Empty() { + errs = packer.MultiErrorAppend( + errs, errors.New("source_omi or source_omi_filter is required.")) + } + if len(b.config.OMIMappings) != 0 { + warns = append(warns, "omi_block_device_mappings are unused when from_scratch is false") + } + if b.config.RootDeviceName != "" { + warns = append(warns, "root_device_name is unused when from_scratch is false") + } + } + + if errs != nil && len(errs.Errors) > 0 { + return warns, errs + } + + packer.LogSecretFilter.Set(b.config.AccessKey, b.config.SecretKey, b.config.Token) + return warns, nil +} + +func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { + if runtime.GOOS != "linux" { + return nil, errors.New("The outscale-chroot builder only works on Linux environments.") + } + + clientConfig, err := b.config.Config() + if err != nil { + return nil, err + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + oapiconn := oapi.NewClient(clientConfig, skipClient) + + wrappedCommand := func(command string) (string, error) { + ctx := b.config.ctx + ctx.Data = &wrappedCommandTemplate{Command: command} + return interpolate.Render(b.config.CommandWrapper, &ctx) + } + + // Setup the state bag and initial state for the steps + state := new(multistep.BasicStateBag) + state.Put("config", &b.config) + state.Put("oapi", oapiconn) + state.Put("clientConfig", clientConfig) + state.Put("hook", hook) + state.Put("ui", ui) + state.Put("wrappedCommand", CommandWrapper(wrappedCommand)) + + // Build the steps + steps := []multistep.Step{ + &osccommon.StepPreValidate{ + DestOmiName: b.config.OMIName, + ForceDeregister: b.config.OMIForceDeregister, + }, + &StepVmInfo{}, + } + + if !b.config.FromScratch { + steps = append(steps, + &osccommon.StepSourceOMIInfo{ + SourceOmi: b.config.SourceOMI, + OmiFilters: b.config.SourceOMIFilter, + OMIVirtType: b.config.OMIVirtType, + }, + &StepCheckRootDevice{}, + ) + } + + steps = append(steps, + &StepFlock{}, + &StepPrepareDevice{}, + &StepCreateVolume{ + RootVolumeType: b.config.RootVolumeType, + RootVolumeSize: b.config.RootVolumeSize, + RootVolumeTags: b.config.RootVolumeTags, + Ctx: b.config.ctx, + }, + &StepLinkVolume{}, + &StepEarlyUnflock{}, + &StepPreMountCommands{ + Commands: b.config.PreMountCommands, + }, + &StepMountDevice{ + MountOptions: b.config.MountOptions, + MountPartition: b.config.MountPartition, + }, + &StepPostMountCommands{ + Commands: b.config.PostMountCommands, + }, + &StepMountExtra{}, + &StepCopyFiles{}, + &StepChrootProvision{}, + &StepEarlyCleanup{}, + &StepSnapshot{}, + &osccommon.StepDeregisterOMI{ + AccessConfig: &b.config.AccessConfig, + ForceDeregister: b.config.OMIForceDeregister, + ForceDeleteSnapshot: b.config.OMIForceDeleteSnapshot, + OMIName: b.config.OMIName, + Regions: b.config.OMIRegions, + }, + &StepCreateOMI{ + RootVolumeSize: b.config.RootVolumeSize, + }, + &osccommon.StepUpdateOMIAttributes{ + AccountIds: b.config.OMIAccountIDs, + SnapshotAccountIds: b.config.SnapshotAccountIDs, + Ctx: b.config.ctx, + }, + &osccommon.StepCreateTags{ + Tags: b.config.OMITags, + SnapshotTags: b.config.SnapshotTags, + Ctx: b.config.ctx, + }, + ) + + // Run! + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) + b.runner.Run(ctx, state) + + // If there was an error, return that + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) + } + + // If there are no OMIs, then just return + if _, ok := state.GetOk("omis"); !ok { + return nil, nil + } + + // Build the artifact and return it + artifact := &osccommon.Artifact{ + Omis: state.Get("omis").(map[string]string), + BuilderIdValue: BuilderId, + Config: clientConfig, + } + + return artifact, nil +} diff --git a/builder/osc/chroot/cleanup.go b/builder/osc/chroot/cleanup.go new file mode 100644 index 000000000..0befac174 --- /dev/null +++ b/builder/osc/chroot/cleanup.go @@ -0,0 +1,10 @@ +package chroot + +import ( + "github.com/hashicorp/packer/helper/multistep" +) + +// Cleanup is an interface that some steps implement for early cleanup. +type Cleanup interface { + CleanupFunc(multistep.StateBag) error +} diff --git a/builder/osc/chroot/command.go b/builder/osc/chroot/command.go new file mode 100644 index 000000000..0ca55be67 --- /dev/null +++ b/builder/osc/chroot/command.go @@ -0,0 +1,15 @@ +package chroot + +import ( + "os/exec" +) + +// CommandWrapper is a type that given a command, will possibly modify that +// command in-flight. This might return an error. +type CommandWrapper func(string) (string, error) + +// ShellCommand takes a command string and returns an *exec.Cmd to execute +// it within the context of a shell (/bin/sh). +func ShellCommand(command string) *exec.Cmd { + return exec.Command("/bin/sh", "-c", command) +} diff --git a/builder/osc/chroot/communicator.go b/builder/osc/chroot/communicator.go new file mode 100644 index 000000000..c5306fe2f --- /dev/null +++ b/builder/osc/chroot/communicator.go @@ -0,0 +1,143 @@ +package chroot + +import ( + "bytes" + "context" + "fmt" + "io" + "log" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" + "syscall" + + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/packer/tmp" +) + +// Communicator is a special communicator that works by executing +// commands locally but within a chroot. +type Communicator struct { + Chroot string + CmdWrapper CommandWrapper +} + +func (c *Communicator) Start(ctx context.Context, cmd *packer.RemoteCmd) error { + // need extra escapes for the command since we're wrapping it in quotes + cmd.Command = strconv.Quote(cmd.Command) + command, err := c.CmdWrapper( + fmt.Sprintf("chroot %s /bin/sh -c %s", c.Chroot, cmd.Command)) + if err != nil { + return err + } + + localCmd := ShellCommand(command) + localCmd.Stdin = cmd.Stdin + localCmd.Stdout = cmd.Stdout + localCmd.Stderr = cmd.Stderr + log.Printf("Executing: %s %#v", localCmd.Path, localCmd.Args) + if err := localCmd.Start(); err != nil { + return err + } + + go func() { + exitStatus := 0 + if err := localCmd.Wait(); err != nil { + if exitErr, ok := err.(*exec.ExitError); ok { + exitStatus = 1 + + // There is no process-independent way to get the REAL + // exit status so we just try to go deeper. + if status, ok := exitErr.Sys().(syscall.WaitStatus); ok { + exitStatus = status.ExitStatus() + } + } + } + + log.Printf( + "Chroot execution exited with '%d': '%s'", + exitStatus, cmd.Command) + cmd.SetExited(exitStatus) + }() + + return nil +} + +func (c *Communicator) Upload(dst string, r io.Reader, fi *os.FileInfo) error { + dst = filepath.Join(c.Chroot, dst) + log.Printf("Uploading to chroot dir: %s", dst) + tf, err := tmp.File("packer-outscale-chroot") + if err != nil { + return fmt.Errorf("Error preparing shell script: %s", err) + } + defer os.Remove(tf.Name()) + + if _, err := io.Copy(tf, r); err != nil { + return err + } + + cpCmd, err := c.CmdWrapper(fmt.Sprintf("cp %s %s", tf.Name(), dst)) + if err != nil { + return err + } + + return ShellCommand(cpCmd).Run() +} + +func (c *Communicator) UploadDir(dst string, src string, exclude []string) error { + // If src ends with a trailing "/", copy from "src/." so that + // directory contents (including hidden files) are copied, but the + // directory "src" is omitted. BSD does this automatically when + // the source contains a trailing slash, but linux does not. + if src[len(src)-1] == '/' { + src = src + "." + } + + // TODO: remove any file copied if it appears in `exclude` + chrootDest := filepath.Join(c.Chroot, dst) + + log.Printf("Uploading directory '%s' to '%s'", src, chrootDest) + cpCmd, err := c.CmdWrapper(fmt.Sprintf("cp -R '%s' %s", src, chrootDest)) + if err != nil { + return err + } + + var stderr bytes.Buffer + cmd := ShellCommand(cpCmd) + cmd.Env = append(cmd.Env, "LANG=C") + cmd.Env = append(cmd.Env, os.Environ()...) + cmd.Stderr = &stderr + err = cmd.Run() + if err == nil { + return err + } + + if strings.Contains(stderr.String(), "No such file") { + // This just means that the directory was empty. Just ignore it. + return nil + } + + return err +} + +func (c *Communicator) DownloadDir(src string, dst string, exclude []string) error { + return fmt.Errorf("DownloadDir is not implemented for outscale-chroot") +} + +func (c *Communicator) Download(src string, w io.Writer) error { + src = filepath.Join(c.Chroot, src) + log.Printf("Downloading from chroot dir: %s", src) + f, err := os.Open(src) + if err != nil { + return err + } + defer f.Close() + + if _, err := io.Copy(w, f); err != nil { + return err + } + + return nil +} diff --git a/builder/osc/chroot/communicator_test.go b/builder/osc/chroot/communicator_test.go new file mode 100644 index 000000000..43995b79a --- /dev/null +++ b/builder/osc/chroot/communicator_test.go @@ -0,0 +1,15 @@ +package chroot + +import ( + "testing" + + "github.com/hashicorp/packer/packer" +) + +func TestCommunicator_ImplementsCommunicator(t *testing.T) { + var raw interface{} + raw = &Communicator{} + if _, ok := raw.(packer.Communicator); !ok { + t.Fatalf("Communicator should be a communicator") + } +} diff --git a/builder/osc/chroot/device.go b/builder/osc/chroot/device.go new file mode 100644 index 000000000..f6fec3d1f --- /dev/null +++ b/builder/osc/chroot/device.go @@ -0,0 +1,74 @@ +package chroot + +import ( + "errors" + "fmt" + "os" + "path/filepath" + "strings" +) + +// AvailableDevice finds an available device and returns it. Note that +// you should externally hold a flock or something in order to guarantee +// that this device is available across processes. +func AvailableDevice() (string, error) { + prefix, err := devicePrefix() + if err != nil { + return "", err + } + + letters := "fghijklmnop" + for _, letter := range letters { + device := fmt.Sprintf("/dev/%s%c", prefix, letter) + + // If the block device itself, i.e. /dev/sf, exists, then we + // can't use any of the numbers either. + if _, err := os.Stat(device); err == nil { + continue + } + + // To be able to build both Paravirtual and HVM images, the unnumbered + // device and the first numbered one must be available. + // E.g. /dev/xvdf and /dev/xvdf1 + numbered_device := fmt.Sprintf("%s%d", device, 1) + if _, err := os.Stat(numbered_device); err != nil { + return device, nil + } + } + + return "", errors.New("available device could not be found") +} + +// devicePrefix returns the prefix ("sd" or "xvd" or so on) of the devices +// on the system. The "vd" prefix appears on outscale images. +func devicePrefix() (string, error) { + available := []string{"sd", "xvd", "vd"} + + f, err := os.Open("/sys/block") + if err != nil { + return "", err + } + defer f.Close() + + dirs, err := f.Readdirnames(-1) + if len(dirs) > 0 { + for _, dir := range dirs { + dirBase := filepath.Base(dir) + for _, prefix := range available { + if strings.HasPrefix(dirBase, prefix) { + //for outscale. + if prefix != "xvd" { + prefix = "xvd" + } + return prefix, nil + } + } + } + } + + if err != nil { + return "", err + } + + return "", errors.New("device prefix could not be detected") +} diff --git a/builder/osc/chroot/lockfile.go b/builder/osc/chroot/lockfile.go new file mode 100644 index 000000000..1ba13e04b --- /dev/null +++ b/builder/osc/chroot/lockfile.go @@ -0,0 +1,16 @@ +// +build windows + +package chroot + +import ( + "errors" + "os" +) + +func lockFile(*os.File) error { + return errors.New("not supported on Windows") +} + +func unlockFile(f *os.File) error { + return nil +} diff --git a/builder/osc/chroot/lockfile_unix.go b/builder/osc/chroot/lockfile_unix.go new file mode 100644 index 000000000..0d0f8c8f7 --- /dev/null +++ b/builder/osc/chroot/lockfile_unix.go @@ -0,0 +1,27 @@ +// +build !windows + +package chroot + +import ( + "os" + + "golang.org/x/sys/unix" +) + +// See: http://linux.die.net/include/sys/file.h +const LOCK_EX = 2 +const LOCK_NB = 4 +const LOCK_UN = 8 + +func lockFile(f *os.File) error { + err := unix.Flock(int(f.Fd()), LOCK_EX) + if err != nil { + return err + } + + return nil +} + +func unlockFile(f *os.File) error { + return unix.Flock(int(f.Fd()), LOCK_UN) +} diff --git a/builder/osc/chroot/run_local_commands.go b/builder/osc/chroot/run_local_commands.go new file mode 100644 index 000000000..9a93f8791 --- /dev/null +++ b/builder/osc/chroot/run_local_commands.go @@ -0,0 +1,41 @@ +package chroot + +import ( + "context" + "fmt" + + sl "github.com/hashicorp/packer/common/shell-local" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" +) + +func RunLocalCommands(commands []string, wrappedCommand CommandWrapper, ictx interpolate.Context, ui packer.Ui) error { + ctx := context.TODO() + for _, rawCmd := range commands { + intCmd, err := interpolate.Render(rawCmd, &ictx) + if err != nil { + return fmt.Errorf("Error interpolating: %s", err) + } + + command, err := wrappedCommand(intCmd) + if err != nil { + return fmt.Errorf("Error wrapping command: %s", err) + } + + ui.Say(fmt.Sprintf("Executing command: %s", command)) + comm := &sl.Communicator{ + ExecuteCommand: []string{"sh", "-c", command}, + } + cmd := &packer.RemoteCmd{Command: command} + if err := cmd.RunWithUi(ctx, comm, ui); err != nil { + return fmt.Errorf("Error executing command: %s", err) + } + if cmd.ExitStatus() != 0 { + return fmt.Errorf( + "Received non-zero exit code %d from command: %s", + cmd.ExitStatus(), + command) + } + } + return nil +} diff --git a/builder/osc/chroot/step_check_root_device.go b/builder/osc/chroot/step_check_root_device.go new file mode 100644 index 000000000..da73cb5e0 --- /dev/null +++ b/builder/osc/chroot/step_check_root_device.go @@ -0,0 +1,32 @@ +package chroot + +import ( + "context" + "fmt" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepCheckRootDevice makes sure the root device on the OMI is BSU-backed. +type StepCheckRootDevice struct{} + +func (s *StepCheckRootDevice) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + image := state.Get("source_image").(oapi.Image) + ui := state.Get("ui").(packer.Ui) + + ui.Say("Checking the root device on source OMI...") + + // It must be BSU-backed otherwise the build won't work + if image.RootDeviceType != "ebs" { + err := fmt.Errorf("The root device of the source OMI must be BSU-backed.") + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepCheckRootDevice) Cleanup(multistep.StateBag) {} diff --git a/builder/osc/chroot/step_chroot_provision.go b/builder/osc/chroot/step_chroot_provision.go new file mode 100644 index 000000000..4545105b0 --- /dev/null +++ b/builder/osc/chroot/step_chroot_provision.go @@ -0,0 +1,37 @@ +package chroot + +import ( + "context" + "log" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +// StepChrootProvision provisions the instance within a chroot. +type StepChrootProvision struct { +} + +func (s *StepChrootProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + hook := state.Get("hook").(packer.Hook) + mountPath := state.Get("mount_path").(string) + ui := state.Get("ui").(packer.Ui) + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + + // Create our communicator + comm := &Communicator{ + Chroot: mountPath, + CmdWrapper: wrappedCommand, + } + + // Provision + log.Println("Running the provision hook") + if err := hook.Run(ctx, packer.HookProvision, ui, comm, nil); err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepChrootProvision) Cleanup(state multistep.StateBag) {} diff --git a/builder/osc/chroot/step_copy_files.go b/builder/osc/chroot/step_copy_files.go new file mode 100644 index 000000000..78625a8d3 --- /dev/null +++ b/builder/osc/chroot/step_copy_files.go @@ -0,0 +1,91 @@ +package chroot + +import ( + "bytes" + "context" + "fmt" + "log" + "path/filepath" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +// StepCopyFiles copies some files from the host into the chroot environment. +// +// Produces: +// copy_files_cleanup CleanupFunc - A function to clean up the copied files +// early. +type StepCopyFiles struct { + files []string +} + +func (s *StepCopyFiles) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + mountPath := state.Get("mount_path").(string) + ui := state.Get("ui").(packer.Ui) + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + stderr := new(bytes.Buffer) + + s.files = make([]string, 0, len(config.CopyFiles)) + if len(config.CopyFiles) > 0 { + ui.Say("Copying files from host to chroot...") + for _, path := range config.CopyFiles { + ui.Message(path) + chrootPath := filepath.Join(mountPath, path) + log.Printf("Copying '%s' to '%s'", path, chrootPath) + + cmdText, err := wrappedCommand(fmt.Sprintf("cp --remove-destination %s %s", path, chrootPath)) + if err != nil { + err := fmt.Errorf("Error building copy command: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + stderr.Reset() + cmd := ShellCommand(cmdText) + cmd.Stderr = stderr + if err := cmd.Run(); err != nil { + err := fmt.Errorf( + "Error copying file: %s\nnStderr: %s", err, stderr.String()) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + s.files = append(s.files, chrootPath) + } + } + + state.Put("copy_files_cleanup", s) + return multistep.ActionContinue +} + +func (s *StepCopyFiles) Cleanup(state multistep.StateBag) { + ui := state.Get("ui").(packer.Ui) + if err := s.CleanupFunc(state); err != nil { + ui.Error(err.Error()) + } +} + +func (s *StepCopyFiles) CleanupFunc(state multistep.StateBag) error { + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + if s.files != nil { + for _, file := range s.files { + log.Printf("Removing: %s", file) + localCmdText, err := wrappedCommand(fmt.Sprintf("rm -f %s", file)) + if err != nil { + return err + } + + localCmd := ShellCommand(localCmdText) + if err := localCmd.Run(); err != nil { + return err + } + } + } + + s.files = nil + return nil +} diff --git a/builder/osc/chroot/step_copy_files_test.go b/builder/osc/chroot/step_copy_files_test.go new file mode 100644 index 000000000..281613e6f --- /dev/null +++ b/builder/osc/chroot/step_copy_files_test.go @@ -0,0 +1,11 @@ +package chroot + +import "testing" + +func TestCopyFilesCleanupFunc_ImplementsCleanupFunc(t *testing.T) { + var raw interface{} + raw = new(StepCopyFiles) + if _, ok := raw.(Cleanup); !ok { + t.Fatalf("cleanup func should be a CleanupFunc") + } +} diff --git a/builder/osc/chroot/step_create_omi.go b/builder/osc/chroot/step_create_omi.go new file mode 100644 index 000000000..6d594d74d --- /dev/null +++ b/builder/osc/chroot/step_create_omi.go @@ -0,0 +1,112 @@ +package chroot + +import ( + "context" + "fmt" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepCreateOMI creates the OMI. +type StepCreateOMI struct { + RootVolumeSize int64 +} + +func (s *StepCreateOMI) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + oapiconn := state.Get("oapi").(*oapi.Client) + snapshotId := state.Get("snapshot_id").(string) + ui := state.Get("ui").(packer.Ui) + + ui.Say("Creating the OMI...") + + var ( + registerOpts oapi.CreateImageRequest + mappings []oapi.BlockDeviceMappingImage + image oapi.Image + rootDeviceName string + ) + + if config.FromScratch { + mappings = config.OMIBlockDevices.BuildOMIDevices() + rootDeviceName = config.RootDeviceName + } else { + image = state.Get("source_image").(oapi.Image) + mappings = image.BlockDeviceMappings + rootDeviceName = image.RootDeviceName + } + + newMappings := make([]oapi.BlockDeviceMappingImage, len(mappings)) + for i, device := range mappings { + newDevice := device + + //FIX: Temporary fix + gibSize := newDevice.Bsu.VolumeSize / (1024 * 1024 * 1024) + newDevice.Bsu.VolumeSize = gibSize + + if newDevice.DeviceName == rootDeviceName { + if newDevice.Bsu != (oapi.BsuToCreate{}) { + newDevice.Bsu.SnapshotId = snapshotId + } else { + newDevice.Bsu = oapi.BsuToCreate{SnapshotId: snapshotId} + } + + if config.FromScratch || s.RootVolumeSize > newDevice.Bsu.VolumeSize { + newDevice.Bsu.VolumeSize = s.RootVolumeSize + } + } + + newMappings[i] = newDevice + } + + if config.FromScratch { + registerOpts = oapi.CreateImageRequest{ + ImageName: config.OMIName, + Architecture: "x86_64", + RootDeviceName: rootDeviceName, + BlockDeviceMappings: newMappings, + } + } else { + registerOpts = buildRegisterOpts(config, image, newMappings) + } + + registerResp, err := oapiconn.POST_CreateImage(registerOpts) + if err != nil { + state.Put("error", fmt.Errorf("Error registering OMI: %s", err)) + ui.Error(state.Get("error").(error).Error()) + return multistep.ActionHalt + } + + imageID := registerResp.OK.Image.ImageId + + // Set the OMI ID in the state + ui.Say(fmt.Sprintf("OMI: %s", imageID)) + omis := make(map[string]string) + omis[oapiconn.GetConfig().Region] = imageID + state.Put("omis", omis) + + ui.Say("Waiting for OMI to become ready...") + if err := osccommon.WaitUntilImageAvailable(oapiconn, imageID); err != nil { + err := fmt.Errorf("Error waiting for OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepCreateOMI) Cleanup(state multistep.StateBag) {} + +func buildRegisterOpts(config *Config, image oapi.Image, mappings []oapi.BlockDeviceMappingImage) oapi.CreateImageRequest { + registerOpts := oapi.CreateImageRequest{ + ImageName: config.OMIName, + Architecture: image.Architecture, + RootDeviceName: image.RootDeviceName, + BlockDeviceMappings: mappings, + } + return registerOpts +} diff --git a/builder/osc/chroot/step_create_volume.go b/builder/osc/chroot/step_create_volume.go new file mode 100644 index 000000000..9e1853d3e --- /dev/null +++ b/builder/osc/chroot/step_create_volume.go @@ -0,0 +1,166 @@ +package chroot + +import ( + "context" + "errors" + "fmt" + "log" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +// StepCreateVolume creates a new volume from the snapshot of the root +// device of the OMI. +// +// Produces: +// volume_id string - The ID of the created volume +type StepCreateVolume struct { + volumeId string + RootVolumeSize int64 + RootVolumeType string + RootVolumeTags osccommon.TagMap + Ctx interpolate.Context +} + +func (s *StepCreateVolume) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + oapiconn := state.Get("oapi").(*oapi.Client) + vm := state.Get("vm").(oapi.Vm) + ui := state.Get("ui").(packer.Ui) + + var err error + + volTags, err := s.RootVolumeTags.OAPITags(s.Ctx, oapiconn.GetConfig().Region, state) + + if err != nil { + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + var createVolume *oapi.CreateVolumeRequest + if config.FromScratch { + rootVolumeType := osccommon.VolumeTypeGp2 + if s.RootVolumeType == "io1" { + err := errors.New("Cannot use io1 volume when building from scratch") + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } else if s.RootVolumeType != "" { + rootVolumeType = s.RootVolumeType + } + createVolume = &oapi.CreateVolumeRequest{ + SubregionName: vm.Placement.SubregionName, + Size: s.RootVolumeSize, + VolumeType: rootVolumeType, + } + + } else { + // Determine the root device snapshot + image := state.Get("source_image").(oapi.Image) + log.Printf("Searching for root device of the image (%s)", image.RootDeviceName) + var rootDevice *oapi.BlockDeviceMappingImage + for _, device := range image.BlockDeviceMappings { + if device.DeviceName == image.RootDeviceName { + rootDevice = &device + break + } + } + + ui.Say("Creating the root volume...") + createVolume, err = s.buildCreateVolumeInput(vm.Placement.SubregionName, rootDevice) + if err != nil { + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + log.Printf("Create args: %+v", createVolume) + + createVolumeResp, err := oapiconn.POST_CreateVolume(*createVolume) + if err != nil { + err := fmt.Errorf("Error creating root volume: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // Set the volume ID so we remember to delete it later + s.volumeId = createVolumeResp.OK.Volume.VolumeId + log.Printf("Volume ID: %s", s.volumeId) + + //Create tags for volume + if len(volTags) > 0 { + if err := osccommon.CreateTags(oapiconn, s.volumeId, ui, volTags); err != nil { + err := fmt.Errorf("Error creating tags for volume: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + // Wait for the volume to become ready + err = osccommon.WaitUntilVolumeAvailable(oapiconn, s.volumeId) + if err != nil { + err := fmt.Errorf("Error waiting for volume: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + state.Put("volume_id", s.volumeId) + return multistep.ActionContinue +} + +func (s *StepCreateVolume) Cleanup(state multistep.StateBag) { + if s.volumeId == "" { + return + } + + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + + ui.Say("Deleting the created BSU volume...") + _, err := oapiconn.POST_DeleteVolume(oapi.DeleteVolumeRequest{VolumeId: s.volumeId}) + if err != nil { + ui.Error(fmt.Sprintf("Error deleting BSU volume: %s", err)) + } +} + +func (s *StepCreateVolume) buildCreateVolumeInput(suregionName string, rootDevice *oapi.BlockDeviceMappingImage) (*oapi.CreateVolumeRequest, error) { + if rootDevice == nil { + return nil, fmt.Errorf("Couldn't find root device!") + } + + //FIX: Temporary fix + gibSize := rootDevice.Bsu.VolumeSize / (1024 * 1024 * 1024) + createVolumeInput := &oapi.CreateVolumeRequest{ + SubregionName: suregionName, + Size: gibSize, + SnapshotId: rootDevice.Bsu.SnapshotId, + VolumeType: rootDevice.Bsu.VolumeType, + Iops: rootDevice.Bsu.Iops, + } + if s.RootVolumeSize > rootDevice.Bsu.VolumeSize { + createVolumeInput.Size = s.RootVolumeSize + } + + if s.RootVolumeType == "" || s.RootVolumeType == rootDevice.Bsu.VolumeType { + return createVolumeInput, nil + } + + if s.RootVolumeType == "io1" { + return nil, fmt.Errorf("Root volume type cannot be io1, because existing root volume type was %s", rootDevice.Bsu.VolumeType) + } + + createVolumeInput.VolumeType = s.RootVolumeType + // non io1 cannot set iops + createVolumeInput.Iops = 0 + + return createVolumeInput, nil +} diff --git a/builder/osc/chroot/step_early_cleanup.go b/builder/osc/chroot/step_early_cleanup.go new file mode 100644 index 000000000..42d7d66c5 --- /dev/null +++ b/builder/osc/chroot/step_early_cleanup.go @@ -0,0 +1,39 @@ +package chroot + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +// StepEarlyCleanup performs some of the cleanup steps early in order to +// prepare for snapshotting and creating an AMI. +type StepEarlyCleanup struct{} + +func (s *StepEarlyCleanup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + cleanupKeys := []string{ + "copy_files_cleanup", + "mount_extra_cleanup", + "mount_device_cleanup", + "attach_cleanup", + } + + for _, key := range cleanupKeys { + c := state.Get(key).(Cleanup) + log.Printf("Running cleanup func: %s", key) + if err := c.CleanupFunc(state); err != nil { + err := fmt.Errorf("Error cleaning up: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + return multistep.ActionContinue +} + +func (s *StepEarlyCleanup) Cleanup(state multistep.StateBag) {} diff --git a/builder/osc/chroot/step_early_unflock.go b/builder/osc/chroot/step_early_unflock.go new file mode 100644 index 000000000..b16becc61 --- /dev/null +++ b/builder/osc/chroot/step_early_unflock.go @@ -0,0 +1,30 @@ +package chroot + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +// StepEarlyUnflock unlocks the flock. +type StepEarlyUnflock struct{} + +func (s *StepEarlyUnflock) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + cleanup := state.Get("flock_cleanup").(Cleanup) + ui := state.Get("ui").(packer.Ui) + + log.Println("Unlocking file lock...") + if err := cleanup.CleanupFunc(state); err != nil { + err := fmt.Errorf("Error unlocking file lock: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepEarlyUnflock) Cleanup(state multistep.StateBag) {} diff --git a/builder/osc/chroot/step_flock.go b/builder/osc/chroot/step_flock.go new file mode 100644 index 000000000..f3fd9d29e --- /dev/null +++ b/builder/osc/chroot/step_flock.go @@ -0,0 +1,74 @@ +package chroot + +import ( + "context" + "fmt" + "log" + "os" + "path/filepath" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +// StepFlock provisions the instance within a chroot. +// +// Produces: +// flock_cleanup Cleanup - To perform early cleanup +type StepFlock struct { + fh *os.File +} + +func (s *StepFlock) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + + lockfile := "/var/lock/packer-chroot/lock" + if err := os.MkdirAll(filepath.Dir(lockfile), 0755); err != nil { + err := fmt.Errorf("Error creating lock: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + log.Printf("Obtaining lock: %s", lockfile) + f, err := os.Create(lockfile) + if err != nil { + err := fmt.Errorf("Error creating lock: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // LOCK! + if err := lockFile(f); err != nil { + err := fmt.Errorf("Error obtaining lock: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // Set the file handle, we can't close it because we need to hold + // the lock. + s.fh = f + + state.Put("flock_cleanup", s) + return multistep.ActionContinue +} + +func (s *StepFlock) Cleanup(state multistep.StateBag) { + s.CleanupFunc(state) +} + +func (s *StepFlock) CleanupFunc(state multistep.StateBag) error { + if s.fh == nil { + return nil + } + + log.Printf("Unlocking: %s", s.fh.Name()) + if err := unlockFile(s.fh); err != nil { + return err + } + + s.fh = nil + return nil +} diff --git a/builder/osc/chroot/step_link_volume.go b/builder/osc/chroot/step_link_volume.go new file mode 100644 index 000000000..f30b7803c --- /dev/null +++ b/builder/osc/chroot/step_link_volume.go @@ -0,0 +1,96 @@ +package chroot + +import ( + "context" + "fmt" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepLinkVolume attaches the previously created volume to an +// available device location. +// +// Produces: +// device string - The location where the volume was attached. +// attach_cleanup CleanupFunc +type StepLinkVolume struct { + attached bool + volumeId string +} + +func (s *StepLinkVolume) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + device := state.Get("device").(string) + vm := state.Get("vm").(oapi.Vm) + ui := state.Get("ui").(packer.Ui) + volumeId := state.Get("volume_id").(string) + + // For the API call, it expects "sd" prefixed devices. + //linkVolume := strings.Replace(device, "/xvd", "/sd", 1) + linkVolume := device + + ui.Say(fmt.Sprintf("Attaching the root volume to %s", linkVolume)) + _, err := oapiconn.POST_LinkVolume(oapi.LinkVolumeRequest{ + VmId: vm.VmId, + VolumeId: volumeId, + DeviceName: linkVolume, + }) + + if err != nil { + err := fmt.Errorf("Error attaching volume: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // Mark that we attached it so we can detach it later + s.attached = true + s.volumeId = volumeId + + // Wait for the volume to become attached + err = osccommon.WaitUntilVolumeIsLinked(oapiconn, s.volumeId) + if err != nil { + err := fmt.Errorf("Error waiting for volume: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + state.Put("attach_cleanup", s) + return multistep.ActionContinue +} + +func (s *StepLinkVolume) Cleanup(state multistep.StateBag) { + ui := state.Get("ui").(packer.Ui) + if err := s.CleanupFunc(state); err != nil { + ui.Error(err.Error()) + } +} + +func (s *StepLinkVolume) CleanupFunc(state multistep.StateBag) error { + if !s.attached { + return nil + } + + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + + ui.Say("Detaching BSU volume...") + _, err := oapiconn.POST_UnlinkVolume(oapi.UnlinkVolumeRequest{VolumeId: s.volumeId}) + if err != nil { + return fmt.Errorf("Error detaching BSU volume: %s", err) + } + + s.attached = false + + // Wait for the volume to detach + err = osccommon.WaitUntilVolumeIsUnlinked(oapiconn, s.volumeId) + if err != nil { + return fmt.Errorf("Error waiting for volume: %s", err) + } + + return nil +} diff --git a/builder/osc/chroot/step_mount_device.go b/builder/osc/chroot/step_mount_device.go new file mode 100644 index 000000000..5a27c1403 --- /dev/null +++ b/builder/osc/chroot/step_mount_device.go @@ -0,0 +1,183 @@ +package chroot + +import ( + "bytes" + "context" + "fmt" + "log" + "os" + "path/filepath" + "strings" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" +) + +type mountPathData struct { + Device string +} + +// StepMountDevice mounts the attached device. +// +// Produces: +// mount_path string - The location where the volume was mounted. +// mount_device_cleanup CleanupFunc - To perform early cleanup +type StepMountDevice struct { + MountOptions []string + MountPartition string + + mountPath string +} + +func (s *StepMountDevice) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + ui := state.Get("ui").(packer.Ui) + device := state.Get("device").(string) + if config.NVMEDevicePath != "" { + // customizable device path for mounting NVME block devices on c5 and m5 HVM + device = config.NVMEDevicePath + } + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + + var virtualizationType string + if config.FromScratch { + virtualizationType = config.OMIVirtType + } else { + //image := state.Get("source_image").(oapi.Image) + + //Is always hvm + virtualizationType = "hvm" + log.Printf("Source image virtualization type is: %s", virtualizationType) + } + + ctx := config.ctx + + ctx.Data = &mountPathData{Device: filepath.Base(device)} + mountPath, err := interpolate.Render(config.MountPath, &ctx) + + if err != nil { + err := fmt.Errorf("Error preparing mount directory: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + mountPath, err = filepath.Abs(mountPath) + if err != nil { + err := fmt.Errorf("Error preparing mount directory: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + log.Printf("[DEBUG] Device: %s", device) + log.Printf("[DEBUG] Mount path: %s", mountPath) + + if err := os.MkdirAll(mountPath, 0755); err != nil { + err := fmt.Errorf("Error creating mount directory: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + //Check the symbolic link for the device to get the real device name + cmd := ShellCommand(fmt.Sprintf("lsblk -no pkname $(readlink -f %s)", device)) + + realDeviceName, err := cmd.Output() + if err != nil { + err := fmt.Errorf( + "Error retrieving the symlink of the device %s.\n", device) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + log.Printf("[DEBUG] RealDeviceName: %s", realDeviceName) + + realDeviceNameSplitted := strings.Split(string(realDeviceName), "\n") + log.Printf("[DEBUG] RealDeviceName Splitted %+v", realDeviceNameSplitted) + log.Printf("[DEBUG] RealDeviceName Splitted Length %d", len(realDeviceNameSplitted)) + log.Printf("[DEBUG] RealDeviceName Splitted [0] %s", realDeviceNameSplitted[0]) + log.Printf("[DEBUG] RealDeviceName Splitted [1] %s", realDeviceNameSplitted[1]) + + realDeviceNameStr := realDeviceNameSplitted[0] + if realDeviceNameStr == "" { + realDeviceNameStr = realDeviceNameSplitted[1] + } + + deviceMount := fmt.Sprintf("/dev/%s", strings.Replace(realDeviceNameStr, "\n", "", -1)) + + log.Printf("[DEBUG] s.MountPartition = %s", s.MountPartition) + log.Printf("[DEBUG ] DeviceMount: %s", deviceMount) + + if virtualizationType == "hvm" && s.MountPartition != "0" { + deviceMount = fmt.Sprintf("%s%s", deviceMount, s.MountPartition) + } + state.Put("deviceMount", deviceMount) + + ui.Say("Mounting the root device...") + stderr := new(bytes.Buffer) + + // build mount options from mount_options config, useful for nouuid options + // or other specific device type settings for mount + opts := "" + if len(s.MountOptions) > 0 { + opts = "-o " + strings.Join(s.MountOptions, " -o ") + } + mountCommand, err := wrappedCommand( + fmt.Sprintf("mount %s %s %s", opts, deviceMount, mountPath)) + if err != nil { + err := fmt.Errorf("Error creating mount command: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + log.Printf("[DEBUG] (step mount) mount command is %s", mountCommand) + cmd = ShellCommand(mountCommand) + cmd.Stderr = stderr + if err := cmd.Run(); err != nil { + err := fmt.Errorf( + "Error mounting root volume: %s\nStderr: %s", err, stderr.String()) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // Set the mount path so we remember to unmount it later + s.mountPath = mountPath + state.Put("mount_path", s.mountPath) + state.Put("mount_device_cleanup", s) + + return multistep.ActionContinue +} + +func (s *StepMountDevice) Cleanup(state multistep.StateBag) { + ui := state.Get("ui").(packer.Ui) + if err := s.CleanupFunc(state); err != nil { + ui.Error(err.Error()) + } +} + +func (s *StepMountDevice) CleanupFunc(state multistep.StateBag) error { + if s.mountPath == "" { + return nil + } + + ui := state.Get("ui").(packer.Ui) + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + + ui.Say("Unmounting the root device...") + unmountCommand, err := wrappedCommand(fmt.Sprintf("umount %s", s.mountPath)) + if err != nil { + return fmt.Errorf("Error creating unmount command: %s", err) + } + + cmd := ShellCommand(unmountCommand) + if err := cmd.Run(); err != nil { + return fmt.Errorf("Error unmounting root device: %s", err) + } + + s.mountPath = "" + return nil +} diff --git a/builder/osc/chroot/step_mount_extra.go b/builder/osc/chroot/step_mount_extra.go new file mode 100644 index 000000000..089bf7e75 --- /dev/null +++ b/builder/osc/chroot/step_mount_extra.go @@ -0,0 +1,137 @@ +package chroot + +import ( + "bytes" + "context" + "fmt" + "os" + "os/exec" + "syscall" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +// StepMountExtra mounts the attached device. +// +// Produces: +// mount_extra_cleanup CleanupFunc - To perform early cleanup +type StepMountExtra struct { + mounts []string +} + +func (s *StepMountExtra) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + mountPath := state.Get("mount_path").(string) + ui := state.Get("ui").(packer.Ui) + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + + s.mounts = make([]string, 0, len(config.ChrootMounts)) + + ui.Say("Mounting additional paths within the chroot...") + for _, mountInfo := range config.ChrootMounts { + innerPath := mountPath + mountInfo[2] + + if err := os.MkdirAll(innerPath, 0755); err != nil { + err := fmt.Errorf("Error creating mount directory: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + flags := "-t " + mountInfo[0] + if mountInfo[0] == "bind" { + flags = "--bind" + } + + ui.Message(fmt.Sprintf("Mounting: %s", mountInfo[2])) + stderr := new(bytes.Buffer) + mountCommand, err := wrappedCommand(fmt.Sprintf( + "mount %s %s %s", + flags, + mountInfo[1], + innerPath)) + if err != nil { + err := fmt.Errorf("Error creating mount command: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + cmd := ShellCommand(mountCommand) + cmd.Stderr = stderr + if err := cmd.Run(); err != nil { + err := fmt.Errorf( + "Error mounting: %s\nStderr: %s", err, stderr.String()) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + s.mounts = append(s.mounts, innerPath) + } + + state.Put("mount_extra_cleanup", s) + return multistep.ActionContinue +} + +func (s *StepMountExtra) Cleanup(state multistep.StateBag) { + ui := state.Get("ui").(packer.Ui) + + if err := s.CleanupFunc(state); err != nil { + ui.Error(err.Error()) + return + } +} + +func (s *StepMountExtra) CleanupFunc(state multistep.StateBag) error { + if s.mounts == nil { + return nil + } + + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + for len(s.mounts) > 0 { + var path string + lastIndex := len(s.mounts) - 1 + path, s.mounts = s.mounts[lastIndex], s.mounts[:lastIndex] + + grepCommand, err := wrappedCommand(fmt.Sprintf("grep %s /proc/mounts", path)) + if err != nil { + return fmt.Errorf("Error creating grep command: %s", err) + } + + // Before attempting to unmount, + // check to see if path is already unmounted + stderr := new(bytes.Buffer) + cmd := ShellCommand(grepCommand) + cmd.Stderr = stderr + if err := cmd.Run(); err != nil { + if exitError, ok := err.(*exec.ExitError); ok { + if status, ok := exitError.Sys().(syscall.WaitStatus); ok { + exitStatus := status.ExitStatus() + if exitStatus == 1 { + // path has already been unmounted + // just skip this path + continue + } + } + } + } + + unmountCommand, err := wrappedCommand(fmt.Sprintf("umount %s", path)) + if err != nil { + return fmt.Errorf("Error creating unmount command: %s", err) + } + + stderr = new(bytes.Buffer) + cmd = ShellCommand(unmountCommand) + cmd.Stderr = stderr + if err := cmd.Run(); err != nil { + return fmt.Errorf( + "Error unmounting device: %s\nStderr: %s", err, stderr.String()) + } + } + + s.mounts = nil + return nil +} diff --git a/builder/osc/chroot/step_post_mount_commands.go b/builder/osc/chroot/step_post_mount_commands.go new file mode 100644 index 000000000..704af428f --- /dev/null +++ b/builder/osc/chroot/step_post_mount_commands.go @@ -0,0 +1,47 @@ +package chroot + +import ( + "context" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type postMountCommandsData struct { + Device string + MountPath string +} + +// StepPostMountCommands allows running arbitrary commands after mounting the +// device, but prior to the bind mount and copy steps. +type StepPostMountCommands struct { + Commands []string +} + +func (s *StepPostMountCommands) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + device := state.Get("device").(string) + mountPath := state.Get("mount_path").(string) + ui := state.Get("ui").(packer.Ui) + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + + if len(s.Commands) == 0 { + return multistep.ActionContinue + } + + ictx := config.ctx + ictx.Data = &postMountCommandsData{ + Device: device, + MountPath: mountPath, + } + + ui.Say("Running post-mount commands...") + if err := RunLocalCommands(s.Commands, wrappedCommand, ictx, ui); err != nil { + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + return multistep.ActionContinue +} + +func (s *StepPostMountCommands) Cleanup(state multistep.StateBag) {} diff --git a/builder/osc/chroot/step_pre_mount_commands.go b/builder/osc/chroot/step_pre_mount_commands.go new file mode 100644 index 000000000..9a60256fe --- /dev/null +++ b/builder/osc/chroot/step_pre_mount_commands.go @@ -0,0 +1,41 @@ +package chroot + +import ( + "context" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type preMountCommandsData struct { + Device string +} + +// StepPreMountCommands sets up the a new block device when building from scratch +type StepPreMountCommands struct { + Commands []string +} + +func (s *StepPreMountCommands) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + device := state.Get("device").(string) + ui := state.Get("ui").(packer.Ui) + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + + if len(s.Commands) == 0 { + return multistep.ActionContinue + } + + ictx := config.ctx + ictx.Data = &preMountCommandsData{Device: device} + + ui.Say("Running device setup commands...") + if err := RunLocalCommands(s.Commands, wrappedCommand, ictx, ui); err != nil { + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + return multistep.ActionContinue +} + +func (s *StepPreMountCommands) Cleanup(state multistep.StateBag) {} diff --git a/builder/osc/chroot/step_prepare_device.go b/builder/osc/chroot/step_prepare_device.go new file mode 100644 index 000000000..0939d33cd --- /dev/null +++ b/builder/osc/chroot/step_prepare_device.go @@ -0,0 +1,46 @@ +package chroot + +import ( + "context" + "fmt" + "log" + "os" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +// StepPrepareDevice finds an available device and sets it. +type StepPrepareDevice struct { +} + +func (s *StepPrepareDevice) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + ui := state.Get("ui").(packer.Ui) + + device := config.DevicePath + if device == "" { + var err error + log.Println("Device path not specified, searching for available device...") + device, err = AvailableDevice() + if err != nil { + err := fmt.Errorf("Error finding available device: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + if _, err := os.Stat(device); err == nil { + err := fmt.Errorf("Device is in use: %s", device) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + log.Printf("Device: %s", device) + state.Put("device", device) + return multistep.ActionContinue +} + +func (s *StepPrepareDevice) Cleanup(state multistep.StateBag) {} diff --git a/builder/osc/chroot/step_snapshot.go b/builder/osc/chroot/step_snapshot.go new file mode 100644 index 000000000..3df493728 --- /dev/null +++ b/builder/osc/chroot/step_snapshot.go @@ -0,0 +1,81 @@ +package chroot + +import ( + "context" + "fmt" + "time" + + osccommon "github.com/hashicorp/packer/builder/osc/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepSnapshot creates a snapshot of the created volume. +// +// Produces: +// snapshot_id string - ID of the created snapshot +type StepSnapshot struct { + snapshotId string +} + +func (s *StepSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + volumeId := state.Get("volume_id").(string) + + ui.Say("Creating snapshot...") + description := fmt.Sprintf("Packer: %s", time.Now().String()) + + createSnapResp, err := oapiconn.POST_CreateSnapshot(oapi.CreateSnapshotRequest{ + VolumeId: volumeId, + Description: description, + }) + if err != nil { + err := fmt.Errorf("Error creating snapshot: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // Set the snapshot ID so we can delete it later + s.snapshotId = createSnapResp.OK.Snapshot.SnapshotId + ui.Message(fmt.Sprintf("Snapshot ID: %s", s.snapshotId)) + + // Wait for the snapshot to be ready + err = osccommon.WaitUntilSnapshotDone(oapiconn, s.snapshotId) + if err != nil { + err := fmt.Errorf("Error waiting for snapshot: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + state.Put("snapshot_id", s.snapshotId) + + snapshots := map[string][]string{ + oapiconn.GetConfig().Region: {s.snapshotId}, + } + state.Put("snapshots", snapshots) + + return multistep.ActionContinue +} + +func (s *StepSnapshot) Cleanup(state multistep.StateBag) { + if s.snapshotId == "" { + return + } + + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + + if cancelled || halted { + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + ui.Say("Removing snapshot since we cancelled or halted...") + _, err := oapiconn.POST_DeleteSnapshot(oapi.DeleteSnapshotRequest{SnapshotId: s.snapshotId}) + if err != nil { + ui.Error(fmt.Sprintf("Error: %s", err)) + } + } +} diff --git a/builder/osc/chroot/step_vm_info.go b/builder/osc/chroot/step_vm_info.go new file mode 100644 index 000000000..0104e2f48 --- /dev/null +++ b/builder/osc/chroot/step_vm_info.go @@ -0,0 +1,64 @@ +package chroot + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepVmInfo verifies that this builder is running on an Outscale vm. +type StepVmInfo struct{} + +func (s *StepVmInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + //session := state.Get("clientConfig").(*session.Session) + ui := state.Get("ui").(packer.Ui) + + // Get our own vm ID + ui.Say("Gathering information about this Outscale vm...") + + cmd := ShellCommand("curl http://169.254.169.254/latest/meta-data/instance-id") + + vmID, err := cmd.Output() + if err != nil { + err := fmt.Errorf( + "Error retrieving the ID of the vm Packer is running on.\n" + + "Please verify Packer is running on a proper Outscale vm.") + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + log.Printf("[Debug] VmID got: %s", string(vmID)) + + // Query the entire vm metadata + resp, err := oapiconn.POST_ReadVms(oapi.ReadVmsRequest{Filters: oapi.FiltersVm{ + VmIds: []string{string(vmID)}, + }}) + if err != nil { + err := fmt.Errorf("Error getting vm data: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + vmsResp := resp.OK + + if len(vmsResp.Vms) == 0 { + err := fmt.Errorf("Error getting vm data: no vm found.") + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + vm := vmsResp.Vms[0] + state.Put("vm", vm) + + return multistep.ActionContinue +} + +func (s *StepVmInfo) Cleanup(multistep.StateBag) {} diff --git a/builder/osc/common/access_config.go b/builder/osc/common/access_config.go new file mode 100644 index 000000000..c5bfabddf --- /dev/null +++ b/builder/osc/common/access_config.go @@ -0,0 +1,106 @@ +package common + +import ( + "crypto/tls" + "fmt" + "log" + "net/http" + "os" + + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +// AccessConfig is for common configuration related to Outscale API access +type AccessConfig struct { + AccessKey string `mapstructure:"access_key"` + CustomEndpointOAPI string `mapstructure:"custom_endpoint_oapi"` + InsecureSkipTLSVerify bool `mapstructure:"insecure_skip_tls_verify"` + MFACode string `mapstructure:"mfa_code"` + ProfileName string `mapstructure:"profile"` + RawRegion string `mapstructure:"region"` + SecretKey string `mapstructure:"secret_key"` + SkipValidation bool `mapstructure:"skip_region_validation"` + SkipMetadataApiCheck bool `mapstructure:"skip_metadata_api_check"` + Token string `mapstructure:"token"` + clientConfig *oapi.Config + + getOAPIConnection func() oapi.OAPIClient +} + +// Config returns a valid oapi.Config object for access to Outscale services, or +// an error if the authentication and region couldn't be resolved +func (c *AccessConfig) Config() (*oapi.Config, error) { + if c.clientConfig != nil { + return c.clientConfig, nil + } + + //Check env variables if access configuration is not set. + + if c.AccessKey == "" { + c.AccessKey = os.Getenv("OUTSCALE_ACCESSKEYID") + } + + if c.SecretKey == "" { + c.SecretKey = os.Getenv("OUTSCALE_SECRETKEYID") + } + + if c.RawRegion == "" { + c.RawRegion = os.Getenv("OUTSCALE_REGION") + } + + if c.CustomEndpointOAPI == "" { + c.CustomEndpointOAPI = os.Getenv("OUTSCALE_OAPI_URL") + } + + if c.CustomEndpointOAPI == "" { + c.CustomEndpointOAPI = "outscale.com/oapi/latest" + } + + config := &oapi.Config{ + AccessKey: c.AccessKey, + SecretKey: c.SecretKey, + Region: c.RawRegion, + URL: c.CustomEndpointOAPI, + Service: "api", + } + + return config, nil + +} + +func (c *AccessConfig) NewOAPIConnection() (oapi.OAPIClient, error) { + if c.getOAPIConnection != nil { + return c.getOAPIConnection(), nil + } + oapicfg, err := c.Config() + if err != nil { + return nil, err + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: c.InsecureSkipTLSVerify}, + }, + } + + oapiClient := oapi.NewClient(oapicfg, skipClient) + + return oapiClient, nil +} + +func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error { + var errs []error + + if c.SkipMetadataApiCheck { + log.Println("(WARN) skip_metadata_api_check ignored.") + } + // Either both access and secret key must be set or neither of them should + // be. + if (len(c.AccessKey) > 0) != (len(c.SecretKey) > 0) { + errs = append(errs, + fmt.Errorf("`access_key` and `secret_key` must both be either set or not set.")) + } + + return errs +} diff --git a/builder/osc/common/access_config_test.go b/builder/osc/common/access_config_test.go new file mode 100644 index 000000000..71de1c446 --- /dev/null +++ b/builder/osc/common/access_config_test.go @@ -0,0 +1,66 @@ +package common + +import ( + "testing" + + "github.com/outscale/osc-go/oapi" +) + +type mockOAPIClient struct { + oapi.OAPIClient +} + +func testAccessConfig() *AccessConfig { + return &AccessConfig{ + getOAPIConnection: func() oapi.OAPIClient { + return &mockOAPIClient{} + }, + } +} + +func (m *mockOAPIClient) POST_ReadRegions(oapi.ReadRegionsRequest) (*oapi.POST_ReadRegionsResponses, error) { + return &oapi.POST_ReadRegionsResponses{ + OK: &oapi.ReadRegionsResponse{ + Regions: []oapi.Region{ + {RegionEndpoint: "us-west1", RegionName: "us-west1"}, + {RegionEndpoint: "us-east-1", RegionName: "us-east-1"}, + }, + }, + }, nil +} + +func TestAccessConfigPrepare_Region(t *testing.T) { + c := testAccessConfig() + + c.RawRegion = "us-east-12" + err := c.ValidateRegion(c.RawRegion) + if err == nil { + t.Fatalf("should have region validation err: %s", c.RawRegion) + } + + c.RawRegion = "us-east-1" + err = c.ValidateRegion(c.RawRegion) + if err != nil { + t.Fatalf("shouldn't have region validation err: %s", c.RawRegion) + } + + c.RawRegion = "custom" + err = c.ValidateRegion(c.RawRegion) + if err == nil { + t.Fatalf("should have region validation err: %s", c.RawRegion) + } + + c.RawRegion = "custom" + c.SkipValidation = true + // testing whole prepare func here; this is checking that validation is + // skipped, so we don't need a mock connection + if err := c.Prepare(nil); err != nil { + t.Fatalf("shouldn't have err: %s", err) + } + + c.SkipValidation = false + c.RawRegion = "" + if err := c.Prepare(nil); err != nil { + t.Fatalf("shouldn't have err: %s", err) + } +} diff --git a/builder/osc/common/artifact.go b/builder/osc/common/artifact.go new file mode 100644 index 000000000..3fe329891 --- /dev/null +++ b/builder/osc/common/artifact.go @@ -0,0 +1,135 @@ +package common + +import ( + "crypto/tls" + "fmt" + "log" + "net/http" + "sort" + "strings" + + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// Artifact is an artifact implementation that contains built OMIs. +type Artifact struct { + // A map of regions to OMI IDs. + Omis map[string]string + + // BuilderId is the unique ID for the builder that created this OMI + BuilderIdValue string + + // OAPI connection for performing API stuff. + Config *oapi.Config +} + +func (a *Artifact) BuilderId() string { + return a.BuilderIdValue +} + +func (*Artifact) Files() []string { + // We have no files + return nil +} + +func (a *Artifact) Id() string { + parts := make([]string, 0, len(a.Omis)) + for region, amiId := range a.Omis { + parts = append(parts, fmt.Sprintf("%s:%s", region, amiId)) + } + + sort.Strings(parts) + return strings.Join(parts, ",") +} + +func (a *Artifact) String() string { + amiStrings := make([]string, 0, len(a.Omis)) + for region, id := range a.Omis { + single := fmt.Sprintf("%s: %s", region, id) + amiStrings = append(amiStrings, single) + } + + sort.Strings(amiStrings) + return fmt.Sprintf("OMIs were created:\n%s\n", strings.Join(amiStrings, "\n")) +} + +func (a *Artifact) State(name string) interface{} { + switch name { + case "atlas.artifact.metadata": + return a.stateAtlasMetadata() + default: + return nil + } +} + +func (a *Artifact) Destroy() error { + errors := make([]error, 0) + + for region, imageId := range a.Omis { + log.Printf("Deregistering image ID (%s) from region (%s)", imageId, region) + + newConfig := &oapi.Config{ + UserAgent: a.Config.UserAgent, + AccessKey: a.Config.AccessKey, + SecretKey: a.Config.SecretKey, + Service: a.Config.Service, + Region: region, //New region + URL: a.Config.URL, + } + + log.Printf("[DEBUG] New Client config %+v", newConfig) + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + regionConn := oapi.NewClient(newConfig, skipClient) + + // Get image metadata + imageResp, err := regionConn.POST_ReadImages(oapi.ReadImagesRequest{ + Filters: oapi.FiltersImage{ + ImageIds: []string{imageId}, + }, + }) + if err != nil { + errors = append(errors, err) + } + if len(imageResp.OK.Images) == 0 { + err := fmt.Errorf("Error retrieving details for OMI (%s), no images found", imageId) + errors = append(errors, err) + } + + // Deregister ami + input := oapi.DeleteImageRequest{ + ImageId: imageId, + } + if _, err := regionConn.POST_DeleteImage(input); err != nil { + errors = append(errors, err) + } + + // TODO: Delete the snapshots associated with an OMI too + } + + if len(errors) > 0 { + if len(errors) == 1 { + return errors[0] + } else { + return &packer.MultiError{Errors: errors} + } + } + + return nil +} + +func (a *Artifact) stateAtlasMetadata() interface{} { + metadata := make(map[string]string) + for region, imageId := range a.Omis { + k := fmt.Sprintf("region.%s", region) + metadata[k] = imageId + } + + return metadata +} diff --git a/builder/osc/common/block_device.go b/builder/osc/common/block_device.go new file mode 100644 index 000000000..3f72076d5 --- /dev/null +++ b/builder/osc/common/block_device.go @@ -0,0 +1,154 @@ +package common + +import ( + "fmt" + "log" + "strings" + + "github.com/aws/aws-sdk-go/aws" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +// BlockDevice +type BlockDevice struct { + DeleteOnVmDeletion bool `mapstructure:"delete_on_vm_deletion"` + DeviceName string `mapstructure:"device_name"` + IOPS int64 `mapstructure:"iops"` + NoDevice bool `mapstructure:"no_device"` + SnapshotId string `mapstructure:"snapshot_id"` + VirtualName string `mapstructure:"virtual_name"` + VolumeType string `mapstructure:"volume_type"` + VolumeSize int64 `mapstructure:"volume_size"` +} + +type BlockDevices struct { + OMIBlockDevices `mapstructure:",squash"` + LaunchBlockDevices `mapstructure:",squash"` +} + +type OMIBlockDevices struct { + OMIMappings []BlockDevice `mapstructure:"omi_block_device_mappings"` +} + +type LaunchBlockDevices struct { + LaunchMappings []BlockDevice `mapstructure:"launch_block_device_mappings"` +} + +func buildBlockDevicesImage(b []BlockDevice) []oapi.BlockDeviceMappingImage { + var blockDevices []oapi.BlockDeviceMappingImage + + for _, blockDevice := range b { + mapping := oapi.BlockDeviceMappingImage{ + DeviceName: blockDevice.DeviceName, + } + + if blockDevice.VirtualName != "" { + if strings.HasPrefix(blockDevice.VirtualName, "ephemeral") { + mapping.VirtualDeviceName = blockDevice.VirtualName + } + } else { + bsu := oapi.BsuToCreate{ + DeleteOnVmDeletion: aws.Bool(blockDevice.DeleteOnVmDeletion), + } + + if blockDevice.VolumeType != "" { + bsu.VolumeType = blockDevice.VolumeType + } + + if blockDevice.VolumeSize > 0 { + bsu.VolumeSize = blockDevice.VolumeSize + } + + // IOPS is only valid for io1 type + if blockDevice.VolumeType == "io1" { + bsu.Iops = blockDevice.IOPS + } + + if blockDevice.SnapshotId != "" { + bsu.SnapshotId = blockDevice.SnapshotId + } + + mapping.Bsu = bsu + } + + blockDevices = append(blockDevices, mapping) + } + return blockDevices +} + +func buildBlockDevicesVmCreation(b []BlockDevice) []oapi.BlockDeviceMappingVmCreation { + log.Printf("[DEBUG] Launch Block Device %#v", b) + + var blockDevices []oapi.BlockDeviceMappingVmCreation + + for _, blockDevice := range b { + mapping := oapi.BlockDeviceMappingVmCreation{ + DeviceName: blockDevice.DeviceName, + } + + if blockDevice.NoDevice { + mapping.NoDevice = "" + } else if blockDevice.VirtualName != "" { + if strings.HasPrefix(blockDevice.VirtualName, "ephemeral") { + mapping.VirtualDeviceName = blockDevice.VirtualName + } + } else { + bsu := oapi.BsuToCreate{ + DeleteOnVmDeletion: aws.Bool(blockDevice.DeleteOnVmDeletion), + } + + if blockDevice.VolumeType != "" { + bsu.VolumeType = blockDevice.VolumeType + } + + if blockDevice.VolumeSize > 0 { + bsu.VolumeSize = blockDevice.VolumeSize + } + + // IOPS is only valid for io1 type + if blockDevice.VolumeType == "io1" { + bsu.Iops = blockDevice.IOPS + } + + if blockDevice.SnapshotId != "" { + bsu.SnapshotId = blockDevice.SnapshotId + } + + mapping.Bsu = bsu + } + + blockDevices = append(blockDevices, mapping) + } + return blockDevices +} + +func (b *BlockDevice) Prepare(ctx *interpolate.Context) error { + if b.DeviceName == "" { + return fmt.Errorf("The `device_name` must be specified " + + "for every device in the block device mapping.") + } + return nil +} + +func (b *BlockDevices) Prepare(ctx *interpolate.Context) (errs []error) { + for _, d := range b.OMIMappings { + if err := d.Prepare(ctx); err != nil { + errs = append(errs, fmt.Errorf("OMIMapping: %s", err.Error())) + } + } + for _, d := range b.LaunchMappings { + if err := d.Prepare(ctx); err != nil { + errs = append(errs, fmt.Errorf("LaunchMapping: %s", err.Error())) + } + } + return errs +} + +func (b *OMIBlockDevices) BuildOMIDevices() []oapi.BlockDeviceMappingImage { + return buildBlockDevicesImage(b.OMIMappings) +} + +func (b *LaunchBlockDevices) BuildLaunchDevices() []oapi.BlockDeviceMappingVmCreation { + return buildBlockDevicesVmCreation(b.LaunchMappings) +} diff --git a/builder/osc/common/block_device_test.go b/builder/osc/common/block_device_test.go new file mode 100644 index 000000000..c047e3167 --- /dev/null +++ b/builder/osc/common/block_device_test.go @@ -0,0 +1,300 @@ +package common + +import ( + "reflect" + "testing" + + "github.com/outscale/osc-go/oapi" +) + +func TestBlockDevice_LaunchDevices(t *testing.T) { + tr := new(bool) + f := new(bool) + + *tr = true + *f = false + + cases := []struct { + Config *BlockDevice + Result oapi.BlockDeviceMappingVmCreation + }{ + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + SnapshotId: "snap-1234", + VolumeType: "standard", + VolumeSize: 8, + DeleteOnVmDeletion: true, + }, + + Result: oapi.BlockDeviceMappingVmCreation{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + SnapshotId: "snap-1234", + VolumeType: "standard", + VolumeSize: 8, + DeleteOnVmDeletion: tr, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeSize: 8, + }, + + Result: oapi.BlockDeviceMappingVmCreation{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeSize: 8, + DeleteOnVmDeletion: f, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeType: "io1", + VolumeSize: 8, + DeleteOnVmDeletion: true, + IOPS: 1000, + }, + + Result: oapi.BlockDeviceMappingVmCreation{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeType: "io1", + VolumeSize: 8, + DeleteOnVmDeletion: tr, + Iops: 1000, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeType: "gp2", + VolumeSize: 8, + DeleteOnVmDeletion: true, + }, + + Result: oapi.BlockDeviceMappingVmCreation{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeType: "gp2", + VolumeSize: 8, + DeleteOnVmDeletion: tr, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeType: "gp2", + VolumeSize: 8, + DeleteOnVmDeletion: true, + }, + + Result: oapi.BlockDeviceMappingVmCreation{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeType: "gp2", + VolumeSize: 8, + DeleteOnVmDeletion: tr, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeType: "standard", + DeleteOnVmDeletion: true, + }, + + Result: oapi.BlockDeviceMappingVmCreation{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeType: "standard", + DeleteOnVmDeletion: tr, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VirtualName: "ephemeral0", + }, + + Result: oapi.BlockDeviceMappingVmCreation{ + DeviceName: "/dev/sdb", + VirtualDeviceName: "ephemeral0", + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + NoDevice: true, + }, + + Result: oapi.BlockDeviceMappingVmCreation{ + DeviceName: "/dev/sdb", + NoDevice: "", + }, + }, + } + + for _, tc := range cases { + + launchBlockDevices := LaunchBlockDevices{ + LaunchMappings: []BlockDevice{*tc.Config}, + } + + expected := []oapi.BlockDeviceMappingVmCreation{tc.Result} + + launchResults := launchBlockDevices.BuildLaunchDevices() + if !reflect.DeepEqual(expected, launchResults) { + t.Fatalf("Bad block device, \nexpected: %#v\n\ngot: %#v", + expected, launchResults) + } + } +} + +func TestBlockDevice_OMI(t *testing.T) { + tr := new(bool) + f := new(bool) + + *tr = true + *f = false + + cases := []struct { + Config *BlockDevice + Result oapi.BlockDeviceMappingImage + }{ + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + SnapshotId: "snap-1234", + VolumeType: "standard", + VolumeSize: 8, + DeleteOnVmDeletion: true, + }, + + Result: oapi.BlockDeviceMappingImage{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + SnapshotId: "snap-1234", + VolumeType: "standard", + VolumeSize: 8, + DeleteOnVmDeletion: tr, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeSize: 8, + }, + + Result: oapi.BlockDeviceMappingImage{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeSize: 8, + DeleteOnVmDeletion: f, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeType: "io1", + VolumeSize: 8, + DeleteOnVmDeletion: true, + IOPS: 1000, + }, + + Result: oapi.BlockDeviceMappingImage{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeType: "io1", + VolumeSize: 8, + DeleteOnVmDeletion: tr, + Iops: 1000, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeType: "gp2", + VolumeSize: 8, + DeleteOnVmDeletion: true, + }, + + Result: oapi.BlockDeviceMappingImage{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeType: "gp2", + VolumeSize: 8, + DeleteOnVmDeletion: tr, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeType: "gp2", + VolumeSize: 8, + DeleteOnVmDeletion: true, + }, + + Result: oapi.BlockDeviceMappingImage{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeType: "gp2", + VolumeSize: 8, + DeleteOnVmDeletion: tr, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VolumeType: "standard", + DeleteOnVmDeletion: true, + }, + + Result: oapi.BlockDeviceMappingImage{ + DeviceName: "/dev/sdb", + Bsu: oapi.BsuToCreate{ + VolumeType: "standard", + DeleteOnVmDeletion: tr, + }, + }, + }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VirtualName: "ephemeral0", + }, + + Result: oapi.BlockDeviceMappingImage{ + DeviceName: "/dev/sdb", + VirtualDeviceName: "ephemeral0", + }, + }, + } + + for _, tc := range cases { + omiBlockDevices := OMIBlockDevices{ + OMIMappings: []BlockDevice{*tc.Config}, + } + + expected := []oapi.BlockDeviceMappingImage{tc.Result} + + omiResults := omiBlockDevices.BuildOMIDevices() + if !reflect.DeepEqual(expected, omiResults) { + t.Fatalf("Bad block device, \nexpected: %+#v\n\ngot: %+#v", + expected, omiResults) + } + } +} diff --git a/builder/osc/common/build_filters.go b/builder/osc/common/build_filters.go new file mode 100644 index 000000000..fe88ed09f --- /dev/null +++ b/builder/osc/common/build_filters.go @@ -0,0 +1,157 @@ +package common + +import ( + "log" + "strconv" + + "github.com/outscale/osc-go/oapi" +) + +func buildNetFilters(input map[string]string) oapi.FiltersNet { + var filters oapi.FiltersNet + for k, v := range input { + filterValue := []string{v} + switch name := k; name { + case "ip-range": + filters.IpRanges = filterValue + case "dhcp-options-set-id": + filters.DhcpOptionsSetIds = filterValue + case "is-default": + if isDefault, err := strconv.ParseBool(v); err == nil { + filters.IsDefault = isDefault + } + case "state": + filters.States = filterValue + case "tag-key": + filters.TagKeys = filterValue + case "tag-value": + filters.TagValues = filterValue + default: + log.Printf("[Debug] Unknown Filter Name: %s.", name) + } + } + return filters +} + +func buildSubnetFilters(input map[string]string) oapi.FiltersSubnet { + var filters oapi.FiltersSubnet + for k, v := range input { + filterValue := []string{v} + switch name := k; name { + case "available-ips-counts": + if ipCount, err := strconv.Atoi(v); err == nil { + filters.AvailableIpsCounts = []int64{int64(ipCount)} + } + case "ip-ranges": + filters.IpRanges = filterValue + case "net-ids": + filters.NetIds = filterValue + case "states": + filters.States = filterValue + case "subnet-ids": + filters.SubnetIds = filterValue + case "sub-region-names": + filters.SubregionNames = filterValue + default: + log.Printf("[Debug] Unknown Filter Name: %s.", name) + } + } + return filters +} + +func buildOMIFilters(input map[string]string) oapi.FiltersImage { + var filters oapi.FiltersImage + for k, v := range input { + filterValue := []string{v} + + switch name := k; name { + case "account-alias": + filters.AccountAliases = filterValue + case "account-id": + filters.AccountIds = filterValue + case "architecture": + filters.Architectures = filterValue + case "image-id": + filters.ImageIds = filterValue + case "image-name": + filters.ImageNames = filterValue + case "image-type": + filters.ImageTypes = filterValue + case "virtualization-type": + filters.VirtualizationTypes = filterValue + case "root-device-type": + filters.RootDeviceTypes = filterValue + case "block-device-mapping-volume-type": + filters.BlockDeviceMappingVolumeType = filterValue + //Some params are missing. + default: + log.Printf("[WARN] Unknown Filter Name: %s.", name) + } + } + return filters +} + +func buildSecurityGroupFilters(input map[string]string) oapi.FiltersSecurityGroup { + var filters oapi.FiltersSecurityGroup + for k, v := range input { + filterValue := []string{v} + + switch name := k; name { + case "account-ids": + filters.AccountIds = filterValue + case "descriptions": + filters.Descriptions = filterValue + case "inbound-rule-account-ids": + filters.InboundRuleAccountIds = filterValue + case "inbound-rule-from-port-ranges": + if val, err := strconv.Atoi(v); err == nil { + filters.InboundRuleFromPortRanges = []int64{int64(val)} + } + case "inbound-rule-ip-ranges": + filters.InboundRuleIpRanges = filterValue + case "inbound-rule-protocols": + filters.InboundRuleProtocols = filterValue + case "inbound-rule-security-group-ids": + filters.InboundRuleSecurityGroupIds = filterValue + case "inbound-rule-security-group-names": + filters.InboundRuleSecurityGroupNames = filterValue + case "inbound-rule-to-port-ranges": + if val, err := strconv.Atoi(v); err == nil { + filters.InboundRuleToPortRanges = []int64{int64(val)} + } + case "net-ids": + filters.NetIds = filterValue + + case "outbound-rule-account-ids": + filters.OutboundRuleAccountIds = filterValue + case "outbound-rule-from-port-ranges": + if val, err := strconv.Atoi(v); err == nil { + filters.OutboundRuleFromPortRanges = []int64{int64(val)} + } + case "outbound-rule-ip-ranges": + filters.OutboundRuleIpRanges = filterValue + case "outbound-rule-protocols": + filters.OutboundRuleProtocols = filterValue + case "outbound-rule-security-group-ids": + filters.OutboundRuleSecurityGroupIds = filterValue + case "outbound-rule-security-group-names": + filters.OutboundRuleSecurityGroupNames = filterValue + case "outbound-rule-to-port-ranges": + if val, err := strconv.Atoi(v); err == nil { + filters.OutboundRuleToPortRanges = []int64{int64(val)} + } + case "security-group-ids": + filters.SecurityGroupIds = filterValue + case "security-group-names": + filters.SecurityGroupNames = filterValue + case "tags-keys": + filters.TagKeys = filterValue + case "tags-values": + filters.TagValues = filterValue + //Some params are missing. + default: + log.Printf("[Debug] Unknown Filter Name: %s.", name) + } + } + return filters +} diff --git a/builder/osc/common/interpolate_build_info.go b/builder/osc/common/interpolate_build_info.go new file mode 100644 index 000000000..a3d62a00c --- /dev/null +++ b/builder/osc/common/interpolate_build_info.go @@ -0,0 +1,35 @@ +package common + +import ( + "github.com/hashicorp/packer/helper/multistep" + "github.com/outscale/osc-go/oapi" +) + +type BuildInfoTemplate struct { + BuildRegion string + SourceOMI string + SourceOMIName string + SourceOMITags map[string]string +} + +func extractBuildInfo(region string, state multistep.StateBag) *BuildInfoTemplate { + rawSourceOMI, hasSourceOMI := state.GetOk("source_image") + if !hasSourceOMI { + return &BuildInfoTemplate{ + BuildRegion: region, + } + } + + sourceOMI := rawSourceOMI.(oapi.Image) + sourceOMITags := make(map[string]string, len(sourceOMI.Tags)) + for _, tag := range sourceOMI.Tags { + sourceOMITags[tag.Key] = tag.Value + } + + return &BuildInfoTemplate{ + BuildRegion: region, + SourceOMI: sourceOMI.ImageId, + SourceOMIName: sourceOMI.ImageName, + SourceOMITags: sourceOMITags, + } +} diff --git a/builder/osc/common/interpolate_build_info_test.go b/builder/osc/common/interpolate_build_info_test.go new file mode 100644 index 000000000..c4d146833 --- /dev/null +++ b/builder/osc/common/interpolate_build_info_test.go @@ -0,0 +1,62 @@ +package common + +import ( + "reflect" + "testing" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/outscale/osc-go/oapi" +) + +func testImage() oapi.Image { + return oapi.Image{ + ImageId: "ami-abcd1234", + ImageName: "ami_test_name", + Tags: []oapi.ResourceTag{ + { + Key: "key-1", + Value: "value-1", + }, + { + Key: "key-2", + Value: "value-2", + }, + }, + } +} + +func testState() multistep.StateBag { + state := new(multistep.BasicStateBag) + return state +} + +func TestInterpolateBuildInfo_extractBuildInfo_noSourceImage(t *testing.T) { + state := testState() + buildInfo := extractBuildInfo("foo", state) + + expected := BuildInfoTemplate{ + BuildRegion: "foo", + } + if !reflect.DeepEqual(*buildInfo, expected) { + t.Fatalf("Unexpected BuildInfoTemplate: expected %#v got %#v\n", expected, *buildInfo) + } +} + +func TestInterpolateBuildInfo_extractBuildInfo_withSourceImage(t *testing.T) { + state := testState() + state.Put("source_image", testImage()) + buildInfo := extractBuildInfo("foo", state) + + expected := BuildInfoTemplate{ + BuildRegion: "foo", + SourceOMI: "ami-abcd1234", + SourceOMIName: "ami_test_name", + SourceOMITags: map[string]string{ + "key-1": "value-1", + "key-2": "value-2", + }, + } + if !reflect.DeepEqual(*buildInfo, expected) { + t.Fatalf("Unexpected BuildInfoTemplate: expected %#v got %#v\n", expected, *buildInfo) + } +} diff --git a/builder/osc/common/omi_config.go b/builder/osc/common/omi_config.go new file mode 100644 index 000000000..3cb352e65 --- /dev/null +++ b/builder/osc/common/omi_config.go @@ -0,0 +1,91 @@ +package common + +import ( + "fmt" + "log" + + "github.com/hashicorp/packer/template/interpolate" +) + +// OMIConfig is for common configuration related to creating OMIs. +type OMIConfig struct { + OMIName string `mapstructure:"omi_name"` + OMIDescription string `mapstructure:"omi_description"` + OMIVirtType string `mapstructure:"omi_virtualization_type"` + OMIAccountIDs []string `mapstructure:"omi_account_ids"` + OMIGroups []string `mapstructure:"omi_groups"` + OMIProductCodes []string `mapstructure:"omi_product_codes"` + OMIRegions []string `mapstructure:"omi_regions"` + OMISkipRegionValidation bool `mapstructure:"skip_region_validation"` + OMITags TagMap `mapstructure:"tags"` + OMIForceDeregister bool `mapstructure:"force_deregister"` + OMIForceDeleteSnapshot bool `mapstructure:"force_delete_snapshot"` + SnapshotTags TagMap `mapstructure:"snapshot_tags"` + SnapshotAccountIDs []string `mapstructure:"snapshot_account_ids"` + SnapshotGroups []string `mapstructure:"snapshot_groups"` +} + +func stringInSlice(s []string, searchstr string) bool { + for _, item := range s { + if item == searchstr { + return true + } + } + return false +} + +func (c *OMIConfig) Prepare(accessConfig *AccessConfig, ctx *interpolate.Context) []error { + var errs []error + + if c.OMIName == "" { + errs = append(errs, fmt.Errorf("omi_name must be specified")) + } + + errs = append(errs, c.prepareRegions(accessConfig)...) + + if len(c.OMIName) < 3 || len(c.OMIName) > 128 { + errs = append(errs, fmt.Errorf("omi_name must be between 3 and 128 characters long")) + } + + if c.OMIName != templateCleanResourceName(c.OMIName) { + errs = append(errs, fmt.Errorf("OMIName should only contain "+ + "alphanumeric characters, parentheses (()), square brackets ([]), spaces "+ + "( ), periods (.), slashes (/), dashes (-), single quotes ('), at-signs "+ + "(@), or underscores(_). You can use the `clean_omi_name` template "+ + "filter to automatically clean your omi name.")) + } + + if len(errs) > 0 { + return errs + } + + return nil +} + +func (c *OMIConfig) prepareRegions(accessConfig *AccessConfig) (errs []error) { + if len(c.OMIRegions) > 0 { + regionSet := make(map[string]struct{}) + regions := make([]string, 0, len(c.OMIRegions)) + + for _, region := range c.OMIRegions { + // If we already saw the region, then don't look again + if _, ok := regionSet[region]; ok { + continue + } + + // Mark that we saw the region + regionSet[region] = struct{}{} + + if (accessConfig != nil) && (region == accessConfig.RawRegion) { + // make sure we don't try to copy to the region we originally + // create the OMI in. + log.Printf("Cannot copy OMI to OUTSCALE session region '%s', deleting it from `omi_regions`.", region) + continue + } + regions = append(regions, region) + } + + c.OMIRegions = regions + } + return errs +} diff --git a/builder/osc/common/omi_config_test.go b/builder/osc/common/omi_config_test.go new file mode 100644 index 000000000..512a93972 --- /dev/null +++ b/builder/osc/common/omi_config_test.go @@ -0,0 +1,148 @@ +package common + +import ( + "fmt" + "reflect" + "testing" +) + +func testOMIConfig() *OMIConfig { + return &OMIConfig{ + OMIName: "foo", + } +} + +func getFakeAccessConfig(region string) *AccessConfig { + c := testAccessConfig() + c.RawRegion = region + return c +} + +func TestOMIConfigPrepare_name(t *testing.T) { + c := testOMIConfig() + accessConf := testAccessConfig() + if err := c.Prepare(accessConf, nil); err != nil { + t.Fatalf("shouldn't have err: %s", err) + } + + c.OMIName = "" + if err := c.Prepare(accessConf, nil); err == nil { + t.Fatal("should have error") + } +} + +func TestOMIConfigPrepare_regions(t *testing.T) { + c := testOMIConfig() + c.OMIRegions = nil + + var errs []error + var err error + accessConf := testAccessConfig() + mockConn := &mockOAPIClient{} + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatalf("shouldn't have err: %#v", errs) + } + + c.OMIRegions, err = listOAPIRegions(mockConn) + if err != nil { + t.Fatalf("shouldn't have err: %s", err.Error()) + } + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatalf("shouldn't have err: %#v", errs) + } + errs = errs[:0] + + c.OMIRegions = []string{"us-east-1", "us-west-1", "us-east-1"} + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatalf("bad: %s", errs[0]) + } + + expected := []string{"us-east-1", "us-west-1"} + if !reflect.DeepEqual(c.OMIRegions, expected) { + t.Fatalf("bad: %#v", c.OMIRegions) + } + + c.OMIRegions = []string{"custom"} + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatal("shouldn't have error") + } + + c.OMIRegions = []string{"us-east-1", "us-east-2", "us-west-1"} + + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatal(fmt.Sprintf("shouldn't have error: %s", errs[0])) + } + + c.OMIRegions = []string{"us-east-1", "us-east-2", "us-west-1"} + + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatal("should have passed; we are able to use default KMS key if not sharing") + } + + c.SnapshotAccountIDs = []string{"user-foo", "user-bar"} + c.OMIRegions = []string{"us-east-1", "us-east-2", "us-west-1"} + + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatal("should have an error b/c can't use default KMS key if sharing") + } + + c.OMIRegions = []string{"us-east-1", "us-west-1"} + + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatal("should have error b/c theres a region in the key map that isn't in omi_regions") + } + + c.OMIRegions = []string{"us-east-1", "us-west-1", "us-east-2"} + + c.SnapshotAccountIDs = []string{"foo", "bar"} + c.OMIRegions = []string{"us-east-1", "us-west-1"} + + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatal("should have error b/c theres a region in in omi_regions that isn't in the key map") + } + + // allow rawregion to exist in omi_regions list. + accessConf = getFakeAccessConfig("us-east-1") + c.OMIRegions = []string{"us-east-1", "us-west-1", "us-east-2"} + + if errs = c.prepareRegions(accessConf); len(errs) > 0 { + t.Fatal("should allow user to have the raw region in omi_regions") + } + +} + +func TestOMINameValidation(t *testing.T) { + c := testOMIConfig() + + accessConf := testAccessConfig() + + c.OMIName = "aa" + if err := c.Prepare(accessConf, nil); err == nil { + t.Fatal("shouldn't be able to have an omi name with less than 3 characters") + } + + var longOmiName string + for i := 0; i < 129; i++ { + longOmiName += "a" + } + c.OMIName = longOmiName + if err := c.Prepare(accessConf, nil); err == nil { + t.Fatal("shouldn't be able to have an omi name with great than 128 characters") + } + + c.OMIName = "+aaa" + if err := c.Prepare(accessConf, nil); err == nil { + t.Fatal("shouldn't be able to have an omi name with invalid characters") + } + + c.OMIName = "fooBAR1()[] ./-'@_" + if err := c.Prepare(accessConf, nil); err != nil { + t.Fatal("should be able to use all of the allowed OMI characters") + } + + c.OMIName = `xyz-base-2017-04-05-1934` + if err := c.Prepare(accessConf, nil); err != nil { + t.Fatalf("expected `xyz-base-2017-04-05-1934` to pass validation.") + } + +} diff --git a/builder/osc/common/regions.go b/builder/osc/common/regions.go new file mode 100644 index 000000000..45a829bcf --- /dev/null +++ b/builder/osc/common/regions.go @@ -0,0 +1,56 @@ +package common + +import ( + "fmt" + + "github.com/outscale/osc-go/oapi" +) + +func listOAPIRegions(oapiconn oapi.OAPIClient) ([]string, error) { + var regions []string + resp, err := oapiconn.POST_ReadRegions(oapi.ReadRegionsRequest{}) + if resp.OK == nil || err != nil { + return []string{}, err + } + + resultRegions := resp.OK + + for _, region := range resultRegions.Regions { + regions = append(regions, region.RegionName) + } + + return regions, nil +} + +// ValidateRegion returns true if the supplied region is a valid Outscale +// region and false if it's not. +func (c *AccessConfig) ValidateRegion(regions ...string) error { + oapiconn, err := c.NewOAPIConnection() + if err != nil { + return err + } + + validRegions, err := listOAPIRegions(oapiconn) + if err != nil { + return err + } + + var invalidRegions []string + for _, region := range regions { + found := false + for _, validRegion := range validRegions { + if region == validRegion { + found = true + break + } + } + if !found { + invalidRegions = append(invalidRegions, region) + } + } + + if len(invalidRegions) > 0 { + return fmt.Errorf("Invalid region(s): %v", invalidRegions) + } + return nil +} diff --git a/builder/osc/common/run_config.go b/builder/osc/common/run_config.go new file mode 100644 index 000000000..1bff1772a --- /dev/null +++ b/builder/osc/common/run_config.go @@ -0,0 +1,219 @@ +package common + +import ( + "fmt" + "net" + "os" + "regexp" + "strings" + "time" + + "github.com/hashicorp/packer/common/uuid" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/template/interpolate" +) + +var reShutdownBehavior = regexp.MustCompile("^(stop|terminate)$") + +type OmiFilterOptions struct { + Filters map[string]string + Owners []string + MostRecent bool `mapstructure:"most_recent"` +} + +func (d *OmiFilterOptions) Empty() bool { + return len(d.Owners) == 0 && len(d.Filters) == 0 +} + +func (d *OmiFilterOptions) NoOwner() bool { + return len(d.Owners) == 0 +} + +type SubnetFilterOptions struct { + Filters map[string]string + MostFree bool `mapstructure:"most_free"` + Random bool `mapstructure:"random"` +} + +func (d *SubnetFilterOptions) Empty() bool { + return len(d.Filters) == 0 +} + +type NetFilterOptions struct { + Filters map[string]string +} + +func (d *NetFilterOptions) Empty() bool { + return len(d.Filters) == 0 +} + +type SecurityGroupFilterOptions struct { + Filters map[string]string +} + +func (d *SecurityGroupFilterOptions) Empty() bool { + return len(d.Filters) == 0 +} + +// RunConfig contains configuration for running an vm from a source +// AMI and details on how to access that launched image. +type RunConfig struct { + AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"` + Subregion string `mapstructure:"subregion_name"` + BlockDurationMinutes int64 `mapstructure:"block_duration_minutes"` + DisableStopVm bool `mapstructure:"disable_stop_vm"` + BsuOptimized bool `mapstructure:"bsu_optimized"` + EnableT2Unlimited bool `mapstructure:"enable_t2_unlimited"` + IamVmProfile string `mapstructure:"iam_vm_profile"` + VmInitiatedShutdownBehavior string `mapstructure:"shutdown_behavior"` + VmType string `mapstructure:"vm_type"` + SecurityGroupFilter SecurityGroupFilterOptions `mapstructure:"security_group_filter"` + RunTags map[string]string `mapstructure:"run_tags"` + SecurityGroupId string `mapstructure:"security_group_id"` + SecurityGroupIds []string `mapstructure:"security_group_ids"` + SourceOmi string `mapstructure:"source_omi"` + SourceOmiFilter OmiFilterOptions `mapstructure:"source_omi_filter"` + SpotPrice string `mapstructure:"spot_price"` + SpotPriceAutoProduct string `mapstructure:"spot_price_auto_product"` + SpotTags map[string]string `mapstructure:"spot_tags"` + SubnetFilter SubnetFilterOptions `mapstructure:"subnet_filter"` + SubnetId string `mapstructure:"subnet_id"` + TemporaryKeyPairName string `mapstructure:"temporary_key_pair_name"` + TemporarySGSourceCidr string `mapstructure:"temporary_security_group_source_cidr"` + UserData string `mapstructure:"user_data"` + UserDataFile string `mapstructure:"user_data_file"` + NetFilter NetFilterOptions `mapstructure:"net_filter"` + NetId string `mapstructure:"net_id"` + WindowsPasswordTimeout time.Duration `mapstructure:"windows_password_timeout"` + + // Communicator settings + Comm communicator.Config `mapstructure:",squash"` + SSHInterface string `mapstructure:"ssh_interface"` +} + +func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { + // If we are not given an explicit ssh_keypair_name or + // ssh_private_key_file, then create a temporary one, but only if the + // temporary_key_pair_name has not been provided and we are not using + // ssh_password. + if c.Comm.SSHKeyPairName == "" && c.Comm.SSHTemporaryKeyPairName == "" && + c.Comm.SSHPrivateKeyFile == "" && c.Comm.SSHPassword == "" { + + c.Comm.SSHTemporaryKeyPairName = fmt.Sprintf("packer_%s", uuid.TimeOrderedUUID()) + } + + if c.WindowsPasswordTimeout == 0 { + c.WindowsPasswordTimeout = 20 * time.Minute + } + + if c.RunTags == nil { + c.RunTags = make(map[string]string) + } + + // Validation + errs := c.Comm.Prepare(ctx) + + // Validating ssh_interface + if c.SSHInterface != "public_ip" && + c.SSHInterface != "private_ip" && + c.SSHInterface != "public_dns" && + c.SSHInterface != "private_dns" && + c.SSHInterface != "" { + errs = append(errs, fmt.Errorf("Unknown interface type: %s", c.SSHInterface)) + } + + if c.Comm.SSHKeyPairName != "" { + if c.Comm.Type == "winrm" && c.Comm.WinRMPassword == "" && c.Comm.SSHPrivateKeyFile == "" { + errs = append(errs, fmt.Errorf("ssh_private_key_file must be provided to retrieve the winrm password when using ssh_keypair_name.")) + } else if c.Comm.SSHPrivateKeyFile == "" && !c.Comm.SSHAgentAuth { + errs = append(errs, fmt.Errorf("ssh_private_key_file must be provided or ssh_agent_auth enabled when ssh_keypair_name is specified.")) + } + } + + if c.SourceOmi == "" && c.SourceOmiFilter.Empty() { + errs = append(errs, fmt.Errorf("A source_omi or source_omi_filter must be specified")) + } + + if c.SourceOmi == "" && c.SourceOmiFilter.NoOwner() { + errs = append(errs, fmt.Errorf("For security reasons, your source AMI filter must declare an owner.")) + } + + if c.VmType == "" { + errs = append(errs, fmt.Errorf("An vm_type must be specified")) + } + + if c.BlockDurationMinutes%60 != 0 { + errs = append(errs, fmt.Errorf( + "block_duration_minutes must be multiple of 60")) + } + + if c.SpotPrice == "auto" { + if c.SpotPriceAutoProduct == "" { + errs = append(errs, fmt.Errorf( + "spot_price_auto_product must be specified when spot_price is auto")) + } + } + + if c.SpotPriceAutoProduct != "" { + if c.SpotPrice != "auto" { + errs = append(errs, fmt.Errorf( + "spot_price should be set to auto when spot_price_auto_product is specified")) + } + } + + if c.SpotTags != nil { + if c.SpotPrice == "" || c.SpotPrice == "0" { + errs = append(errs, fmt.Errorf( + "spot_tags should not be set when not requesting a spot vm")) + } + } + + if c.UserData != "" && c.UserDataFile != "" { + errs = append(errs, fmt.Errorf("Only one of user_data or user_data_file can be specified.")) + } else if c.UserDataFile != "" { + if _, err := os.Stat(c.UserDataFile); err != nil { + errs = append(errs, fmt.Errorf("user_data_file not found: %s", c.UserDataFile)) + } + } + + if c.SecurityGroupId != "" { + if len(c.SecurityGroupIds) > 0 { + errs = append(errs, fmt.Errorf("Only one of security_group_id or security_group_ids can be specified.")) + } else { + c.SecurityGroupIds = []string{c.SecurityGroupId} + c.SecurityGroupId = "" + } + } + + if c.TemporarySGSourceCidr == "" { + c.TemporarySGSourceCidr = "0.0.0.0/0" + } else { + if _, _, err := net.ParseCIDR(c.TemporarySGSourceCidr); err != nil { + errs = append(errs, fmt.Errorf("Error parsing temporary_security_group_source_cidr: %s", err.Error())) + } + } + + if c.VmInitiatedShutdownBehavior == "" { + c.VmInitiatedShutdownBehavior = "stop" + } else if !reShutdownBehavior.MatchString(c.VmInitiatedShutdownBehavior) { + errs = append(errs, fmt.Errorf("shutdown_behavior only accepts 'stop' or 'terminate' values.")) + } + + if c.EnableT2Unlimited { + if c.SpotPrice != "" { + errs = append(errs, fmt.Errorf("Error: T2 Unlimited cannot be used in conjuction with Spot Vms")) + } + firstDotIndex := strings.Index(c.VmType, ".") + if firstDotIndex == -1 { + errs = append(errs, fmt.Errorf("Error determining main Vm Type from: %s", c.VmType)) + } else if c.VmType[0:firstDotIndex] != "t2" { + errs = append(errs, fmt.Errorf("Error: T2 Unlimited enabled with a non-T2 Vm Type: %s", c.VmType)) + } + } + + return errs +} + +func (c *RunConfig) IsSpotVm() bool { + return c.SpotPrice != "" && c.SpotPrice != "0" +} diff --git a/builder/osc/common/run_config_test.go b/builder/osc/common/run_config_test.go new file mode 100644 index 000000000..a33280eae --- /dev/null +++ b/builder/osc/common/run_config_test.go @@ -0,0 +1,233 @@ +package common + +import ( + "io/ioutil" + "os" + "regexp" + "testing" + + "github.com/hashicorp/packer/helper/communicator" +) + +func init() { + // Clear out the OUTSCALE access key env vars so they don't + // affect our tests. + os.Setenv("OUTSCALE_ACCESS_KEY_ID", "") + os.Setenv("OUTSCALE_ACCESS_KEY", "") + os.Setenv("OUTSCALE_SECRET_ACCESS_KEY", "") + os.Setenv("OUTSCALE_SECRET_KEY", "") +} + +func testConfig() *RunConfig { + return &RunConfig{ + SourceOmi: "abcd", + VmType: "m1.small", + Comm: communicator.Config{ + SSH: communicator.SSH{ + SSHUsername: "foo", + }, + }, + } +} + +func testConfigFilter() *RunConfig { + config := testConfig() + config.SourceOmi = "" + config.SourceOmiFilter = OmiFilterOptions{} + return config +} + +func TestRunConfigPrepare(t *testing.T) { + c := testConfig() + err := c.Prepare(nil) + if len(err) > 0 { + t.Fatalf("err: %s", err) + } +} + +func TestRunConfigPrepare_VmType(t *testing.T) { + c := testConfig() + c.VmType = "" + if err := c.Prepare(nil); len(err) != 1 { + t.Fatalf("Should error if an vm_type is not specified") + } +} + +func TestRunConfigPrepare_SourceOmi(t *testing.T) { + c := testConfig() + c.SourceOmi = "" + if err := c.Prepare(nil); len(err) != 2 { + t.Fatalf("Should error if a source_omi (or source_omi_filter) is not specified") + } +} + +func TestRunConfigPrepare_SourceOmiFilterBlank(t *testing.T) { + c := testConfigFilter() + if err := c.Prepare(nil); len(err) != 2 { + t.Fatalf("Should error if source_ami_filter is empty or not specified (and source_ami is not specified)") + } +} + +func TestRunConfigPrepare_SourceOmiFilterOwnersBlank(t *testing.T) { + c := testConfigFilter() + filter_key := "name" + filter_value := "foo" + c.SourceOmiFilter = OmiFilterOptions{Filters: map[string]string{filter_key: filter_value}} + if err := c.Prepare(nil); len(err) != 1 { + t.Fatalf("Should error if Owners is not specified)") + } +} + +func TestRunConfigPrepare_SourceOmiFilterGood(t *testing.T) { + c := testConfigFilter() + owner := "123" + filter_key := "name" + filter_value := "foo" + goodFilter := OmiFilterOptions{Owners: []string{owner}, Filters: map[string]string{filter_key: filter_value}} + c.SourceOmiFilter = goodFilter + if err := c.Prepare(nil); len(err) != 0 { + t.Fatalf("err: %s", err) + } +} + +func TestRunConfigPrepare_EnableT2UnlimitedGood(t *testing.T) { + c := testConfig() + // Must have a T2 vm type if T2 Unlimited is enabled + c.VmType = "t2.micro" + c.EnableT2Unlimited = true + err := c.Prepare(nil) + if len(err) > 0 { + t.Fatalf("err: %s", err) + } +} + +func TestRunConfigPrepare_EnableT2UnlimitedBadVmType(t *testing.T) { + c := testConfig() + // T2 Unlimited cannot be used with vm types other than T2 + c.VmType = "m5.large" + c.EnableT2Unlimited = true + err := c.Prepare(nil) + if len(err) != 1 { + t.Fatalf("Should error if T2 Unlimited is enabled with non-T2 vm_type") + } +} + +func TestRunConfigPrepare_EnableT2UnlimitedBadWithSpotInstanceRequest(t *testing.T) { + c := testConfig() + // T2 Unlimited cannot be used with Spot Instances + c.VmType = "t2.micro" + c.EnableT2Unlimited = true + c.SpotPrice = "auto" + c.SpotPriceAutoProduct = "Linux/UNIX" + err := c.Prepare(nil) + if len(err) != 1 { + t.Fatalf("Should error if T2 Unlimited has been used in conjuntion with a Spot Price request") + } +} + +func TestRunConfigPrepare_SpotAuto(t *testing.T) { + c := testConfig() + c.SpotPrice = "auto" + if err := c.Prepare(nil); len(err) != 1 { + t.Fatalf("Should error if spot_price_auto_product is not set and spot_price is set to auto") + } + + // Good - SpotPrice and SpotPriceAutoProduct are correctly set + c.SpotPriceAutoProduct = "foo" + if err := c.Prepare(nil); len(err) != 0 { + t.Fatalf("err: %s", err) + } + + c.SpotPrice = "" + if err := c.Prepare(nil); len(err) != 1 { + t.Fatalf("Should error if spot_price is not set to auto and spot_price_auto_product is set") + } +} + +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("Should error if user_data string and user_data_file have both been specified") + } +} + +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("Should error if the file specified by user_data_file does not exist") + } + + 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") + } + + // Match prefix and UUID, e.g. "packer_5790d491-a0b8-c84c-c9d2-2aea55086550". + r := regexp.MustCompile(`\Apacker_(?:(?i)[a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12}?)\z`) + if !r.MatchString(c.Comm.SSHTemporaryKeyPairName) { + t.Fatal("keypair name is not valid") + } + + 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") + } +} diff --git a/builder/osc/common/ssh.go b/builder/osc/common/ssh.go new file mode 100644 index 000000000..751c3c925 --- /dev/null +++ b/builder/osc/common/ssh.go @@ -0,0 +1,84 @@ +package common + +import ( + "errors" + "fmt" + "time" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/outscale/osc-go/oapi" +) + +type oapiDescriber interface { + POST_ReadVms(oapi.ReadVmsRequest) (*oapi.POST_ReadVmsResponses, error) +} + +var ( + // modified in tests + sshHostSleepDuration = time.Second +) + +// SSHHost returns a function that can be given to the SSH communicator +// for determining the SSH address based on the vm DNS name. +func SSHHost(e oapiDescriber, sshInterface string) func(multistep.StateBag) (string, error) { + return func(state multistep.StateBag) (string, error) { + const tries = 2 + // <= with current structure to check result of describing `tries` times + for j := 0; j <= tries; j++ { + var host string + i := state.Get("vm").(oapi.Vm) + if sshInterface != "" { + switch sshInterface { + case "public_ip": + if i.PublicIp != "" { + host = i.PublicIp + } + case "private_ip": + if i.PrivateIp != "" { + host = i.PrivateIp + } + case "public_dns": + if i.PublicDnsName != "" { + host = i.PublicDnsName + } + case "private_dns": + if i.PrivateDnsName != "" { + host = i.PrivateDnsName + } + default: + panic(fmt.Sprintf("Unknown interface type: %s", sshInterface)) + } + } else if i.NetId != "" { + if i.PublicIp != "" { + host = i.PublicIp + } else if i.PrivateIp != "" { + host = i.PrivateIp + } + } else if i.PublicDnsName != "" { + host = i.PublicDnsName + } + + if host != "" { + return host, nil + } + + r, err := e.POST_ReadVms(oapi.ReadVmsRequest{ + Filters: oapi.FiltersVm{ + VmIds: []string{i.VmId}, + }, + }) + if err != nil { + return "", err + } + + if len(r.OK.Vms) == 0 { + return "", fmt.Errorf("vm not found: %s", i.VmId) + } + + state.Put("vm", r.OK.Vms[0]) + time.Sleep(sshHostSleepDuration) + } + + return "", errors.New("couldn't determine address for vm") + } +} diff --git a/builder/osc/common/state.go b/builder/osc/common/state.go new file mode 100644 index 000000000..2cc475123 --- /dev/null +++ b/builder/osc/common/state.go @@ -0,0 +1,323 @@ +package common + +import ( + "fmt" + "log" + + "github.com/hashicorp/packer/common" + "github.com/outscale/osc-go/oapi" +) + +type stateRefreshFunc func() (string, error) + +func waitForSecurityGroup(conn *oapi.Client, securityGroupID string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "exists", securityGroupWaitFunc(conn, securityGroupID)) + err := <-errCh + return err +} + +func waitUntilForVmRunning(conn *oapi.Client, vmID string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "running", waitUntilVmStateFunc(conn, vmID)) + err := <-errCh + return err +} + +func waitUntilVmDeleted(conn *oapi.Client, vmID string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "terminated", waitUntilVmStateFunc(conn, vmID)) + return <-errCh +} + +func waitUntilVmStopped(conn *oapi.Client, vmID string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "stopped", waitUntilVmStateFunc(conn, vmID)) + return <-errCh +} + +func WaitUntilSnapshotCompleted(conn *oapi.Client, id string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "completed", waitUntilSnapshotStateFunc(conn, id)) + return <-errCh +} + +func WaitUntilImageAvailable(conn *oapi.Client, imageID string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "available", waitUntilImageStateFunc(conn, imageID)) + return <-errCh +} + +func WaitUntilVolumeAvailable(conn *oapi.Client, volumeID string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "available", volumeWaitFunc(conn, volumeID)) + return <-errCh +} + +func WaitUntilVolumeIsLinked(conn *oapi.Client, volumeID string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "attached", waitUntilVolumeLinkedStateFunc(conn, volumeID)) + return <-errCh +} + +func WaitUntilVolumeIsUnlinked(conn *oapi.Client, volumeID string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "dettached", waitUntilVolumeUnLinkedStateFunc(conn, volumeID)) + return <-errCh +} + +func WaitUntilSnapshotDone(conn *oapi.Client, snapshotID string) error { + errCh := make(chan error, 1) + go waitForState(errCh, "completed", waitUntilSnapshotDoneStateFunc(conn, snapshotID)) + return <-errCh +} + +func waitForState(errCh chan<- error, target string, refresh stateRefreshFunc) error { + err := common.Retry(2, 2, 0, func(_ uint) (bool, error) { + state, err := refresh() + if err != nil { + return false, err + } else if state == target { + return true, nil + } + return false, nil + }) + errCh <- err + return err +} + +func waitUntilVmStateFunc(conn *oapi.Client, id string) stateRefreshFunc { + return func() (string, error) { + log.Printf("[Debug] Check if SG with id %s exists", id) + resp, err := conn.POST_ReadVms(oapi.ReadVmsRequest{ + Filters: oapi.FiltersVm{ + VmIds: []string{id}, + }, + }) + + log.Printf("[Debug] Read Response %+v", resp.OK) + + if err != nil { + return "", err + } + + if resp.OK == nil { + return "", fmt.Errorf("Vm with ID %s. Not Found", id) + } + + if len(resp.OK.Vms) == 0 { + return "pending", nil + } + + return resp.OK.Vms[0].State, nil + } +} + +func waitUntilVolumeLinkedStateFunc(conn *oapi.Client, id string) stateRefreshFunc { + return func() (string, error) { + log.Printf("[Debug] Check if volume with id %s exists", id) + resp, err := conn.POST_ReadVolumes(oapi.ReadVolumesRequest{ + Filters: oapi.FiltersVolume{ + VolumeIds: []string{id}, + }, + }) + + if err != nil { + return "", err + } + + if resp.OK == nil { + return "", fmt.Errorf("Vm with ID %s. Not Found", id) + } + + log.Printf("[Debug] Read Response %+v", resp.OK) + + if len(resp.OK.Volumes) == 0 { + return "pending", nil + } + + if len(resp.OK.Volumes[0].LinkedVolumes) == 0 { + return "pending", nil + } + + return resp.OK.Volumes[0].LinkedVolumes[0].State, nil + } +} + +func waitUntilVolumeUnLinkedStateFunc(conn *oapi.Client, id string) stateRefreshFunc { + return func() (string, error) { + log.Printf("[Debug] Check if volume with id %s exists", id) + resp, err := conn.POST_ReadVolumes(oapi.ReadVolumesRequest{ + Filters: oapi.FiltersVolume{ + VolumeIds: []string{id}, + }, + }) + + if err != nil { + return "", err + } + + if resp.OK == nil { + return "", fmt.Errorf("Vm with ID %s. Not Found", id) + } + + log.Printf("[Debug] Read Response %+v", resp.OK) + + if len(resp.OK.Volumes) == 0 { + return "pending", nil + } + + if len(resp.OK.Volumes[0].LinkedVolumes) == 0 { + return "dettached", nil + } + + return "failed", nil + } +} + +func waitUntilSnapshotStateFunc(conn *oapi.Client, id string) stateRefreshFunc { + return func() (string, error) { + log.Printf("[Debug] Check if Snapshot with id %s exists", id) + resp, err := conn.POST_ReadSnapshots(oapi.ReadSnapshotsRequest{ + Filters: oapi.FiltersSnapshot{ + SnapshotIds: []string{id}, + }, + }) + + log.Printf("[Debug] Read Response %+v", resp.OK) + + if err != nil { + return "", err + } + + if resp.OK == nil { + return "", fmt.Errorf("Vm with ID %s. Not Found", id) + } + + if len(resp.OK.Snapshots) == 0 { + return "pending", nil + } + + return resp.OK.Snapshots[0].State, nil + } +} + +func waitUntilImageStateFunc(conn *oapi.Client, id string) stateRefreshFunc { + return func() (string, error) { + log.Printf("[Debug] Check if Image with id %s exists", id) + resp, err := conn.POST_ReadImages(oapi.ReadImagesRequest{ + Filters: oapi.FiltersImage{ + ImageIds: []string{id}, + }, + }) + + log.Printf("[Debug] Read Response %+v", resp.OK) + + if err != nil { + return "", err + } + + if resp.OK == nil { + return "", fmt.Errorf("Vm with ID %s. Not Found", id) + } + + if len(resp.OK.Images) == 0 { + return "pending", nil + } + + if resp.OK.Images[0].State == "failed" { + return resp.OK.Images[0].State, fmt.Errorf("Image (%s) creation is failed", id) + } + + return resp.OK.Images[0].State, nil + } +} + +func securityGroupWaitFunc(conn *oapi.Client, id string) stateRefreshFunc { + return func() (string, error) { + log.Printf("[Debug] Check if SG with id %s exists", id) + resp, err := conn.POST_ReadSecurityGroups(oapi.ReadSecurityGroupsRequest{ + Filters: oapi.FiltersSecurityGroup{ + SecurityGroupIds: []string{id}, + }, + }) + + log.Printf("[Debug] Read Response %+v", resp.OK) + + if err != nil { + return "", err + } + + if resp.OK == nil { + return "", fmt.Errorf("Security Group with ID %s. Not Found", id) + } + + if len(resp.OK.SecurityGroups) == 0 { + return "waiting", nil + } + + return "exists", nil + } +} + +func waitUntilSnapshotDoneStateFunc(conn *oapi.Client, id string) stateRefreshFunc { + return func() (string, error) { + log.Printf("[Debug] Check if Snapshot with id %s exists", id) + resp, err := conn.POST_ReadSnapshots(oapi.ReadSnapshotsRequest{ + Filters: oapi.FiltersSnapshot{ + SnapshotIds: []string{id}, + }, + }) + + log.Printf("[Debug] Read Response %+v", resp.OK) + + if err != nil { + return "", err + } + + if resp.OK == nil { + return "", fmt.Errorf("Snapshot with ID %s. Not Found", id) + } + + if len(resp.OK.Snapshots) == 0 { + return "", fmt.Errorf("Snapshot with ID %s. Not Found", id) + } + + if resp.OK.Snapshots[0].State == "error" { + return resp.OK.Snapshots[0].State, fmt.Errorf("Snapshot (%s) creation is failed", id) + } + + return resp.OK.Snapshots[0].State, nil + } +} + +func volumeWaitFunc(conn *oapi.Client, id string) stateRefreshFunc { + return func() (string, error) { + log.Printf("[Debug] Check if SvolumeG with id %s exists", id) + resp, err := conn.POST_ReadVolumes(oapi.ReadVolumesRequest{ + Filters: oapi.FiltersVolume{ + VolumeIds: []string{id}, + }, + }) + + log.Printf("[Debug] Read Response %+v", resp.OK) + + if err != nil { + return "", err + } + + if resp.OK == nil { + return "", fmt.Errorf("Volume with ID %s. Not Found", id) + } + + if len(resp.OK.Volumes) == 0 { + return "waiting", nil + } + + if resp.OK.Volumes[0].State == "error" { + return resp.OK.Volumes[0].State, fmt.Errorf("Volume (%s) creation is failed", id) + } + + return resp.OK.Volumes[0].State, nil + } +} diff --git a/builder/osc/common/step_cleanup_volumes.go b/builder/osc/common/step_cleanup_volumes.go new file mode 100644 index 000000000..79d3e123f --- /dev/null +++ b/builder/osc/common/step_cleanup_volumes.go @@ -0,0 +1,96 @@ +package common + +import ( + "context" + "fmt" + "reflect" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// stepCleanupVolumes cleans up any orphaned volumes that were not designated to +// remain after termination of the vm. These volumes are typically ones +// that are marked as "delete on terminate:false" in the source_ami of a build. +type StepCleanupVolumes struct { + BlockDevices BlockDevices +} + +func (s *StepCleanupVolumes) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + // stepCleanupVolumes is for Cleanup only + return multistep.ActionContinue +} + +func (s *StepCleanupVolumes) Cleanup(state multistep.StateBag) { + oapiconn := state.Get("oapi").(*oapi.Client) + vmRaw := state.Get("vm") + var vm oapi.Vm + if vmRaw != nil { + vm = vmRaw.(oapi.Vm) + } + ui := state.Get("ui").(packer.Ui) + if vm.VmId == "" { + ui.Say("No volumes to clean up, skipping") + return + } + + ui.Say("Cleaning up any extra volumes...") + + // Collect Volume information from the cached Vm as a map of volume-id + // to device name, to compare with save list below + var vl []string + volList := make(map[string]string) + for _, bdm := range vm.BlockDeviceMappings { + if !reflect.DeepEqual(bdm.Bsu, oapi.BsuCreated{}) { + vl = append(vl, bdm.Bsu.VolumeId) + volList[bdm.Bsu.VolumeId] = bdm.DeviceName + } + } + + // Using the volume list from the cached Vm, check with Outscale for up to + // date information on them + resp, err := oapiconn.POST_ReadVolumes(oapi.ReadVolumesRequest{ + Filters: oapi.FiltersVolume{ + VolumeIds: vl, + }, + }) + + if err != nil { + ui.Say(fmt.Sprintf("Error describing volumes: %s", err)) + return + } + + // If any of the returned volumes are in a "deleting" stage or otherwise not + // available, remove them from the list of volumes + for _, v := range resp.OK.Volumes { + if v.State != "" && v.State != "available" { + delete(volList, v.VolumeId) + } + } + + if len(resp.OK.Volumes) == 0 { + ui.Say("No volumes to clean up, skipping") + return + } + + // Filter out any devices created as part of the launch mappings, since + // we'll let outscale follow the `delete_on_vm_deletion` setting. + for _, b := range s.BlockDevices.LaunchMappings { + for volKey, volName := range volList { + if volName == b.DeviceName { + delete(volList, volKey) + } + } + } + + // Destroy remaining volumes + for k := range volList { + ui.Say(fmt.Sprintf("Destroying volume (%s)...", k)) + _, err := oapiconn.POST_DeleteVolume(oapi.DeleteVolumeRequest{VolumeId: k}) + if err != nil { + ui.Say(fmt.Sprintf("Error deleting volume: %s", err)) + } + + } +} diff --git a/builder/osc/common/step_create_tags.go b/builder/osc/common/step_create_tags.go new file mode 100644 index 000000000..44bdcc78c --- /dev/null +++ b/builder/osc/common/step_create_tags.go @@ -0,0 +1,151 @@ +package common + +import ( + "context" + "crypto/tls" + "fmt" + "net/http" + + "github.com/aws/aws-sdk-go/aws/awserr" + retry "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +type StepCreateTags struct { + Tags TagMap + SnapshotTags TagMap + Ctx interpolate.Context +} + +func (s *StepCreateTags) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + config := state.Get("clientConfig").(*oapi.Config) + ui := state.Get("ui").(packer.Ui) + omis := state.Get("omis").(map[string]string) + + if !s.Tags.IsSet() && !s.SnapshotTags.IsSet() { + return multistep.ActionContinue + } + + // Adds tags to OMIs and snapshots + for region, ami := range omis { + ui.Say(fmt.Sprintf("Adding tags to OMI (%s)...", ami)) + + newConfig := &oapi.Config{ + UserAgent: config.UserAgent, + SecretKey: config.SecretKey, + Service: config.Service, + Region: region, //New region + URL: config.URL, + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + regionConn := oapi.NewClient(newConfig, skipClient) + + // Retrieve image list for given OMI + resourceIds := []string{ami} + imageResp, err := regionConn.POST_ReadImages(oapi.ReadImagesRequest{ + Filters: oapi.FiltersImage{ + ImageIds: resourceIds, + }, + }) + + if err != nil { + err := fmt.Errorf("Error retrieving details for OMI (%s): %s", ami, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + if len(imageResp.OK.Images) == 0 { + err := fmt.Errorf("Error retrieving details for OMI (%s), no images found", ami) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + image := imageResp.OK.Images[0] + snapshotIds := []string{} + + // Add only those with a Snapshot ID, i.e. not Ephemeral + for _, device := range image.BlockDeviceMappings { + if device.Bsu.SnapshotId != "" { + ui.Say(fmt.Sprintf("Tagging snapshot: %s", device.Bsu.SnapshotId)) + resourceIds = append(resourceIds, device.Bsu.SnapshotId) + snapshotIds = append(snapshotIds, device.Bsu.SnapshotId) + } + } + + // Convert tags to oapi.Tag format + ui.Say("Creating OMI tags") + amiTags, err := s.Tags.OAPITags(s.Ctx, oapiconn.GetConfig().Region, state) + if err != nil { + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + amiTags.Report(ui) + + ui.Say("Creating snapshot tags") + snapshotTags, err := s.SnapshotTags.OAPITags(s.Ctx, oapiconn.GetConfig().Region, state) + if err != nil { + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + snapshotTags.Report(ui) + + // Retry creating tags for about 2.5 minutes + err = retry.Retry(0.2, 30, 11, func(_ uint) (bool, error) { + // Tag images and snapshots + _, err := regionConn.POST_CreateTags(oapi.CreateTagsRequest{ + ResourceIds: resourceIds, + Tags: amiTags, + }) + if awsErr, ok := err.(awserr.Error); ok { + if awsErr.Code() == "InvalidOMIID.NotFound" || + awsErr.Code() == "InvalidSnapshot.NotFound" { + return false, nil + } + } + + // Override tags on snapshots + if len(snapshotTags) > 0 { + _, err = regionConn.POST_CreateTags(oapi.CreateTagsRequest{ + ResourceIds: snapshotIds, + Tags: snapshotTags, + }) + } + if err == nil { + return true, nil + } + if awsErr, ok := err.(awserr.Error); ok { + if awsErr.Code() == "InvalidSnapshot.NotFound" { + return false, nil + } + } + return true, err + }) + + if err != nil { + err := fmt.Errorf("Error adding tags to Resources (%#v): %s", resourceIds, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + return multistep.ActionContinue +} + +func (s *StepCreateTags) Cleanup(state multistep.StateBag) { + // No cleanup... +} diff --git a/builder/osc/common/step_deregister_omi.go b/builder/osc/common/step_deregister_omi.go new file mode 100644 index 000000000..4d735ac3d --- /dev/null +++ b/builder/osc/common/step_deregister_omi.go @@ -0,0 +1,110 @@ +package common + +import ( + "context" + "crypto/tls" + "fmt" + "net/http" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +type StepDeregisterOMI struct { + AccessConfig *AccessConfig + ForceDeregister bool + ForceDeleteSnapshot bool + OMIName string + Regions []string +} + +func (s *StepDeregisterOMI) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + // Check for force deregister + if !s.ForceDeregister { + return multistep.ActionContinue + } + + ui := state.Get("ui").(packer.Ui) + oapiconn := state.Get("oapi").(*oapi.Client) + // Add the session region to list of regions will will deregister OMIs in + regions := append(s.Regions, oapiconn.GetConfig().Region) + + for _, region := range regions { + // get new connection for each region in which we need to deregister vms + config, err := s.AccessConfig.Config() + if err != nil { + return multistep.ActionHalt + } + + newConfig := &oapi.Config{ + UserAgent: config.UserAgent, + SecretKey: config.SecretKey, + Service: config.Service, + Region: region, //New region + URL: config.URL, + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + regionconn := oapi.NewClient(newConfig, skipClient) + + resp, err := regionconn.POST_ReadImages(oapi.ReadImagesRequest{ + Filters: oapi.FiltersImage{ + ImageNames: []string{s.OMIName}, + AccountAliases: []string{"self"}, + }, + }) + + if err != nil { + err := fmt.Errorf("Error describing OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // Deregister image(s) by name + for _, i := range resp.OK.Images { + //We are supposing that DeleteImage does the same action as DeregisterImage + _, err := regionconn.POST_DeleteImage(oapi.DeleteImageRequest{ + ImageId: i.ImageId, + }) + + if err != nil { + err := fmt.Errorf("Error deregistering existing OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + ui.Say(fmt.Sprintf("Deregistered OMI %s, id: %s", s.OMIName, i.ImageId)) + + // Delete snapshot(s) by image + if s.ForceDeleteSnapshot { + for _, b := range i.BlockDeviceMappings { + if b.Bsu.SnapshotId != "" { + _, err := regionconn.POST_DeleteSnapshot(oapi.DeleteSnapshotRequest{ + SnapshotId: b.Bsu.SnapshotId, + }) + + if err != nil { + err := fmt.Errorf("Error deleting existing snapshot: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + ui.Say(fmt.Sprintf("Deleted snapshot: %s", b.Bsu.SnapshotId)) + } + } + } + } + } + + return multistep.ActionContinue +} + +func (s *StepDeregisterOMI) Cleanup(state multistep.StateBag) { +} diff --git a/builder/osc/common/step_get_password.go b/builder/osc/common/step_get_password.go new file mode 100644 index 000000000..63ebbb288 --- /dev/null +++ b/builder/osc/common/step_get_password.go @@ -0,0 +1,179 @@ +package common + +import ( + "context" + "crypto/rsa" + "crypto/x509" + "encoding/base64" + "encoding/pem" + "errors" + "fmt" + "log" + "time" + + commonhelper "github.com/hashicorp/packer/helper/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepGetPassword reads the password from a Windows server and sets it +// on the WinRM config. +type StepGetPassword struct { + Debug bool + Comm *communicator.Config + Timeout time.Duration + BuildName string +} + +func (s *StepGetPassword) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + + // Skip if we're not using winrm + if s.Comm.Type != "winrm" { + log.Printf("[INFO] Not using winrm communicator, skipping get password...") + return multistep.ActionContinue + } + + // If we already have a password, skip it + if s.Comm.WinRMPassword != "" { + ui.Say("Skipping waiting for password since WinRM password set...") + return multistep.ActionContinue + } + + // Get the password + var password string + var err error + cancel := make(chan struct{}) + waitDone := make(chan bool, 1) + go func() { + ui.Say("Waiting for auto-generated password for vm...") + ui.Message( + "It is normal for this process to take up to 15 minutes,\n" + + "but it usually takes around 5. Please wait.") + password, err = s.waitForPassword(state, cancel) + waitDone <- true + }() + + timeout := time.After(s.Timeout) +WaitLoop: + for { + // Wait for either SSH to become available, a timeout to occur, + // or an interrupt to come through. + select { + case <-waitDone: + if err != nil { + ui.Error(fmt.Sprintf("Error waiting for password: %s", err)) + state.Put("error", err) + return multistep.ActionHalt + } + + ui.Message(fmt.Sprintf(" \nPassword retrieved!")) + s.Comm.WinRMPassword = password + break WaitLoop + case <-timeout: + err := fmt.Errorf("Timeout waiting for password.") + state.Put("error", err) + ui.Error(err.Error()) + close(cancel) + return multistep.ActionHalt + case <-time.After(1 * time.Second): + if _, ok := state.GetOk(multistep.StateCancelled); ok { + // The step sequence was cancelled, so cancel waiting for password + // and just start the halting process. + close(cancel) + log.Println("[WARN] Interrupt detected, quitting waiting for password.") + return multistep.ActionHalt + } + } + } + + // In debug-mode, we output the password + if s.Debug { + ui.Message(fmt.Sprintf( + "Password (since debug is enabled): %s", s.Comm.WinRMPassword)) + } + // store so that we can access this later during provisioning + + err = commonhelper.SetSharedState("winrm_password", s.Comm.WinRMPassword, s.BuildName) + if err != nil { + log.Printf("[WARN] commonhelper.SetSharedState returned error: %s", err) + } + packer.LogSecretFilter.Set(s.Comm.WinRMPassword) + + return multistep.ActionContinue +} + +func (s *StepGetPassword) Cleanup(multistep.StateBag) { + commonhelper.RemoveSharedStateFile("winrm_password", s.BuildName) +} + +func (s *StepGetPassword) waitForPassword(state multistep.StateBag, cancel <-chan struct{}) (string, error) { + oapiconn := state.Get("oapi").(*oapi.Client) + vm := state.Get("vm").(oapi.Vm) + privateKey := s.Comm.SSHPrivateKey + + for { + select { + case <-cancel: + log.Println("[INFO] Retrieve password wait cancelled. Exiting loop.") + return "", errors.New("Retrieve password wait cancelled") + case <-time.After(5 * time.Second): + } + + resp, err := oapiconn.POST_ReadAdminPassword(oapi.ReadAdminPasswordRequest{ + VmId: vm.VmId, + }) + if err != nil { + err := fmt.Errorf("Error retrieving auto-generated vm password: %s", err) + return "", err + } + + if resp.OK.AdminPassword != "" { + decryptedPassword, err := decryptPasswordDataWithPrivateKey( + resp.OK.AdminPassword, []byte(privateKey)) + if err != nil { + err := fmt.Errorf("Error decrypting auto-generated vm password: %s", err) + return "", err + } + + return decryptedPassword, nil + } + + log.Printf("[DEBUG] Password is blank, will retry...") + } +} + +func decryptPasswordDataWithPrivateKey(passwordData string, pemBytes []byte) (string, error) { + encryptedPasswd, err := base64.StdEncoding.DecodeString(passwordData) + if err != nil { + return "", err + } + + block, _ := pem.Decode(pemBytes) + var asn1Bytes []byte + if _, ok := block.Headers["DEK-Info"]; ok { + return "", errors.New("encrypted private key isn't yet supported") + /* + asn1Bytes, err = x509.DecryptPEMBlock(block, password) + if err != nil { + return "", err + } + */ + } else { + asn1Bytes = block.Bytes + } + + key, err := x509.ParsePKCS1PrivateKey(asn1Bytes) + if err != nil { + return "", err + } + + out, err := rsa.DecryptPKCS1v15(nil, key, encryptedPasswd) + if err != nil { + return "", err + } + + return string(out), nil +} diff --git a/builder/osc/common/step_key_pair.go b/builder/osc/common/step_key_pair.go new file mode 100644 index 000000000..effc9eec6 --- /dev/null +++ b/builder/osc/common/step_key_pair.go @@ -0,0 +1,123 @@ +package common + +import ( + "context" + "fmt" + "os" + "runtime" + + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +type StepKeyPair struct { + Debug bool + Comm *communicator.Config + DebugKeyPath string + + doCleanup bool +} + +func (s *StepKeyPair) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + + if s.Comm.SSHPrivateKeyFile != "" { + ui.Say("Using existing SSH private key") + privateKeyBytes, err := s.Comm.ReadSSHPrivateKeyFile() + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + s.Comm.SSHPrivateKey = privateKeyBytes + + return multistep.ActionContinue + } + + if s.Comm.SSHAgentAuth && s.Comm.SSHKeyPairName == "" { + ui.Say("Using SSH Agent with key pair in Source OMI") + return multistep.ActionContinue + } + + if s.Comm.SSHAgentAuth && s.Comm.SSHKeyPairName != "" { + ui.Say(fmt.Sprintf("Using SSH Agent for existing key pair %s", s.Comm.SSHKeyPairName)) + return multistep.ActionContinue + } + + if s.Comm.SSHTemporaryKeyPairName == "" { + ui.Say("Not using temporary keypair") + s.Comm.SSHKeyPairName = "" + return multistep.ActionContinue + } + + oapiconn := state.Get("oapi").(*oapi.Client) + + ui.Say(fmt.Sprintf("Creating temporary keypair: %s", s.Comm.SSHTemporaryKeyPairName)) + keyResp, err := oapiconn.POST_CreateKeypair(oapi.CreateKeypairRequest{ + KeypairName: s.Comm.SSHTemporaryKeyPairName}) + if err != nil { + state.Put("error", fmt.Errorf("Error creating temporary keypair: %s", err)) + return multistep.ActionHalt + } + + s.doCleanup = true + + // Set some data for use in future steps + s.Comm.SSHKeyPairName = s.Comm.SSHTemporaryKeyPairName + s.Comm.SSHPrivateKey = []byte(keyResp.OK.Keypair.PrivateKey) + + // If we're in debug mode, output the private key to the working + // directory. + if s.Debug { + ui.Message(fmt.Sprintf("Saving key for debug purposes: %s", s.DebugKeyPath)) + f, err := os.Create(s.DebugKeyPath) + if err != nil { + state.Put("error", fmt.Errorf("Error saving debug key: %s", err)) + return multistep.ActionHalt + } + defer f.Close() + + // Write the key out + if _, err := f.Write([]byte(keyResp.OK.Keypair.PrivateKey)); err != nil { + state.Put("error", fmt.Errorf("Error saving debug key: %s", err)) + return multistep.ActionHalt + } + + // Chmod it so that it is SSH ready + if runtime.GOOS != "windows" { + if err := f.Chmod(0600); err != nil { + state.Put("error", fmt.Errorf("Error setting permissions of debug key: %s", err)) + return multistep.ActionHalt + } + } + } + + return multistep.ActionContinue +} + +func (s *StepKeyPair) Cleanup(state multistep.StateBag) { + if !s.doCleanup { + return + } + + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + + // Remove the keypair + ui.Say("Deleting temporary keypair...") + _, err := oapiconn.POST_DeleteKeypair(oapi.DeleteKeypairRequest{KeypairName: s.Comm.SSHTemporaryKeyPairName}) + if err != nil { + ui.Error(fmt.Sprintf( + "Error cleaning up keypair. Please delete the key manually: %s", s.Comm.SSHTemporaryKeyPairName)) + } + + // Also remove the physical key if we're debugging. + if s.Debug { + if err := os.Remove(s.DebugKeyPath); err != nil { + ui.Error(fmt.Sprintf( + "Error removing debug key '%s': %s", s.DebugKeyPath, err)) + } + } +} diff --git a/builder/osc/common/step_network_info.go b/builder/osc/common/step_network_info.go new file mode 100644 index 000000000..937758bae --- /dev/null +++ b/builder/osc/common/step_network_info.go @@ -0,0 +1,158 @@ +package common + +import ( + "context" + "fmt" + "log" + "math/rand" + "sort" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepNetworkInfo queries OUTSCALE for information about +// NET's and Subnets that is used throughout the OMI creation process. +// +// Produces (adding them to the state bag): +// vpc_id string - the NET ID +// subnet_id string - the Subnet ID +// availability_zone string - the Subregion name +type StepNetworkInfo struct { + NetId string + NetFilter NetFilterOptions + SubnetId string + SubnetFilter SubnetFilterOptions + SubregionName string + SecurityGroupIds []string + SecurityGroupFilter SecurityGroupFilterOptions +} + +type subnetsSort []oapi.Subnet + +func (a subnetsSort) Len() int { return len(a) } +func (a subnetsSort) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a subnetsSort) Less(i, j int) bool { + return a[i].AvailableIpsCount < a[j].AvailableIpsCount +} + +// Returns the most recent OMI out of a slice of images. +func mostFreeSubnet(subnets []oapi.Subnet) oapi.Subnet { + sortedSubnets := subnets + sort.Sort(subnetsSort(sortedSubnets)) + return sortedSubnets[len(sortedSubnets)-1] +} + +func (s *StepNetworkInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + + // NET + if s.NetId == "" && !s.NetFilter.Empty() { + params := oapi.ReadNetsRequest{} + params.Filters = buildNetFilters(s.NetFilter.Filters) + s.NetFilter.Filters["state"] = "available" + + log.Printf("Using NET Filters %v", params) + + vpcResp, err := oapiconn.POST_ReadNets(params) + if err != nil { + err := fmt.Errorf("Error querying NETs: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + if len(vpcResp.OK.Nets) != 1 { + err := fmt.Errorf("Exactly one NET should match the filter, but %d NET's was found matching filters: %v", len(vpcResp.OK.Nets), params) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + s.NetId = vpcResp.OK.Nets[0].NetId + ui.Message(fmt.Sprintf("Found NET ID: %s", s.NetId)) + } + + // Subnet + if s.SubnetId == "" && !s.SubnetFilter.Empty() { + params := oapi.ReadSubnetsRequest{} + s.SubnetFilter.Filters["state"] = "available" + + if s.NetId != "" { + s.SubnetFilter.Filters["vpc-id"] = s.NetId + } + if s.SubregionName != "" { + s.SubnetFilter.Filters["availability-zone"] = s.SubregionName + } + params.Filters = buildSubnetFilters(s.SubnetFilter.Filters) + log.Printf("Using Subnet Filters %v", params) + + subnetsResp, err := oapiconn.POST_ReadSubnets(params) + if err != nil { + err := fmt.Errorf("Error querying Subnets: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + if len(subnetsResp.OK.Subnets) == 0 { + err := fmt.Errorf("No Subnets was found matching filters: %v", params) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + if len(subnetsResp.OK.Subnets) > 1 && !s.SubnetFilter.Random && !s.SubnetFilter.MostFree { + err := fmt.Errorf("Your filter matched %d Subnets. Please try a more specific search, or set random or most_free to true.", len(subnetsResp.OK.Subnets)) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + var subnet oapi.Subnet + switch { + case s.SubnetFilter.MostFree: + subnet = mostFreeSubnet(subnetsResp.OK.Subnets) + case s.SubnetFilter.Random: + subnet = subnetsResp.OK.Subnets[rand.Intn(len(subnetsResp.OK.Subnets))] + default: + subnet = subnetsResp.OK.Subnets[0] + } + s.SubnetId = subnet.SubnetId + ui.Message(fmt.Sprintf("Found Subnet ID: %s", s.SubnetId)) + } + + // Try to find Subregion and NET Id from Subnet if they are not yet found/given + if s.SubnetId != "" && (s.SubregionName == "" || s.NetId == "") { + log.Printf("[INFO] Finding Subregion and NetId for the given subnet '%s'", s.SubnetId) + resp, err := oapiconn.POST_ReadSubnets( + oapi.ReadSubnetsRequest{ + Filters: oapi.FiltersSubnet{ + SubnetIds: []string{s.SubnetId}, + }, + }) + if err != nil { + err := fmt.Errorf("Describing the subnet: %s returned error: %s.", s.SubnetId, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + if s.SubregionName == "" { + s.SubregionName = resp.OK.Subnets[0].SubregionName + log.Printf("[INFO] SubregionName found: '%s'", s.SubregionName) + } + if s.NetId == "" { + s.NetId = resp.OK.Subnets[0].NetId + log.Printf("[INFO] NetId found: '%s'", s.NetId) + } + } + + state.Put("net_id", s.NetId) + state.Put("subregion_name", s.SubregionName) + state.Put("subnet_id", s.SubnetId) + return multistep.ActionContinue +} + +func (s *StepNetworkInfo) Cleanup(multistep.StateBag) {} diff --git a/builder/osc/common/step_pre_validate.go b/builder/osc/common/step_pre_validate.go new file mode 100644 index 000000000..1b31232aa --- /dev/null +++ b/builder/osc/common/step_pre_validate.go @@ -0,0 +1,61 @@ +package common + +import ( + "context" + "fmt" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepPreValidate provides an opportunity to pre-validate any configuration for +// the build before actually doing any time consuming work +// +type StepPreValidate struct { + DestOmiName string + ForceDeregister bool +} + +func (s *StepPreValidate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + if s.ForceDeregister { + ui.Say("Force Deregister flag found, skipping prevalidating OMI Name") + return multistep.ActionContinue + } + + oapiconn := state.Get("oapi").(*oapi.Client) + + ui.Say(fmt.Sprintf("Prevalidating OMI Name: %s", s.DestOmiName)) + resp, err := oapiconn.POST_ReadImages(oapi.ReadImagesRequest{ + Filters: oapi.FiltersImage{ImageNames: []string{s.DestOmiName}}, + }) + + if err != nil { + err := fmt.Errorf("Error querying OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + //FIXME: Remove when the oAPI filters works + images := make([]oapi.Image, 0) + + for _, omi := range resp.OK.Images { + if omi.ImageName == s.DestOmiName { + images = append(images, omi) + } + } + + //if len(resp.OK.Images) > 0 { + if len(images) > 0 { + err := fmt.Errorf("Error: name conflicts with an existing OMI: %s", resp.OK.Images[0].ImageId) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepPreValidate) Cleanup(multistep.StateBag) {} diff --git a/builder/osc/common/step_run_source_vm.go b/builder/osc/common/step_run_source_vm.go new file mode 100644 index 000000000..85e74e68c --- /dev/null +++ b/builder/osc/common/step_run_source_vm.go @@ -0,0 +1,342 @@ +package common + +import ( + "context" + "encoding/base64" + "fmt" + "io/ioutil" + "log" + "reflect" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/outscale/osc-go/oapi" + + retry "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" +) + +const ( + RunSourceVmBSUExpectedRootDevice = "ebs" +) + +type StepRunSourceVm struct { + AssociatePublicIpAddress bool + BlockDevices BlockDevices + Comm *communicator.Config + Ctx interpolate.Context + Debug bool + BsuOptimized bool + EnableT2Unlimited bool + ExpectedRootDevice string + IamVmProfile string + VmInitiatedShutdownBehavior string + VmType string + IsRestricted bool + SourceOMI string + Tags TagMap + UserData string + UserDataFile string + VolumeTags TagMap + + vmId string +} + +func (s *StepRunSourceVm) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + + securityGroupIds := state.Get("securityGroupIds").([]string) + ui := state.Get("ui").(packer.Ui) + + userData := s.UserData + if s.UserDataFile != "" { + contents, err := ioutil.ReadFile(s.UserDataFile) + if err != nil { + state.Put("error", fmt.Errorf("Problem reading user data file: %s", err)) + return multistep.ActionHalt + } + + userData = string(contents) + } + + // Test if it is encoded already, and if not, encode it + if _, err := base64.StdEncoding.DecodeString(userData); err != nil { + log.Printf("[DEBUG] base64 encoding user data...") + userData = base64.StdEncoding.EncodeToString([]byte(userData)) + } + + ui.Say("Launching a source OUTSCALE vm...") + image, ok := state.Get("source_image").(oapi.Image) + if !ok { + state.Put("error", fmt.Errorf("source_image type assertion failed")) + return multistep.ActionHalt + } + s.SourceOMI = image.ImageId + + if s.ExpectedRootDevice != "" && image.RootDeviceType != s.ExpectedRootDevice { + state.Put("error", fmt.Errorf( + "The provided source OMI has an invalid root device type.\n"+ + "Expected '%s', got '%s'.", + s.ExpectedRootDevice, image.RootDeviceType)) + return multistep.ActionHalt + } + + var vmId string + + ui.Say("Adding tags to source vm") + if _, exists := s.Tags["Name"]; !exists { + s.Tags["Name"] = "Packer Builder" + } + + oapiTags, err := s.Tags.OAPITags(s.Ctx, oapiconn.GetConfig().Region, state) + if err != nil { + err := fmt.Errorf("Error tagging source vm: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + volTags, err := s.VolumeTags.OAPITags(s.Ctx, oapiconn.GetConfig().Region, state) + if err != nil { + err := fmt.Errorf("Error tagging volumes: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + subregion := state.Get("subregion_name").(string) + runOpts := oapi.CreateVmsRequest{ + ImageId: s.SourceOMI, + VmType: s.VmType, + UserData: userData, + MaxVmsCount: 1, + MinVmsCount: 1, + Placement: oapi.Placement{SubregionName: subregion}, + BsuOptimized: s.BsuOptimized, + BlockDeviceMappings: s.BlockDevices.BuildLaunchDevices(), + //IamVmProfile: oapi.IamVmProfileSpecification{Name: &s.IamVmProfile}, + } + + // if s.EnableT2Unlimited { + // creditOption := "unlimited" + // runOpts.CreditSpecification = &oapi.CreditSpecificationRequest{CpuCredits: &creditOption} + // } + + // Collect tags for tagging on resource creation + // var tagSpecs []oapi.ResourceTag + + // if len(oapiTags) > 0 { + // runTags := &oapi.ResourceTag{ + // ResourceType: aws.String("vm"), + // Tags: oapiTags, + // } + + // tagSpecs = append(tagSpecs, runTags) + // } + + // if len(volTags) > 0 { + // runVolTags := &oapi.TagSpecification{ + // ResourceType: aws.String("volume"), + // Tags: volTags, + // } + + // tagSpecs = append(tagSpecs, runVolTags) + // } + + // // If our region supports it, set tag specifications + // if len(tagSpecs) > 0 && !s.IsRestricted { + // runOpts.SetTagSpecifications(tagSpecs) + // oapiTags.Report(ui) + // volTags.Report(ui) + // } + + if s.Comm.SSHKeyPairName != "" { + runOpts.KeypairName = s.Comm.SSHKeyPairName + } + + subnetId := state.Get("subnet_id").(string) + + if subnetId != "" && s.AssociatePublicIpAddress { + runOpts.Nics = []oapi.NicForVmCreation{ + { + DeviceNumber: 0, + //AssociatePublicIpAddress: s.AssociatePublicIpAddress, + SubnetId: subnetId, + SecurityGroupIds: securityGroupIds, + DeleteOnVmDeletion: true, + }, + } + } else { + runOpts.SubnetId = subnetId + runOpts.SecurityGroupIds = securityGroupIds + } + + if s.ExpectedRootDevice == "bsu" { + runOpts.VmInitiatedShutdownBehavior = s.VmInitiatedShutdownBehavior + } + + runResp, err := oapiconn.POST_CreateVms(runOpts) + if err != nil { + err := fmt.Errorf("Error launching source vm: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + vmId = runResp.OK.Vms[0].VmId + volumeId := runResp.OK.Vms[0].BlockDeviceMappings[0].Bsu.VolumeId + + // Set the vm ID so that the cleanup works properly + s.vmId = vmId + + ui.Message(fmt.Sprintf("Vm ID: %s", vmId)) + ui.Say(fmt.Sprintf("Waiting for vm (%v) to become ready...", vmId)) + + request := oapi.ReadVmsRequest{ + Filters: oapi.FiltersVm{ + VmIds: []string{vmId}, + }, + } + if err := waitUntilForVmRunning(oapiconn, vmId); err != nil { + err := fmt.Errorf("Error waiting for vm (%s) to become ready: %s", vmId, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + //Set Vm tags and vollume tags + if len(oapiTags) > 0 { + if err := CreateTags(oapiconn, s.vmId, ui, oapiTags); err != nil { + err := fmt.Errorf("Error creating tags for vm (%s): %s", s.vmId, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + if len(volTags) > 0 { + if err := CreateTags(oapiconn, volumeId, ui, volTags); err != nil { + err := fmt.Errorf("Error creating tags for volume (%s): %s", volumeId, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + //TODO: LinkPublicIp i + + resp, err := oapiconn.POST_ReadVms(request) + + r := resp.OK + + if err != nil || len(r.Vms) == 0 { + err := fmt.Errorf("Error finding source vm.") + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + vm := r.Vms[0] + + if s.Debug { + if vm.PublicDnsName != "" { + ui.Message(fmt.Sprintf("Public DNS: %s", vm.PublicDnsName)) + } + + if vm.PublicIp != "" { + ui.Message(fmt.Sprintf("Public IP: %s", vm.PublicIp)) + } + + if vm.PrivateIp != "" { + ui.Message(fmt.Sprintf("Private IP: %s", vm.PublicIp)) + } + } + + state.Put("vm", vm) + + // If we're in a region that doesn't support tagging on vm creation, + // do that now. + + if s.IsRestricted { + oapiTags.Report(ui) + // Retry creating tags for about 2.5 minutes + err = retry.Retry(0.2, 30, 11, func(_ uint) (bool, error) { + _, err := oapiconn.POST_CreateTags(oapi.CreateTagsRequest{ + Tags: oapiTags, + ResourceIds: []string{vmId}, + }) + if err == nil { + return true, nil + } + //TODO: improve error + if awsErr, ok := err.(awserr.Error); ok { + if awsErr.Code() == "InvalidVmID.NotFound" { + return false, nil + } + } + return true, err + }) + + if err != nil { + err := fmt.Errorf("Error tagging source vm: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // Now tag volumes + + volumeIds := make([]string, 0) + for _, v := range vm.BlockDeviceMappings { + if bsu := v.Bsu; !reflect.DeepEqual(bsu, oapi.BsuCreated{}) { + volumeIds = append(volumeIds, bsu.VolumeId) + } + } + + if len(volumeIds) > 0 && s.VolumeTags.IsSet() { + ui.Say("Adding tags to source BSU Volumes") + + volumeTags, err := s.VolumeTags.OAPITags(s.Ctx, oapiconn.GetConfig().Region, state) + if err != nil { + err := fmt.Errorf("Error tagging source BSU Volumes on %s: %s", vm.VmId, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + volumeTags.Report(ui) + + _, err = oapiconn.POST_CreateTags(oapi.CreateTagsRequest{ + ResourceIds: volumeIds, + Tags: volumeTags, + }) + + if err != nil { + err := fmt.Errorf("Error tagging source BSU Volumes on %s: %s", vm.VmId, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + } + + return multistep.ActionContinue +} + +func (s *StepRunSourceVm) Cleanup(state multistep.StateBag) { + + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + + // Terminate the source vm if it exists + if s.vmId != "" { + ui.Say("Terminating the source OUTSCALE vm...") + if _, err := oapiconn.POST_DeleteVms(oapi.DeleteVmsRequest{VmIds: []string{s.vmId}}); err != nil { + ui.Error(fmt.Sprintf("Error terminating vm, may still be around: %s", err)) + return + } + + if err := waitUntilVmDeleted(oapiconn, s.vmId); err != nil { + ui.Error(err.Error()) + } + } +} diff --git a/builder/osc/common/step_security_group.go b/builder/osc/common/step_security_group.go new file mode 100644 index 000000000..1948c6435 --- /dev/null +++ b/builder/osc/common/step_security_group.go @@ -0,0 +1,175 @@ +package common + +import ( + "context" + "fmt" + "log" + "strings" + "time" + + "github.com/hashicorp/packer/common/uuid" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +type StepSecurityGroup struct { + CommConfig *communicator.Config + SecurityGroupFilter SecurityGroupFilterOptions + SecurityGroupIds []string + TemporarySGSourceCidr string + + createdGroupId string +} + +func (s *StepSecurityGroup) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + netId := state.Get("net_id").(string) + + if len(s.SecurityGroupIds) > 0 { + resp, err := oapiconn.POST_ReadSecurityGroups( + oapi.ReadSecurityGroupsRequest{ + Filters: oapi.FiltersSecurityGroup{ + SecurityGroupIds: s.SecurityGroupIds, + }, + }, + ) + if err != nil || resp.OK == nil || len(resp.OK.SecurityGroups) <= 0 { + err := fmt.Errorf("Couldn't find specified security group: %s", err) + log.Printf("[DEBUG] %s", err.Error()) + state.Put("error", err) + return multistep.ActionHalt + } + + log.Printf("Using specified security groups: %v", s.SecurityGroupIds) + state.Put("securityGroupIds", s.SecurityGroupIds) + return multistep.ActionContinue + } + + if !s.SecurityGroupFilter.Empty() { + + params := oapi.ReadSecurityGroupsRequest{} + if netId != "" { + s.SecurityGroupFilter.Filters["net-id"] = netId + } + params.Filters = buildSecurityGroupFilters(s.SecurityGroupFilter.Filters) + + log.Printf("Using SecurityGroup Filters %v", params) + + sgResp, err := oapiconn.POST_ReadSecurityGroups(params) + if err != nil || sgResp.OK == nil { + err := fmt.Errorf("Couldn't find security groups for filter: %s", err) + log.Printf("[DEBUG] %s", err.Error()) + state.Put("error", err) + return multistep.ActionHalt + } + + securityGroupIds := []string{} + for _, sg := range sgResp.OK.SecurityGroups { + securityGroupIds = append(securityGroupIds, sg.SecurityGroupId) + } + + ui.Message(fmt.Sprintf("Found Security Group(s): %s", strings.Join(securityGroupIds, ", "))) + state.Put("securityGroupIds", securityGroupIds) + + return multistep.ActionContinue + } + + port := s.CommConfig.Port() + if port == 0 { + if s.CommConfig.Type != "none" { + panic("port must be set to a non-zero value.") + } + } + + // Create the group + groupName := fmt.Sprintf("packer_%s", uuid.TimeOrderedUUID()) + ui.Say(fmt.Sprintf("Creating temporary security group for this instance: %s", groupName)) + group := oapi.CreateSecurityGroupRequest{ + SecurityGroupName: groupName, + Description: "Temporary group for Packer", + } + + group.NetId = netId + + groupResp, err := oapiconn.POST_CreateSecurityGroup(group) + if err != nil { + ui.Error(err.Error()) + state.Put("error", err) + return multistep.ActionHalt + } + + // Set the group ID so we can delete it later + s.createdGroupId = groupResp.OK.SecurityGroup.SecurityGroupId + + // Wait for the security group become available for authorizing + log.Printf("[DEBUG] Waiting for temporary security group: %s", s.createdGroupId) + err = waitForSecurityGroup(oapiconn, s.createdGroupId) + if err == nil { + log.Printf("[DEBUG] Found security group %s", s.createdGroupId) + } else { + err := fmt.Errorf("Timed out waiting for security group %s: %s", s.createdGroupId, err) + log.Printf("[DEBUG] %s", err.Error()) + state.Put("error", err) + return multistep.ActionHalt + } + + // Authorize the SSH access for the security group + groupRules := oapi.CreateSecurityGroupRuleRequest{ + SecurityGroupId: groupResp.OK.SecurityGroup.SecurityGroupId, + Flow: "Inbound", + Rules: []oapi.SecurityGroupRule{ + { + FromPortRange: int64(port), + ToPortRange: int64(port), + IpRanges: []string{s.TemporarySGSourceCidr}, + IpProtocol: "tcp", + }, + }, + } + + ui.Say(fmt.Sprintf( + "Authorizing access to port %d from %s in the temporary security group...", + port, s.TemporarySGSourceCidr)) + _, err = oapiconn.POST_CreateSecurityGroupRule(groupRules) + if err != nil { + err := fmt.Errorf("Error authorizing temporary security group: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // Set some state data for use in future steps + state.Put("securityGroupIds", []string{s.createdGroupId}) + + return multistep.ActionContinue +} + +func (s *StepSecurityGroup) Cleanup(state multistep.StateBag) { + if s.createdGroupId == "" { + return + } + + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + + ui.Say("Deleting temporary security group...") + + var err error + for i := 0; i < 5; i++ { + _, err = oapiconn.POST_DeleteSecurityGroup(oapi.DeleteSecurityGroupRequest{SecurityGroupId: s.createdGroupId}) + if err == nil { + break + } + + log.Printf("Error deleting security group: %s", err) + time.Sleep(5 * time.Second) + } + + if err != nil { + ui.Error(fmt.Sprintf( + "Error cleaning up security group. Please delete the group manually: %s", s.createdGroupId)) + } +} diff --git a/builder/osc/common/step_source_omi_info.go b/builder/osc/common/step_source_omi_info.go new file mode 100644 index 000000000..19ec926cc --- /dev/null +++ b/builder/osc/common/step_source_omi_info.go @@ -0,0 +1,100 @@ +package common + +import ( + "context" + "fmt" + "log" + "sort" + "time" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +// StepSourceOMIInfo extracts critical information from the source OMI +// that is used throughout the OMI creation process. +// +// Produces: +// source_image *oapi.Image - the source OMI info +type StepSourceOMIInfo struct { + SourceOmi string + OMIVirtType string + OmiFilters OmiFilterOptions +} + +type imageSort []oapi.Image + +func (a imageSort) Len() int { return len(a) } +func (a imageSort) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a imageSort) Less(i, j int) bool { + itime, _ := time.Parse(time.RFC3339, a[i].CreationDate) + jtime, _ := time.Parse(time.RFC3339, a[j].CreationDate) + return itime.Unix() < jtime.Unix() +} + +// Returns the most recent OMI out of a slice of images. +func mostRecentOmi(images []oapi.Image) oapi.Image { + sortedImages := images + sort.Sort(imageSort(sortedImages)) + return sortedImages[len(sortedImages)-1] +} + +func (s *StepSourceOMIInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + ui := state.Get("ui").(packer.Ui) + + params := oapi.ReadImagesRequest{ + Filters: oapi.FiltersImage{}, + } + + if s.SourceOmi != "" { + params.Filters.ImageIds = []string{s.SourceOmi} + } + + // We have filters to apply + if len(s.OmiFilters.Filters) > 0 { + params.Filters = buildOMIFilters(s.OmiFilters.Filters) + } + //TODO:Check if AccountIds correspond to Owners. + if len(s.OmiFilters.Owners) > 0 { + params.Filters.AccountIds = s.OmiFilters.Owners + } + + log.Printf("Using OMI Filters %#v", params) + imageResp, err := oapiconn.POST_ReadImages(params) + if err != nil { + err := fmt.Errorf("Error querying OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + if len(imageResp.OK.Images) == 0 { + err := fmt.Errorf("No OMI was found matching filters: %#v", params) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + if len(imageResp.OK.Images) > 1 && !s.OmiFilters.MostRecent { + err := fmt.Errorf("Your query returned more than one result. Please try a more specific search, or set most_recent to true.") + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + var image oapi.Image + if s.OmiFilters.MostRecent { + image = mostRecentOmi(imageResp.OK.Images) + } else { + image = imageResp.OK.Images[0] + } + + ui.Message(fmt.Sprintf("Found Image ID: %s", image.ImageId)) + + state.Put("source_image", image) + return multistep.ActionContinue +} + +func (s *StepSourceOMIInfo) Cleanup(multistep.StateBag) {} diff --git a/builder/osc/common/step_stop_bsu_backed_vm.go b/builder/osc/common/step_stop_bsu_backed_vm.go new file mode 100644 index 000000000..02076d35d --- /dev/null +++ b/builder/osc/common/step_stop_bsu_backed_vm.go @@ -0,0 +1,95 @@ +package common + +import ( + "context" + "fmt" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/outscale/osc-go/oapi" +) + +type StepStopBSUBackedVm struct { + Skip bool + DisableStopVm bool +} + +func (s *StepStopBSUBackedVm) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + vm := state.Get("vm").(oapi.Vm) + ui := state.Get("ui").(packer.Ui) + + // Skip when it is a spot vm + if s.Skip { + return multistep.ActionContinue + } + + var err error + + if !s.DisableStopVm { + // Stop the vm so we can create an AMI from it + ui.Say("Stopping the source vm...") + + // Amazon EC2 API follows an eventual consistency model. + + // This means that if you run a command to modify or describe a resource + // that you just created, its ID might not have propagated throughout + // the system, and you will get an error responding that the resource + // does not exist. + + // Work around this by retrying a few times, up to about 5 minutes. + err := common.Retry(10, 60, 6, func(i uint) (bool, error) { + ui.Message(fmt.Sprintf("Stopping vm, attempt %d", i+1)) + + _, err = oapiconn.POST_StopVms(oapi.StopVmsRequest{ + VmIds: []string{vm.VmId}, + }) + + if err == nil { + // success + return true, nil + } + + if awsErr, ok := err.(awserr.Error); ok { + if awsErr.Code() == "InvalidVmID.NotFound" { + ui.Message(fmt.Sprintf( + "Error stopping vm; will retry ..."+ + "Error: %s", err)) + // retry + return false, nil + } + } + // errored, but not in expected way. Don't want to retry + return true, err + }) + + if err != nil { + err := fmt.Errorf("Error stopping vm: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + } else { + ui.Say("Automatic vm stop disabled. Please stop vm manually.") + } + + // Wait for the vm to actually stop + ui.Say("Waiting for the vm to stop...") + err = waitUntilVmStopped(oapiconn, vm.VmId) + + if err != nil { + err := fmt.Errorf("Error waiting for vm to stop: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepStopBSUBackedVm) Cleanup(multistep.StateBag) { + // No cleanup... +} diff --git a/builder/osc/common/step_update_bsu_vm.go b/builder/osc/common/step_update_bsu_vm.go new file mode 100644 index 000000000..e348916a8 --- /dev/null +++ b/builder/osc/common/step_update_bsu_vm.go @@ -0,0 +1,63 @@ +package common + +import ( + "context" + + "github.com/hashicorp/packer/helper/multistep" +) + +type StepUpdateBSUBackedVm struct { + EnableAMIENASupport *bool + EnableAMISriovNetSupport bool +} + +func (s *StepUpdateBSUBackedVm) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + // oapiconn := state.Get("oapi").(*oapi.Client) + // vm := state.Get("vm").(*oapi.Vm) + // ui := state.Get("ui").(packer.Ui) + + // Set SriovNetSupport to "simple". See http://goo.gl/icuXh5 + // As of February 2017, this applies to C3, C4, D2, I2, R3, and M4 (excluding m4.16xlarge) + // if s.EnableAMISriovNetSupport { + // ui.Say("Enabling Enhanced Networking (SR-IOV)...") + // simple := "simple" + // _, err := oapiconn.POST_UpdateVm(oapi.UpdateVmRequest{ + // VmId: vm.VmId, + // SriovNetSupport: &oapi.AttributeValue{Value: &simple}, + // }) + // if err != nil { + // err := fmt.Errorf("Error enabling Enhanced Networking (SR-IOV) on %s: %s", *vm.VmId, err) + // state.Put("error", err) + // ui.Error(err.Error()) + // return multistep.ActionHalt + // } + // } + + // Handle EnaSupport flag. + // As of February 2017, this applies to C5, I3, P2, R4, X1, and m4.16xlarge + // if s.EnableAMIENASupport != nil { + // var prefix string + // if *s.EnableAMIENASupport { + // prefix = "En" + // } else { + // prefix = "Dis" + // } + // ui.Say(fmt.Sprintf("%sabling Enhanced Networking (ENA)...", prefix)) + // _, err := oapiconn.UpdateVmAttribute(&oapi.UpdateVmAttributeInput{ + // VmId: vm.VmId, + // EnaSupport: &oapi.AttributeBooleanValue{Value: aws.Bool(*s.EnableAMIENASupport)}, + // }) + // if err != nil { + // err := fmt.Errorf("Error %sabling Enhanced Networking (ENA) on %s: %s", strings.ToLower(prefix), *vm.VmId, err) + // state.Put("error", err) + // ui.Error(err.Error()) + // return multistep.ActionHalt + // } + // } + + return multistep.ActionContinue +} + +func (s *StepUpdateBSUBackedVm) Cleanup(state multistep.StateBag) { + // No cleanup... +} diff --git a/builder/osc/common/step_update_omi.go b/builder/osc/common/step_update_omi.go new file mode 100644 index 000000000..41ce69a89 --- /dev/null +++ b/builder/osc/common/step_update_omi.go @@ -0,0 +1,127 @@ +package common + +import ( + "context" + "crypto/tls" + "fmt" + "net/http" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +type StepUpdateOMIAttributes struct { + AccountIds []string + SnapshotAccountIds []string + Ctx interpolate.Context +} + +func (s *StepUpdateOMIAttributes) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + oapiconn := state.Get("oapi").(*oapi.Client) + config := state.Get("clientConfig").(*oapi.Config) + ui := state.Get("ui").(packer.Ui) + omis := state.Get("omis").(map[string]string) + snapshots := state.Get("snapshots").(map[string][]string) + + // Determine if there is any work to do. + valid := false + valid = valid || (s.AccountIds != nil && len(s.AccountIds) > 0) + valid = valid || (s.SnapshotAccountIds != nil && len(s.SnapshotAccountIds) > 0) + + if !valid { + return multistep.ActionContinue + } + + s.Ctx.Data = extractBuildInfo(oapiconn.GetConfig().Region, state) + + updateSnapshoptRequest := oapi.UpdateSnapshotRequest{ + PermissionsToCreateVolume: oapi.PermissionsOnResourceCreation{ + Additions: oapi.PermissionsOnResource{ + AccountIds: s.AccountIds, + GlobalPermission: false, + }, + }, + } + + updateImageRequest := oapi.UpdateImageRequest{ + PermissionsToLaunch: oapi.PermissionsOnResourceCreation{ + Additions: oapi.PermissionsOnResource{ + AccountIds: s.AccountIds, + GlobalPermission: false, + }, + }, + } + + // Updating image attributes + for region, omi := range omis { + ui.Say(fmt.Sprintf("Updating attributes on OMI (%s)...", omi)) + newConfig := &oapi.Config{ + UserAgent: config.UserAgent, + AccessKey: config.AccessKey, + SecretKey: config.SecretKey, + Service: config.Service, + Region: region, //New region + URL: config.URL, + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + regionconn := oapi.NewClient(newConfig, skipClient) + + ui.Message(fmt.Sprintf("Updating: %s", omi)) + updateImageRequest.ImageId = omi + _, err := regionconn.POST_UpdateImage(updateImageRequest) + if err != nil { + err := fmt.Errorf("Error updating OMI: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + // Updating snapshot attributes + for region, region_snapshots := range snapshots { + for _, snapshot := range region_snapshots { + ui.Say(fmt.Sprintf("Updating attributes on snapshot (%s)...", snapshot)) + newConfig := &oapi.Config{ + UserAgent: config.UserAgent, + AccessKey: config.AccessKey, + SecretKey: config.SecretKey, + Service: config.Service, + Region: region, //New region + URL: config.URL, + } + + skipClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + + regionconn := oapi.NewClient(newConfig, skipClient) + + ui.Message(fmt.Sprintf("Updating: %s", snapshot)) + updateSnapshoptRequest.SnapshotId = snapshot + _, err := regionconn.POST_UpdateSnapshot(updateSnapshoptRequest) + if err != nil { + err := fmt.Errorf("Error updating snapshot: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + } + } + + return multistep.ActionContinue +} + +func (s *StepUpdateOMIAttributes) Cleanup(state multistep.StateBag) { + // No cleanup... +} diff --git a/builder/osc/common/tags.go b/builder/osc/common/tags.go new file mode 100644 index 000000000..c42d48db7 --- /dev/null +++ b/builder/osc/common/tags.go @@ -0,0 +1,56 @@ +package common + +import ( + "fmt" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/outscale/osc-go/oapi" +) + +type TagMap map[string]string +type OAPITags []oapi.ResourceTag + +func (t OAPITags) Report(ui packer.Ui) { + for _, tag := range t { + ui.Message(fmt.Sprintf("Adding tag: \"%s\": \"%s\"", + tag.Key, tag.Value)) + } +} + +func (t TagMap) IsSet() bool { + return len(t) > 0 +} + +func (t TagMap) OAPITags(ctx interpolate.Context, region string, state multistep.StateBag) (OAPITags, error) { + var oapiTags []oapi.ResourceTag + ctx.Data = extractBuildInfo(region, state) + + for key, value := range t { + interpolatedKey, err := interpolate.Render(key, &ctx) + if err != nil { + return nil, fmt.Errorf("Error processing tag: %s:%s - %s", key, value, err) + } + interpolatedValue, err := interpolate.Render(value, &ctx) + if err != nil { + return nil, fmt.Errorf("Error processing tag: %s:%s - %s", key, value, err) + } + oapiTags = append(oapiTags, oapi.ResourceTag{ + Key: interpolatedKey, + Value: interpolatedValue, + }) + } + return oapiTags, nil +} + +func CreateTags(conn *oapi.Client, resourceID string, ui packer.Ui, tags OAPITags) error { + tags.Report(ui) + + _, err := conn.POST_CreateTags(oapi.CreateTagsRequest{ + ResourceIds: []string{resourceID}, + Tags: tags, + }) + + return err +} diff --git a/builder/osc/common/temp_const.go b/builder/osc/common/temp_const.go new file mode 100644 index 000000000..d43e0276d --- /dev/null +++ b/builder/osc/common/temp_const.go @@ -0,0 +1,18 @@ +package common + +const ( + // VolumeTypeStandard is a VolumeType enum value + VolumeTypeStandard = "standard" + + // VolumeTypeIo1 is a VolumeType enum value + VolumeTypeIo1 = "io1" + + // VolumeTypeGp2 is a VolumeType enum value + VolumeTypeGp2 = "gp2" + + // VolumeTypeSc1 is a VolumeType enum value + VolumeTypeSc1 = "sc1" + + // VolumeTypeSt1 is a VolumeType enum value + VolumeTypeSt1 = "st1" +) diff --git a/builder/osc/common/template_funcs.go b/builder/osc/common/template_funcs.go new file mode 100644 index 000000000..78680c5c1 --- /dev/null +++ b/builder/osc/common/template_funcs.go @@ -0,0 +1,37 @@ +package common + +import ( + "bytes" + "html/template" +) + +func isalphanumeric(b byte) bool { + if '0' <= b && b <= '9' { + return true + } + if 'a' <= b && b <= 'z' { + return true + } + if 'A' <= b && b <= 'Z' { + return true + } + return false +} + +func templateCleanResourceName(s string) string { + allowed := []byte{'(', ')', '[', ']', ' ', '.', '/', '-', '\'', '@', '_'} + b := []byte(s) + newb := make([]byte, len(b)) + for i, c := range b { + if isalphanumeric(c) || bytes.IndexByte(allowed, c) != -1 { + newb[i] = c + } else { + newb[i] = '-' + } + } + return string(newb[:]) +} + +var TemplateFuncs = template.FuncMap{ + "clean_resource_name": templateCleanResourceName, +} diff --git a/builder/parallels/common/ssh.go b/builder/parallels/common/ssh.go index 7c94006eb..df82c8082 100644 --- a/builder/parallels/common/ssh.go +++ b/builder/parallels/common/ssh.go @@ -1,23 +1,31 @@ package common import ( + "log" + "github.com/hashicorp/packer/helper/multistep" ) // CommHost returns the VM's IP address which should be used to access it by SSH. -func CommHost(state multistep.StateBag) (string, error) { - vmName := state.Get("vmName").(string) - driver := state.Get("driver").(Driver) +func CommHost(host string) func(multistep.StateBag) (string, error) { + return func(state multistep.StateBag) (string, error) { + if host != "" { + log.Printf("Using ssh_host value: %s", host) + return host, nil + } + vmName := state.Get("vmName").(string) + driver := state.Get("driver").(Driver) - mac, err := driver.MAC(vmName) - if err != nil { - return "", err + mac, err := driver.MAC(vmName) + if err != nil { + return "", err + } + + ip, err := driver.IPAddress(mac) + if err != nil { + return "", err + } + + return ip, nil } - - ip, err := driver.IPAddress(mac) - if err != nil { - return "", err - } - - return ip, nil } diff --git a/builder/parallels/iso/builder.go b/builder/parallels/iso/builder.go index 63b4aa618..38eda1c87 100644 --- a/builder/parallels/iso/builder.go +++ b/builder/parallels/iso/builder.go @@ -231,7 +231,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, &communicator.StepConnect{ Config: &b.config.SSHConfig.Comm, - Host: parallelscommon.CommHost, + Host: parallelscommon.CommHost(b.config.SSHConfig.Comm.SSHHost), SSHConfig: b.config.SSHConfig.Comm.SSHConfigFunc(), }, ¶llelscommon.StepUploadVersion{ diff --git a/builder/parallels/pvm/builder.go b/builder/parallels/pvm/builder.go index a19e6b833..d62415a3d 100644 --- a/builder/parallels/pvm/builder.go +++ b/builder/parallels/pvm/builder.go @@ -85,7 +85,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, &communicator.StepConnect{ Config: &b.config.SSHConfig.Comm, - Host: parallelscommon.CommHost, + Host: parallelscommon.CommHost(b.config.SSHConfig.Comm.SSHHost), SSHConfig: b.config.SSHConfig.Comm.SSHConfigFunc(), }, ¶llelscommon.StepUploadVersion{ diff --git a/builder/profitbricks/builder.go b/builder/profitbricks/builder.go index dd678c35e..3ab9d18fe 100644 --- a/builder/profitbricks/builder.go +++ b/builder/profitbricks/builder.go @@ -41,7 +41,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack new(stepCreateServer), &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "server_ip"), SSHConfig: b.config.Comm.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/profitbricks/ssh.go b/builder/profitbricks/ssh.go deleted file mode 100644 index c860bc841..000000000 --- a/builder/profitbricks/ssh.go +++ /dev/null @@ -1,10 +0,0 @@ -package profitbricks - -import ( - "github.com/hashicorp/packer/helper/multistep" -) - -func commHost(state multistep.StateBag) (string, error) { - ipAddress := state.Get("server_ip").(string) - return ipAddress, nil -} diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index ea5857968..bb5cddba6 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -122,6 +122,15 @@ type Config struct { // does not include WHPX support and users may need to compile or source a // build of QEMU for Windows themselves with WHPX support. Accelerator string `mapstructure:"accelerator" required:"false"` + // Additional disks to create. Uses `vm_name` as the disk name template and + // appends `-#` where `#` is the position in the array. `#` starts at 1 since 0 + // is the default disk. Each string represents the disk image size in bytes. + // Optional suffixes 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' + // (gigabyte, 1024M), 'T' (terabyte, 1024G), 'P' (petabyte, 1024T) and 'E' + // (exabyte, 1024P) are supported. 'b' is ignored. Per qemu-img documentation. + // Each additional disk uses the same disk parameters as the default disk. + // Unset by default. + AdditionalDiskSize []string `mapstructure:"disk_additional_size" required:"false"` // The number of cpus to use when building the VM. // The default is `1` CPU. CpuCount int `mapstructure:"cpus" required:"false"` @@ -270,13 +279,18 @@ type Config struct { // some platforms. For example qemu-kvm, or qemu-system-i386 may be a // better choice for some systems. QemuBinary string `mapstructure:"qemu_binary" required:"false"` - // The minimum and - // maximum port to use for the SSH port on the host machine which is forwarded - // to the SSH port on the guest machine. Because Packer often runs in parallel, - // Packer will choose a randomly available port in this range to use as the - // host port. By default this is 2222 to 4444. + // Enable QMP socket. Location is specified by `qmp_socket_path`. Defaults + // to false. + QMPEnable bool `mapstructure:"qmp_enable" required:"false"` + // QMP Socket Path when `qmp_enable` is true. Defaults to + // `output_directory`/`vm_name`.monitor. + QMPSocketPath string `mapstructure:"qmp_socket_path" required:"false"` + // The minimum and maximum port to use for the SSH port on the host machine + // which is forwarded to the SSH port on the guest machine. Because Packer + // often runs in parallel, Packer will choose a randomly available port in + // this range to use as the host port. By default this is 2222 to 4444. SSHHostPortMin int `mapstructure:"ssh_host_port_min" required:"false"` - SSHHostPortMax int `mapstructure:"ssh_host_port_max"` + SSHHostPortMax int `mapstructure:"ssh_host_port_max" required:"false"` // If true, do not pass a -display option // to qemu, allowing it to choose the default. This may be needed when running // under macOS, and getting errors about sdl not being available. @@ -285,6 +299,10 @@ type Config struct { // binded to for VNC. By default packer will use 127.0.0.1 for this. If you // wish to bind to all interfaces use 0.0.0.0. VNCBindAddress string `mapstructure:"vnc_bind_address" required:"false"` + // Whether or not to set a password on the VNC server. This option + // automatically enables the QMP socket. See `qmp_socket_path`. Defaults to + // `false`. + VNCUsePassword bool `mapstructure:"vnc_use_password" required:"false"` // The minimum and maximum port // to use for VNC access to the virtual machine. The builder uses VNC to type // the initial boot_command. Because Packer generally runs in parallel, @@ -300,7 +318,7 @@ type Config struct { // These are deprecated, but we keep them around for BC // TODO(@mitchellh): remove - SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout"` + SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout" required:"false"` // TODO(mitchellh): deprecate RunOnce bool `mapstructure:"run_once"` @@ -458,6 +476,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs, errors.New("use_backing_file can only be enabled for QCOW2 images and when disk_image is true")) } + if b.config.DiskImage && len(b.config.AdditionalDiskSize) > 0 { + errs = packer.MultiErrorAppend( + errs, errors.New("disk_additional_size can only be used when disk_image is false")) + } + if _, ok := accels[b.config.Accelerator]; !ok { errs = packer.MultiErrorAppend( errs, errors.New("invalid accelerator, only 'kvm', 'tcg', 'xen', 'hax', 'hvf', 'whpx', or 'none' are allowed")) @@ -500,6 +523,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs = packer.MultiErrorAppend( errs, errors.New("ssh_host_port_min must be less than ssh_host_port_max")) } + if b.config.SSHHostPortMin < 0 { errs = packer.MultiErrorAppend( errs, errors.New("ssh_host_port_min must be positive")) @@ -510,6 +534,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs, fmt.Errorf("vnc_port_min must be less than vnc_port_max")) } + if b.config.VNCUsePassword && b.config.QMPSocketPath == "" { + socketName := fmt.Sprintf("%s.monitor", b.config.VMName) + b.config.QMPSocketPath = filepath.Join(b.config.OutputDir, socketName) + } + if b.config.QemuArgs == nil { b.config.QemuArgs = make([][]string, 0) } @@ -581,6 +610,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack steps = append(steps, new(stepConfigureVNC), steprun, + new(stepConfigureQMP), &stepTypeBootCommand{}, ) @@ -588,7 +618,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack steps = append(steps, &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, + Host: commHost(b.config.Comm.SSHHost), SSHConfig: b.config.Comm.SSHConfigFunc(), SSHPort: commPort, WinRMPort: commPort, @@ -662,7 +692,11 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack state: make(map[string]interface{}), } - artifact.state["diskName"] = state.Get("disk_filename").(string) + artifact.state["diskName"] = b.config.VMName + diskpaths, ok := state.Get("qemu_disk_paths").([]string) + if ok { + artifact.state["diskPaths"] = diskpaths + } artifact.state["diskType"] = b.config.Format artifact.state["diskSize"] = uint64(b.config.DiskSize) artifact.state["domainType"] = b.config.Accelerator diff --git a/builder/qemu/builder_test.go b/builder/qemu/builder_test.go index d0d403666..122caa754 100644 --- a/builder/qemu/builder_test.go +++ b/builder/qemu/builder_test.go @@ -4,6 +4,7 @@ import ( "fmt" "io/ioutil" "os" + "path/filepath" "reflect" "testing" @@ -187,6 +188,36 @@ func TestBuilderPrepare_DiskSize(t *testing.T) { } } +func TestBuilderPrepare_AdditionalDiskSize(t *testing.T) { + var b Builder + config := testConfig() + + config["disk_additional_size"] = []string{"1M"} + config["disk_image"] = true + warns, err := b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err == nil { + t.Fatalf("should have error") + } + + delete(config, "disk_image") + config["disk_additional_size"] = []string{"1M"} + b = Builder{} + warns, err = b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("should not have error: %s", err) + } + + if b.config.AdditionalDiskSize[0] != "1M" { + t.Fatalf("bad size: %s", b.config.AdditionalDiskSize) + } +} + func TestBuilderPrepare_Format(t *testing.T) { var b Builder config := testConfig() @@ -568,3 +599,24 @@ func TestBuilderPrepare_QemuArgs(t *testing.T) { t.Fatalf("bad: %#v", b.config.QemuArgs) } } + +func TestBuilderPrepare_VNCPassword(t *testing.T) { + var b Builder + config := testConfig() + + config["vnc_use_password"] = true + config["output_directory"] = "not-a-real-directory" + b = Builder{} + warns, err := b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("should not have error: %s", err) + } + + expected := filepath.Join("not-a-real-directory", "packer-foo.monitor") + if !reflect.DeepEqual(b.config.QMPSocketPath, expected) { + t.Fatalf("Bad QMP socket Path: %s", b.config.QMPSocketPath) + } +} diff --git a/builder/qemu/ssh.go b/builder/qemu/ssh.go index 1fe4537bd..a444dc0c4 100644 --- a/builder/qemu/ssh.go +++ b/builder/qemu/ssh.go @@ -1,11 +1,20 @@ package qemu import ( + "log" + "github.com/hashicorp/packer/helper/multistep" ) -func commHost(state multistep.StateBag) (string, error) { - return "127.0.0.1", nil +func commHost(host string) func(multistep.StateBag) (string, error) { + return func(state multistep.StateBag) (string, error) { + if host != "" { + log.Printf("Using ssh_host value: %s", host) + return host, nil + } + + return "127.0.0.1", nil + } } func commPort(state multistep.StateBag) (int, error) { diff --git a/builder/qemu/step_configure_qmp.go b/builder/qemu/step_configure_qmp.go new file mode 100644 index 000000000..fa988ad0b --- /dev/null +++ b/builder/qemu/step_configure_qmp.go @@ -0,0 +1,89 @@ +package qemu + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/digitalocean/go-qemu/qmp" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +// This step configures the VM to enable the QMP listener. +// +// Uses: +// config *config +// ui packer.Ui +// +// Produces: +type stepConfigureQMP struct { + monitor *qmp.SocketMonitor +} + +func (s *stepConfigureQMP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + ui := state.Get("ui").(packer.Ui) + + if !config.VNCUsePassword { + return multistep.ActionContinue + } + + msg := fmt.Sprintf("QMP socket at: %s", config.QMPSocketPath) + ui.Say(msg) + log.Print(msg) + + // Only initialize and open QMP when we have a use for it. + // Open QMP socket + var err error + var cmd []byte + var result []byte + s.monitor, err = qmp.NewSocketMonitor("unix", config.QMPSocketPath, 2*time.Second) + if err != nil { + err := fmt.Errorf("Error opening QMP socket: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + QMPMonitor := s.monitor + vncPassword := state.Get("vnc_password") + + // Connect to QMP + // function automatically calls capabilities so is immediately ready for commands + err = QMPMonitor.Connect() + if err != nil { + err := fmt.Errorf("Error connecting to QMP socket: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + log.Printf("QMP socket open SUCCESS") + + cmd = []byte(fmt.Sprintf("{ \"execute\": \"change-vnc-password\", \"arguments\": { \"password\": \"%s\" } }", + vncPassword)) + result, err = QMPMonitor.Run(cmd) + if err != nil { + err := fmt.Errorf("Error connecting to QMP socket: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + msg = fmt.Sprintf("QMP Command: %s\nResult: %s", cmd, result) + log.Printf(msg) + + // Put QMP monitor in statebag in case there is a use in a following step + // Uncomment for future case as it is unused for now + //state.Put("qmp_monitor", QMPMonitor) + + return multistep.ActionContinue +} + +func (s *stepConfigureQMP) Cleanup(multistep.StateBag) { + if s.monitor != nil { + err := s.monitor.Disconnect() + if err != nil { + log.Printf("failed to disconnect QMP: %v", err) + } + } +} diff --git a/builder/qemu/step_configure_vnc.go b/builder/qemu/step_configure_vnc.go index 465288e7f..34aed791e 100644 --- a/builder/qemu/step_configure_vnc.go +++ b/builder/qemu/step_configure_vnc.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "math/rand" "github.com/hashicorp/packer/common/net" "github.com/hashicorp/packer/helper/multistep" @@ -22,6 +23,21 @@ type stepConfigureVNC struct { l *net.Listener } +func VNCPassword() string { + length := int(8) + + charSet := []byte("012345689abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + charSetLength := len(charSet) + + password := make([]byte, length) + + for i := 0; i < length; i++ { + password[i] = charSet[rand.Intn(charSetLength)] + } + + return string(password) +} + func (s *stepConfigureVNC) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) ui := state.Get("ui").(packer.Ui) @@ -33,6 +49,7 @@ func (s *stepConfigureVNC) Run(ctx context.Context, state multistep.StateBag) mu ui.Say(msg) log.Print(msg) + var vncPassword string var err error s.l, err = net.ListenRangeConfig{ Addr: config.VNCBindAddress, @@ -41,7 +58,7 @@ func (s *stepConfigureVNC) Run(ctx context.Context, state multistep.StateBag) mu Network: "tcp", }.Listen(ctx) if err != nil { - err := fmt.Errorf("Error finding port: %s", err) + err := fmt.Errorf("Error finding VNC port: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt @@ -49,9 +66,15 @@ func (s *stepConfigureVNC) Run(ctx context.Context, state multistep.StateBag) mu s.l.Listener.Close() // free port, but don't unlock lock file vncPort := s.l.Port + if config.VNCUsePassword { + vncPassword = VNCPassword() + } else { + vncPassword = "" + } + log.Printf("Found available VNC port: %d on IP: %s", vncPort, config.VNCBindAddress) state.Put("vnc_port", vncPort) - state.Put("vnc_ip", config.VNCBindAddress) + state.Put("vnc_password", vncPassword) return multistep.ActionContinue } diff --git a/builder/qemu/step_convert_disk.go b/builder/qemu/step_convert_disk.go index 067722be1..249efb414 100644 --- a/builder/qemu/step_convert_disk.go +++ b/builder/qemu/step_convert_disk.go @@ -22,7 +22,7 @@ type stepConvertDisk struct{} func (s *stepConvertDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - diskName := state.Get("disk_filename").(string) + diskName := config.VMName ui := state.Get("ui").(packer.Ui) if config.SkipCompaction && !config.DiskCompression { diff --git a/builder/qemu/step_copy_disk.go b/builder/qemu/step_copy_disk.go index e18e59657..e5fa4de46 100644 --- a/builder/qemu/step_copy_disk.go +++ b/builder/qemu/step_copy_disk.go @@ -19,7 +19,6 @@ func (s *stepCopyDisk) Run(ctx context.Context, state multistep.StateBag) multis isoPath := state.Get("iso_path").(string) ui := state.Get("ui").(packer.Ui) path := filepath.Join(config.OutputDir, fmt.Sprintf("%s", config.VMName)) - name := config.VMName command := []string{ "convert", @@ -40,8 +39,6 @@ func (s *stepCopyDisk) Run(ctx context.Context, state multistep.StateBag) multis return multistep.ActionHalt } - state.Put("disk_filename", name) - return multistep.ActionContinue } diff --git a/builder/qemu/step_create_disk.go b/builder/qemu/step_create_disk.go index e7a6db046..8fb18d025 100644 --- a/builder/qemu/step_create_disk.go +++ b/builder/qemu/step_create_disk.go @@ -3,6 +3,7 @@ package qemu import ( "context" "fmt" + "log" "path/filepath" "github.com/hashicorp/packer/helper/multistep" @@ -18,36 +19,54 @@ func (s *stepCreateDisk) Run(ctx context.Context, state multistep.StateBag) mult driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) name := config.VMName - path := filepath.Join(config.OutputDir, name) - - command := []string{ - "create", - "-f", config.Format, - } - - if config.UseBackingFile { - isoPath := state.Get("iso_path").(string) - command = append(command, "-b", isoPath) - } - - command = append(command, - path, - fmt.Sprintf("%vM", config.DiskSize), - ) if config.DiskImage && !config.UseBackingFile { return multistep.ActionContinue } - ui.Say("Creating hard drive...") - if err := driver.QemuImg(command...); err != nil { - err := fmt.Errorf("Error creating hard drive: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt + var diskFullPaths, diskSizes []string + + ui.Say("Creating required virtual machine disks") + // The 'main' or 'default' disk + diskFullPaths = append(diskFullPaths, filepath.Join(config.OutputDir, name)) + diskSizes = append(diskSizes, fmt.Sprintf("%dM", uint64(config.DiskSize))) + // Additional disks + if len(config.AdditionalDiskSize) > 0 { + for i, diskSize := range config.AdditionalDiskSize { + path := filepath.Join(config.OutputDir, fmt.Sprintf("%s-%d", name, i+1)) + diskFullPaths = append(diskFullPaths, path) + size := fmt.Sprintf("%s", diskSize) + diskSizes = append(diskSizes, size) + } } - state.Put("disk_filename", name) + // Create all required disks + for i, diskFullPath := range diskFullPaths { + log.Printf("[INFO] Creating disk with Path: %s and Size: %s", diskFullPath, diskSizes[i]) + command := []string{ + "create", + "-f", config.Format, + } + + if config.UseBackingFile && i == 0 { + isoPath := state.Get("iso_path").(string) + command = append(command, "-b", isoPath) + } + + command = append(command, + diskFullPath, + diskSizes[i]) + + if err := driver.QemuImg(command...); err != nil { + err := fmt.Errorf("Error creating hard drive: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + // Stash the disk paths so we can retrieve later + state.Put("qemu_disk_paths", diskFullPaths) return multistep.ActionContinue } diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index b0e10e4a1..55390168c 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -62,12 +62,10 @@ func (s *stepRun) Cleanup(state multistep.StateBag) { func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error) { config := state.Get("config").(*Config) isoPath := state.Get("iso_path").(string) - vncIP := state.Get("vnc_ip").(string) + vncIP := config.VNCBindAddress vncPort := state.Get("vnc_port").(int) ui := state.Get("ui").(packer.Ui) driver := state.Get("driver").(Driver) - - vnc := fmt.Sprintf("%s:%d", vncIP, vncPort-5900) vmName := config.VMName imgPath := filepath.Join(config.OutputDir, vmName) @@ -75,6 +73,14 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error var deviceArgs []string var driveArgs []string var sshHostPort int + var vnc string + + if !config.VNCUsePassword { + vnc = fmt.Sprintf("%s:%d", vncIP, vncPort-5900) + } else { + vnc = fmt.Sprintf("%s:%d,password", vncIP, vncPort-5900) + defaultArgs["-qmp"] = fmt.Sprintf("unix:%s,server,nowait", config.QMPSocketPath) + } defaultArgs["-name"] = vmName defaultArgs["-machine"] = fmt.Sprintf("type=%s", config.MachineType) @@ -94,19 +100,42 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error if qemuVersion.GreaterThanOrEqual(v2) { if config.DiskInterface == "virtio-scsi" { - deviceArgs = append(deviceArgs, "virtio-scsi-pci,id=scsi0", "scsi-hd,bus=scsi0.0,drive=drive0") - driveArgumentString := fmt.Sprintf("if=none,file=%s,id=drive0,cache=%s,discard=%s,format=%s", imgPath, config.DiskCache, config.DiskDiscard, config.Format) - if config.DetectZeroes != "off" { - driveArgumentString = fmt.Sprintf("%s,detect-zeroes=%s", driveArgumentString, config.DetectZeroes) + if config.DiskImage { + deviceArgs = append(deviceArgs, "virtio-scsi-pci,id=scsi0", "scsi-hd,bus=scsi0.0,drive=drive0") + driveArgumentString := fmt.Sprintf("if=none,file=%s,id=drive0,cache=%s,discard=%s,format=%s", imgPath, config.DiskCache, config.DiskDiscard, config.Format) + if config.DetectZeroes != "off" { + driveArgumentString = fmt.Sprintf("%s,detect-zeroes=%s", driveArgumentString, config.DetectZeroes) + } + driveArgs = append(driveArgs, driveArgumentString) + } else { + deviceArgs = append(deviceArgs, "virtio-scsi-pci,id=scsi0") + diskFullPaths := state.Get("qemu_disk_paths").([]string) + for i, diskFullPath := range diskFullPaths { + deviceArgs = append(deviceArgs, fmt.Sprintf("scsi-hd,bus=scsi0.0,drive=drive%d", i)) + driveArgumentString := fmt.Sprintf("if=none,file=%s,id=drive%d,cache=%s,discard=%s,format=%s", diskFullPath, i, config.DiskCache, config.DiskDiscard, config.Format) + if config.DetectZeroes != "off" { + driveArgumentString = fmt.Sprintf("%s,detect-zeroes=%s", driveArgumentString, config.DetectZeroes) + } + driveArgs = append(driveArgs, driveArgumentString) + } } - driveArgs = append(driveArgs, driveArgumentString) } else { - driveArgumentString := fmt.Sprintf("file=%s,if=%s,cache=%s,discard=%s,format=%s", imgPath, config.DiskInterface, config.DiskCache, config.DiskDiscard, config.Format) - if config.DetectZeroes != "off" { - driveArgumentString = fmt.Sprintf("%s,detect-zeroes=%s", driveArgumentString, config.DetectZeroes) + if config.DiskImage { + driveArgumentString := fmt.Sprintf("file=%s,if=%s,cache=%s,discard=%s,format=%s", imgPath, config.DiskInterface, config.DiskCache, config.DiskDiscard, config.Format) + if config.DetectZeroes != "off" { + driveArgumentString = fmt.Sprintf("%s,detect-zeroes=%s", driveArgumentString, config.DetectZeroes) + } + driveArgs = append(driveArgs, driveArgumentString) + } else { + diskFullPaths := state.Get("qemu_disk_paths").([]string) + for _, diskFullPath := range diskFullPaths { + driveArgumentString := fmt.Sprintf("file=%s,if=%s,cache=%s,discard=%s,format=%s", diskFullPath, config.DiskInterface, config.DiskCache, config.DiskDiscard, config.Format) + if config.DetectZeroes != "off" { + driveArgumentString = fmt.Sprintf("%s,detect-zeroes=%s", driveArgumentString, config.DetectZeroes) + } + driveArgs = append(driveArgs, driveArgumentString) + } } - driveArgs = append(driveArgs, driveArgumentString) - } } else { driveArgs = append(driveArgs, fmt.Sprintf("file=%s,if=%s,cache=%s,format=%s", imgPath, config.DiskInterface, config.DiskCache, config.Format)) @@ -114,17 +143,23 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error deviceArgs = append(deviceArgs, fmt.Sprintf("%s,netdev=user.0", config.NetDevice)) if config.Headless == true { - vncIpRaw, vncIpOk := state.GetOk("vnc_ip") vncPortRaw, vncPortOk := state.GetOk("vnc_port") + vncPass := state.Get("vnc_password") - if vncIpOk && vncPortOk { - vncIp := vncIpRaw.(string) + if vncPortOk && vncPass != nil && len(vncPass.(string)) > 0 { + vncPort := vncPortRaw.(int) + + ui.Message(fmt.Sprintf( + "The VM will be run headless, without a GUI. If you want to\n"+ + "view the screen of the VM, connect via VNC to vnc://%s:%d\n"+ + "with the password: %s", vncIP, vncPort, vncPass)) + } else if vncPortOk { vncPort := vncPortRaw.(int) ui.Message(fmt.Sprintf( "The VM will be run headless, without a GUI. If you want to\n"+ "view the screen of the VM, connect via VNC without a password to\n"+ - "vnc://%s:%d", vncIp, vncPort)) + "vnc://%s:%d", vncIP, vncPort)) } else { ui.Message("The VM will be run headless, without a GUI, as configured.\n" + "If the run isn't succeeding as you expect, please enable the GUI\n" + diff --git a/builder/qemu/step_type_boot_command.go b/builder/qemu/step_type_boot_command.go index b524967cb..4bce10d0c 100644 --- a/builder/qemu/step_type_boot_command.go +++ b/builder/qemu/step_type_boot_command.go @@ -41,7 +41,8 @@ func (s *stepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) httpPort := state.Get("http_port").(int) ui := state.Get("ui").(packer.Ui) vncPort := state.Get("vnc_port").(int) - vncIP := state.Get("vnc_ip").(string) + vncIP := config.VNCBindAddress + vncPassword := state.Get("vnc_password") if config.VNCConfig.DisableVNC { log.Println("Skipping boot command step...") @@ -76,7 +77,15 @@ func (s *stepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) } defer nc.Close() - c, err := vnc.Client(nc, &vnc.ClientConfig{Exclusive: false}) + var auth []vnc.ClientAuth + + if vncPassword != nil && len(vncPassword.(string)) > 0 { + auth = []vnc.ClientAuth{&vnc.PasswordAuth{Password: vncPassword.(string)}} + } else { + auth = []vnc.ClientAuth{new(vnc.ClientAuthNone)} + } + + c, err := vnc.Client(nc, &vnc.ClientConfig{Auth: auth, Exclusive: false}) if err != nil { err := fmt.Errorf("Error handshaking with VNC: %s", err) state.Put("error", err) diff --git a/builder/scaleway/builder.go b/builder/scaleway/builder.go index 418f945fb..47ddc8376 100644 --- a/builder/scaleway/builder.go +++ b/builder/scaleway/builder.go @@ -52,11 +52,12 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack Debug: b.config.PackerDebug, DebugKeyPath: fmt.Sprintf("scw_%s.pem", b.config.PackerBuildName), }, + new(stepRemoveVolume), new(stepCreateServer), new(stepServerInfo), &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, + Host: communicator.CommHost(b.config.Comm.SSHHost, "server_ip"), SSHConfig: b.config.Comm.SSHConfigFunc(), }, new(common.StepProvision), diff --git a/builder/scaleway/config.go b/builder/scaleway/config.go index 1455369d2..7a78092db 100644 --- a/builder/scaleway/config.go +++ b/builder/scaleway/config.go @@ -64,6 +64,8 @@ type Config struct { // bootscript, Default bootscript BootType string `mapstructure:"boottype" required:"false"` + RemoveVolume bool `mapstructure:"remove_volume"` + UserAgent string ctx interpolate.Context } diff --git a/builder/scaleway/ssh.go b/builder/scaleway/ssh.go deleted file mode 100644 index e291151ab..000000000 --- a/builder/scaleway/ssh.go +++ /dev/null @@ -1,10 +0,0 @@ -package scaleway - -import ( - "github.com/hashicorp/packer/helper/multistep" -) - -func commHost(state multistep.StateBag) (string, error) { - ipAddress := state.Get("server_ip").(string) - return ipAddress, nil -} diff --git a/builder/scaleway/step_remove_volume.go b/builder/scaleway/step_remove_volume.go new file mode 100644 index 000000000..9bc6125c1 --- /dev/null +++ b/builder/scaleway/step_remove_volume.go @@ -0,0 +1,44 @@ +package scaleway + +import ( + "context" + "fmt" + + "github.com/scaleway/scaleway-cli/pkg/api" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type stepRemoveVolume struct{} + +func (s *stepRemoveVolume) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + // nothing to do ... only cleanup interests us + return multistep.ActionContinue +} + +func (s *stepRemoveVolume) Cleanup(state multistep.StateBag) { + if _, ok := state.GetOk("snapshot_name"); !ok { + // volume will be detached from server only after snapshotting ... so we don't + // need to remove volume before snapshot step. + return + } + + client := state.Get("client").(*api.ScalewayAPI) + ui := state.Get("ui").(packer.Ui) + c := state.Get("config").(*Config) + volumeID := state.Get("root_volume_id").(string) + + if !c.RemoveVolume { + return + } + + ui.Say("Removing Volume ...") + + err := client.DeleteVolume(volumeID) + if err != nil { + err := fmt.Errorf("Error removing volume: %s", err) + state.Put("error", err) + ui.Error(fmt.Sprintf("Error removing volume: %s. (Ignored)", err)) + } +} diff --git a/builder/tencentcloud/cvm/builder.go b/builder/tencentcloud/cvm/builder.go index a0a12f348..9b05846b3 100644 --- a/builder/tencentcloud/cvm/builder.go +++ b/builder/tencentcloud/cvm/builder.go @@ -104,9 +104,11 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack InstanceName: b.config.InstanceName, DiskType: b.config.DiskType, DiskSize: b.config.DiskSize, + DataDisks: b.config.DataDisks, HostName: b.config.HostName, InternetMaxBandwidthOut: b.config.InternetMaxBandwidthOut, AssociatePublicIpAddress: b.config.AssociatePublicIpAddress, + Tags: b.config.RunTags, }, &communicator.StepConnect{ Config: &b.config.TencentCloudRunConfig.Comm, @@ -115,9 +117,15 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, &common.StepProvision{}, &common.StepCleanupTempKeys{ - Comm: &b.config.TencentCloudRunConfig.Comm}, + Comm: &b.config.TencentCloudRunConfig.Comm, + }, + // We need this step to detach temporary key from instance, otherwise + // it always fails to delete the key. + &stepDetachTempKeyPair{}, &stepCreateImage{}, - &stepShareImage{b.config.ImageShareAccounts}, + &stepShareImage{ + b.config.ImageShareAccounts, + }, &stepCopyImage{ DesinationRegions: b.config.ImageCopyRegions, SourceRegion: b.config.Region, diff --git a/builder/tencentcloud/cvm/image_config.go b/builder/tencentcloud/cvm/image_config.go index ccfc83f37..5311f4254 100644 --- a/builder/tencentcloud/cvm/image_config.go +++ b/builder/tencentcloud/cvm/image_config.go @@ -4,7 +4,6 @@ package cvm import ( "fmt" - "regexp" "github.com/hashicorp/packer/template/interpolate" ) @@ -39,14 +38,9 @@ func (cf *TencentCloudImageConfig) Prepare(ctx *interpolate.Context) []error { var errs []error cf.ForcePoweroff = true if cf.ImageName == "" { - errs = append(errs, fmt.Errorf("image_name must be set")) + errs = append(errs, fmt.Errorf("image_name must be specified")) } else if len(cf.ImageName) > 20 { - errs = append(errs, fmt.Errorf("image_num length should not exceed 20 characters")) - } else { - regex := regexp.MustCompile("^[0-9a-zA-Z\\-]+$") - if !regex.MatchString(cf.ImageName) { - errs = append(errs, fmt.Errorf("image_name can only be composed of letters, numbers and minus sign")) - } + errs = append(errs, fmt.Errorf("image_name length should not exceed 20 characters")) } if len(cf.ImageDescription) > 60 { diff --git a/builder/tencentcloud/cvm/image_config_test.go b/builder/tencentcloud/cvm/image_config_test.go index a6e441fc3..53f9240b7 100644 --- a/builder/tencentcloud/cvm/image_config_test.go +++ b/builder/tencentcloud/cvm/image_config_test.go @@ -11,9 +11,9 @@ func TestTencentCloudImageConfig_Prepare(t *testing.T) { t.Fatalf("shouldn't have err: %v", err) } - cf.ImageName = "foo:" - if err := cf.Prepare(nil); err == nil { - t.Fatal("should have error") + cf.ImageName = "foo.:" + if err := cf.Prepare(nil); err != nil { + t.Fatal("shouldn't have error") } cf.ImageName = "foo" diff --git a/builder/tencentcloud/cvm/run_config.go b/builder/tencentcloud/cvm/run_config.go index 91b06afbb..2e4bc3cfe 100644 --- a/builder/tencentcloud/cvm/run_config.go +++ b/builder/tencentcloud/cvm/run_config.go @@ -12,6 +12,12 @@ import ( "github.com/pkg/errors" ) +type tencentCloudDataDisk struct { + DiskType string `mapstructure:"disk_type"` + DiskSize int64 `mapstructure:"disk_size"` + SnapshotId string `mapstructure:"disk_snapshot_id"` +} + type TencentCloudRunConfig struct { // Whether allocate public ip to your cvm. // Default value is false. @@ -31,6 +37,17 @@ type TencentCloudRunConfig struct { DiskType string `mapstructure:"disk_type" required:"false"` // Root disk size your cvm will be launched by. values range(in GB): DiskSize int64 `mapstructure:"disk_size" required:"false"` + // Add one or more data disks to the instance before creating the image. + // Note that if the source image has data disk snapshots, this argument + // will be ignored, and the running instance will use source image data + // disk settings, in such case, `disk_type` argument will be used as disk + // type for all data disks, and each data disk size will use the origin + // value in source image. + // The data disks allow for the following argument: + // - `disk_type` - Type of the data disk. Valid choices: `CLOUD_BASIC`, `CLOUD_PREMIUM` and `CLOUD_SSD`. + // - `disk_size` - Size of the data disk. + // - `disk_snapshot_id` - Id of the snapshot for a data disk. + DataDisks []tencentCloudDataDisk `mapstructure:"data_disks"` // Specify vpc your cvm will be launched by. VpcId string `mapstructure:"vpc_id" required:"false"` // Specify vpc name you will create. if vpc_id is not set, packer will @@ -61,6 +78,9 @@ type TencentCloudRunConfig struct { UserDataFile string `mapstructure:"user_data_file" required:"false"` // host name. HostName string `mapstructure:"host_name" required:"false"` + // Tags to apply to the instance that is *launched* to create the image. + // These tags are *not* applied to the resulting image. + RunTags map[string]string `mapstructure:"run_tags" required:"false"` // Communicator settings Comm communicator.Config `mapstructure:",squash"` @@ -150,6 +170,10 @@ func (cf *TencentCloudRunConfig) Prepare(ctx *interpolate.Context) []error { cf.HostName = cf.InstanceName[:15] } + if cf.RunTags == nil { + cf.RunTags = make(map[string]string) + } + return errs } diff --git a/builder/tencentcloud/cvm/step_config_key_pair.go b/builder/tencentcloud/cvm/step_config_key_pair.go index a1768f67d..dfaa97a0d 100644 --- a/builder/tencentcloud/cvm/step_config_key_pair.go +++ b/builder/tencentcloud/cvm/step_config_key_pair.go @@ -70,6 +70,7 @@ func (s *stepConfigKeyPair) Run(ctx context.Context, state multistep.StateBag) m // set keyId to delete when Cleanup s.keyID = *resp.Response.KeyPair.KeyId + state.Put("temporary_key_pair_id", resp.Response.KeyPair.KeyId) s.Comm.SSHKeyPairName = *resp.Response.KeyPair.KeyId s.Comm.SSHPrivateKey = []byte(*resp.Response.KeyPair.PrivateKey) diff --git a/builder/tencentcloud/cvm/step_config_security_group.go b/builder/tencentcloud/cvm/step_config_security_group.go index 9244f4cc6..2b107615a 100644 --- a/builder/tencentcloud/cvm/step_config_security_group.go +++ b/builder/tencentcloud/cvm/step_config_security_group.go @@ -106,7 +106,7 @@ func (s *stepConfigSecurityGroup) Cleanup(state multistep.StateBag) { vpcClient := state.Get("vpc_client").(*vpc.Client) ui := state.Get("ui").(packer.Ui) - MessageClean(state, "VPC") + MessageClean(state, "Security Group") req := vpc.NewDeleteSecurityGroupRequest() req.SecurityGroupId = &s.SecurityGroupId err := retry.Config{ diff --git a/builder/tencentcloud/cvm/step_create_image.go b/builder/tencentcloud/cvm/step_create_image.go index f4cfa9d4f..1d162fa36 100644 --- a/builder/tencentcloud/cvm/step_create_image.go +++ b/builder/tencentcloud/cvm/step_create_image.go @@ -3,9 +3,12 @@ package cvm import ( "context" "fmt" + "time" + "github.com/hashicorp/packer/common/retry" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312" ) @@ -25,6 +28,15 @@ func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) mul req.ImageName = &config.ImageName req.ImageDescription = &config.ImageDescription req.InstanceId = instance.InstanceId + // TODO: We should allow user to specify which data disk should be + // included into created image. + var dataDiskIds []*string + for _, disk := range instance.DataDisks { + dataDiskIds = append(dataDiskIds, disk.DiskId) + } + if len(dataDiskIds) > 0 { + req.DataDiskIds = dataDiskIds + } True := "True" False := "False" @@ -46,7 +58,26 @@ func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) mul req.Sysprep = &False } - _, err := client.CreateImage(req) + err := retry.Config{ + Tries: 60, + RetryDelay: (&retry.Backoff{ + InitialBackoff: 5 * time.Second, + MaxBackoff: 5 * time.Second, + Multiplier: 2, + }).Linear, + ShouldRetry: func(err error) bool { + if e, ok := err.(*errors.TencentCloudSDKError); ok { + if e.Code == "InvalidImageName.Duplicate" { + return false + } + } + return true + }, + }.Run(ctx, func(ctx context.Context) error { + _, err := client.CreateImage(req) + return err + }) + if err != nil { err := fmt.Errorf("create image failed: %s", err.Error()) state.Put("error", err) diff --git a/builder/tencentcloud/cvm/step_detach_temp_key_pair.go b/builder/tencentcloud/cvm/step_detach_temp_key_pair.go new file mode 100644 index 000000000..ea1feff73 --- /dev/null +++ b/builder/tencentcloud/cvm/step_detach_temp_key_pair.go @@ -0,0 +1,51 @@ +package cvm + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/packer/common/retry" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" + cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312" +) + +type stepDetachTempKeyPair struct { +} + +func (s *stepDetachTempKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + client := state.Get("cvm_client").(*cvm.Client) + instance := state.Get("instance").(*cvm.Instance) + if _, ok := state.GetOk("temporary_key_pair_id"); !ok { + return multistep.ActionContinue + } + keyId := state.Get("temporary_key_pair_id").(*string) + ui := state.Get("ui").(packer.Ui) + ui.Say(fmt.Sprintf("Detaching temporary key pair %s...", *keyId)) + req := cvm.NewDisassociateInstancesKeyPairsRequest() + req.KeyIds = []*string{keyId} + req.InstanceIds = []*string{instance.InstanceId} + req.ForceStop = common.BoolPtr(true) + err := retry.Config{ + Tries: 60, + RetryDelay: (&retry.Backoff{ + InitialBackoff: 5 * time.Second, + MaxBackoff: 5 * time.Second, + Multiplier: 2, + }).Linear, + }.Run(ctx, func(ctx context.Context) error { + _, err := client.DisassociateInstancesKeyPairs(req) + return err + }) + if err != nil { + ui.Error(fmt.Sprintf("Fail to detach temporary key pair from instance! Error: %s", err)) + state.Put("error", err) + return multistep.ActionHalt + } + return multistep.ActionContinue +} + +func (s *stepDetachTempKeyPair) Cleanup(state multistep.StateBag) { +} diff --git a/builder/tencentcloud/cvm/step_run_instance.go b/builder/tencentcloud/cvm/step_run_instance.go index fab521e6d..224a62425 100644 --- a/builder/tencentcloud/cvm/step_run_instance.go +++ b/builder/tencentcloud/cvm/step_run_instance.go @@ -8,6 +8,7 @@ import ( "log" "time" + "github.com/hashicorp/packer/common/retry" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312" @@ -25,6 +26,8 @@ type stepRunInstance struct { HostName string InternetMaxBandwidthOut int64 AssociatePublicIpAddress bool + Tags map[string]string + DataDisks []tencentCloudDataDisk } func (s *stepRunInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { @@ -60,10 +63,46 @@ func (s *stepRunInstance) Run(ctx context.Context, state multistep.StateBag) mul req.ImageId = source_image.ImageId req.InstanceChargeType = &POSTPAID_BY_HOUR req.InstanceType = &s.InstanceType + // TODO: Add check for system disk size, it should be larger than image system disk size. req.SystemDisk = &cvm.SystemDisk{ DiskType: &s.DiskType, DiskSize: &s.DiskSize, } + // System disk snapshot is mandatory, so if there are additional data disks, + // length will be larger than 1. + if source_image.SnapshotSet != nil && len(source_image.SnapshotSet) > 1 { + ui.Say("Use source image snapshot data disks, ignore user data disk settings.") + var dataDisks []*cvm.DataDisk + for _, snapshot := range source_image.SnapshotSet { + if *snapshot.DiskUsage == "DATA_DISK" { + var dataDisk cvm.DataDisk + // FIXME: Currently we have no way to get original disk type + // from data disk snapshots, and we don't allow user to overwrite + // snapshot settings, and we cannot guarantee a certain hard-coded type + // is not sold out, so here we use system disk type as a workaround. + // + // Eventually, we need to allow user to overwrite snapshot disk + // settings. + dataDisk.DiskType = &s.DiskType + dataDisk.DiskSize = snapshot.DiskSize + dataDisk.SnapshotId = snapshot.SnapshotId + dataDisks = append(dataDisks, &dataDisk) + } + } + req.DataDisks = dataDisks + } else { + var dataDisks []*cvm.DataDisk + for _, disk := range s.DataDisks { + var dataDisk cvm.DataDisk + dataDisk.DiskType = &disk.DiskType + dataDisk.DiskSize = &disk.DiskSize + if disk.SnapshotId != "" { + dataDisk.SnapshotId = &disk.SnapshotId + } + dataDisks = append(dataDisks, &dataDisk) + } + req.DataDisks = dataDisks + } req.VirtualPrivateCloud = &cvm.VirtualPrivateCloud{ VpcId: &vpc_id, SubnetId: &subnet_id, @@ -88,6 +127,22 @@ func (s *stepRunInstance) Run(ctx context.Context, state multistep.StateBag) mul req.ClientToken = &s.InstanceName req.HostName = &s.HostName req.UserData = &userData + var tags []*cvm.Tag + for k, v := range s.Tags { + tags = append(tags, &cvm.Tag{ + Key: &k, + Value: &v, + }) + } + resourceType := "instance" + if len(tags) > 0 { + req.TagSpecification = []*cvm.TagSpecification{ + &cvm.TagSpecification{ + ResourceType: &resourceType, + Tags: tags, + }, + } + } resp, err := client.RunInstances(req) if err != nil { @@ -143,15 +198,23 @@ func (s *stepRunInstance) Cleanup(state multistep.StateBag) { if s.instanceId == "" { return } - MessageClean(state, "instance") + MessageClean(state, "Instance") client := state.Get("cvm_client").(*cvm.Client) ui := state.Get("ui").(packer.Ui) req := cvm.NewTerminateInstancesRequest() req.InstanceIds = []*string{&s.instanceId} - _, err := client.TerminateInstances(req) - // The binding relation between instance and vpc would last few minutes after - // instance terminate, we sleep here to give more time - time.Sleep(2 * time.Minute) + ctx := context.TODO() + err := retry.Config{ + Tries: 60, + RetryDelay: (&retry.Backoff{ + InitialBackoff: 5 * time.Second, + MaxBackoff: 5 * time.Second, + Multiplier: 2, + }).Linear, + }.Run(ctx, func(ctx context.Context) error { + _, err := client.TerminateInstances(req) + return err + }) if err != nil { ui.Error(fmt.Sprintf("terminate instance(%s) failed: %s", s.instanceId, err.Error())) } diff --git a/builder/triton/builder.go b/builder/triton/builder.go index 4e40116c5..ba6e2baa8 100644 --- a/builder/triton/builder.go +++ b/builder/triton/builder.go @@ -64,7 +64,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack &StepCreateSourceMachine{}, &communicator.StepConnect{ Config: &config.Comm, - Host: commHost, + Host: commHost(b.config.Comm.SSHHost), SSHConfig: b.config.Comm.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/triton/ssh.go b/builder/triton/ssh.go index 0508bfed9..70d52d5e8 100644 --- a/builder/triton/ssh.go +++ b/builder/triton/ssh.go @@ -1,17 +1,26 @@ package triton import ( + "log" + "github.com/hashicorp/packer/helper/multistep" ) -func commHost(state multistep.StateBag) (string, error) { - driver := state.Get("driver").(Driver) - machineID := state.Get("machine").(string) +func commHost(host string) func(multistep.StateBag) (string, error) { + return func(state multistep.StateBag) (string, error) { + if host != "" { + log.Printf("Using ssh_host value: %s", host) + return host, nil + } - machine, err := driver.GetMachineIP(machineID) - if err != nil { - return "", err + driver := state.Get("driver").(Driver) + machineID := state.Get("machine").(string) + + machine, err := driver.GetMachineIP(machineID) + if err != nil { + return "", err + } + + return machine, nil } - - return machine, nil } diff --git a/builder/ucloud/uhost/access_config.go b/builder/ucloud/uhost/access_config.go new file mode 100644 index 000000000..5450617f0 --- /dev/null +++ b/builder/ucloud/uhost/access_config.go @@ -0,0 +1,201 @@ +package uhost + +import ( + "fmt" + "github.com/hashicorp/packer/template/interpolate" + "github.com/hashicorp/packer/version" + "github.com/ucloud/ucloud-sdk-go/services/uaccount" + "github.com/ucloud/ucloud-sdk-go/services/uhost" + "github.com/ucloud/ucloud-sdk-go/services/unet" + "github.com/ucloud/ucloud-sdk-go/services/vpc" + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" + "os" +) + +type AccessConfig struct { + PublicKey string `mapstructure:"public_key"` + PrivateKey string `mapstructure:"private_key"` + Region string `mapstructure:"region"` + ProjectId string `mapstructure:"project_id"` + + client *UCloudClient +} + +func (c *AccessConfig) Client() (*UCloudClient, error) { + if c.client != nil { + return c.client, nil + } + + cfg := ucloud.NewConfig() + cfg.Region = c.Region + cfg.ProjectId = c.ProjectId + cfg.UserAgent = fmt.Sprintf("Packer-UCloud/%s", version.FormattedVersion()) + + cred := auth.NewCredential() + cred.PublicKey = c.PublicKey + cred.PrivateKey = c.PrivateKey + + c.client = &UCloudClient{} + c.client.uhostconn = uhost.NewClient(&cfg, &cred) + c.client.unetconn = unet.NewClient(&cfg, &cred) + c.client.vpcconn = vpc.NewClient(&cfg, &cred) + c.client.uaccountconn = uaccount.NewClient(&cfg, &cred) + + return c.client, nil +} + +func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error { + var errs []error + if err := c.Config(); err != nil { + errs = append(errs, err) + } + + if c.Region == "" { + c.Region = os.Getenv("UCLOUD_REGION") + } + + if c.Region == "" { + errs = append(errs, fmt.Errorf("%q must be set", "region")) + } + + if len(errs) > 0 { + return errs + } + + return nil +} + +func (c *AccessConfig) Config() error { + if c.PublicKey == "" { + c.PublicKey = os.Getenv("UCLOUD_PUBLIC_KEY") + } + if c.PrivateKey == "" { + c.PrivateKey = os.Getenv("UCLOUD_PRIVATE_KEY") + } + + if c.ProjectId == "" { + c.ProjectId = os.Getenv("UCLOUD_PROJECT_ID") + } + + if c.PublicKey == "" || c.PrivateKey == "" || c.ProjectId == "" { + return fmt.Errorf("%q, %q, and %q must be set", "public_key", "private_key", "project_id") + } + return nil + +} + +func (c *AccessConfig) ValidateProjectId(projectId string) error { + supportedProjectIds, err := c.getSupportedProjectIds() + if err != nil { + return err + } + + for _, supportedProjectId := range supportedProjectIds { + if projectId == supportedProjectId { + return nil + } + } + + return fmt.Errorf("%q is invalid, should be an valid ucloud project_id, got %q", "project_id", projectId) +} + +func (c *AccessConfig) ValidateRegion(region string) error { + supportedRegions, err := c.getSupportedRegions() + if err != nil { + return err + } + + for _, supportedRegion := range supportedRegions { + if region == supportedRegion { + return nil + } + } + + return fmt.Errorf("%q is invalid, should be an valid ucloud region, got %q", "region", region) +} + +func (c *AccessConfig) ValidateZone(region, zone string) error { + supportedZones, err := c.getSupportedZones(region) + if err != nil { + return err + } + + for _, supportedZone := range supportedZones { + if zone == supportedZone { + return nil + } + } + + return fmt.Errorf("%q is invalid, should be an valid ucloud zone, got %q", "availability_zone", zone) +} + +func (c *AccessConfig) getSupportedProjectIds() ([]string, error) { + client, err := c.Client() + conn := client.uaccountconn + if err != nil { + return nil, err + } + + req := conn.NewGetProjectListRequest() + resp, err := conn.GetProjectList(req) + if err != nil { + return nil, err + } + + validProjectIds := make([]string, len(resp.ProjectSet)) + for _, val := range resp.ProjectSet { + if !isStringIn(val.ProjectId, validProjectIds) { + validProjectIds = append(validProjectIds, val.ProjectId) + } + } + + return validProjectIds, nil +} + +func (c *AccessConfig) getSupportedRegions() ([]string, error) { + client, err := c.Client() + conn := client.uaccountconn + if err != nil { + return nil, err + } + + req := conn.NewGetRegionRequest() + resp, err := conn.GetRegion(req) + if err != nil { + return nil, err + } + + validRegions := make([]string, len(resp.Regions)) + for _, val := range resp.Regions { + if !isStringIn(val.Region, validRegions) { + validRegions = append(validRegions, val.Region) + } + } + + return validRegions, nil +} + +func (c *AccessConfig) getSupportedZones(region string) ([]string, error) { + client, err := c.Client() + conn := client.uaccountconn + if err != nil { + return nil, err + } + + req := conn.NewGetRegionRequest() + resp, err := conn.GetRegion(req) + if err != nil { + return nil, err + } + + validZones := make([]string, len(resp.Regions)) + for _, val := range resp.Regions { + if val.Region == region && !isStringIn(val.Zone, validZones) { + validZones = append(validZones, val.Zone) + } + + } + + return validZones, nil +} diff --git a/builder/ucloud/uhost/access_config_test.go b/builder/ucloud/uhost/access_config_test.go new file mode 100644 index 000000000..3c949bb8b --- /dev/null +++ b/builder/ucloud/uhost/access_config_test.go @@ -0,0 +1,35 @@ +package uhost + +import ( + "os" + "testing" +) + +func testAccessConfig() *AccessConfig { + return &AccessConfig{ + PublicKey: "test_pub", + PrivateKey: "test_pri", + ProjectId: "test_pro", + } + +} + +func TestAccessConfigPrepareRegion(t *testing.T) { + c := testAccessConfig() + + c.Region = "" + if err := c.Prepare(nil); err == nil { + t.Fatalf("should have err") + } + + c.Region = "cn-sh2" + if err := c.Prepare(nil); err != nil { + t.Fatalf("shouldn't have err: %s", err) + } + + os.Setenv("UCLOUD_REGION", "cn-bj2") + c.Region = "" + if err := c.Prepare(nil); err != nil { + t.Fatalf("shouldn't have err: %s", err) + } +} diff --git a/builder/ucloud/uhost/artifact.go b/builder/ucloud/uhost/artifact.go new file mode 100644 index 000000000..fc8a43ff6 --- /dev/null +++ b/builder/ucloud/uhost/artifact.go @@ -0,0 +1,93 @@ +package uhost + +import ( + "fmt" + "github.com/hashicorp/packer/packer" + "github.com/ucloud/ucloud-sdk-go/ucloud" + "log" + "sort" + "strings" +) + +type Artifact struct { + UCloudImages *imageInfoSet + + BuilderIdValue string + + Client *UCloudClient +} + +func (a *Artifact) BuilderId() string { + return a.BuilderIdValue +} + +func (*Artifact) Files() []string { + return nil +} + +func (a *Artifact) Id() string { + m := make([]string, 0, len(a.UCloudImages.GetAll())) + + for _, v := range a.UCloudImages.GetAll() { + m = append(m, fmt.Sprintf("%s:%s:%s", v.ProjectId, v.Region, v.ImageId)) + } + + sort.Strings(m) + return strings.Join(m, ",") +} + +func (a *Artifact) String() string { + m := make([]string, 0, len(a.UCloudImages.GetAll())) + for _, v := range a.UCloudImages.GetAll() { + m = append(m, fmt.Sprintf("%s: %s: %s", v.ProjectId, v.Region, v.ImageId)) + } + + sort.Strings(m) + return fmt.Sprintf("UCloud images were created:\n\n%s", strings.Join(m, "\n")) +} + +func (a *Artifact) State(name string) interface{} { + switch name { + case "atlas.artifact.metadata": + return a.stateAtlasMetadata() + default: + return nil + } +} + +func (a *Artifact) Destroy() error { + conn := a.Client.uhostconn + errors := make([]error, 0) + + for _, v := range a.UCloudImages.GetAll() { + log.Printf("Delete ucloud image %s from %s:%s", v.ImageId, v.ProjectId, v.Region) + req := conn.NewTerminateCustomImageRequest() + req.ProjectId = ucloud.String(v.ProjectId) + req.Region = ucloud.String(v.Region) + req.ImageId = ucloud.String(v.ImageId) + + if _, err := conn.TerminateCustomImage(req); err != nil { + errors = append(errors, err) + } + } + + if len(errors) > 0 { + if len(errors) == 1 { + return errors[0] + } else { + return &packer.MultiError{Errors: errors} + } + } + + return nil +} + +func (a *Artifact) stateAtlasMetadata() interface{} { + metadata := make(map[string]string) + for _, v := range a.UCloudImages.GetAll() { + k := fmt.Sprintf("%s:%s", v.ProjectId, v.Region) + metadata[k] = v.ImageId + } + + return metadata +} diff --git a/builder/ucloud/uhost/artifact_test.go b/builder/ucloud/uhost/artifact_test.go new file mode 100644 index 000000000..ec4278565 --- /dev/null +++ b/builder/ucloud/uhost/artifact_test.go @@ -0,0 +1,65 @@ +package uhost + +import ( + "github.com/hashicorp/packer/packer" + "reflect" + "testing" +) + +func TestArtifact_Impl(t *testing.T) { + var _ packer.Artifact = new(Artifact) +} + +func TestArtifactId(t *testing.T) { + expected := `project1:region1:foo,project2:region2:bar` + + images := newImageInfoSet(nil) + images.Set(imageInfo{ + Region: "region1", + ProjectId: "project1", + ImageId: "foo", + }) + + images.Set(imageInfo{ + Region: "region2", + ProjectId: "project2", + ImageId: "bar", + }) + + a := &Artifact{ + UCloudImages: images, + } + + result := a.Id() + if result != expected { + t.Fatalf("bad: %s", result) + } +} + +func TestArtifactState_atlasMetadata(t *testing.T) { + images := newImageInfoSet(nil) + images.Set(imageInfo{ + Region: "region1", + ProjectId: "project1", + ImageId: "foo", + }) + + images.Set(imageInfo{ + Region: "region2", + ProjectId: "project2", + ImageId: "bar", + }) + + a := &Artifact{ + UCloudImages: images, + } + + actual := a.State("atlas.artifact.metadata") + expected := map[string]string{ + "project1:region1": "foo", + "project2:region2": "bar", + } + if !reflect.DeepEqual(actual, expected) { + t.Fatalf("bad: %#v", actual) + } +} diff --git a/builder/ucloud/uhost/builder.go b/builder/ucloud/uhost/builder.go new file mode 100644 index 000000000..3ec4393bb --- /dev/null +++ b/builder/ucloud/uhost/builder.go @@ -0,0 +1,147 @@ +// The ucloud-uhost contains a packer.Builder implementation that +// builds uhost images for UCloud UHost instance. +package uhost + +import ( + "context" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" +) + +// The unique ID for this builder +const BuilderId = "ucloud.uhost" + +type Config struct { + common.PackerConfig `mapstructure:",squash"` + AccessConfig `mapstructure:",squash"` + ImageConfig `mapstructure:",squash"` + RunConfig `mapstructure:",squash"` + + ctx interpolate.Context +} + +type Builder struct { + config Config + runner multistep.Runner +} + +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + err := config.Decode(&b.config, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &b.config.ctx, + InterpolateFilter: &interpolate.RenderFilter{ + Exclude: []string{ + "run_command", + }, + }, + }, raws...) + b.config.ctx.EnableEnv = true + if err != nil { + return nil, err + } + + // Accumulate any errors + var errs *packer.MultiError + errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.ImageConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.RunConfig.Prepare(&b.config.ctx)...) + + if errs != nil && len(errs.Errors) > 0 { + return nil, errs + } + + packer.LogSecretFilter.Set(b.config.PublicKey, b.config.PrivateKey) + return nil, nil +} + +func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { + + client, err := b.config.Client() + if err != nil { + return nil, err + } + + // Setup the state bag and initial state for the steps + state := new(multistep.BasicStateBag) + state.Put("config", &b.config) + state.Put("client", client) + state.Put("hook", hook) + state.Put("ui", ui) + + var steps []multistep.Step + + // Build the steps + steps = []multistep.Step{ + &stepPreValidate{ + ProjectId: b.config.ProjectId, + Region: b.config.Region, + Zone: b.config.Zone, + ImageDestinations: b.config.ImageDestinations, + }, + + &stepCheckSourceImageId{ + SourceUHostImageId: b.config.SourceImageId, + }, + + &stepConfigVPC{ + VPCId: b.config.VPCId, + }, + &stepConfigSubnet{ + SubnetId: b.config.SubnetId, + }, + &stepConfigSecurityGroup{ + SecurityGroupId: b.config.SecurityGroupId, + }, + + &stepCreateInstance{ + InstanceType: b.config.InstanceType, + Region: b.config.Region, + Zone: b.config.Zone, + SourceImageId: b.config.SourceImageId, + InstanceName: b.config.InstanceName, + BootDiskType: b.config.BootDiskType, + UsePrivateIp: b.config.UseSSHPrivateIp, + }, + &communicator.StepConnect{ + Config: &b.config.RunConfig.Comm, + Host: SSHHost( + b.config.UseSSHPrivateIp), + SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(), + }, + &common.StepProvision{}, + &stepStopInstance{}, + &stepCreateImage{}, + &stepCopyUCloudImage{ + ImageDestinations: b.config.ImageDestinations, + RegionId: b.config.Region, + ProjectId: b.config.ProjectId, + }, + } + + // Run! + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) + b.runner.Run(ctx, state) + + // If there was an error, return that + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) + } + + // If there are no ucloud images, then just return + if _, ok := state.GetOk("ucloud_images"); !ok { + return nil, nil + } + + // Build the artifact and return it + artifact := &Artifact{ + UCloudImages: state.Get("ucloud_images").(*imageInfoSet), + BuilderIdValue: BuilderId, + Client: client, + } + + return artifact, nil +} diff --git a/builder/ucloud/uhost/builder_acc_test.go b/builder/ucloud/uhost/builder_acc_test.go new file mode 100644 index 000000000..d19a15e8d --- /dev/null +++ b/builder/ucloud/uhost/builder_acc_test.go @@ -0,0 +1,208 @@ +package uhost + +import ( + "fmt" + "github.com/hashicorp/packer/packer" + "os" + "testing" + + builderT "github.com/hashicorp/packer/helper/builder/testing" +) + +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 := &AccessConfig{Region: "cn-bj2"} + err := access.Config() + if err != nil { + t.Fatalf("Error on initing UCloud AccessConfig, %s", err) + } + + err = access.ValidateRegion("cn-sh2") + if err != nil { + t.Fatalf("Expected pass with valid region but failed: %s", err) + } + + err = access.ValidateRegion("invalidRegion") + if err == nil { + t.Fatal("Expected failure due to invalid region 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-bj2", + "availability_zone": "cn-bj2-02", + "instance_type": "n-basic-2", + "source_image_id":"uimage-f1chxn", + "ssh_username":"root", + "image_name": "packer-test-basic_{{timestamp}}" + }] +}` + +func TestBuilderAcc_ubuntu(t *testing.T) { + t.Parallel() + builderT.Test(t, builderT.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + Builder: &Builder{}, + Template: testBuilderAccUbuntu, + }) +} + +const testBuilderAccUbuntu = ` +{ "builders": [{ + "type": "test", + "region": "cn-bj2", + "availability_zone": "cn-bj2-02", + "instance_type": "n-basic-2", + "source_image_id":"uimage-irofn4", + "ssh_username":"ubuntu", + "image_name": "packer-test-ubuntu_{{timestamp}}" + }] +}` + +func TestBuilderAcc_regionCopy(t *testing.T) { + t.Parallel() + projectId := os.Getenv("UCLOUD_PROJECT_ID") + builderT.Test(t, builderT.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + Builder: &Builder{}, + Template: testBuilderAccRegionCopy(projectId), + Check: checkRegionCopy( + projectId, + []ImageDestination{ + {projectId, "cn-sh2", "packer-test-regionCopy-sh", "test"}, + }), + }) +} + +func testBuilderAccRegionCopy(projectId string) string { + return fmt.Sprintf(` +{ + "builders": [{ + "type": "test", + "region": "cn-bj2", + "availability_zone": "cn-bj2-02", + "instance_type": "n-basic-2", + "source_image_id":"uimage-f1chxn", + "ssh_username":"root", + "image_name": "packer-test-regionCopy-bj", + "image_copy_to_mappings": [{ + "project_id": %q, + "region": "cn-sh2", + "name": "packer-test-regionCopy-sh", + "description": "test" + }] + }] +}`, projectId) +} + +func checkRegionCopy(projectId string, imageDst []ImageDestination) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + if len(artifacts) > 1 { + return fmt.Errorf("more than 1 artifact") + } + + artifactSet := artifacts[0] + artifact, ok := artifactSet.(*Artifact) + if !ok { + return fmt.Errorf("unknown artifact: %#v", artifactSet) + } + + destSet := newImageInfoSet(nil) + for _, dest := range imageDst { + destSet.Set(imageInfo{ + Region: dest.Region, + ProjectId: dest.ProjectId, + }) + } + + for _, r := range artifact.UCloudImages.GetAll() { + if r.ProjectId == projectId && r.Region == "cn-bj2" { + destSet.Remove(r.Id()) + continue + } + + if destSet.Get(r.ProjectId, r.Region) == nil { + return fmt.Errorf("project%s : region%s is not the target but found in artifacts", r.ProjectId, r.Region) + } + + destSet.Remove(r.Id()) + } + + if len(destSet.GetAll()) > 0 { + return fmt.Errorf("the following copying targets not found in corresponding artifacts : %#v", destSet.GetAll()) + } + + client, _ := testUCloudClient() + for _, r := range artifact.UCloudImages.GetAll() { + if r.ProjectId == projectId && r.Region == "cn-bj2" { + continue + } + imageSet, err := client.describeImageByInfo(r.ProjectId, r.Region, r.ImageId) + if err != nil { + if isNotFoundError(err) { + return fmt.Errorf("image %s in artifacts can not be found", r.ImageId) + } + return err + } + + if r.Region == "cn-sh2" && imageSet.ImageName != "packer-test-regionCopy-sh" { + return fmt.Errorf("the name of image %q in artifacts should be %s, got %s", r.ImageId, "packer-test-regionCopy-sh", imageSet.ImageName) + } + } + + return nil + } +} + +func testAccPreCheck(t *testing.T) { + if v := os.Getenv("UCLOUD_PUBLIC_KEY"); v == "" { + t.Fatal("UCLOUD_PUBLIC_KEY must be set for acceptance tests") + } + + if v := os.Getenv("UCLOUD_PRIVATE_KEY"); v == "" { + t.Fatal("UCLOUD_PRIVATE_KEY must be set for acceptance tests") + } + + if v := os.Getenv("UCLOUD_PROJECT_ID"); v == "" { + t.Fatal("UCLOUD_PROJECT_ID must be set for acceptance tests") + } +} + +func testUCloudClient() (*UCloudClient, error) { + access := &AccessConfig{Region: "cn-bj2"} + err := access.Config() + if err != nil { + return nil, err + } + client, err := access.Client() + if err != nil { + return nil, err + } + + return client, nil +} diff --git a/builder/ucloud/uhost/builder_test.go b/builder/ucloud/uhost/builder_test.go new file mode 100644 index 000000000..250444fb5 --- /dev/null +++ b/builder/ucloud/uhost/builder_test.go @@ -0,0 +1,139 @@ +package uhost + +import ( + "github.com/hashicorp/packer/packer" + "reflect" + "testing" +) + +func testBuilderConfig() map[string]interface{} { + return map[string]interface{}{ + "public_key": "foo", + "private_key": "bar", + "project_id": "foo", + "source_image_id": "bar", + "availability_zone": "cn-bj2-02", + "instance_type": "n-basic-2", + "region": "cn-bj2", + "ssh_username": "root", + "image_name": "foo", + } +} + +func TestBuilder_ImplementsBuilder(t *testing.T) { + var raw interface{} + raw = &Builder{} + if _, ok := raw.(packer.Builder); !ok { + t.Fatalf("Builder should be a builder") + } +} + +func TestBuilder_Prepare_BadType(t *testing.T) { + b := &Builder{} + c := map[string]interface{}{ + "public_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_ImageName(t *testing.T) { + var b Builder + config := testBuilderConfig() + + // Test good + config["image_name"] = "foo" + 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["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_ImageDestinations(t *testing.T) { + var b Builder + config := testBuilderConfig() + config["image_copy_to_mappings"] = []map[string]interface{}{ + { + "project_id": "project1", + "region": "region1", + "name": "bar", + "description": "foo", + }, + { + "project_id": "project2", + "region": "region2", + "name": "foo", + "description": "bar", + }, + } + 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 !reflect.DeepEqual(b.config.ImageDestinations, []ImageDestination{ + { + ProjectId: "project1", + Region: "region1", + Name: "bar", + Description: "foo", + }, + { + ProjectId: "project2", + Region: "region2", + Name: "foo", + Description: "bar", + }, + }) { + t.Fatalf("image_copy_mappings are not set properly, got: %#v", b.config.ImageDestinations) + } +} diff --git a/builder/ucloud/uhost/client.go b/builder/ucloud/uhost/client.go new file mode 100644 index 000000000..120f2d33c --- /dev/null +++ b/builder/ucloud/uhost/client.go @@ -0,0 +1,140 @@ +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/services/uaccount" + "github.com/ucloud/ucloud-sdk-go/services/uhost" + "github.com/ucloud/ucloud-sdk-go/services/unet" + "github.com/ucloud/ucloud-sdk-go/services/vpc" + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/error" +) + +type UCloudClient struct { + uhostconn *uhost.UHostClient + unetconn *unet.UNetClient + vpcconn *vpc.VPCClient + uaccountconn *uaccount.UAccountClient +} + +func (c *UCloudClient) describeFirewallById(sgId string) (*unet.FirewallDataSet, error) { + if sgId == "" { + return nil, newNotFoundError("security group", sgId) + } + conn := c.unetconn + + req := conn.NewDescribeFirewallRequest() + req.FWId = ucloud.String(sgId) + + resp, err := conn.DescribeFirewall(req) + + if err != nil { + if uErr, ok := err.(uerr.Error); ok && uErr.Code() == 54002 { + return nil, newNotFoundError("security group", sgId) + } + return nil, err + } + + if len(resp.DataSet) < 1 { + return nil, newNotFoundError("security group", sgId) + } + + return &resp.DataSet[0], nil +} + +func (c *UCloudClient) describeSubnetById(subnetId string) (*vpc.VPCSubnetInfoSet, error) { + if subnetId == "" { + return nil, newNotFoundError("Subnet", subnetId) + } + conn := c.vpcconn + + req := conn.NewDescribeSubnetRequest() + req.SubnetIds = []string{subnetId} + + resp, err := conn.DescribeSubnet(req) + if err != nil { + return nil, err + } + + if resp == nil || len(resp.DataSet) < 1 { + return nil, newNotFoundError("Subnet", subnetId) + } + + return &resp.DataSet[0], nil +} + +func (c *UCloudClient) describeVPCById(vpcId string) (*vpc.VPCInfo, error) { + if vpcId == "" { + return nil, newNotFoundError("VPC", vpcId) + } + conn := c.vpcconn + + req := conn.NewDescribeVPCRequest() + req.VPCIds = []string{vpcId} + + resp, err := conn.DescribeVPC(req) + if err != nil { + return nil, err + } + + if resp == nil || len(resp.DataSet) < 1 { + return nil, newNotFoundError("VPC", vpcId) + } + + return &resp.DataSet[0], nil +} + +func (c *UCloudClient) DescribeImageById(imageId string) (*uhost.UHostImageSet, error) { + if imageId == "" { + return nil, newNotFoundError("image", imageId) + } + req := c.uhostconn.NewDescribeImageRequest() + req.ImageId = ucloud.String(imageId) + + resp, err := c.uhostconn.DescribeImage(req) + if err != nil { + return nil, err + } + + if len(resp.ImageSet) < 1 { + return nil, newNotFoundError("image", imageId) + } + + return &resp.ImageSet[0], nil +} + +func (c *UCloudClient) describeUHostById(uhostId string) (*uhost.UHostInstanceSet, error) { + if uhostId == "" { + return nil, newNotFoundError("instance", uhostId) + } + req := c.uhostconn.NewDescribeUHostInstanceRequest() + req.UHostIds = []string{uhostId} + + resp, err := c.uhostconn.DescribeUHostInstance(req) + if err != nil { + return nil, err + } + if len(resp.UHostSet) < 1 { + return nil, nil + } + + return &resp.UHostSet[0], nil +} + +func (c *UCloudClient) describeImageByInfo(projectId, regionId, imageId string) (*uhost.UHostImageSet, error) { + req := c.uhostconn.NewDescribeImageRequest() + req.ProjectId = ucloud.String(projectId) + req.ImageId = ucloud.String(imageId) + req.Region = ucloud.String(regionId) + + resp, err := c.uhostconn.DescribeImage(req) + if err != nil { + return nil, err + } + + if len(resp.ImageSet) < 1 { + return nil, newNotFoundError("image", imageId) + } + + return &resp.ImageSet[0], nil + +} diff --git a/builder/ucloud/uhost/consts.go b/builder/ucloud/uhost/consts.go new file mode 100644 index 000000000..a275c4230 --- /dev/null +++ b/builder/ucloud/uhost/consts.go @@ -0,0 +1,24 @@ +package uhost + +const ( + // defaultPasswordStr, defaultPasswordNum and defaultPasswordSpe are used to general default value of root password of UHost instance + defaultPasswordNum = "012346789" + defaultPasswordStr = "abcdefghijklmnopqrstuvwxyz" + defaultPasswordSpe = "-_" +) + +const ( + osTypeWindows = "Windows" + securityGroupNonWeb = "recommend non web" + instanceStateRunning = "Running" + instanceStateStopped = "Stopped" + bootDiskStateNormal = "Normal" + imageStateAvailable = "Available" + ipTypePrivate = "Private" +) + +var bootDiskTypeMap = map[string]string{ + "cloud_ssd": "CLOUD_SSD", + "local_normal": "LOCAL_NORMAL", + "local_ssd": "LOCAL_SSD", +} diff --git a/builder/ucloud/uhost/errors.go b/builder/ucloud/uhost/errors.go new file mode 100644 index 000000000..2f5d85192 --- /dev/null +++ b/builder/ucloud/uhost/errors.go @@ -0,0 +1,62 @@ +package uhost + +import ( + "fmt" +) + +type NotFoundError struct { + message string +} + +type ExpectedStateError struct { + message string +} + +type NotCompleteError struct { + message string +} + +func (e *ExpectedStateError) Error() string { + return e.message +} + +func (e *NotFoundError) Error() string { + return e.message +} + +func (e *NotCompleteError) Error() string { + return e.message +} + +func newNotFoundError(product, id string) error { + return &NotFoundError{fmt.Sprintf("the %s %s is not found", product, id)} +} + +func newExpectedStateError(product, id string) error { + return &ExpectedStateError{fmt.Sprintf("the %s %s not be expected state", product, id)} +} + +func newNotCompleteError(product string) error { + return &NotCompleteError{fmt.Sprintf("%s is not completed", product)} +} + +func isNotFoundError(err error) bool { + if _, ok := err.(*NotFoundError); ok { + return true + } + return false +} + +func isExpectedStateError(err error) bool { + if _, ok := err.(*ExpectedStateError); ok { + return true + } + return false +} + +func isNotCompleteError(err error) bool { + if _, ok := err.(*NotCompleteError); ok { + return true + } + return false +} diff --git a/builder/ucloud/uhost/image_config.go b/builder/ucloud/uhost/image_config.go new file mode 100644 index 000000000..85fe43822 --- /dev/null +++ b/builder/ucloud/uhost/image_config.go @@ -0,0 +1,66 @@ +package uhost + +import ( + "fmt" + "github.com/hashicorp/packer/template/interpolate" + "regexp" +) + +type ImageDestination struct { + ProjectId string `mapstructure:"project_id"` + Region string `mapstructure:"region"` + Name string `mapstructure:"name"` + Description string `mapstructure:"description"` +} + +type ImageConfig struct { + ImageName string `mapstructure:"image_name"` + ImageDescription string `mapstructure:"image_description"` + ImageDestinations []ImageDestination `mapstructure:"image_copy_to_mappings"` +} + +var imageNamePattern = regexp.MustCompile(`^[A-Za-z0-9\p{Han}-_\[\]:,.]{1,63}$`) + +func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error { + var errs []error + imageName := c.ImageName + if imageName == "" { + errs = append(errs, fmt.Errorf("%q must be set", "image_name")) + } else if !imageNamePattern.MatchString(imageName) { + errs = append(errs, fmt.Errorf("expected %q to be 1-63 characters and only support chinese, english, numbers, '-_,.:[]', got %q", "image_name", imageName)) + } + + if len(c.ImageDestinations) > 0 { + for _, imageDestination := range c.ImageDestinations { + if imageDestination.Name == "" { + imageDestination.Name = imageName + } + + errs = append(errs, imageDestination.validate()...) + } + } + + if len(errs) > 0 { + return errs + } + + return nil +} + +func (imageDestination *ImageDestination) validate() []error { + var errs []error + + if imageDestination.Region == "" { + errs = append(errs, fmt.Errorf("%q must be set", "image_copy_region")) + } + + if imageDestination.ProjectId == "" { + errs = append(errs, fmt.Errorf("%q must be set", "image_copy_project")) + } + + if imageDestination.Name != "" && !imageNamePattern.MatchString(imageDestination.Name) { + errs = append(errs, fmt.Errorf("expected %q to be 1-63 characters and only support chinese, english, numbers, '-_,.:[]', got %q", "image_copy_name", imageDestination.Name)) + } + + return errs +} diff --git a/builder/ucloud/uhost/image_config_test.go b/builder/ucloud/uhost/image_config_test.go new file mode 100644 index 000000000..9388bb80d --- /dev/null +++ b/builder/ucloud/uhost/image_config_test.go @@ -0,0 +1,63 @@ +package uhost + +import ( + "testing" +) + +func testImageConfig() *ImageConfig { + return &ImageConfig{ + ImageName: "foo", + } +} + +func TestImageConfigPrepare_name(t *testing.T) { + c := testImageConfig() + if err := c.Prepare(nil); err != nil { + t.Fatalf("shouldn't have err: %s", err) + } + + c.ImageName = "" + if err := c.Prepare(nil); err == nil { + t.Fatal("should have error") + } +} + +func TestImageConfigPrepare_destinations(t *testing.T) { + c := testImageConfig() + c.ImageDestinations = nil + if err := c.Prepare(nil); err != nil { + t.Fatalf("shouldn't have err: %s", err) + } + + c.ImageDestinations = []ImageDestination{ + { + ProjectId: "foo", + Region: "cn-bj2", + Name: "bar", + }, + + { + ProjectId: "bar", + Region: "cn-sh2", + Name: "foo", + }, + } + if err := c.Prepare(nil); err != nil { + t.Fatalf("bad: %s", err) + } + + c.ImageDestinations = []ImageDestination{ + { + ProjectId: "foo", + Name: "bar", + }, + + { + ProjectId: "bar", + Region: "cn-sh2", + }, + } + if err := c.Prepare(nil); err == nil { + t.Fatal("should have error") + } +} diff --git a/builder/ucloud/uhost/run_config.go b/builder/ucloud/uhost/run_config.go new file mode 100644 index 000000000..cf8f1b0c3 --- /dev/null +++ b/builder/ucloud/uhost/run_config.go @@ -0,0 +1,112 @@ +package uhost + +import ( + "fmt" + "github.com/hashicorp/packer/common/uuid" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/template/interpolate" + "regexp" +) + +type RunConfig struct { + Zone string `mapstructure:"availability_zone"` + SourceImageId string `mapstructure:"source_image_id"` + InstanceType string `mapstructure:"instance_type"` + InstanceName string `mapstructure:"instance_name"` + BootDiskType string `mapstructure:"boot_disk_type"` + VPCId string `mapstructure:"vpc_id"` + SubnetId string `mapstructure:"subnet_id"` + SecurityGroupId string `mapstructure:"security_group_id"` + + // Communicator settings + Comm communicator.Config `mapstructure:",squash"` + UseSSHPrivateIp bool `mapstructure:"use_ssh_private_ip"` +} + +var instanceNamePattern = regexp.MustCompile(`^[A-Za-z0-9\p{Han}-_.]{1,63}$`) + +func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { + errs := c.Comm.Prepare(ctx) + + if c.Zone == "" { + errs = append(errs, fmt.Errorf("%q must be set", "availability_zone")) + } + + if c.SourceImageId == "" { + errs = append(errs, fmt.Errorf("%q must be set", "source_image_id")) + } + + if c.InstanceType == "" { + errs = append(errs, fmt.Errorf("%q must be set", "instance_type")) + } else if _, err := parseInstanceType(c.InstanceType); err != nil { + errs = append(errs, err) + } + + if (c.VPCId != "" && c.SubnetId == "") || (c.VPCId == "" && c.SubnetId != "") { + errs = append(errs, fmt.Errorf("expected both %q and %q to set or not set", "vpc_id", "subnet_id")) + } + + if c.BootDiskType == "" { + c.BootDiskType = "cloud_ssd" + } else if err := checkStringIn(c.BootDiskType, + []string{"local_normal", "local_ssd", "cloud_ssd"}); err != nil { + errs = append(errs, err) + } + + if c.InstanceName == "" { + c.InstanceName = fmt.Sprintf("packer-%s", uuid.TimeOrderedUUID()[:8]) + } else if !instanceNamePattern.MatchString(c.InstanceName) { + errs = append(errs, fmt.Errorf("expected %q to be 1-63 characters and only support chinese, english, numbers, '-_.', got %q", "instance_name", c.InstanceName)) + } + + if c.UseSSHPrivateIp == true && c.VPCId == "" { + errs = append(errs, fmt.Errorf("%q must be set when use_ssh_private_ip is true", "vpc_id")) + } + + if c.Comm.SSHPassword != "" && len(validateInstancePassword(c.Comm.SSHPassword)) != 0 { + for _, v := range validateInstancePassword(c.Comm.SSHPassword) { + errs = append(errs, v) + } + } + + if len(errs) > 0 { + return errs + } + + return nil +} + +var instancePasswordUpperPattern = regexp.MustCompile(`[A-Z]`) +var instancePasswordLowerPattern = regexp.MustCompile(`[a-z]`) +var instancePasswordNumPattern = regexp.MustCompile(`[0-9]`) +var instancePasswordSpecialPattern = regexp.MustCompile(`[` + "`" + `()~!@#$%^&*-+=_|{}\[\]:;'<>,.?/]`) +var instancePasswordPattern = regexp.MustCompile(`^[A-Za-z0-9` + "`" + `()~!@#$%^&*-+=_|{}\[\]:;'<>,.?/]{8,30}$`) + +func validateInstancePassword(password string) (errors []error) { + if !instancePasswordPattern.MatchString(password) { + errors = append(errors, fmt.Errorf("%q is invalid, should have between 8-30 characters and any characters must be legal, got %q", "ssh_password", password)) + } + + categoryCount := 0 + if instancePasswordUpperPattern.MatchString(password) { + categoryCount++ + } + + if instancePasswordLowerPattern.MatchString(password) { + categoryCount++ + } + + if instancePasswordNumPattern.MatchString(password) { + categoryCount++ + } + + if instancePasswordSpecialPattern.MatchString(password) { + categoryCount++ + } + + if categoryCount < 2 { + errors = append(errors, fmt.Errorf("%q is invalid, should have least 2 items of capital letters, lower case letters, numbers and special characters, got %q", "ssh_password", password)) + } + + return +} diff --git a/builder/ucloud/uhost/run_config_test.go b/builder/ucloud/uhost/run_config_test.go new file mode 100644 index 000000000..ff156905d --- /dev/null +++ b/builder/ucloud/uhost/run_config_test.go @@ -0,0 +1,65 @@ +package uhost + +import ( + "testing" + + "github.com/hashicorp/packer/helper/communicator" +) + +func testConfig() *RunConfig { + return &RunConfig{ + SourceImageId: "ucloud_image", + InstanceType: "n-basic-2", + Zone: "cn-bj2-02", + Comm: communicator.Config{ + SSH: communicator.SSH{ + SSHUsername: "ucloud", + }, + }, + } +} + +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_SourceImage(t *testing.T) { + c := testConfig() + c.SourceImageId = "" + 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) + } +} diff --git a/builder/ucloud/uhost/step_check_source_image.go b/builder/ucloud/uhost/step_check_source_image.go new file mode 100644 index 000000000..b8a570610 --- /dev/null +++ b/builder/ucloud/uhost/step_check_source_image.go @@ -0,0 +1,36 @@ +package uhost + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type stepCheckSourceImageId struct { + SourceUHostImageId string +} + +func (s *stepCheckSourceImageId) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + client := state.Get("client").(*UCloudClient) + + ui.Say("Querying source image id...") + + imageSet, err := client.DescribeImageById(s.SourceUHostImageId) + if err != nil { + if isNotFoundError(err) { + return halt(state, err, "") + } + return halt(state, err, fmt.Sprintf("Error on querying specified source_image_id %q", s.SourceUHostImageId)) + } + + if imageSet.OsType == osTypeWindows { + return halt(state, err, "The ucloud-uhost builder does not support Windows images yet") + } + + state.Put("source_image", imageSet) + return multistep.ActionContinue +} + +func (s *stepCheckSourceImageId) Cleanup(multistep.StateBag) {} diff --git a/builder/ucloud/uhost/step_config_security_group.go b/builder/ucloud/uhost/step_config_security_group.go new file mode 100644 index 000000000..eee0d0977 --- /dev/null +++ b/builder/ucloud/uhost/step_config_security_group.go @@ -0,0 +1,77 @@ +package uhost + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/ucloud/ucloud-sdk-go/ucloud" +) + +type stepConfigSecurityGroup struct { + SecurityGroupId string +} + +func (s *stepConfigSecurityGroup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + client := state.Get("client").(*UCloudClient) + conn := client.unetconn + ui := state.Get("ui").(packer.Ui) + + if len(s.SecurityGroupId) != 0 { + ui.Say(fmt.Sprintf("Trying to use specified security group %q...", s.SecurityGroupId)) + securityGroupSet, err := client.describeFirewallById(s.SecurityGroupId) + if err != nil { + if isNotFoundError(err) { + err = fmt.Errorf("the specified security group %q does not exist", s.SecurityGroupId) + return halt(state, err, "") + } + return halt(state, err, fmt.Sprintf("Error on querying specified security group %q", s.SecurityGroupId)) + } + + state.Put("security_group_id", securityGroupSet.FWId) + return multistep.ActionContinue + } + + ui.Say("Trying to use default security group...") + var securityGroupId string + var limit = 100 + var offset int + + for { + req := conn.NewDescribeFirewallRequest() + req.Limit = ucloud.Int(limit) + req.Offset = ucloud.Int(offset) + + resp, err := conn.DescribeFirewall(req) + if err != nil { + return halt(state, err, "Error on querying default security group") + } + + if resp == nil || len(resp.DataSet) < 1 { + break + } + + for _, item := range resp.DataSet { + if item.Type == securityGroupNonWeb { + securityGroupId = item.FWId + break + } + } + + if len(resp.DataSet) < limit { + break + } + + offset = offset + limit + } + + if securityGroupId == "" { + return halt(state, fmt.Errorf("the default security group does not exist"), "") + } + + state.Put("security_group_id", securityGroupId) + return multistep.ActionContinue +} + +func (s *stepConfigSecurityGroup) Cleanup(state multistep.StateBag) { +} diff --git a/builder/ucloud/uhost/step_config_subnet.go b/builder/ucloud/uhost/step_config_subnet.go new file mode 100644 index 000000000..44e22c6db --- /dev/null +++ b/builder/ucloud/uhost/step_config_subnet.go @@ -0,0 +1,39 @@ +package uhost + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type stepConfigSubnet struct { + SubnetId string +} + +func (s *stepConfigSubnet) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + client := state.Get("client").(*UCloudClient) + ui := state.Get("ui").(packer.Ui) + + if len(s.SubnetId) != 0 { + ui.Say(fmt.Sprintf("Trying to use specified subnet %q...", s.SubnetId)) + subnetSet, err := client.describeSubnetById(s.SubnetId) + if err != nil { + if isNotFoundError(err) { + err = fmt.Errorf("the specified subnet %q does not exist", s.SubnetId) + return halt(state, err, "") + } + return halt(state, err, fmt.Sprintf("Error on querying specified subnet %q", s.SubnetId)) + } + + state.Put("subnet_id", subnetSet.SubnetId) + return multistep.ActionContinue + } + + ui.Say(fmt.Sprintf("Trying to use default subnet...")) + + return multistep.ActionContinue +} + +func (s *stepConfigSubnet) Cleanup(state multistep.StateBag) { +} diff --git a/builder/ucloud/uhost/step_config_vpc.go b/builder/ucloud/uhost/step_config_vpc.go new file mode 100644 index 000000000..3378071f4 --- /dev/null +++ b/builder/ucloud/uhost/step_config_vpc.go @@ -0,0 +1,42 @@ +package uhost + +import ( + "context" + "fmt" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type stepConfigVPC struct { + VPCId string +} + +func (s *stepConfigVPC) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + client := state.Get("client").(*UCloudClient) + ui := state.Get("ui").(packer.Ui) + + if len(s.VPCId) != 0 { + ui.Say(fmt.Sprintf("Trying to use specified vpc %q...", s.VPCId)) + + vpcSet, err := client.describeVPCById(s.VPCId) + if err != nil { + if isNotFoundError(err) { + err = fmt.Errorf("the specified vpc %q does not exist", s.VPCId) + return halt(state, err, "") + } + return halt(state, err, fmt.Sprintf("Error on querying specified vpc %q", s.VPCId)) + } + + state.Put("vpc_id", vpcSet.VPCId) + return multistep.ActionContinue + + } + + ui.Say(fmt.Sprintf("Trying to use default vpc...")) + + return multistep.ActionContinue +} + +func (s *stepConfigVPC) Cleanup(state multistep.StateBag) { +} diff --git a/builder/ucloud/uhost/step_copy_image.go b/builder/ucloud/uhost/step_copy_image.go new file mode 100644 index 000000000..dab78bbd7 --- /dev/null +++ b/builder/ucloud/uhost/step_copy_image.go @@ -0,0 +1,139 @@ +package uhost + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/common/retry" + "strings" + "time" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/ucloud/ucloud-sdk-go/ucloud" +) + +type stepCopyUCloudImage struct { + ImageDestinations []ImageDestination + RegionId string + ProjectId string +} + +func (s *stepCopyUCloudImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + if len(s.ImageDestinations) == 0 { + return multistep.ActionContinue + } + + client := state.Get("client").(*UCloudClient) + conn := client.uhostconn + ui := state.Get("ui").(packer.Ui) + + srcImageId := state.Get("image_id").(string) + artifactImages := state.Get("ucloud_images").(*imageInfoSet) + expectedImages := newImageInfoSet(nil) + ui.Say(fmt.Sprintf("Copying images from %q...", srcImageId)) + for _, v := range s.ImageDestinations { + if v.ProjectId == s.ProjectId && v.Region == s.RegionId { + continue + } + + req := conn.NewCopyCustomImageRequest() + req.TargetProjectId = ucloud.String(v.ProjectId) + req.TargetRegion = ucloud.String(v.Region) + req.SourceImageId = ucloud.String(srcImageId) + req.TargetImageName = ucloud.String(v.Name) + req.TargetImageDescription = ucloud.String(v.Description) + + resp, err := conn.CopyCustomImage(req) + if err != nil { + return halt(state, err, fmt.Sprintf("Error on copying image %q to %s:%s", srcImageId, v.ProjectId, v.Region)) + } + + image := imageInfo{ + Region: v.Region, + ProjectId: v.ProjectId, + ImageId: resp.TargetImageId, + } + expectedImages.Set(image) + artifactImages.Set(image) + + ui.Message(fmt.Sprintf("Copying image from %s:%s:%s to %s:%s:%s)", + s.ProjectId, s.RegionId, srcImageId, v.ProjectId, v.Region, resp.TargetImageId)) + } + ui.Message("Waiting for the copied images to become available...") + + err := retry.Config{ + Tries: 200, + ShouldRetry: func(err error) bool { return isNotCompleteError(err) }, + RetryDelay: (&retry.Backoff{InitialBackoff: 2 * time.Second, MaxBackoff: 12 * time.Second, Multiplier: 2}).Linear, + }.Run(ctx, func(ctx context.Context) error { + for _, v := range expectedImages.GetAll() { + imageSet, err := client.describeImageByInfo(v.ProjectId, v.Region, v.ImageId) + if err != nil { + return fmt.Errorf("reading %s:%s:%s failed, %s", v.ProjectId, v.Region, v.ImageId, err) + } + + if imageSet.State == imageStateAvailable { + expectedImages.Remove(v.Id()) + continue + } + } + + if len(expectedImages.GetAll()) != 0 { + return newNotCompleteError("copying image") + } + + return nil + }) + + if err != nil { + var s []string + for _, v := range expectedImages.GetAll() { + s = append(s, fmt.Sprintf("%s:%s:%s", v.ProjectId, v.Region, v.ImageId)) + } + + return halt(state, err, fmt.Sprintf("Error on waiting for copying images %q to become available", strings.Join(s, ","))) + } + + ui.Message(fmt.Sprintf("Copying image complete")) + return multistep.ActionContinue +} + +func (s *stepCopyUCloudImage) Cleanup(state multistep.StateBag) { + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + + if !cancelled && !halted { + return + } + + srcImageId := state.Get("image_id").(string) + ucloudImages := state.Get("ucloud_images").(*imageInfoSet) + imageInfos := ucloudImages.GetAll() + if len(imageInfos) == 0 { + return + } else if len(imageInfos) == 1 && imageInfos[0].ImageId == srcImageId { + return + } + + ui := state.Get("ui").(packer.Ui) + client := state.Get("client").(*UCloudClient) + conn := client.uhostconn + ui.Say(fmt.Sprintf("Deleting copied image because of cancellation or error...")) + + for _, v := range imageInfos { + if v.ImageId == srcImageId { + continue + } + + req := conn.NewTerminateCustomImageRequest() + req.ProjectId = ucloud.String(v.ProjectId) + req.Region = ucloud.String(v.Region) + req.ImageId = ucloud.String(v.ImageId) + _, err := conn.TerminateCustomImage(req) + if err != nil { + ui.Error(fmt.Sprintf("Error on deleting copied image %q", v.ImageId)) + } + } + + ui.Message("Deleting copied image complete") +} diff --git a/builder/ucloud/uhost/step_create_image.go b/builder/ucloud/uhost/step_create_image.go new file mode 100644 index 000000000..6389b4b22 --- /dev/null +++ b/builder/ucloud/uhost/step_create_image.go @@ -0,0 +1,104 @@ +package uhost + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/common/retry" + "time" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/ucloud/ucloud-sdk-go/services/uhost" + "github.com/ucloud/ucloud-sdk-go/ucloud" +) + +type stepCreateImage struct { + image *uhost.UHostImageSet +} + +func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + client := state.Get("client").(*UCloudClient) + conn := client.uhostconn + instance := state.Get("instance").(*uhost.UHostInstanceSet) + ui := state.Get("ui").(packer.Ui) + config := state.Get("config").(*Config) + + ui.Say(fmt.Sprintf("Creating image %s...", config.ImageName)) + + req := conn.NewCreateCustomImageRequest() + req.ImageName = ucloud.String(config.ImageName) + req.ImageDescription = ucloud.String(config.ImageDescription) + req.UHostId = ucloud.String(instance.UHostId) + + resp, err := conn.CreateCustomImage(req) + if err != nil { + return halt(state, err, "Error on creating image") + } + ui.Message(fmt.Sprintf("Waiting for the created image %q to become available...", resp.ImageId)) + + err = retry.Config{ + Tries: 200, + ShouldRetry: func(err error) bool { + return isExpectedStateError(err) + }, + RetryDelay: (&retry.Backoff{InitialBackoff: 2 * time.Second, MaxBackoff: 12 * time.Second, Multiplier: 2}).Linear, + }.Run(ctx, func(ctx context.Context) error { + inst, err := client.DescribeImageById(resp.ImageId) + if err != nil { + return err + } + if inst == nil || inst.State != imageStateAvailable { + return newExpectedStateError("image", resp.ImageId) + } + + return nil + }) + + if err != nil { + return halt(state, err, fmt.Sprintf("Error on waiting for image %q to become available", resp.ImageId)) + } + + imageSet, err := client.DescribeImageById(resp.ImageId) + if err != nil { + return halt(state, err, fmt.Sprintf("Error on reading image when creating %q", resp.ImageId)) + } + + s.image = imageSet + state.Put("image_id", imageSet.ImageId) + + images := []imageInfo{ + { + ImageId: imageSet.ImageId, + ProjectId: config.ProjectId, + Region: config.Region, + }, + } + + state.Put("ucloud_images", newImageInfoSet(images)) + ui.Message(fmt.Sprintf("Creating image %q complete", imageSet.ImageId)) + return multistep.ActionContinue +} + +func (s *stepCreateImage) Cleanup(state multistep.StateBag) { + if s.image == nil { + return + } + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + if !cancelled && !halted { + return + } + + client := state.Get("client").(*UCloudClient) + conn := client.uhostconn + ui := state.Get("ui").(packer.Ui) + + ui.Say("Deleting image because of cancellation or error...") + req := conn.NewTerminateCustomImageRequest() + req.ImageId = ucloud.String(s.image.ImageId) + _, err := conn.TerminateCustomImage(req) + if err != nil { + ui.Error(fmt.Sprintf("Error on deleting image %q", s.image.ImageId)) + } + ui.Message(fmt.Sprintf("Deleting image %q complete", s.image.ImageId)) +} diff --git a/builder/ucloud/uhost/step_create_instance.go b/builder/ucloud/uhost/step_create_instance.go new file mode 100644 index 000000000..f5554ee70 --- /dev/null +++ b/builder/ucloud/uhost/step_create_instance.go @@ -0,0 +1,285 @@ +package uhost + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/common/retry" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/ucloud/ucloud-sdk-go/services/uhost" + "github.com/ucloud/ucloud-sdk-go/ucloud" + "math/rand" + "strings" + "time" +) + +type stepCreateInstance struct { + Region string + Zone string + InstanceType string + InstanceName string + BootDiskType string + SourceImageId string + UsePrivateIp bool + + instanceId string +} + +func (s *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + client := state.Get("client").(*UCloudClient) + conn := client.uhostconn + ui := state.Get("ui").(packer.Ui) + + ui.Say("Creating Instance...") + resp, err := conn.CreateUHostInstance(s.buildCreateInstanceRequest(state)) + if err != nil { + return halt(state, err, "Error on creating instance") + } + instanceId := resp.UHostIds[0] + + err = retry.Config{ + Tries: 20, + ShouldRetry: func(err error) bool { + return isExpectedStateError(err) + }, + RetryDelay: (&retry.Backoff{InitialBackoff: 2 * time.Second, MaxBackoff: 6 * time.Second, Multiplier: 2}).Linear, + }.Run(ctx, func(ctx context.Context) error { + inst, err := client.describeUHostById(instanceId) + if err != nil { + return err + } + + if inst.State == "ResizeFail" { + return fmt.Errorf("resizing instance failed") + } + + if inst.State == "Install Fail" { + return fmt.Errorf("install failed") + } + + if inst == nil || inst.State != instanceStateRunning { + return newExpectedStateError("instance", instanceId) + } + + return nil + }) + + if err != nil { + return halt(state, err, fmt.Sprintf("Error on waiting for instance %q to become available", instanceId)) + } + + ui.Message(fmt.Sprintf("Creating instance %q complete", instanceId)) + instance, err := client.describeUHostById(instanceId) + if err != nil { + return halt(state, err, fmt.Sprintf("Error on reading instance when creating %q", instanceId)) + } + + s.instanceId = instanceId + state.Put("instance", instance) + + if instance.BootDiskState != bootDiskStateNormal { + ui.Say("Waiting for boot disk of instance initialized") + if s.BootDiskType == "local_normal" || s.BootDiskType == "local_ssd" { + ui.Message(fmt.Sprintf("Warning: It takes around 10 mins for boot disk initialization when `boot_disk_type` is %q", s.BootDiskType)) + } + + err = retry.Config{ + Tries: 200, + ShouldRetry: func(err error) bool { + return isExpectedStateError(err) + }, + RetryDelay: (&retry.Backoff{InitialBackoff: 2 * time.Second, MaxBackoff: 12 * time.Second, Multiplier: 2}).Linear, + }.Run(ctx, func(ctx context.Context) error { + inst, err := client.describeUHostById(instanceId) + if err != nil { + return err + } + if inst.BootDiskState != bootDiskStateNormal { + return newExpectedStateError("boot_disk of instance", instanceId) + } + + return nil + }) + + if err != nil { + return halt(state, err, fmt.Sprintf("Error on waiting for boot disk of instance %q initialized", instanceId)) + } + + ui.Message(fmt.Sprintf("Waiting for boot disk of instance %q initialized complete", instanceId)) + } + + return multistep.ActionContinue +} + +func (s *stepCreateInstance) Cleanup(state multistep.StateBag) { + if s.instanceId == "" { + return + } + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + + ui := state.Get("ui").(packer.Ui) + ctx := context.TODO() + + if cancelled || halted { + ui.Say("Deleting instance because of cancellation or error...") + } else { + ui.Say("Deleting instance...") + } + + client := state.Get("client").(*UCloudClient) + conn := client.uhostconn + + instance, err := client.describeUHostById(s.instanceId) + if err != nil { + if isNotFoundError(err) { + return + } + ui.Error(fmt.Sprintf("Error on reading instance when deleting %q, %s", + s.instanceId, err.Error())) + return + } + + if instance.State != instanceStateStopped { + stopReq := conn.NewStopUHostInstanceRequest() + stopReq.UHostId = ucloud.String(s.instanceId) + if _, err = conn.StopUHostInstance(stopReq); err != nil { + ui.Error(fmt.Sprintf("Error on stopping instance when deleting %q, %s", + s.instanceId, err.Error())) + return + } + + err = retry.Config{ + Tries: 30, + ShouldRetry: func(err error) bool { + return isExpectedStateError(err) + }, + RetryDelay: (&retry.Backoff{InitialBackoff: 2 * time.Second, MaxBackoff: 6 * time.Second, Multiplier: 2}).Linear, + }.Run(ctx, func(ctx context.Context) error { + instance, err := client.describeUHostById(s.instanceId) + if err != nil { + return err + } + + if instance.State != instanceStateStopped { + return newExpectedStateError("instance", s.instanceId) + } + + return nil + }) + + if err != nil { + ui.Error(fmt.Sprintf("Error on waiting for stopping instance when deleting %q, %s", + s.instanceId, err.Error())) + return + } + } + + deleteReq := conn.NewTerminateUHostInstanceRequest() + deleteReq.UHostId = ucloud.String(s.instanceId) + deleteReq.ReleaseUDisk = ucloud.Bool(true) + deleteReq.ReleaseEIP = ucloud.Bool(true) + + if _, err = conn.TerminateUHostInstance(deleteReq); err != nil { + ui.Error(fmt.Sprintf("Error on deleting instance %q, %s", + s.instanceId, err.Error())) + return + } + + err = retry.Config{ + Tries: 30, + ShouldRetry: func(err error) bool { return !isNotFoundError(err) }, + RetryDelay: (&retry.Backoff{InitialBackoff: 2 * time.Second, MaxBackoff: 6 * time.Second, Multiplier: 2}).Linear, + }.Run(ctx, func(ctx context.Context) error { + _, err := client.describeUHostById(s.instanceId) + return err + }) + + if err != nil { + ui.Error(fmt.Sprintf("Error on waiting for instance %q to be deleted: %s", + s.instanceId, err.Error())) + return + } + + ui.Message(fmt.Sprintf("Deleting instance %q complete", s.instanceId)) +} + +func (s *stepCreateInstance) buildCreateInstanceRequest(state multistep.StateBag) *uhost.CreateUHostInstanceRequest { + client := state.Get("client").(*UCloudClient) + conn := client.uhostconn + srcImage := state.Get("source_image").(*uhost.UHostImageSet) + config := state.Get("config").(*Config) + connectConfig := &config.RunConfig.Comm + + var password string + if srcImage.OsType == "Linux" { + password = config.Comm.SSHPassword + } + + if password == "" { + password = fmt.Sprintf("%s%s%s", + s.randStringFromCharSet(5, defaultPasswordStr), + s.randStringFromCharSet(1, defaultPasswordSpe), + s.randStringFromCharSet(5, defaultPasswordNum)) + if srcImage.OsType == "Linux" { + connectConfig.SSHPassword = password + } + } + + req := conn.NewCreateUHostInstanceRequest() + t, _ := parseInstanceType(s.InstanceType) + + req.CPU = ucloud.Int(t.CPU) + req.Memory = ucloud.Int(t.Memory) + req.Name = ucloud.String(s.InstanceName) + req.LoginMode = ucloud.String("Password") + req.Zone = ucloud.String(s.Zone) + req.ImageId = ucloud.String(s.SourceImageId) + req.ChargeType = ucloud.String("Dynamic") + req.Password = ucloud.String(password) + + if v, ok := state.GetOk("security_group_id"); ok { + req.SecurityGroupId = ucloud.String(v.(string)) + } + + if v, ok := state.GetOk("vpc_id"); ok { + req.VPCId = ucloud.String(v.(string)) + } + + if v, ok := state.GetOk("subnet_id"); ok { + req.SubnetId = ucloud.String(v.(string)) + } + + bootDisk := uhost.UHostDisk{} + bootDisk.IsBoot = ucloud.String("true") + bootDisk.Size = ucloud.Int(srcImage.ImageSize) + bootDisk.Type = ucloud.String(bootDiskTypeMap[s.BootDiskType]) + + req.Disks = append(req.Disks, bootDisk) + + if !s.UsePrivateIp { + operatorName := ucloud.String("International") + if strings.HasPrefix(s.Region, "cn-") { + operatorName = ucloud.String("Bgp") + } + networkInterface := uhost.CreateUHostInstanceParamNetworkInterface{ + EIP: &uhost.CreateUHostInstanceParamNetworkInterfaceEIP{ + Bandwidth: ucloud.Int(30), + PayMode: ucloud.String("Traffic"), + OperatorName: operatorName, + }, + } + + req.NetworkInterface = append(req.NetworkInterface, networkInterface) + } + return req +} + +func (s *stepCreateInstance) randStringFromCharSet(strlen int, charSet string) string { + rand.Seed(time.Now().UTC().UnixNano()) + result := make([]byte, strlen) + for i := 0; i < strlen; i++ { + result[i] = charSet[rand.Intn(len(charSet))] + } + return string(result) +} diff --git a/builder/ucloud/uhost/step_pre_validate.go b/builder/ucloud/uhost/step_pre_validate.go new file mode 100644 index 000000000..5c578d08a --- /dev/null +++ b/builder/ucloud/uhost/step_pre_validate.go @@ -0,0 +1,97 @@ +package uhost + +import ( + "context" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type stepPreValidate struct { + ProjectId string + Region string + Zone string + ImageDestinations []ImageDestination +} + +func (s *stepPreValidate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + if err := s.validateProjectIds(state); err != nil { + return halt(state, err, "") + } + + if err := s.validateRegions(state); err != nil { + return halt(state, err, "") + } + + if err := s.validateZones(state); err != nil { + return halt(state, err, "") + } + + return multistep.ActionContinue +} + +func (s *stepPreValidate) validateProjectIds(state multistep.StateBag) error { + ui := state.Get("ui").(packer.Ui) + config := state.Get("config").(*Config) + + ui.Say("Validating project_id and copied project_ids...") + + var errs *packer.MultiError + if err := config.ValidateProjectId(s.ProjectId); err != nil { + errs = packer.MultiErrorAppend(errs, err) + } + + for _, imageDestination := range s.ImageDestinations { + if err := config.ValidateProjectId(imageDestination.ProjectId); err != nil { + errs = packer.MultiErrorAppend(errs, err) + } + } + + if errs != nil && len(errs.Errors) > 0 { + return errs + } + + return nil +} + +func (s *stepPreValidate) validateRegions(state multistep.StateBag) error { + ui := state.Get("ui").(packer.Ui) + config := state.Get("config").(*Config) + + ui.Say("Validating region and copied regions...") + + var errs *packer.MultiError + if err := config.ValidateRegion(s.Region); err != nil { + errs = packer.MultiErrorAppend(errs, err) + } + for _, imageDestination := range s.ImageDestinations { + if err := config.ValidateRegion(imageDestination.Region); err != nil { + errs = packer.MultiErrorAppend(errs, err) + } + } + + if errs != nil && len(errs.Errors) > 0 { + return errs + } + + return nil +} + +func (s *stepPreValidate) validateZones(state multistep.StateBag) error { + ui := state.Get("ui").(packer.Ui) + config := state.Get("config").(*Config) + + ui.Say("Validating availability_zone...") + + var errs *packer.MultiError + if err := config.ValidateZone(s.Region, s.Zone); err != nil { + errs = packer.MultiErrorAppend(errs, err) + } + + if errs != nil && len(errs.Errors) > 0 { + return errs + } + + return nil +} + +func (s *stepPreValidate) Cleanup(multistep.StateBag) {} diff --git a/builder/ucloud/uhost/step_stop_instance.go b/builder/ucloud/uhost/step_stop_instance.go new file mode 100644 index 000000000..548a8d20f --- /dev/null +++ b/builder/ucloud/uhost/step_stop_instance.go @@ -0,0 +1,80 @@ +package uhost + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/common/retry" + "time" + + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/ucloud/ucloud-sdk-go/services/uhost" + "github.com/ucloud/ucloud-sdk-go/ucloud" +) + +type stepStopInstance struct { +} + +func (s *stepStopInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + client := state.Get("client").(*UCloudClient) + conn := client.uhostconn + instance := state.Get("instance").(*uhost.UHostInstanceSet) + ui := state.Get("ui").(packer.Ui) + + instance, err := client.describeUHostById(instance.UHostId) + if err != nil { + return halt(state, err, fmt.Sprintf("Error on reading instance when stopping %q", instance.UHostId)) + } + + if instance.State != instanceStateStopped { + stopReq := conn.NewStopUHostInstanceRequest() + stopReq.UHostId = ucloud.String(instance.UHostId) + ui.Say(fmt.Sprintf("Stopping instance %q", instance.UHostId)) + err = retry.Config{ + Tries: 5, + ShouldRetry: func(err error) bool { + return err != nil + }, + RetryDelay: (&retry.Backoff{InitialBackoff: 2 * time.Second, MaxBackoff: 6 * time.Second, Multiplier: 2}).Linear, + }.Run(ctx, func(ctx context.Context) error { + if _, err = conn.StopUHostInstance(stopReq); err != nil { + return err + } + return nil + }) + + if err != nil { + return halt(state, err, fmt.Sprintf("Error on stopping instance %q", instance.UHostId)) + } + + err = retry.Config{ + Tries: 20, + ShouldRetry: func(err error) bool { + return isExpectedStateError(err) + }, + RetryDelay: (&retry.Backoff{InitialBackoff: 2 * time.Second, MaxBackoff: 6 * time.Second, Multiplier: 2}).Linear, + }.Run(ctx, func(ctx context.Context) error { + instance, err := client.describeUHostById(instance.UHostId) + if err != nil { + return err + } + + if instance.State != instanceStateStopped { + return newExpectedStateError("instance", instance.UHostId) + } + + return nil + }) + + if err != nil { + return halt(state, err, fmt.Sprintf("Error on waiting for stopping instance when stopping %q", instance.UHostId)) + } + + ui.Message(fmt.Sprintf("Stopping instance %q complete", instance.UHostId)) + } + + return multistep.ActionContinue +} + +func (s *stepStopInstance) Cleanup(multistep.StateBag) { +} diff --git a/builder/ucloud/uhost/types.go b/builder/ucloud/uhost/types.go new file mode 100644 index 000000000..9695450fb --- /dev/null +++ b/builder/ucloud/uhost/types.go @@ -0,0 +1,215 @@ +package uhost + +import ( + "fmt" + "strconv" + "strings" + "sync" +) + +type instanceType struct { + CPU int + Memory int + HostType string + HostScaleType string +} + +func parseInstanceType(s string) (*instanceType, error) { + split := strings.Split(s, "-") + if len(split) < 3 { + return nil, fmt.Errorf("instance type is invalid, got %q", s) + } + + if split[1] == "customized" { + return parseInstanceTypeByCustomize(split...) + } + + return parseInstanceTypeByNormal(split...) +} +func (i *instanceType) String() string { + if i.Iscustomized() { + return fmt.Sprintf("%s-%s-%v-%v", i.HostType, i.HostScaleType, i.CPU, i.Memory) + } else { + return fmt.Sprintf("%s-%s-%v", i.HostType, i.HostScaleType, i.CPU) + } +} + +func (i *instanceType) Iscustomized() bool { + return i.HostScaleType == "customized" +} + +var instanceTypeScaleMap = map[string]int{ + "highcpu": 1 * 1024, + "basic": 2 * 1024, + "standard": 4 * 1024, + "highmem": 8 * 1024, +} + +var availableHostTypes = []string{"n"} + +func parseInstanceTypeByCustomize(splited ...string) (*instanceType, error) { + if len(splited) != 4 { + return nil, fmt.Errorf("instance type is invalid, expected like n-customize-1-2") + } + + hostType := splited[0] + err := checkStringIn(hostType, availableHostTypes) + if err != nil { + return nil, err + } + + hostScaleType := splited[1] + + cpu, err := strconv.Atoi(splited[2]) + if err != nil { + return nil, fmt.Errorf("cpu count is invalid, please use a number") + } + + memory, err := strconv.Atoi(splited[3]) + if err != nil { + return nil, fmt.Errorf("memory count is invalid, please use a number") + } + + if cpu/memory > 2 || memory/cpu > 12 { + return nil, fmt.Errorf("the ratio of cpu to memory should be range of 2:1 ~ 1:12, got %d:%d", cpu, memory) + } + + if memory/cpu == 1 || memory/cpu == 2 || memory/cpu == 4 || memory/cpu == 8 { + return nil, fmt.Errorf("instance type is invalid, expected %q like %q,"+ + "the Type can be highcpu, basic, standard, highmem when the ratio of cpu to memory is 1:1, 1:2, 1:4, 1:8", "n-Type-CPU", "n-standard-1") + } + + if cpu < 1 || 32 < cpu { + return nil, fmt.Errorf("expected cpu to be in the range (1 - 32), got %d", cpu) + } + + if memory < 1 || 128 < memory { + return nil, fmt.Errorf("expected memory to be in the range (1 - 128),got %d", memory) + } + + if cpu != 1 && (cpu%2) != 0 { + return nil, fmt.Errorf("expected the number of cores of cpu must be divisible by 2 without a remainder (except single core), got %d", cpu) + } + + if memory != 1 && (memory%2) != 0 { + return nil, fmt.Errorf("expected the number of memory must be divisible by 2 without a remainder (except single memory), got %d", memory) + } + + t := &instanceType{} + t.HostType = hostType + t.HostScaleType = hostScaleType + t.CPU = cpu + t.Memory = memory * 1024 + return t, nil +} + +var availableOutstandingCpu = []int{4, 8, 16, 32, 64} + +func parseInstanceTypeByNormal(split ...string) (*instanceType, error) { + if len(split) != 3 { + return nil, fmt.Errorf("instance type is invalid, expected like n-standard-1") + } + + hostType := split[0] + err := checkStringIn(hostType, []string{"n", "o"}) + if err != nil { + return nil, err + } + + hostScaleType := split[1] + + if scale, ok := instanceTypeScaleMap[hostScaleType]; !ok { + return nil, fmt.Errorf("instance type is invalid, expected like n-standard-1") + } else { + cpu, err := strconv.Atoi(split[2]) + if err != nil { + return nil, fmt.Errorf("cpu count is invalid, please use a number") + } + + if cpu != 1 && (cpu%2) != 0 { + return nil, fmt.Errorf("expected the number of cores of cpu must be divisible by 2 without a remainder (except single core), got %d", cpu) + } + + if hostType == "o" { + if err := checkIntIn(cpu, availableOutstandingCpu); err != nil { + return nil, fmt.Errorf("expected cpu of outstanding instancetype %q", err) + } + + if hostScaleType == "highmem" && cpu == 64 { + return nil, fmt.Errorf("this instance type %q is not supported, please refer to instance type document", "o-highmem-64") + } + } else { + if hostScaleType == "highmem" && cpu > 16 { + return nil, fmt.Errorf("expected cpu to be in the range (1 - 16) for normal highmem instance type, got %d", cpu) + } + + if cpu < 1 || 32 < cpu { + return nil, fmt.Errorf("expected cpu to be in the range (1 - 32) for normal instance type, got %d", cpu) + } + } + + memory := cpu * scale + + t := &instanceType{} + t.HostType = hostType + t.HostScaleType = hostScaleType + t.CPU = cpu + t.Memory = memory + return t, nil + } +} + +type imageInfo struct { + ImageId string + ProjectId string + Region string +} + +func (i *imageInfo) Id() string { + return fmt.Sprintf("%s:%s", i.ProjectId, i.Region) +} + +type imageInfoSet struct { + m map[string]imageInfo + once sync.Once +} + +func newImageInfoSet(vL []imageInfo) *imageInfoSet { + s := imageInfoSet{} + for _, v := range vL { + s.Set(v) + } + return &s +} + +func (i *imageInfoSet) init() { + i.m = make(map[string]imageInfo) +} + +func (i *imageInfoSet) Set(img imageInfo) { + i.once.Do(i.init) + + i.m[img.Id()] = img +} + +func (i *imageInfoSet) Remove(id string) { + i.once.Do(i.init) + + delete(i.m, id) +} + +func (i *imageInfoSet) Get(projectId, region string) *imageInfo { + k := fmt.Sprintf("%s:%s", projectId, region) + if v, ok := i.m[k]; ok { + return &v + } + return nil +} + +func (i *imageInfoSet) GetAll() []imageInfo { + var vL []imageInfo + for _, img := range i.m { + vL = append(vL, img) + } + return vL +} diff --git a/builder/ucloud/uhost/types_test.go b/builder/ucloud/uhost/types_test.go new file mode 100644 index 000000000..1509855ca --- /dev/null +++ b/builder/ucloud/uhost/types_test.go @@ -0,0 +1,54 @@ +package uhost + +import ( + "testing" +) + +func Test_parseInstanceType(t *testing.T) { + type args struct { + s string + } + + tests := []struct { + name string + args args + want *instanceType + wantErr bool + }{ + {"ok_highcpu", args{"n-highcpu-1"}, &instanceType{1, 1024, "n", "highcpu"}, false}, + {"ok_basic", args{"n-basic-1"}, &instanceType{1, 2048, "n", "basic"}, false}, + {"ok_standard", args{"n-standard-1"}, &instanceType{1, 4096, "n", "standard"}, false}, + {"ok_highmem", args{"n-highmem-1"}, &instanceType{1, 8192, "n", "highmem"}, false}, + {"ok_customized", args{"n-customized-1-12"}, &instanceType{1, 12288, "n", "customized"}, false}, + + {"err_customized", args{"n-customized-1-5"}, nil, true}, + {"err_type", args{"nx-highcpu-1"}, nil, true}, + {"err_scale_type", args{"n-invalid-1"}, nil, true}, + {"err_cpu_too_much", args{"n-highcpu-33"}, nil, true}, + {"err_cpu_too_less", args{"n-highcpu-0"}, nil, true}, + {"err_cpu_is_invalid", args{"n-highcpu-x"}, nil, true}, + {"err_customized_format_len", args{"n-customized-1"}, nil, true}, + {"err_customized_format_number", args{"n-customized-x"}, nil, true}, + {"err_customized_should_be_standard", args{"n-customized-1-2"}, nil, true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := parseInstanceType(tt.args.s) + if (err != nil) != tt.wantErr { + t.Errorf("parseInstanceType() arg %s got %#v error = %v, wantErr %v", tt.args.s, got, err, tt.wantErr) + return + } + + if got == nil { + return + } + + if !(tt.want.CPU == got.CPU) || + !(tt.want.Memory == got.Memory) || + !(tt.want.HostType == got.HostType) || + !(tt.want.HostScaleType == got.HostScaleType) { + t.Errorf("parseInstanceType() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/builder/ucloud/uhost/utils.go b/builder/ucloud/uhost/utils.go new file mode 100644 index 000000000..b05216bc3 --- /dev/null +++ b/builder/ucloud/uhost/utils.go @@ -0,0 +1,74 @@ +package uhost + +import ( + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/ucloud/ucloud-sdk-go/services/uhost" + "strings" +) + +func checkStringIn(val string, available []string) error { + for _, choice := range available { + if val == choice { + return nil + } + } + + return fmt.Errorf("should be one of %q, got %q", strings.Join(available, ","), val) +} + +func checkIntIn(val int, available []int) error { + for _, choice := range available { + if val == choice { + return nil + } + } + + return fmt.Errorf("should be one of %v, got %d", available, val) +} + +func isStringIn(val string, available []string) bool { + for _, choice := range available { + if val == choice { + return true + } + } + + return false +} + +// SSHHost returns a function that can be given to the SSH communicator +func SSHHost(usePrivateIp bool) func(multistep.StateBag) (string, error) { + return func(state multistep.StateBag) (string, error) { + + instance := state.Get("instance").(*uhost.UHostInstanceSet) + var privateIp, publicIp string + + for _, v := range instance.IPSet { + if v.Type == ipTypePrivate { + privateIp = v.IP + } else { + publicIp = v.IP + } + } + + if usePrivateIp { + return privateIp, nil + } + + return publicIp, nil + } +} + +func halt(state multistep.StateBag, err error, prefix string) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + + if prefix != "" { + err = fmt.Errorf("%s: %s", prefix, err) + } + + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt +} diff --git a/builder/vagrant/builder.go b/builder/vagrant/builder.go index 1da055155..69c6fb3cf 100644 --- a/builder/vagrant/builder.go +++ b/builder/vagrant/builder.go @@ -254,6 +254,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack Template: b.config.Template, SyncedFolder: b.config.SyncedFolder, SourceBox: b.config.SourceBox, + BoxName: b.config.BoxName, OutputDir: b.config.OutputDir, GlobalID: b.config.GlobalID, }, diff --git a/builder/vagrant/step_create_vagrantfile.go b/builder/vagrant/step_create_vagrantfile.go index fa01d62a8..5101c6335 100644 --- a/builder/vagrant/step_create_vagrantfile.go +++ b/builder/vagrant/step_create_vagrantfile.go @@ -14,14 +14,21 @@ import ( type StepCreateVagrantfile struct { Template string - SourceBox string OutputDir string SyncedFolder string GlobalID string + SourceBox string + BoxName string } var DEFAULT_TEMPLATE = `Vagrant.configure("2") do |config| - config.vm.box = "{{.BoxName}}" + config.vm.define "source", autostart: false do |source| + source.vm.box = "{{.SourceBox}}" + end + config.vm.define "output" do |output| + output.vm.box = "{{.BoxName}}" + output.vm.box_url = "file://package.box" + end {{ if ne .SyncedFolder "" -}} config.vm.synced_folder "{{.SyncedFolder}}", "/vagrant" {{- else -}} @@ -31,6 +38,7 @@ end` type VagrantfileOptions struct { SyncedFolder string + SourceBox string BoxName string } @@ -56,7 +64,8 @@ func (s *StepCreateVagrantfile) createVagrantfile() (string, error) { opts := &VagrantfileOptions{ SyncedFolder: s.SyncedFolder, - BoxName: s.SourceBox, + BoxName: s.BoxName, + SourceBox: s.SourceBox, } err = tpl.Execute(templateFile, opts) diff --git a/builder/vagrant/step_create_vagrantfile_test.go b/builder/vagrant/step_create_vagrantfile_test.go index d3bcf21b9..93ef81702 100644 --- a/builder/vagrant/step_create_vagrantfile_test.go +++ b/builder/vagrant/step_create_vagrantfile_test.go @@ -20,7 +20,8 @@ func TestStepCreateVagrantfile_Impl(t *testing.T) { func TestCreateFile(t *testing.T) { testy := StepCreateVagrantfile{ OutputDir: "./", - SourceBox: "bananas", + SourceBox: "apples", + BoxName: "bananas", } templatePath, err := testy.createVagrantfile() if err != nil { @@ -30,7 +31,13 @@ func TestCreateFile(t *testing.T) { contents, err := ioutil.ReadFile(templatePath) actual := string(contents) expected := `Vagrant.configure("2") do |config| - config.vm.box = "bananas" + config.vm.define "source", autostart: false do |source| + source.vm.box = "apples" + end + config.vm.define "output" do |output| + output.vm.box = "bananas" + output.vm.box_url = "file://package.box" + end config.vm.synced_folder ".", "/vagrant", disabled: true end` if ok := strings.Compare(actual, expected); ok != 0 { @@ -51,7 +58,13 @@ func TestCreateFile_customSync(t *testing.T) { contents, err := ioutil.ReadFile(templatePath) actual := string(contents) expected := `Vagrant.configure("2") do |config| - config.vm.box = "" + config.vm.define "source", autostart: false do |source| + source.vm.box = "" + end + config.vm.define "output" do |output| + output.vm.box = "" + output.vm.box_url = "file://package.box" + end config.vm.synced_folder "myfolder/foldertimes", "/vagrant" end` if ok := strings.Compare(actual, expected); ok != 0 { diff --git a/builder/vagrant/step_ssh_config.go b/builder/vagrant/step_ssh_config.go index 6fb65ccde..7da3cb7d8 100644 --- a/builder/vagrant/step_ssh_config.go +++ b/builder/vagrant/step_ssh_config.go @@ -36,8 +36,6 @@ func (s *StepSSHConfig) Run(ctx context.Context, state multistep.StateBag) multi return multistep.ActionHalt } - config.Comm.SSHPrivateKeyFile = sshConfig.IdentityFile - config.Comm.SSHUsername = sshConfig.User config.Comm.SSHHost = sshConfig.Hostname port, err := strconv.Atoi(sshConfig.Port) if err != nil { @@ -46,6 +44,14 @@ func (s *StepSSHConfig) Run(ctx context.Context, state multistep.StateBag) multi } config.Comm.SSHPort = port + if config.Comm.SSHUsername != "" { + // If user has set the username within the communicator, use the + // auth provided there. + return multistep.ActionContinue + } + config.Comm.SSHPrivateKeyFile = sshConfig.IdentityFile + config.Comm.SSHUsername = sshConfig.User + return multistep.ActionContinue } diff --git a/builder/vagrant/step_up.go b/builder/vagrant/step_up.go index 23284f852..9caa711b0 100644 --- a/builder/vagrant/step_up.go +++ b/builder/vagrant/step_up.go @@ -20,7 +20,8 @@ func (s *StepUp) Run(ctx context.Context, state multistep.StateBag) multistep.St ui.Say("Calling Vagrant Up...") - var args []string + // start only the source box + args := []string{"source"} if s.GlobalID != "" { args = append(args, s.GlobalID) } diff --git a/builder/virtualbox/common/driver.go b/builder/virtualbox/common/driver.go index c0085fe2d..bfe8069ac 100644 --- a/builder/virtualbox/common/driver.go +++ b/builder/virtualbox/common/driver.go @@ -42,6 +42,7 @@ type Driver interface { SuppressMessages() error // VBoxManage executes the given VBoxManage command + // and returns the stdout channel as string VBoxManage(...string) error // Verify checks to make sure that this driver should function @@ -51,6 +52,25 @@ type Driver interface { // Version reads the version of VirtualBox that is installed. Version() (string, error) + + // LoadSnapshots Loads all defined snapshots for a vm. + // if no snapshots are defined nil will be returned + LoadSnapshots(string) (*VBoxSnapshot, error) + + // CreateSnapshot Creates a snapshot for a vm with a given name + CreateSnapshot(string, string) error + + // HasSnapshots tests if a vm has snapshots + HasSnapshots(string) (bool, error) + + // GetCurrentSnapshot Returns the current snapshot for a vm + GetCurrentSnapshot(string) (*VBoxSnapshot, error) + + // SetSnapshot sets the for a vm + SetSnapshot(string, *VBoxSnapshot) error + + // DeleteSnapshot deletes the specified snapshot from a vm + DeleteSnapshot(string, *VBoxSnapshot) error } func NewDriver() (Driver, error) { diff --git a/builder/virtualbox/common/driver_4_2.go b/builder/virtualbox/common/driver_4_2.go index fc065a678..1cc3e4ff9 100644 --- a/builder/virtualbox/common/driver_4_2.go +++ b/builder/virtualbox/common/driver_4_2.go @@ -177,6 +177,11 @@ func (d *VBox42Driver) SuppressMessages() error { } func (d *VBox42Driver) VBoxManage(args ...string) error { + _, err := d.VBoxManageWithOutput(args...) + return err +} + +func (d *VBox42Driver) VBoxManageWithOutput(args ...string) (string, error) { var stdout, stderr bytes.Buffer log.Printf("Executing VBoxManage: %#v", args) @@ -204,7 +209,7 @@ func (d *VBox42Driver) VBoxManage(args ...string) error { log.Printf("stdout: %s", stdoutString) log.Printf("stderr: %s", stderrString) - return err + return stdoutString, err } func (d *VBox42Driver) Verify() error { @@ -239,3 +244,84 @@ func (d *VBox42Driver) Version() (string, error) { log.Printf("VirtualBox version: %s", matches[0][1]) return matches[0][1], nil } + +// LoadSnapshots load the snapshots for a VM instance +func (d *VBox42Driver) LoadSnapshots(vmName string) (*VBoxSnapshot, error) { + if vmName == "" { + panic("Argument empty exception: vmName") + } + log.Printf("Executing LoadSnapshots: VM: %s", vmName) + + stdoutString, err := d.VBoxManageWithOutput("snapshot", vmName, "list", "--machinereadable") + if nil != err { + return nil, err + } + + var rootNode *VBoxSnapshot + if stdoutString != "This machine does not have any snapshots" { + rootNode, err = ParseSnapshotData(stdoutString) + if nil != err { + return nil, err + } + } + + return rootNode, nil +} + +func (d *VBox42Driver) CreateSnapshot(vmname string, snapshotName string) error { + if vmname == "" { + panic("Argument empty exception: vmname") + } + log.Printf("Executing CreateSnapshot: VM: %s, SnapshotName %s", vmname, snapshotName) + + return d.VBoxManage("snapshot", vmname, "take", snapshotName) +} + +func (d *VBox42Driver) HasSnapshots(vmname string) (bool, error) { + if vmname == "" { + panic("Argument empty exception: vmname") + } + log.Printf("Executing HasSnapshots: VM: %s", vmname) + + sn, err := d.LoadSnapshots(vmname) + if nil != err { + return false, err + } + return nil != sn, nil +} + +func (d *VBox42Driver) GetCurrentSnapshot(vmname string) (*VBoxSnapshot, error) { + if vmname == "" { + panic("Argument empty exception: vmname") + } + log.Printf("Executing GetCurrentSnapshot: VM: %s", vmname) + + sn, err := d.LoadSnapshots(vmname) + if nil != err { + return nil, err + } + return sn.GetCurrentSnapshot(), nil +} + +func (d *VBox42Driver) SetSnapshot(vmname string, sn *VBoxSnapshot) error { + if vmname == "" { + panic("Argument empty exception: vmname") + } + if nil == sn { + panic("Argument null exception: sn") + } + log.Printf("Executing SetSnapshot: VM: %s, SnapshotName %s", vmname, sn.UUID) + + return d.VBoxManage("snapshot", vmname, "restore", sn.UUID) +} + +func (d *VBox42Driver) DeleteSnapshot(vmname string, sn *VBoxSnapshot) error { + if vmname == "" { + panic("Argument empty exception: vmname") + } + if nil == sn { + panic("Argument null exception: sn") + } + log.Printf("Executing DeleteSnapshot: VM: %s, SnapshotName %s", vmname, sn.UUID) + return d.VBoxManage("snapshot", vmname, "delete", sn.UUID) +} diff --git a/builder/virtualbox/common/driver_mock.go b/builder/virtualbox/common/driver_mock.go index d69a06650..68d57fa64 100644 --- a/builder/virtualbox/common/driver_mock.go +++ b/builder/virtualbox/common/driver_mock.go @@ -45,6 +45,17 @@ type DriverMock struct { VersionCalled bool VersionResult string VersionErr error + + LoadSnapshotsCalled []string + LoadSnapshotsResult *VBoxSnapshot + CreateSnapshotCalled []string + CreateSnapshotError error + HasSnapshotsCalled []string + HasSnapshotsResult bool + GetCurrentSnapshotCalled []string + GetCurrentSnapshotResult *VBoxSnapshot + SetSnapshotCalled []*VBoxSnapshot + DeleteSnapshotCalled []*VBoxSnapshot } func (d *DriverMock) CreateSATAController(vm string, controller string, portcount int) error { @@ -114,3 +125,65 @@ func (d *DriverMock) Version() (string, error) { d.VersionCalled = true return d.VersionResult, d.VersionErr } + +func (d *DriverMock) LoadSnapshots(vmName string) (*VBoxSnapshot, error) { + if vmName == "" { + panic("Argument empty exception: vmName") + } + + d.LoadSnapshotsCalled = append(d.LoadSnapshotsCalled, vmName) + return d.LoadSnapshotsResult, nil +} + +func (d *DriverMock) CreateSnapshot(vmName string, snapshotName string) error { + if vmName == "" { + panic("Argument empty exception: vmName") + } + if snapshotName == "" { + panic("Argument empty exception: snapshotName") + } + + d.CreateSnapshotCalled = append(d.CreateSnapshotCalled, snapshotName) + return d.CreateSnapshotError +} + +func (d *DriverMock) HasSnapshots(vmName string) (bool, error) { + if vmName == "" { + panic("Argument empty exception: vmName") + } + + d.HasSnapshotsCalled = append(d.HasSnapshotsCalled, vmName) + return d.HasSnapshotsResult, nil +} + +func (d *DriverMock) GetCurrentSnapshot(vmName string) (*VBoxSnapshot, error) { + if vmName == "" { + panic("Argument empty exception: vmName") + } + + d.GetCurrentSnapshotCalled = append(d.GetCurrentSnapshotCalled, vmName) + return d.GetCurrentSnapshotResult, nil +} + +func (d *DriverMock) SetSnapshot(vmName string, snapshot *VBoxSnapshot) error { + if vmName == "" { + panic("Argument empty exception: vmName") + } + if snapshot == nil { + panic("Argument empty exception: snapshot") + } + + d.SetSnapshotCalled = append(d.SetSnapshotCalled, snapshot) + return nil +} + +func (d *DriverMock) DeleteSnapshot(vmName string, snapshot *VBoxSnapshot) error { + if vmName == "" { + panic("Argument empty exception: vmName") + } + if snapshot == nil { + panic("Argument empty exception: snapshot") + } + d.DeleteSnapshotCalled = append(d.DeleteSnapshotCalled, snapshot) + return nil +} diff --git a/builder/virtualbox/common/snapshot.go b/builder/virtualbox/common/snapshot.go new file mode 100644 index 000000000..e68540182 --- /dev/null +++ b/builder/virtualbox/common/snapshot.go @@ -0,0 +1,199 @@ +package common + +import ( + "bufio" + "log" + "regexp" + "strings" + + "github.com/golang-collections/collections/stack" +) + +// VBoxSnapshot stores the hierarchy of snapshots for a VM instance +type VBoxSnapshot struct { + Name string + UUID string + IsCurrent bool + Parent *VBoxSnapshot // nil if topmost (root) snapshot + Children []*VBoxSnapshot +} + +// ParseSnapshotData parses the machinereadable representation of a virtualbox snapshot tree +func ParseSnapshotData(snapshotData string) (*VBoxSnapshot, error) { + scanner := bufio.NewScanner(strings.NewReader(snapshotData)) + SnapshotNamePartsRe := regexp.MustCompile("Snapshot(?PName|UUID)(?P(-[1-9]+)*)=\"(?P[^\"]*)\"") + var currentIndicator string + parentStack := stack.New() + var node *VBoxSnapshot + var rootNode *VBoxSnapshot + + for scanner.Scan() { + txt := scanner.Text() + idx := strings.Index(txt, "=") + if idx > 0 { + if strings.HasPrefix(txt, "Current") { + node.IsCurrent = true + } else { + matches := SnapshotNamePartsRe.FindStringSubmatch(txt) + if matches[1] == "Name" { + if nil == rootNode { + node = new(VBoxSnapshot) + rootNode = node + currentIndicator = matches[2] + } else { + pathLenCur := strings.Count(currentIndicator, "-") + pathLen := strings.Count(matches[2], "-") + if pathLen > pathLenCur { + currentIndicator = matches[2] + parentStack.Push(node) + } else if pathLen < pathLenCur { + currentIndicator = matches[2] + for i := 0; i < pathLenCur-pathLen; i++ { + parentStack.Pop() + } + } + node = new(VBoxSnapshot) + parent := parentStack.Peek().(*VBoxSnapshot) + if nil != parent { + node.Parent = parent + parent.Children = append(parent.Children, node) + } + } + node.Name = matches[4] + } else if matches[1] == "UUID" { + node.UUID = matches[4] + } + } + } else { + log.Printf("Invalid key,value pair [%s]", txt) + } + } + return rootNode, nil +} + +// IsChildOf verifies if the current snaphot is a child of the passed as argument +func (sn *VBoxSnapshot) IsChildOf(candidate *VBoxSnapshot) bool { + if nil == candidate { + panic("Missing parameter value: candidate") + } + node := sn + for nil != node { + if candidate.UUID == node.UUID { + break + } + node = node.Parent + } + return nil != node +} + +// the walker uses a channel to return nodes from a snapshot tree in breadth approach +func walk(sn *VBoxSnapshot, ch chan *VBoxSnapshot) { + if nil == sn { + return + } + if 0 < len(sn.Children) { + for _, child := range sn.Children { + walk(child, ch) + } + } + ch <- sn +} + +func walker(sn *VBoxSnapshot) <-chan *VBoxSnapshot { + if nil == sn { + panic("Argument null exception: sn") + } + + ch := make(chan *VBoxSnapshot) + go func() { + walk(sn, ch) + close(ch) + }() + return ch +} + +// GetRoot returns the top-most (root) snapshot for a given snapshot +func (sn *VBoxSnapshot) GetRoot() *VBoxSnapshot { + if nil == sn { + panic("Argument null exception: sn") + } + + node := sn + for nil != node.Parent { + node = node.Parent + } + return node +} + +// GetSnapshots returns an array of all snapshots defined +func (sn *VBoxSnapshot) GetSnapshots() []*VBoxSnapshot { + var result []*VBoxSnapshot + root := sn.GetRoot() + ch := walker(root) + for { + node, ok := <-ch + if !ok { + break + } + result = append(result, node) + } + return result +} + +// GetSnapshotsByName find all snapshots with a given name +func (sn *VBoxSnapshot) GetSnapshotsByName(name string) []*VBoxSnapshot { + var result []*VBoxSnapshot + root := sn.GetRoot() + ch := walker(root) + for { + node, ok := <-ch + if !ok { + break + } + if strings.EqualFold(node.Name, name) { + result = append(result, node) + } + } + return result +} + +// GetSnapshotByUUID returns a snapshot by it's UUID +func (sn *VBoxSnapshot) GetSnapshotByUUID(uuid string) *VBoxSnapshot { + root := sn.GetRoot() + ch := walker(root) + for { + node, ok := <-ch + if !ok { + break + } + if strings.EqualFold(node.UUID, uuid) { + return node + } + } + return nil +} + +// GetCurrentSnapshot returns the currently attached snapshot +func (sn *VBoxSnapshot) GetCurrentSnapshot() *VBoxSnapshot { + root := sn.GetRoot() + ch := walker(root) + for { + node, ok := <-ch + if !ok { + break + } + if node.IsCurrent { + return node + } + } + return nil +} + +func (sn *VBoxSnapshot) GetChildWithName(name string) *VBoxSnapshot { + for _, child := range sn.Children { + if child.Name == name { + return child + } + } + return nil +} diff --git a/builder/virtualbox/common/snapshot_test.go b/builder/virtualbox/common/snapshot_test.go new file mode 100644 index 000000000..5b3ab78de --- /dev/null +++ b/builder/virtualbox/common/snapshot_test.go @@ -0,0 +1,136 @@ +package common + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func getTestData() string { + return `SnapshotName="Imported" +SnapshotUUID="7e5b4165-91ec-4091-a74c-a5709d584530" +SnapshotName-1="Snapshot 1" +SnapshotUUID-1="5fc461ec-da7a-40a8-a168-03134d7cdf5c" +SnapshotName-1-1="Snapshot 2" +SnapshotUUID-1-1="8e12833b-c6b5-4cbd-b42b-09eff8ffc173" +SnapshotName-1-1-1="Snapshot 3" +SnapshotUUID-1-1-1="eb342b39-b4bd-47b0-afd8-dcd1cc5c5929" +SnapshotName-1-1-2="Snapshot 4" +SnapshotUUID-1-1-2="17df1668-e79a-4ed6-a86b-713913699846" +SnapshotName-1-2="Snapshot-Export" +SnapshotUUID-1-2="c857d1b8-4fd6-4044-9d2c-c6e465b3cdd4" +CurrentSnapshotName="Snapshot-Export" +CurrentSnapshotUUID="c857d1b8-4fd6-4044-9d2c-c6e465b3cdd4" +CurrentSnapshotNode="SnapshotName-1-2" +SnapshotName-2="Snapshot 5" +SnapshotUUID-2="85646c6a-fb86-4112-b15e-cab090670778" +SnapshotName-2-1="Snapshot 2" +SnapshotUUID-2-1="7b093686-2981-4ada-8b0f-4c03ae23cd1a" +SnapshotName-3="Snapshot 7" +SnapshotUUID-3="0d977a1f-c9ef-412c-a08d-7c0707b3b18f" +SnapshotName-3-1="Snapshot 8" +SnapshotUUID-3-1="f4ed75b3-afc1-42d4-9e02-8df6f053d07e" +SnapshotName-3-2="Snapshot 9" +SnapshotUUID-3-2="a5903505-9261-4bd3-9972-bacd0064d667"` +} + +func TestSnapshot_ParseFullTree(t *testing.T) { + rootNode, err := ParseSnapshotData(getTestData()) + assert.NoError(t, err) + assert.NotNil(t, rootNode) + assert.Equal(t, rootNode.Name, "Imported") + assert.Equal(t, rootNode.UUID, "7e5b4165-91ec-4091-a74c-a5709d584530") + assert.Equal(t, 3, len(rootNode.Children)) + assert.Nil(t, rootNode.Parent) +} + +func TestSnapshot_FindCurrent(t *testing.T) { + rootNode, err := ParseSnapshotData(getTestData()) + assert.NoError(t, err) + assert.NotNil(t, rootNode) + + current := rootNode.GetCurrentSnapshot() + assert.NotNil(t, current) + assert.Equal(t, current.UUID, "c857d1b8-4fd6-4044-9d2c-c6e465b3cdd4") + assert.Equal(t, current.Name, "Snapshot-Export") + assert.NotNil(t, current.Parent) + assert.Equal(t, current.Parent.UUID, "5fc461ec-da7a-40a8-a168-03134d7cdf5c") + assert.Equal(t, current.Parent.Name, "Snapshot 1") +} + +func TestSnapshot_FindNodeByUUID(t *testing.T) { + rootNode, err := ParseSnapshotData(getTestData()) + assert.NoError(t, err) + assert.NotNil(t, rootNode) + + node := rootNode.GetSnapshotByUUID("7b093686-2981-4ada-8b0f-4c03ae23cd1a") + assert.NotNil(t, node) + assert.Equal(t, "Snapshot 2", node.Name) + assert.Equal(t, "7b093686-2981-4ada-8b0f-4c03ae23cd1a", node.UUID) + assert.Equal(t, 0, len(node.Children)) + assert.Nil(t, rootNode.Parent) + + otherNode := rootNode.GetSnapshotByUUID("f4ed75b3-afc1-42d4-9e02-8df6f053d07e") + assert.NotNil(t, otherNode) + assert.True(t, otherNode.IsChildOf(rootNode)) + assert.False(t, node.IsChildOf(otherNode)) + assert.False(t, otherNode.IsChildOf(node)) +} + +func TestSnapshot_FindNodesByName(t *testing.T) { + rootNode, err := ParseSnapshotData(getTestData()) + assert.NoError(t, err) + assert.NotNil(t, rootNode) + + nodes := rootNode.GetSnapshotsByName("Snapshot 2") + assert.NotNil(t, nodes) + assert.Equal(t, 2, len(nodes)) +} + +func TestSnapshot_IsChildOf(t *testing.T) { + rootNode, err := ParseSnapshotData(getTestData()) + assert.NoError(t, err) + assert.NotNil(t, rootNode) + + child := rootNode.GetSnapshotByUUID("c857d1b8-4fd6-4044-9d2c-c6e465b3cdd4") + assert.NotNil(t, child) + assert.True(t, child.IsChildOf(rootNode)) + assert.True(t, child.IsChildOf(child.Parent)) + assert.PanicsWithValue(t, "Missing parameter value: candidate", func() { child.IsChildOf(nil) }) +} + +func TestSnapshot_SingleSnapshot(t *testing.T) { + snapData := `SnapshotName="Imported" + SnapshotUUID="7e5b4165-91ec-4091-a74c-a5709d584530"` + + rootNode, err := ParseSnapshotData(snapData) + assert.NoError(t, err) + assert.NotNil(t, rootNode) + + assert.Equal(t, rootNode.Name, "Imported") + assert.Equal(t, rootNode.UUID, "7e5b4165-91ec-4091-a74c-a5709d584530") + assert.Equal(t, len(rootNode.Children), 0) + assert.Nil(t, rootNode.Parent) +} + +func TestSnapshot_EmptySnapshotData(t *testing.T) { + snapData := `` + + rootNode, err := ParseSnapshotData(snapData) + assert.NoError(t, err) + assert.Nil(t, rootNode) +} + +func TestSnapshot_EnsureParents(t *testing.T) { + rootNode, err := ParseSnapshotData(getTestData()) + assert.NoError(t, err) + assert.NotNil(t, rootNode) + + for _, snapshot := range rootNode.GetSnapshots() { + if snapshot == rootNode { + assert.Nil(t, snapshot.Parent) + } else { + assert.NotNil(t, snapshot.Parent) + } + } +} diff --git a/builder/virtualbox/common/step_download_guest_additions.go b/builder/virtualbox/common/step_download_guest_additions.go index 2ffc15b2c..77c7b733d 100644 --- a/builder/virtualbox/common/step_download_guest_additions.go +++ b/builder/virtualbox/common/step_download_guest_additions.go @@ -158,7 +158,6 @@ func (s *StepDownloadGuestAdditions) downloadAdditionsSHA256(ctx context.Context downStep := &common.StepDownload{ Description: "Guest additions checksums", ResultKey: "guest_additions_checksums_path", - TargetPath: checksumsFile.Name(), Url: []string{checksumsUrl}, } diff --git a/builder/virtualbox/common/step_forward_ssh.go b/builder/virtualbox/common/step_forward_ssh.go index 345b9c55f..ecb0947e0 100644 --- a/builder/virtualbox/common/step_forward_ssh.go +++ b/builder/virtualbox/common/step_forward_ssh.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "strings" "github.com/hashicorp/packer/common/net" "github.com/hashicorp/packer/helper/communicator" @@ -69,11 +70,29 @@ func (s *StepForwardSSH) Run(ctx context.Context, state multistep.StateBag) mult "--natpf1", fmt.Sprintf("packercomm,tcp,127.0.0.1,%d,,%d", sshHostPort, guestPort), } + retried := false + retry: if err := driver.VBoxManage(command...); err != nil { - err := fmt.Errorf("Error creating port forwarding rule: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt + if !strings.Contains(err.Error(), "A NAT rule of this name already exists") || retried { + err := fmt.Errorf("Error creating port forwarding rule: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } else { + log.Printf("A packer NAT rule already exists. Trying to delete ...") + delcommand := []string{ + "modifyvm", vmName, + "--natpf1", + "delete", "packercomm", + } + if err := driver.VBoxManage(delcommand...); err != nil { + err := fmt.Errorf("Error deleting packer NAT forwarding rule: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + goto retry + } } } diff --git a/builder/virtualbox/common/step_shutdown.go b/builder/virtualbox/common/step_shutdown.go index baad0dc82..f28e2deef 100644 --- a/builder/virtualbox/common/step_shutdown.go +++ b/builder/virtualbox/common/step_shutdown.go @@ -45,31 +45,6 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis return multistep.ActionHalt } - // Wait for the machine to actually shut down - log.Printf("Waiting max %s for shutdown to complete", s.Timeout) - shutdownTimer := time.After(s.Timeout) - for { - running, _ := driver.IsRunning(vmName) - if !running { - - if s.Delay.Nanoseconds() > 0 { - log.Printf("Delay for %s after shutdown to allow locks to clear...", s.Delay) - time.Sleep(s.Delay) - } - - break - } - - select { - case <-shutdownTimer: - err := errors.New("Timeout while waiting for machine to shut down.") - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - default: - time.Sleep(500 * time.Millisecond) - } - } } else { ui.Say("Halting the virtual machine...") if err := driver.Stop(vmName); err != nil { @@ -80,6 +55,32 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis } } + // Wait for the machine to actually shut down + log.Printf("Waiting max %s for shutdown to complete", s.Timeout) + shutdownTimer := time.After(s.Timeout) + for { + running, _ := driver.IsRunning(vmName) + if !running { + + if s.Delay.Nanoseconds() > 0 { + log.Printf("Delay for %s after shutdown to allow locks to clear...", s.Delay) + time.Sleep(s.Delay) + } + + break + } + + select { + case <-shutdownTimer: + err := errors.New("Timeout while waiting for machine to shut down.") + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + default: + time.Sleep(500 * time.Millisecond) + } + } + log.Println("VM shut down.") return multistep.ActionContinue } diff --git a/builder/virtualbox/vm/builder.go b/builder/virtualbox/vm/builder.go new file mode 100644 index 000000000..25f825622 --- /dev/null +++ b/builder/virtualbox/vm/builder.go @@ -0,0 +1,178 @@ +package vm + +import ( + "context" + "errors" + "fmt" + + vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +// Builder implements packer.Builder and builds the actual VirtualBox +// images. +type Builder struct { + config *Config + runner multistep.Runner +} + +// Prepare processes the build configuration parameters. +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + c, warnings, errs := NewConfig(raws...) + if errs != nil { + return warnings, errs + } + b.config = c + + return warnings, nil +} + +// Run executes a Packer build and returns a packer.Artifact representing +// a VirtualBox appliance. +func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { + // Create the driver that we'll use to communicate with VirtualBox + driver, err := vboxcommon.NewDriver() + if err != nil { + return nil, fmt.Errorf("Failed creating VirtualBox driver: %s", err) + } + + // Set up the state. + state := new(multistep.BasicStateBag) + state.Put("config", b.config) + state.Put("debug", b.config.PackerDebug) + state.Put("driver", driver) + state.Put("hook", hook) + state.Put("ui", ui) + + // Build the steps. + steps := []multistep.Step{ + new(vboxcommon.StepSuppressMessages), + &common.StepCreateFloppy{ + Files: b.config.FloppyConfig.FloppyFiles, + Directories: b.config.FloppyConfig.FloppyDirectories, + }, + &StepSetSnapshot{ + Name: b.config.VMName, + AttachSnapshot: b.config.AttachSnapshot, + KeepRegistered: b.config.KeepRegistered, + }, + &common.StepHTTPServer{ + HTTPDir: b.config.HTTPDir, + HTTPPortMin: b.config.HTTPPortMin, + HTTPPortMax: b.config.HTTPPortMax, + }, + &vboxcommon.StepDownloadGuestAdditions{ + GuestAdditionsMode: b.config.GuestAdditionsMode, + GuestAdditionsURL: b.config.GuestAdditionsURL, + GuestAdditionsSHA256: b.config.GuestAdditionsSHA256, + Ctx: b.config.ctx, + }, + &StepImport{ + Name: b.config.VMName, + }, + &vboxcommon.StepAttachGuestAdditions{ + GuestAdditionsMode: b.config.GuestAdditionsMode, + }, + &vboxcommon.StepConfigureVRDP{ + VRDPBindAddress: b.config.VRDPBindAddress, + VRDPPortMin: b.config.VRDPPortMin, + VRDPPortMax: b.config.VRDPPortMax, + }, + new(vboxcommon.StepAttachFloppy), + &vboxcommon.StepForwardSSH{ + CommConfig: &b.config.SSHConfig.Comm, + HostPortMin: b.config.SSHHostPortMin, + HostPortMax: b.config.SSHHostPortMax, + SkipNatMapping: b.config.SSHSkipNatMapping, + }, + &vboxcommon.StepVBoxManage{ + Commands: b.config.VBoxManage, + Ctx: b.config.ctx, + }, + &vboxcommon.StepRun{ + Headless: b.config.Headless, + }, + &vboxcommon.StepTypeBootCommand{ + BootWait: b.config.BootWait, + BootCommand: b.config.FlatBootCommand(), + VMName: b.config.VMName, + Ctx: b.config.ctx, + GroupInterval: b.config.BootConfig.BootGroupInterval, + Comm: &b.config.Comm, + }, + &communicator.StepConnect{ + Config: &b.config.SSHConfig.Comm, + Host: vboxcommon.CommHost(b.config.SSHConfig.Comm.SSHHost), + SSHConfig: b.config.SSHConfig.Comm.SSHConfigFunc(), + SSHPort: vboxcommon.SSHPort, + WinRMPort: vboxcommon.SSHPort, + }, + &vboxcommon.StepUploadVersion{ + Path: *b.config.VBoxVersionFile, + }, + &vboxcommon.StepUploadGuestAdditions{ + GuestAdditionsMode: b.config.GuestAdditionsMode, + GuestAdditionsPath: b.config.GuestAdditionsPath, + Ctx: b.config.ctx, + }, + new(common.StepProvision), + &common.StepCleanupTempKeys{ + Comm: &b.config.SSHConfig.Comm, + }, + &vboxcommon.StepShutdown{ + Command: b.config.ShutdownCommand, + Timeout: b.config.ShutdownTimeout, + Delay: b.config.PostShutdownDelay, + }, + &vboxcommon.StepVBoxManage{ + Commands: b.config.VBoxManagePost, + Ctx: b.config.ctx, + }, + &StepCreateSnapshot{ + Name: b.config.VMName, + TargetSnapshot: b.config.TargetSnapshot, + }, + &vboxcommon.StepExport{ + Format: b.config.Format, + OutputDir: b.config.OutputDir, + ExportOpts: b.config.ExportOpts, + SkipNatMapping: b.config.SSHSkipNatMapping, + SkipExport: b.config.SkipExport, + }, + } + + if !b.config.SkipExport { + steps = append(steps, nil) + copy(steps[1:], steps) + steps[0] = &common.StepOutputDir{ + Force: b.config.PackerForce, + Path: b.config.OutputDir, + } + } + // Run the steps. + b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state) + b.runner.Run(ctx, state) + + // Report any errors. + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) + } + + // If we were interrupted or cancelled, then just exit. + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return nil, errors.New("build was cancelled") + } + + if _, ok := state.GetOk(multistep.StateHalted); ok { + return nil, errors.New("build was halted") + } + + if b.config.SkipExport { + return nil, nil + } + + return vboxcommon.NewArtifact(b.config.OutputDir) +} diff --git a/builder/virtualbox/vm/config.go b/builder/virtualbox/vm/config.go new file mode 100644 index 000000000..b244739c7 --- /dev/null +++ b/builder/virtualbox/vm/config.go @@ -0,0 +1,207 @@ +package vm + +import ( + "fmt" + "log" + "strings" + + vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/common/bootcommand" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" +) + +// Config is the configuration structure for the builder. +type Config struct { + common.PackerConfig `mapstructure:",squash"` + common.HTTPConfig `mapstructure:",squash"` + common.FloppyConfig `mapstructure:",squash"` + bootcommand.BootConfig `mapstructure:",squash"` + vboxcommon.ExportConfig `mapstructure:",squash"` + vboxcommon.OutputConfig `mapstructure:",squash"` + vboxcommon.RunConfig `mapstructure:",squash"` + vboxcommon.SSHConfig `mapstructure:",squash"` + vboxcommon.ShutdownConfig `mapstructure:",squash"` + vboxcommon.VBoxManageConfig `mapstructure:",squash"` + vboxcommon.VBoxVersionConfig `mapstructure:",squash"` + + GuestAdditionsMode string `mapstructure:"guest_additions_mode"` + GuestAdditionsPath string `mapstructure:"guest_additions_path"` + GuestAdditionsSHA256 string `mapstructure:"guest_additions_sha256"` + GuestAdditionsURL string `mapstructure:"guest_additions_url"` + VMName string `mapstructure:"vm_name"` + AttachSnapshot string `mapstructure:"attach_snapshot"` + TargetSnapshot string `mapstructure:"target_snapshot"` + DeleteTargetSnapshot bool `mapstructure:"force_delete_snapshot"` + KeepRegistered bool `mapstructure:"keep_registered"` + SkipExport bool `mapstructure:"skip_export"` + + ctx interpolate.Context +} + +func NewConfig(raws ...interface{}) (*Config, []string, error) { + c := new(Config) + err := config.Decode(c, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &c.ctx, + InterpolateFilter: &interpolate.RenderFilter{ + Exclude: []string{ + "boot_command", + "guest_additions_path", + "guest_additions_url", + "vboxmanage", + "vboxmanage_post", + }, + }, + }, raws...) + if err != nil { + return nil, nil, err + } + + // Defaults + if c.GuestAdditionsMode == "" { + c.GuestAdditionsMode = "upload" + } + + if c.GuestAdditionsPath == "" { + c.GuestAdditionsPath = "VBoxGuestAdditions.iso" + } + + if c.RawPostShutdownDelay == "" { + c.RawPostShutdownDelay = "2s" + } + + // Prepare the errors + var errs *packer.MultiError + errs = packer.MultiErrorAppend(errs, c.ExportConfig.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.FloppyConfig.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.HTTPConfig.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.OutputConfig.Prepare(&c.ctx, &c.PackerConfig)...) + errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.SSHConfig.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.VBoxManageConfig.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.VBoxVersionConfig.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.BootConfig.Prepare(&c.ctx)...) + + log.Printf("PostShutdownDelay: %f", c.PostShutdownDelay.Seconds()) + + if c.VMName == "" { + errs = packer.MultiErrorAppend(errs, + fmt.Errorf("vm_name is required")) + } + + validMode := false + validModes := []string{ + vboxcommon.GuestAdditionsModeDisable, + vboxcommon.GuestAdditionsModeAttach, + vboxcommon.GuestAdditionsModeUpload, + } + + for _, mode := range validModes { + if c.GuestAdditionsMode == mode { + validMode = true + break + } + } + + if !validMode { + errs = packer.MultiErrorAppend(errs, + fmt.Errorf("guest_additions_mode is invalid. Must be one of: %v", validModes)) + } + + if c.GuestAdditionsSHA256 != "" { + c.GuestAdditionsSHA256 = strings.ToLower(c.GuestAdditionsSHA256) + } + + // Warnings + var warnings []string + if c.TargetSnapshot == "" && c.SkipExport { + warnings = append(warnings, + "No target snapshot is specified (target_snapshot empty) and no export will be created (skip_export=true).\n"+ + "You might lose all changes applied by this run, the next time you execute packer.") + } + + if c.ShutdownCommand == "" { + warnings = append(warnings, + "A shutdown_command was not specified. Without a shutdown command, Packer\n"+ + "will forcibly halt the virtual machine, which may result in data loss.") + } + + driver, err := vboxcommon.NewDriver() + if err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Failed creating VirtualBox driver: %s", err)) + } else { + if c.AttachSnapshot != "" && c.TargetSnapshot != "" && c.AttachSnapshot == c.TargetSnapshot { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Attach snapshot %s and target snapshot %s cannot be the same", c.AttachSnapshot, c.TargetSnapshot)) + } + snapshotTree, err := driver.LoadSnapshots(c.VMName) + log.Printf("") + if err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Failed to load snapshots for VM %s: %s", c.VMName, err)) + } else { + log.Printf("Snapshots loaded from VM %s", c.VMName) + + var attachSnapshot *vboxcommon.VBoxSnapshot + if nil != snapshotTree { + attachSnapshot = snapshotTree.GetCurrentSnapshot() + log.Printf("VM %s is currently attached to snapshot: %s/%s", c.VMName, attachSnapshot.Name, attachSnapshot.UUID) + } + if c.AttachSnapshot != "" { + log.Printf("Checking configuration attach_snapshot [%s]", c.AttachSnapshot) + if nil == snapshotTree { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("No snapshots defined on VM %s. Unable to attach to %s", c.VMName, c.AttachSnapshot)) + } else { + snapshots := snapshotTree.GetSnapshotsByName(c.AttachSnapshot) + if 0 >= len(snapshots) { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Snapshot %s does not exist on VM %s", c.AttachSnapshot, c.VMName)) + } else if 1 < len(snapshots) { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Multiple Snapshots with name %s exist on VM %s", c.AttachSnapshot, c.VMName)) + } else { + attachSnapshot = snapshots[0] + } + } + } + if c.TargetSnapshot != "" { + log.Printf("Checking configuration target_snapshot [%s]", c.TargetSnapshot) + if nil == snapshotTree { + log.Printf("Currently no snapshots defined in VM %s", c.VMName) + } else { + if c.TargetSnapshot == attachSnapshot.Name { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target snapshot %s cannot be the same as the snapshot to which the builder shall attach: %s", c.TargetSnapshot, attachSnapshot.Name)) + } else { + snapshots := snapshotTree.GetSnapshotsByName(c.TargetSnapshot) + if 0 < len(snapshots) { + if nil == attachSnapshot { + panic("Internal error. Expecting a handle to a VBoxSnapshot") + } + isChild := false + for _, snapshot := range snapshots { + log.Printf("Checking if target snaphot %s/%s is child of %s/%s", snapshot.Name, snapshot.UUID, attachSnapshot.Name, attachSnapshot.UUID) + isChild = nil != snapshot.Parent && snapshot.Parent.UUID == attachSnapshot.UUID + } + if !isChild { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target snapshot %s already exists and is not a direct child of %s", c.TargetSnapshot, attachSnapshot.Name)) + } else if !c.DeleteTargetSnapshot { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target snapshot %s already exists as direct child of %s for VM %s. Use force_delete_snapshot = true to overwrite snapshot", + c.TargetSnapshot, + attachSnapshot.Name, + c.VMName)) + } + } else { + log.Printf("No snapshot with name %s defined in VM %s", c.TargetSnapshot, c.VMName) + } + } + } + } + } + } + // Check for any errors. + if errs != nil && len(errs.Errors) > 0 { + return nil, warnings, errs + } + + return c, warnings, nil +} diff --git a/builder/virtualbox/vm/step_create_snapshot.go b/builder/virtualbox/vm/step_create_snapshot.go new file mode 100644 index 000000000..95c676069 --- /dev/null +++ b/builder/virtualbox/vm/step_create_snapshot.go @@ -0,0 +1,69 @@ +package vm + +import ( + "context" + "fmt" + "log" + + vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type StepCreateSnapshot struct { + Name string + TargetSnapshot string +} + +func (s *StepCreateSnapshot) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + driver := state.Get("driver").(vboxcommon.Driver) + ui := state.Get("ui").(packer.Ui) + if s.TargetSnapshot != "" { + running, err := driver.IsRunning(s.Name) + if err != nil { + err = fmt.Errorf("Failed to test if VM %s is still running: %s", s.Name, err) + } else if running { + err = fmt.Errorf("VM %s is still running. Unable to create snapshot %s", s.Name, s.TargetSnapshot) + } + if err != nil { + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + ui.Say(fmt.Sprintf("Creating snapshot %s on virtual machine %s", s.TargetSnapshot, s.Name)) + snapshotTree, err := driver.LoadSnapshots(s.Name) + if err != nil { + err = fmt.Errorf("Failed to load snapshots for VM %s: %s", s.Name, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + currentSnapshot := snapshotTree.GetCurrentSnapshot() + targetSnapshot := currentSnapshot.GetChildWithName(s.TargetSnapshot) + if nil != targetSnapshot { + log.Printf("Deleting existing target snapshot %s", s.TargetSnapshot) + err = driver.DeleteSnapshot(s.Name, targetSnapshot) + if nil != err { + err = fmt.Errorf("Unable to delete snapshot %s from VM %s: %s", s.TargetSnapshot, s.Name, err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + err = driver.CreateSnapshot(s.Name, s.TargetSnapshot) + if err != nil { + err := fmt.Errorf("Error creating snaphot VM: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } else { + ui.Say("No target snapshot defined...") + } + + return multistep.ActionContinue +} + +func (s *StepCreateSnapshot) Cleanup(state multistep.StateBag) {} diff --git a/builder/virtualbox/vm/step_import.go b/builder/virtualbox/vm/step_import.go new file mode 100644 index 000000000..3e0a11fe4 --- /dev/null +++ b/builder/virtualbox/vm/step_import.go @@ -0,0 +1,20 @@ +package vm + +import ( + "context" + + "github.com/hashicorp/packer/helper/multistep" +) + +// This step imports an OVF VM into VirtualBox. +type StepImport struct { + Name string +} + +func (s *StepImport) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + state.Put("vmName", s.Name) + return multistep.ActionContinue +} + +func (s *StepImport) Cleanup(state multistep.StateBag) { +} diff --git a/builder/virtualbox/vm/step_set_snapshot.go b/builder/virtualbox/vm/step_set_snapshot.go new file mode 100644 index 000000000..515d9b2a0 --- /dev/null +++ b/builder/virtualbox/vm/step_set_snapshot.go @@ -0,0 +1,90 @@ +package vm + +import ( + "context" + "fmt" + + vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +type StepSetSnapshot struct { + Name string + AttachSnapshot string + KeepRegistered bool + revertToSnapshot string +} + +func (s *StepSetSnapshot) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + driver := state.Get("driver").(vboxcommon.Driver) + ui := state.Get("ui").(packer.Ui) + snapshotTree, err := driver.LoadSnapshots(s.Name) + if err != nil { + err := fmt.Errorf("Error loading snapshots for VM: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + if s.AttachSnapshot != "" { + if nil == snapshotTree { + err := fmt.Errorf("Unable to attach snapshot on VM %s when no snapshots exist", s.Name) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + currentSnapshot := snapshotTree.GetCurrentSnapshot() + s.revertToSnapshot = currentSnapshot.UUID + ui.Say(fmt.Sprintf("Attaching snapshot %s on virtual machine %s", s.AttachSnapshot, s.Name)) + candidateSnapshots := snapshotTree.GetSnapshotsByName(s.AttachSnapshot) + if 0 >= len(candidateSnapshots) { + err := fmt.Errorf("Snapshot %s not found on VM %s", s.AttachSnapshot, s.Name) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } else if 1 > len(candidateSnapshots) { + err := fmt.Errorf("More than one Snapshot %s found on VM %s", s.AttachSnapshot, s.Name) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } else { + err = driver.SetSnapshot(s.Name, candidateSnapshots[0]) + if err != nil { + err := fmt.Errorf("Unable to set snapshot for VM: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + } + return multistep.ActionContinue +} + +func (s *StepSetSnapshot) Cleanup(state multistep.StateBag) { + driver := state.Get("driver").(vboxcommon.Driver) + if s.revertToSnapshot != "" { + ui := state.Get("ui").(packer.Ui) + if s.KeepRegistered { + ui.Say("Keeping virtual machine state (keep_registered = true)") + return + } else { + ui.Say(fmt.Sprintf("Reverting to snapshot %s on virtual machine %s", s.revertToSnapshot, s.Name)) + snapshotTree, err := driver.LoadSnapshots(s.Name) + revertTo := snapshotTree.GetSnapshotByUUID(s.revertToSnapshot) + if nil == revertTo { + err := fmt.Errorf("Snapshot with UUID %s not found for VM %s", s.revertToSnapshot, s.Name) + state.Put("error", err) + ui.Error(err.Error()) + return + } + err = driver.SetSnapshot(s.Name, revertTo) + if err != nil { + err := fmt.Errorf("Unable to set snapshot for VM: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return + } + } + } +} diff --git a/builder/vmware/common/driver_parser.go b/builder/vmware/common/driver_parser.go index fc54b8221..b464ffbc1 100644 --- a/builder/vmware/common/driver_parser.go +++ b/builder/vmware/common/driver_parser.go @@ -2,7 +2,6 @@ package common import ( "fmt" - "io" "log" "math" "net" @@ -1962,7 +1961,9 @@ func consumeFile(fd *os.File) (chan byte, sentinelSignaller) { b := make([]byte, 1) for { _, err := fd.Read(b) - if err == io.EOF { + if err != nil { + // In case of any error we must stop + // ErrClosed may appear since file is closed and this goroutine still left running break } fromfile <- b[0] diff --git a/builder/yandex/builder.go b/builder/yandex/builder.go index 38ea7524d..5020fec2b 100644 --- a/builder/yandex/builder.go +++ b/builder/yandex/builder.go @@ -61,7 +61,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack &stepInstanceInfo{}, &communicator.StepConnect{ Config: &b.config.Communicator, - Host: commHost, + Host: communicator.CommHost(b.config.Communicator.SSHHost, "instance_ip"), SSHConfig: b.config.Communicator.SSHConfigFunc(), }, &common.StepProvision{}, diff --git a/builder/yandex/ssh.go b/builder/yandex/ssh.go deleted file mode 100644 index c32f16b53..000000000 --- a/builder/yandex/ssh.go +++ /dev/null @@ -1,10 +0,0 @@ -package yandex - -import ( - "github.com/hashicorp/packer/helper/multistep" -) - -func commHost(state multistep.StateBag) (string, error) { - ipAddress := state.Get("instance_ip").(string) - return ipAddress, nil -} diff --git a/command/build.go b/command/build.go index 65d19bd23..7f582d38a 100644 --- a/command/build.go +++ b/command/build.go @@ -156,12 +156,12 @@ func (c *BuildCommand) RunContext(buildCtx context.Context, args []string) int { // Add a newline between the color output and the actual output c.Ui.Say("") } - // Now add timestamps if requested - if cfg.Timestamp { - ui = &packer.TimestampedUi{ - Ui: ui, - } - } + } + } + // Now add timestamps if requested + if cfg.Timestamp { + ui = &packer.TimestampedUi{ + Ui: ui, } } @@ -241,9 +241,11 @@ func (c *BuildCommand) RunContext(buildCtx context.Context, args []string) int { errors.Unlock() } else { ui.Say(fmt.Sprintf("Build '%s' finished.", name)) - artifacts.Lock() - artifacts.m[name] = runArtifacts - artifacts.Unlock() + if nil != runArtifacts { + artifacts.Lock() + artifacts.m[name] = runArtifacts + artifacts.Unlock() + } } }() diff --git a/command/console.go b/command/console.go index da2faf52b..88862248e 100644 --- a/command/console.go +++ b/command/console.go @@ -99,7 +99,7 @@ Options: } func (*ConsoleCommand) Synopsis() string { - return "check that a template is valid" + return "creates a console for testing variable interpolation" } func (*ConsoleCommand) AutocompleteArgs() complete.Predictor { diff --git a/command/fix.go b/command/fix.go index 227edc403..8b33fa895 100644 --- a/command/fix.go +++ b/command/fix.go @@ -120,46 +120,16 @@ Usage: packer fix [options] TEMPLATE If the template cannot be fixed due to an error, the command will exit with a non-zero exit status. Error messages will appear on standard error. -Fixes that are run: +Fixes that are run (in order): - iso-md5 Replaces "iso_md5" in builders with newer - "iso_checksum" - createtime Replaces ".CreateTime" in builder configs with - "{{timestamp}}" - virtualbox-gaattach Updates VirtualBox builders using - "guest_additions_attach" to use - "guest_additions_mode" - pp-vagrant-override Replaces old-style provider overrides for the - Vagrant post-processor to new-style as of Packer - 0.5.0. - virtualbox-rename Updates "virtualbox" builders to "virtualbox-iso" - vmware-rename Updates "vmware" builders to "vmware-iso" - parallels-headless Removes unused "headless" setting from Parallels - builders - parallels-deprecations Removes deprecated "parallels_tools_host_path" from - Parallels builders - sshkeypath Updates builders using "ssh_key_path" to use - "ssh_private_key_file" - sshdisableagent Updates builders using "ssh_disable_agent" to use - "ssh_disable_agent_forwarding" - manifest-filename Updates "manifest" post-processor so any "filename" - field is renamed to "output" - amazon-shutdown_behavior Changes "shutdown_behaviour" to "shutdown_behavior" - in Amazon builders - amazon-enhanced-networking Replaces "enhanced_networking" in builders with - "ena_support" - amazon-private-ip Replaces "ssh_private_ip": true in amazon builders - with "ssh_interface": "private_ip" - docker-email Removes "login_email" from the Docker builder - powershell-escapes Removes PowerShell escapes from user env vars and - elevated username and password strings - hyperv-deprecations Removes the deprecated "vhd_temp_path" setting from - Hyper-V ISO builder templates - hyperv-vmxc-typo Corrects a typo in the "clone_from_vmxc_path" - setting. Replaces with "clone_from_vmcx_path". - vmware-compaction Adds "skip_compaction = true" to "vmware-iso" - builders with incompatible disk_type_id +` + for _, name := range fix.FixerOrder { + helpText += fmt.Sprintf( + " %-27s%s\n", name, fix.Fixers[name].Synopsis()) + } + + helpText += ` Options: -validate=true If true (default), validates the fixed template. diff --git a/command/plugin.go b/command/plugin.go index 088c4af70..81dcc4ec1 100644 --- a/command/plugin.go +++ b/command/plugin.go @@ -29,6 +29,7 @@ import ( hyperonebuilder "github.com/hashicorp/packer/builder/hyperone" hypervisobuilder "github.com/hashicorp/packer/builder/hyperv/iso" hypervvmcxbuilder "github.com/hashicorp/packer/builder/hyperv/vmcx" + jdcloudbuilder "github.com/hashicorp/packer/builder/jdcloud" linodebuilder "github.com/hashicorp/packer/builder/linode" lxcbuilder "github.com/hashicorp/packer/builder/lxc" lxdbuilder "github.com/hashicorp/packer/builder/lxd" @@ -38,6 +39,10 @@ import ( openstackbuilder "github.com/hashicorp/packer/builder/openstack" oracleclassicbuilder "github.com/hashicorp/packer/builder/oracle/classic" oracleocibuilder "github.com/hashicorp/packer/builder/oracle/oci" + oscbsubuilder "github.com/hashicorp/packer/builder/osc/bsu" + oscbsusurrogatebuilder "github.com/hashicorp/packer/builder/osc/bsusurrogate" + oscbsuvolumebuilder "github.com/hashicorp/packer/builder/osc/bsuvolume" + oscchrootbuilder "github.com/hashicorp/packer/builder/osc/chroot" parallelsisobuilder "github.com/hashicorp/packer/builder/parallels/iso" parallelspvmbuilder "github.com/hashicorp/packer/builder/parallels/pvm" profitbricksbuilder "github.com/hashicorp/packer/builder/profitbricks" @@ -46,9 +51,11 @@ import ( scalewaybuilder "github.com/hashicorp/packer/builder/scaleway" tencentcloudcvmbuilder "github.com/hashicorp/packer/builder/tencentcloud/cvm" tritonbuilder "github.com/hashicorp/packer/builder/triton" + uclouduhostbuilder "github.com/hashicorp/packer/builder/ucloud/uhost" vagrantbuilder "github.com/hashicorp/packer/builder/vagrant" virtualboxisobuilder "github.com/hashicorp/packer/builder/virtualbox/iso" virtualboxovfbuilder "github.com/hashicorp/packer/builder/virtualbox/ovf" + virtualboxvmbuilder "github.com/hashicorp/packer/builder/virtualbox/vm" vmwareisobuilder "github.com/hashicorp/packer/builder/vmware/iso" vmwarevmxbuilder "github.com/hashicorp/packer/builder/vmware/vmx" yandexbuilder "github.com/hashicorp/packer/builder/yandex" @@ -62,6 +69,7 @@ import ( dockerpushpostprocessor "github.com/hashicorp/packer/post-processor/docker-push" dockersavepostprocessor "github.com/hashicorp/packer/post-processor/docker-save" dockertagpostprocessor "github.com/hashicorp/packer/post-processor/docker-tag" + exoscaleimportpostprocessor "github.com/hashicorp/packer/post-processor/exoscale-import" googlecomputeexportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-export" googlecomputeimportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-import" manifestpostprocessor "github.com/hashicorp/packer/post-processor/manifest" @@ -110,6 +118,7 @@ var Builders = map[string]packer.Builder{ "hyperone": new(hyperonebuilder.Builder), "hyperv-iso": new(hypervisobuilder.Builder), "hyperv-vmcx": new(hypervvmcxbuilder.Builder), + "jdcloud": new(jdcloudbuilder.Builder), "linode": new(linodebuilder.Builder), "lxc": new(lxcbuilder.Builder), "lxd": new(lxdbuilder.Builder), @@ -119,6 +128,10 @@ var Builders = map[string]packer.Builder{ "openstack": new(openstackbuilder.Builder), "oracle-classic": new(oracleclassicbuilder.Builder), "oracle-oci": new(oracleocibuilder.Builder), + "osc-bsu": new(oscbsubuilder.Builder), + "osc-bsusurrogate": new(oscbsusurrogatebuilder.Builder), + "osc-bsuvolume": new(oscbsuvolumebuilder.Builder), + "osc-chroot": new(oscchrootbuilder.Builder), "parallels-iso": new(parallelsisobuilder.Builder), "parallels-pvm": new(parallelspvmbuilder.Builder), "profitbricks": new(profitbricksbuilder.Builder), @@ -127,9 +140,11 @@ var Builders = map[string]packer.Builder{ "scaleway": new(scalewaybuilder.Builder), "tencentcloud-cvm": new(tencentcloudcvmbuilder.Builder), "triton": new(tritonbuilder.Builder), + "ucloud-uhost": new(uclouduhostbuilder.Builder), "vagrant": new(vagrantbuilder.Builder), "virtualbox-iso": new(virtualboxisobuilder.Builder), "virtualbox-ovf": new(virtualboxovfbuilder.Builder), + "virtualbox-vm": new(virtualboxvmbuilder.Builder), "vmware-iso": new(vmwareisobuilder.Builder), "vmware-vmx": new(vmwarevmxbuilder.Builder), "yandex": new(yandexbuilder.Builder), @@ -166,6 +181,7 @@ var PostProcessors = map[string]packer.PostProcessor{ "docker-push": new(dockerpushpostprocessor.PostProcessor), "docker-save": new(dockersavepostprocessor.PostProcessor), "docker-tag": new(dockertagpostprocessor.PostProcessor), + "exoscale-import": new(exoscaleimportpostprocessor.PostProcessor), "googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor), "googlecompute-import": new(googlecomputeimportpostprocessor.PostProcessor), "manifest": new(manifestpostprocessor.PostProcessor), diff --git a/common/bootcommand/boot_command.go b/common/bootcommand/boot_command.go index 1447a4337..b16864e42 100644 --- a/common/bootcommand/boot_command.go +++ b/common/bootcommand/boot_command.go @@ -13,6 +13,7 @@ import ( "sort" "strconv" "strings" + "sync" "time" "unicode" "unicode/utf8" @@ -981,7 +982,7 @@ type position struct { } func (p position) String() string { - return fmt.Sprintf("%d:%d [%d]", p.line, p.col, p.offset) + return strconv.Itoa(p.line) + ":" + strconv.Itoa(p.col) + " [" + strconv.Itoa(p.offset) + "]" } // savepoint stores all state required to go back to this point in the @@ -1445,13 +1446,24 @@ type Cloner interface { Clone() interface{} } +var statePool = &sync.Pool{ + New: func() interface{} { return make(storeDict) }, +} + +func (sd storeDict) Discard() { + for k := range sd { + delete(sd, k) + } + statePool.Put(sd) +} + // clone and return parser current state. func (p *parser) cloneState() storeDict { if p.debug { defer p.out(p.in("cloneState")) } - state := make(storeDict, len(p.cur.state)) + state := statePool.Get().(storeDict) for k, v := range p.cur.state { if c, ok := v.(Cloner); ok { state[k] = c.Clone() @@ -1468,6 +1480,7 @@ func (p *parser) restoreState(state storeDict) { if p.debug { defer p.out(p.in("restoreState")) } + p.cur.state.Discard() p.cur.state = state } @@ -1580,7 +1593,7 @@ func listJoin(list []string, sep string, lastSep string) string { case 1: return list[0] default: - return fmt.Sprintf("%s %s %s", strings.Join(list[:len(list)-1], sep), lastSep, list[len(list)-1]) + return strings.Join(list[:len(list)-1], sep) + " " + lastSep + " " + list[len(list)-1] } } @@ -1880,7 +1893,7 @@ func (p *parser) parseLitMatcher(lit *litMatcher) (interface{}, bool) { if lit.ignoreCase { ignoreCase = "i" } - val := fmt.Sprintf("%q%s", lit.val, ignoreCase) + val := string(strconv.AppendQuote([]byte{}, lit.val)) + ignoreCase // wrap 'lit.val' with double quotes start := p.pt for _, want := range lit.val { cur := p.pt.rn diff --git a/common/iso_config.go b/common/iso_config.go index 4a0092d80..3c878e128 100644 --- a/common/iso_config.go +++ b/common/iso_config.go @@ -3,10 +3,15 @@ package common import ( + "encoding/hex" "errors" "fmt" + "log" + "net/url" + "os" "strings" + getter "github.com/hashicorp/go-getter" "github.com/hashicorp/packer/template/interpolate" ) @@ -137,18 +142,47 @@ func (c *ISOConfig) Prepare(ctx *interpolate.Context) (warnings []string, errs [ } if c.ISOChecksumURL != "" { - if strings.HasSuffix(strings.ToLower(c.ISOChecksumURL), ".iso") { - errs = append(errs, fmt.Errorf("Error parsing checksum:"+ - " .iso is not a valid checksum extension")) + if c.ISOChecksum != "" { + warnings = append(warnings, "You have provided both an "+ + "iso_checksum and an iso_checksum_url. Discarding the "+ + "iso_checksum_url and using the checksum.") + } else { + if strings.HasSuffix(strings.ToLower(c.ISOChecksumURL), ".iso") { + errs = append(errs, fmt.Errorf("Error parsing checksum:"+ + " .iso is not a valid checksum extension")) + } + // go-getter auto-parses checksum files + c.ISOChecksumType = "file" + c.ISOChecksum = c.ISOChecksumURL } - // go-getter auto-parses checksum files - c.ISOChecksumType = "file" - c.ISOChecksum = c.ISOChecksumURL } if c.ISOChecksum == "" { errs = append(errs, fmt.Errorf("A checksum must be specified")) } + if c.ISOChecksumType == "file" { + u, err := url.Parse(c.ISOUrls[0]) + wd, err := os.Getwd() + if err != nil { + log.Printf("get working directory: %v", err) + // here we ignore the error in case the + // working directory is not needed. + } + gc := getter.Client{ + Dst: "no-op", + Src: u.String(), + Pwd: wd, + Dir: false, + Getters: getter.Getters, + } + cksum, err := gc.ChecksumFromFile(c.ISOChecksumURL, u) + if cksum == nil || err != nil { + errs = append(errs, fmt.Errorf("Couldn't extract checksum from checksum file")) + } else { + c.ISOChecksumType = cksum.Type + c.ISOChecksum = hex.EncodeToString(cksum.Value) + } + } return warnings, errs } diff --git a/common/iso_config_test.go b/common/iso_config_test.go index d8a236899..b04e0933f 100644 --- a/common/iso_config_test.go +++ b/common/iso_config_test.go @@ -75,11 +75,16 @@ func TestISOConfigPrepare_ISOChecksum(t *testing.T) { func TestISOConfigPrepare_ISOChecksumURLBad(t *testing.T) { i := testISOConfig() i.ISOChecksumURL = "file:///not_read" + i.ISOChecksum = "shouldoverride" // Test ISOChecksum overrides url warns, err := i.Prepare(nil) - if len(warns) > 0 && len(err) > 0 { - t.Fatalf("bad: %#v, %#v", warns, err) + if len(warns) != 1 { + t.Fatalf("Bad: should have warned because both checksum and " + + "checksumURL are set.") + } + if len(err) > 0 { + t.Fatalf("Bad; should have warned but not errored.") } // Test that we won't try to read an iso into memory because of a user diff --git a/common/multistep_runner.go b/common/multistep_runner.go index b34ee3a04..b93159fc2 100644 --- a/common/multistep_runner.go +++ b/common/multistep_runner.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "log" - "os" "reflect" "strings" "time" @@ -71,17 +70,9 @@ func (s abortStep) Run(ctx context.Context, state multistep.StateBag) multistep. } func (s abortStep) Cleanup(state multistep.StateBag) { - err, ok := state.GetOk("error") - if ok { - s.ui.Error(fmt.Sprintf("%s", err)) - } - if _, ok := state.GetOk(multistep.StateCancelled); ok { - s.ui.Error("Interrupted, aborting...") - os.Exit(1) - } - if _, ok := state.GetOk(multistep.StateHalted); ok { - s.ui.Error(fmt.Sprintf("Step %q failed, aborting...", typeName(s.step))) - os.Exit(1) + shouldCleanup := handleAbortsAndInterupts(state, s.ui, typeName(s.step)) + if !shouldCleanup { + return } s.step.Cleanup(state) } @@ -112,7 +103,8 @@ func (s askStep) Run(ctx context.Context, state multistep.StateBag) (action mult case askCleanup: return case askAbort: - os.Exit(1) + state.Put("aborted", true) + return case askRetry: continue } @@ -120,6 +112,12 @@ func (s askStep) Run(ctx context.Context, state multistep.StateBag) (action mult } func (s askStep) Cleanup(state multistep.StateBag) { + if _, ok := state.GetOk("aborted"); ok { + shouldCleanup := handleAbortsAndInterupts(state, s.ui, typeName(s.step)) + if !shouldCleanup { + return + } + } s.step.Cleanup(state) } @@ -170,3 +168,33 @@ func askPrompt(ui packer.Ui) askResponse { ui.Say(fmt.Sprintf("Incorrect input: %#v", line)) } } + +func handleAbortsAndInterupts(state multistep.StateBag, ui packer.Ui, stepName string) bool { + // if returns false, don't run cleanup. If true, do run cleanup. + _, alreadyLogged := state.GetOk("abort_step_logged") + + err, ok := state.GetOk("error") + if ok && !alreadyLogged { + ui.Error(fmt.Sprintf("%s", err)) + state.Put("abort_step_logged", true) + } + if _, ok := state.GetOk(multistep.StateCancelled); ok { + if !alreadyLogged { + ui.Error("Interrupted, aborting...") + state.Put("abort_step_logged", true) + } else { + ui.Error(fmt.Sprintf("aborted: skipping cleanup of step %q", stepName)) + } + return false + } + if _, ok := state.GetOk(multistep.StateHalted); ok { + if !alreadyLogged { + ui.Error(fmt.Sprintf("Step %q failed, aborting...", stepName)) + state.Put("abort_step_logged", true) + } else { + ui.Error(fmt.Sprintf("aborted: skipping cleanup of step %q", stepName)) + } + return false + } + return true +} diff --git a/common/powershell/hyperv/hyperv.go b/common/powershell/hyperv/hyperv.go index aa5ee1db3..d6539d328 100644 --- a/common/powershell/hyperv/hyperv.go +++ b/common/powershell/hyperv/hyperv.go @@ -35,7 +35,7 @@ param([string]$switchName, [int]$addressIndex) $HostVMAdapter = Hyper-V\Get-VMNetworkAdapter -ManagementOS -SwitchName $switchName if ($HostVMAdapter){ - $HostNetAdapter = Get-NetAdapter | ?{ $HostVMAdapter.DeviceId.Contains($_.DeviceID) } + $HostNetAdapter = Get-NetAdapter | ?{ $_.DeviceId -eq $HostVMAdapter.DeviceId } if ($HostNetAdapter){ $HostNetAdapterIfIndex = @() $HostNetAdapterIfIndex += $HostNetAdapter.ifIndex diff --git a/common/shell-local/config.go b/common/shell-local/config.go index d9c9408b4..ea9911469 100644 --- a/common/shell-local/config.go +++ b/common/shell-local/config.go @@ -18,7 +18,7 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` // ** DEPRECATED: USE INLINE INSTEAD ** - // ** Only Present for backwards compatibiltiy ** + // ** Only Present for backwards compatibility ** // Command is the command to execute Command string diff --git a/common/step_download.go b/common/step_download.go index af7708e6e..fb84ceb10 100644 --- a/common/step_download.go +++ b/common/step_download.go @@ -7,6 +7,7 @@ import ( "fmt" "log" "os" + "path/filepath" "runtime" "strings" @@ -52,9 +53,9 @@ type StepDownload struct { } func (s *StepDownload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) - defer ui.Say(fmt.Sprintf("leaving retrieve loop for %s", s.Description)) + defer log.Printf("Leaving retrieve loop for %s", s.Description) + ui := state.Get("ui").(packer.Ui) ui.Say(fmt.Sprintf("Retrieving %s", s.Description)) var errs []error @@ -101,10 +102,21 @@ func init() { // can leave the source file where it is & tell us where it is. Copy: true, } + getters["smb"] = &getter.FileGetter{ + Copy: true, + } } } func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string) (string, error) { + if runtime.GOOS == "windows" { + // Check that the user specified a UNC path, and promote it to an smb:// uri. + if strings.HasPrefix(source, "\\\\") && len(source) > 2 && source[2] != '?' { + source = filepath.ToSlash(source[2:]) + source = fmt.Sprintf("smb://%s", source) + } + } + u, err := urlhelper.Parse(source) if err != nil { return "", fmt.Errorf("url parse: %s", err) @@ -159,12 +171,26 @@ func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string // could guess it only in cases it is // necessary. } + src := u.String() + if u.Scheme == "" || strings.ToLower(u.Scheme) == "file" { + // If a local filepath, then we need to preprocess to make sure the + // path doens't have any multiple successive path separators; if it + // does, go-getter will read this as a specialized go-getter-specific + // subdirectory command, which it most likely isn't. + src = filepath.Clean(u.String()) + if _, err := os.Stat(filepath.Clean(u.Path)); err != nil { + // Cleaned path isn't present on system so it must be some other + // scheme. Don't error right away; see if go-getter can figure it + // out. + src = u.String() + } + } ui.Say(fmt.Sprintf("Trying %s", u.String())) gc := getter.Client{ Ctx: ctx, Dst: targetPath, - Src: u.String(), + Src: src, ProgressListener: ui, Pwd: wd, Dir: false, diff --git a/common/step_download_test.go b/common/step_download_test.go index 8a8df9960..6a5a70bd8 100644 --- a/common/step_download_test.go +++ b/common/step_download_test.go @@ -71,6 +71,14 @@ func TestStepDownload_Run(t *testing.T) { toSha1(abs(t, "./test-fixtures/root/another.txt")) + ".lock", }, }, + {"double slashes on a local filesystem passes", + fields{Url: []string{abs(t, "./test-fixtures/root//another.txt")}}, + multistep.ActionContinue, + []string{ + toSha1(abs(t, "./test-fixtures/root//another.txt")), + toSha1(abs(t, "./test-fixtures/root//another.txt")) + ".lock", + }, + }, {"none checksum works, without a checksum", fields{Url: []string{abs(t, "./test-fixtures/root/another.txt")}, ChecksumType: "none"}, multistep.ActionContinue, diff --git a/examples/azure/ubuntu_managed_image_sig.json b/examples/azure/ubuntu_managed_image_sig.json new file mode 100644 index 000000000..4789ad891 --- /dev/null +++ b/examples/azure/ubuntu_managed_image_sig.json @@ -0,0 +1,46 @@ +{ + "variables": { + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}", + "tenant_id": "{{env `ARM_TENANT_ID`}}" + }, + "builders": [{ + "type": "azure-arm", + + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "tenant_id": "{{user `tenant_id`}}", + "subscription_id": "{{user `subscription_id`}}", + + "os_type": "Linux", + "image_publisher": "Canonical", + "image_offer": "UbuntuServer", + "image_sku": "16.04-LTS", + + "location": "West Central US", + "vm_size": "Standard_DS2_v2", + + "managed_image_resource_group_name": "PackerSigRGManagedImageRG", + "managed_image_name": "demo-image-sig-packer", + "shared_image_gallery_destination": { + "resource_group": "PackerSigPublishRG", + "gallery_name": "PackerSigGallery", + "image_name": "PackerSigImageDefinition", + "image_version": "1.0.0", + "replication_regions": ["South Central US"] + } + }], + "provisioners": [{ + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", + "inline": [ + "apt-get update", + "apt-get upgrade -y", + + "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync" + ], + "inline_shebang": "/bin/sh -x", + "type": "shell" + }] +} + diff --git a/examples/azure/windows_custom_image.json b/examples/azure/windows_custom_image.json index 49c1276ee..5a15a6946 100644 --- a/examples/azure/windows_custom_image.json +++ b/examples/azure/windows_custom_image.json @@ -5,7 +5,7 @@ "resource_group": "{{env `ARM_RESOURCE_GROUP`}}", "storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}", "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}", - "object_id": "{{env `ARM_OJBECT_ID`}}" + "object_id": "{{env `ARM_OBJECT_ID`}}" }, "builders": [ { diff --git a/examples/jdcloud/credential-key.json b/examples/jdcloud/credential-key.json new file mode 100644 index 000000000..b2f4da03e --- /dev/null +++ b/examples/jdcloud/credential-key.json @@ -0,0 +1,34 @@ +{ + "builders": [ + { + "type": "jdcloud", + "image_id": "", + "access_key": "", + "secret_key": "", + "region_id": "cn-north-1", + "az": "cn-north-1c", + "instance_name": "created_by_packer", + "instance_type": "g.n2.medium", + + "ssh_private_key_file":"/Path/to/your/.ssh/id_rsa", + "ssh_keypair_name":"packer_keys", + + "image_name": "created_by_packer", + "subnet_id": "", + "communicator":"ssh", + "ssh_username": "root", + "ssh_timeout" : "60s" + } + ], + + "provisioners": [ + { + "type": "shell", + "inline": [ + "sleep 3", + "echo 123", + "pwd" + ] + } + ] +} diff --git a/examples/jdcloud/credential-new-key.json b/examples/jdcloud/credential-new-key.json new file mode 100644 index 000000000..7b7187b61 --- /dev/null +++ b/examples/jdcloud/credential-new-key.json @@ -0,0 +1,31 @@ +{ + "builders": [ + { + "type": "jdcloud", + "image_id": "", + "access_key": "", + "secret_key": "", + "region_id": "cn-north-1", + "az": "cn-north-1c", + "instance_name": "created_by_packer", + "instance_type": "g.n2.medium", + "image_name": "packerImage", + "temporary_key_pair_name": "whatever_new_key_name", + "subnet_id": "", + "communicator":"ssh", + "ssh_username": "root", + "ssh_timeout" : "60s" + } + ], + + "provisioners": [ + { + "type": "shell", + "inline": [ + "sleep 3", + "echo 123", + "pwd" + ] + } + ] +} diff --git a/examples/jdcloud/credential-password.json b/examples/jdcloud/credential-password.json new file mode 100644 index 000000000..5e6aa80db --- /dev/null +++ b/examples/jdcloud/credential-password.json @@ -0,0 +1,32 @@ +{ + "builders": [ + { + "type": "jdcloud", + "image_id": "img-h8ly274zg9", + "access_key": "", + "secret_key": "", + "region_id": "cn-north-1", + "az": "cn-north-1c", + "instance_name": "created_by_packer", + "instance_type": "g.n2.medium", + "ssh_password":"/Users/mac/.ssh/id_rsa", + "ssh_keypair_name":"created_by_xiaohan", + "image_name": "packerImage", + "subnet_id": "subnet-jo6e38sdli", + "communicator":"ssh", + "ssh_username": "root", + "ssh_timeout" : "60s" + } + ], + + "provisioners": [ + { + "type": "shell", + "inline": [ + "sleep 3", + "echo 123", + "pwd" + ] + } + ] +} diff --git a/examples/jdcloud/use_new_subnet.json b/examples/jdcloud/use_new_subnet.json new file mode 100644 index 000000000..a4881ca0a --- /dev/null +++ b/examples/jdcloud/use_new_subnet.json @@ -0,0 +1,34 @@ +{ + "builders": [ + { + "type": "jdcloud", + "image_id": "img-h8ly274zg9", + "access_key": "", + "secret_key": "", + "region_id": "cn-north-1", + "az": "cn-north-1c", + "instance_name": "created_by_packer", + "instance_type": "g.n2.medium", + "ssh_password":"/Users/mac/.ssh/id_rsa", + "ssh_keypair_name":"created_by_xiaohan", + "image_name": "packerImage", + + + + "communicator":"ssh", + "ssh_username": "root", + "ssh_timeout" : "60s" + } + ], + + "provisioners": [ + { + "type": "shell", + "inline": [ + "sleep 3", + "echo 123", + "pwd" + ] + } + ] +} diff --git a/examples/tencentcloud/basic-with-data-disk.json b/examples/tencentcloud/basic-with-data-disk.json new file mode 100644 index 000000000..695a68014 --- /dev/null +++ b/examples/tencentcloud/basic-with-data-disk.json @@ -0,0 +1,34 @@ +{ + "variables": { + "secret_id": "{{env `TENCENTCLOUD_ACCESS_KEY`}}", + "secret_key": "{{env `TENCENTCLOUD_SECRET_KEY`}}" + }, + "builders": [{ + "type": "tencentcloud-cvm", + "secret_id": "{{user `secret_id`}}", + "secret_key": "{{user `secret_key`}}", + "region": "ap-guangzhou", + "zone": "ap-guangzhou-4", + "instance_type": "S4.SMALL1", + "source_image_id": "img-oikl1tzv", + "ssh_username" : "root", + "image_name": "PackerTest", + "disk_type": "CLOUD_PREMIUM", + "packer_debug": true, + "associate_public_ip_address": true, + "run_tags": { + "good": "luck" + }, + "data_disks": [{ + "disk_type": "CLOUD_PREMIUM", + "disk_size": 50 + }] + }], + "provisioners": [{ + "type": "shell", + "inline": [ + "sleep 30", + "yum install redis.x86_64 -y" + ] + }] +} diff --git a/examples/tencentcloud/basic.json b/examples/tencentcloud/basic.json index 62423d9ab..4e90efd36 100644 --- a/examples/tencentcloud/basic.json +++ b/examples/tencentcloud/basic.json @@ -8,13 +8,17 @@ "secret_id": "{{user `secret_id`}}", "secret_key": "{{user `secret_key`}}", "region": "ap-guangzhou", - "zone": "ap-guangzhou-3", - "instance_type": "S3.SMALL1", + "zone": "ap-guangzhou-4", + "instance_type": "S4.SMALL1", "source_image_id": "img-oikl1tzv", "ssh_username" : "root", - "image_name": "packerTest2", + "image_name": "PackerTest", + "disk_type": "CLOUD_PREMIUM", "packer_debug": true, - "associate_public_ip_address": true + "associate_public_ip_address": true, + "run_tags": { + "good": "luck" + } }], "provisioners": [{ "type": "shell", @@ -23,4 +27,4 @@ "yum install redis.x86_64 -y" ] }] -} \ No newline at end of file +} diff --git a/examples/ucloud/basic.json b/examples/ucloud/basic.json new file mode 100644 index 000000000..df1dc32af --- /dev/null +++ b/examples/ucloud/basic.json @@ -0,0 +1,33 @@ +{ + "variables": { + "ucloud_public_key": "{{env `UCLOUD_PUBLIC_KEY`}}", + "ucloud_private_key": "{{env `UCLOUD_PRIVATE_KEY`}}", + "ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}" + }, + + "builders": [{ + "type": "ucloud-uhost", + "public_key": "{{user `ucloud_public_key`}}", + "private_key": "{{user `ucloud_private_key`}}", + "project_id": "{{user `ucloud_project_id`}}", + "region": "cn-bj2", + "availability_zone": "cn-bj2-02", + "instance_type": "n-basic-2", + "source_image_id": "uimage-f1chxn", + "ssh_username":"root", + "image_name": "packer-test-basic-bj", + "image_copy_to_mappings": [{ + "project_id": "{{user `ucloud_project_id`}}", + "region": "cn-sh2", + "description": "test", + "name": "packer-test-basic-sh" + }] + }], + "provisioners": [{ + "type": "shell", + "inline": [ + "yum install -y nginx" + ] + }] +} + diff --git a/examples/ucloud/ubuntu.json b/examples/ucloud/ubuntu.json new file mode 100644 index 000000000..baed4fa15 --- /dev/null +++ b/examples/ucloud/ubuntu.json @@ -0,0 +1,32 @@ +{ + "variables": { + "ucloud_public_key": "{{env `UCLOUD_PUBLIC_KEY`}}", + "ucloud_private_key": "{{env `UCLOUD_PRIVATE_KEY`}}", + "ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}", + "password": "ucloud_2019" + }, + + "builders": [{ + "type": "ucloud-uhost", + "public_key": "{{user `ucloud_public_key`}}", + "private_key": "{{user `ucloud_private_key`}}", + "project_id": "{{user `ucloud_project_id`}}", + "region": "cn-bj2", + "availability_zone": "cn-bj2-02", + "instance_type": "n-basic-2", + "source_image_id": "uimage-irofn4", + "ssh_password": "{{user `password`}}", + "ssh_username": "ubuntu", + "image_name": "packer-test-ubuntu-bj" + }], + + "provisioners": [{ + "type": "shell", + "execute_command": "echo '{{user `password`}}' | sudo -S '{{.Path}}'", + "inline": [ + "sleep 30", + "sudo apt update", + "sudo apt install nginx -y" + ] + }] +} \ No newline at end of file diff --git a/fix/fixer.go b/fix/fixer.go index 4bcbaac2f..bd822a4c2 100644 --- a/fix/fixer.go +++ b/fix/fixer.go @@ -43,6 +43,7 @@ func init() { "hyperv-cpu-and-ram": new(FizerHypervCPUandRAM), "vmware-compaction": new(FixerVMwareCompaction), "clean-image-name": new(FixerCleanImageName), + "spot-price-auto-product": new(FixerAmazonSpotPriceProductDeprecation), } FixerOrder = []string{ @@ -65,7 +66,10 @@ func init() { "docker-email", "powershell-escapes", "vmware-compaction", + "hyperv-deprecations", + "hyperv-vmxc-typo", "hyperv-cpu-and-ram", "clean-image-name", + "spot-price-auto-product", } } diff --git a/fix/fixer_amazon_spot_price_product.go b/fix/fixer_amazon_spot_price_product.go new file mode 100644 index 000000000..2ed961589 --- /dev/null +++ b/fix/fixer_amazon_spot_price_product.go @@ -0,0 +1,60 @@ +package fix + +import ( + "github.com/mitchellh/mapstructure" +) + +// FixerAmazonSpotPriceProductDeprecation removes the deprecated "vhd_temp_path" setting +// from Amazon builder templates +type FixerAmazonSpotPriceProductDeprecation struct{} + +func (FixerAmazonSpotPriceProductDeprecation) Fix(input map[string]interface{}) (map[string]interface{}, error) { + // The type we'll decode into; we only care about builders + type template struct { + Builders []map[string]interface{} + } + + // Decode the input into our structure, if we can + var tpl template + if err := mapstructure.Decode(input, &tpl); err != nil { + return nil, err + } + + for _, builder := range tpl.Builders { + builderTypeRaw, ok := builder["type"] + if !ok { + continue + } + + builderType, ok := builderTypeRaw.(string) + if !ok { + continue + } + + buildersToFix := []string{"amazon-ebs", "amazon-ebssurrogate", + "amazon-ebsvolume", "amazon-instance"} + + matched := false + for _, b := range buildersToFix { + if builderType == b { + matched = true + break + } + } + if !matched { + continue + } + + _, ok = builder["spot_price_auto_product"] + if ok { + delete(builder, "spot_price_auto_product") + } + } + + input["builders"] = tpl.Builders + return input, nil +} + +func (FixerAmazonSpotPriceProductDeprecation) Synopsis() string { + return `Removes the deprecated "spot_price_auto_product" setting from Amazon builder templates` +} diff --git a/fix/fixer_parallels_deprecations.go b/fix/fixer_parallels_deprecations.go index 9aff731ad..9afc22088 100644 --- a/fix/fixer_parallels_deprecations.go +++ b/fix/fixer_parallels_deprecations.go @@ -54,6 +54,5 @@ func (FixerParallelsDeprecations) Fix(input map[string]interface{}) (map[string] } func (FixerParallelsDeprecations) Synopsis() string { - return `Removes deprecated "parallels_tools_host_path" from Parallels builders - and changes "guest_os_distribution" to "guest_os_type".` + return `Removes deprecated "parallels_tools_host_path" from Parallels builders and changes "guest_os_distribution" to "guest_os_type".` } diff --git a/fix/fixer_test.go b/fix/fixer_test.go new file mode 100644 index 000000000..820c6dcf3 --- /dev/null +++ b/fix/fixer_test.go @@ -0,0 +1,29 @@ +package fix + +import ( + "testing" +) + +func TestFix_allFixersEnabled(t *testing.T) { + f := Fixers + o := FixerOrder + + if len(f) != len(o) { + t.Fatalf("Fixers length (%d) does not match FixerOrder length (%d)", len(f), len(o)) + } + + for fixer, _ := range f { + found := false + + for _, orderedFixer := range o { + if orderedFixer == fixer { + found = true + break + } + } + + if !found { + t.Fatalf("Did not find Fixer %s in FixerOrder", fixer) + } + } +} diff --git a/go.mod b/go.mod index 3cc92c7e0..fdc37027c 100644 --- a/go.mod +++ b/go.mod @@ -20,29 +20,35 @@ require ( github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6 // indirect github.com/approvals/go-approval-tests v0.0.0-20160714161514-ad96e53bea43 github.com/armon/go-radix v1.0.0 // indirect - github.com/aws/aws-sdk-go v1.16.24 + github.com/aws/aws-sdk-go v1.22.2 github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3 github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae github.com/cheggaaa/pb v1.0.27 + github.com/chzyer/logex v1.1.10 // indirect github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e + github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect github.com/creack/goselect v0.1.0 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible + github.com/digitalocean/go-libvirt v0.0.0-20190626172931-4d226dd6c437 // indirect + github.com/digitalocean/go-qemu v0.0.0-20181112162955-dd7bb9c771b8 github.com/digitalocean/godo v1.11.1 github.com/dnaeon/go-vcr v1.0.0 // indirect github.com/docker/docker v0.0.0-20180422163414-57142e89befe // indirect github.com/dylanmei/iso8601 v0.1.0 // indirect github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 + github.com/exoscale/egoscale v0.18.1 github.com/fatih/camelcase v1.0.0 github.com/fatih/structtag v1.0.0 github.com/go-ini/ini v1.25.4 github.com/gobwas/glob v0.2.3 // indirect github.com/gocolly/colly v1.2.0 github.com/gofrs/flock v0.7.1 + github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect github.com/google/go-cmp v0.2.0 github.com/google/shlex v0.0.0-20150127133951-6f45313302b9 github.com/google/uuid v1.0.0 - github.com/gophercloud/gophercloud v0.0.0-20180903124057-ea7289ebdf06 + github.com/gophercloud/gophercloud v0.2.0 github.com/gophercloud/utils v0.0.0-20190124192022-a5c25e7a53a6 github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect github.com/gorilla/websocket v0.0.0-20170319172727-a91eba7f9777 // indirect @@ -50,7 +56,7 @@ require ( github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de github.com/hashicorp/go-cleanhttp v0.5.0 - github.com/hashicorp/go-getter v1.2.0 + github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79 github.com/hashicorp/go-retryablehttp v0.5.2 // indirect @@ -61,8 +67,9 @@ require ( github.com/hashicorp/serf v0.8.2 // indirect github.com/hashicorp/vault v1.1.0 github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d - github.com/hetznercloud/hcloud-go v1.12.0 + github.com/hetznercloud/hcloud-go v1.15.1 github.com/hyperonecom/h1-client-go v0.0.0-20190122232013-cf38e8387775 + github.com/jdcloud-api/jdcloud-sdk-go v1.9.1-0.20190605102154-3d81a50ca961 github.com/joyent/triton-go v0.0.0-20180116165742-545edbe0d564 github.com/json-iterator/go v1.1.6 // indirect github.com/jtolds/gls v4.2.1+incompatible // indirect @@ -84,7 +91,6 @@ require ( github.com/mitchellh/go-fs v0.0.0-20180402234041-7b48fa161ea7 github.com/mitchellh/go-homedir v1.0.0 github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed - github.com/mitchellh/gox v1.0.1 // indirect github.com/mitchellh/iochan v1.0.0 github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557 @@ -100,6 +106,7 @@ require ( github.com/onsi/ginkgo v1.7.0 // indirect github.com/onsi/gomega v1.4.3 // indirect github.com/oracle/oci-go-sdk v1.8.0 + github.com/outscale/osc-go v0.0.1 github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a github.com/pierrec/lz4 v2.0.5+incompatible github.com/pkg/errors v0.8.0 @@ -112,12 +119,12 @@ require ( github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect github.com/satori/go.uuid v1.2.0 // indirect github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70 - github.com/sirupsen/logrus v1.2.0 // indirect github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect github.com/stretchr/testify v1.3.0 - github.com/temoto/robotstxt v0.0.0-20180810133444-97ee4a9ee6ea // indirect - github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346 + github.com/temoto/robotstxt v1.1.1 // indirect + github.com/tencentcloud/tencentcloud-sdk-go v3.0.71+incompatible + github.com/ucloud/ucloud-sdk-go v0.8.7 github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1 github.com/ulikunitz/xz v0.5.5 github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311 @@ -135,5 +142,4 @@ require ( gopkg.in/h2non/gock.v1 v1.0.12 // indirect gopkg.in/ini.v1 v1.42.0 // indirect gopkg.in/jarcoal/httpmock.v1 v1.0.0-20181117152235-275e9df93516 // indirect - gopkg.in/yaml.v2 v2.2.2 // indirect ) diff --git a/go.sum b/go.sum index aee27ace5..216265fa7 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,6 @@ github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591 h github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591/go.mod h1:EHGzQGbwozJBj/4qj3WGrTJ0FqjgOTOxLQ0VNWvPn08= github.com/PuerkitoBio/goquery v1.5.0 h1:uGvmFXOA73IKluu/F84Xd1tt/z07GYm8X49XKHP7EJk= github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg= -github.com/Telmate/proxmox-api-go v0.0.0-20190410200643-f08824d5082d h1:igrCnHheXb+lZ1bW9Ths8JZZIjh9D4Vi/49JqiHE+cI= -github.com/Telmate/proxmox-api-go v0.0.0-20190410200643-f08824d5082d/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= github.com/Telmate/proxmox-api-go v0.0.0-20190614181158-26cd147831a4 h1:o//09WenT9BNcQypCYfOBfRe5gtLUvUfTPq0xQqPMEI= github.com/Telmate/proxmox-api-go v0.0.0-20190614181158-26cd147831a4/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af h1:DBNMBMuMiWYu0b+8KMJuWmfCkcxl09JwdlqwDZZ6U14= @@ -57,8 +55,9 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= -github.com/aws/aws-sdk-go v1.16.24 h1:I/A3Hwbgs3IEAP6v1bFpHKXiT7wZDoToX9cb00nxZnM= -github.com/aws/aws-sdk-go v1.16.24/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.16.22/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.22.2 h1:uYP58k2Cd9y1qBy8CxTe5ADmdi4kANm8Ul8ch3kkIcQ= +github.com/aws/aws-sdk-go v1.22.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= 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= @@ -73,8 +72,12 @@ github.com/census-instrumentation/opencensus-proto v0.2.0 h1:LzQXZOgg4CQfE6bFvXG github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cheggaaa/pb v1.0.27 h1:wIkZHkNfC7R6GI5w7l/PdAdzXzlrbcI3p8OAlnkTsnc= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= +github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/creack/goselect v0.1.0 h1:4QiXIhcpSQF50XGaBsFzesjwX/1qOY5bOveQPmN9CXY= @@ -84,6 +87,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/digitalocean/go-libvirt v0.0.0-20190626172931-4d226dd6c437 h1:phR13shVFOIpa1pnLBmewI9p16NEladLPvVylLPeexo= +github.com/digitalocean/go-libvirt v0.0.0-20190626172931-4d226dd6c437/go.mod h1:PRcPVAAma6zcLpFd4GZrjR/MRpood3TamjKI2m/z/Uw= +github.com/digitalocean/go-qemu v0.0.0-20181112162955-dd7bb9c771b8 h1:N7nH2py78LcMqYY3rZjjrsX6N7uCN7sjvaosgpXN9Ow= +github.com/digitalocean/go-qemu v0.0.0-20181112162955-dd7bb9c771b8/go.mod h1:/YnlngP1PARC0SKAZx6kaAEMOp8bNTQGqS+Ka3MctNI= github.com/digitalocean/godo v1.11.1 h1:OsTh37YFKk+g6DnAOrkXJ9oDArTkRx5UTkBJ2EWAO38= github.com/digitalocean/godo v1.11.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= github.com/dnaeon/go-vcr v1.0.0 h1:1QZ+ahihvRvppcJnFvuoHAdnZTf1PqKjO4Ftr1cfQTo= @@ -96,6 +103,8 @@ github.com/dylanmei/iso8601 v0.1.0 h1:812NGQDBcqquTfH5Yeo7lwR0nzx/cKdsmf3qMjPURU github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 h1:0bp6/GrNOrTDtSXe9YYGCwf8jp5Fb/b+4a6MTRm4qzY= github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08/go.mod h1:VBVDFSBXCIW8JaHQpI8lldSKfYaLMzP9oyq6IJ4fhzY= +github.com/exoscale/egoscale v0.18.1 h1:1FNZVk8jHUx0AvWhOZxLEDNlacTU0chMXUUNkm9EZaI= +github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8= github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= @@ -116,7 +125,11 @@ github.com/gocolly/colly v1.2.0 h1:qRz9YAn8FIH0qzgNUw+HT9UN7wm1oF9OBAilwEWpyrI= github.com/gocolly/colly v1.2.0/go.mod h1:Hof5T3ZswNVsOHYmba1u03W65HDWgpV5HifSuueE0EA= github.com/gofrs/flock v0.7.1 h1:DP+LD/t0njgoPBvT5MJLeliUIVQR03hiKR6vezdwHlc= github.com/gofrs/flock v0.7.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= +github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +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 h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= @@ -146,8 +159,8 @@ github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3 h1:siORttZ36U2R/WjiJuDz8znElWBiAlO9rVt+mqJt0Cc= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= -github.com/gophercloud/gophercloud v0.0.0-20180903124057-ea7289ebdf06 h1:m7Rt/8En7PLrM7PQpykdZBPKUdgZWN6MwiA/ChVIoxs= -github.com/gophercloud/gophercloud v0.0.0-20180903124057-ea7289ebdf06/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= +github.com/gophercloud/gophercloud v0.2.0 h1:lD2Bce2xBAMNNcFZ0dObTpXkGLlVIb33RPVUNVpw6ic= +github.com/gophercloud/gophercloud v0.2.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gophercloud/utils v0.0.0-20190124192022-a5c25e7a53a6 h1:Cw/B8Bu7Rryomxf7bjc8zNfIyLgjxsDd91n0eGRWpuo= github.com/gophercloud/utils v0.0.0-20190124192022-a5c25e7a53a6/go.mod h1:wjDF8z83zTeg5eMLml5EBSlAhbF7G8DobyI1YsMuyzw= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -167,8 +180,8 @@ github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de h1:XDCSyth github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de/go.mod h1:xIwEieBHERyEvaeKF/TcHh1Hu+lxPM+n2vT1+g9I4m4= github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-getter v1.2.0 h1:E05bVPilzyh2yXgT6srn7WEkfMZaH+LuX9tDJw/4kaE= -github.com/hashicorp/go-getter v1.2.0/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= +github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e h1:6krcdHPiS+aIP9XKzJzSahfjD7jG7Z+4+opm0z39V1M= +github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= @@ -189,7 +202,6 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.1.0 h1:bPIoEKD27tNdebFGGxxYwcL4nepeY4j1QP23PFRGzg0= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= @@ -209,12 +221,14 @@ github.com/hashicorp/vault v1.1.0 h1:v79NUgO5xCZnXVzUkIqFOXtP8YhpnHAi1fk3eo9cuOE github.com/hashicorp/vault v1.1.0/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hetznercloud/hcloud-go v1.12.0 h1:ugZO8a8ADekqSWi7xWlcs6pxr4QE0tw5VnyjXcL5n28= -github.com/hetznercloud/hcloud-go v1.12.0/go.mod h1:g5pff0YNAZywQaivY/CmhUYFVp7oP0nu3MiODC2W4Hw= +github.com/hetznercloud/hcloud-go v1.15.1 h1:G8Q+xyAqQ5IUY7yq4HKZgkabFa0S/VXJXq3TGCeT8JM= +github.com/hetznercloud/hcloud-go v1.15.1/go.mod h1:8lR3yHBHZWy2uGcUi9Ibt4UOoop2wrVdERJgCtxsF3Q= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hyperonecom/h1-client-go v0.0.0-20190122232013-cf38e8387775 h1:MIteIoIQ5nFoOmwEHPDsqng8d0dtKj3lCnQCwGvtxXc= github.com/hyperonecom/h1-client-go v0.0.0-20190122232013-cf38e8387775/go.mod h1:R9rU87RxxmcD3DkspW9JqGBXiJyg5MA+WNCtJrBtnXs= +github.com/jdcloud-api/jdcloud-sdk-go v1.9.1-0.20190605102154-3d81a50ca961 h1:a2/K4HRhg31A5vafiz5yYiGMjaCxwRpyjJStfVquKds= +github.com/jdcloud-api/jdcloud-sdk-go v1.9.1-0.20190605102154-3d81a50ca961/go.mod h1:UrKjuULIWLjHFlG6aSPunArE5QX57LftMmStAZJBEX8= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= @@ -283,8 +297,6 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed h1:FI2NIv6fpef6BQl2u3IZX/Cj20tfypRF4yd+uaHOMtI= github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaCv4AyBgu5ALFM0+tSuHrBh6v692nyQe3ikrq0= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI= -github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -320,6 +332,8 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/oracle/oci-go-sdk v1.8.0 h1:4SO45bKV0I3/Mn1os3ANDZmV0eSE5z5CLdSUIkxtyzs= github.com/oracle/oci-go-sdk v1.8.0/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= +github.com/outscale/osc-go v0.0.1 h1:hvBtORyu7sWSKW1norGlfIP8C7c2aegI2Vkq75SRPCE= +github.com/outscale/osc-go v0.0.1/go.mod h1:hJLmXzqU/t07qQYh90I0TqZzu9s85Zs6FMrxk3ukiFM= github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a h1:A3QMuteviunoaY/8ex+RKFqwhcZJ/Cf3fCW3IwL2wx4= github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs= @@ -380,8 +394,8 @@ github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1l github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= -github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME= +github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= 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 h1:Ho+uVpkel/udgjbwB5Lktg9BtvJSh2DT0Hi6LPSyI2w= @@ -396,10 +410,12 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/temoto/robotstxt v0.0.0-20180810133444-97ee4a9ee6ea h1:hH8P1IiDpzRU6ZDbDh/RDnVuezi2oOXJpApa06M0zyI= -github.com/temoto/robotstxt v0.0.0-20180810133444-97ee4a9ee6ea/go.mod h1:aOux3gHPCftJ3KHq6Pz/AlDjYJ7Y+yKfm1gU/3B0u04= -github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346 h1:a014AaXz7AISMePv8xKRffUZZkr5z2XmSDf41gRV3+A= -github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= +github.com/temoto/robotstxt v1.1.1 h1:Gh8RCs8ouX3hRSxxK7B1mO5RFByQ4CmJZDwgom++JaA= +github.com/temoto/robotstxt v1.1.1/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo= +github.com/tencentcloud/tencentcloud-sdk-go v3.0.71+incompatible h1:9sIWfe6ZC7xoSlshYWNGicPqomK7N+CsHMa1YFWBCWU= +github.com/tencentcloud/tencentcloud-sdk-go v3.0.71+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= +github.com/ucloud/ucloud-sdk-go v0.8.7 h1:BmXOb5RivI0Uu4oZRpjI6SQ9/y7n/H9wxTGR1txIE8o= +github.com/ucloud/ucloud-sdk-go v0.8.7/go.mod h1:lM6fpI8y6iwACtlbHUav823/uKPdXsNBlnBpRF2fj3c= github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1 h1:U6ufy3mLDgg9RYupntOvAF7xCmNNquyKaYaaVHo1Nnk= github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= @@ -422,6 +438,7 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3 h1:KYQXGkl6vs02hK7pK4eIbw0NpNPedieTSTEiJ//bwGs= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d h1:adrbvkTDn9rGnXg2IJDKozEpXXLZN89pdIA+Syt4/u0= @@ -476,6 +493,7 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/helper/communicator/comm_host.go b/helper/communicator/comm_host.go new file mode 100644 index 000000000..adc49b257 --- /dev/null +++ b/helper/communicator/comm_host.go @@ -0,0 +1,23 @@ +package communicator + +import ( + "fmt" + "log" + + "github.com/hashicorp/packer/helper/multistep" +) + +// Generic commHost function that should work for most cloud builders. +func CommHost(host string, statebagKey string) func(multistep.StateBag) (string, error) { + return func(state multistep.StateBag) (string, error) { + if host != "" { + log.Printf("Using ssh_host value: %s", host) + return host, nil + } + ipAddress, hasIP := state.Get(statebagKey).(string) + if !hasIP { + return "", fmt.Errorf("Failed to retrieve IP address.") + } + return ipAddress, nil + } +} diff --git a/helper/communicator/config.go b/helper/communicator/config.go index 9d7486780..3280d5318 100644 --- a/helper/communicator/config.go +++ b/helper/communicator/config.go @@ -64,8 +64,6 @@ type Config struct { } type SSH struct { - // SSH - // The address to SSH to. This usually is automatically configured by the // builder. SSHHost string `mapstructure:"ssh_host"` @@ -96,19 +94,6 @@ type SSH struct { // The `~` can be used in path and will be expanded to the home directory // of current user. SSHPrivateKeyFile string `mapstructure:"ssh_private_key_file"` - // One of `public_ip`, `private_ip`, `public_dns`, or `private_dns`. If - // set, either the public IP address, private IP address, public DNS name - // or private DNS name will used as the host for SSH. The default behaviour - // if inside a VPC is to use the public IP address if available, otherwise - // the private IP address will be used. If not in a VPC the public DNS name - // will be used. Also works for WinRM. - // - // Where Packer is configured for an outbound proxy but WinRM traffic - // should be direct, `ssh_interface` must be set to `private_dns` and - // `.compute.internal` included in the `NO_PROXY` environment - // variable. - SSHInterface string `mapstructure:"ssh_interface"` - SSHIPVersion string `mapstructure:"ssh_ip_version"` // If `true`, a PTY will be requested for the SSH connection. This defaults // to `false`. SSHPty bool `mapstructure:"ssh_pty"` @@ -168,6 +153,26 @@ type SSH struct { SSHPrivateKey []byte } +type SSHInterface struct { + // One of `public_ip`, `private_ip`, `public_dns`, or `private_dns`. If + // set, either the public IP address, private IP address, public DNS name + // or private DNS name will used as the host for SSH. The default behaviour + // if inside a VPC is to use the public IP address if available, otherwise + // the private IP address will be used. If not in a VPC the public DNS name + // will be used. Also works for WinRM. + // + // Where Packer is configured for an outbound proxy but WinRM traffic + // should be direct, `ssh_interface` must be set to `private_dns` and + // `.compute.internal` included in the `NO_PROXY` environment + // variable. + SSHInterface string `mapstructure:"ssh_interface"` + // The IP version to use for SSH connections, valid values are `4` and `6`. + // Useful on dual stacked instances where the default behavior is to + // connect via whichever IP address is returned first from the OpenStack + // API. + SSHIPVersion string `mapstructure:"ssh_ip_version"` +} + type WinRM struct { // The username to use to connect to WinRM. WinRMUser string `mapstructure:"winrm_username"` diff --git a/helper/communicator/step_connect_ssh.go b/helper/communicator/step_connect_ssh.go index d2d1789fd..28347fe95 100644 --- a/helper/communicator/step_connect_ssh.go +++ b/helper/communicator/step_connect_ssh.go @@ -36,17 +36,17 @@ func (s *StepConnectSSH) Run(ctx context.Context, state multistep.StateBag) mult var comm packer.Communicator var err error - cancel := make(chan struct{}) + subCtx, cancel := context.WithCancel(ctx) waitDone := make(chan bool, 1) go func() { ui.Say("Waiting for SSH to become available...") - comm, err = s.waitForSSH(state, cancel) + comm, err = s.waitForSSH(state, subCtx) + cancel() // just to make 'possible context leak' analysis happy waitDone <- true }() log.Printf("[INFO] Waiting for SSH, up to timeout: %s", s.Config.SSHTimeout) timeout := time.After(s.Config.SSHTimeout) -WaitLoop: for { // Wait for either SSH to become available, a timeout to occur, // or an interrupt to come through. @@ -60,31 +60,28 @@ WaitLoop: ui.Say("Connected to SSH!") state.Put("communicator", comm) - break WaitLoop + return multistep.ActionContinue case <-timeout: err := fmt.Errorf("Timeout waiting for SSH.") state.Put("error", err) ui.Error(err.Error()) - close(cancel) + cancel() + return multistep.ActionHalt + case <-ctx.Done(): + // The step sequence was cancelled, so cancel waiting for SSH + // and just start the halting process. + cancel() + log.Println("[WARN] Interrupt detected, quitting waiting for SSH.") return multistep.ActionHalt case <-time.After(1 * time.Second): - if _, ok := state.GetOk(multistep.StateCancelled); ok { - // The step sequence was cancelled, so cancel waiting for SSH - // and just start the halting process. - close(cancel) - log.Println("[WARN] Interrupt detected, quitting waiting for SSH.") - return multistep.ActionHalt - } } } - - return multistep.ActionContinue } func (s *StepConnectSSH) Cleanup(multistep.StateBag) { } -func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan struct{}) (packer.Communicator, error) { +func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, ctx context.Context) (packer.Communicator, error) { // Determine if we're using a bastion host, and if so, retrieve // that configuration. This configuration doesn't change so we // do this one before entering the retry loop. @@ -123,7 +120,7 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan stru // Don't check for cancel or wait on first iteration if !first { select { - case <-cancel: + case <-ctx.Done(): log.Println("[DEBUG] SSH wait cancelled. Exiting loop.") return nil, errors.New("SSH wait cancelled") case <-time.After(5 * time.Second): diff --git a/helper/communicator/step_connect_winrm.go b/helper/communicator/step_connect_winrm.go index c9a748b0f..f1e30820a 100644 --- a/helper/communicator/step_connect_winrm.go +++ b/helper/communicator/step_connect_winrm.go @@ -33,23 +33,23 @@ type StepConnectWinRM struct { WinRMPort func(multistep.StateBag) (int, error) } -func (s *StepConnectWinRM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { +func (s *StepConnectWinRM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) var comm packer.Communicator var err error - cancel := make(chan struct{}) + subCtx, cancel := context.WithCancel(ctx) waitDone := make(chan bool, 1) go func() { ui.Say("Waiting for WinRM to become available...") - comm, err = s.waitForWinRM(state, cancel) + comm, err = s.waitForWinRM(state, subCtx) + cancel() // just to make 'possible context leak' analysis happy waitDone <- true }() log.Printf("Waiting for WinRM, up to timeout: %s", s.Config.WinRMTimeout) timeout := time.After(s.Config.WinRMTimeout) -WaitLoop: for { // Wait for either WinRM to become available, a timeout to occur, // or an interrupt to come through. @@ -62,39 +62,40 @@ WaitLoop: ui.Say("Connected to WinRM!") state.Put("communicator", comm) - break WaitLoop + return multistep.ActionContinue case <-timeout: err := fmt.Errorf("Timeout waiting for WinRM.") state.Put("error", err) ui.Error(err.Error()) - close(cancel) + cancel() + return multistep.ActionHalt + case <-ctx.Done(): + // The step sequence was cancelled, so cancel waiting for WinRM + // and just start the halting process. + cancel() + log.Println("Interrupt detected, quitting waiting for WinRM.") return multistep.ActionHalt case <-time.After(1 * time.Second): - if _, ok := state.GetOk(multistep.StateCancelled); ok { - // The step sequence was cancelled, so cancel waiting for WinRM - // and just start the halting process. - close(cancel) - log.Println("Interrupt detected, quitting waiting for WinRM.") - return multistep.ActionHalt - } } } - - return multistep.ActionContinue } func (s *StepConnectWinRM) Cleanup(multistep.StateBag) { } -func (s *StepConnectWinRM) waitForWinRM(state multistep.StateBag, cancel <-chan struct{}) (packer.Communicator, error) { - ctx := context.TODO() +func (s *StepConnectWinRM) waitForWinRM(state multistep.StateBag, ctx context.Context) (packer.Communicator, error) { var comm packer.Communicator + first := true for { - select { - case <-cancel: - log.Println("[INFO] WinRM wait cancelled. Exiting loop.") - return nil, errors.New("WinRM wait cancelled") - case <-time.After(5 * time.Second): + // Don't check for cancel or wait on first iteration + if !first { + select { + case <-ctx.Done(): + log.Println("[INFO] WinRM wait cancelled. Exiting loop.") + return nil, errors.New("WinRM wait cancelled") + case <-time.After(5 * time.Second): + } + first = false } host, err := s.Host(state) @@ -157,7 +158,7 @@ func (s *StepConnectWinRM) waitForWinRM(state multistep.StateBag, cancel <-chan cmd.Stdout = &buf cmd.Stdout = io.MultiWriter(cmd.Stdout, &buf2) select { - case <-cancel: + case <-ctx.Done(): log.Println("WinRM wait canceled, exiting loop") return comm, fmt.Errorf("WinRM wait canceled") case <-time.After(retryableSleep): diff --git a/helper/ssh/key_pair.go b/helper/ssh/key_pair.go index fd052dc2e..0ca6b95ec 100644 --- a/helper/ssh/key_pair.go +++ b/helper/ssh/key_pair.go @@ -77,6 +77,7 @@ func KeyPairFromPrivateKey(config FromPrivateKeyConfig) (KeyPair, error) { return KeyPair{}, err } return KeyPair{ + Comment: config.Comment, PrivateKeyPemBlock: config.RawPrivateKeyPemBlock, PublicKeyAuthorizedKeysLine: authorizedKeysLine(publicKey, config.Comment), }, nil @@ -86,6 +87,7 @@ func KeyPairFromPrivateKey(config FromPrivateKeyConfig) (KeyPair, error) { return KeyPair{}, err } return KeyPair{ + Comment: config.Comment, PrivateKeyPemBlock: config.RawPrivateKeyPemBlock, PublicKeyAuthorizedKeysLine: authorizedKeysLine(publicKey, config.Comment), }, nil diff --git a/helper/ssh/key_pair_test.go b/helper/ssh/key_pair_test.go index 3c98c84e8..5ff182467 100644 --- a/helper/ssh/key_pair_test.go +++ b/helper/ssh/key_pair_test.go @@ -237,49 +237,57 @@ func TestKeyPairFromPrivateKey(t *testing.T) { pemRsa1024: { t: Rsa, d: expectedData{ - bits: 1024, + bits: 1024, + comment: uuid.TimeOrderedUUID(), }, }, pemRsa2048: { t: Rsa, d: expectedData{ - bits: 2048, + bits: 2048, + comment: uuid.TimeOrderedUUID(), }, }, pemOpenSshRsa1024: { t: Rsa, d: expectedData{ - bits: 1024, + bits: 1024, + comment: uuid.TimeOrderedUUID(), }, }, pemOpenSshRsa2048: { t: Rsa, d: expectedData{ - bits: 2048, + bits: 2048, + comment: uuid.TimeOrderedUUID(), }, }, pemDsa: { t: Dsa, d: expectedData{ - bits: 1024, + bits: 1024, + comment: uuid.TimeOrderedUUID(), }, }, pemEcdsa384: { t: Ecdsa, d: expectedData{ - bits: 384, + bits: 384, + comment: uuid.TimeOrderedUUID(), }, }, pemEcdsa521: { t: Ecdsa, d: expectedData{ - bits: 521, + bits: 521, + comment: uuid.TimeOrderedUUID(), }, }, pemOpenSshEd25519: { t: Ed25519, d: expectedData{ - bits: 256, + bits: 256, + comment: uuid.TimeOrderedUUID(), }, }, } @@ -287,6 +295,7 @@ func TestKeyPairFromPrivateKey(t *testing.T) { for rawPrivateKey, expected := range m { kp, err := KeyPairFromPrivateKey(FromPrivateKeyConfig{ RawPrivateKeyPemBlock: []byte(rawPrivateKey), + Comment: expected.d.comment, }) if err != nil { t.Fatal(err.Error()) @@ -340,6 +349,11 @@ func verifyEcdsaKeyPair(kp KeyPair, e expectedData) error { return err } + if kp.Comment != e.comment { + return fmt.Errorf("key pair comment should be:\n'%s'\nGot:\n'%s'", + e.comment, kp.Comment) + } + expectedBytes := bytes.TrimSuffix(gossh.MarshalAuthorizedKey(publicKey), []byte("\n")) if len(e.comment) > 0 { expectedBytes = append(expectedBytes, ' ') @@ -374,6 +388,11 @@ func verifyRsaKeyPair(kp KeyPair, e expectedData) error { return err } + if kp.Comment != e.comment { + return fmt.Errorf("key pair comment should be:\n'%s'\nGot:\n'%s'", + e.comment, kp.Comment) + } + expectedBytes := bytes.TrimSuffix(gossh.MarshalAuthorizedKey(publicKey), []byte("\n")) if len(e.comment) > 0 { expectedBytes = append(expectedBytes, ' ') @@ -404,6 +423,11 @@ func verifyDsaKeyPair(kp KeyPair, e fromPrivateExpectedData) error { return err } + if kp.Comment != e.d.comment { + return fmt.Errorf("key pair comment should be:\n'%s'\nGot:\n'%s'", + e.d.comment, kp.Comment) + } + expectedBytes := bytes.TrimSuffix(gossh.MarshalAuthorizedKey(publicKey), []byte("\n")) if len(e.d.comment) > 0 { expectedBytes = append(expectedBytes, ' ') @@ -434,6 +458,11 @@ func verifyEd25519KeyPair(kp KeyPair, e fromPrivateExpectedData) error { return err } + if kp.Comment != e.d.comment { + return fmt.Errorf("key pair comment should be:\n'%s'\nGot:\n'%s'", + e.d.comment, kp.Comment) + } + expectedBytes := bytes.TrimSuffix(gossh.MarshalAuthorizedKey(publicKey), []byte("\n")) if len(e.d.comment) > 0 { expectedBytes = append(expectedBytes, ' ') diff --git a/log.go b/log.go index e5c07c206..1a6722235 100644 --- a/log.go +++ b/log.go @@ -35,6 +35,9 @@ func logOutput() (logOutput io.Writer, err error) { if strings.Contains(scanner.Text(), "ui:") { continue } + if strings.Contains(scanner.Text(), "ui error:") { + continue + } os.Stderr.WriteString(fmt.Sprint(scanner.Text() + "\n")) } }(scanner) diff --git a/packer/config_file.go b/packer/config_file.go index 04275f457..173766afa 100644 --- a/packer/config_file.go +++ b/packer/config_file.go @@ -52,18 +52,31 @@ func homeDir() (string, error) { } func configFile() (string, error) { - dir, err := homeDir() - if err != nil { - return "", err + var dir string + if cd := os.Getenv("PACKER_CONFIG_DIR"); cd != "" { + log.Printf("Detected config directory from env var: %s", cd) + dir = cd + } else { + homedir, err := homeDir() + if err != nil { + return "", err + } + dir = homedir } - return filepath.Join(dir, defaultConfigFile), nil } func configDir() (string, error) { - dir, err := homeDir() - if err != nil { - return "", err + var dir string + if cd := os.Getenv("PACKER_CONFIG_DIR"); cd != "" { + log.Printf("Detected config directory from env var: %s", cd) + dir = cd + } else { + homedir, err := homeDir() + if err != nil { + return "", err + } + dir = homedir } return filepath.Join(dir, defaultConfigDir), nil diff --git a/packer/core.go b/packer/core.go index 507c79b81..c9672eb96 100644 --- a/packer/core.go +++ b/packer/core.go @@ -3,6 +3,7 @@ package packer import ( "fmt" "sort" + "strings" ttmp "text/template" @@ -366,9 +367,13 @@ func (c *Core) init() error { c.variables[k] = renderedV ctx.UserVariables = c.variables case ttmp.ExecError: - shouldRetry = true - failedInterpolation = fmt.Sprintf(`"%s": "%s"`, k, v) - continue + castError := err.(ttmp.ExecError) + if strings.Contains(castError.Error(), interpolate.ErrVariableNotSetString) { + shouldRetry = true + failedInterpolation = fmt.Sprintf(`"%s": "%s"; error: %s`, k, v, err) + } else { + return err + } default: return fmt.Errorf( // unexpected interpolation error: abort the run diff --git a/packer/hook.go b/packer/hook.go index ea77cafd8..67074aa7d 100644 --- a/packer/hook.go +++ b/packer/hook.go @@ -16,7 +16,7 @@ const HookProvision = "packer_provision" // in. In addition to that, the Hook is given access to a UI so that it can // output things to the user. // -// The first context argument controlls cancellation, the context will usually +// The first context argument controls cancellation, the context will usually // be called when Run is still in progress so the mechanism that handles this // must be race-free. Cancel should attempt to cancel the hook in the quickest, // safest way possible. diff --git a/packer/ui.go b/packer/ui.go index 596c17253..d2f7bdca2 100644 --- a/packer/ui.go +++ b/packer/ui.go @@ -335,15 +335,15 @@ func (u *MachineReadableUi) Machine(category string, args ...string) { // Prepare the args for i, v := range args { - args[i] = strings.Replace(v, ",", "%!(PACKER_COMMA)", -1) - args[i] = strings.Replace(args[i], "\r", "\\r", -1) - args[i] = strings.Replace(args[i], "\n", "\\n", -1) // Use LogSecretFilter to scrub out sensitive variables for s := range LogSecretFilter.s { if s != "" { args[i] = strings.Replace(args[i], s, "", -1) } } + args[i] = strings.Replace(v, ",", "%!(PACKER_COMMA)", -1) + args[i] = strings.Replace(args[i], "\r", "\\r", -1) + args[i] = strings.Replace(args[i], "\n", "\\n", -1) } argsString := strings.Join(args, ",") diff --git a/post-processor/exoscale-import/artifact.go b/post-processor/exoscale-import/artifact.go new file mode 100644 index 000000000..cd3f9797b --- /dev/null +++ b/post-processor/exoscale-import/artifact.go @@ -0,0 +1,31 @@ +package exoscaleimport + +const BuilderId = "packer.post-processor.exoscale-import" + +type Artifact struct { + id string +} + +func (a *Artifact) BuilderId() string { + return BuilderId +} + +func (a *Artifact) Id() string { + return a.id +} + +func (a *Artifact) Files() []string { + return nil +} + +func (a *Artifact) String() string { + return a.id +} + +func (a *Artifact) State(name string) interface{} { + return nil +} + +func (a *Artifact) Destroy() error { + return nil +} diff --git a/post-processor/exoscale-import/post-processor.go b/post-processor/exoscale-import/post-processor.go new file mode 100644 index 000000000..b3afee7ac --- /dev/null +++ b/post-processor/exoscale-import/post-processor.go @@ -0,0 +1,265 @@ +package exoscaleimport + +import ( + "context" + "crypto/md5" + "encoding/base64" + "fmt" + "io" + "os" + "path/filepath" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go/service/s3/s3manager" + "github.com/exoscale/egoscale" + "github.com/hashicorp/packer/builder/file" + "github.com/hashicorp/packer/builder/qemu" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/post-processor/artifice" + "github.com/hashicorp/packer/version" +) + +var ( + defaultTemplateZone = "ch-gva-2" + defaultAPIEndpoint = "https://api.exoscale.com/compute" + defaultSOSEndpoint = "https://sos-" + defaultTemplateZone + ".exo.io" +) + +type Config struct { + common.PackerConfig `mapstructure:",squash"` + SkipClean bool `mapstructure:"skip_clean"` + + SOSEndpoint string `mapstructure:"sos_endpoint"` + APIEndpoint string `mapstructure:"api_endpoint"` + APIKey string `mapstructure:"api_key"` + APISecret string `mapstructure:"api_secret"` + ImageBucket string `mapstructure:"image_bucket"` + TemplateZone string `mapstructure:"template_zone"` + TemplateName string `mapstructure:"template_name"` + TemplateDescription string `mapstructure:"template_description"` + TemplateUsername string `mapstructure:"template_username"` + TemplateDisablePassword bool `mapstructure:"template_disable_password"` + TemplateDisableSSHKey bool `mapstructure:"template_disable_sshkey"` +} + +func init() { + egoscale.UserAgent = "Packer-Exoscale/" + version.FormattedVersion() + " " + egoscale.UserAgent +} + +type PostProcessor struct { + config Config +} + +func (p *PostProcessor) Configure(raws ...interface{}) error { + p.config.TemplateZone = defaultTemplateZone + p.config.APIEndpoint = defaultAPIEndpoint + p.config.SOSEndpoint = defaultSOSEndpoint + + if err := config.Decode(&p.config, nil, raws...); err != nil { + return err + } + + if p.config.APIKey == "" { + p.config.APIKey = os.Getenv("EXOSCALE_API_KEY") + } + + if p.config.APISecret == "" { + p.config.APISecret = os.Getenv("EXOSCALE_API_SECRET") + } + + requiredArgs := map[string]*string{ + "api_key": &p.config.APIKey, + "api_secret": &p.config.APISecret, + "api_endpoint": &p.config.APIEndpoint, + "sos_endpoint": &p.config.SOSEndpoint, + "image_bucket": &p.config.ImageBucket, + "template_zone": &p.config.TemplateZone, + "template_name": &p.config.TemplateName, + "template_description": &p.config.TemplateDescription, + } + + errs := new(packer.MultiError) + for k, v := range requiredArgs { + if *v == "" { + errs = packer.MultiErrorAppend( + errs, fmt.Errorf("%s must be set", k)) + } + } + + if len(errs.Errors) > 0 { + return errs + } + + packer.LogSecretFilter.Set(p.config.APIKey, p.config.APISecret) + + return nil +} + +func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { + switch a.BuilderId() { + case qemu.BuilderId, file.BuilderId, artifice.BuilderId: + break + + default: + err := fmt.Errorf( + "Unknown artifact type: %s\nCan only import from QEMU/file builders and Artifice post-processor artifacts.", + a.BuilderId()) + return nil, false, false, err + } + + ui.Message("Uploading template image") + url, md5sum, err := p.uploadImage(ctx, ui, a) + if err != nil { + return nil, false, false, fmt.Errorf("unable to upload image: %s", err) + } + + ui.Message("Registering template") + id, err := p.registerTemplate(ctx, ui, url, md5sum) + if err != nil { + return nil, false, false, fmt.Errorf("unable to register template: %s", err) + } + + if !p.config.SkipClean { + ui.Message("Deleting uploaded template image") + if err = p.deleteImage(ctx, ui, a); err != nil { + return nil, false, false, fmt.Errorf("unable to delete uploaded template image: %s", err) + } + } + + return &Artifact{id}, false, false, nil +} + +func (p *PostProcessor) uploadImage(ctx context.Context, ui packer.Ui, a packer.Artifact) (string, string, error) { + var ( + imageFile = a.Files()[0] + bucketFile = filepath.Base(imageFile) + ) + + f, err := os.Open(imageFile) + if err != nil { + return "", "", err + } + defer f.Close() + + fileInfo, err := f.Stat() + if err != nil { + return "", "", err + } + + // For tracking image file upload progress + pf := ui.TrackProgress(imageFile, 0, fileInfo.Size(), f) + defer pf.Close() + + hash := md5.New() + if _, err := io.Copy(hash, f); err != nil { + return "", "", fmt.Errorf("image checksumming failed: %s", err) + } + if _, err := f.Seek(0, 0); err != nil { + return "", "", err + } + + sess := session.Must(session.NewSessionWithOptions(session.Options{Config: aws.Config{ + Region: aws.String(p.config.TemplateZone), + Endpoint: aws.String(p.config.SOSEndpoint), + Credentials: credentials.NewStaticCredentials(p.config.APIKey, p.config.APISecret, "")}})) + + uploader := s3manager.NewUploader(sess) + output, err := uploader.UploadWithContext(ctx, &s3manager.UploadInput{ + Body: pf, + Bucket: aws.String(p.config.ImageBucket), + Key: aws.String(bucketFile), + ContentMD5: aws.String(base64.StdEncoding.EncodeToString(hash.Sum(nil))), + ACL: aws.String("public-read"), + }) + if err != nil { + return "", "", err + } + + return output.Location, fmt.Sprintf("%x", hash.Sum(nil)), nil +} + +func (p *PostProcessor) deleteImage(ctx context.Context, ui packer.Ui, a packer.Artifact) error { + var ( + imageFile = a.Files()[0] + bucketFile = filepath.Base(imageFile) + ) + + sess := session.Must(session.NewSessionWithOptions(session.Options{Config: aws.Config{ + Region: aws.String(p.config.TemplateZone), + Endpoint: aws.String(p.config.SOSEndpoint), + Credentials: credentials.NewStaticCredentials(p.config.APIKey, p.config.APISecret, "")}})) + + svc := s3.New(sess) + if _, err := svc.DeleteObject(&s3.DeleteObjectInput{ + Bucket: aws.String(p.config.ImageBucket), + Key: aws.String(bucketFile), + }); err != nil { + return err + } + + return nil +} + +func (p *PostProcessor) registerTemplate(ctx context.Context, ui packer.Ui, url, md5sum string) (string, error) { + var ( + passwordEnabled = !p.config.TemplateDisablePassword + sshkeyEnabled = !p.config.TemplateDisableSSHKey + regErr error + ) + + exo := egoscale.NewClient(p.config.APIEndpoint, p.config.APIKey, p.config.APISecret) + exo.RetryStrategy = egoscale.FibonacciRetryStrategy + + zone := egoscale.Zone{Name: p.config.TemplateZone} + if resp, err := exo.GetWithContext(ctx, &zone); err != nil { + return "", fmt.Errorf("template zone lookup failed: %s", err) + } else { + zone.ID = resp.(*egoscale.Zone).ID + } + + req := egoscale.RegisterCustomTemplate{ + URL: url, + ZoneID: zone.ID, + Name: p.config.TemplateName, + Displaytext: p.config.TemplateDescription, + PasswordEnabled: &passwordEnabled, + SSHKeyEnabled: &sshkeyEnabled, + Details: map[string]string{"username": p.config.TemplateUsername}, + Checksum: md5sum, + } + + res := make([]egoscale.Template, 0) + + exo.AsyncRequestWithContext(ctx, req, func(jobRes *egoscale.AsyncJobResult, err error) bool { + if err != nil { + regErr = fmt.Errorf("request failed: %s", err) + return false + } else if jobRes.JobStatus == egoscale.Pending { + // Job is not completed yet + ui.Message("template registration in progress") + return true + } + + if err := jobRes.Result(&res); err != nil { + regErr = err + return false + } + + if len(res) != 1 { + regErr = fmt.Errorf("unexpected response from API (expected 1 item, got %d)", len(res)) + return false + } + + return false + }) + if regErr != nil { + return "", regErr + } + + return res[0].ID.String(), nil +} diff --git a/post-processor/googlecompute-export/post-processor.go b/post-processor/googlecompute-export/post-processor.go index b0e15e296..b5ddc8906 100644 --- a/post-processor/googlecompute-export/post-processor.go +++ b/post-processor/googlecompute-export/post-processor.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" + "golang.org/x/oauth2/jwt" ) type Config struct { @@ -26,7 +27,7 @@ type Config struct { Subnetwork string `mapstructure:"subnetwork"` Zone string `mapstructure:"zone"` - Account googlecompute.AccountFile + Account *jwt.Config ctx interpolate.Context } @@ -96,16 +97,18 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact // Set up credentials for GCE driver. if builderAccountFile != "" { - err := googlecompute.ProcessAccountFile(&p.config.Account, builderAccountFile) + cfg, err := googlecompute.ProcessAccountFile(builderAccountFile) if err != nil { return nil, false, false, err } + p.config.Account = cfg } if p.config.AccountFile != "" { - err := googlecompute.ProcessAccountFile(&p.config.Account, p.config.AccountFile) + cfg, err := googlecompute.ProcessAccountFile(p.config.AccountFile) if err != nil { return nil, false, false, err } + p.config.Account = cfg } // Set up exporter instance configuration. @@ -139,7 +142,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact } exporterConfig.CalcTimeout() - driver, err := googlecompute.NewDriverGCE(ui, builderProjectId, &p.config.Account) + driver, err := googlecompute.NewDriverGCE(ui, builderProjectId, p.config.Account) if err != nil { return nil, false, false, err } diff --git a/post-processor/googlecompute-import/post-processor.go b/post-processor/googlecompute-import/post-processor.go index 7cef5f899..32073f993 100644 --- a/post-processor/googlecompute-import/post-processor.go +++ b/post-processor/googlecompute-import/post-processor.go @@ -8,6 +8,7 @@ import ( "strings" "time" + "golang.org/x/oauth2/jwt" "google.golang.org/api/compute/v1" "google.golang.org/api/storage/v1" @@ -34,7 +35,7 @@ type Config struct { ImageName string `mapstructure:"image_name"` SkipClean bool `mapstructure:"skip_clean"` - Account googlecompute.AccountFile + Account *jwt.Config ctx interpolate.Context } @@ -70,9 +71,11 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { } if p.config.AccountFile != "" { - if err := googlecompute.ProcessAccountFile(&p.config.Account, p.config.AccountFile); err != nil { + cfg, err := googlecompute.ProcessAccountFile(p.config.AccountFile) + if err != nil { errs = packer.MultiErrorAppend(errs, err) } + p.config.Account = cfg } templates := map[string]*string{ @@ -95,7 +98,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { } func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { - client, err := googlecompute.NewClientGCE(&p.config.Account) + client, err := googlecompute.NewClientGCE(p.config.Account) if err != nil { return nil, false, false, err } diff --git a/post-processor/shell-local/post-processor.go b/post-processor/shell-local/post-processor.go index 3d7131427..e23d31648 100644 --- a/post-processor/shell-local/post-processor.go +++ b/post-processor/shell-local/post-processor.go @@ -47,7 +47,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact } // Force shell-local pp to keep the input artifact, because otherwise we'll - // lose it instead of being able to pass it through. If oyu want to delete + // lose it instead of being able to pass it through. If you want to delete // the input artifact for a shell local pp, use the artifice pp to create a // new artifact return artifact, true, true, retErr diff --git a/post-processor/vagrant/post-processor.go b/post-processor/vagrant/post-processor.go index 02dde3209..90197c316 100644 --- a/post-processor/vagrant/post-processor.go +++ b/post-processor/vagrant/post-processor.go @@ -42,11 +42,12 @@ var builtins = map[string]string{ type Config struct { common.PackerConfig `mapstructure:",squash"` - CompressionLevel int `mapstructure:"compression_level"` - Include []string `mapstructure:"include"` - OutputPath string `mapstructure:"output"` - Override map[string]interface{} - VagrantfileTemplate string `mapstructure:"vagrantfile_template"` + CompressionLevel int `mapstructure:"compression_level"` + Include []string `mapstructure:"include"` + OutputPath string `mapstructure:"output"` + Override map[string]interface{} + VagrantfileTemplate string `mapstructure:"vagrantfile_template"` + VagrantfileTemplateGenerated bool `mapstructure:"vagrantfile_template_generated"` ctx interpolate.Context } @@ -217,7 +218,7 @@ func (p *PostProcessor) configureSingle(c *Config, raws ...interface{}) error { } var errs *packer.MultiError - if c.VagrantfileTemplate != "" { + if c.VagrantfileTemplate != "" && c.VagrantfileTemplateGenerated == false { _, err := os.Stat(c.VagrantfileTemplate) if err != nil { errs = packer.MultiErrorAppend(errs, fmt.Errorf( diff --git a/post-processor/vagrant/post-processor_test.go b/post-processor/vagrant/post-processor_test.go index 7e6be2b29..fccf4cf24 100644 --- a/post-processor/vagrant/post-processor_test.go +++ b/post-processor/vagrant/post-processor_test.go @@ -137,13 +137,25 @@ func TestPostProcessorPrepare_vagrantfileTemplateExists(t *testing.T) { t.Fatalf("err: %s", err) } + var p PostProcessor + + if err := p.Configure(c); err != nil { + t.Fatal("no error expected as vagrantfile_template exists") + } + if err := os.Remove(name); err != nil { t.Fatalf("err: %s", err) } - var p PostProcessor if err := p.Configure(c); err == nil { - t.Fatal("expected an error since vagrantfile_template does not exist") + t.Fatal("expected error since vagrantfile_template does not exist and vagrantfile_template_generated is unset") + } + + // The vagrantfile_template will be generated during the build process + c["vagrantfile_template_generated"] = true + + if err := p.Configure(c); err != nil { + t.Fatal("no error expected due to missing vagrantfile_template as vagrantfile_template_generated is set") } } diff --git a/provisioner/ansible/provisioner.go b/provisioner/ansible/provisioner.go index 378fd7beb..d61d4d44e 100644 --- a/provisioner/ansible/provisioner.go +++ b/provisioner/ansible/provisioner.go @@ -61,6 +61,10 @@ type Config struct { UseSFTP bool `mapstructure:"use_sftp"` InventoryDirectory string `mapstructure:"inventory_directory"` InventoryFile string `mapstructure:"inventory_file"` + GalaxyFile string `mapstructure:"galaxy_file"` + GalaxyCommand string `mapstructure:"galaxy_command"` + GalaxyForceInstall bool `mapstructure:"galaxy_force_install"` + RolesPath string `mapstructure:"roles_path"` } type Provisioner struct { @@ -100,6 +104,10 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { p.config.Command = "ansible-playbook" } + if p.config.GalaxyCommand == "" { + p.config.GalaxyCommand = "ansible-galaxy" + } + if p.config.HostAlias == "" { p.config.HostAlias = "default" } @@ -110,6 +118,14 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { errs = packer.MultiErrorAppend(errs, err) } + // Check that the galaxy file exists, if configured + if len(p.config.GalaxyFile) > 0 { + err = validateFileConfig(p.config.GalaxyFile, "galaxy_file", true) + if err != nil { + errs = packer.MultiErrorAppend(errs, err) + } + } + // Check that the authorized key file exists if len(p.config.SSHAuthorizedKeyFile) > 0 { err = validateFileConfig(p.config.SSHAuthorizedKeyFile, "ssh_authorized_key_file", true) @@ -343,14 +359,64 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) Cancel() { - if p.done != nil { - close(p.done) +func (p *Provisioner) executeGalaxy(ui packer.Ui, comm packer.Communicator) error { + galaxyFile := filepath.ToSlash(p.config.GalaxyFile) + + // ansible-galaxy install -r requirements.yml + args := []string{"install", "-r", galaxyFile} + // Add force to arguments + if p.config.GalaxyForceInstall { + args = append(args, "-f") } - if p.adapter != nil { - p.adapter.Shutdown() + // Add roles_path argument if specified + if p.config.RolesPath != "" { + args = append(args, "-p", filepath.ToSlash(p.config.RolesPath)) } - os.Exit(0) + + ui.Message(fmt.Sprintf("Executing Ansible Galaxy")) + cmd := exec.Command(p.config.GalaxyCommand, args...) + + stdout, err := cmd.StdoutPipe() + if err != nil { + return err + } + stderr, err := cmd.StderrPipe() + if err != nil { + return err + } + wg := sync.WaitGroup{} + repeat := func(r io.ReadCloser) { + reader := bufio.NewReader(r) + for { + line, err := reader.ReadString('\n') + if line != "" { + line = strings.TrimRightFunc(line, unicode.IsSpace) + ui.Message(line) + } + if err != nil { + if err == io.EOF { + break + } else { + ui.Error(err.Error()) + break + } + } + } + wg.Done() + } + wg.Add(2) + go repeat(stdout) + go repeat(stderr) + + if err := cmd.Start(); err != nil { + return err + } + wg.Wait() + err = cmd.Wait() + if err != nil { + return fmt.Errorf("Non-zero exit status: %s", err) + } + return nil } func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator, privKeyFile string) error { @@ -359,6 +425,12 @@ func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator, pri var envvars []string + // Fetch external dependencies + if len(p.config.GalaxyFile) > 0 { + if err := p.executeGalaxy(ui, comm); err != nil { + return fmt.Errorf("Error executing Ansible Galaxy: %s", err) + } + } args := []string{"--extra-vars", fmt.Sprintf("packer_build_name=%s packer_builder_type=%s -o IdentitiesOnly=yes", p.config.PackerBuildName, p.config.PackerBuilderType), "-i", inventory, playbook} diff --git a/provisioner/breakpoint/provisioner.go b/provisioner/breakpoint/provisioner.go index 3787ce44d..b6c6f4504 100644 --- a/provisioner/breakpoint/provisioner.go +++ b/provisioner/breakpoint/provisioner.go @@ -3,7 +3,6 @@ package breakpoint import ( "context" "fmt" - "os" "golang.org/x/sync/errgroup" @@ -79,8 +78,3 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C } return nil } - -func (p *Provisioner) Cancel() { - // Just hard quit. - os.Exit(0) -} diff --git a/provisioner/converge/provisioner.go b/provisioner/converge/provisioner.go index 20b48bcca..a7ea6f6a9 100644 --- a/provisioner/converge/provisioner.go +++ b/provisioner/converge/provisioner.go @@ -234,9 +234,3 @@ func (p *Provisioner) applyModules(ui packer.Ui, comm packer.Communicator) error return nil } - -// Cancel the provisioning process -func (p *Provisioner) Cancel() { - // there's not an awful lot we can do to cancel Converge at the moment. - // The default semantics are fine. -} diff --git a/provisioner/inspec/provisioner.go b/provisioner/inspec/provisioner.go index c90b66d49..618802f9f 100644 --- a/provisioner/inspec/provisioner.go +++ b/provisioner/inspec/provisioner.go @@ -317,15 +317,6 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) Cancel() { - if p.done != nil { - close(p.done) - } - if p.adapter != nil { - p.adapter.Shutdown() - } - os.Exit(0) -} func (p *Provisioner) executeInspec(ui packer.Ui, comm packer.Communicator, privKeyFile string) error { var envvars []string @@ -342,7 +333,7 @@ func (p *Provisioner) executeInspec(ui packer.Ui, comm packer.Communicator, priv args = append(args, "--port", strconv.Itoa(p.config.LocalPort)) } - args = append(args, "--attrs") + args = append(args, "--input-file") args = append(args, p.config.AttributesFiles...) args = append(args, p.config.ExtraArguments...) diff --git a/provisioner/powershell/provisioner.go b/provisioner/powershell/provisioner.go index 6b0038947..53903ceb9 100644 --- a/provisioner/powershell/provisioner.go +++ b/provisioner/powershell/provisioner.go @@ -305,12 +305,6 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) Cancel() { - // Just hard quit. It isn't a big deal if what we're doing keeps running - // on the other side. - os.Exit(0) -} - // Environment variables required within the remote environment are uploaded // within a PS script and then enabled by 'dot sourcing' the script // immediately prior to execution of the main command diff --git a/provisioner/salt-masterless/provisioner.go b/provisioner/salt-masterless/provisioner.go index 38a84fc50..83bc326fb 100644 --- a/provisioner/salt-masterless/provisioner.go +++ b/provisioner/salt-masterless/provisioner.go @@ -130,7 +130,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return fmt.Errorf("Invalid guest_os_type: \"%s\"", p.config.GuestOSType) } - p.guestCommands, err = provisioner.NewGuestCommands(p.config.GuestOSType, false) + p.guestCommands, err = provisioner.NewGuestCommands(p.config.GuestOSType, !p.config.DisableSudo) if err != nil { return fmt.Errorf("Invalid guest_os_type: \"%s\"", p.config.GuestOSType) } @@ -399,9 +399,14 @@ func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst, sr } defer f.Close() - if err = comm.Upload(dst, f, nil); err != nil { + _, temp_dst := filepath.Split(dst) + + if err = comm.Upload(temp_dst, f, nil); err != nil { return fmt.Errorf("Error uploading %s: %s", src, err) } + + p.moveFile(ui, comm, dst, temp_dst) + return nil } @@ -468,14 +473,9 @@ func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir stri } func (p *Provisioner) uploadDir(ui packer.Ui, comm packer.Communicator, dst, src string, ignore []string) error { - if err := p.createDir(ui, comm, dst); err != nil { + _, temp_dst := filepath.Split(dst) + if err := comm.UploadDir(temp_dst, src, ignore); err != nil { return err } - - // Make sure there is a trailing "/" so that the directory isn't - // created on the other side. - if src[len(src)-1] != '/' { - src = src + "/" - } - return comm.UploadDir(dst, src, ignore) + return p.moveFile(ui, comm, dst, temp_dst) } diff --git a/provisioner/shell-local/provisioner.go b/provisioner/shell-local/provisioner.go index 9768f85b8..f92f93c70 100644 --- a/provisioner/shell-local/provisioner.go +++ b/provisioner/shell-local/provisioner.go @@ -30,7 +30,3 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, _ packer.Comm return retErr } - -func (p *Provisioner) Cancel() { - // Just do nothing. When the process ends, so will our provisioner -} diff --git a/provisioner/sleep/provisioner.go b/provisioner/sleep/provisioner.go index 146ac914d..ecd4a4b40 100644 --- a/provisioner/sleep/provisioner.go +++ b/provisioner/sleep/provisioner.go @@ -26,5 +26,3 @@ func (p *Provisioner) Provision(ctx context.Context, _ packer.Ui, _ packer.Commu return nil } } - -func (p *Provisioner) Cancel() {} diff --git a/scripts/off_gopath.sh b/scripts/off_gopath.sh new file mode 100755 index 000000000..ead92a6d7 --- /dev/null +++ b/scripts/off_gopath.sh @@ -0,0 +1,22 @@ +#! /usr/bin/env bash + +set -eu -o pipefail + +gpath=${GOPATH:-} +if [ -z "$gpath" ]; then + gpath=$HOME/go +fi + +reldir=`dirname $0` +curdir=`pwd` +cd $reldir +CUR_GO_DIR=`pwd` +cd $curdir + +if [[ $CUR_GO_DIR == *"$gpath"* ]]; then + # echo "You're on the gopath" + exit 1 +else + # echo "You're not on the gopath" + exit 0 +fi \ No newline at end of file diff --git a/template/interpolate/funcs.go b/template/interpolate/funcs.go index 57495052a..1d76f8f06 100644 --- a/template/interpolate/funcs.go +++ b/template/interpolate/funcs.go @@ -47,6 +47,8 @@ var FuncGens = map[string]FuncGenerator{ "lower": funcGenPrimitive(strings.ToLower), } +var ErrVariableNotSetString = "Error: variable not set:" + // FuncGenerator is a function that given a context generates a template // function for the template. type FuncGenerator func(*Context) interface{} @@ -168,7 +170,7 @@ func funcGenUser(ctx *Context) interface{} { // error and retry if we're interpolating UserVariables. But if // we're elsewhere in the template, just return the empty string. if !ok { - return "", errors.New(fmt.Sprintf("variable %s not set", k)) + return "", fmt.Errorf("%s %s", ErrVariableNotSetString, k) } } return val, nil diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/availabilitysets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/availabilitysets.go new file mode 100644 index 000000000..3534239a0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/availabilitysets.go @@ -0,0 +1,655 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AvailabilitySetsClient is the compute Client +type AvailabilitySetsClient struct { + BaseClient +} + +// NewAvailabilitySetsClient creates an instance of the AvailabilitySetsClient client. +func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient { + return NewAvailabilitySetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAvailabilitySetsClientWithBaseURI creates an instance of the AvailabilitySetsClient client. +func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient { + return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update an availability set. +// Parameters: +// resourceGroupName - the name of the resource group. +// availabilitySetName - the name of the availability set. +// parameters - parameters supplied to the Create Availability Set operation. +func (client AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet) (result AvailabilitySet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AvailabilitySetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "availabilitySetName": autorest.Encode("path", availabilitySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response) (result AvailabilitySet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an availability set. +// Parameters: +// resourceGroupName - the name of the resource group. +// availabilitySetName - the name of the availability set. +func (client AvailabilitySetsClient) Delete(ctx context.Context, resourceGroupName string, availabilitySetName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, availabilitySetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AvailabilitySetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "availabilitySetName": autorest.Encode("path", availabilitySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves information about an availability set. +// Parameters: +// resourceGroupName - the name of the resource group. +// availabilitySetName - the name of the availability set. +func (client AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, availabilitySetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AvailabilitySetsClient) GetPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "availabilitySetName": autorest.Encode("path", availabilitySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result AvailabilitySet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all availability sets in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client AvailabilitySetsClient) List(ctx context.Context, resourceGroupName string) (result AvailabilitySetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.List") + defer func() { + sc := -1 + if result.aslr.Response.Response != nil { + sc = result.aslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending request") + return + } + + result.aslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailabilitySetsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result AvailabilitySetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AvailabilitySetsClient) listNextResults(ctx context.Context, lastResults AvailabilitySetListResult) (result AvailabilitySetListResult, err error) { + req, err := lastResults.availabilitySetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailabilitySetsClient) ListComplete(ctx context.Context, resourceGroupName string) (result AvailabilitySetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAvailableSizes lists all available virtual machine sizes that can be used to create a new virtual machine in an +// existing availability set. +// Parameters: +// resourceGroupName - the name of the resource group. +// availabilitySetName - the name of the availability set. +func (client AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.ListAvailableSizes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, availabilitySetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableSizesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableSizesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to request") + } + + return +} + +// ListAvailableSizesPreparer prepares the ListAvailableSizes request. +func (client AvailabilitySetsClient) ListAvailableSizesPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "availabilitySetName": autorest.Encode("path", availabilitySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription lists all availability sets in a subscription. +func (client AvailabilitySetsClient) ListBySubscription(ctx context.Context) (result AvailabilitySetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.ListBySubscription") + defer func() { + sc := -1 + if result.aslr.Response.Response != nil { + sc = result.aslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.aslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.aslr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client AvailabilitySetsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) ListBySubscriptionResponder(resp *http.Response) (result AvailabilitySetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client AvailabilitySetsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AvailabilitySetListResult) (result AvailabilitySetListResult, err error) { + req, err := lastResults.availabilitySetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailabilitySetsClient) ListBySubscriptionComplete(ctx context.Context) (result AvailabilitySetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update update an availability set. +// Parameters: +// resourceGroupName - the name of the resource group. +// availabilitySetName - the name of the availability set. +// parameters - parameters supplied to the Update Availability Set operation. +func (client AvailabilitySetsClient) Update(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate) (result AvailabilitySet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AvailabilitySetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "availabilitySetName": autorest.Encode("path", availabilitySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) UpdateResponder(resp *http.Response) (result AvailabilitySet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/client.go new file mode 100644 index 000000000..b23c9ca74 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/client.go @@ -0,0 +1,51 @@ +// Package compute implements the Azure ARM Compute service API version . +// +// Compute Client +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Compute + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Compute. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/containerservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/containerservices.go new file mode 100644 index 000000000..24fdc0801 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/containerservices.go @@ -0,0 +1,538 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ContainerServicesClient is the compute Client +type ContainerServicesClient struct { + BaseClient +} + +// NewContainerServicesClient creates an instance of the ContainerServicesClient client. +func NewContainerServicesClient(subscriptionID string) ContainerServicesClient { + return NewContainerServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewContainerServicesClientWithBaseURI creates an instance of the ContainerServicesClient client. +func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string) ContainerServicesClient { + return ContainerServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a container service with the specified configuration of orchestrator, masters, and +// agents. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerServiceName - the name of the container service in the specified subscription and resource group. +// parameters - parameters supplied to the Create or Update a Container Service operation. +func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (result ContainerServicesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerServiceProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.CustomProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.CustomProfile.Orchestrator", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ContainerServiceProperties.ServicePrincipalProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ContainerServiceProperties.ServicePrincipalProfile.Secret", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.ContainerServiceProperties.MasterProfile", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.MasterProfile.DNSPrefix", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ContainerServiceProperties.AgentPoolProfiles", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ContainerServiceProperties.WindowsProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$`, Chain: nil}}}, + {Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.ContainerServiceProperties.LinuxProfile", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-z][a-z0-9_-]*$`, Chain: nil}}}, + {Target: "parameters.ContainerServiceProperties.LinuxProfile.SSH", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.ContainerServiceProperties.DiagnosticsProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile.VMDiagnostics", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile.VMDiagnostics.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.ContainerServicesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerServiceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ContainerServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerServiceName": autorest.Encode("path", containerServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) CreateOrUpdateSender(req *http.Request) (future ContainerServicesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified container service in the specified subscription and resource group. The operation does +// not delete other resources created as part of creating a container service, including storage accounts, VMs, and +// availability sets. All the other resources created with the container service are part of the same resource group +// and can be deleted individually. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerServiceName - the name of the container service in the specified subscription and resource group. +func (client ContainerServicesClient) Delete(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerServicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, containerServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ContainerServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerServiceName": autorest.Encode("path", containerServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) DeleteSender(req *http.Request) (future ContainerServicesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the properties of the specified container service in the specified subscription and resource group. The +// operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters +// and agents. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerServiceName - the name of the container service in the specified subscription and resource group. +func (client ContainerServicesClient) Get(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, containerServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ContainerServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerServiceName": autorest.Encode("path", containerServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) GetResponder(resp *http.Response) (result ContainerService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of container services in the specified subscription. The operation returns properties of each +// container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. +func (client ContainerServicesClient) List(ctx context.Context) (result ContainerServiceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.List") + defer func() { + sc := -1 + if result.cslr.Response.Response != nil { + sc = result.cslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "List", resp, "Failure sending request") + return + } + + result.cslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ContainerServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) ListResponder(resp *http.Response) (result ContainerServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ContainerServicesClient) listNextResults(ctx context.Context, lastResults ContainerServiceListResult) (result ContainerServiceListResult, err error) { + req, err := lastResults.containerServiceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ContainerServicesClient) ListComplete(ctx context.Context) (result ContainerServiceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets a list of container services in the specified subscription and resource group. The +// operation returns properties of each container service including state, orchestrator, number of masters and agents, +// and FQDNs of masters and agents. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ContainerServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ContainerServiceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.cslr.Response.Response != nil { + sc = result.cslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.cslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.cslr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ContainerServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ContainerServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ContainerServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ContainerServiceListResult) (result ContainerServiceListResult, err error) { + req, err := lastResults.containerServiceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ContainerServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ContainerServiceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/disks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/disks.go new file mode 100644 index 000000000..b81821b47 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/disks.go @@ -0,0 +1,766 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DisksClient is the compute Client +type DisksClient struct { + BaseClient +} + +// NewDisksClient creates an instance of the DisksClient client. +func NewDisksClient(subscriptionID string) DisksClient { + return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDisksClientWithBaseURI creates an instance of the DisksClient client. +func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient { + return DisksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a disk. +// Parameters: +// resourceGroupName - the name of the resource group. +// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is +// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 +// characters. +// disk - disk object supplied in the body of the Put disk operation. +func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (result DisksCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: disk, + Constraints: []validation.Constraint{{Target: "disk.DiskProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData.ImageReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "disk.DiskProperties.EncryptionSettingsCollection", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "disk.DiskProperties.EncryptionSettingsCollection.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("compute.DisksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, diskName, disk) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DisksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + disk.ManagedBy = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), + autorest.WithJSON(disk), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) CreateOrUpdateSender(req *http.Request) (future DisksCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Disk, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a disk. +// Parameters: +// resourceGroupName - the name of the resource group. +// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is +// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 +// characters. +func (client DisksClient) Delete(ctx context.Context, resourceGroupName string, diskName string) (result DisksDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, diskName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DisksClient) DeletePreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) DeleteSender(req *http.Request) (future DisksDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DisksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about a disk. +// Parameters: +// resourceGroupName - the name of the resource group. +// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is +// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 +// characters. +func (client DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string) (result Disk, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, diskName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DisksClient) GetPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DisksClient) GetResponder(resp *http.Response) (result Disk, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GrantAccess grants access to a disk. +// Parameters: +// resourceGroupName - the name of the resource group. +// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is +// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 +// characters. +// grantAccessData - access data object supplied in the body of the get disk access operation. +func (client DisksClient) GrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (result DisksGrantAccessFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.GrantAccess") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: grantAccessData, + Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.DisksClient", "GrantAccess", err.Error()) + } + + req, err := client.GrantAccessPreparer(ctx, resourceGroupName, diskName, grantAccessData) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", nil, "Failure preparing request") + return + } + + result, err = client.GrantAccessSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", result.Response(), "Failure sending request") + return + } + + return +} + +// GrantAccessPreparer prepares the GrantAccess request. +func (client DisksClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", pathParameters), + autorest.WithJSON(grantAccessData), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GrantAccessSender sends the GrantAccess request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) GrantAccessSender(req *http.Request) (future DisksGrantAccessFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// GrantAccessResponder handles the response to the GrantAccess request. The method always +// closes the http.Response Body. +func (client DisksClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the disks under a subscription. +func (client DisksClient) List(ctx context.Context) (result DiskListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.List") + defer func() { + sc := -1 + if result.dl.Response.Response != nil { + sc = result.dl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure sending request") + return + } + + result.dl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DisksClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DisksClient) ListResponder(resp *http.Response) (result DiskList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DisksClient) listNextResults(ctx context.Context, lastResults DiskList) (result DiskList, err error) { + req, err := lastResults.diskListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DisksClient) ListComplete(ctx context.Context) (result DiskListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all the disks under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client DisksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DiskListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dl.Response.Response != nil { + sc = result.dl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DisksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DisksClient) ListByResourceGroupResponder(resp *http.Response) (result DiskList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client DisksClient) listByResourceGroupNextResults(ctx context.Context, lastResults DiskList) (result DiskList, err error) { + req, err := lastResults.diskListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DisksClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DiskListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// RevokeAccess revokes access to a disk. +// Parameters: +// resourceGroupName - the name of the resource group. +// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is +// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 +// characters. +func (client DisksClient) RevokeAccess(ctx context.Context, resourceGroupName string, diskName string) (result DisksRevokeAccessFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.RevokeAccess") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, diskName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", nil, "Failure preparing request") + return + } + + result, err = client.RevokeAccessSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", result.Response(), "Failure sending request") + return + } + + return +} + +// RevokeAccessPreparer prepares the RevokeAccess request. +func (client DisksClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevokeAccessSender sends the RevokeAccess request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) RevokeAccessSender(req *http.Request) (future DisksRevokeAccessFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RevokeAccessResponder handles the response to the RevokeAccess request. The method always +// closes the http.Response Body. +func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates (patches) a disk. +// Parameters: +// resourceGroupName - the name of the resource group. +// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is +// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 +// characters. +// disk - disk object supplied in the body of the Patch disk operation. +func (client DisksClient) Update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (result DisksUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, diskName, disk) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DisksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), + autorest.WithJSON(disk), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) UpdateSender(req *http.Request) (future DisksUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DisksClient) UpdateResponder(resp *http.Response) (result Disk, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleries.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleries.go new file mode 100644 index 000000000..3ab139470 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleries.go @@ -0,0 +1,498 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// GalleriesClient is the compute Client +type GalleriesClient struct { + BaseClient +} + +// NewGalleriesClient creates an instance of the GalleriesClient client. +func NewGalleriesClient(subscriptionID string) GalleriesClient { + return NewGalleriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGalleriesClientWithBaseURI creates an instance of the GalleriesClient client. +func NewGalleriesClientWithBaseURI(baseURI string, subscriptionID string) GalleriesClient { + return GalleriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a Shared Image Gallery. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery. The allowed characters are alphabets and numbers with +// dots and periods allowed in the middle. The maximum length is 80 characters. +// gallery - parameters supplied to the create or update Shared Image Gallery operation. +func (client GalleriesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery) (result GalleriesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, galleryName, gallery) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GalleriesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", pathParameters), + autorest.WithJSON(gallery), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GalleriesClient) CreateOrUpdateSender(req *http.Request) (future GalleriesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GalleriesClient) CreateOrUpdateResponder(resp *http.Response) (result Gallery, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a Shared Image Gallery. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery to be deleted. +func (client GalleriesClient) Delete(ctx context.Context, resourceGroupName string, galleryName string) (result GalleriesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, galleryName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GalleriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, galleryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GalleriesClient) DeleteSender(req *http.Request) (future GalleriesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GalleriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves information about a Shared Image Gallery. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery. +func (client GalleriesClient) Get(ctx context.Context, resourceGroupName string, galleryName string) (result Gallery, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, galleryName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GalleriesClient) GetPreparer(ctx context.Context, resourceGroupName string, galleryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GalleriesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GalleriesClient) GetResponder(resp *http.Response) (result Gallery, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list galleries under a subscription. +func (client GalleriesClient) List(ctx context.Context) (result GalleryListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.List") + defer func() { + sc := -1 + if result.gl.Response.Response != nil { + sc = result.gl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.gl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "List", resp, "Failure sending request") + return + } + + result.gl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GalleriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GalleriesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GalleriesClient) ListResponder(resp *http.Response) (result GalleryList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client GalleriesClient) listNextResults(ctx context.Context, lastResults GalleryList) (result GalleryList, err error) { + req, err := lastResults.galleryListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.GalleriesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.GalleriesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client GalleriesClient) ListComplete(ctx context.Context) (result GalleryListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup list galleries under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client GalleriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result GalleryListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.gl.Response.Response != nil { + sc = result.gl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.gl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.gl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client GalleriesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client GalleriesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client GalleriesClient) ListByResourceGroupResponder(resp *http.Response) (result GalleryList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client GalleriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults GalleryList) (result GalleryList, err error) { + req, err := lastResults.galleryListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.GalleriesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.GalleriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client GalleriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result GalleryListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimages.go new file mode 100644 index 000000000..be0796dca --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimages.go @@ -0,0 +1,410 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// GalleryImagesClient is the compute Client +type GalleryImagesClient struct { + BaseClient +} + +// NewGalleryImagesClient creates an instance of the GalleryImagesClient client. +func NewGalleryImagesClient(subscriptionID string) GalleryImagesClient { + return NewGalleryImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGalleryImagesClientWithBaseURI creates an instance of the GalleryImagesClient client. +func NewGalleryImagesClientWithBaseURI(baseURI string, subscriptionID string) GalleryImagesClient { + return GalleryImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a gallery Image Definition. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery in which the Image Definition is to be created. +// galleryImageName - the name of the gallery Image Definition to be created or updated. The allowed characters +// are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 +// characters. +// galleryImage - parameters supplied to the create or update gallery image operation. +func (client GalleryImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage) (result GalleryImagesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: galleryImage, + Constraints: []validation.Constraint{{Target: "galleryImage.GalleryImageProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "galleryImage.GalleryImageProperties.Identifier", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "galleryImage.GalleryImageProperties.Identifier.Publisher", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "galleryImage.GalleryImageProperties.Identifier.Offer", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "galleryImage.GalleryImageProperties.Identifier.Sku", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.GalleryImagesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GalleryImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", pathParameters), + autorest.WithJSON(galleryImage), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) CreateOrUpdateSender(req *http.Request) (future GalleryImagesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) CreateOrUpdateResponder(resp *http.Response) (result GalleryImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a gallery image. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery in which the Image Definition is to be deleted. +// galleryImageName - the name of the gallery Image Definition to be deleted. +func (client GalleryImagesClient) Delete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result GalleryImagesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, galleryName, galleryImageName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GalleryImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) DeleteSender(req *http.Request) (future GalleryImagesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves information about a gallery Image Definition. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery from which the Image Definitions are to be retrieved. +// galleryImageName - the name of the gallery Image Definition to be retrieved. +func (client GalleryImagesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result GalleryImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, galleryName, galleryImageName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GalleryImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) GetResponder(resp *http.Response) (result GalleryImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByGallery list gallery Image Definitions in a gallery. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery from which Image Definitions are to be listed. +func (client GalleryImagesClient) ListByGallery(ctx context.Context, resourceGroupName string, galleryName string) (result GalleryImageListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.ListByGallery") + defer func() { + sc := -1 + if result.gil.Response.Response != nil { + sc = result.gil.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByGalleryNextResults + req, err := client.ListByGalleryPreparer(ctx, resourceGroupName, galleryName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "ListByGallery", nil, "Failure preparing request") + return + } + + resp, err := client.ListByGallerySender(req) + if err != nil { + result.gil.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "ListByGallery", resp, "Failure sending request") + return + } + + result.gil, err = client.ListByGalleryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "ListByGallery", resp, "Failure responding to request") + } + + return +} + +// ListByGalleryPreparer prepares the ListByGallery request. +func (client GalleryImagesClient) ListByGalleryPreparer(ctx context.Context, resourceGroupName string, galleryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByGallerySender sends the ListByGallery request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) ListByGallerySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByGalleryResponder handles the response to the ListByGallery request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) ListByGalleryResponder(resp *http.Response) (result GalleryImageList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByGalleryNextResults retrieves the next set of results, if any. +func (client GalleryImagesClient) listByGalleryNextResults(ctx context.Context, lastResults GalleryImageList) (result GalleryImageList, err error) { + req, err := lastResults.galleryImageListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "listByGalleryNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByGallerySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "listByGalleryNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByGalleryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "listByGalleryNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByGalleryComplete enumerates all values, automatically crossing page boundaries as required. +func (client GalleryImagesClient) ListByGalleryComplete(ctx context.Context, resourceGroupName string, galleryName string) (result GalleryImageListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.ListByGallery") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByGallery(ctx, resourceGroupName, galleryName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimageversions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimageversions.go new file mode 100644 index 000000000..9bed4b798 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimageversions.go @@ -0,0 +1,418 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// GalleryImageVersionsClient is the compute Client +type GalleryImageVersionsClient struct { + BaseClient +} + +// NewGalleryImageVersionsClient creates an instance of the GalleryImageVersionsClient client. +func NewGalleryImageVersionsClient(subscriptionID string) GalleryImageVersionsClient { + return NewGalleryImageVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGalleryImageVersionsClientWithBaseURI creates an instance of the GalleryImageVersionsClient client. +func NewGalleryImageVersionsClientWithBaseURI(baseURI string, subscriptionID string) GalleryImageVersionsClient { + return GalleryImageVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a gallery Image Version. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - the name of the gallery Image Definition in which the Image Version is to be created. +// galleryImageVersionName - the name of the gallery Image Version to be created. Needs to follow semantic +// version name pattern: The allowed characters are digit and period. Digits must be within the range of a +// 32-bit integer. Format: .. +// galleryImageVersion - parameters supplied to the create or update gallery Image Version operation. +func (client GalleryImageVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion) (result GalleryImageVersionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: galleryImageVersion, + Constraints: []validation.Constraint{{Target: "galleryImageVersion.GalleryImageVersionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "galleryImageVersion.GalleryImageVersionProperties.PublishingProfile", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("compute.GalleryImageVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GalleryImageVersionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "galleryImageVersionName": autorest.Encode("path", galleryImageVersionName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", pathParameters), + autorest.WithJSON(galleryImageVersion), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImageVersionsClient) CreateOrUpdateSender(req *http.Request) (future GalleryImageVersionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GalleryImageVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result GalleryImageVersion, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a gallery Image Version. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - the name of the gallery Image Definition in which the Image Version resides. +// galleryImageVersionName - the name of the gallery Image Version to be deleted. +func (client GalleryImageVersionsClient) Delete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string) (result GalleryImageVersionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GalleryImageVersionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "galleryImageVersionName": autorest.Encode("path", galleryImageVersionName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImageVersionsClient) DeleteSender(req *http.Request) (future GalleryImageVersionsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GalleryImageVersionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves information about a gallery Image Version. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - the name of the gallery Image Definition in which the Image Version resides. +// galleryImageVersionName - the name of the gallery Image Version to be retrieved. +// expand - the expand expression to apply on the operation. +func (client GalleryImageVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, expand ReplicationStatusTypes) (result GalleryImageVersion, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GalleryImageVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, expand ReplicationStatusTypes) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "galleryImageVersionName": autorest.Encode("path", galleryImageVersionName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImageVersionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GalleryImageVersionsClient) GetResponder(resp *http.Response) (result GalleryImageVersion, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByGalleryImage list gallery Image Versions in a gallery Image Definition. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - the name of the Shared Image Gallery Image Definition from which the Image Versions are +// to be listed. +func (client GalleryImageVersionsClient) ListByGalleryImage(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result GalleryImageVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.ListByGalleryImage") + defer func() { + sc := -1 + if result.givl.Response.Response != nil { + sc = result.givl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByGalleryImageNextResults + req, err := client.ListByGalleryImagePreparer(ctx, resourceGroupName, galleryName, galleryImageName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "ListByGalleryImage", nil, "Failure preparing request") + return + } + + resp, err := client.ListByGalleryImageSender(req) + if err != nil { + result.givl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "ListByGalleryImage", resp, "Failure sending request") + return + } + + result.givl, err = client.ListByGalleryImageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "ListByGalleryImage", resp, "Failure responding to request") + } + + return +} + +// ListByGalleryImagePreparer prepares the ListByGalleryImage request. +func (client GalleryImageVersionsClient) ListByGalleryImagePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByGalleryImageSender sends the ListByGalleryImage request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImageVersionsClient) ListByGalleryImageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByGalleryImageResponder handles the response to the ListByGalleryImage request. The method always +// closes the http.Response Body. +func (client GalleryImageVersionsClient) ListByGalleryImageResponder(resp *http.Response) (result GalleryImageVersionList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByGalleryImageNextResults retrieves the next set of results, if any. +func (client GalleryImageVersionsClient) listByGalleryImageNextResults(ctx context.Context, lastResults GalleryImageVersionList) (result GalleryImageVersionList, err error) { + req, err := lastResults.galleryImageVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "listByGalleryImageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByGalleryImageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "listByGalleryImageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByGalleryImageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "listByGalleryImageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByGalleryImageComplete enumerates all values, automatically crossing page boundaries as required. +func (client GalleryImageVersionsClient) ListByGalleryImageComplete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result GalleryImageVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.ListByGalleryImage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByGalleryImage(ctx, resourceGroupName, galleryName, galleryImageName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/images.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/images.go new file mode 100644 index 000000000..d20fd4a7e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/images.go @@ -0,0 +1,582 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ImagesClient is the compute Client +type ImagesClient struct { + BaseClient +} + +// NewImagesClient creates an instance of the ImagesClient client. +func NewImagesClient(subscriptionID string) ImagesClient { + return NewImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewImagesClientWithBaseURI creates an instance of the ImagesClient client. +func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesClient { + return ImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update an image. +// Parameters: +// resourceGroupName - the name of the resource group. +// imageName - the name of the image. +// parameters - parameters supplied to the Create Image operation. +func (client ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (result ImagesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, imageName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageName": autorest.Encode("path", imageName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) CreateOrUpdateSender(req *http.Request) (future ImagesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result Image, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Image. +// Parameters: +// resourceGroupName - the name of the resource group. +// imageName - the name of the image. +func (client ImagesClient) Delete(ctx context.Context, resourceGroupName string, imageName string) (result ImagesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, imageName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, imageName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageName": autorest.Encode("path", imageName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) DeleteSender(req *http.Request) (future ImagesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an image. +// Parameters: +// resourceGroupName - the name of the resource group. +// imageName - the name of the image. +// expand - the expand expression to apply on the operation. +func (client ImagesClient) Get(ctx context.Context, resourceGroupName string, imageName string, expand string) (result Image, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, imageName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, imageName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageName": autorest.Encode("path", imageName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ImagesClient) GetResponder(resp *http.Response) (result Image, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the list of Images in the subscription. Use nextLink property in the response to get the next page of +// Images. Do this till nextLink is null to fetch all the Images. +func (client ImagesClient) List(ctx context.Context) (result ImageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.List") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ImagesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ImagesClient) ListResponder(resp *http.Response) (result ImageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ImagesClient) listNextResults(ctx context.Context, lastResults ImageListResult) (result ImageListResult, err error) { + req, err := lastResults.imageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ImagesClient) ListComplete(ctx context.Context) (result ImageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets the list of images under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ImagesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ImageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ImagesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ImagesClient) ListByResourceGroupResponder(resp *http.Response) (result ImageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ImagesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ImageListResult) (result ImageListResult, err error) { + req, err := lastResults.imageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ImagesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ImageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update update an image. +// Parameters: +// resourceGroupName - the name of the resource group. +// imageName - the name of the image. +// parameters - parameters supplied to the Update Image operation. +func (client ImagesClient) Update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate) (result ImagesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, imageName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ImagesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageName": autorest.Encode("path", imageName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) UpdateSender(req *http.Request) (future ImagesUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ImagesClient) UpdateResponder(resp *http.Response) (result Image, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/loganalytics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/loganalytics.go new file mode 100644 index 000000000..5fec2f884 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/loganalytics.go @@ -0,0 +1,212 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LogAnalyticsClient is the compute Client +type LogAnalyticsClient struct { + BaseClient +} + +// NewLogAnalyticsClient creates an instance of the LogAnalyticsClient client. +func NewLogAnalyticsClient(subscriptionID string) LogAnalyticsClient { + return NewLogAnalyticsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogAnalyticsClientWithBaseURI creates an instance of the LogAnalyticsClient client. +func NewLogAnalyticsClientWithBaseURI(baseURI string, subscriptionID string) LogAnalyticsClient { + return LogAnalyticsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ExportRequestRateByInterval export logs that show Api requests made by this subscription in the given time window to +// show throttling activities. +// Parameters: +// parameters - parameters supplied to the LogAnalytics getRequestRateByInterval Api. +// location - the location upon which virtual-machine-sizes is queried. +func (client LogAnalyticsClient) ExportRequestRateByInterval(ctx context.Context, parameters RequestRateByIntervalInput, location string) (result LogAnalyticsExportRequestRateByIntervalFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.ExportRequestRateByInterval") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.LogAnalyticsClient", "ExportRequestRateByInterval", err.Error()) + } + + req, err := client.ExportRequestRateByIntervalPreparer(ctx, parameters, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportRequestRateByInterval", nil, "Failure preparing request") + return + } + + result, err = client.ExportRequestRateByIntervalSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportRequestRateByInterval", result.Response(), "Failure sending request") + return + } + + return +} + +// ExportRequestRateByIntervalPreparer prepares the ExportRequestRateByInterval request. +func (client LogAnalyticsClient) ExportRequestRateByIntervalPreparer(ctx context.Context, parameters RequestRateByIntervalInput, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportRequestRateByIntervalSender sends the ExportRequestRateByInterval request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) ExportRequestRateByIntervalSender(req *http.Request) (future LogAnalyticsExportRequestRateByIntervalFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ExportRequestRateByIntervalResponder handles the response to the ExportRequestRateByInterval request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) ExportRequestRateByIntervalResponder(resp *http.Response) (result LogAnalyticsOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExportThrottledRequests export logs that show total throttled Api requests for this subscription in the given time +// window. +// Parameters: +// parameters - parameters supplied to the LogAnalytics getThrottledRequests Api. +// location - the location upon which virtual-machine-sizes is queried. +func (client LogAnalyticsClient) ExportThrottledRequests(ctx context.Context, parameters ThrottledRequestsInput, location string) (result LogAnalyticsExportThrottledRequestsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.ExportThrottledRequests") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.LogAnalyticsClient", "ExportThrottledRequests", err.Error()) + } + + req, err := client.ExportThrottledRequestsPreparer(ctx, parameters, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportThrottledRequests", nil, "Failure preparing request") + return + } + + result, err = client.ExportThrottledRequestsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportThrottledRequests", result.Response(), "Failure sending request") + return + } + + return +} + +// ExportThrottledRequestsPreparer prepares the ExportThrottledRequests request. +func (client LogAnalyticsClient) ExportThrottledRequestsPreparer(ctx context.Context, parameters ThrottledRequestsInput, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportThrottledRequestsSender sends the ExportThrottledRequests request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) ExportThrottledRequestsSender(req *http.Request) (future LogAnalyticsExportThrottledRequestsFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ExportThrottledRequestsResponder handles the response to the ExportThrottledRequests request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) ExportThrottledRequestsResponder(resp *http.Response) (result LogAnalyticsOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/models.go new file mode 100644 index 000000000..23f80d2fa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/models.go @@ -0,0 +1,10910 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute" + +// AccessLevel enumerates the values for access level. +type AccessLevel string + +const ( + // None ... + None AccessLevel = "None" + // Read ... + Read AccessLevel = "Read" + // Write ... + Write AccessLevel = "Write" +) + +// PossibleAccessLevelValues returns an array of possible values for the AccessLevel const type. +func PossibleAccessLevelValues() []AccessLevel { + return []AccessLevel{None, Read, Write} +} + +// AggregatedReplicationState enumerates the values for aggregated replication state. +type AggregatedReplicationState string + +const ( + // Completed ... + Completed AggregatedReplicationState = "Completed" + // Failed ... + Failed AggregatedReplicationState = "Failed" + // InProgress ... + InProgress AggregatedReplicationState = "InProgress" + // Unknown ... + Unknown AggregatedReplicationState = "Unknown" +) + +// PossibleAggregatedReplicationStateValues returns an array of possible values for the AggregatedReplicationState const type. +func PossibleAggregatedReplicationStateValues() []AggregatedReplicationState { + return []AggregatedReplicationState{Completed, Failed, InProgress, Unknown} +} + +// AvailabilitySetSkuTypes enumerates the values for availability set sku types. +type AvailabilitySetSkuTypes string + +const ( + // Aligned ... + Aligned AvailabilitySetSkuTypes = "Aligned" + // Classic ... + Classic AvailabilitySetSkuTypes = "Classic" +) + +// PossibleAvailabilitySetSkuTypesValues returns an array of possible values for the AvailabilitySetSkuTypes const type. +func PossibleAvailabilitySetSkuTypesValues() []AvailabilitySetSkuTypes { + return []AvailabilitySetSkuTypes{Aligned, Classic} +} + +// CachingTypes enumerates the values for caching types. +type CachingTypes string + +const ( + // CachingTypesNone ... + CachingTypesNone CachingTypes = "None" + // CachingTypesReadOnly ... + CachingTypesReadOnly CachingTypes = "ReadOnly" + // CachingTypesReadWrite ... + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +// PossibleCachingTypesValues returns an array of possible values for the CachingTypes const type. +func PossibleCachingTypesValues() []CachingTypes { + return []CachingTypes{CachingTypesNone, CachingTypesReadOnly, CachingTypesReadWrite} +} + +// ComponentNames enumerates the values for component names. +type ComponentNames string + +const ( + // MicrosoftWindowsShellSetup ... + MicrosoftWindowsShellSetup ComponentNames = "Microsoft-Windows-Shell-Setup" +) + +// PossibleComponentNamesValues returns an array of possible values for the ComponentNames const type. +func PossibleComponentNamesValues() []ComponentNames { + return []ComponentNames{MicrosoftWindowsShellSetup} +} + +// ContainerServiceOrchestratorTypes enumerates the values for container service orchestrator types. +type ContainerServiceOrchestratorTypes string + +const ( + // Custom ... + Custom ContainerServiceOrchestratorTypes = "Custom" + // DCOS ... + DCOS ContainerServiceOrchestratorTypes = "DCOS" + // Kubernetes ... + Kubernetes ContainerServiceOrchestratorTypes = "Kubernetes" + // Swarm ... + Swarm ContainerServiceOrchestratorTypes = "Swarm" +) + +// PossibleContainerServiceOrchestratorTypesValues returns an array of possible values for the ContainerServiceOrchestratorTypes const type. +func PossibleContainerServiceOrchestratorTypesValues() []ContainerServiceOrchestratorTypes { + return []ContainerServiceOrchestratorTypes{Custom, DCOS, Kubernetes, Swarm} +} + +// ContainerServiceVMSizeTypes enumerates the values for container service vm size types. +type ContainerServiceVMSizeTypes string + +const ( + // StandardA0 ... + StandardA0 ContainerServiceVMSizeTypes = "Standard_A0" + // StandardA1 ... + StandardA1 ContainerServiceVMSizeTypes = "Standard_A1" + // StandardA10 ... + StandardA10 ContainerServiceVMSizeTypes = "Standard_A10" + // StandardA11 ... + StandardA11 ContainerServiceVMSizeTypes = "Standard_A11" + // StandardA2 ... + StandardA2 ContainerServiceVMSizeTypes = "Standard_A2" + // StandardA3 ... + StandardA3 ContainerServiceVMSizeTypes = "Standard_A3" + // StandardA4 ... + StandardA4 ContainerServiceVMSizeTypes = "Standard_A4" + // StandardA5 ... + StandardA5 ContainerServiceVMSizeTypes = "Standard_A5" + // StandardA6 ... + StandardA6 ContainerServiceVMSizeTypes = "Standard_A6" + // StandardA7 ... + StandardA7 ContainerServiceVMSizeTypes = "Standard_A7" + // StandardA8 ... + StandardA8 ContainerServiceVMSizeTypes = "Standard_A8" + // StandardA9 ... + StandardA9 ContainerServiceVMSizeTypes = "Standard_A9" + // StandardD1 ... + StandardD1 ContainerServiceVMSizeTypes = "Standard_D1" + // StandardD11 ... + StandardD11 ContainerServiceVMSizeTypes = "Standard_D11" + // StandardD11V2 ... + StandardD11V2 ContainerServiceVMSizeTypes = "Standard_D11_v2" + // StandardD12 ... + StandardD12 ContainerServiceVMSizeTypes = "Standard_D12" + // StandardD12V2 ... + StandardD12V2 ContainerServiceVMSizeTypes = "Standard_D12_v2" + // StandardD13 ... + StandardD13 ContainerServiceVMSizeTypes = "Standard_D13" + // StandardD13V2 ... + StandardD13V2 ContainerServiceVMSizeTypes = "Standard_D13_v2" + // StandardD14 ... + StandardD14 ContainerServiceVMSizeTypes = "Standard_D14" + // StandardD14V2 ... + StandardD14V2 ContainerServiceVMSizeTypes = "Standard_D14_v2" + // StandardD1V2 ... + StandardD1V2 ContainerServiceVMSizeTypes = "Standard_D1_v2" + // StandardD2 ... + StandardD2 ContainerServiceVMSizeTypes = "Standard_D2" + // StandardD2V2 ... + StandardD2V2 ContainerServiceVMSizeTypes = "Standard_D2_v2" + // StandardD3 ... + StandardD3 ContainerServiceVMSizeTypes = "Standard_D3" + // StandardD3V2 ... + StandardD3V2 ContainerServiceVMSizeTypes = "Standard_D3_v2" + // StandardD4 ... + StandardD4 ContainerServiceVMSizeTypes = "Standard_D4" + // StandardD4V2 ... + StandardD4V2 ContainerServiceVMSizeTypes = "Standard_D4_v2" + // StandardD5V2 ... + StandardD5V2 ContainerServiceVMSizeTypes = "Standard_D5_v2" + // StandardDS1 ... + StandardDS1 ContainerServiceVMSizeTypes = "Standard_DS1" + // StandardDS11 ... + StandardDS11 ContainerServiceVMSizeTypes = "Standard_DS11" + // StandardDS12 ... + StandardDS12 ContainerServiceVMSizeTypes = "Standard_DS12" + // StandardDS13 ... + StandardDS13 ContainerServiceVMSizeTypes = "Standard_DS13" + // StandardDS14 ... + StandardDS14 ContainerServiceVMSizeTypes = "Standard_DS14" + // StandardDS2 ... + StandardDS2 ContainerServiceVMSizeTypes = "Standard_DS2" + // StandardDS3 ... + StandardDS3 ContainerServiceVMSizeTypes = "Standard_DS3" + // StandardDS4 ... + StandardDS4 ContainerServiceVMSizeTypes = "Standard_DS4" + // StandardG1 ... + StandardG1 ContainerServiceVMSizeTypes = "Standard_G1" + // StandardG2 ... + StandardG2 ContainerServiceVMSizeTypes = "Standard_G2" + // StandardG3 ... + StandardG3 ContainerServiceVMSizeTypes = "Standard_G3" + // StandardG4 ... + StandardG4 ContainerServiceVMSizeTypes = "Standard_G4" + // StandardG5 ... + StandardG5 ContainerServiceVMSizeTypes = "Standard_G5" + // StandardGS1 ... + StandardGS1 ContainerServiceVMSizeTypes = "Standard_GS1" + // StandardGS2 ... + StandardGS2 ContainerServiceVMSizeTypes = "Standard_GS2" + // StandardGS3 ... + StandardGS3 ContainerServiceVMSizeTypes = "Standard_GS3" + // StandardGS4 ... + StandardGS4 ContainerServiceVMSizeTypes = "Standard_GS4" + // StandardGS5 ... + StandardGS5 ContainerServiceVMSizeTypes = "Standard_GS5" +) + +// PossibleContainerServiceVMSizeTypesValues returns an array of possible values for the ContainerServiceVMSizeTypes const type. +func PossibleContainerServiceVMSizeTypesValues() []ContainerServiceVMSizeTypes { + return []ContainerServiceVMSizeTypes{StandardA0, StandardA1, StandardA10, StandardA11, StandardA2, StandardA3, StandardA4, StandardA5, StandardA6, StandardA7, StandardA8, StandardA9, StandardD1, StandardD11, StandardD11V2, StandardD12, StandardD12V2, StandardD13, StandardD13V2, StandardD14, StandardD14V2, StandardD1V2, StandardD2, StandardD2V2, StandardD3, StandardD3V2, StandardD4, StandardD4V2, StandardD5V2, StandardDS1, StandardDS11, StandardDS12, StandardDS13, StandardDS14, StandardDS2, StandardDS3, StandardDS4, StandardG1, StandardG2, StandardG3, StandardG4, StandardG5, StandardGS1, StandardGS2, StandardGS3, StandardGS4, StandardGS5} +} + +// DiffDiskOptions enumerates the values for diff disk options. +type DiffDiskOptions string + +const ( + // Local ... + Local DiffDiskOptions = "Local" +) + +// PossibleDiffDiskOptionsValues returns an array of possible values for the DiffDiskOptions const type. +func PossibleDiffDiskOptionsValues() []DiffDiskOptions { + return []DiffDiskOptions{Local} +} + +// DiskCreateOption enumerates the values for disk create option. +type DiskCreateOption string + +const ( + // Attach ... + Attach DiskCreateOption = "Attach" + // Copy ... + Copy DiskCreateOption = "Copy" + // Empty ... + Empty DiskCreateOption = "Empty" + // FromImage ... + FromImage DiskCreateOption = "FromImage" + // Import ... + Import DiskCreateOption = "Import" + // Restore ... + Restore DiskCreateOption = "Restore" + // Upload ... + Upload DiskCreateOption = "Upload" +) + +// PossibleDiskCreateOptionValues returns an array of possible values for the DiskCreateOption const type. +func PossibleDiskCreateOptionValues() []DiskCreateOption { + return []DiskCreateOption{Attach, Copy, Empty, FromImage, Import, Restore, Upload} +} + +// DiskCreateOptionTypes enumerates the values for disk create option types. +type DiskCreateOptionTypes string + +const ( + // DiskCreateOptionTypesAttach ... + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + // DiskCreateOptionTypesEmpty ... + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + // DiskCreateOptionTypesFromImage ... + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" +) + +// PossibleDiskCreateOptionTypesValues returns an array of possible values for the DiskCreateOptionTypes const type. +func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes { + return []DiskCreateOptionTypes{DiskCreateOptionTypesAttach, DiskCreateOptionTypesEmpty, DiskCreateOptionTypesFromImage} +} + +// DiskState enumerates the values for disk state. +type DiskState string + +const ( + // ActiveSAS ... + ActiveSAS DiskState = "ActiveSAS" + // ActiveUpload ... + ActiveUpload DiskState = "ActiveUpload" + // Attached ... + Attached DiskState = "Attached" + // ReadyToUpload ... + ReadyToUpload DiskState = "ReadyToUpload" + // Reserved ... + Reserved DiskState = "Reserved" + // Unattached ... + Unattached DiskState = "Unattached" +) + +// PossibleDiskStateValues returns an array of possible values for the DiskState const type. +func PossibleDiskStateValues() []DiskState { + return []DiskState{ActiveSAS, ActiveUpload, Attached, ReadyToUpload, Reserved, Unattached} +} + +// DiskStorageAccountTypes enumerates the values for disk storage account types. +type DiskStorageAccountTypes string + +const ( + // PremiumLRS ... + PremiumLRS DiskStorageAccountTypes = "Premium_LRS" + // StandardLRS ... + StandardLRS DiskStorageAccountTypes = "Standard_LRS" + // StandardSSDLRS ... + StandardSSDLRS DiskStorageAccountTypes = "StandardSSD_LRS" + // UltraSSDLRS ... + UltraSSDLRS DiskStorageAccountTypes = "UltraSSD_LRS" +) + +// PossibleDiskStorageAccountTypesValues returns an array of possible values for the DiskStorageAccountTypes const type. +func PossibleDiskStorageAccountTypesValues() []DiskStorageAccountTypes { + return []DiskStorageAccountTypes{PremiumLRS, StandardLRS, StandardSSDLRS, UltraSSDLRS} +} + +// HostCaching enumerates the values for host caching. +type HostCaching string + +const ( + // HostCachingNone ... + HostCachingNone HostCaching = "None" + // HostCachingReadOnly ... + HostCachingReadOnly HostCaching = "ReadOnly" + // HostCachingReadWrite ... + HostCachingReadWrite HostCaching = "ReadWrite" +) + +// PossibleHostCachingValues returns an array of possible values for the HostCaching const type. +func PossibleHostCachingValues() []HostCaching { + return []HostCaching{HostCachingNone, HostCachingReadOnly, HostCachingReadWrite} +} + +// HyperVGeneration enumerates the values for hyper v generation. +type HyperVGeneration string + +const ( + // V1 ... + V1 HyperVGeneration = "V1" + // V2 ... + V2 HyperVGeneration = "V2" +) + +// PossibleHyperVGenerationValues returns an array of possible values for the HyperVGeneration const type. +func PossibleHyperVGenerationValues() []HyperVGeneration { + return []HyperVGeneration{V1, V2} +} + +// HyperVGenerationTypes enumerates the values for hyper v generation types. +type HyperVGenerationTypes string + +const ( + // HyperVGenerationTypesV1 ... + HyperVGenerationTypesV1 HyperVGenerationTypes = "V1" + // HyperVGenerationTypesV2 ... + HyperVGenerationTypesV2 HyperVGenerationTypes = "V2" +) + +// PossibleHyperVGenerationTypesValues returns an array of possible values for the HyperVGenerationTypes const type. +func PossibleHyperVGenerationTypesValues() []HyperVGenerationTypes { + return []HyperVGenerationTypes{HyperVGenerationTypesV1, HyperVGenerationTypesV2} +} + +// InstanceViewTypes enumerates the values for instance view types. +type InstanceViewTypes string + +const ( + // InstanceView ... + InstanceView InstanceViewTypes = "instanceView" +) + +// PossibleInstanceViewTypesValues returns an array of possible values for the InstanceViewTypes const type. +func PossibleInstanceViewTypesValues() []InstanceViewTypes { + return []InstanceViewTypes{InstanceView} +} + +// IntervalInMins enumerates the values for interval in mins. +type IntervalInMins string + +const ( + // FiveMins ... + FiveMins IntervalInMins = "FiveMins" + // SixtyMins ... + SixtyMins IntervalInMins = "SixtyMins" + // ThirtyMins ... + ThirtyMins IntervalInMins = "ThirtyMins" + // ThreeMins ... + ThreeMins IntervalInMins = "ThreeMins" +) + +// PossibleIntervalInMinsValues returns an array of possible values for the IntervalInMins const type. +func PossibleIntervalInMinsValues() []IntervalInMins { + return []IntervalInMins{FiveMins, SixtyMins, ThirtyMins, ThreeMins} +} + +// IPVersion enumerates the values for ip version. +type IPVersion string + +const ( + // IPv4 ... + IPv4 IPVersion = "IPv4" + // IPv6 ... + IPv6 IPVersion = "IPv6" +) + +// PossibleIPVersionValues returns an array of possible values for the IPVersion const type. +func PossibleIPVersionValues() []IPVersion { + return []IPVersion{IPv4, IPv6} +} + +// MaintenanceOperationResultCodeTypes enumerates the values for maintenance operation result code types. +type MaintenanceOperationResultCodeTypes string + +const ( + // MaintenanceOperationResultCodeTypesMaintenanceAborted ... + MaintenanceOperationResultCodeTypesMaintenanceAborted MaintenanceOperationResultCodeTypes = "MaintenanceAborted" + // MaintenanceOperationResultCodeTypesMaintenanceCompleted ... + MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted" + // MaintenanceOperationResultCodeTypesNone ... + MaintenanceOperationResultCodeTypesNone MaintenanceOperationResultCodeTypes = "None" + // MaintenanceOperationResultCodeTypesRetryLater ... + MaintenanceOperationResultCodeTypesRetryLater MaintenanceOperationResultCodeTypes = "RetryLater" +) + +// PossibleMaintenanceOperationResultCodeTypesValues returns an array of possible values for the MaintenanceOperationResultCodeTypes const type. +func PossibleMaintenanceOperationResultCodeTypesValues() []MaintenanceOperationResultCodeTypes { + return []MaintenanceOperationResultCodeTypes{MaintenanceOperationResultCodeTypesMaintenanceAborted, MaintenanceOperationResultCodeTypesMaintenanceCompleted, MaintenanceOperationResultCodeTypesNone, MaintenanceOperationResultCodeTypesRetryLater} +} + +// OperatingSystemStateTypes enumerates the values for operating system state types. +type OperatingSystemStateTypes string + +const ( + // Generalized ... + Generalized OperatingSystemStateTypes = "Generalized" + // Specialized ... + Specialized OperatingSystemStateTypes = "Specialized" +) + +// PossibleOperatingSystemStateTypesValues returns an array of possible values for the OperatingSystemStateTypes const type. +func PossibleOperatingSystemStateTypesValues() []OperatingSystemStateTypes { + return []OperatingSystemStateTypes{Generalized, Specialized} +} + +// OperatingSystemTypes enumerates the values for operating system types. +type OperatingSystemTypes string + +const ( + // Linux ... + Linux OperatingSystemTypes = "Linux" + // Windows ... + Windows OperatingSystemTypes = "Windows" +) + +// PossibleOperatingSystemTypesValues returns an array of possible values for the OperatingSystemTypes const type. +func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { + return []OperatingSystemTypes{Linux, Windows} +} + +// PassNames enumerates the values for pass names. +type PassNames string + +const ( + // OobeSystem ... + OobeSystem PassNames = "OobeSystem" +) + +// PossiblePassNamesValues returns an array of possible values for the PassNames const type. +func PossiblePassNamesValues() []PassNames { + return []PassNames{OobeSystem} +} + +// ProtocolTypes enumerates the values for protocol types. +type ProtocolTypes string + +const ( + // HTTP ... + HTTP ProtocolTypes = "Http" + // HTTPS ... + HTTPS ProtocolTypes = "Https" +) + +// PossibleProtocolTypesValues returns an array of possible values for the ProtocolTypes const type. +func PossibleProtocolTypesValues() []ProtocolTypes { + return []ProtocolTypes{HTTP, HTTPS} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMigrating ... + ProvisioningStateMigrating ProvisioningState = "Migrating" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMigrating, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ProvisioningState1 enumerates the values for provisioning state 1. +type ProvisioningState1 string + +const ( + // ProvisioningState1Creating ... + ProvisioningState1Creating ProvisioningState1 = "Creating" + // ProvisioningState1Deleting ... + ProvisioningState1Deleting ProvisioningState1 = "Deleting" + // ProvisioningState1Failed ... + ProvisioningState1Failed ProvisioningState1 = "Failed" + // ProvisioningState1Migrating ... + ProvisioningState1Migrating ProvisioningState1 = "Migrating" + // ProvisioningState1Succeeded ... + ProvisioningState1Succeeded ProvisioningState1 = "Succeeded" + // ProvisioningState1Updating ... + ProvisioningState1Updating ProvisioningState1 = "Updating" +) + +// PossibleProvisioningState1Values returns an array of possible values for the ProvisioningState1 const type. +func PossibleProvisioningState1Values() []ProvisioningState1 { + return []ProvisioningState1{ProvisioningState1Creating, ProvisioningState1Deleting, ProvisioningState1Failed, ProvisioningState1Migrating, ProvisioningState1Succeeded, ProvisioningState1Updating} +} + +// ProvisioningState2 enumerates the values for provisioning state 2. +type ProvisioningState2 string + +const ( + // ProvisioningState2Creating ... + ProvisioningState2Creating ProvisioningState2 = "Creating" + // ProvisioningState2Deleting ... + ProvisioningState2Deleting ProvisioningState2 = "Deleting" + // ProvisioningState2Failed ... + ProvisioningState2Failed ProvisioningState2 = "Failed" + // ProvisioningState2Migrating ... + ProvisioningState2Migrating ProvisioningState2 = "Migrating" + // ProvisioningState2Succeeded ... + ProvisioningState2Succeeded ProvisioningState2 = "Succeeded" + // ProvisioningState2Updating ... + ProvisioningState2Updating ProvisioningState2 = "Updating" +) + +// PossibleProvisioningState2Values returns an array of possible values for the ProvisioningState2 const type. +func PossibleProvisioningState2Values() []ProvisioningState2 { + return []ProvisioningState2{ProvisioningState2Creating, ProvisioningState2Deleting, ProvisioningState2Failed, ProvisioningState2Migrating, ProvisioningState2Succeeded, ProvisioningState2Updating} +} + +// ProximityPlacementGroupType enumerates the values for proximity placement group type. +type ProximityPlacementGroupType string + +const ( + // Standard ... + Standard ProximityPlacementGroupType = "Standard" + // Ultra ... + Ultra ProximityPlacementGroupType = "Ultra" +) + +// PossibleProximityPlacementGroupTypeValues returns an array of possible values for the ProximityPlacementGroupType const type. +func PossibleProximityPlacementGroupTypeValues() []ProximityPlacementGroupType { + return []ProximityPlacementGroupType{Standard, Ultra} +} + +// ReplicationState enumerates the values for replication state. +type ReplicationState string + +const ( + // ReplicationStateCompleted ... + ReplicationStateCompleted ReplicationState = "Completed" + // ReplicationStateFailed ... + ReplicationStateFailed ReplicationState = "Failed" + // ReplicationStateReplicating ... + ReplicationStateReplicating ReplicationState = "Replicating" + // ReplicationStateUnknown ... + ReplicationStateUnknown ReplicationState = "Unknown" +) + +// PossibleReplicationStateValues returns an array of possible values for the ReplicationState const type. +func PossibleReplicationStateValues() []ReplicationState { + return []ReplicationState{ReplicationStateCompleted, ReplicationStateFailed, ReplicationStateReplicating, ReplicationStateUnknown} +} + +// ReplicationStatusTypes enumerates the values for replication status types. +type ReplicationStatusTypes string + +const ( + // ReplicationStatusTypesReplicationStatus ... + ReplicationStatusTypesReplicationStatus ReplicationStatusTypes = "ReplicationStatus" +) + +// PossibleReplicationStatusTypesValues returns an array of possible values for the ReplicationStatusTypes const type. +func PossibleReplicationStatusTypesValues() []ReplicationStatusTypes { + return []ReplicationStatusTypes{ReplicationStatusTypesReplicationStatus} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone ... + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned ... + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeSystemAssignedUserAssigned ... + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + // ResourceIdentityTypeUserAssigned ... + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} +} + +// ResourceSkuCapacityScaleType enumerates the values for resource sku capacity scale type. +type ResourceSkuCapacityScaleType string + +const ( + // ResourceSkuCapacityScaleTypeAutomatic ... + ResourceSkuCapacityScaleTypeAutomatic ResourceSkuCapacityScaleType = "Automatic" + // ResourceSkuCapacityScaleTypeManual ... + ResourceSkuCapacityScaleTypeManual ResourceSkuCapacityScaleType = "Manual" + // ResourceSkuCapacityScaleTypeNone ... + ResourceSkuCapacityScaleTypeNone ResourceSkuCapacityScaleType = "None" +) + +// PossibleResourceSkuCapacityScaleTypeValues returns an array of possible values for the ResourceSkuCapacityScaleType const type. +func PossibleResourceSkuCapacityScaleTypeValues() []ResourceSkuCapacityScaleType { + return []ResourceSkuCapacityScaleType{ResourceSkuCapacityScaleTypeAutomatic, ResourceSkuCapacityScaleTypeManual, ResourceSkuCapacityScaleTypeNone} +} + +// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. +type ResourceSkuRestrictionsReasonCode string + +const ( + // NotAvailableForSubscription ... + NotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" + // QuotaID ... + QuotaID ResourceSkuRestrictionsReasonCode = "QuotaId" +) + +// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type. +func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode { + return []ResourceSkuRestrictionsReasonCode{NotAvailableForSubscription, QuotaID} +} + +// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type. +type ResourceSkuRestrictionsType string + +const ( + // Location ... + Location ResourceSkuRestrictionsType = "Location" + // Zone ... + Zone ResourceSkuRestrictionsType = "Zone" +) + +// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type. +func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType { + return []ResourceSkuRestrictionsType{Location, Zone} +} + +// RollingUpgradeActionType enumerates the values for rolling upgrade action type. +type RollingUpgradeActionType string + +const ( + // Cancel ... + Cancel RollingUpgradeActionType = "Cancel" + // Start ... + Start RollingUpgradeActionType = "Start" +) + +// PossibleRollingUpgradeActionTypeValues returns an array of possible values for the RollingUpgradeActionType const type. +func PossibleRollingUpgradeActionTypeValues() []RollingUpgradeActionType { + return []RollingUpgradeActionType{Cancel, Start} +} + +// RollingUpgradeStatusCode enumerates the values for rolling upgrade status code. +type RollingUpgradeStatusCode string + +const ( + // RollingUpgradeStatusCodeCancelled ... + RollingUpgradeStatusCodeCancelled RollingUpgradeStatusCode = "Cancelled" + // RollingUpgradeStatusCodeCompleted ... + RollingUpgradeStatusCodeCompleted RollingUpgradeStatusCode = "Completed" + // RollingUpgradeStatusCodeFaulted ... + RollingUpgradeStatusCodeFaulted RollingUpgradeStatusCode = "Faulted" + // RollingUpgradeStatusCodeRollingForward ... + RollingUpgradeStatusCodeRollingForward RollingUpgradeStatusCode = "RollingForward" +) + +// PossibleRollingUpgradeStatusCodeValues returns an array of possible values for the RollingUpgradeStatusCode const type. +func PossibleRollingUpgradeStatusCodeValues() []RollingUpgradeStatusCode { + return []RollingUpgradeStatusCode{RollingUpgradeStatusCodeCancelled, RollingUpgradeStatusCodeCompleted, RollingUpgradeStatusCodeFaulted, RollingUpgradeStatusCodeRollingForward} +} + +// SettingNames enumerates the values for setting names. +type SettingNames string + +const ( + // AutoLogon ... + AutoLogon SettingNames = "AutoLogon" + // FirstLogonCommands ... + FirstLogonCommands SettingNames = "FirstLogonCommands" +) + +// PossibleSettingNamesValues returns an array of possible values for the SettingNames const type. +func PossibleSettingNamesValues() []SettingNames { + return []SettingNames{AutoLogon, FirstLogonCommands} +} + +// SnapshotStorageAccountTypes enumerates the values for snapshot storage account types. +type SnapshotStorageAccountTypes string + +const ( + // SnapshotStorageAccountTypesPremiumLRS ... + SnapshotStorageAccountTypesPremiumLRS SnapshotStorageAccountTypes = "Premium_LRS" + // SnapshotStorageAccountTypesStandardLRS ... + SnapshotStorageAccountTypesStandardLRS SnapshotStorageAccountTypes = "Standard_LRS" + // SnapshotStorageAccountTypesStandardZRS ... + SnapshotStorageAccountTypesStandardZRS SnapshotStorageAccountTypes = "Standard_ZRS" +) + +// PossibleSnapshotStorageAccountTypesValues returns an array of possible values for the SnapshotStorageAccountTypes const type. +func PossibleSnapshotStorageAccountTypesValues() []SnapshotStorageAccountTypes { + return []SnapshotStorageAccountTypes{SnapshotStorageAccountTypesPremiumLRS, SnapshotStorageAccountTypesStandardLRS, SnapshotStorageAccountTypesStandardZRS} +} + +// StatusLevelTypes enumerates the values for status level types. +type StatusLevelTypes string + +const ( + // Error ... + Error StatusLevelTypes = "Error" + // Info ... + Info StatusLevelTypes = "Info" + // Warning ... + Warning StatusLevelTypes = "Warning" +) + +// PossibleStatusLevelTypesValues returns an array of possible values for the StatusLevelTypes const type. +func PossibleStatusLevelTypesValues() []StatusLevelTypes { + return []StatusLevelTypes{Error, Info, Warning} +} + +// StorageAccountType enumerates the values for storage account type. +type StorageAccountType string + +const ( + // StorageAccountTypeStandardLRS ... + StorageAccountTypeStandardLRS StorageAccountType = "Standard_LRS" + // StorageAccountTypeStandardZRS ... + StorageAccountTypeStandardZRS StorageAccountType = "Standard_ZRS" +) + +// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. +func PossibleStorageAccountTypeValues() []StorageAccountType { + return []StorageAccountType{StorageAccountTypeStandardLRS, StorageAccountTypeStandardZRS} +} + +// StorageAccountTypes enumerates the values for storage account types. +type StorageAccountTypes string + +const ( + // StorageAccountTypesPremiumLRS ... + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + // StorageAccountTypesStandardLRS ... + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + // StorageAccountTypesStandardSSDLRS ... + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + // StorageAccountTypesUltraSSDLRS ... + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +// PossibleStorageAccountTypesValues returns an array of possible values for the StorageAccountTypes const type. +func PossibleStorageAccountTypesValues() []StorageAccountTypes { + return []StorageAccountTypes{StorageAccountTypesPremiumLRS, StorageAccountTypesStandardLRS, StorageAccountTypesStandardSSDLRS, StorageAccountTypesUltraSSDLRS} +} + +// UpgradeMode enumerates the values for upgrade mode. +type UpgradeMode string + +const ( + // Automatic ... + Automatic UpgradeMode = "Automatic" + // Manual ... + Manual UpgradeMode = "Manual" + // Rolling ... + Rolling UpgradeMode = "Rolling" +) + +// PossibleUpgradeModeValues returns an array of possible values for the UpgradeMode const type. +func PossibleUpgradeModeValues() []UpgradeMode { + return []UpgradeMode{Automatic, Manual, Rolling} +} + +// UpgradeOperationInvoker enumerates the values for upgrade operation invoker. +type UpgradeOperationInvoker string + +const ( + // UpgradeOperationInvokerPlatform ... + UpgradeOperationInvokerPlatform UpgradeOperationInvoker = "Platform" + // UpgradeOperationInvokerUnknown ... + UpgradeOperationInvokerUnknown UpgradeOperationInvoker = "Unknown" + // UpgradeOperationInvokerUser ... + UpgradeOperationInvokerUser UpgradeOperationInvoker = "User" +) + +// PossibleUpgradeOperationInvokerValues returns an array of possible values for the UpgradeOperationInvoker const type. +func PossibleUpgradeOperationInvokerValues() []UpgradeOperationInvoker { + return []UpgradeOperationInvoker{UpgradeOperationInvokerPlatform, UpgradeOperationInvokerUnknown, UpgradeOperationInvokerUser} +} + +// UpgradeState enumerates the values for upgrade state. +type UpgradeState string + +const ( + // UpgradeStateCancelled ... + UpgradeStateCancelled UpgradeState = "Cancelled" + // UpgradeStateCompleted ... + UpgradeStateCompleted UpgradeState = "Completed" + // UpgradeStateFaulted ... + UpgradeStateFaulted UpgradeState = "Faulted" + // UpgradeStateRollingForward ... + UpgradeStateRollingForward UpgradeState = "RollingForward" +) + +// PossibleUpgradeStateValues returns an array of possible values for the UpgradeState const type. +func PossibleUpgradeStateValues() []UpgradeState { + return []UpgradeState{UpgradeStateCancelled, UpgradeStateCompleted, UpgradeStateFaulted, UpgradeStateRollingForward} +} + +// VirtualMachineEvictionPolicyTypes enumerates the values for virtual machine eviction policy types. +type VirtualMachineEvictionPolicyTypes string + +const ( + // Deallocate ... + Deallocate VirtualMachineEvictionPolicyTypes = "Deallocate" + // Delete ... + Delete VirtualMachineEvictionPolicyTypes = "Delete" +) + +// PossibleVirtualMachineEvictionPolicyTypesValues returns an array of possible values for the VirtualMachineEvictionPolicyTypes const type. +func PossibleVirtualMachineEvictionPolicyTypesValues() []VirtualMachineEvictionPolicyTypes { + return []VirtualMachineEvictionPolicyTypes{Deallocate, Delete} +} + +// VirtualMachinePriorityTypes enumerates the values for virtual machine priority types. +type VirtualMachinePriorityTypes string + +const ( + // Low ... + Low VirtualMachinePriorityTypes = "Low" + // Regular ... + Regular VirtualMachinePriorityTypes = "Regular" +) + +// PossibleVirtualMachinePriorityTypesValues returns an array of possible values for the VirtualMachinePriorityTypes const type. +func PossibleVirtualMachinePriorityTypesValues() []VirtualMachinePriorityTypes { + return []VirtualMachinePriorityTypes{Low, Regular} +} + +// VirtualMachineScaleSetSkuScaleType enumerates the values for virtual machine scale set sku scale type. +type VirtualMachineScaleSetSkuScaleType string + +const ( + // VirtualMachineScaleSetSkuScaleTypeAutomatic ... + VirtualMachineScaleSetSkuScaleTypeAutomatic VirtualMachineScaleSetSkuScaleType = "Automatic" + // VirtualMachineScaleSetSkuScaleTypeNone ... + VirtualMachineScaleSetSkuScaleTypeNone VirtualMachineScaleSetSkuScaleType = "None" +) + +// PossibleVirtualMachineScaleSetSkuScaleTypeValues returns an array of possible values for the VirtualMachineScaleSetSkuScaleType const type. +func PossibleVirtualMachineScaleSetSkuScaleTypeValues() []VirtualMachineScaleSetSkuScaleType { + return []VirtualMachineScaleSetSkuScaleType{VirtualMachineScaleSetSkuScaleTypeAutomatic, VirtualMachineScaleSetSkuScaleTypeNone} +} + +// VirtualMachineSizeTypes enumerates the values for virtual machine size types. +type VirtualMachineSizeTypes string + +const ( + // VirtualMachineSizeTypesBasicA0 ... + VirtualMachineSizeTypesBasicA0 VirtualMachineSizeTypes = "Basic_A0" + // VirtualMachineSizeTypesBasicA1 ... + VirtualMachineSizeTypesBasicA1 VirtualMachineSizeTypes = "Basic_A1" + // VirtualMachineSizeTypesBasicA2 ... + VirtualMachineSizeTypesBasicA2 VirtualMachineSizeTypes = "Basic_A2" + // VirtualMachineSizeTypesBasicA3 ... + VirtualMachineSizeTypesBasicA3 VirtualMachineSizeTypes = "Basic_A3" + // VirtualMachineSizeTypesBasicA4 ... + VirtualMachineSizeTypesBasicA4 VirtualMachineSizeTypes = "Basic_A4" + // VirtualMachineSizeTypesStandardA0 ... + VirtualMachineSizeTypesStandardA0 VirtualMachineSizeTypes = "Standard_A0" + // VirtualMachineSizeTypesStandardA1 ... + VirtualMachineSizeTypesStandardA1 VirtualMachineSizeTypes = "Standard_A1" + // VirtualMachineSizeTypesStandardA10 ... + VirtualMachineSizeTypesStandardA10 VirtualMachineSizeTypes = "Standard_A10" + // VirtualMachineSizeTypesStandardA11 ... + VirtualMachineSizeTypesStandardA11 VirtualMachineSizeTypes = "Standard_A11" + // VirtualMachineSizeTypesStandardA1V2 ... + VirtualMachineSizeTypesStandardA1V2 VirtualMachineSizeTypes = "Standard_A1_v2" + // VirtualMachineSizeTypesStandardA2 ... + VirtualMachineSizeTypesStandardA2 VirtualMachineSizeTypes = "Standard_A2" + // VirtualMachineSizeTypesStandardA2mV2 ... + VirtualMachineSizeTypesStandardA2mV2 VirtualMachineSizeTypes = "Standard_A2m_v2" + // VirtualMachineSizeTypesStandardA2V2 ... + VirtualMachineSizeTypesStandardA2V2 VirtualMachineSizeTypes = "Standard_A2_v2" + // VirtualMachineSizeTypesStandardA3 ... + VirtualMachineSizeTypesStandardA3 VirtualMachineSizeTypes = "Standard_A3" + // VirtualMachineSizeTypesStandardA4 ... + VirtualMachineSizeTypesStandardA4 VirtualMachineSizeTypes = "Standard_A4" + // VirtualMachineSizeTypesStandardA4mV2 ... + VirtualMachineSizeTypesStandardA4mV2 VirtualMachineSizeTypes = "Standard_A4m_v2" + // VirtualMachineSizeTypesStandardA4V2 ... + VirtualMachineSizeTypesStandardA4V2 VirtualMachineSizeTypes = "Standard_A4_v2" + // VirtualMachineSizeTypesStandardA5 ... + VirtualMachineSizeTypesStandardA5 VirtualMachineSizeTypes = "Standard_A5" + // VirtualMachineSizeTypesStandardA6 ... + VirtualMachineSizeTypesStandardA6 VirtualMachineSizeTypes = "Standard_A6" + // VirtualMachineSizeTypesStandardA7 ... + VirtualMachineSizeTypesStandardA7 VirtualMachineSizeTypes = "Standard_A7" + // VirtualMachineSizeTypesStandardA8 ... + VirtualMachineSizeTypesStandardA8 VirtualMachineSizeTypes = "Standard_A8" + // VirtualMachineSizeTypesStandardA8mV2 ... + VirtualMachineSizeTypesStandardA8mV2 VirtualMachineSizeTypes = "Standard_A8m_v2" + // VirtualMachineSizeTypesStandardA8V2 ... + VirtualMachineSizeTypesStandardA8V2 VirtualMachineSizeTypes = "Standard_A8_v2" + // VirtualMachineSizeTypesStandardA9 ... + VirtualMachineSizeTypesStandardA9 VirtualMachineSizeTypes = "Standard_A9" + // VirtualMachineSizeTypesStandardB1ms ... + VirtualMachineSizeTypesStandardB1ms VirtualMachineSizeTypes = "Standard_B1ms" + // VirtualMachineSizeTypesStandardB1s ... + VirtualMachineSizeTypesStandardB1s VirtualMachineSizeTypes = "Standard_B1s" + // VirtualMachineSizeTypesStandardB2ms ... + VirtualMachineSizeTypesStandardB2ms VirtualMachineSizeTypes = "Standard_B2ms" + // VirtualMachineSizeTypesStandardB2s ... + VirtualMachineSizeTypesStandardB2s VirtualMachineSizeTypes = "Standard_B2s" + // VirtualMachineSizeTypesStandardB4ms ... + VirtualMachineSizeTypesStandardB4ms VirtualMachineSizeTypes = "Standard_B4ms" + // VirtualMachineSizeTypesStandardB8ms ... + VirtualMachineSizeTypesStandardB8ms VirtualMachineSizeTypes = "Standard_B8ms" + // VirtualMachineSizeTypesStandardD1 ... + VirtualMachineSizeTypesStandardD1 VirtualMachineSizeTypes = "Standard_D1" + // VirtualMachineSizeTypesStandardD11 ... + VirtualMachineSizeTypesStandardD11 VirtualMachineSizeTypes = "Standard_D11" + // VirtualMachineSizeTypesStandardD11V2 ... + VirtualMachineSizeTypesStandardD11V2 VirtualMachineSizeTypes = "Standard_D11_v2" + // VirtualMachineSizeTypesStandardD12 ... + VirtualMachineSizeTypesStandardD12 VirtualMachineSizeTypes = "Standard_D12" + // VirtualMachineSizeTypesStandardD12V2 ... + VirtualMachineSizeTypesStandardD12V2 VirtualMachineSizeTypes = "Standard_D12_v2" + // VirtualMachineSizeTypesStandardD13 ... + VirtualMachineSizeTypesStandardD13 VirtualMachineSizeTypes = "Standard_D13" + // VirtualMachineSizeTypesStandardD13V2 ... + VirtualMachineSizeTypesStandardD13V2 VirtualMachineSizeTypes = "Standard_D13_v2" + // VirtualMachineSizeTypesStandardD14 ... + VirtualMachineSizeTypesStandardD14 VirtualMachineSizeTypes = "Standard_D14" + // VirtualMachineSizeTypesStandardD14V2 ... + VirtualMachineSizeTypesStandardD14V2 VirtualMachineSizeTypes = "Standard_D14_v2" + // VirtualMachineSizeTypesStandardD15V2 ... + VirtualMachineSizeTypesStandardD15V2 VirtualMachineSizeTypes = "Standard_D15_v2" + // VirtualMachineSizeTypesStandardD16sV3 ... + VirtualMachineSizeTypesStandardD16sV3 VirtualMachineSizeTypes = "Standard_D16s_v3" + // VirtualMachineSizeTypesStandardD16V3 ... + VirtualMachineSizeTypesStandardD16V3 VirtualMachineSizeTypes = "Standard_D16_v3" + // VirtualMachineSizeTypesStandardD1V2 ... + VirtualMachineSizeTypesStandardD1V2 VirtualMachineSizeTypes = "Standard_D1_v2" + // VirtualMachineSizeTypesStandardD2 ... + VirtualMachineSizeTypesStandardD2 VirtualMachineSizeTypes = "Standard_D2" + // VirtualMachineSizeTypesStandardD2sV3 ... + VirtualMachineSizeTypesStandardD2sV3 VirtualMachineSizeTypes = "Standard_D2s_v3" + // VirtualMachineSizeTypesStandardD2V2 ... + VirtualMachineSizeTypesStandardD2V2 VirtualMachineSizeTypes = "Standard_D2_v2" + // VirtualMachineSizeTypesStandardD2V3 ... + VirtualMachineSizeTypesStandardD2V3 VirtualMachineSizeTypes = "Standard_D2_v3" + // VirtualMachineSizeTypesStandardD3 ... + VirtualMachineSizeTypesStandardD3 VirtualMachineSizeTypes = "Standard_D3" + // VirtualMachineSizeTypesStandardD32sV3 ... + VirtualMachineSizeTypesStandardD32sV3 VirtualMachineSizeTypes = "Standard_D32s_v3" + // VirtualMachineSizeTypesStandardD32V3 ... + VirtualMachineSizeTypesStandardD32V3 VirtualMachineSizeTypes = "Standard_D32_v3" + // VirtualMachineSizeTypesStandardD3V2 ... + VirtualMachineSizeTypesStandardD3V2 VirtualMachineSizeTypes = "Standard_D3_v2" + // VirtualMachineSizeTypesStandardD4 ... + VirtualMachineSizeTypesStandardD4 VirtualMachineSizeTypes = "Standard_D4" + // VirtualMachineSizeTypesStandardD4sV3 ... + VirtualMachineSizeTypesStandardD4sV3 VirtualMachineSizeTypes = "Standard_D4s_v3" + // VirtualMachineSizeTypesStandardD4V2 ... + VirtualMachineSizeTypesStandardD4V2 VirtualMachineSizeTypes = "Standard_D4_v2" + // VirtualMachineSizeTypesStandardD4V3 ... + VirtualMachineSizeTypesStandardD4V3 VirtualMachineSizeTypes = "Standard_D4_v3" + // VirtualMachineSizeTypesStandardD5V2 ... + VirtualMachineSizeTypesStandardD5V2 VirtualMachineSizeTypes = "Standard_D5_v2" + // VirtualMachineSizeTypesStandardD64sV3 ... + VirtualMachineSizeTypesStandardD64sV3 VirtualMachineSizeTypes = "Standard_D64s_v3" + // VirtualMachineSizeTypesStandardD64V3 ... + VirtualMachineSizeTypesStandardD64V3 VirtualMachineSizeTypes = "Standard_D64_v3" + // VirtualMachineSizeTypesStandardD8sV3 ... + VirtualMachineSizeTypesStandardD8sV3 VirtualMachineSizeTypes = "Standard_D8s_v3" + // VirtualMachineSizeTypesStandardD8V3 ... + VirtualMachineSizeTypesStandardD8V3 VirtualMachineSizeTypes = "Standard_D8_v3" + // VirtualMachineSizeTypesStandardDS1 ... + VirtualMachineSizeTypesStandardDS1 VirtualMachineSizeTypes = "Standard_DS1" + // VirtualMachineSizeTypesStandardDS11 ... + VirtualMachineSizeTypesStandardDS11 VirtualMachineSizeTypes = "Standard_DS11" + // VirtualMachineSizeTypesStandardDS11V2 ... + VirtualMachineSizeTypesStandardDS11V2 VirtualMachineSizeTypes = "Standard_DS11_v2" + // VirtualMachineSizeTypesStandardDS12 ... + VirtualMachineSizeTypesStandardDS12 VirtualMachineSizeTypes = "Standard_DS12" + // VirtualMachineSizeTypesStandardDS12V2 ... + VirtualMachineSizeTypesStandardDS12V2 VirtualMachineSizeTypes = "Standard_DS12_v2" + // VirtualMachineSizeTypesStandardDS13 ... + VirtualMachineSizeTypesStandardDS13 VirtualMachineSizeTypes = "Standard_DS13" + // VirtualMachineSizeTypesStandardDS132V2 ... + VirtualMachineSizeTypesStandardDS132V2 VirtualMachineSizeTypes = "Standard_DS13-2_v2" + // VirtualMachineSizeTypesStandardDS134V2 ... + VirtualMachineSizeTypesStandardDS134V2 VirtualMachineSizeTypes = "Standard_DS13-4_v2" + // VirtualMachineSizeTypesStandardDS13V2 ... + VirtualMachineSizeTypesStandardDS13V2 VirtualMachineSizeTypes = "Standard_DS13_v2" + // VirtualMachineSizeTypesStandardDS14 ... + VirtualMachineSizeTypesStandardDS14 VirtualMachineSizeTypes = "Standard_DS14" + // VirtualMachineSizeTypesStandardDS144V2 ... + VirtualMachineSizeTypesStandardDS144V2 VirtualMachineSizeTypes = "Standard_DS14-4_v2" + // VirtualMachineSizeTypesStandardDS148V2 ... + VirtualMachineSizeTypesStandardDS148V2 VirtualMachineSizeTypes = "Standard_DS14-8_v2" + // VirtualMachineSizeTypesStandardDS14V2 ... + VirtualMachineSizeTypesStandardDS14V2 VirtualMachineSizeTypes = "Standard_DS14_v2" + // VirtualMachineSizeTypesStandardDS15V2 ... + VirtualMachineSizeTypesStandardDS15V2 VirtualMachineSizeTypes = "Standard_DS15_v2" + // VirtualMachineSizeTypesStandardDS1V2 ... + VirtualMachineSizeTypesStandardDS1V2 VirtualMachineSizeTypes = "Standard_DS1_v2" + // VirtualMachineSizeTypesStandardDS2 ... + VirtualMachineSizeTypesStandardDS2 VirtualMachineSizeTypes = "Standard_DS2" + // VirtualMachineSizeTypesStandardDS2V2 ... + VirtualMachineSizeTypesStandardDS2V2 VirtualMachineSizeTypes = "Standard_DS2_v2" + // VirtualMachineSizeTypesStandardDS3 ... + VirtualMachineSizeTypesStandardDS3 VirtualMachineSizeTypes = "Standard_DS3" + // VirtualMachineSizeTypesStandardDS3V2 ... + VirtualMachineSizeTypesStandardDS3V2 VirtualMachineSizeTypes = "Standard_DS3_v2" + // VirtualMachineSizeTypesStandardDS4 ... + VirtualMachineSizeTypesStandardDS4 VirtualMachineSizeTypes = "Standard_DS4" + // VirtualMachineSizeTypesStandardDS4V2 ... + VirtualMachineSizeTypesStandardDS4V2 VirtualMachineSizeTypes = "Standard_DS4_v2" + // VirtualMachineSizeTypesStandardDS5V2 ... + VirtualMachineSizeTypesStandardDS5V2 VirtualMachineSizeTypes = "Standard_DS5_v2" + // VirtualMachineSizeTypesStandardE16sV3 ... + VirtualMachineSizeTypesStandardE16sV3 VirtualMachineSizeTypes = "Standard_E16s_v3" + // VirtualMachineSizeTypesStandardE16V3 ... + VirtualMachineSizeTypesStandardE16V3 VirtualMachineSizeTypes = "Standard_E16_v3" + // VirtualMachineSizeTypesStandardE2sV3 ... + VirtualMachineSizeTypesStandardE2sV3 VirtualMachineSizeTypes = "Standard_E2s_v3" + // VirtualMachineSizeTypesStandardE2V3 ... + VirtualMachineSizeTypesStandardE2V3 VirtualMachineSizeTypes = "Standard_E2_v3" + // VirtualMachineSizeTypesStandardE3216V3 ... + VirtualMachineSizeTypesStandardE3216V3 VirtualMachineSizeTypes = "Standard_E32-16_v3" + // VirtualMachineSizeTypesStandardE328sV3 ... + VirtualMachineSizeTypesStandardE328sV3 VirtualMachineSizeTypes = "Standard_E32-8s_v3" + // VirtualMachineSizeTypesStandardE32sV3 ... + VirtualMachineSizeTypesStandardE32sV3 VirtualMachineSizeTypes = "Standard_E32s_v3" + // VirtualMachineSizeTypesStandardE32V3 ... + VirtualMachineSizeTypesStandardE32V3 VirtualMachineSizeTypes = "Standard_E32_v3" + // VirtualMachineSizeTypesStandardE4sV3 ... + VirtualMachineSizeTypesStandardE4sV3 VirtualMachineSizeTypes = "Standard_E4s_v3" + // VirtualMachineSizeTypesStandardE4V3 ... + VirtualMachineSizeTypesStandardE4V3 VirtualMachineSizeTypes = "Standard_E4_v3" + // VirtualMachineSizeTypesStandardE6416sV3 ... + VirtualMachineSizeTypesStandardE6416sV3 VirtualMachineSizeTypes = "Standard_E64-16s_v3" + // VirtualMachineSizeTypesStandardE6432sV3 ... + VirtualMachineSizeTypesStandardE6432sV3 VirtualMachineSizeTypes = "Standard_E64-32s_v3" + // VirtualMachineSizeTypesStandardE64sV3 ... + VirtualMachineSizeTypesStandardE64sV3 VirtualMachineSizeTypes = "Standard_E64s_v3" + // VirtualMachineSizeTypesStandardE64V3 ... + VirtualMachineSizeTypesStandardE64V3 VirtualMachineSizeTypes = "Standard_E64_v3" + // VirtualMachineSizeTypesStandardE8sV3 ... + VirtualMachineSizeTypesStandardE8sV3 VirtualMachineSizeTypes = "Standard_E8s_v3" + // VirtualMachineSizeTypesStandardE8V3 ... + VirtualMachineSizeTypesStandardE8V3 VirtualMachineSizeTypes = "Standard_E8_v3" + // VirtualMachineSizeTypesStandardF1 ... + VirtualMachineSizeTypesStandardF1 VirtualMachineSizeTypes = "Standard_F1" + // VirtualMachineSizeTypesStandardF16 ... + VirtualMachineSizeTypesStandardF16 VirtualMachineSizeTypes = "Standard_F16" + // VirtualMachineSizeTypesStandardF16s ... + VirtualMachineSizeTypesStandardF16s VirtualMachineSizeTypes = "Standard_F16s" + // VirtualMachineSizeTypesStandardF16sV2 ... + VirtualMachineSizeTypesStandardF16sV2 VirtualMachineSizeTypes = "Standard_F16s_v2" + // VirtualMachineSizeTypesStandardF1s ... + VirtualMachineSizeTypesStandardF1s VirtualMachineSizeTypes = "Standard_F1s" + // VirtualMachineSizeTypesStandardF2 ... + VirtualMachineSizeTypesStandardF2 VirtualMachineSizeTypes = "Standard_F2" + // VirtualMachineSizeTypesStandardF2s ... + VirtualMachineSizeTypesStandardF2s VirtualMachineSizeTypes = "Standard_F2s" + // VirtualMachineSizeTypesStandardF2sV2 ... + VirtualMachineSizeTypesStandardF2sV2 VirtualMachineSizeTypes = "Standard_F2s_v2" + // VirtualMachineSizeTypesStandardF32sV2 ... + VirtualMachineSizeTypesStandardF32sV2 VirtualMachineSizeTypes = "Standard_F32s_v2" + // VirtualMachineSizeTypesStandardF4 ... + VirtualMachineSizeTypesStandardF4 VirtualMachineSizeTypes = "Standard_F4" + // VirtualMachineSizeTypesStandardF4s ... + VirtualMachineSizeTypesStandardF4s VirtualMachineSizeTypes = "Standard_F4s" + // VirtualMachineSizeTypesStandardF4sV2 ... + VirtualMachineSizeTypesStandardF4sV2 VirtualMachineSizeTypes = "Standard_F4s_v2" + // VirtualMachineSizeTypesStandardF64sV2 ... + VirtualMachineSizeTypesStandardF64sV2 VirtualMachineSizeTypes = "Standard_F64s_v2" + // VirtualMachineSizeTypesStandardF72sV2 ... + VirtualMachineSizeTypesStandardF72sV2 VirtualMachineSizeTypes = "Standard_F72s_v2" + // VirtualMachineSizeTypesStandardF8 ... + VirtualMachineSizeTypesStandardF8 VirtualMachineSizeTypes = "Standard_F8" + // VirtualMachineSizeTypesStandardF8s ... + VirtualMachineSizeTypesStandardF8s VirtualMachineSizeTypes = "Standard_F8s" + // VirtualMachineSizeTypesStandardF8sV2 ... + VirtualMachineSizeTypesStandardF8sV2 VirtualMachineSizeTypes = "Standard_F8s_v2" + // VirtualMachineSizeTypesStandardG1 ... + VirtualMachineSizeTypesStandardG1 VirtualMachineSizeTypes = "Standard_G1" + // VirtualMachineSizeTypesStandardG2 ... + VirtualMachineSizeTypesStandardG2 VirtualMachineSizeTypes = "Standard_G2" + // VirtualMachineSizeTypesStandardG3 ... + VirtualMachineSizeTypesStandardG3 VirtualMachineSizeTypes = "Standard_G3" + // VirtualMachineSizeTypesStandardG4 ... + VirtualMachineSizeTypesStandardG4 VirtualMachineSizeTypes = "Standard_G4" + // VirtualMachineSizeTypesStandardG5 ... + VirtualMachineSizeTypesStandardG5 VirtualMachineSizeTypes = "Standard_G5" + // VirtualMachineSizeTypesStandardGS1 ... + VirtualMachineSizeTypesStandardGS1 VirtualMachineSizeTypes = "Standard_GS1" + // VirtualMachineSizeTypesStandardGS2 ... + VirtualMachineSizeTypesStandardGS2 VirtualMachineSizeTypes = "Standard_GS2" + // VirtualMachineSizeTypesStandardGS3 ... + VirtualMachineSizeTypesStandardGS3 VirtualMachineSizeTypes = "Standard_GS3" + // VirtualMachineSizeTypesStandardGS4 ... + VirtualMachineSizeTypesStandardGS4 VirtualMachineSizeTypes = "Standard_GS4" + // VirtualMachineSizeTypesStandardGS44 ... + VirtualMachineSizeTypesStandardGS44 VirtualMachineSizeTypes = "Standard_GS4-4" + // VirtualMachineSizeTypesStandardGS48 ... + VirtualMachineSizeTypesStandardGS48 VirtualMachineSizeTypes = "Standard_GS4-8" + // VirtualMachineSizeTypesStandardGS5 ... + VirtualMachineSizeTypesStandardGS5 VirtualMachineSizeTypes = "Standard_GS5" + // VirtualMachineSizeTypesStandardGS516 ... + VirtualMachineSizeTypesStandardGS516 VirtualMachineSizeTypes = "Standard_GS5-16" + // VirtualMachineSizeTypesStandardGS58 ... + VirtualMachineSizeTypesStandardGS58 VirtualMachineSizeTypes = "Standard_GS5-8" + // VirtualMachineSizeTypesStandardH16 ... + VirtualMachineSizeTypesStandardH16 VirtualMachineSizeTypes = "Standard_H16" + // VirtualMachineSizeTypesStandardH16m ... + VirtualMachineSizeTypesStandardH16m VirtualMachineSizeTypes = "Standard_H16m" + // VirtualMachineSizeTypesStandardH16mr ... + VirtualMachineSizeTypesStandardH16mr VirtualMachineSizeTypes = "Standard_H16mr" + // VirtualMachineSizeTypesStandardH16r ... + VirtualMachineSizeTypesStandardH16r VirtualMachineSizeTypes = "Standard_H16r" + // VirtualMachineSizeTypesStandardH8 ... + VirtualMachineSizeTypesStandardH8 VirtualMachineSizeTypes = "Standard_H8" + // VirtualMachineSizeTypesStandardH8m ... + VirtualMachineSizeTypesStandardH8m VirtualMachineSizeTypes = "Standard_H8m" + // VirtualMachineSizeTypesStandardL16s ... + VirtualMachineSizeTypesStandardL16s VirtualMachineSizeTypes = "Standard_L16s" + // VirtualMachineSizeTypesStandardL32s ... + VirtualMachineSizeTypesStandardL32s VirtualMachineSizeTypes = "Standard_L32s" + // VirtualMachineSizeTypesStandardL4s ... + VirtualMachineSizeTypesStandardL4s VirtualMachineSizeTypes = "Standard_L4s" + // VirtualMachineSizeTypesStandardL8s ... + VirtualMachineSizeTypesStandardL8s VirtualMachineSizeTypes = "Standard_L8s" + // VirtualMachineSizeTypesStandardM12832ms ... + VirtualMachineSizeTypesStandardM12832ms VirtualMachineSizeTypes = "Standard_M128-32ms" + // VirtualMachineSizeTypesStandardM12864ms ... + VirtualMachineSizeTypesStandardM12864ms VirtualMachineSizeTypes = "Standard_M128-64ms" + // VirtualMachineSizeTypesStandardM128ms ... + VirtualMachineSizeTypesStandardM128ms VirtualMachineSizeTypes = "Standard_M128ms" + // VirtualMachineSizeTypesStandardM128s ... + VirtualMachineSizeTypesStandardM128s VirtualMachineSizeTypes = "Standard_M128s" + // VirtualMachineSizeTypesStandardM6416ms ... + VirtualMachineSizeTypesStandardM6416ms VirtualMachineSizeTypes = "Standard_M64-16ms" + // VirtualMachineSizeTypesStandardM6432ms ... + VirtualMachineSizeTypesStandardM6432ms VirtualMachineSizeTypes = "Standard_M64-32ms" + // VirtualMachineSizeTypesStandardM64ms ... + VirtualMachineSizeTypesStandardM64ms VirtualMachineSizeTypes = "Standard_M64ms" + // VirtualMachineSizeTypesStandardM64s ... + VirtualMachineSizeTypesStandardM64s VirtualMachineSizeTypes = "Standard_M64s" + // VirtualMachineSizeTypesStandardNC12 ... + VirtualMachineSizeTypesStandardNC12 VirtualMachineSizeTypes = "Standard_NC12" + // VirtualMachineSizeTypesStandardNC12sV2 ... + VirtualMachineSizeTypesStandardNC12sV2 VirtualMachineSizeTypes = "Standard_NC12s_v2" + // VirtualMachineSizeTypesStandardNC12sV3 ... + VirtualMachineSizeTypesStandardNC12sV3 VirtualMachineSizeTypes = "Standard_NC12s_v3" + // VirtualMachineSizeTypesStandardNC24 ... + VirtualMachineSizeTypesStandardNC24 VirtualMachineSizeTypes = "Standard_NC24" + // VirtualMachineSizeTypesStandardNC24r ... + VirtualMachineSizeTypesStandardNC24r VirtualMachineSizeTypes = "Standard_NC24r" + // VirtualMachineSizeTypesStandardNC24rsV2 ... + VirtualMachineSizeTypesStandardNC24rsV2 VirtualMachineSizeTypes = "Standard_NC24rs_v2" + // VirtualMachineSizeTypesStandardNC24rsV3 ... + VirtualMachineSizeTypesStandardNC24rsV3 VirtualMachineSizeTypes = "Standard_NC24rs_v3" + // VirtualMachineSizeTypesStandardNC24sV2 ... + VirtualMachineSizeTypesStandardNC24sV2 VirtualMachineSizeTypes = "Standard_NC24s_v2" + // VirtualMachineSizeTypesStandardNC24sV3 ... + VirtualMachineSizeTypesStandardNC24sV3 VirtualMachineSizeTypes = "Standard_NC24s_v3" + // VirtualMachineSizeTypesStandardNC6 ... + VirtualMachineSizeTypesStandardNC6 VirtualMachineSizeTypes = "Standard_NC6" + // VirtualMachineSizeTypesStandardNC6sV2 ... + VirtualMachineSizeTypesStandardNC6sV2 VirtualMachineSizeTypes = "Standard_NC6s_v2" + // VirtualMachineSizeTypesStandardNC6sV3 ... + VirtualMachineSizeTypesStandardNC6sV3 VirtualMachineSizeTypes = "Standard_NC6s_v3" + // VirtualMachineSizeTypesStandardND12s ... + VirtualMachineSizeTypesStandardND12s VirtualMachineSizeTypes = "Standard_ND12s" + // VirtualMachineSizeTypesStandardND24rs ... + VirtualMachineSizeTypesStandardND24rs VirtualMachineSizeTypes = "Standard_ND24rs" + // VirtualMachineSizeTypesStandardND24s ... + VirtualMachineSizeTypesStandardND24s VirtualMachineSizeTypes = "Standard_ND24s" + // VirtualMachineSizeTypesStandardND6s ... + VirtualMachineSizeTypesStandardND6s VirtualMachineSizeTypes = "Standard_ND6s" + // VirtualMachineSizeTypesStandardNV12 ... + VirtualMachineSizeTypesStandardNV12 VirtualMachineSizeTypes = "Standard_NV12" + // VirtualMachineSizeTypesStandardNV24 ... + VirtualMachineSizeTypesStandardNV24 VirtualMachineSizeTypes = "Standard_NV24" + // VirtualMachineSizeTypesStandardNV6 ... + VirtualMachineSizeTypesStandardNV6 VirtualMachineSizeTypes = "Standard_NV6" +) + +// PossibleVirtualMachineSizeTypesValues returns an array of possible values for the VirtualMachineSizeTypes const type. +func PossibleVirtualMachineSizeTypesValues() []VirtualMachineSizeTypes { + return []VirtualMachineSizeTypes{VirtualMachineSizeTypesBasicA0, VirtualMachineSizeTypesBasicA1, VirtualMachineSizeTypesBasicA2, VirtualMachineSizeTypesBasicA3, VirtualMachineSizeTypesBasicA4, VirtualMachineSizeTypesStandardA0, VirtualMachineSizeTypesStandardA1, VirtualMachineSizeTypesStandardA10, VirtualMachineSizeTypesStandardA11, VirtualMachineSizeTypesStandardA1V2, VirtualMachineSizeTypesStandardA2, VirtualMachineSizeTypesStandardA2mV2, VirtualMachineSizeTypesStandardA2V2, VirtualMachineSizeTypesStandardA3, VirtualMachineSizeTypesStandardA4, VirtualMachineSizeTypesStandardA4mV2, VirtualMachineSizeTypesStandardA4V2, VirtualMachineSizeTypesStandardA5, VirtualMachineSizeTypesStandardA6, VirtualMachineSizeTypesStandardA7, VirtualMachineSizeTypesStandardA8, VirtualMachineSizeTypesStandardA8mV2, VirtualMachineSizeTypesStandardA8V2, VirtualMachineSizeTypesStandardA9, VirtualMachineSizeTypesStandardB1ms, VirtualMachineSizeTypesStandardB1s, VirtualMachineSizeTypesStandardB2ms, VirtualMachineSizeTypesStandardB2s, VirtualMachineSizeTypesStandardB4ms, VirtualMachineSizeTypesStandardB8ms, VirtualMachineSizeTypesStandardD1, VirtualMachineSizeTypesStandardD11, VirtualMachineSizeTypesStandardD11V2, VirtualMachineSizeTypesStandardD12, VirtualMachineSizeTypesStandardD12V2, VirtualMachineSizeTypesStandardD13, VirtualMachineSizeTypesStandardD13V2, VirtualMachineSizeTypesStandardD14, VirtualMachineSizeTypesStandardD14V2, VirtualMachineSizeTypesStandardD15V2, VirtualMachineSizeTypesStandardD16sV3, VirtualMachineSizeTypesStandardD16V3, VirtualMachineSizeTypesStandardD1V2, VirtualMachineSizeTypesStandardD2, VirtualMachineSizeTypesStandardD2sV3, VirtualMachineSizeTypesStandardD2V2, VirtualMachineSizeTypesStandardD2V3, VirtualMachineSizeTypesStandardD3, VirtualMachineSizeTypesStandardD32sV3, VirtualMachineSizeTypesStandardD32V3, VirtualMachineSizeTypesStandardD3V2, VirtualMachineSizeTypesStandardD4, VirtualMachineSizeTypesStandardD4sV3, VirtualMachineSizeTypesStandardD4V2, VirtualMachineSizeTypesStandardD4V3, VirtualMachineSizeTypesStandardD5V2, VirtualMachineSizeTypesStandardD64sV3, VirtualMachineSizeTypesStandardD64V3, VirtualMachineSizeTypesStandardD8sV3, VirtualMachineSizeTypesStandardD8V3, VirtualMachineSizeTypesStandardDS1, VirtualMachineSizeTypesStandardDS11, VirtualMachineSizeTypesStandardDS11V2, VirtualMachineSizeTypesStandardDS12, VirtualMachineSizeTypesStandardDS12V2, VirtualMachineSizeTypesStandardDS13, VirtualMachineSizeTypesStandardDS132V2, VirtualMachineSizeTypesStandardDS134V2, VirtualMachineSizeTypesStandardDS13V2, VirtualMachineSizeTypesStandardDS14, VirtualMachineSizeTypesStandardDS144V2, VirtualMachineSizeTypesStandardDS148V2, VirtualMachineSizeTypesStandardDS14V2, VirtualMachineSizeTypesStandardDS15V2, VirtualMachineSizeTypesStandardDS1V2, VirtualMachineSizeTypesStandardDS2, VirtualMachineSizeTypesStandardDS2V2, VirtualMachineSizeTypesStandardDS3, VirtualMachineSizeTypesStandardDS3V2, VirtualMachineSizeTypesStandardDS4, VirtualMachineSizeTypesStandardDS4V2, VirtualMachineSizeTypesStandardDS5V2, VirtualMachineSizeTypesStandardE16sV3, VirtualMachineSizeTypesStandardE16V3, VirtualMachineSizeTypesStandardE2sV3, VirtualMachineSizeTypesStandardE2V3, VirtualMachineSizeTypesStandardE3216V3, VirtualMachineSizeTypesStandardE328sV3, VirtualMachineSizeTypesStandardE32sV3, VirtualMachineSizeTypesStandardE32V3, VirtualMachineSizeTypesStandardE4sV3, VirtualMachineSizeTypesStandardE4V3, VirtualMachineSizeTypesStandardE6416sV3, VirtualMachineSizeTypesStandardE6432sV3, VirtualMachineSizeTypesStandardE64sV3, VirtualMachineSizeTypesStandardE64V3, VirtualMachineSizeTypesStandardE8sV3, VirtualMachineSizeTypesStandardE8V3, VirtualMachineSizeTypesStandardF1, VirtualMachineSizeTypesStandardF16, VirtualMachineSizeTypesStandardF16s, VirtualMachineSizeTypesStandardF16sV2, VirtualMachineSizeTypesStandardF1s, VirtualMachineSizeTypesStandardF2, VirtualMachineSizeTypesStandardF2s, VirtualMachineSizeTypesStandardF2sV2, VirtualMachineSizeTypesStandardF32sV2, VirtualMachineSizeTypesStandardF4, VirtualMachineSizeTypesStandardF4s, VirtualMachineSizeTypesStandardF4sV2, VirtualMachineSizeTypesStandardF64sV2, VirtualMachineSizeTypesStandardF72sV2, VirtualMachineSizeTypesStandardF8, VirtualMachineSizeTypesStandardF8s, VirtualMachineSizeTypesStandardF8sV2, VirtualMachineSizeTypesStandardG1, VirtualMachineSizeTypesStandardG2, VirtualMachineSizeTypesStandardG3, VirtualMachineSizeTypesStandardG4, VirtualMachineSizeTypesStandardG5, VirtualMachineSizeTypesStandardGS1, VirtualMachineSizeTypesStandardGS2, VirtualMachineSizeTypesStandardGS3, VirtualMachineSizeTypesStandardGS4, VirtualMachineSizeTypesStandardGS44, VirtualMachineSizeTypesStandardGS48, VirtualMachineSizeTypesStandardGS5, VirtualMachineSizeTypesStandardGS516, VirtualMachineSizeTypesStandardGS58, VirtualMachineSizeTypesStandardH16, VirtualMachineSizeTypesStandardH16m, VirtualMachineSizeTypesStandardH16mr, VirtualMachineSizeTypesStandardH16r, VirtualMachineSizeTypesStandardH8, VirtualMachineSizeTypesStandardH8m, VirtualMachineSizeTypesStandardL16s, VirtualMachineSizeTypesStandardL32s, VirtualMachineSizeTypesStandardL4s, VirtualMachineSizeTypesStandardL8s, VirtualMachineSizeTypesStandardM12832ms, VirtualMachineSizeTypesStandardM12864ms, VirtualMachineSizeTypesStandardM128ms, VirtualMachineSizeTypesStandardM128s, VirtualMachineSizeTypesStandardM6416ms, VirtualMachineSizeTypesStandardM6432ms, VirtualMachineSizeTypesStandardM64ms, VirtualMachineSizeTypesStandardM64s, VirtualMachineSizeTypesStandardNC12, VirtualMachineSizeTypesStandardNC12sV2, VirtualMachineSizeTypesStandardNC12sV3, VirtualMachineSizeTypesStandardNC24, VirtualMachineSizeTypesStandardNC24r, VirtualMachineSizeTypesStandardNC24rsV2, VirtualMachineSizeTypesStandardNC24rsV3, VirtualMachineSizeTypesStandardNC24sV2, VirtualMachineSizeTypesStandardNC24sV3, VirtualMachineSizeTypesStandardNC6, VirtualMachineSizeTypesStandardNC6sV2, VirtualMachineSizeTypesStandardNC6sV3, VirtualMachineSizeTypesStandardND12s, VirtualMachineSizeTypesStandardND24rs, VirtualMachineSizeTypesStandardND24s, VirtualMachineSizeTypesStandardND6s, VirtualMachineSizeTypesStandardNV12, VirtualMachineSizeTypesStandardNV24, VirtualMachineSizeTypesStandardNV6} +} + +// AccessURI a disk access SAS uri. +type AccessURI struct { + autorest.Response `json:"-"` + // AccessSAS - READ-ONLY; A SAS uri for accessing a disk. + AccessSAS *string `json:"accessSAS,omitempty"` +} + +// AdditionalCapabilities enables or disables a capability on the virtual machine or virtual machine scale +// set. +type AdditionalCapabilities struct { + // UltraSSDEnabled - The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled. + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} + +// AdditionalUnattendContent specifies additional XML formatted information that can be included in the +// Unattend.xml file, which is used by Windows Setup. Contents are defined by setting name, component name, +// and the pass in which the content is applied. +type AdditionalUnattendContent struct { + // PassName - The pass name. Currently, the only allowable value is OobeSystem. Possible values include: 'OobeSystem' + PassName PassNames `json:"passName,omitempty"` + // ComponentName - The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. Possible values include: 'MicrosoftWindowsShellSetup' + ComponentName ComponentNames `json:"componentName,omitempty"` + // SettingName - Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. Possible values include: 'AutoLogon', 'FirstLogonCommands' + SettingName SettingNames `json:"settingName,omitempty"` + // Content - Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML must be less than 4KB and must include the root element for the setting or feature that is being inserted. + Content *string `json:"content,omitempty"` +} + +// APIEntityReference the API entity reference. +type APIEntityReference struct { + // ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + ID *string `json:"id,omitempty"` +} + +// APIError api error. +type APIError struct { + // Details - The Api error details + Details *[]APIErrorBase `json:"details,omitempty"` + // Innererror - The Api inner error + Innererror *InnerError `json:"innererror,omitempty"` + // Code - The error code. + Code *string `json:"code,omitempty"` + // Target - The target of the particular error. + Target *string `json:"target,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` +} + +// APIErrorBase api error base. +type APIErrorBase struct { + // Code - The error code. + Code *string `json:"code,omitempty"` + // Target - The target of the particular error. + Target *string `json:"target,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` +} + +// AutomaticOSUpgradePolicy the configuration parameters used for performing automatic OS upgrade. +type AutomaticOSUpgradePolicy struct { + // EnableAutomaticOSUpgrade - Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. If this is set to true for Windows based scale sets, recommendation is to set [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) to false. + EnableAutomaticOSUpgrade *bool `json:"enableAutomaticOSUpgrade,omitempty"` + // DisableAutomaticRollback - Whether OS image rollback feature should be disabled. Default value is false. + DisableAutomaticRollback *bool `json:"disableAutomaticRollback,omitempty"` +} + +// AutomaticOSUpgradeProperties describes automatic OS upgrade properties on the image. +type AutomaticOSUpgradeProperties struct { + // AutomaticOSUpgradeSupported - Specifies whether automatic OS upgrade is supported on the image. + AutomaticOSUpgradeSupported *bool `json:"automaticOSUpgradeSupported,omitempty"` +} + +// AvailabilitySet specifies information about the availability set that the virtual machine should be +// assigned to. Virtual machines specified in the same availability set are allocated to different nodes to +// maximize availability. For more information about availability sets, see [Manage the availability of +// virtual +// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). +//

For more information on Azure planned maintenance, see [Planned maintenance for virtual +// machines in +// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) +//

Currently, a VM can only be added to availability set at creation time. An existing VM cannot +// be added to an availability set. +type AvailabilitySet struct { + autorest.Response `json:"-"` + *AvailabilitySetProperties `json:"properties,omitempty"` + // Sku - Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AvailabilitySet. +func (as AvailabilitySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if as.AvailabilitySetProperties != nil { + objectMap["properties"] = as.AvailabilitySetProperties + } + if as.Sku != nil { + objectMap["sku"] = as.Sku + } + if as.Location != nil { + objectMap["location"] = as.Location + } + if as.Tags != nil { + objectMap["tags"] = as.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AvailabilitySet struct. +func (as *AvailabilitySet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var availabilitySetProperties AvailabilitySetProperties + err = json.Unmarshal(*v, &availabilitySetProperties) + if err != nil { + return err + } + as.AvailabilitySetProperties = &availabilitySetProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + as.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + as.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + as.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + as.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + as.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + as.Tags = tags + } + } + } + + return nil +} + +// AvailabilitySetListResult the List Availability Set operation response. +type AvailabilitySetListResult struct { + autorest.Response `json:"-"` + // Value - The list of availability sets + Value *[]AvailabilitySet `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to fetch the next page of AvailabilitySets. + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailabilitySetListResultIterator provides access to a complete listing of AvailabilitySet values. +type AvailabilitySetListResultIterator struct { + i int + page AvailabilitySetListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailabilitySetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailabilitySetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailabilitySetListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailabilitySetListResultIterator) Response() AvailabilitySetListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailabilitySetListResultIterator) Value() AvailabilitySet { + if !iter.page.NotDone() { + return AvailabilitySet{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailabilitySetListResultIterator type. +func NewAvailabilitySetListResultIterator(page AvailabilitySetListResultPage) AvailabilitySetListResultIterator { + return AvailabilitySetListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aslr AvailabilitySetListResult) IsEmpty() bool { + return aslr.Value == nil || len(*aslr.Value) == 0 +} + +// availabilitySetListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aslr AvailabilitySetListResult) availabilitySetListResultPreparer(ctx context.Context) (*http.Request, error) { + if aslr.NextLink == nil || len(to.String(aslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aslr.NextLink))) +} + +// AvailabilitySetListResultPage contains a page of AvailabilitySet values. +type AvailabilitySetListResultPage struct { + fn func(context.Context, AvailabilitySetListResult) (AvailabilitySetListResult, error) + aslr AvailabilitySetListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailabilitySetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.aslr) + if err != nil { + return err + } + page.aslr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailabilitySetListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailabilitySetListResultPage) NotDone() bool { + return !page.aslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailabilitySetListResultPage) Response() AvailabilitySetListResult { + return page.aslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailabilitySetListResultPage) Values() []AvailabilitySet { + if page.aslr.IsEmpty() { + return nil + } + return *page.aslr.Value +} + +// Creates a new instance of the AvailabilitySetListResultPage type. +func NewAvailabilitySetListResultPage(getNextPage func(context.Context, AvailabilitySetListResult) (AvailabilitySetListResult, error)) AvailabilitySetListResultPage { + return AvailabilitySetListResultPage{fn: getNextPage} +} + +// AvailabilitySetProperties the instance view of a resource. +type AvailabilitySetProperties struct { + // PlatformUpdateDomainCount - Update Domain count. + PlatformUpdateDomainCount *int32 `json:"platformUpdateDomainCount,omitempty"` + // PlatformFaultDomainCount - Fault Domain count. + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` + // VirtualMachines - A list of references to all virtual machines in the availability set. + VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` + // ProximityPlacementGroup - Specifies information about the proximity placement group that the availability set should be assigned to.

Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + // Statuses - READ-ONLY; The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// AvailabilitySetUpdate specifies information about the availability set that the virtual machine should +// be assigned to. Only tags may be updated. +type AvailabilitySetUpdate struct { + *AvailabilitySetProperties `json:"properties,omitempty"` + // Sku - Sku of the availability set + Sku *Sku `json:"sku,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AvailabilitySetUpdate. +func (asu AvailabilitySetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asu.AvailabilitySetProperties != nil { + objectMap["properties"] = asu.AvailabilitySetProperties + } + if asu.Sku != nil { + objectMap["sku"] = asu.Sku + } + if asu.Tags != nil { + objectMap["tags"] = asu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AvailabilitySetUpdate struct. +func (asu *AvailabilitySetUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var availabilitySetProperties AvailabilitySetProperties + err = json.Unmarshal(*v, &availabilitySetProperties) + if err != nil { + return err + } + asu.AvailabilitySetProperties = &availabilitySetProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + asu.Sku = &sku + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asu.Tags = tags + } + } + } + + return nil +} + +// BootDiagnostics boot Diagnostics is a debugging feature which allows you to view Console Output and +// Screenshot to diagnose VM status.

You can easily view the output of your console log.

+// Azure also enables you to see a screenshot of the VM from the hypervisor. +type BootDiagnostics struct { + // Enabled - Whether boot diagnostics should be enabled on the Virtual Machine. + Enabled *bool `json:"enabled,omitempty"` + // StorageURI - Uri of the storage account to use for placing the console output and screenshot. + StorageURI *string `json:"storageUri,omitempty"` +} + +// BootDiagnosticsInstanceView the instance view of a virtual machine boot diagnostics. +type BootDiagnosticsInstanceView struct { + // ConsoleScreenshotBlobURI - READ-ONLY; The console screenshot blob URI. + ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty"` + // SerialConsoleLogBlobURI - READ-ONLY; The Linux serial console log blob Uri. + SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty"` + // Status - READ-ONLY; The boot diagnostics status information for the VM.

NOTE: It will be set only if there are errors encountered in enabling boot diagnostics. + Status *InstanceViewStatus `json:"status,omitempty"` +} + +// CloudError an error response from the Gallery service. +type CloudError struct { + Error *APIError `json:"error,omitempty"` +} + +// ContainerService container service. +type ContainerService struct { + autorest.Response `json:"-"` + *ContainerServiceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ContainerService. +func (cs ContainerService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.ContainerServiceProperties != nil { + objectMap["properties"] = cs.ContainerServiceProperties + } + if cs.Location != nil { + objectMap["location"] = cs.Location + } + if cs.Tags != nil { + objectMap["tags"] = cs.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContainerService struct. +func (cs *ContainerService) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerServiceProperties ContainerServiceProperties + err = json.Unmarshal(*v, &containerServiceProperties) + if err != nil { + return err + } + cs.ContainerServiceProperties = &containerServiceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cs.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cs.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cs.Tags = tags + } + } + } + + return nil +} + +// ContainerServiceAgentPoolProfile profile for the container service agent pool. +type ContainerServiceAgentPoolProfile struct { + // Name - Unique name of the agent pool profile in the context of the subscription and resource group. + Name *string `json:"name,omitempty"` + // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + Count *int32 `json:"count,omitempty"` + // VMSize - Size of agent VMs. Possible values include: 'StandardA0', 'StandardA1', 'StandardA2', 'StandardA3', 'StandardA4', 'StandardA5', 'StandardA6', 'StandardA7', 'StandardA8', 'StandardA9', 'StandardA10', 'StandardA11', 'StandardD1', 'StandardD2', 'StandardD3', 'StandardD4', 'StandardD11', 'StandardD12', 'StandardD13', 'StandardD14', 'StandardD1V2', 'StandardD2V2', 'StandardD3V2', 'StandardD4V2', 'StandardD5V2', 'StandardD11V2', 'StandardD12V2', 'StandardD13V2', 'StandardD14V2', 'StandardG1', 'StandardG2', 'StandardG3', 'StandardG4', 'StandardG5', 'StandardDS1', 'StandardDS2', 'StandardDS3', 'StandardDS4', 'StandardDS11', 'StandardDS12', 'StandardDS13', 'StandardDS14', 'StandardGS1', 'StandardGS2', 'StandardGS3', 'StandardGS4', 'StandardGS5' + VMSize ContainerServiceVMSizeTypes `json:"vmSize,omitempty"` + // DNSPrefix - DNS prefix to be used to create the FQDN for the agent pool. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // Fqdn - READ-ONLY; FQDN for the agent pool. + Fqdn *string `json:"fqdn,omitempty"` +} + +// ContainerServiceCustomProfile properties to configure a custom container service cluster. +type ContainerServiceCustomProfile struct { + // Orchestrator - The name of the custom orchestrator to use. + Orchestrator *string `json:"orchestrator,omitempty"` +} + +// ContainerServiceDiagnosticsProfile ... +type ContainerServiceDiagnosticsProfile struct { + // VMDiagnostics - Profile for the container service VM diagnostic agent. + VMDiagnostics *ContainerServiceVMDiagnostics `json:"vmDiagnostics,omitempty"` +} + +// ContainerServiceLinuxProfile profile for Linux VMs in the container service cluster. +type ContainerServiceLinuxProfile struct { + // AdminUsername - The administrator username to use for Linux VMs. + AdminUsername *string `json:"adminUsername,omitempty"` + // SSH - The ssh key configuration for Linux VMs. + SSH *ContainerServiceSSHConfiguration `json:"ssh,omitempty"` +} + +// ContainerServiceListResult the response from the List Container Services operation. +type ContainerServiceListResult struct { + autorest.Response `json:"-"` + // Value - the list of container services. + Value *[]ContainerService `json:"value,omitempty"` + // NextLink - The URL to get the next set of container service results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ContainerServiceListResultIterator provides access to a complete listing of ContainerService values. +type ContainerServiceListResultIterator struct { + i int + page ContainerServiceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ContainerServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServiceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ContainerServiceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ContainerServiceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ContainerServiceListResultIterator) Response() ContainerServiceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ContainerServiceListResultIterator) Value() ContainerService { + if !iter.page.NotDone() { + return ContainerService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ContainerServiceListResultIterator type. +func NewContainerServiceListResultIterator(page ContainerServiceListResultPage) ContainerServiceListResultIterator { + return ContainerServiceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cslr ContainerServiceListResult) IsEmpty() bool { + return cslr.Value == nil || len(*cslr.Value) == 0 +} + +// containerServiceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cslr ContainerServiceListResult) containerServiceListResultPreparer(ctx context.Context) (*http.Request, error) { + if cslr.NextLink == nil || len(to.String(cslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cslr.NextLink))) +} + +// ContainerServiceListResultPage contains a page of ContainerService values. +type ContainerServiceListResultPage struct { + fn func(context.Context, ContainerServiceListResult) (ContainerServiceListResult, error) + cslr ContainerServiceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ContainerServiceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServiceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.cslr) + if err != nil { + return err + } + page.cslr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ContainerServiceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ContainerServiceListResultPage) NotDone() bool { + return !page.cslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ContainerServiceListResultPage) Response() ContainerServiceListResult { + return page.cslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ContainerServiceListResultPage) Values() []ContainerService { + if page.cslr.IsEmpty() { + return nil + } + return *page.cslr.Value +} + +// Creates a new instance of the ContainerServiceListResultPage type. +func NewContainerServiceListResultPage(getNextPage func(context.Context, ContainerServiceListResult) (ContainerServiceListResult, error)) ContainerServiceListResultPage { + return ContainerServiceListResultPage{fn: getNextPage} +} + +// ContainerServiceMasterProfile profile for the container service master. +type ContainerServiceMasterProfile struct { + // Count - Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. + Count *int32 `json:"count,omitempty"` + // DNSPrefix - DNS prefix to be used to create the FQDN for master. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // Fqdn - READ-ONLY; FQDN for the master. + Fqdn *string `json:"fqdn,omitempty"` +} + +// ContainerServiceOrchestratorProfile profile for the container service orchestrator. +type ContainerServiceOrchestratorProfile struct { + // OrchestratorType - The orchestrator to use to manage container service cluster resources. Valid values are Swarm, DCOS, and Custom. Possible values include: 'Swarm', 'DCOS', 'Custom', 'Kubernetes' + OrchestratorType ContainerServiceOrchestratorTypes `json:"orchestratorType,omitempty"` +} + +// ContainerServiceProperties properties of the container service. +type ContainerServiceProperties struct { + // ProvisioningState - READ-ONLY; the current deployment or provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // OrchestratorProfile - Properties of the orchestrator. + OrchestratorProfile *ContainerServiceOrchestratorProfile `json:"orchestratorProfile,omitempty"` + // CustomProfile - Properties for custom clusters. + CustomProfile *ContainerServiceCustomProfile `json:"customProfile,omitempty"` + // ServicePrincipalProfile - Properties for cluster service principals. + ServicePrincipalProfile *ContainerServiceServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` + // MasterProfile - Properties of master agents. + MasterProfile *ContainerServiceMasterProfile `json:"masterProfile,omitempty"` + // AgentPoolProfiles - Properties of the agent pool. + AgentPoolProfiles *[]ContainerServiceAgentPoolProfile `json:"agentPoolProfiles,omitempty"` + // WindowsProfile - Properties of Windows VMs. + WindowsProfile *ContainerServiceWindowsProfile `json:"windowsProfile,omitempty"` + // LinuxProfile - Properties of Linux VMs. + LinuxProfile *ContainerServiceLinuxProfile `json:"linuxProfile,omitempty"` + // DiagnosticsProfile - Properties of the diagnostic agent. + DiagnosticsProfile *ContainerServiceDiagnosticsProfile `json:"diagnosticsProfile,omitempty"` +} + +// ContainerServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ContainerServicesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ContainerServicesCreateOrUpdateFuture) Result(client ContainerServicesClient) (cs ContainerService, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.ContainerServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cs.Response.Response, err = future.GetResult(sender); err == nil && cs.Response.Response.StatusCode != http.StatusNoContent { + cs, err = client.CreateOrUpdateResponder(cs.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesCreateOrUpdateFuture", "Result", cs.Response.Response, "Failure responding to request") + } + } + return +} + +// ContainerServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ContainerServicesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ContainerServicesDeleteFuture) Result(client ContainerServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ContainerServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.ContainerServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ContainerServiceServicePrincipalProfile information about a service principal identity for the cluster +// to use for manipulating Azure APIs. +type ContainerServiceServicePrincipalProfile struct { + // ClientID - The ID for the service principal. + ClientID *string `json:"clientId,omitempty"` + // Secret - The secret password associated with the service principal. + Secret *string `json:"secret,omitempty"` +} + +// ContainerServiceSSHConfiguration SSH configuration for Linux-based VMs running on Azure. +type ContainerServiceSSHConfiguration struct { + // PublicKeys - the list of SSH public keys used to authenticate with Linux-based VMs. + PublicKeys *[]ContainerServiceSSHPublicKey `json:"publicKeys,omitempty"` +} + +// ContainerServiceSSHPublicKey contains information about SSH certificate public key data. +type ContainerServiceSSHPublicKey struct { + // KeyData - Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. + KeyData *string `json:"keyData,omitempty"` +} + +// ContainerServiceVMDiagnostics profile for diagnostics on the container service VMs. +type ContainerServiceVMDiagnostics struct { + // Enabled - Whether the VM diagnostic agent is provisioned on the VM. + Enabled *bool `json:"enabled,omitempty"` + // StorageURI - READ-ONLY; The URI of the storage account where diagnostics are stored. + StorageURI *string `json:"storageUri,omitempty"` +} + +// ContainerServiceWindowsProfile profile for Windows VMs in the container service cluster. +type ContainerServiceWindowsProfile struct { + // AdminUsername - The administrator username to use for Windows VMs. + AdminUsername *string `json:"adminUsername,omitempty"` + // AdminPassword - The administrator password to use for Windows VMs. + AdminPassword *string `json:"adminPassword,omitempty"` +} + +// CreationData data used when creating a disk. +type CreationData struct { + // CreateOption - This enumerates the possible sources of a disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy', 'Restore', 'Upload' + CreateOption DiskCreateOption `json:"createOption,omitempty"` + // StorageAccountID - If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ImageReference - Disk source information. + ImageReference *ImageDiskReference `json:"imageReference,omitempty"` + // SourceURI - If createOption is Import, this is the URI of a blob to be imported into a managed disk. + SourceURI *string `json:"sourceUri,omitempty"` + // SourceResourceID - If createOption is Copy, this is the ARM id of the source snapshot or disk. + SourceResourceID *string `json:"sourceResourceId,omitempty"` +} + +// DataDisk describes a data disk. +type DataDisk struct { + // Lun - Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. + Lun *int32 `json:"lun,omitempty"` + // Name - The disk name. + Name *string `json:"name,omitempty"` + // Vhd - The virtual hard disk. + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + // Image - The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. + Image *VirtualHardDisk `json:"image,omitempty"` + // Caching - Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // CreateOption - Specifies how the virtual machine should be created.

Possible values are:

**Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.

**FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach' + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + // ToBeDetached - Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset + ToBeDetached *bool `json:"toBeDetached,omitempty"` +} + +// DataDiskImage contains the data disk images information. +type DataDiskImage struct { + // Lun - READ-ONLY; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. + Lun *int32 `json:"lun,omitempty"` +} + +// DiagnosticsProfile specifies the boot diagnostic settings state.

Minimum api-version: +// 2015-06-15. +type DiagnosticsProfile struct { + // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status.

You can easily view the output of your console log.

Azure also enables you to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} + +// DiffDiskSettings describes the parameters of ephemeral disk settings that can be specified for operating +// system disk.

NOTE: The ephemeral disk settings can only be specified for managed disk. +type DiffDiskSettings struct { + // Option - Specifies the ephemeral disk settings for operating system disk. Possible values include: 'Local' + Option DiffDiskOptions `json:"option,omitempty"` +} + +// Disallowed describes the disallowed disk types. +type Disallowed struct { + // DiskTypes - A list of disk types. + DiskTypes *[]string `json:"diskTypes,omitempty"` +} + +// Disk disk resource. +type Disk struct { + autorest.Response `json:"-"` + // ManagedBy - READ-ONLY; A relative URI containing the ID of the VM that has the disk attached. + ManagedBy *string `json:"managedBy,omitempty"` + Sku *DiskSku `json:"sku,omitempty"` + // Zones - The Logical zone list for Disk. + Zones *[]string `json:"zones,omitempty"` + *DiskProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Disk. +func (d Disk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.Sku != nil { + objectMap["sku"] = d.Sku + } + if d.Zones != nil { + objectMap["zones"] = d.Zones + } + if d.DiskProperties != nil { + objectMap["properties"] = d.DiskProperties + } + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Disk struct. +func (d *Disk) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "managedBy": + if v != nil { + var managedBy string + err = json.Unmarshal(*v, &managedBy) + if err != nil { + return err + } + d.ManagedBy = &managedBy + } + case "sku": + if v != nil { + var sku DiskSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + d.Sku = &sku + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + d.Zones = &zones + } + case "properties": + if v != nil { + var diskProperties DiskProperties + err = json.Unmarshal(*v, &diskProperties) + if err != nil { + return err + } + d.DiskProperties = &diskProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + d.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + } + } + + return nil +} + +// DiskEncryptionSettings describes a Encryption Settings for a Disk +type DiskEncryptionSettings struct { + // DiskEncryptionKey - Specifies the location of the disk encryption key, which is a Key Vault Secret. + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + // KeyEncryptionKey - Specifies the location of the key encryption key in Key Vault. + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` + // Enabled - Specifies whether disk encryption should be enabled on the virtual machine. + Enabled *bool `json:"enabled,omitempty"` +} + +// DiskInstanceView the instance view of the disk. +type DiskInstanceView struct { + // Name - The disk name. + Name *string `json:"name,omitempty"` + // EncryptionSettings - Specifies the encryption settings for the OS Disk.

Minimum api-version: 2015-06-15 + EncryptionSettings *[]DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// DiskList the List Disks operation response. +type DiskList struct { + autorest.Response `json:"-"` + // Value - A list of disks. + Value *[]Disk `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. + NextLink *string `json:"nextLink,omitempty"` +} + +// DiskListIterator provides access to a complete listing of Disk values. +type DiskListIterator struct { + i int + page DiskListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DiskListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiskListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DiskListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DiskListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DiskListIterator) Response() DiskList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DiskListIterator) Value() Disk { + if !iter.page.NotDone() { + return Disk{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DiskListIterator type. +func NewDiskListIterator(page DiskListPage) DiskListIterator { + return DiskListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dl DiskList) IsEmpty() bool { + return dl.Value == nil || len(*dl.Value) == 0 +} + +// diskListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dl DiskList) diskListPreparer(ctx context.Context) (*http.Request, error) { + if dl.NextLink == nil || len(to.String(dl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dl.NextLink))) +} + +// DiskListPage contains a page of Disk values. +type DiskListPage struct { + fn func(context.Context, DiskList) (DiskList, error) + dl DiskList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DiskListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiskListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.dl) + if err != nil { + return err + } + page.dl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DiskListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DiskListPage) NotDone() bool { + return !page.dl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DiskListPage) Response() DiskList { + return page.dl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DiskListPage) Values() []Disk { + if page.dl.IsEmpty() { + return nil + } + return *page.dl.Value +} + +// Creates a new instance of the DiskListPage type. +func NewDiskListPage(getNextPage func(context.Context, DiskList) (DiskList, error)) DiskListPage { + return DiskListPage{fn: getNextPage} +} + +// DiskProperties disk resource properties. +type DiskProperties struct { + // TimeCreated - READ-ONLY; The time when the disk was created. + TimeCreated *date.Time `json:"timeCreated,omitempty"` + // OsType - The Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // HyperVGeneration - The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' + HyperVGeneration HyperVGeneration `json:"hyperVGeneration,omitempty"` + // CreationData - Disk source information. CreationData information cannot be changed after the disk has been created. + CreationData *CreationData `json:"creationData,omitempty"` + // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // EncryptionSettingsCollection - Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + // ProvisioningState - READ-ONLY; The disk provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // DiskIOPSReadWrite - The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + // DiskMBpsReadWrite - The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + DiskMBpsReadWrite *int32 `json:"diskMBpsReadWrite,omitempty"` + // DiskState - READ-ONLY; The state of the disk. Possible values include: 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', 'ReadyToUpload', 'ActiveUpload' + DiskState DiskState `json:"diskState,omitempty"` +} + +// DisksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DisksCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisksCreateOrUpdateFuture) Result(client DisksClient) (d Disk, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DisksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DisksDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisksDeleteFuture) Result(client DisksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DisksGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DisksGrantAccessFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisksGrantAccessFuture) Result(client DisksClient) (au AccessURI, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksGrantAccessFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if au.Response.Response, err = future.GetResult(sender); err == nil && au.Response.Response.StatusCode != http.StatusNoContent { + au, err = client.GrantAccessResponder(au.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", au.Response.Response, "Failure responding to request") + } + } + return +} + +// DiskSku the disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. +type DiskSku struct { + // Name - The sku name. Possible values include: 'StandardLRS', 'PremiumLRS', 'StandardSSDLRS', 'UltraSSDLRS' + Name DiskStorageAccountTypes `json:"name,omitempty"` + // Tier - READ-ONLY; The sku tier. + Tier *string `json:"tier,omitempty"` +} + +// DisksRevokeAccessFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DisksRevokeAccessFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisksRevokeAccessFuture) Result(client DisksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksRevokeAccessFuture") + return + } + ar.Response = future.Response() + return +} + +// DisksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DisksUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisksUpdateFuture) Result(client DisksClient) (d Disk, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.UpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DiskUpdate disk update resource. +type DiskUpdate struct { + *DiskUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + Sku *DiskSku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiskUpdate. +func (du DiskUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if du.DiskUpdateProperties != nil { + objectMap["properties"] = du.DiskUpdateProperties + } + if du.Tags != nil { + objectMap["tags"] = du.Tags + } + if du.Sku != nil { + objectMap["sku"] = du.Sku + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DiskUpdate struct. +func (du *DiskUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diskUpdateProperties DiskUpdateProperties + err = json.Unmarshal(*v, &diskUpdateProperties) + if err != nil { + return err + } + du.DiskUpdateProperties = &diskUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + du.Tags = tags + } + case "sku": + if v != nil { + var sku DiskSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + du.Sku = &sku + } + } + } + + return nil +} + +// DiskUpdateProperties disk resource update properties. +type DiskUpdateProperties struct { + // OsType - the Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // EncryptionSettingsCollection - Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + // DiskIOPSReadWrite - The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + // DiskMBpsReadWrite - The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + DiskMBpsReadWrite *int32 `json:"diskMBpsReadWrite,omitempty"` +} + +// EncryptionSettingsCollection encryption settings for disk or snapshot +type EncryptionSettingsCollection struct { + // Enabled - Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. + Enabled *bool `json:"enabled,omitempty"` + // EncryptionSettings - A collection of encryption settings, one for each disk volume. + EncryptionSettings *[]EncryptionSettingsElement `json:"encryptionSettings,omitempty"` +} + +// EncryptionSettingsElement encryption settings for one disk volume. +type EncryptionSettingsElement struct { + // DiskEncryptionKey - Key Vault Secret Url and vault id of the disk encryption key + DiskEncryptionKey *KeyVaultAndSecretReference `json:"diskEncryptionKey,omitempty"` + // KeyEncryptionKey - Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + KeyEncryptionKey *KeyVaultAndKeyReference `json:"keyEncryptionKey,omitempty"` +} + +// GalleriesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GalleriesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleriesCreateOrUpdateFuture) Result(client GalleriesClient) (g Gallery, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleriesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if g.Response.Response, err = future.GetResult(sender); err == nil && g.Response.Response.StatusCode != http.StatusNoContent { + g, err = client.CreateOrUpdateResponder(g.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesCreateOrUpdateFuture", "Result", g.Response.Response, "Failure responding to request") + } + } + return +} + +// GalleriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GalleriesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleriesDeleteFuture) Result(client GalleriesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleriesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Gallery specifies information about the Shared Image Gallery that you want to create or update. +type Gallery struct { + autorest.Response `json:"-"` + *GalleryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Gallery. +func (g Gallery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if g.GalleryProperties != nil { + objectMap["properties"] = g.GalleryProperties + } + if g.Location != nil { + objectMap["location"] = g.Location + } + if g.Tags != nil { + objectMap["tags"] = g.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Gallery struct. +func (g *Gallery) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var galleryProperties GalleryProperties + err = json.Unmarshal(*v, &galleryProperties) + if err != nil { + return err + } + g.GalleryProperties = &galleryProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + g.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + g.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + g.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + g.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + g.Tags = tags + } + } + } + + return nil +} + +// GalleryArtifactPublishingProfileBase describes the basic gallery artifact publishing profile. +type GalleryArtifactPublishingProfileBase struct { + // TargetRegions - The target regions where the Image Version is going to be replicated to. This property is updatable. + TargetRegions *[]TargetRegion `json:"targetRegions,omitempty"` + Source *GalleryArtifactSource `json:"source,omitempty"` +} + +// GalleryArtifactSource the source image from which the Image Version is going to be created. +type GalleryArtifactSource struct { + ManagedImage *ManagedArtifact `json:"managedImage,omitempty"` +} + +// GalleryDataDiskImage this is the data disk image. +type GalleryDataDiskImage struct { + // Lun - READ-ONLY; This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. + Lun *int32 `json:"lun,omitempty"` + // SizeInGB - READ-ONLY; This property indicates the size of the VHD to be created. + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // HostCaching - READ-ONLY; The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: 'HostCachingNone', 'HostCachingReadOnly', 'HostCachingReadWrite' + HostCaching HostCaching `json:"hostCaching,omitempty"` +} + +// GalleryDiskImage this is the disk image base class. +type GalleryDiskImage struct { + // SizeInGB - READ-ONLY; This property indicates the size of the VHD to be created. + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // HostCaching - READ-ONLY; The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: 'HostCachingNone', 'HostCachingReadOnly', 'HostCachingReadWrite' + HostCaching HostCaching `json:"hostCaching,omitempty"` +} + +// GalleryIdentifier describes the gallery unique name. +type GalleryIdentifier struct { + // UniqueName - READ-ONLY; The unique name of the Shared Image Gallery. This name is generated automatically by Azure. + UniqueName *string `json:"uniqueName,omitempty"` +} + +// GalleryImage specifies information about the gallery Image Definition that you want to create or update. +type GalleryImage struct { + autorest.Response `json:"-"` + *GalleryImageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for GalleryImage. +func (gi GalleryImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gi.GalleryImageProperties != nil { + objectMap["properties"] = gi.GalleryImageProperties + } + if gi.Location != nil { + objectMap["location"] = gi.Location + } + if gi.Tags != nil { + objectMap["tags"] = gi.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryImage struct. +func (gi *GalleryImage) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var galleryImageProperties GalleryImageProperties + err = json.Unmarshal(*v, &galleryImageProperties) + if err != nil { + return err + } + gi.GalleryImageProperties = &galleryImageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gi.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + gi.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + gi.Tags = tags + } + } + } + + return nil +} + +// GalleryImageIdentifier this is the gallery Image Definition identifier. +type GalleryImageIdentifier struct { + // Publisher - The name of the gallery Image Definition publisher. + Publisher *string `json:"publisher,omitempty"` + // Offer - The name of the gallery Image Definition offer. + Offer *string `json:"offer,omitempty"` + // Sku - The name of the gallery Image Definition SKU. + Sku *string `json:"sku,omitempty"` +} + +// GalleryImageList the List Gallery Images operation response. +type GalleryImageList struct { + autorest.Response `json:"-"` + // Value - A list of Shared Image Gallery images. + Value *[]GalleryImage `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the next page of gallery Image Definitions. + NextLink *string `json:"nextLink,omitempty"` +} + +// GalleryImageListIterator provides access to a complete listing of GalleryImage values. +type GalleryImageListIterator struct { + i int + page GalleryImageListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *GalleryImageListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *GalleryImageListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GalleryImageListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter GalleryImageListIterator) Response() GalleryImageList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter GalleryImageListIterator) Value() GalleryImage { + if !iter.page.NotDone() { + return GalleryImage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GalleryImageListIterator type. +func NewGalleryImageListIterator(page GalleryImageListPage) GalleryImageListIterator { + return GalleryImageListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (gil GalleryImageList) IsEmpty() bool { + return gil.Value == nil || len(*gil.Value) == 0 +} + +// galleryImageListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (gil GalleryImageList) galleryImageListPreparer(ctx context.Context) (*http.Request, error) { + if gil.NextLink == nil || len(to.String(gil.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(gil.NextLink))) +} + +// GalleryImageListPage contains a page of GalleryImage values. +type GalleryImageListPage struct { + fn func(context.Context, GalleryImageList) (GalleryImageList, error) + gil GalleryImageList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *GalleryImageListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.gil) + if err != nil { + return err + } + page.gil = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *GalleryImageListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GalleryImageListPage) NotDone() bool { + return !page.gil.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GalleryImageListPage) Response() GalleryImageList { + return page.gil +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GalleryImageListPage) Values() []GalleryImage { + if page.gil.IsEmpty() { + return nil + } + return *page.gil.Value +} + +// Creates a new instance of the GalleryImageListPage type. +func NewGalleryImageListPage(getNextPage func(context.Context, GalleryImageList) (GalleryImageList, error)) GalleryImageListPage { + return GalleryImageListPage{fn: getNextPage} +} + +// GalleryImageProperties describes the properties of a gallery Image Definition. +type GalleryImageProperties struct { + // Description - The description of this gallery Image Definition resource. This property is updatable. + Description *string `json:"description,omitempty"` + // Eula - The Eula agreement for the gallery Image Definition. + Eula *string `json:"eula,omitempty"` + // PrivacyStatementURI - The privacy statement uri. + PrivacyStatementURI *string `json:"privacyStatementUri,omitempty"` + // ReleaseNoteURI - The release note uri. + ReleaseNoteURI *string `json:"releaseNoteUri,omitempty"` + // OsType - This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed image.

Possible values are:

**Windows**

**Linux**. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // OsState - The allowed values for OS State are 'Generalized'. Possible values include: 'Generalized', 'Specialized' + OsState OperatingSystemStateTypes `json:"osState,omitempty"` + // EndOfLifeDate - The end of life date of the gallery Image Definition. This property can be used for decommissioning purposes. This property is updatable. + EndOfLifeDate *date.Time `json:"endOfLifeDate,omitempty"` + Identifier *GalleryImageIdentifier `json:"identifier,omitempty"` + Recommended *RecommendedMachineConfiguration `json:"recommended,omitempty"` + Disallowed *Disallowed `json:"disallowed,omitempty"` + PurchasePlan *ImagePurchasePlan `json:"purchasePlan,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. Possible values include: 'ProvisioningState1Creating', 'ProvisioningState1Updating', 'ProvisioningState1Failed', 'ProvisioningState1Succeeded', 'ProvisioningState1Deleting', 'ProvisioningState1Migrating' + ProvisioningState ProvisioningState1 `json:"provisioningState,omitempty"` +} + +// GalleryImagesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GalleryImagesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleryImagesCreateOrUpdateFuture) Result(client GalleryImagesClient) (gi GalleryImage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleryImagesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gi.Response.Response, err = future.GetResult(sender); err == nil && gi.Response.Response.StatusCode != http.StatusNoContent { + gi, err = client.CreateOrUpdateResponder(gi.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesCreateOrUpdateFuture", "Result", gi.Response.Response, "Failure responding to request") + } + } + return +} + +// GalleryImagesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GalleryImagesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleryImagesDeleteFuture) Result(client GalleryImagesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleryImagesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GalleryImageVersion specifies information about the gallery Image Version that you want to create or +// update. +type GalleryImageVersion struct { + autorest.Response `json:"-"` + *GalleryImageVersionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for GalleryImageVersion. +func (giv GalleryImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if giv.GalleryImageVersionProperties != nil { + objectMap["properties"] = giv.GalleryImageVersionProperties + } + if giv.Location != nil { + objectMap["location"] = giv.Location + } + if giv.Tags != nil { + objectMap["tags"] = giv.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryImageVersion struct. +func (giv *GalleryImageVersion) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var galleryImageVersionProperties GalleryImageVersionProperties + err = json.Unmarshal(*v, &galleryImageVersionProperties) + if err != nil { + return err + } + giv.GalleryImageVersionProperties = &galleryImageVersionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + giv.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + giv.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + giv.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + giv.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + giv.Tags = tags + } + } + } + + return nil +} + +// GalleryImageVersionList the List Gallery Image version operation response. +type GalleryImageVersionList struct { + autorest.Response `json:"-"` + // Value - A list of gallery Image Versions. + Value *[]GalleryImageVersion `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of gallery Image Versions. Call ListNext() with this to fetch the next page of gallery Image Versions. + NextLink *string `json:"nextLink,omitempty"` +} + +// GalleryImageVersionListIterator provides access to a complete listing of GalleryImageVersion values. +type GalleryImageVersionListIterator struct { + i int + page GalleryImageVersionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *GalleryImageVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *GalleryImageVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GalleryImageVersionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter GalleryImageVersionListIterator) Response() GalleryImageVersionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter GalleryImageVersionListIterator) Value() GalleryImageVersion { + if !iter.page.NotDone() { + return GalleryImageVersion{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GalleryImageVersionListIterator type. +func NewGalleryImageVersionListIterator(page GalleryImageVersionListPage) GalleryImageVersionListIterator { + return GalleryImageVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (givl GalleryImageVersionList) IsEmpty() bool { + return givl.Value == nil || len(*givl.Value) == 0 +} + +// galleryImageVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (givl GalleryImageVersionList) galleryImageVersionListPreparer(ctx context.Context) (*http.Request, error) { + if givl.NextLink == nil || len(to.String(givl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(givl.NextLink))) +} + +// GalleryImageVersionListPage contains a page of GalleryImageVersion values. +type GalleryImageVersionListPage struct { + fn func(context.Context, GalleryImageVersionList) (GalleryImageVersionList, error) + givl GalleryImageVersionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *GalleryImageVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.givl) + if err != nil { + return err + } + page.givl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *GalleryImageVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GalleryImageVersionListPage) NotDone() bool { + return !page.givl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GalleryImageVersionListPage) Response() GalleryImageVersionList { + return page.givl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GalleryImageVersionListPage) Values() []GalleryImageVersion { + if page.givl.IsEmpty() { + return nil + } + return *page.givl.Value +} + +// Creates a new instance of the GalleryImageVersionListPage type. +func NewGalleryImageVersionListPage(getNextPage func(context.Context, GalleryImageVersionList) (GalleryImageVersionList, error)) GalleryImageVersionListPage { + return GalleryImageVersionListPage{fn: getNextPage} +} + +// GalleryImageVersionProperties describes the properties of a gallery Image Version. +type GalleryImageVersionProperties struct { + PublishingProfile *GalleryImageVersionPublishingProfile `json:"publishingProfile,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. Possible values include: 'ProvisioningState2Creating', 'ProvisioningState2Updating', 'ProvisioningState2Failed', 'ProvisioningState2Succeeded', 'ProvisioningState2Deleting', 'ProvisioningState2Migrating' + ProvisioningState ProvisioningState2 `json:"provisioningState,omitempty"` + // StorageProfile - READ-ONLY + StorageProfile *GalleryImageVersionStorageProfile `json:"storageProfile,omitempty"` + // ReplicationStatus - READ-ONLY + ReplicationStatus *ReplicationStatus `json:"replicationStatus,omitempty"` +} + +// GalleryImageVersionPublishingProfile the publishing profile of a gallery Image Version. +type GalleryImageVersionPublishingProfile struct { + // ReplicaCount - The number of replicas of the Image Version to be created per region. This property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. + ReplicaCount *int32 `json:"replicaCount,omitempty"` + // ExcludeFromLatest - If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool `json:"excludeFromLatest,omitempty"` + // PublishedDate - READ-ONLY; The timestamp for when the gallery Image Version is published. + PublishedDate *date.Time `json:"publishedDate,omitempty"` + // EndOfLifeDate - The end of life date of the gallery Image Version. This property can be used for decommissioning purposes. This property is updatable. + EndOfLifeDate *date.Time `json:"endOfLifeDate,omitempty"` + // StorageAccountType - Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: 'StorageAccountTypeStandardLRS', 'StorageAccountTypeStandardZRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` + // TargetRegions - The target regions where the Image Version is going to be replicated to. This property is updatable. + TargetRegions *[]TargetRegion `json:"targetRegions,omitempty"` + Source *GalleryArtifactSource `json:"source,omitempty"` +} + +// GalleryImageVersionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GalleryImageVersionsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleryImageVersionsCreateOrUpdateFuture) Result(client GalleryImageVersionsClient) (giv GalleryImageVersion, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleryImageVersionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if giv.Response.Response, err = future.GetResult(sender); err == nil && giv.Response.Response.StatusCode != http.StatusNoContent { + giv, err = client.CreateOrUpdateResponder(giv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsCreateOrUpdateFuture", "Result", giv.Response.Response, "Failure responding to request") + } + } + return +} + +// GalleryImageVersionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GalleryImageVersionsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleryImageVersionsDeleteFuture) Result(client GalleryImageVersionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleryImageVersionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GalleryImageVersionStorageProfile this is the storage profile of a gallery Image Version. +type GalleryImageVersionStorageProfile struct { + // OsDiskImage - READ-ONLY + OsDiskImage *GalleryOSDiskImage `json:"osDiskImage,omitempty"` + // DataDiskImages - READ-ONLY; A list of data disk images. + DataDiskImages *[]GalleryDataDiskImage `json:"dataDiskImages,omitempty"` +} + +// GalleryList the List Galleries operation response. +type GalleryList struct { + autorest.Response `json:"-"` + // Value - A list of galleries. + Value *[]Gallery `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. + NextLink *string `json:"nextLink,omitempty"` +} + +// GalleryListIterator provides access to a complete listing of Gallery values. +type GalleryListIterator struct { + i int + page GalleryListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *GalleryListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *GalleryListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GalleryListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter GalleryListIterator) Response() GalleryList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter GalleryListIterator) Value() Gallery { + if !iter.page.NotDone() { + return Gallery{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GalleryListIterator type. +func NewGalleryListIterator(page GalleryListPage) GalleryListIterator { + return GalleryListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (gl GalleryList) IsEmpty() bool { + return gl.Value == nil || len(*gl.Value) == 0 +} + +// galleryListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (gl GalleryList) galleryListPreparer(ctx context.Context) (*http.Request, error) { + if gl.NextLink == nil || len(to.String(gl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(gl.NextLink))) +} + +// GalleryListPage contains a page of Gallery values. +type GalleryListPage struct { + fn func(context.Context, GalleryList) (GalleryList, error) + gl GalleryList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *GalleryListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.gl) + if err != nil { + return err + } + page.gl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *GalleryListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GalleryListPage) NotDone() bool { + return !page.gl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GalleryListPage) Response() GalleryList { + return page.gl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GalleryListPage) Values() []Gallery { + if page.gl.IsEmpty() { + return nil + } + return *page.gl.Value +} + +// Creates a new instance of the GalleryListPage type. +func NewGalleryListPage(getNextPage func(context.Context, GalleryList) (GalleryList, error)) GalleryListPage { + return GalleryListPage{fn: getNextPage} +} + +// GalleryOSDiskImage this is the OS disk image. +type GalleryOSDiskImage struct { + // SizeInGB - READ-ONLY; This property indicates the size of the VHD to be created. + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // HostCaching - READ-ONLY; The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values include: 'HostCachingNone', 'HostCachingReadOnly', 'HostCachingReadWrite' + HostCaching HostCaching `json:"hostCaching,omitempty"` +} + +// GalleryProperties describes the properties of a Shared Image Gallery. +type GalleryProperties struct { + // Description - The description of this Shared Image Gallery resource. This property is updatable. + Description *string `json:"description,omitempty"` + Identifier *GalleryIdentifier `json:"identifier,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateDeleting', 'ProvisioningStateMigrating' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// GrantAccessData data used for requesting a SAS. +type GrantAccessData struct { + // Access - Possible values include: 'None', 'Read', 'Write' + Access AccessLevel `json:"access,omitempty"` + // DurationInSeconds - Time duration in seconds until the SAS access expires. + DurationInSeconds *int32 `json:"durationInSeconds,omitempty"` +} + +// HardwareProfile specifies the hardware settings for the virtual machine. +type HardwareProfile struct { + // VMSize - Specifies the size of the virtual machine. For more information about virtual machine sizes, see [Sizes for virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-sizes?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).

The available VM sizes depend on region and availability set. For a list of available sizes use these APIs:

[List all available virtual machine sizes in an availability set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes)

[List all available virtual machine sizes in a region](https://docs.microsoft.com/rest/api/compute/virtualmachinesizes/list)

[List all available virtual machine sizes for resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). Possible values include: 'VirtualMachineSizeTypesBasicA0', 'VirtualMachineSizeTypesBasicA1', 'VirtualMachineSizeTypesBasicA2', 'VirtualMachineSizeTypesBasicA3', 'VirtualMachineSizeTypesBasicA4', 'VirtualMachineSizeTypesStandardA0', 'VirtualMachineSizeTypesStandardA1', 'VirtualMachineSizeTypesStandardA2', 'VirtualMachineSizeTypesStandardA3', 'VirtualMachineSizeTypesStandardA4', 'VirtualMachineSizeTypesStandardA5', 'VirtualMachineSizeTypesStandardA6', 'VirtualMachineSizeTypesStandardA7', 'VirtualMachineSizeTypesStandardA8', 'VirtualMachineSizeTypesStandardA9', 'VirtualMachineSizeTypesStandardA10', 'VirtualMachineSizeTypesStandardA11', 'VirtualMachineSizeTypesStandardA1V2', 'VirtualMachineSizeTypesStandardA2V2', 'VirtualMachineSizeTypesStandardA4V2', 'VirtualMachineSizeTypesStandardA8V2', 'VirtualMachineSizeTypesStandardA2mV2', 'VirtualMachineSizeTypesStandardA4mV2', 'VirtualMachineSizeTypesStandardA8mV2', 'VirtualMachineSizeTypesStandardB1s', 'VirtualMachineSizeTypesStandardB1ms', 'VirtualMachineSizeTypesStandardB2s', 'VirtualMachineSizeTypesStandardB2ms', 'VirtualMachineSizeTypesStandardB4ms', 'VirtualMachineSizeTypesStandardB8ms', 'VirtualMachineSizeTypesStandardD1', 'VirtualMachineSizeTypesStandardD2', 'VirtualMachineSizeTypesStandardD3', 'VirtualMachineSizeTypesStandardD4', 'VirtualMachineSizeTypesStandardD11', 'VirtualMachineSizeTypesStandardD12', 'VirtualMachineSizeTypesStandardD13', 'VirtualMachineSizeTypesStandardD14', 'VirtualMachineSizeTypesStandardD1V2', 'VirtualMachineSizeTypesStandardD2V2', 'VirtualMachineSizeTypesStandardD3V2', 'VirtualMachineSizeTypesStandardD4V2', 'VirtualMachineSizeTypesStandardD5V2', 'VirtualMachineSizeTypesStandardD2V3', 'VirtualMachineSizeTypesStandardD4V3', 'VirtualMachineSizeTypesStandardD8V3', 'VirtualMachineSizeTypesStandardD16V3', 'VirtualMachineSizeTypesStandardD32V3', 'VirtualMachineSizeTypesStandardD64V3', 'VirtualMachineSizeTypesStandardD2sV3', 'VirtualMachineSizeTypesStandardD4sV3', 'VirtualMachineSizeTypesStandardD8sV3', 'VirtualMachineSizeTypesStandardD16sV3', 'VirtualMachineSizeTypesStandardD32sV3', 'VirtualMachineSizeTypesStandardD64sV3', 'VirtualMachineSizeTypesStandardD11V2', 'VirtualMachineSizeTypesStandardD12V2', 'VirtualMachineSizeTypesStandardD13V2', 'VirtualMachineSizeTypesStandardD14V2', 'VirtualMachineSizeTypesStandardD15V2', 'VirtualMachineSizeTypesStandardDS1', 'VirtualMachineSizeTypesStandardDS2', 'VirtualMachineSizeTypesStandardDS3', 'VirtualMachineSizeTypesStandardDS4', 'VirtualMachineSizeTypesStandardDS11', 'VirtualMachineSizeTypesStandardDS12', 'VirtualMachineSizeTypesStandardDS13', 'VirtualMachineSizeTypesStandardDS14', 'VirtualMachineSizeTypesStandardDS1V2', 'VirtualMachineSizeTypesStandardDS2V2', 'VirtualMachineSizeTypesStandardDS3V2', 'VirtualMachineSizeTypesStandardDS4V2', 'VirtualMachineSizeTypesStandardDS5V2', 'VirtualMachineSizeTypesStandardDS11V2', 'VirtualMachineSizeTypesStandardDS12V2', 'VirtualMachineSizeTypesStandardDS13V2', 'VirtualMachineSizeTypesStandardDS14V2', 'VirtualMachineSizeTypesStandardDS15V2', 'VirtualMachineSizeTypesStandardDS134V2', 'VirtualMachineSizeTypesStandardDS132V2', 'VirtualMachineSizeTypesStandardDS148V2', 'VirtualMachineSizeTypesStandardDS144V2', 'VirtualMachineSizeTypesStandardE2V3', 'VirtualMachineSizeTypesStandardE4V3', 'VirtualMachineSizeTypesStandardE8V3', 'VirtualMachineSizeTypesStandardE16V3', 'VirtualMachineSizeTypesStandardE32V3', 'VirtualMachineSizeTypesStandardE64V3', 'VirtualMachineSizeTypesStandardE2sV3', 'VirtualMachineSizeTypesStandardE4sV3', 'VirtualMachineSizeTypesStandardE8sV3', 'VirtualMachineSizeTypesStandardE16sV3', 'VirtualMachineSizeTypesStandardE32sV3', 'VirtualMachineSizeTypesStandardE64sV3', 'VirtualMachineSizeTypesStandardE3216V3', 'VirtualMachineSizeTypesStandardE328sV3', 'VirtualMachineSizeTypesStandardE6432sV3', 'VirtualMachineSizeTypesStandardE6416sV3', 'VirtualMachineSizeTypesStandardF1', 'VirtualMachineSizeTypesStandardF2', 'VirtualMachineSizeTypesStandardF4', 'VirtualMachineSizeTypesStandardF8', 'VirtualMachineSizeTypesStandardF16', 'VirtualMachineSizeTypesStandardF1s', 'VirtualMachineSizeTypesStandardF2s', 'VirtualMachineSizeTypesStandardF4s', 'VirtualMachineSizeTypesStandardF8s', 'VirtualMachineSizeTypesStandardF16s', 'VirtualMachineSizeTypesStandardF2sV2', 'VirtualMachineSizeTypesStandardF4sV2', 'VirtualMachineSizeTypesStandardF8sV2', 'VirtualMachineSizeTypesStandardF16sV2', 'VirtualMachineSizeTypesStandardF32sV2', 'VirtualMachineSizeTypesStandardF64sV2', 'VirtualMachineSizeTypesStandardF72sV2', 'VirtualMachineSizeTypesStandardG1', 'VirtualMachineSizeTypesStandardG2', 'VirtualMachineSizeTypesStandardG3', 'VirtualMachineSizeTypesStandardG4', 'VirtualMachineSizeTypesStandardG5', 'VirtualMachineSizeTypesStandardGS1', 'VirtualMachineSizeTypesStandardGS2', 'VirtualMachineSizeTypesStandardGS3', 'VirtualMachineSizeTypesStandardGS4', 'VirtualMachineSizeTypesStandardGS5', 'VirtualMachineSizeTypesStandardGS48', 'VirtualMachineSizeTypesStandardGS44', 'VirtualMachineSizeTypesStandardGS516', 'VirtualMachineSizeTypesStandardGS58', 'VirtualMachineSizeTypesStandardH8', 'VirtualMachineSizeTypesStandardH16', 'VirtualMachineSizeTypesStandardH8m', 'VirtualMachineSizeTypesStandardH16m', 'VirtualMachineSizeTypesStandardH16r', 'VirtualMachineSizeTypesStandardH16mr', 'VirtualMachineSizeTypesStandardL4s', 'VirtualMachineSizeTypesStandardL8s', 'VirtualMachineSizeTypesStandardL16s', 'VirtualMachineSizeTypesStandardL32s', 'VirtualMachineSizeTypesStandardM64s', 'VirtualMachineSizeTypesStandardM64ms', 'VirtualMachineSizeTypesStandardM128s', 'VirtualMachineSizeTypesStandardM128ms', 'VirtualMachineSizeTypesStandardM6432ms', 'VirtualMachineSizeTypesStandardM6416ms', 'VirtualMachineSizeTypesStandardM12864ms', 'VirtualMachineSizeTypesStandardM12832ms', 'VirtualMachineSizeTypesStandardNC6', 'VirtualMachineSizeTypesStandardNC12', 'VirtualMachineSizeTypesStandardNC24', 'VirtualMachineSizeTypesStandardNC24r', 'VirtualMachineSizeTypesStandardNC6sV2', 'VirtualMachineSizeTypesStandardNC12sV2', 'VirtualMachineSizeTypesStandardNC24sV2', 'VirtualMachineSizeTypesStandardNC24rsV2', 'VirtualMachineSizeTypesStandardNC6sV3', 'VirtualMachineSizeTypesStandardNC12sV3', 'VirtualMachineSizeTypesStandardNC24sV3', 'VirtualMachineSizeTypesStandardNC24rsV3', 'VirtualMachineSizeTypesStandardND6s', 'VirtualMachineSizeTypesStandardND12s', 'VirtualMachineSizeTypesStandardND24s', 'VirtualMachineSizeTypesStandardND24rs', 'VirtualMachineSizeTypesStandardNV6', 'VirtualMachineSizeTypesStandardNV12', 'VirtualMachineSizeTypesStandardNV24' + VMSize VirtualMachineSizeTypes `json:"vmSize,omitempty"` +} + +// Image the source user image virtual hard disk. The virtual hard disk will be copied before being +// attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not +// exist. +type Image struct { + autorest.Response `json:"-"` + *ImageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Image. +func (i Image) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.ImageProperties != nil { + objectMap["properties"] = i.ImageProperties + } + if i.Location != nil { + objectMap["location"] = i.Location + } + if i.Tags != nil { + objectMap["tags"] = i.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Image struct. +func (i *Image) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var imageProperties ImageProperties + err = json.Unmarshal(*v, &imageProperties) + if err != nil { + return err + } + i.ImageProperties = &imageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + i.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + i.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + i.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + i.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + i.Tags = tags + } + } + } + + return nil +} + +// ImageDataDisk describes a data disk. +type ImageDataDisk struct { + // Lun - Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. + Lun *int32 `json:"lun,omitempty"` + // Snapshot - The snapshot. + Snapshot *SubResource `json:"snapshot,omitempty"` + // ManagedDisk - The managedDisk. + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + // BlobURI - The Virtual Hard Disk. + BlobURI *string `json:"blobUri,omitempty"` + // Caching - Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // DiskSizeGB - Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // StorageAccountType - Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values include: 'StorageAccountTypesStandardLRS', 'StorageAccountTypesPremiumLRS', 'StorageAccountTypesStandardSSDLRS', 'StorageAccountTypesUltraSSDLRS' + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// ImageDiskReference the source image used for creating the disk. +type ImageDiskReference struct { + // ID - A relative uri containing either a Platform Image Repository or user image reference. + ID *string `json:"id,omitempty"` + // Lun - If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. + Lun *int32 `json:"lun,omitempty"` +} + +// ImageListResult the List Image operation response. +type ImageListResult struct { + autorest.Response `json:"-"` + // Value - The list of Images. + Value *[]Image `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Images. Call ListNext() with this to fetch the next page of Images. + NextLink *string `json:"nextLink,omitempty"` +} + +// ImageListResultIterator provides access to a complete listing of Image values. +type ImageListResultIterator struct { + i int + page ImageListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ImageListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImageListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ImageListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ImageListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ImageListResultIterator) Response() ImageListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ImageListResultIterator) Value() Image { + if !iter.page.NotDone() { + return Image{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ImageListResultIterator type. +func NewImageListResultIterator(page ImageListResultPage) ImageListResultIterator { + return ImageListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ilr ImageListResult) IsEmpty() bool { + return ilr.Value == nil || len(*ilr.Value) == 0 +} + +// imageListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ilr ImageListResult) imageListResultPreparer(ctx context.Context) (*http.Request, error) { + if ilr.NextLink == nil || len(to.String(ilr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ilr.NextLink))) +} + +// ImageListResultPage contains a page of Image values. +type ImageListResultPage struct { + fn func(context.Context, ImageListResult) (ImageListResult, error) + ilr ImageListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ImageListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImageListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.ilr) + if err != nil { + return err + } + page.ilr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ImageListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ImageListResultPage) NotDone() bool { + return !page.ilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ImageListResultPage) Response() ImageListResult { + return page.ilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ImageListResultPage) Values() []Image { + if page.ilr.IsEmpty() { + return nil + } + return *page.ilr.Value +} + +// Creates a new instance of the ImageListResultPage type. +func NewImageListResultPage(getNextPage func(context.Context, ImageListResult) (ImageListResult, error)) ImageListResultPage { + return ImageListResultPage{fn: getNextPage} +} + +// ImageOSDisk describes an Operating System disk. +type ImageOSDisk struct { + // OsType - This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image.

Possible values are:

**Windows**

**Linux**. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // OsState - The OS State. Possible values include: 'Generalized', 'Specialized' + OsState OperatingSystemStateTypes `json:"osState,omitempty"` + // Snapshot - The snapshot. + Snapshot *SubResource `json:"snapshot,omitempty"` + // ManagedDisk - The managedDisk. + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + // BlobURI - The Virtual Hard Disk. + BlobURI *string `json:"blobUri,omitempty"` + // Caching - Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // DiskSizeGB - Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // StorageAccountType - Specifies the storage account type for the managed disk. UltraSSD_LRS cannot be used with OS Disk. Possible values include: 'StorageAccountTypesStandardLRS', 'StorageAccountTypesPremiumLRS', 'StorageAccountTypesStandardSSDLRS', 'StorageAccountTypesUltraSSDLRS' + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// ImageProperties describes the properties of an Image. +type ImageProperties struct { + // SourceVirtualMachine - The source virtual machine from which Image is created. + SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` + // StorageProfile - Specifies the storage settings for the virtual machine disks. + StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // HyperVGeneration - Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: 'HyperVGenerationTypesV1', 'HyperVGenerationTypesV2' + HyperVGeneration HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` +} + +// ImagePurchasePlan describes the gallery Image Definition purchase plan. This is used by marketplace +// images. +type ImagePurchasePlan struct { + // Name - The plan ID. + Name *string `json:"name,omitempty"` + // Publisher - The publisher ID. + Publisher *string `json:"publisher,omitempty"` + // Product - The product ID. + Product *string `json:"product,omitempty"` +} + +// ImageReference specifies information about the image to use. You can specify information about platform +// images, marketplace images, or virtual machine images. This element is required when you want to use a +// platform image, marketplace image, or virtual machine image, but is not used in other creation +// operations. +type ImageReference struct { + // Publisher - The image publisher. + Publisher *string `json:"publisher,omitempty"` + // Offer - Specifies the offer of the platform image or marketplace image used to create the virtual machine. + Offer *string `json:"offer,omitempty"` + // Sku - The image SKU. + Sku *string `json:"sku,omitempty"` + // Version - Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. + Version *string `json:"version,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// ImagesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ImagesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ImagesCreateOrUpdateFuture) Result(client ImagesClient) (i Image, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.ImagesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if i.Response.Response, err = future.GetResult(sender); err == nil && i.Response.Response.StatusCode != http.StatusNoContent { + i, err = client.CreateOrUpdateResponder(i.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") + } + } + return +} + +// ImagesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ImagesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ImagesDeleteFuture) Result(client ImagesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.ImagesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ImageStorageProfile describes a storage profile. +type ImageStorageProfile struct { + // OsDisk - Specifies information about the operating system disk used by the virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + OsDisk *ImageOSDisk `json:"osDisk,omitempty"` + // DataDisks - Specifies the parameters that are used to add a data disk to a virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + DataDisks *[]ImageDataDisk `json:"dataDisks,omitempty"` + // ZoneResilient - Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} + +// ImagesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ImagesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ImagesUpdateFuture) Result(client ImagesClient) (i Image, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.ImagesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if i.Response.Response, err = future.GetResult(sender); err == nil && i.Response.Response.StatusCode != http.StatusNoContent { + i, err = client.UpdateResponder(i.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesUpdateFuture", "Result", i.Response.Response, "Failure responding to request") + } + } + return +} + +// ImageUpdate the source user image virtual hard disk. Only tags may be updated. +type ImageUpdate struct { + *ImageProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ImageUpdate. +func (iu ImageUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iu.ImageProperties != nil { + objectMap["properties"] = iu.ImageProperties + } + if iu.Tags != nil { + objectMap["tags"] = iu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ImageUpdate struct. +func (iu *ImageUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var imageProperties ImageProperties + err = json.Unmarshal(*v, &imageProperties) + if err != nil { + return err + } + iu.ImageProperties = &imageProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + iu.Tags = tags + } + } + } + + return nil +} + +// InnerError inner error details. +type InnerError struct { + // Exceptiontype - The exception type. + Exceptiontype *string `json:"exceptiontype,omitempty"` + // Errordetail - The internal error message or exception dump. + Errordetail *string `json:"errordetail,omitempty"` +} + +// InstanceViewStatus instance view status. +type InstanceViewStatus struct { + // Code - The status code. + Code *string `json:"code,omitempty"` + // Level - The level code. Possible values include: 'Info', 'Warning', 'Error' + Level StatusLevelTypes `json:"level,omitempty"` + // DisplayStatus - The short localizable label for the status. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Message - The detailed status message, including for alerts and error messages. + Message *string `json:"message,omitempty"` + // Time - The time of the status. + Time *date.Time `json:"time,omitempty"` +} + +// KeyVaultAndKeyReference key Vault Key Url and vault id of KeK, KeK is optional and when provided is used +// to unwrap the encryptionKey +type KeyVaultAndKeyReference struct { + // SourceVault - Resource id of the KeyVault containing the key or secret + SourceVault *SourceVault `json:"sourceVault,omitempty"` + // KeyURL - Url pointing to a key or secret in KeyVault + KeyURL *string `json:"keyUrl,omitempty"` +} + +// KeyVaultAndSecretReference key Vault Secret Url and vault id of the encryption key +type KeyVaultAndSecretReference struct { + // SourceVault - Resource id of the KeyVault containing the key or secret + SourceVault *SourceVault `json:"sourceVault,omitempty"` + // SecretURL - Url pointing to a key or secret in KeyVault + SecretURL *string `json:"secretUrl,omitempty"` +} + +// KeyVaultKeyReference describes a reference to Key Vault Key +type KeyVaultKeyReference struct { + // KeyURL - The URL referencing a key encryption key in Key Vault. + KeyURL *string `json:"keyUrl,omitempty"` + // SourceVault - The relative URL of the Key Vault containing the key. + SourceVault *SubResource `json:"sourceVault,omitempty"` +} + +// KeyVaultSecretReference describes a reference to Key Vault Secret +type KeyVaultSecretReference struct { + // SecretURL - The URL referencing a secret in a Key Vault. + SecretURL *string `json:"secretUrl,omitempty"` + // SourceVault - The relative URL of the Key Vault containing the secret. + SourceVault *SubResource `json:"sourceVault,omitempty"` +} + +// LinuxConfiguration specifies the Linux operating system settings on the virtual machine.

For a +// list of supported Linux distributions, see [Linux on Azure-Endorsed +// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) +//

For running non-endorsed distributions, see [Information for Non-Endorsed +// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). +type LinuxConfiguration struct { + // DisablePasswordAuthentication - Specifies whether password authentication should be disabled. + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + // SSH - Specifies the ssh key configuration for a Linux OS. + SSH *SSHConfiguration `json:"ssh,omitempty"` + // ProvisionVMAgent - Indicates whether virtual machine agent should be provisioned on the virtual machine.

When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later. + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` +} + +// ListUsagesResult the List Usages operation response. +type ListUsagesResult struct { + autorest.Response `json:"-"` + // Value - The list of compute resource usages. + Value *[]Usage `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of compute resource usage information. Call ListNext() with this to fetch the next page of compute resource usage information. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListUsagesResultIterator provides access to a complete listing of Usage values. +type ListUsagesResultIterator struct { + i int + page ListUsagesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListUsagesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListUsagesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListUsagesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListUsagesResultIterator) Response() ListUsagesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListUsagesResultIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListUsagesResultIterator type. +func NewListUsagesResultIterator(page ListUsagesResultPage) ListUsagesResultIterator { + return ListUsagesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lur ListUsagesResult) IsEmpty() bool { + return lur.Value == nil || len(*lur.Value) == 0 +} + +// listUsagesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lur ListUsagesResult) listUsagesResultPreparer(ctx context.Context) (*http.Request, error) { + if lur.NextLink == nil || len(to.String(lur.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lur.NextLink))) +} + +// ListUsagesResultPage contains a page of Usage values. +type ListUsagesResultPage struct { + fn func(context.Context, ListUsagesResult) (ListUsagesResult, error) + lur ListUsagesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListUsagesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.lur) + if err != nil { + return err + } + page.lur = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListUsagesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListUsagesResultPage) NotDone() bool { + return !page.lur.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListUsagesResultPage) Response() ListUsagesResult { + return page.lur +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListUsagesResultPage) Values() []Usage { + if page.lur.IsEmpty() { + return nil + } + return *page.lur.Value +} + +// Creates a new instance of the ListUsagesResultPage type. +func NewListUsagesResultPage(getNextPage func(context.Context, ListUsagesResult) (ListUsagesResult, error)) ListUsagesResultPage { + return ListUsagesResultPage{fn: getNextPage} +} + +// ListVirtualMachineExtensionImage ... +type ListVirtualMachineExtensionImage struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineExtensionImage `json:"value,omitempty"` +} + +// ListVirtualMachineImageResource ... +type ListVirtualMachineImageResource struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineImageResource `json:"value,omitempty"` +} + +// LogAnalyticsExportRequestRateByIntervalFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type LogAnalyticsExportRequestRateByIntervalFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LogAnalyticsExportRequestRateByIntervalFuture) Result(client LogAnalyticsClient) (laor LogAnalyticsOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportRequestRateByIntervalFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.LogAnalyticsExportRequestRateByIntervalFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if laor.Response.Response, err = future.GetResult(sender); err == nil && laor.Response.Response.StatusCode != http.StatusNoContent { + laor, err = client.ExportRequestRateByIntervalResponder(laor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportRequestRateByIntervalFuture", "Result", laor.Response.Response, "Failure responding to request") + } + } + return +} + +// LogAnalyticsExportThrottledRequestsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LogAnalyticsExportThrottledRequestsFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LogAnalyticsExportThrottledRequestsFuture) Result(client LogAnalyticsClient) (laor LogAnalyticsOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportThrottledRequestsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.LogAnalyticsExportThrottledRequestsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if laor.Response.Response, err = future.GetResult(sender); err == nil && laor.Response.Response.StatusCode != http.StatusNoContent { + laor, err = client.ExportThrottledRequestsResponder(laor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportThrottledRequestsFuture", "Result", laor.Response.Response, "Failure responding to request") + } + } + return +} + +// LogAnalyticsInputBase api input base class for LogAnalytics Api. +type LogAnalyticsInputBase struct { + // BlobContainerSasURI - SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + BlobContainerSasURI *string `json:"blobContainerSasUri,omitempty"` + // FromTime - From time of the query + FromTime *date.Time `json:"fromTime,omitempty"` + // ToTime - To time of the query + ToTime *date.Time `json:"toTime,omitempty"` + // GroupByThrottlePolicy - Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + // GroupByOperationName - Group query result by Operation Name. + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + // GroupByResourceName - Group query result by Resource Name. + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` +} + +// LogAnalyticsOperationResult logAnalytics operation status response +type LogAnalyticsOperationResult struct { + autorest.Response `json:"-"` + // Properties - READ-ONLY; LogAnalyticsOutput + Properties *LogAnalyticsOutput `json:"properties,omitempty"` +} + +// LogAnalyticsOutput logAnalytics output properties +type LogAnalyticsOutput struct { + // Output - READ-ONLY; Output file Uri path to blob container. + Output *string `json:"output,omitempty"` +} + +// MaintenanceRedeployStatus maintenance Operation Status. +type MaintenanceRedeployStatus struct { + // IsCustomerInitiatedMaintenanceAllowed - True, if customer is allowed to perform Maintenance. + IsCustomerInitiatedMaintenanceAllowed *bool `json:"isCustomerInitiatedMaintenanceAllowed,omitempty"` + // PreMaintenanceWindowStartTime - Start Time for the Pre Maintenance Window. + PreMaintenanceWindowStartTime *date.Time `json:"preMaintenanceWindowStartTime,omitempty"` + // PreMaintenanceWindowEndTime - End Time for the Pre Maintenance Window. + PreMaintenanceWindowEndTime *date.Time `json:"preMaintenanceWindowEndTime,omitempty"` + // MaintenanceWindowStartTime - Start Time for the Maintenance Window. + MaintenanceWindowStartTime *date.Time `json:"maintenanceWindowStartTime,omitempty"` + // MaintenanceWindowEndTime - End Time for the Maintenance Window. + MaintenanceWindowEndTime *date.Time `json:"maintenanceWindowEndTime,omitempty"` + // LastOperationResultCode - The Last Maintenance Operation Result Code. Possible values include: 'MaintenanceOperationResultCodeTypesNone', 'MaintenanceOperationResultCodeTypesRetryLater', 'MaintenanceOperationResultCodeTypesMaintenanceAborted', 'MaintenanceOperationResultCodeTypesMaintenanceCompleted' + LastOperationResultCode MaintenanceOperationResultCodeTypes `json:"lastOperationResultCode,omitempty"` + // LastOperationMessage - Message returned for the last Maintenance Operation. + LastOperationMessage *string `json:"lastOperationMessage,omitempty"` +} + +// ManagedArtifact the managed artifact. +type ManagedArtifact struct { + // ID - The managed artifact id. + ID *string `json:"id,omitempty"` +} + +// ManagedDiskParameters the parameters of a managed disk. +type ManagedDiskParameters struct { + // StorageAccountType - Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values include: 'StorageAccountTypesStandardLRS', 'StorageAccountTypesPremiumLRS', 'StorageAccountTypesStandardSSDLRS', 'StorageAccountTypesUltraSSDLRS' + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// NetworkInterfaceReference describes a network interface reference. +type NetworkInterfaceReference struct { + *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkInterfaceReference. +func (nir NetworkInterfaceReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if nir.NetworkInterfaceReferenceProperties != nil { + objectMap["properties"] = nir.NetworkInterfaceReferenceProperties + } + if nir.ID != nil { + objectMap["id"] = nir.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for NetworkInterfaceReference struct. +func (nir *NetworkInterfaceReference) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var networkInterfaceReferenceProperties NetworkInterfaceReferenceProperties + err = json.Unmarshal(*v, &networkInterfaceReferenceProperties) + if err != nil { + return err + } + nir.NetworkInterfaceReferenceProperties = &networkInterfaceReferenceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + nir.ID = &ID + } + } + } + + return nil +} + +// NetworkInterfaceReferenceProperties describes a network interface reference properties. +type NetworkInterfaceReferenceProperties struct { + // Primary - Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` +} + +// NetworkProfile specifies the network interfaces of the virtual machine. +type NetworkProfile struct { + // NetworkInterfaces - Specifies the list of resource Ids for the network interfaces associated with the virtual machine. + NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` +} + +// OperationListResult the List Compute Operation operation response. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of compute operations + Value *[]OperationValue `json:"value,omitempty"` +} + +// OperationValue describes the properties of a Compute Operation value. +type OperationValue struct { + // Origin - READ-ONLY; The origin of the compute operation. + Origin *string `json:"origin,omitempty"` + // Name - READ-ONLY; The name of the compute operation. + Name *string `json:"name,omitempty"` + *OperationValueDisplay `json:"display,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationValue. +func (ov OperationValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ov.OperationValueDisplay != nil { + objectMap["display"] = ov.OperationValueDisplay + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OperationValue struct. +func (ov *OperationValue) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + ov.Origin = &origin + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ov.Name = &name + } + case "display": + if v != nil { + var operationValueDisplay OperationValueDisplay + err = json.Unmarshal(*v, &operationValueDisplay) + if err != nil { + return err + } + ov.OperationValueDisplay = &operationValueDisplay + } + } + } + + return nil +} + +// OperationValueDisplay describes the properties of a Compute Operation Value Display. +type OperationValueDisplay struct { + // Operation - READ-ONLY; The display name of the compute operation. + Operation *string `json:"operation,omitempty"` + // Resource - READ-ONLY; The display name of the resource the operation applies to. + Resource *string `json:"resource,omitempty"` + // Description - READ-ONLY; The description of the operation. + Description *string `json:"description,omitempty"` + // Provider - READ-ONLY; The resource provider for the operation. + Provider *string `json:"provider,omitempty"` +} + +// OSDisk specifies information about the operating system disk used by the virtual machine.

For +// more information about disks, see [About disks and VHDs for Azure virtual +// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). +type OSDisk struct { + // OsType - This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD.

Possible values are:

**Windows**

**Linux**. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // EncryptionSettings - Specifies the encryption settings for the OS Disk.

Minimum api-version: 2015-06-15 + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + // Name - The disk name. + Name *string `json:"name,omitempty"` + // Vhd - The virtual hard disk. + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + // Image - The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. + Image *VirtualHardDisk `json:"image,omitempty"` + // Caching - Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // DiffDiskSettings - Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + // CreateOption - Specifies how the virtual machine should be created.

Possible values are:

**Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.

**FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach' + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` +} + +// OSDiskImage contains the os disk image information. +type OSDiskImage struct { + // OperatingSystem - The operating system of the osDiskImage. Possible values include: 'Windows', 'Linux' + OperatingSystem OperatingSystemTypes `json:"operatingSystem,omitempty"` +} + +// OSProfile specifies the operating system settings for the virtual machine. +type OSProfile struct { + // ComputerName - Specifies the host OS name of the virtual machine.

This name cannot be updated after the VM is created.

**Max-length (Windows):** 15 characters

**Max-length (Linux):** 64 characters.

For naming conventions and restrictions see [Azure infrastructure services implementation guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). + ComputerName *string `json:"computerName,omitempty"` + // AdminUsername - Specifies the name of the administrator account.

**Windows-only restriction:** Cannot end in "."

**Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".

**Minimum-length (Linux):** 1 character

**Max-length (Linux):** 64 characters

**Max-length (Windows):** 20 characters

  • For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
  • For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + AdminUsername *string `json:"adminUsername,omitempty"` + // AdminPassword - Specifies the password of the administrator account.

    **Minimum-length (Windows):** 8 characters

    **Minimum-length (Linux):** 6 characters

    **Max-length (Windows):** 123 characters

    **Max-length (Linux):** 72 characters

    **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
    Has lower characters
    Has upper characters
    Has a digit
    Has a special character (Regex match [\W_])

    **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"

    For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password) + AdminPassword *string `json:"adminPassword,omitempty"` + // CustomData - Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes.

    For using cloud-init for your VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + CustomData *string `json:"customData,omitempty"` + // WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + // LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine.

    For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)

    For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + // Secrets - Specifies set of certificates that should be installed onto the virtual machine. + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + // AllowExtensionOperations - Specifies whether extension operations should be allowed on the virtual machine.

    This may only be set to False when no extensions are present on the virtual machine. + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` +} + +// Plan specifies information about the marketplace image used to create the virtual machine. This element +// is only used for marketplace images. Before you can use a marketplace image from an API, you must enable +// the image for programmatic use. In the Azure portal, find the marketplace image that you want to use +// and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and +// then click **Save**. +type Plan struct { + // Name - The plan ID. + Name *string `json:"name,omitempty"` + // Publisher - The publisher ID. + Publisher *string `json:"publisher,omitempty"` + // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. + Product *string `json:"product,omitempty"` + // PromotionCode - The promotion code. + PromotionCode *string `json:"promotionCode,omitempty"` +} + +// ProximityPlacementGroup specifies information about the proximity placement group. +type ProximityPlacementGroup struct { + autorest.Response `json:"-"` + // ProximityPlacementGroupProperties - Describes the properties of a Proximity Placement Group. + *ProximityPlacementGroupProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ProximityPlacementGroup. +func (ppg ProximityPlacementGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ppg.ProximityPlacementGroupProperties != nil { + objectMap["properties"] = ppg.ProximityPlacementGroupProperties + } + if ppg.Location != nil { + objectMap["location"] = ppg.Location + } + if ppg.Tags != nil { + objectMap["tags"] = ppg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ProximityPlacementGroup struct. +func (ppg *ProximityPlacementGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var proximityPlacementGroupProperties ProximityPlacementGroupProperties + err = json.Unmarshal(*v, &proximityPlacementGroupProperties) + if err != nil { + return err + } + ppg.ProximityPlacementGroupProperties = &proximityPlacementGroupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ppg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ppg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ppg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ppg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ppg.Tags = tags + } + } + } + + return nil +} + +// ProximityPlacementGroupListResult the List Proximity Placement Group operation response. +type ProximityPlacementGroupListResult struct { + autorest.Response `json:"-"` + // Value - The list of proximity placement groups + Value *[]ProximityPlacementGroup `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of proximity placement groups. + NextLink *string `json:"nextLink,omitempty"` +} + +// ProximityPlacementGroupListResultIterator provides access to a complete listing of +// ProximityPlacementGroup values. +type ProximityPlacementGroupListResultIterator struct { + i int + page ProximityPlacementGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProximityPlacementGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProximityPlacementGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProximityPlacementGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProximityPlacementGroupListResultIterator) Response() ProximityPlacementGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProximityPlacementGroupListResultIterator) Value() ProximityPlacementGroup { + if !iter.page.NotDone() { + return ProximityPlacementGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProximityPlacementGroupListResultIterator type. +func NewProximityPlacementGroupListResultIterator(page ProximityPlacementGroupListResultPage) ProximityPlacementGroupListResultIterator { + return ProximityPlacementGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ppglr ProximityPlacementGroupListResult) IsEmpty() bool { + return ppglr.Value == nil || len(*ppglr.Value) == 0 +} + +// proximityPlacementGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ppglr ProximityPlacementGroupListResult) proximityPlacementGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if ppglr.NextLink == nil || len(to.String(ppglr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ppglr.NextLink))) +} + +// ProximityPlacementGroupListResultPage contains a page of ProximityPlacementGroup values. +type ProximityPlacementGroupListResultPage struct { + fn func(context.Context, ProximityPlacementGroupListResult) (ProximityPlacementGroupListResult, error) + ppglr ProximityPlacementGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProximityPlacementGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.ppglr) + if err != nil { + return err + } + page.ppglr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProximityPlacementGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProximityPlacementGroupListResultPage) NotDone() bool { + return !page.ppglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProximityPlacementGroupListResultPage) Response() ProximityPlacementGroupListResult { + return page.ppglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProximityPlacementGroupListResultPage) Values() []ProximityPlacementGroup { + if page.ppglr.IsEmpty() { + return nil + } + return *page.ppglr.Value +} + +// Creates a new instance of the ProximityPlacementGroupListResultPage type. +func NewProximityPlacementGroupListResultPage(getNextPage func(context.Context, ProximityPlacementGroupListResult) (ProximityPlacementGroupListResult, error)) ProximityPlacementGroupListResultPage { + return ProximityPlacementGroupListResultPage{fn: getNextPage} +} + +// ProximityPlacementGroupProperties describes the properties of a Proximity Placement Group. +type ProximityPlacementGroupProperties struct { + // ProximityPlacementGroupType - Specifies the type of the proximity placement group.

    Possible values are:

    **Standard**

    **Ultra**. Possible values include: 'Standard', 'Ultra' + ProximityPlacementGroupType ProximityPlacementGroupType `json:"proximityPlacementGroupType,omitempty"` + // VirtualMachines - READ-ONLY; A list of references to all virtual machines in the proximity placement group. + VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` + // VirtualMachineScaleSets - READ-ONLY; A list of references to all virtual machine scale sets in the proximity placement group. + VirtualMachineScaleSets *[]SubResource `json:"virtualMachineScaleSets,omitempty"` + // AvailabilitySets - READ-ONLY; A list of references to all availability sets in the proximity placement group. + AvailabilitySets *[]SubResource `json:"availabilitySets,omitempty"` +} + +// ProximityPlacementGroupUpdate specifies information about the proximity placement group. +type ProximityPlacementGroupUpdate struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ProximityPlacementGroupUpdate. +func (ppgu ProximityPlacementGroupUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ppgu.Tags != nil { + objectMap["tags"] = ppgu.Tags + } + return json.Marshal(objectMap) +} + +// PurchasePlan used for establishing the purchase context of any 3rd Party artifact through MarketPlace. +type PurchasePlan struct { + // Publisher - The publisher ID. + Publisher *string `json:"publisher,omitempty"` + // Name - The plan ID. + Name *string `json:"name,omitempty"` + // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. + Product *string `json:"product,omitempty"` +} + +// RecommendedMachineConfiguration the properties describe the recommended machine configuration for this +// Image Definition. These properties are updatable. +type RecommendedMachineConfiguration struct { + VCPUs *ResourceRange `json:"vCPUs,omitempty"` + Memory *ResourceRange `json:"memory,omitempty"` +} + +// RecoveryWalkResponse response after calling a manual recovery walk +type RecoveryWalkResponse struct { + autorest.Response `json:"-"` + // WalkPerformed - READ-ONLY; Whether the recovery walk was performed + WalkPerformed *bool `json:"walkPerformed,omitempty"` + // NextPlatformUpdateDomain - READ-ONLY; The next update domain that needs to be walked. Null means walk spanning all update domains has been completed + NextPlatformUpdateDomain *int32 `json:"nextPlatformUpdateDomain,omitempty"` +} + +// RegionalReplicationStatus this is the regional replication status. +type RegionalReplicationStatus struct { + // Region - READ-ONLY; The region to which the gallery Image Version is being replicated to. + Region *string `json:"region,omitempty"` + // State - READ-ONLY; This is the regional replication state. Possible values include: 'ReplicationStateUnknown', 'ReplicationStateReplicating', 'ReplicationStateCompleted', 'ReplicationStateFailed' + State ReplicationState `json:"state,omitempty"` + // Details - READ-ONLY; The details of the replication status. + Details *string `json:"details,omitempty"` + // Progress - READ-ONLY; It indicates progress of the replication job. + Progress *int32 `json:"progress,omitempty"` +} + +// ReplicationStatus this is the replication status of the gallery Image Version. +type ReplicationStatus struct { + // AggregatedState - READ-ONLY; This is the aggregated replication status based on all the regional replication status flags. Possible values include: 'Unknown', 'InProgress', 'Completed', 'Failed' + AggregatedState AggregatedReplicationState `json:"aggregatedState,omitempty"` + // Summary - READ-ONLY; This is a summary of replication status for each region. + Summary *[]RegionalReplicationStatus `json:"summary,omitempty"` +} + +// RequestRateByIntervalInput api request input for LogAnalytics getRequestRateByInterval Api. +type RequestRateByIntervalInput struct { + // IntervalLength - Interval value in minutes used to create LogAnalytics call rate logs. Possible values include: 'ThreeMins', 'FiveMins', 'ThirtyMins', 'SixtyMins' + IntervalLength IntervalInMins `json:"intervalLength,omitempty"` + // BlobContainerSasURI - SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + BlobContainerSasURI *string `json:"blobContainerSasUri,omitempty"` + // FromTime - From time of the query + FromTime *date.Time `json:"fromTime,omitempty"` + // ToTime - To time of the query + ToTime *date.Time `json:"toTime,omitempty"` + // GroupByThrottlePolicy - Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + // GroupByOperationName - Group query result by Operation Name. + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + // GroupByResourceName - Group query result by Resource Name. + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` +} + +// Resource the Resource model definition. +type Resource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceRange describes the resource range. +type ResourceRange struct { + // Min - The minimum number of the resource. + Min *int32 `json:"min,omitempty"` + // Max - The maximum number of the resource. + Max *int32 `json:"max,omitempty"` +} + +// ResourceSku describes an available Compute SKU. +type ResourceSku struct { + // ResourceType - READ-ONLY; The type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Name - READ-ONLY; The name of SKU. + Name *string `json:"name,omitempty"` + // Tier - READ-ONLY; Specifies the tier of virtual machines in a scale set.

    Possible Values:

    **Standard**

    **Basic** + Tier *string `json:"tier,omitempty"` + // Size - READ-ONLY; The Size of the SKU. + Size *string `json:"size,omitempty"` + // Family - READ-ONLY; The Family of this particular SKU. + Family *string `json:"family,omitempty"` + // Kind - READ-ONLY; The Kind of resources that are supported in this SKU. + Kind *string `json:"kind,omitempty"` + // Capacity - READ-ONLY; Specifies the number of virtual machines in the scale set. + Capacity *ResourceSkuCapacity `json:"capacity,omitempty"` + // Locations - READ-ONLY; The set of locations that the SKU is available. + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - READ-ONLY; A list of locations and availability zones in those locations where the SKU is available. + LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"` + // APIVersions - READ-ONLY; The api versions that support this SKU. + APIVersions *[]string `json:"apiVersions,omitempty"` + // Costs - READ-ONLY; Metadata for retrieving price info. + Costs *[]ResourceSkuCosts `json:"costs,omitempty"` + // Capabilities - READ-ONLY; A name value pair to describe the capability. + Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` + // Restrictions - READ-ONLY; The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` +} + +// ResourceSkuCapabilities describes The SKU capabilities object. +type ResourceSkuCapabilities struct { + // Name - READ-ONLY; An invariant to describe the feature. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; An invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty"` +} + +// ResourceSkuCapacity describes scaling information of a SKU. +type ResourceSkuCapacity struct { + // Minimum - READ-ONLY; The minimum capacity. + Minimum *int64 `json:"minimum,omitempty"` + // Maximum - READ-ONLY; The maximum capacity that can be set. + Maximum *int64 `json:"maximum,omitempty"` + // Default - READ-ONLY; The default capacity. + Default *int64 `json:"default,omitempty"` + // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'ResourceSkuCapacityScaleTypeAutomatic', 'ResourceSkuCapacityScaleTypeManual', 'ResourceSkuCapacityScaleTypeNone' + ScaleType ResourceSkuCapacityScaleType `json:"scaleType,omitempty"` +} + +// ResourceSkuCosts describes metadata for retrieving price info. +type ResourceSkuCosts struct { + // MeterID - READ-ONLY; Used for querying price from commerce. + MeterID *string `json:"meterID,omitempty"` + // Quantity - READ-ONLY; The multiplier is needed to extend the base metered cost. + Quantity *int64 `json:"quantity,omitempty"` + // ExtendedUnit - READ-ONLY; An invariant to show the extended unit. + ExtendedUnit *string `json:"extendedUnit,omitempty"` +} + +// ResourceSkuLocationInfo ... +type ResourceSkuLocationInfo struct { + // Location - READ-ONLY; Location of the SKU + Location *string `json:"location,omitempty"` + // Zones - READ-ONLY; List of availability zones where the SKU is supported. + Zones *[]string `json:"zones,omitempty"` + // ZoneDetails - READ-ONLY; Details of capabilities available to a SKU in specific zones. + ZoneDetails *[]ResourceSkuZoneDetails `json:"zoneDetails,omitempty"` +} + +// ResourceSkuRestrictionInfo ... +type ResourceSkuRestrictionInfo struct { + // Locations - READ-ONLY; Locations where the SKU is restricted + Locations *[]string `json:"locations,omitempty"` + // Zones - READ-ONLY; List of availability zones where the SKU is restricted. + Zones *[]string `json:"zones,omitempty"` +} + +// ResourceSkuRestrictions describes scaling information of a SKU. +type ResourceSkuRestrictions struct { + // Type - READ-ONLY; The type of restrictions. Possible values include: 'Location', 'Zone' + Type ResourceSkuRestrictionsType `json:"type,omitempty"` + // Values - READ-ONLY; The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // RestrictionInfo - READ-ONLY; The information about the restriction where the SKU cannot be used. + RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` + // ReasonCode - READ-ONLY; The reason for restriction. Possible values include: 'QuotaID', 'NotAvailableForSubscription' + ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` +} + +// ResourceSkusResult the Compute List Skus operation response. +type ResourceSkusResult struct { + autorest.Response `json:"-"` + // Value - The list of skus available for the subscription. + Value *[]ResourceSku `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Compute Skus. Call ListNext() with this to fetch the next page of VMSS Skus. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceSkusResultIterator provides access to a complete listing of ResourceSku values. +type ResourceSkusResultIterator struct { + i int + page ResourceSkusResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceSkusResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceSkusResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceSkusResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceSkusResultIterator) Response() ResourceSkusResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceSkusResultIterator) Value() ResourceSku { + if !iter.page.NotDone() { + return ResourceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceSkusResultIterator type. +func NewResourceSkusResultIterator(page ResourceSkusResultPage) ResourceSkusResultIterator { + return ResourceSkusResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rsr ResourceSkusResult) IsEmpty() bool { + return rsr.Value == nil || len(*rsr.Value) == 0 +} + +// resourceSkusResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rsr ResourceSkusResult) resourceSkusResultPreparer(ctx context.Context) (*http.Request, error) { + if rsr.NextLink == nil || len(to.String(rsr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rsr.NextLink))) +} + +// ResourceSkusResultPage contains a page of ResourceSku values. +type ResourceSkusResultPage struct { + fn func(context.Context, ResourceSkusResult) (ResourceSkusResult, error) + rsr ResourceSkusResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceSkusResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rsr) + if err != nil { + return err + } + page.rsr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceSkusResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceSkusResultPage) NotDone() bool { + return !page.rsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceSkusResultPage) Response() ResourceSkusResult { + return page.rsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceSkusResultPage) Values() []ResourceSku { + if page.rsr.IsEmpty() { + return nil + } + return *page.rsr.Value +} + +// Creates a new instance of the ResourceSkusResultPage type. +func NewResourceSkusResultPage(getNextPage func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)) ResourceSkusResultPage { + return ResourceSkusResultPage{fn: getNextPage} +} + +// ResourceSkuZoneDetails describes The zonal capabilities of a SKU. +type ResourceSkuZoneDetails struct { + // Name - READ-ONLY; The set of zones that the SKU is available in with the specified capabilities. + Name *[]string `json:"name,omitempty"` + // Capabilities - READ-ONLY; A list of capabilities that are available for the SKU in the specified list of zones. + Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` +} + +// RollbackStatusInfo information about rollback on failed VM instances after a OS Upgrade operation. +type RollbackStatusInfo struct { + // SuccessfullyRolledbackInstanceCount - READ-ONLY; The number of instances which have been successfully rolled back. + SuccessfullyRolledbackInstanceCount *int32 `json:"successfullyRolledbackInstanceCount,omitempty"` + // FailedRolledbackInstanceCount - READ-ONLY; The number of instances which failed to rollback. + FailedRolledbackInstanceCount *int32 `json:"failedRolledbackInstanceCount,omitempty"` + // RollbackError - READ-ONLY; Error details if OS rollback failed. + RollbackError *APIError `json:"rollbackError,omitempty"` +} + +// RollingUpgradePolicy the configuration parameters used while performing a rolling upgrade. +type RollingUpgradePolicy struct { + // MaxBatchInstancePercent - The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability. The default value for this parameter is 20%. + MaxBatchInstancePercent *int32 `json:"maxBatchInstancePercent,omitempty"` + // MaxUnhealthyInstancePercent - The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting any batch. The default value for this parameter is 20%. + MaxUnhealthyInstancePercent *int32 `json:"maxUnhealthyInstancePercent,omitempty"` + // MaxUnhealthyUpgradedInstancePercent - The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts. The default value for this parameter is 20%. + MaxUnhealthyUpgradedInstancePercent *int32 `json:"maxUnhealthyUpgradedInstancePercent,omitempty"` + // PauseTimeBetweenBatches - The wait time between completing the update for all virtual machines in one batch and starting the next batch. The time duration should be specified in ISO 8601 format. The default value is 0 seconds (PT0S). + PauseTimeBetweenBatches *string `json:"pauseTimeBetweenBatches,omitempty"` +} + +// RollingUpgradeProgressInfo information about the number of virtual machine instances in each upgrade +// state. +type RollingUpgradeProgressInfo struct { + // SuccessfulInstanceCount - READ-ONLY; The number of instances that have been successfully upgraded. + SuccessfulInstanceCount *int32 `json:"successfulInstanceCount,omitempty"` + // FailedInstanceCount - READ-ONLY; The number of instances that have failed to be upgraded successfully. + FailedInstanceCount *int32 `json:"failedInstanceCount,omitempty"` + // InProgressInstanceCount - READ-ONLY; The number of instances that are currently being upgraded. + InProgressInstanceCount *int32 `json:"inProgressInstanceCount,omitempty"` + // PendingInstanceCount - READ-ONLY; The number of instances that have not yet begun to be upgraded. + PendingInstanceCount *int32 `json:"pendingInstanceCount,omitempty"` +} + +// RollingUpgradeRunningStatus information about the current running state of the overall upgrade. +type RollingUpgradeRunningStatus struct { + // Code - READ-ONLY; Code indicating the current status of the upgrade. Possible values include: 'RollingUpgradeStatusCodeRollingForward', 'RollingUpgradeStatusCodeCancelled', 'RollingUpgradeStatusCodeCompleted', 'RollingUpgradeStatusCodeFaulted' + Code RollingUpgradeStatusCode `json:"code,omitempty"` + // StartTime - READ-ONLY; Start time of the upgrade. + StartTime *date.Time `json:"startTime,omitempty"` + // LastAction - READ-ONLY; The last action performed on the rolling upgrade. Possible values include: 'Start', 'Cancel' + LastAction RollingUpgradeActionType `json:"lastAction,omitempty"` + // LastActionTime - READ-ONLY; Last action time of the upgrade. + LastActionTime *date.Time `json:"lastActionTime,omitempty"` +} + +// RollingUpgradeStatusInfo the status of the latest virtual machine scale set rolling upgrade. +type RollingUpgradeStatusInfo struct { + autorest.Response `json:"-"` + *RollingUpgradeStatusInfoProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for RollingUpgradeStatusInfo. +func (rusi RollingUpgradeStatusInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rusi.RollingUpgradeStatusInfoProperties != nil { + objectMap["properties"] = rusi.RollingUpgradeStatusInfoProperties + } + if rusi.Location != nil { + objectMap["location"] = rusi.Location + } + if rusi.Tags != nil { + objectMap["tags"] = rusi.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RollingUpgradeStatusInfo struct. +func (rusi *RollingUpgradeStatusInfo) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var rollingUpgradeStatusInfoProperties RollingUpgradeStatusInfoProperties + err = json.Unmarshal(*v, &rollingUpgradeStatusInfoProperties) + if err != nil { + return err + } + rusi.RollingUpgradeStatusInfoProperties = &rollingUpgradeStatusInfoProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rusi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rusi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rusi.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rusi.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rusi.Tags = tags + } + } + } + + return nil +} + +// RollingUpgradeStatusInfoProperties the status of the latest virtual machine scale set rolling upgrade. +type RollingUpgradeStatusInfoProperties struct { + // Policy - READ-ONLY; The rolling upgrade policies applied for this upgrade. + Policy *RollingUpgradePolicy `json:"policy,omitempty"` + // RunningStatus - READ-ONLY; Information about the current running state of the overall upgrade. + RunningStatus *RollingUpgradeRunningStatus `json:"runningStatus,omitempty"` + // Progress - READ-ONLY; Information about the number of virtual machine instances in each upgrade state. + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty"` + // Error - READ-ONLY; Error details for this upgrade, if there are any. + Error *APIError `json:"error,omitempty"` +} + +// RunCommandDocument describes the properties of a Run Command. +type RunCommandDocument struct { + autorest.Response `json:"-"` + // Script - The script to be executed. + Script *[]string `json:"script,omitempty"` + // Parameters - The parameters used by the script. + Parameters *[]RunCommandParameterDefinition `json:"parameters,omitempty"` + // Schema - The VM run command schema. + Schema *string `json:"$schema,omitempty"` + // ID - The VM run command id. + ID *string `json:"id,omitempty"` + // OsType - The Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // Label - The VM run command label. + Label *string `json:"label,omitempty"` + // Description - The VM run command description. + Description *string `json:"description,omitempty"` +} + +// RunCommandDocumentBase describes the properties of a Run Command metadata. +type RunCommandDocumentBase struct { + // Schema - The VM run command schema. + Schema *string `json:"$schema,omitempty"` + // ID - The VM run command id. + ID *string `json:"id,omitempty"` + // OsType - The Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // Label - The VM run command label. + Label *string `json:"label,omitempty"` + // Description - The VM run command description. + Description *string `json:"description,omitempty"` +} + +// RunCommandInput capture Virtual Machine parameters. +type RunCommandInput struct { + // CommandID - The run command id. + CommandID *string `json:"commandId,omitempty"` + // Script - Optional. The script to be executed. When this value is given, the given script will override the default script of the command. + Script *[]string `json:"script,omitempty"` + // Parameters - The run command parameters. + Parameters *[]RunCommandInputParameter `json:"parameters,omitempty"` +} + +// RunCommandInputParameter describes the properties of a run command parameter. +type RunCommandInputParameter struct { + // Name - The run command parameter name. + Name *string `json:"name,omitempty"` + // Value - The run command parameter value. + Value *string `json:"value,omitempty"` +} + +// RunCommandListResult the List Virtual Machine operation response. +type RunCommandListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine run commands. + Value *[]RunCommandDocumentBase `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of run commands. Call ListNext() with this to fetch the next page of run commands. + NextLink *string `json:"nextLink,omitempty"` +} + +// RunCommandListResultIterator provides access to a complete listing of RunCommandDocumentBase values. +type RunCommandListResultIterator struct { + i int + page RunCommandListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RunCommandListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunCommandListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RunCommandListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RunCommandListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RunCommandListResultIterator) Response() RunCommandListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RunCommandListResultIterator) Value() RunCommandDocumentBase { + if !iter.page.NotDone() { + return RunCommandDocumentBase{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RunCommandListResultIterator type. +func NewRunCommandListResultIterator(page RunCommandListResultPage) RunCommandListResultIterator { + return RunCommandListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rclr RunCommandListResult) IsEmpty() bool { + return rclr.Value == nil || len(*rclr.Value) == 0 +} + +// runCommandListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rclr RunCommandListResult) runCommandListResultPreparer(ctx context.Context) (*http.Request, error) { + if rclr.NextLink == nil || len(to.String(rclr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rclr.NextLink))) +} + +// RunCommandListResultPage contains a page of RunCommandDocumentBase values. +type RunCommandListResultPage struct { + fn func(context.Context, RunCommandListResult) (RunCommandListResult, error) + rclr RunCommandListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RunCommandListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunCommandListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rclr) + if err != nil { + return err + } + page.rclr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RunCommandListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RunCommandListResultPage) NotDone() bool { + return !page.rclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RunCommandListResultPage) Response() RunCommandListResult { + return page.rclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RunCommandListResultPage) Values() []RunCommandDocumentBase { + if page.rclr.IsEmpty() { + return nil + } + return *page.rclr.Value +} + +// Creates a new instance of the RunCommandListResultPage type. +func NewRunCommandListResultPage(getNextPage func(context.Context, RunCommandListResult) (RunCommandListResult, error)) RunCommandListResultPage { + return RunCommandListResultPage{fn: getNextPage} +} + +// RunCommandParameterDefinition describes the properties of a run command parameter. +type RunCommandParameterDefinition struct { + // Name - The run command parameter name. + Name *string `json:"name,omitempty"` + // Type - The run command parameter type. + Type *string `json:"type,omitempty"` + // DefaultValue - The run command parameter default value. + DefaultValue *string `json:"defaultValue,omitempty"` + // Required - The run command parameter required. + Required *bool `json:"required,omitempty"` +} + +// RunCommandResult ... +type RunCommandResult struct { + autorest.Response `json:"-"` + // Value - Run command operation response. + Value *[]InstanceViewStatus `json:"value,omitempty"` +} + +// Sku describes a virtual machine scale set sku. +type Sku struct { + // Name - The sku name. + Name *string `json:"name,omitempty"` + // Tier - Specifies the tier of virtual machines in a scale set.

    Possible Values:

    **Standard**

    **Basic** + Tier *string `json:"tier,omitempty"` + // Capacity - Specifies the number of virtual machines in the scale set. + Capacity *int64 `json:"capacity,omitempty"` +} + +// Snapshot snapshot resource. +type Snapshot struct { + autorest.Response `json:"-"` + // ManagedBy - READ-ONLY; Unused. Always Null. + ManagedBy *string `json:"managedBy,omitempty"` + Sku *SnapshotSku `json:"sku,omitempty"` + *SnapshotProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.Sku != nil { + objectMap["sku"] = s.Sku + } + if s.SnapshotProperties != nil { + objectMap["properties"] = s.SnapshotProperties + } + if s.Location != nil { + objectMap["location"] = s.Location + } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Snapshot struct. +func (s *Snapshot) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "managedBy": + if v != nil { + var managedBy string + err = json.Unmarshal(*v, &managedBy) + if err != nil { + return err + } + s.ManagedBy = &managedBy + } + case "sku": + if v != nil { + var sku SnapshotSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + s.Sku = &sku + } + case "properties": + if v != nil { + var snapshotProperties SnapshotProperties + err = json.Unmarshal(*v, &snapshotProperties) + if err != nil { + return err + } + s.SnapshotProperties = &snapshotProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + } + } + + return nil +} + +// SnapshotList the List Snapshots operation response. +type SnapshotList struct { + autorest.Response `json:"-"` + // Value - A list of snapshots. + Value *[]Snapshot `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. + NextLink *string `json:"nextLink,omitempty"` +} + +// SnapshotListIterator provides access to a complete listing of Snapshot values. +type SnapshotListIterator struct { + i int + page SnapshotListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SnapshotListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SnapshotListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SnapshotListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SnapshotListIterator) Response() SnapshotList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SnapshotListIterator) Value() Snapshot { + if !iter.page.NotDone() { + return Snapshot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SnapshotListIterator type. +func NewSnapshotListIterator(page SnapshotListPage) SnapshotListIterator { + return SnapshotListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sl SnapshotList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 +} + +// snapshotListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sl SnapshotList) snapshotListPreparer(ctx context.Context) (*http.Request, error) { + if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sl.NextLink))) +} + +// SnapshotListPage contains a page of Snapshot values. +type SnapshotListPage struct { + fn func(context.Context, SnapshotList) (SnapshotList, error) + sl SnapshotList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SnapshotListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.sl) + if err != nil { + return err + } + page.sl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SnapshotListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SnapshotListPage) NotDone() bool { + return !page.sl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SnapshotListPage) Response() SnapshotList { + return page.sl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SnapshotListPage) Values() []Snapshot { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value +} + +// Creates a new instance of the SnapshotListPage type. +func NewSnapshotListPage(getNextPage func(context.Context, SnapshotList) (SnapshotList, error)) SnapshotListPage { + return SnapshotListPage{fn: getNextPage} +} + +// SnapshotProperties snapshot resource properties. +type SnapshotProperties struct { + // TimeCreated - READ-ONLY; The time when the disk was created. + TimeCreated *date.Time `json:"timeCreated,omitempty"` + // OsType - The Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // HyperVGeneration - The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' + HyperVGeneration HyperVGeneration `json:"hyperVGeneration,omitempty"` + // CreationData - Disk source information. CreationData information cannot be changed after the disk has been created. + CreationData *CreationData `json:"creationData,omitempty"` + // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // EncryptionSettingsCollection - Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + // ProvisioningState - READ-ONLY; The disk provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// SnapshotsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SnapshotsCreateOrUpdateFuture) Result(client SnapshotsClient) (s Snapshot, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateOrUpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SnapshotsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SnapshotsDeleteFuture) Result(client SnapshotsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SnapshotsGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsGrantAccessFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SnapshotsGrantAccessFuture) Result(client SnapshotsClient) (au AccessURI, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsGrantAccessFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if au.Response.Response, err = future.GetResult(sender); err == nil && au.Response.Response.StatusCode != http.StatusNoContent { + au, err = client.GrantAccessResponder(au.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", au.Response.Response, "Failure responding to request") + } + } + return +} + +// SnapshotSku the snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. +type SnapshotSku struct { + // Name - The sku name. Possible values include: 'SnapshotStorageAccountTypesStandardLRS', 'SnapshotStorageAccountTypesPremiumLRS', 'SnapshotStorageAccountTypesStandardZRS' + Name SnapshotStorageAccountTypes `json:"name,omitempty"` + // Tier - READ-ONLY; The sku tier. + Tier *string `json:"tier,omitempty"` +} + +// SnapshotsRevokeAccessFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsRevokeAccessFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SnapshotsRevokeAccessFuture) Result(client SnapshotsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsRevokeAccessFuture") + return + } + ar.Response = future.Response() + return +} + +// SnapshotsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SnapshotsUpdateFuture) Result(client SnapshotsClient) (s Snapshot, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.UpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SnapshotUpdate snapshot update resource. +type SnapshotUpdate struct { + *SnapshotUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + Sku *SnapshotSku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotUpdate. +func (su SnapshotUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if su.SnapshotUpdateProperties != nil { + objectMap["properties"] = su.SnapshotUpdateProperties + } + if su.Tags != nil { + objectMap["tags"] = su.Tags + } + if su.Sku != nil { + objectMap["sku"] = su.Sku + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SnapshotUpdate struct. +func (su *SnapshotUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var snapshotUpdateProperties SnapshotUpdateProperties + err = json.Unmarshal(*v, &snapshotUpdateProperties) + if err != nil { + return err + } + su.SnapshotUpdateProperties = &snapshotUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + su.Tags = tags + } + case "sku": + if v != nil { + var sku SnapshotSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + su.Sku = &sku + } + } + } + + return nil +} + +// SnapshotUpdateProperties snapshot resource update properties. +type SnapshotUpdateProperties struct { + // OsType - the Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // EncryptionSettingsCollection - Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` +} + +// SourceVault the vault id is an Azure Resource Manager Resource id in the form +// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} +type SourceVault struct { + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// SSHConfiguration SSH configuration for Linux based VMs running on Azure +type SSHConfiguration struct { + // PublicKeys - The list of SSH public keys used to authenticate with linux based VMs. + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey contains information about SSH certificate public key and the path on the Linux VM where +// the public key is placed. +type SSHPublicKey struct { + // Path - Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys + Path *string `json:"path,omitempty"` + // KeyData - SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format.

    For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + KeyData *string `json:"keyData,omitempty"` +} + +// StorageProfile specifies the storage settings for the virtual machine disks. +type StorageProfile struct { + // ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. + ImageReference *ImageReference `json:"imageReference,omitempty"` + // OsDisk - Specifies information about the operating system disk used by the virtual machine.

    For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + OsDisk *OSDisk `json:"osDisk,omitempty"` + // DataDisks - Specifies the parameters that are used to add a data disk to a virtual machine.

    For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` +} + +// SubResource ... +type SubResource struct { + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// SubResourceReadOnly ... +type SubResourceReadOnly struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` +} + +// TargetRegion describes the target region information. +type TargetRegion struct { + // Name - The name of the region. + Name *string `json:"name,omitempty"` + // RegionalReplicaCount - The number of replicas of the Image Version to be created per region. This property is updatable. + RegionalReplicaCount *int32 `json:"regionalReplicaCount,omitempty"` + // StorageAccountType - Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: 'StorageAccountTypeStandardLRS', 'StorageAccountTypeStandardZRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` +} + +// ThrottledRequestsInput api request input for LogAnalytics getThrottledRequests Api. +type ThrottledRequestsInput struct { + // BlobContainerSasURI - SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + BlobContainerSasURI *string `json:"blobContainerSasUri,omitempty"` + // FromTime - From time of the query + FromTime *date.Time `json:"fromTime,omitempty"` + // ToTime - To time of the query + ToTime *date.Time `json:"toTime,omitempty"` + // GroupByThrottlePolicy - Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + // GroupByOperationName - Group query result by Operation Name. + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + // GroupByResourceName - Group query result by Resource Name. + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` +} + +// UpdateResource the Update Resource model definition. +type UpdateResource struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for UpdateResource. +func (ur UpdateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ur.Tags != nil { + objectMap["tags"] = ur.Tags + } + return json.Marshal(objectMap) +} + +// UpgradeOperationHistoricalStatusInfo virtual Machine Scale Set OS Upgrade History operation response. +type UpgradeOperationHistoricalStatusInfo struct { + // Properties - READ-ONLY; Information about the properties of the upgrade operation. + Properties *UpgradeOperationHistoricalStatusInfoProperties `json:"properties,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Resource location + Location *string `json:"location,omitempty"` +} + +// UpgradeOperationHistoricalStatusInfoProperties describes each OS upgrade on the Virtual Machine Scale +// Set. +type UpgradeOperationHistoricalStatusInfoProperties struct { + // RunningStatus - READ-ONLY; Information about the overall status of the upgrade operation. + RunningStatus *UpgradeOperationHistoryStatus `json:"runningStatus,omitempty"` + // Progress - READ-ONLY; Counts of the VMs in each state. + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty"` + // Error - READ-ONLY; Error Details for this upgrade if there are any. + Error *APIError `json:"error,omitempty"` + // StartedBy - READ-ONLY; Invoker of the Upgrade Operation. Possible values include: 'UpgradeOperationInvokerUnknown', 'UpgradeOperationInvokerUser', 'UpgradeOperationInvokerPlatform' + StartedBy UpgradeOperationInvoker `json:"startedBy,omitempty"` + // TargetImageReference - READ-ONLY; Image Reference details + TargetImageReference *ImageReference `json:"targetImageReference,omitempty"` + // RollbackInfo - READ-ONLY; Information about OS rollback if performed + RollbackInfo *RollbackStatusInfo `json:"rollbackInfo,omitempty"` +} + +// UpgradeOperationHistoryStatus information about the current running state of the overall upgrade. +type UpgradeOperationHistoryStatus struct { + // Code - READ-ONLY; Code indicating the current status of the upgrade. Possible values include: 'UpgradeStateRollingForward', 'UpgradeStateCancelled', 'UpgradeStateCompleted', 'UpgradeStateFaulted' + Code UpgradeState `json:"code,omitempty"` + // StartTime - READ-ONLY; Start time of the upgrade. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - READ-ONLY; End time of the upgrade. + EndTime *date.Time `json:"endTime,omitempty"` +} + +// UpgradePolicy describes an upgrade policy - automatic, manual, or rolling. +type UpgradePolicy struct { + // Mode - Specifies the mode of an upgrade to virtual machines in the scale set.

    Possible values are:

    **Manual** - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action.

    **Automatic** - All virtual machines in the scale set are automatically updated at the same time. Possible values include: 'Automatic', 'Manual', 'Rolling' + Mode UpgradeMode `json:"mode,omitempty"` + // RollingUpgradePolicy - The configuration parameters used while performing a rolling upgrade. + RollingUpgradePolicy *RollingUpgradePolicy `json:"rollingUpgradePolicy,omitempty"` + // AutomaticOSUpgradePolicy - Configuration parameters used for performing automatic OS Upgrade. + AutomaticOSUpgradePolicy *AutomaticOSUpgradePolicy `json:"automaticOSUpgradePolicy,omitempty"` +} + +// Usage describes Compute Resource Usage. +type Usage struct { + // Unit - An enum describing the unit of usage measurement. + Unit *string `json:"unit,omitempty"` + // CurrentValue - The current usage of the resource. + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - The maximum permitted usage of the resource. + Limit *int64 `json:"limit,omitempty"` + // Name - The name of the type of usage. + Name *UsageName `json:"name,omitempty"` +} + +// UsageName the Usage Names. +type UsageName struct { + // Value - The name of the resource. + Value *string `json:"value,omitempty"` + // LocalizedValue - The localized name of the resource. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// VaultCertificate describes a single certificate reference in a Key Vault, and where the certificate +// should reside on the VM. +type VaultCertificate struct { + // CertificateURL - This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8:

    {
    "data":"",
    "dataType":"pfx",
    "password":""
    } + CertificateURL *string `json:"certificateUrl,omitempty"` + // CertificateStore - For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account.

    For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name <UppercaseThumbprint>.crt for the X509 certificate file and <UppercaseThumbprint>.prv for private key. Both of these files are .pem formatted. + CertificateStore *string `json:"certificateStore,omitempty"` +} + +// VaultSecretGroup describes a set of certificates which are all in the same Key Vault. +type VaultSecretGroup struct { + // SourceVault - The relative URL of the Key Vault containing all of the certificates in VaultCertificates. + SourceVault *SubResource `json:"sourceVault,omitempty"` + // VaultCertificates - The list of key vault references in SourceVault which contain certificates. + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} + +// VirtualHardDisk describes the uri of a disk. +type VirtualHardDisk struct { + // URI - Specifies the virtual hard disk's uri. + URI *string `json:"uri,omitempty"` +} + +// VirtualMachine describes a Virtual Machine. +type VirtualMachine struct { + autorest.Response `json:"-"` + // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineProperties `json:"properties,omitempty"` + // Resources - READ-ONLY; The virtual machine child extension resources. + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + // Identity - The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity `json:"identity,omitempty"` + // Zones - The virtual machine zones. + Zones *[]string `json:"zones,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualMachine. +func (VM VirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if VM.Plan != nil { + objectMap["plan"] = VM.Plan + } + if VM.VirtualMachineProperties != nil { + objectMap["properties"] = VM.VirtualMachineProperties + } + if VM.Identity != nil { + objectMap["identity"] = VM.Identity + } + if VM.Zones != nil { + objectMap["zones"] = VM.Zones + } + if VM.Location != nil { + objectMap["location"] = VM.Location + } + if VM.Tags != nil { + objectMap["tags"] = VM.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachine struct. +func (VM *VirtualMachine) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + VM.Plan = &plan + } + case "properties": + if v != nil { + var virtualMachineProperties VirtualMachineProperties + err = json.Unmarshal(*v, &virtualMachineProperties) + if err != nil { + return err + } + VM.VirtualMachineProperties = &virtualMachineProperties + } + case "resources": + if v != nil { + var resources []VirtualMachineExtension + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + VM.Resources = &resources + } + case "identity": + if v != nil { + var identity VirtualMachineIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + VM.Identity = &identity + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + VM.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + VM.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + VM.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + VM.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + VM.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + VM.Tags = tags + } + } + } + + return nil +} + +// VirtualMachineAgentInstanceView the instance view of the VM Agent running on the virtual machine. +type VirtualMachineAgentInstanceView struct { + // VMAgentVersion - The VM Agent full version. + VMAgentVersion *string `json:"vmAgentVersion,omitempty"` + // ExtensionHandlers - The virtual machine extension handler instance view. + ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// VirtualMachineCaptureParameters capture Virtual Machine parameters. +type VirtualMachineCaptureParameters struct { + // VhdPrefix - The captured virtual hard disk's name prefix. + VhdPrefix *string `json:"vhdPrefix,omitempty"` + // DestinationContainerName - The destination container name. + DestinationContainerName *string `json:"destinationContainerName,omitempty"` + // OverwriteVhds - Specifies whether to overwrite the destination virtual hard disk, in case of conflict. + OverwriteVhds *bool `json:"overwriteVhds,omitempty"` +} + +// VirtualMachineCaptureResult output of virtual machine capture operation. +type VirtualMachineCaptureResult struct { + autorest.Response `json:"-"` + // Schema - READ-ONLY; the schema of the captured virtual machine + Schema *string `json:"$schema,omitempty"` + // ContentVersion - READ-ONLY; the version of the content + ContentVersion *string `json:"contentVersion,omitempty"` + // Parameters - READ-ONLY; parameters of the captured virtual machine + Parameters interface{} `json:"parameters,omitempty"` + // Resources - READ-ONLY; a list of resource items of the captured virtual machine + Resources *[]interface{} `json:"resources,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// VirtualMachineExtension describes a Virtual Machine Extension. +type VirtualMachineExtension struct { + autorest.Response `json:"-"` + *VirtualMachineExtensionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineExtension. +func (vme VirtualMachineExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vme.VirtualMachineExtensionProperties != nil { + objectMap["properties"] = vme.VirtualMachineExtensionProperties + } + if vme.Location != nil { + objectMap["location"] = vme.Location + } + if vme.Tags != nil { + objectMap["tags"] = vme.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtension struct. +func (vme *VirtualMachineExtension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualMachineExtensionProperties VirtualMachineExtensionProperties + err = json.Unmarshal(*v, &virtualMachineExtensionProperties) + if err != nil { + return err + } + vme.VirtualMachineExtensionProperties = &virtualMachineExtensionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vme.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vme.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vme.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vme.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vme.Tags = tags + } + } + } + + return nil +} + +// VirtualMachineExtensionHandlerInstanceView the instance view of a virtual machine extension handler. +type VirtualMachineExtensionHandlerInstanceView struct { + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // Status - The extension handler status. + Status *InstanceViewStatus `json:"status,omitempty"` +} + +// VirtualMachineExtensionImage describes a Virtual Machine Extension Image. +type VirtualMachineExtensionImage struct { + autorest.Response `json:"-"` + *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineExtensionImage. +func (vmei VirtualMachineExtensionImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmei.VirtualMachineExtensionImageProperties != nil { + objectMap["properties"] = vmei.VirtualMachineExtensionImageProperties + } + if vmei.Location != nil { + objectMap["location"] = vmei.Location + } + if vmei.Tags != nil { + objectMap["tags"] = vmei.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionImage struct. +func (vmei *VirtualMachineExtensionImage) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualMachineExtensionImageProperties VirtualMachineExtensionImageProperties + err = json.Unmarshal(*v, &virtualMachineExtensionImageProperties) + if err != nil { + return err + } + vmei.VirtualMachineExtensionImageProperties = &virtualMachineExtensionImageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmei.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmei.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmei.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vmei.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmei.Tags = tags + } + } + } + + return nil +} + +// VirtualMachineExtensionImageProperties describes the properties of a Virtual Machine Extension Image. +type VirtualMachineExtensionImageProperties struct { + // OperatingSystem - The operating system this extension supports. + OperatingSystem *string `json:"operatingSystem,omitempty"` + // ComputeRole - The type of role (IaaS or PaaS) this extension supports. + ComputeRole *string `json:"computeRole,omitempty"` + // HandlerSchema - The schema defined by publisher, where extension consumers should provide settings in a matching schema. + HandlerSchema *string `json:"handlerSchema,omitempty"` + // VMScaleSetEnabled - Whether the extension can be used on xRP VMScaleSets. By default existing extensions are usable on scalesets, but there might be cases where a publisher wants to explicitly indicate the extension is only enabled for CRP VMs but not VMSS. + VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"` + // SupportsMultipleExtensions - Whether the handler can support multiple extensions. + SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"` +} + +// VirtualMachineExtensionInstanceView the instance view of a virtual machine extension. +type VirtualMachineExtensionInstanceView struct { + // Name - The virtual machine extension name. + Name *string `json:"name,omitempty"` + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // Substatuses - The resource status information. + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// VirtualMachineExtensionProperties describes the properties of a Virtual Machine Extension. +type VirtualMachineExtensionProperties struct { + // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + // Publisher - The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // Settings - Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // InstanceView - The virtual machine extension instance view. + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` +} + +// VirtualMachineExtensionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualMachineExtensionsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineExtensionsCreateOrUpdateFuture) Result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vme.Response.Response, err = future.GetResult(sender); err == nil && vme.Response.Response.StatusCode != http.StatusNoContent { + vme, err = client.CreateOrUpdateResponder(vme.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", vme.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachineExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineExtensionsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineExtensionsDeleteFuture) Result(client VirtualMachineExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineExtensionsListResult the List Extension operation response +type VirtualMachineExtensionsListResult struct { + autorest.Response `json:"-"` + // Value - The list of extensions + Value *[]VirtualMachineExtension `json:"value,omitempty"` +} + +// VirtualMachineExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineExtensionsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineExtensionsUpdateFuture) Result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vme.Response.Response, err = future.GetResult(sender); err == nil && vme.Response.Response.StatusCode != http.StatusNoContent { + vme, err = client.UpdateResponder(vme.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", vme.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachineExtensionUpdate describes a Virtual Machine Extension. +type VirtualMachineExtensionUpdate struct { + *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineExtensionUpdate. +func (vmeu VirtualMachineExtensionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmeu.VirtualMachineExtensionUpdateProperties != nil { + objectMap["properties"] = vmeu.VirtualMachineExtensionUpdateProperties + } + if vmeu.Tags != nil { + objectMap["tags"] = vmeu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionUpdate struct. +func (vmeu *VirtualMachineExtensionUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualMachineExtensionUpdateProperties VirtualMachineExtensionUpdateProperties + err = json.Unmarshal(*v, &virtualMachineExtensionUpdateProperties) + if err != nil { + return err + } + vmeu.VirtualMachineExtensionUpdateProperties = &virtualMachineExtensionUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmeu.Tags = tags + } + } + } + + return nil +} + +// VirtualMachineExtensionUpdateProperties describes the properties of a Virtual Machine Extension. +type VirtualMachineExtensionUpdateProperties struct { + // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + // Publisher - The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // Settings - Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` +} + +// VirtualMachineHealthStatus the health status of the VM. +type VirtualMachineHealthStatus struct { + // Status - READ-ONLY; The health status information for the VM. + Status *InstanceViewStatus `json:"status,omitempty"` +} + +// VirtualMachineIdentity identity for the virtual machine. +type VirtualMachineIdentity struct { + // PrincipalID - READ-ONLY; The principal id of virtual machine identity. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id associated with the virtual machine. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the virtual machine. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*VirtualMachineIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineIdentity. +func (vmi VirtualMachineIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmi.Type != "" { + objectMap["type"] = vmi.Type + } + if vmi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = vmi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// VirtualMachineIdentityUserAssignedIdentitiesValue ... +type VirtualMachineIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// VirtualMachineImage describes a Virtual Machine Image. +type VirtualMachineImage struct { + autorest.Response `json:"-"` + *VirtualMachineImageProperties `json:"properties,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Location - The supported Azure location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + Tags map[string]*string `json:"tags"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineImage. +func (vmi VirtualMachineImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmi.VirtualMachineImageProperties != nil { + objectMap["properties"] = vmi.VirtualMachineImageProperties + } + if vmi.Name != nil { + objectMap["name"] = vmi.Name + } + if vmi.Location != nil { + objectMap["location"] = vmi.Location + } + if vmi.Tags != nil { + objectMap["tags"] = vmi.Tags + } + if vmi.ID != nil { + objectMap["id"] = vmi.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineImage struct. +func (vmi *VirtualMachineImage) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualMachineImageProperties VirtualMachineImageProperties + err = json.Unmarshal(*v, &virtualMachineImageProperties) + if err != nil { + return err + } + vmi.VirtualMachineImageProperties = &virtualMachineImageProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmi.Name = &name + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vmi.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmi.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmi.ID = &ID + } + } + } + + return nil +} + +// VirtualMachineImageProperties describes the properties of a Virtual Machine Image. +type VirtualMachineImageProperties struct { + Plan *PurchasePlan `json:"plan,omitempty"` + OsDiskImage *OSDiskImage `json:"osDiskImage,omitempty"` + DataDiskImages *[]DataDiskImage `json:"dataDiskImages,omitempty"` + AutomaticOSUpgradeProperties *AutomaticOSUpgradeProperties `json:"automaticOSUpgradeProperties,omitempty"` +} + +// VirtualMachineImageResource virtual machine image resource information. +type VirtualMachineImageResource struct { + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Location - The supported Azure location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + Tags map[string]*string `json:"tags"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineImageResource. +func (vmir VirtualMachineImageResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmir.Name != nil { + objectMap["name"] = vmir.Name + } + if vmir.Location != nil { + objectMap["location"] = vmir.Location + } + if vmir.Tags != nil { + objectMap["tags"] = vmir.Tags + } + if vmir.ID != nil { + objectMap["id"] = vmir.ID + } + return json.Marshal(objectMap) +} + +// VirtualMachineInstanceView the instance view of a virtual machine. +type VirtualMachineInstanceView struct { + autorest.Response `json:"-"` + // PlatformUpdateDomain - Specifies the update domain of the virtual machine. + PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` + // PlatformFaultDomain - Specifies the fault domain of the virtual machine. + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + // ComputerName - The computer name assigned to the virtual machine. + ComputerName *string `json:"computerName,omitempty"` + // OsName - The Operating System running on the virtual machine. + OsName *string `json:"osName,omitempty"` + // OsVersion - The version of Operating System running on the virtual machine. + OsVersion *string `json:"osVersion,omitempty"` + // RdpThumbPrint - The Remote desktop certificate thumbprint. + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + // VMAgent - The VM Agent running on the virtual machine. + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + // MaintenanceRedeployStatus - The Maintenance Operation status on the virtual machine. + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + // Disks - The virtual machine disk information. + Disks *[]DiskInstanceView `json:"disks,omitempty"` + // Extensions - The extensions information. + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status.

    You can easily view the output of your console log.

    Azure also enables you to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// VirtualMachineListResult the List Virtual Machine operation response. +type VirtualMachineListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machines. + Value *[]VirtualMachine `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next page of Virtual Machines. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineListResultIterator provides access to a complete listing of VirtualMachine values. +type VirtualMachineListResultIterator struct { + i int + page VirtualMachineListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualMachineListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualMachineListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualMachineListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualMachineListResultIterator) Response() VirtualMachineListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualMachineListResultIterator) Value() VirtualMachine { + if !iter.page.NotDone() { + return VirtualMachine{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualMachineListResultIterator type. +func NewVirtualMachineListResultIterator(page VirtualMachineListResultPage) VirtualMachineListResultIterator { + return VirtualMachineListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmlr VirtualMachineListResult) IsEmpty() bool { + return vmlr.Value == nil || len(*vmlr.Value) == 0 +} + +// virtualMachineListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmlr VirtualMachineListResult) virtualMachineListResultPreparer(ctx context.Context) (*http.Request, error) { + if vmlr.NextLink == nil || len(to.String(vmlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmlr.NextLink))) +} + +// VirtualMachineListResultPage contains a page of VirtualMachine values. +type VirtualMachineListResultPage struct { + fn func(context.Context, VirtualMachineListResult) (VirtualMachineListResult, error) + vmlr VirtualMachineListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualMachineListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vmlr) + if err != nil { + return err + } + page.vmlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualMachineListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualMachineListResultPage) NotDone() bool { + return !page.vmlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualMachineListResultPage) Response() VirtualMachineListResult { + return page.vmlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualMachineListResultPage) Values() []VirtualMachine { + if page.vmlr.IsEmpty() { + return nil + } + return *page.vmlr.Value +} + +// Creates a new instance of the VirtualMachineListResultPage type. +func NewVirtualMachineListResultPage(getNextPage func(context.Context, VirtualMachineListResult) (VirtualMachineListResult, error)) VirtualMachineListResultPage { + return VirtualMachineListResultPage{fn: getNextPage} +} + +// VirtualMachineProperties describes the properties of a Virtual Machine. +type VirtualMachineProperties struct { + // HardwareProfile - Specifies the hardware settings for the virtual machine. + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + // StorageProfile - Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // AdditionalCapabilities - Specifies additional capabilities enabled or disabled on the virtual machine. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + // OsProfile - Specifies the operating system settings for the virtual machine. + OsProfile *OSProfile `json:"osProfile,omitempty"` + // NetworkProfile - Specifies the network interfaces of the virtual machine. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // DiagnosticsProfile - Specifies the boot diagnostic settings state.

    Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + // AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).

    For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + // ProximityPlacementGroup - Specifies information about the proximity placement group that the virtual machine should be assigned to.

    Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // InstanceView - READ-ONLY; The virtual machine instance view. + InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` + // LicenseType - Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system.

    Possible values are:

    Windows_Client

    Windows_Server

    If this element is included in a request for an update, the value must match the initial value. This value cannot be updated.

    For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    Minimum api-version: 2015-06-15 + LicenseType *string `json:"licenseType,omitempty"` + // VMID - READ-ONLY; Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + VMID *string `json:"vmId,omitempty"` +} + +// VirtualMachineReimageParameters parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk +// will always be reimaged +type VirtualMachineReimageParameters struct { + // TempDisk - Specifies whether to reimage temp disk. Default value: false. + TempDisk *bool `json:"tempDisk,omitempty"` +} + +// VirtualMachineScaleSet describes a Virtual Machine Scale Set. +type VirtualMachineScaleSet struct { + autorest.Response `json:"-"` + // Sku - The virtual machine scale set sku. + Sku *Sku `json:"sku,omitempty"` + // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineScaleSetProperties `json:"properties,omitempty"` + // Identity - The identity of the virtual machine scale set, if configured. + Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` + // Zones - The virtual machine scale set zones. + Zones *[]string `json:"zones,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSet. +func (vmss VirtualMachineScaleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmss.Sku != nil { + objectMap["sku"] = vmss.Sku + } + if vmss.Plan != nil { + objectMap["plan"] = vmss.Plan + } + if vmss.VirtualMachineScaleSetProperties != nil { + objectMap["properties"] = vmss.VirtualMachineScaleSetProperties + } + if vmss.Identity != nil { + objectMap["identity"] = vmss.Identity + } + if vmss.Zones != nil { + objectMap["zones"] = vmss.Zones + } + if vmss.Location != nil { + objectMap["location"] = vmss.Location + } + if vmss.Tags != nil { + objectMap["tags"] = vmss.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSet struct. +func (vmss *VirtualMachineScaleSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + vmss.Sku = &sku + } + case "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + vmss.Plan = &plan + } + case "properties": + if v != nil { + var virtualMachineScaleSetProperties VirtualMachineScaleSetProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetProperties) + if err != nil { + return err + } + vmss.VirtualMachineScaleSetProperties = &virtualMachineScaleSetProperties + } + case "identity": + if v != nil { + var identity VirtualMachineScaleSetIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + vmss.Identity = &identity + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + vmss.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmss.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmss.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmss.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vmss.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmss.Tags = tags + } + } + } + + return nil +} + +// VirtualMachineScaleSetDataDisk describes a virtual machine scale set data disk. +type VirtualMachineScaleSetDataDisk struct { + // Name - The disk name. + Name *string `json:"name,omitempty"` + // Lun - Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. + Lun *int32 `json:"lun,omitempty"` + // Caching - Specifies the caching requirements.

    Possible values are:

    **None**

    **ReadOnly**

    **ReadWrite**

    Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // CreateOption - The create option. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach' + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

    This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` +} + +// VirtualMachineScaleSetExtension describes a Virtual Machine Scale Set Extension. +type VirtualMachineScaleSetExtension struct { + autorest.Response `json:"-"` + // Name - The name of the extension. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetExtension. +func (vmsse VirtualMachineScaleSetExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmsse.Name != nil { + objectMap["name"] = vmsse.Name + } + if vmsse.VirtualMachineScaleSetExtensionProperties != nil { + objectMap["properties"] = vmsse.VirtualMachineScaleSetExtensionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetExtension struct. +func (vmsse *VirtualMachineScaleSetExtension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmsse.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetExtensionProperties VirtualMachineScaleSetExtensionProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetExtensionProperties) + if err != nil { + return err + } + vmsse.VirtualMachineScaleSetExtensionProperties = &virtualMachineScaleSetExtensionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmsse.ID = &ID + } + } + } + + return nil +} + +// VirtualMachineScaleSetExtensionListResult the List VM scale set extension operation response. +type VirtualMachineScaleSetExtensionListResult struct { + autorest.Response `json:"-"` + // Value - The list of VM scale set extensions. + Value *[]VirtualMachineScaleSetExtension `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of VM scale set extensions. Call ListNext() with this to fetch the next page of VM scale set extensions. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetExtensionListResultIterator provides access to a complete listing of +// VirtualMachineScaleSetExtension values. +type VirtualMachineScaleSetExtensionListResultIterator struct { + i int + page VirtualMachineScaleSetExtensionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualMachineScaleSetExtensionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualMachineScaleSetExtensionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualMachineScaleSetExtensionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualMachineScaleSetExtensionListResultIterator) Response() VirtualMachineScaleSetExtensionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualMachineScaleSetExtensionListResultIterator) Value() VirtualMachineScaleSetExtension { + if !iter.page.NotDone() { + return VirtualMachineScaleSetExtension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualMachineScaleSetExtensionListResultIterator type. +func NewVirtualMachineScaleSetExtensionListResultIterator(page VirtualMachineScaleSetExtensionListResultPage) VirtualMachineScaleSetExtensionListResultIterator { + return VirtualMachineScaleSetExtensionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmsselr VirtualMachineScaleSetExtensionListResult) IsEmpty() bool { + return vmsselr.Value == nil || len(*vmsselr.Value) == 0 +} + +// virtualMachineScaleSetExtensionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmsselr VirtualMachineScaleSetExtensionListResult) virtualMachineScaleSetExtensionListResultPreparer(ctx context.Context) (*http.Request, error) { + if vmsselr.NextLink == nil || len(to.String(vmsselr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmsselr.NextLink))) +} + +// VirtualMachineScaleSetExtensionListResultPage contains a page of VirtualMachineScaleSetExtension values. +type VirtualMachineScaleSetExtensionListResultPage struct { + fn func(context.Context, VirtualMachineScaleSetExtensionListResult) (VirtualMachineScaleSetExtensionListResult, error) + vmsselr VirtualMachineScaleSetExtensionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualMachineScaleSetExtensionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vmsselr) + if err != nil { + return err + } + page.vmsselr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualMachineScaleSetExtensionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualMachineScaleSetExtensionListResultPage) NotDone() bool { + return !page.vmsselr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualMachineScaleSetExtensionListResultPage) Response() VirtualMachineScaleSetExtensionListResult { + return page.vmsselr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualMachineScaleSetExtensionListResultPage) Values() []VirtualMachineScaleSetExtension { + if page.vmsselr.IsEmpty() { + return nil + } + return *page.vmsselr.Value +} + +// Creates a new instance of the VirtualMachineScaleSetExtensionListResultPage type. +func NewVirtualMachineScaleSetExtensionListResultPage(getNextPage func(context.Context, VirtualMachineScaleSetExtensionListResult) (VirtualMachineScaleSetExtensionListResult, error)) VirtualMachineScaleSetExtensionListResultPage { + return VirtualMachineScaleSetExtensionListResultPage{fn: getNextPage} +} + +// VirtualMachineScaleSetExtensionProfile describes a virtual machine scale set extension profile. +type VirtualMachineScaleSetExtensionProfile struct { + // Extensions - The virtual machine scale set child extension resources. + Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"` +} + +// VirtualMachineScaleSetExtensionProperties describes the properties of a Virtual Machine Scale Set +// Extension. +type VirtualMachineScaleSetExtensionProperties struct { + // ForceUpdateTag - If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + // Publisher - The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // Settings - Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // ProvisionAfterExtensions - Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` +} + +// VirtualMachineScaleSetExtensionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualMachineScaleSetExtensionsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetExtensionsCreateOrUpdateFuture) Result(client VirtualMachineScaleSetExtensionsClient) (vmsse VirtualMachineScaleSetExtension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmsse.Response.Response, err = future.GetResult(sender); err == nil && vmsse.Response.Response.StatusCode != http.StatusNoContent { + vmsse, err = client.CreateOrUpdateResponder(vmsse.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture", "Result", vmsse.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachineScaleSetExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualMachineScaleSetExtensionsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetExtensionsDeleteFuture) Result(client VirtualMachineScaleSetExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetIdentity identity for the virtual machine scale set. +type VirtualMachineScaleSetIdentity struct { + // PrincipalID - READ-ONLY; The principal id of virtual machine scale set identity. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id associated with the virtual machine scale set. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the virtual machine scale set. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine scale set. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetIdentity. +func (vmssi VirtualMachineScaleSetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmssi.Type != "" { + objectMap["type"] = vmssi.Type + } + if vmssi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = vmssi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue ... +type VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// VirtualMachineScaleSetInstanceView the instance view of a virtual machine scale set. +type VirtualMachineScaleSetInstanceView struct { + autorest.Response `json:"-"` + // VirtualMachine - READ-ONLY; The instance view status summary for the virtual machine scale set. + VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"` + // Extensions - READ-ONLY; The extensions information. + Extensions *[]VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// VirtualMachineScaleSetInstanceViewStatusesSummary instance view statuses summary for virtual machines of +// a virtual machine scale set. +type VirtualMachineScaleSetInstanceViewStatusesSummary struct { + // StatusesSummary - READ-ONLY; The extensions information. + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` +} + +// VirtualMachineScaleSetIPConfiguration describes a virtual machine scale set network profile's IP +// configuration. +type VirtualMachineScaleSetIPConfiguration struct { + // Name - The IP configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetIPConfiguration. +func (vmssic VirtualMachineScaleSetIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmssic.Name != nil { + objectMap["name"] = vmssic.Name + } + if vmssic.VirtualMachineScaleSetIPConfigurationProperties != nil { + objectMap["properties"] = vmssic.VirtualMachineScaleSetIPConfigurationProperties + } + if vmssic.ID != nil { + objectMap["id"] = vmssic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetIPConfiguration struct. +func (vmssic *VirtualMachineScaleSetIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssic.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetIPConfigurationProperties VirtualMachineScaleSetIPConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetIPConfigurationProperties) + if err != nil { + return err + } + vmssic.VirtualMachineScaleSetIPConfigurationProperties = &virtualMachineScaleSetIPConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssic.ID = &ID + } + } + } + + return nil +} + +// VirtualMachineScaleSetIPConfigurationProperties describes a virtual machine scale set network profile's +// IP configuration properties. +type VirtualMachineScaleSetIPConfigurationProperties struct { + // Subnet - Specifies the identifier of the subnet. + Subnet *APIEntityReference `json:"subnet,omitempty"` + // Primary - Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` + // PublicIPAddressConfiguration - The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + // PrivateIPAddressVersion - Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` + // ApplicationGatewayBackendAddressPools - Specifies an array of references to backend address pools of application gateways. A scale set can reference backend address pools of multiple application gateways. Multiple scale sets cannot use the same application gateway. + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + // ApplicationSecurityGroups - Specifies an array of references to application security group. + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + // LoadBalancerBackendAddressPools - Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same load balancer. + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + // LoadBalancerInboundNatPools - Specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple scale sets cannot use the same load balancer + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` +} + +// VirtualMachineScaleSetIPTag contains the IP tag associated with the public IP address. +type VirtualMachineScaleSetIPTag struct { + // IPTagType - IP tag type. Example: FirstPartyUsage. + IPTagType *string `json:"ipTagType,omitempty"` + // Tag - IP tag associated with the public IP. Example: SQL, Storage etc. + Tag *string `json:"tag,omitempty"` +} + +// VirtualMachineScaleSetListOSUpgradeHistory list of Virtual Machine Scale Set OS Upgrade History +// operation response. +type VirtualMachineScaleSetListOSUpgradeHistory struct { + autorest.Response `json:"-"` + // Value - The list of OS upgrades performed on the virtual machine scale set. + Value *[]UpgradeOperationHistoricalStatusInfo `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of OS Upgrade History. Call ListNext() with this to fetch the next page of history of upgrades. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListOSUpgradeHistoryIterator provides access to a complete listing of +// UpgradeOperationHistoricalStatusInfo values. +type VirtualMachineScaleSetListOSUpgradeHistoryIterator struct { + i int + page VirtualMachineScaleSetListOSUpgradeHistoryPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualMachineScaleSetListOSUpgradeHistoryIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListOSUpgradeHistoryIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualMachineScaleSetListOSUpgradeHistoryIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualMachineScaleSetListOSUpgradeHistoryIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualMachineScaleSetListOSUpgradeHistoryIterator) Response() VirtualMachineScaleSetListOSUpgradeHistory { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualMachineScaleSetListOSUpgradeHistoryIterator) Value() UpgradeOperationHistoricalStatusInfo { + if !iter.page.NotDone() { + return UpgradeOperationHistoricalStatusInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualMachineScaleSetListOSUpgradeHistoryIterator type. +func NewVirtualMachineScaleSetListOSUpgradeHistoryIterator(page VirtualMachineScaleSetListOSUpgradeHistoryPage) VirtualMachineScaleSetListOSUpgradeHistoryIterator { + return VirtualMachineScaleSetListOSUpgradeHistoryIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmsslouh VirtualMachineScaleSetListOSUpgradeHistory) IsEmpty() bool { + return vmsslouh.Value == nil || len(*vmsslouh.Value) == 0 +} + +// virtualMachineScaleSetListOSUpgradeHistoryPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmsslouh VirtualMachineScaleSetListOSUpgradeHistory) virtualMachineScaleSetListOSUpgradeHistoryPreparer(ctx context.Context) (*http.Request, error) { + if vmsslouh.NextLink == nil || len(to.String(vmsslouh.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmsslouh.NextLink))) +} + +// VirtualMachineScaleSetListOSUpgradeHistoryPage contains a page of UpgradeOperationHistoricalStatusInfo +// values. +type VirtualMachineScaleSetListOSUpgradeHistoryPage struct { + fn func(context.Context, VirtualMachineScaleSetListOSUpgradeHistory) (VirtualMachineScaleSetListOSUpgradeHistory, error) + vmsslouh VirtualMachineScaleSetListOSUpgradeHistory +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualMachineScaleSetListOSUpgradeHistoryPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListOSUpgradeHistoryPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vmsslouh) + if err != nil { + return err + } + page.vmsslouh = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualMachineScaleSetListOSUpgradeHistoryPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualMachineScaleSetListOSUpgradeHistoryPage) NotDone() bool { + return !page.vmsslouh.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualMachineScaleSetListOSUpgradeHistoryPage) Response() VirtualMachineScaleSetListOSUpgradeHistory { + return page.vmsslouh +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualMachineScaleSetListOSUpgradeHistoryPage) Values() []UpgradeOperationHistoricalStatusInfo { + if page.vmsslouh.IsEmpty() { + return nil + } + return *page.vmsslouh.Value +} + +// Creates a new instance of the VirtualMachineScaleSetListOSUpgradeHistoryPage type. +func NewVirtualMachineScaleSetListOSUpgradeHistoryPage(getNextPage func(context.Context, VirtualMachineScaleSetListOSUpgradeHistory) (VirtualMachineScaleSetListOSUpgradeHistory, error)) VirtualMachineScaleSetListOSUpgradeHistoryPage { + return VirtualMachineScaleSetListOSUpgradeHistoryPage{fn: getNextPage} +} + +// VirtualMachineScaleSetListResult the List Virtual Machine operation response. +type VirtualMachineScaleSetListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine scale sets. + Value *[]VirtualMachineScaleSet `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of VMSS. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListResultIterator provides access to a complete listing of VirtualMachineScaleSet +// values. +type VirtualMachineScaleSetListResultIterator struct { + i int + page VirtualMachineScaleSetListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualMachineScaleSetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualMachineScaleSetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualMachineScaleSetListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualMachineScaleSetListResultIterator) Response() VirtualMachineScaleSetListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualMachineScaleSetListResultIterator) Value() VirtualMachineScaleSet { + if !iter.page.NotDone() { + return VirtualMachineScaleSet{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualMachineScaleSetListResultIterator type. +func NewVirtualMachineScaleSetListResultIterator(page VirtualMachineScaleSetListResultPage) VirtualMachineScaleSetListResultIterator { + return VirtualMachineScaleSetListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmsslr VirtualMachineScaleSetListResult) IsEmpty() bool { + return vmsslr.Value == nil || len(*vmsslr.Value) == 0 +} + +// virtualMachineScaleSetListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmsslr VirtualMachineScaleSetListResult) virtualMachineScaleSetListResultPreparer(ctx context.Context) (*http.Request, error) { + if vmsslr.NextLink == nil || len(to.String(vmsslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmsslr.NextLink))) +} + +// VirtualMachineScaleSetListResultPage contains a page of VirtualMachineScaleSet values. +type VirtualMachineScaleSetListResultPage struct { + fn func(context.Context, VirtualMachineScaleSetListResult) (VirtualMachineScaleSetListResult, error) + vmsslr VirtualMachineScaleSetListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualMachineScaleSetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vmsslr) + if err != nil { + return err + } + page.vmsslr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualMachineScaleSetListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualMachineScaleSetListResultPage) NotDone() bool { + return !page.vmsslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualMachineScaleSetListResultPage) Response() VirtualMachineScaleSetListResult { + return page.vmsslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualMachineScaleSetListResultPage) Values() []VirtualMachineScaleSet { + if page.vmsslr.IsEmpty() { + return nil + } + return *page.vmsslr.Value +} + +// Creates a new instance of the VirtualMachineScaleSetListResultPage type. +func NewVirtualMachineScaleSetListResultPage(getNextPage func(context.Context, VirtualMachineScaleSetListResult) (VirtualMachineScaleSetListResult, error)) VirtualMachineScaleSetListResultPage { + return VirtualMachineScaleSetListResultPage{fn: getNextPage} +} + +// VirtualMachineScaleSetListSkusResult the Virtual Machine Scale Set List Skus operation response. +type VirtualMachineScaleSetListSkusResult struct { + autorest.Response `json:"-"` + // Value - The list of skus available for the virtual machine scale set. + Value *[]VirtualMachineScaleSetSku `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Virtual Machine Scale Set Skus. Call ListNext() with this to fetch the next page of VMSS Skus. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListSkusResultIterator provides access to a complete listing of +// VirtualMachineScaleSetSku values. +type VirtualMachineScaleSetListSkusResultIterator struct { + i int + page VirtualMachineScaleSetListSkusResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualMachineScaleSetListSkusResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListSkusResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualMachineScaleSetListSkusResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualMachineScaleSetListSkusResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualMachineScaleSetListSkusResultIterator) Response() VirtualMachineScaleSetListSkusResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualMachineScaleSetListSkusResultIterator) Value() VirtualMachineScaleSetSku { + if !iter.page.NotDone() { + return VirtualMachineScaleSetSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualMachineScaleSetListSkusResultIterator type. +func NewVirtualMachineScaleSetListSkusResultIterator(page VirtualMachineScaleSetListSkusResultPage) VirtualMachineScaleSetListSkusResultIterator { + return VirtualMachineScaleSetListSkusResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmsslsr VirtualMachineScaleSetListSkusResult) IsEmpty() bool { + return vmsslsr.Value == nil || len(*vmsslsr.Value) == 0 +} + +// virtualMachineScaleSetListSkusResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmsslsr VirtualMachineScaleSetListSkusResult) virtualMachineScaleSetListSkusResultPreparer(ctx context.Context) (*http.Request, error) { + if vmsslsr.NextLink == nil || len(to.String(vmsslsr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmsslsr.NextLink))) +} + +// VirtualMachineScaleSetListSkusResultPage contains a page of VirtualMachineScaleSetSku values. +type VirtualMachineScaleSetListSkusResultPage struct { + fn func(context.Context, VirtualMachineScaleSetListSkusResult) (VirtualMachineScaleSetListSkusResult, error) + vmsslsr VirtualMachineScaleSetListSkusResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualMachineScaleSetListSkusResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListSkusResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vmsslsr) + if err != nil { + return err + } + page.vmsslsr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualMachineScaleSetListSkusResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualMachineScaleSetListSkusResultPage) NotDone() bool { + return !page.vmsslsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualMachineScaleSetListSkusResultPage) Response() VirtualMachineScaleSetListSkusResult { + return page.vmsslsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualMachineScaleSetListSkusResultPage) Values() []VirtualMachineScaleSetSku { + if page.vmsslsr.IsEmpty() { + return nil + } + return *page.vmsslsr.Value +} + +// Creates a new instance of the VirtualMachineScaleSetListSkusResultPage type. +func NewVirtualMachineScaleSetListSkusResultPage(getNextPage func(context.Context, VirtualMachineScaleSetListSkusResult) (VirtualMachineScaleSetListSkusResult, error)) VirtualMachineScaleSetListSkusResultPage { + return VirtualMachineScaleSetListSkusResultPage{fn: getNextPage} +} + +// VirtualMachineScaleSetListWithLinkResult the List Virtual Machine operation response. +type VirtualMachineScaleSetListWithLinkResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine scale sets. + Value *[]VirtualMachineScaleSet `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of Virtual Machine Scale Sets. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListWithLinkResultIterator provides access to a complete listing of +// VirtualMachineScaleSet values. +type VirtualMachineScaleSetListWithLinkResultIterator struct { + i int + page VirtualMachineScaleSetListWithLinkResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualMachineScaleSetListWithLinkResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListWithLinkResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualMachineScaleSetListWithLinkResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualMachineScaleSetListWithLinkResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualMachineScaleSetListWithLinkResultIterator) Response() VirtualMachineScaleSetListWithLinkResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualMachineScaleSetListWithLinkResultIterator) Value() VirtualMachineScaleSet { + if !iter.page.NotDone() { + return VirtualMachineScaleSet{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualMachineScaleSetListWithLinkResultIterator type. +func NewVirtualMachineScaleSetListWithLinkResultIterator(page VirtualMachineScaleSetListWithLinkResultPage) VirtualMachineScaleSetListWithLinkResultIterator { + return VirtualMachineScaleSetListWithLinkResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) IsEmpty() bool { + return vmsslwlr.Value == nil || len(*vmsslwlr.Value) == 0 +} + +// virtualMachineScaleSetListWithLinkResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) virtualMachineScaleSetListWithLinkResultPreparer(ctx context.Context) (*http.Request, error) { + if vmsslwlr.NextLink == nil || len(to.String(vmsslwlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmsslwlr.NextLink))) +} + +// VirtualMachineScaleSetListWithLinkResultPage contains a page of VirtualMachineScaleSet values. +type VirtualMachineScaleSetListWithLinkResultPage struct { + fn func(context.Context, VirtualMachineScaleSetListWithLinkResult) (VirtualMachineScaleSetListWithLinkResult, error) + vmsslwlr VirtualMachineScaleSetListWithLinkResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualMachineScaleSetListWithLinkResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListWithLinkResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vmsslwlr) + if err != nil { + return err + } + page.vmsslwlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualMachineScaleSetListWithLinkResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualMachineScaleSetListWithLinkResultPage) NotDone() bool { + return !page.vmsslwlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualMachineScaleSetListWithLinkResultPage) Response() VirtualMachineScaleSetListWithLinkResult { + return page.vmsslwlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualMachineScaleSetListWithLinkResultPage) Values() []VirtualMachineScaleSet { + if page.vmsslwlr.IsEmpty() { + return nil + } + return *page.vmsslwlr.Value +} + +// Creates a new instance of the VirtualMachineScaleSetListWithLinkResultPage type. +func NewVirtualMachineScaleSetListWithLinkResultPage(getNextPage func(context.Context, VirtualMachineScaleSetListWithLinkResult) (VirtualMachineScaleSetListWithLinkResult, error)) VirtualMachineScaleSetListWithLinkResultPage { + return VirtualMachineScaleSetListWithLinkResultPage{fn: getNextPage} +} + +// VirtualMachineScaleSetManagedDiskParameters describes the parameters of a ScaleSet managed disk. +type VirtualMachineScaleSetManagedDiskParameters struct { + // StorageAccountType - Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values include: 'StorageAccountTypesStandardLRS', 'StorageAccountTypesPremiumLRS', 'StorageAccountTypesStandardSSDLRS', 'StorageAccountTypesUltraSSDLRS' + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// VirtualMachineScaleSetNetworkConfiguration describes a virtual machine scale set network profile's +// network configurations. +type VirtualMachineScaleSetNetworkConfiguration struct { + // Name - The network configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetNetworkConfiguration. +func (vmssnc VirtualMachineScaleSetNetworkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmssnc.Name != nil { + objectMap["name"] = vmssnc.Name + } + if vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties != nil { + objectMap["properties"] = vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties + } + if vmssnc.ID != nil { + objectMap["id"] = vmssnc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetNetworkConfiguration struct. +func (vmssnc *VirtualMachineScaleSetNetworkConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssnc.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetNetworkConfigurationProperties VirtualMachineScaleSetNetworkConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetNetworkConfigurationProperties) + if err != nil { + return err + } + vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties = &virtualMachineScaleSetNetworkConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssnc.ID = &ID + } + } + } + + return nil +} + +// VirtualMachineScaleSetNetworkConfigurationDNSSettings describes a virtual machines scale sets network +// configuration's DNS settings. +type VirtualMachineScaleSetNetworkConfigurationDNSSettings struct { + // DNSServers - List of DNS servers IP addresses + DNSServers *[]string `json:"dnsServers,omitempty"` +} + +// VirtualMachineScaleSetNetworkConfigurationProperties describes a virtual machine scale set network +// profile's IP configuration. +type VirtualMachineScaleSetNetworkConfigurationProperties struct { + // Primary - Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` + // EnableAcceleratedNetworking - Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + // NetworkSecurityGroup - The network security group. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + // DNSSettings - The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineScaleSetNetworkConfigurationDNSSettings `json:"dnsSettings,omitempty"` + // IPConfigurations - Specifies the IP configurations of the network interface. + IPConfigurations *[]VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations,omitempty"` + // EnableIPForwarding - Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` +} + +// VirtualMachineScaleSetNetworkProfile describes a virtual machine scale set network profile. +type VirtualMachineScaleSetNetworkProfile struct { + // HealthProbe - A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + HealthProbe *APIEntityReference `json:"healthProbe,omitempty"` + // NetworkInterfaceConfigurations - The list of network configurations. + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} + +// VirtualMachineScaleSetOSDisk describes a virtual machine scale set operating system disk. +type VirtualMachineScaleSetOSDisk struct { + // Name - The disk name. + Name *string `json:"name,omitempty"` + // Caching - Specifies the caching requirements.

    Possible values are:

    **None**

    **ReadOnly**

    **ReadWrite**

    Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // CreateOption - Specifies how the virtual machines in the scale set should be created.

    The only allowed value is: **FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach' + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + // DiffDiskSettings - Specifies the ephemeral disk Settings for the operating system disk used by the virtual machine scale set. + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + // DiskSizeGB - Specifies the size of the operating system disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

    This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // OsType - This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD.

    Possible values are:

    **Windows**

    **Linux**. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // Image - Specifies information about the unmanaged user image to base the scale set on. + Image *VirtualHardDisk `json:"image,omitempty"` + // VhdContainers - Specifies the container urls that are used to store operating system disks for the scale set. + VhdContainers *[]string `json:"vhdContainers,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` +} + +// VirtualMachineScaleSetOSProfile describes a virtual machine scale set OS profile. +type VirtualMachineScaleSetOSProfile struct { + // ComputerNamePrefix - Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long. + ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` + // AdminUsername - Specifies the name of the administrator account.

    **Windows-only restriction:** Cannot end in "."

    **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".

    **Minimum-length (Linux):** 1 character

    **Max-length (Linux):** 64 characters

    **Max-length (Windows):** 20 characters

  • For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
  • For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + AdminUsername *string `json:"adminUsername,omitempty"` + // AdminPassword - Specifies the password of the administrator account.

    **Minimum-length (Windows):** 8 characters

    **Minimum-length (Linux):** 6 characters

    **Max-length (Windows):** 123 characters

    **Max-length (Linux):** 72 characters

    **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
    Has lower characters
    Has upper characters
    Has a digit
    Has a special character (Regex match [\W_])

    **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"

    For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password) + AdminPassword *string `json:"adminPassword,omitempty"` + // CustomData - Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes.

    For using cloud-init for your VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + CustomData *string `json:"customData,omitempty"` + // WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + // LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine.

    For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)

    For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + // Secrets - Specifies set of certificates that should be installed onto the virtual machines in the scale set. + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` +} + +// VirtualMachineScaleSetProperties describes the properties of a Virtual Machine Scale Set. +type VirtualMachineScaleSetProperties struct { + // UpgradePolicy - The upgrade policy. + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + // VirtualMachineProfile - The virtual machine profile. + VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // Overprovision - Specifies whether the Virtual Machine Scale Set should be overprovisioned. + Overprovision *bool `json:"overprovision,omitempty"` + // DoNotRunExtensionsOnOverprovisionedVMs - When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions do not run on the extra overprovisioned VMs. + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + // UniqueID - READ-ONLY; Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + UniqueID *string `json:"uniqueId,omitempty"` + // SinglePlacementGroup - When true this limits the scale set to a single placement group, of max size 100 virtual machines. + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + // ZoneBalance - Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. + ZoneBalance *bool `json:"zoneBalance,omitempty"` + // PlatformFaultDomainCount - Fault Domain count for each placement group. + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` + // ProximityPlacementGroup - Specifies information about the proximity placement group that the virtual machine scale set should be assigned to.

    Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + // AdditionalCapabilities - Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to support attaching managed data disks with UltraSSD_LRS storage account type. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` +} + +// VirtualMachineScaleSetPublicIPAddressConfiguration describes a virtual machines scale set IP +// Configuration's PublicIPAddress configuration +type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + // Name - The publicIP address configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetPublicIPAddressConfigurationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetPublicIPAddressConfiguration. +func (vmsspiac VirtualMachineScaleSetPublicIPAddressConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmsspiac.Name != nil { + objectMap["name"] = vmsspiac.Name + } + if vmsspiac.VirtualMachineScaleSetPublicIPAddressConfigurationProperties != nil { + objectMap["properties"] = vmsspiac.VirtualMachineScaleSetPublicIPAddressConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetPublicIPAddressConfiguration struct. +func (vmsspiac *VirtualMachineScaleSetPublicIPAddressConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmsspiac.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetPublicIPAddressConfigurationProperties VirtualMachineScaleSetPublicIPAddressConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetPublicIPAddressConfigurationProperties) + if err != nil { + return err + } + vmsspiac.VirtualMachineScaleSetPublicIPAddressConfigurationProperties = &virtualMachineScaleSetPublicIPAddressConfigurationProperties + } + } + } + + return nil +} + +// VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings describes a virtual machines scale sets +// network configuration's DNS settings. +type VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings struct { + // DomainNameLabel - The Domain name label.The concatenation of the domain name label and vm index will be the domain name labels of the PublicIPAddress resources that will be created + DomainNameLabel *string `json:"domainNameLabel,omitempty"` +} + +// VirtualMachineScaleSetPublicIPAddressConfigurationProperties describes a virtual machines scale set IP +// Configuration's PublicIPAddress configuration +type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { + // IdleTimeoutInMinutes - The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // DNSSettings - The dns settings to be applied on the publicIP addresses . + DNSSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings `json:"dnsSettings,omitempty"` + // IPTags - The list of IP tags associated with the public IP address. + IPTags *[]VirtualMachineScaleSetIPTag `json:"ipTags,omitempty"` + // PublicIPPrefix - The PublicIPPrefix from which to allocate publicIP addresses. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} + +// VirtualMachineScaleSetReimageParameters describes a Virtual Machine Scale Set VM Reimage Parameters. +type VirtualMachineScaleSetReimageParameters struct { + // InstanceIds - The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. + InstanceIds *[]string `json:"instanceIds,omitempty"` + // TempDisk - Specifies whether to reimage temp disk. Default value: false. + TempDisk *bool `json:"tempDisk,omitempty"` +} + +// VirtualMachineScaleSetRollingUpgradesCancelFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualMachineScaleSetRollingUpgradesCancelFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetRollingUpgradesCancelFuture) Result(client VirtualMachineScaleSetRollingUpgradesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesCancelFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesCancelFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture) Result(client VirtualMachineScaleSetRollingUpgradesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture) Result(client VirtualMachineScaleSetRollingUpgradesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualMachineScaleSetsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsCreateOrUpdateFuture) Result(client VirtualMachineScaleSetsClient) (vmss VirtualMachineScaleSet, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmss.Response.Response, err = future.GetResult(sender); err == nil && vmss.Response.Response.StatusCode != http.StatusNoContent { + vmss, err = client.CreateOrUpdateResponder(vmss.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", vmss.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachineScaleSetsDeallocateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetsDeallocateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsDeallocateFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeallocateFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsDeleteFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetsDeleteInstancesFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualMachineScaleSetsDeleteInstancesFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsDeleteInstancesFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteInstancesFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetSku describes an available virtual machine scale set sku. +type VirtualMachineScaleSetSku struct { + // ResourceType - READ-ONLY; The type of resource the sku applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Sku - READ-ONLY; The Sku. + Sku *Sku `json:"sku,omitempty"` + // Capacity - READ-ONLY; Specifies the number of virtual machines in the scale set. + Capacity *VirtualMachineScaleSetSkuCapacity `json:"capacity,omitempty"` +} + +// VirtualMachineScaleSetSkuCapacity describes scaling information of a sku. +type VirtualMachineScaleSetSkuCapacity struct { + // Minimum - READ-ONLY; The minimum capacity. + Minimum *int64 `json:"minimum,omitempty"` + // Maximum - READ-ONLY; The maximum capacity that can be set. + Maximum *int64 `json:"maximum,omitempty"` + // DefaultCapacity - READ-ONLY; The default capacity. + DefaultCapacity *int64 `json:"defaultCapacity,omitempty"` + // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'VirtualMachineScaleSetSkuScaleTypeAutomatic', 'VirtualMachineScaleSetSkuScaleTypeNone' + ScaleType VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"` +} + +// VirtualMachineScaleSetsPerformMaintenanceFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualMachineScaleSetsPerformMaintenanceFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsPerformMaintenanceFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPerformMaintenanceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPerformMaintenanceFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetsPowerOffFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetsPowerOffFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsPowerOffFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPowerOffFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetsRedeployFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetsRedeployFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsRedeployFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRedeployFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRedeployFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetsReimageAllFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetsReimageAllFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsReimageAllFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageAllFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetsReimageFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetsReimageFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsReimageFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetsRestartFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetsRestartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsRestartFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetsStartFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetsStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsStartFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetStorageProfile describes a virtual machine scale set storage profile. +type VirtualMachineScaleSetStorageProfile struct { + // ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. + ImageReference *ImageReference `json:"imageReference,omitempty"` + // OsDisk - Specifies information about the operating system disk used by the virtual machines in the scale set.

    For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` + // DataDisks - Specifies the parameters that are used to add data disks to the virtual machines in the scale set.

    For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` +} + +// VirtualMachineScaleSetsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsUpdateFuture) Result(client VirtualMachineScaleSetsClient) (vmss VirtualMachineScaleSet, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmss.Response.Response, err = future.GetResult(sender); err == nil && vmss.Response.Response.StatusCode != http.StatusNoContent { + vmss, err = client.UpdateResponder(vmss.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateFuture", "Result", vmss.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachineScaleSetsUpdateInstancesFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualMachineScaleSetsUpdateInstancesFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetsUpdateInstancesFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateInstancesFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetUpdate describes a Virtual Machine Scale Set. +type VirtualMachineScaleSetUpdate struct { + // Sku - The virtual machine scale set sku. + Sku *Sku `json:"sku,omitempty"` + // Plan - The purchase plan when deploying a virtual machine scale set from VM Marketplace images. + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineScaleSetUpdateProperties `json:"properties,omitempty"` + // Identity - The identity of the virtual machine scale set, if configured. + Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetUpdate. +func (vmssu VirtualMachineScaleSetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmssu.Sku != nil { + objectMap["sku"] = vmssu.Sku + } + if vmssu.Plan != nil { + objectMap["plan"] = vmssu.Plan + } + if vmssu.VirtualMachineScaleSetUpdateProperties != nil { + objectMap["properties"] = vmssu.VirtualMachineScaleSetUpdateProperties + } + if vmssu.Identity != nil { + objectMap["identity"] = vmssu.Identity + } + if vmssu.Tags != nil { + objectMap["tags"] = vmssu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetUpdate struct. +func (vmssu *VirtualMachineScaleSetUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + vmssu.Sku = &sku + } + case "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + vmssu.Plan = &plan + } + case "properties": + if v != nil { + var virtualMachineScaleSetUpdateProperties VirtualMachineScaleSetUpdateProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetUpdateProperties) + if err != nil { + return err + } + vmssu.VirtualMachineScaleSetUpdateProperties = &virtualMachineScaleSetUpdateProperties + } + case "identity": + if v != nil { + var identity VirtualMachineScaleSetIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + vmssu.Identity = &identity + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmssu.Tags = tags + } + } + } + + return nil +} + +// VirtualMachineScaleSetUpdateIPConfiguration describes a virtual machine scale set network profile's IP +// configuration. +type VirtualMachineScaleSetUpdateIPConfiguration struct { + // Name - The IP configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetUpdateIPConfigurationProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetUpdateIPConfiguration. +func (vmssuic VirtualMachineScaleSetUpdateIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmssuic.Name != nil { + objectMap["name"] = vmssuic.Name + } + if vmssuic.VirtualMachineScaleSetUpdateIPConfigurationProperties != nil { + objectMap["properties"] = vmssuic.VirtualMachineScaleSetUpdateIPConfigurationProperties + } + if vmssuic.ID != nil { + objectMap["id"] = vmssuic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetUpdateIPConfiguration struct. +func (vmssuic *VirtualMachineScaleSetUpdateIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssuic.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetUpdateIPConfigurationProperties VirtualMachineScaleSetUpdateIPConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetUpdateIPConfigurationProperties) + if err != nil { + return err + } + vmssuic.VirtualMachineScaleSetUpdateIPConfigurationProperties = &virtualMachineScaleSetUpdateIPConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssuic.ID = &ID + } + } + } + + return nil +} + +// VirtualMachineScaleSetUpdateIPConfigurationProperties describes a virtual machine scale set network +// profile's IP configuration properties. +type VirtualMachineScaleSetUpdateIPConfigurationProperties struct { + // Subnet - The subnet. + Subnet *APIEntityReference `json:"subnet,omitempty"` + // Primary - Specifies the primary IP Configuration in case the network interface has more than one IP Configuration. + Primary *bool `json:"primary,omitempty"` + // PublicIPAddressConfiguration - The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachineScaleSetUpdatePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + // PrivateIPAddressVersion - Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` + // ApplicationGatewayBackendAddressPools - The application gateway backend address pools. + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + // ApplicationSecurityGroups - Specifies an array of references to application security group. + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + // LoadBalancerBackendAddressPools - The load balancer backend address pools. + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + // LoadBalancerInboundNatPools - The load balancer inbound nat pools. + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` +} + +// VirtualMachineScaleSetUpdateNetworkConfiguration describes a virtual machine scale set network profile's +// network configurations. +type VirtualMachineScaleSetUpdateNetworkConfiguration struct { + // Name - The network configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetUpdateNetworkConfigurationProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetUpdateNetworkConfiguration. +func (vmssunc VirtualMachineScaleSetUpdateNetworkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmssunc.Name != nil { + objectMap["name"] = vmssunc.Name + } + if vmssunc.VirtualMachineScaleSetUpdateNetworkConfigurationProperties != nil { + objectMap["properties"] = vmssunc.VirtualMachineScaleSetUpdateNetworkConfigurationProperties + } + if vmssunc.ID != nil { + objectMap["id"] = vmssunc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetUpdateNetworkConfiguration struct. +func (vmssunc *VirtualMachineScaleSetUpdateNetworkConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssunc.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetUpdateNetworkConfigurationProperties VirtualMachineScaleSetUpdateNetworkConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetUpdateNetworkConfigurationProperties) + if err != nil { + return err + } + vmssunc.VirtualMachineScaleSetUpdateNetworkConfigurationProperties = &virtualMachineScaleSetUpdateNetworkConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssunc.ID = &ID + } + } + } + + return nil +} + +// VirtualMachineScaleSetUpdateNetworkConfigurationProperties describes a virtual machine scale set +// updatable network profile's IP configuration.Use this object for updating network profile's IP +// Configuration. +type VirtualMachineScaleSetUpdateNetworkConfigurationProperties struct { + // Primary - Whether this is a primary NIC on a virtual machine. + Primary *bool `json:"primary,omitempty"` + // EnableAcceleratedNetworking - Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + // NetworkSecurityGroup - The network security group. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + // DNSSettings - The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineScaleSetNetworkConfigurationDNSSettings `json:"dnsSettings,omitempty"` + // IPConfigurations - The virtual machine scale set IP Configuration. + IPConfigurations *[]VirtualMachineScaleSetUpdateIPConfiguration `json:"ipConfigurations,omitempty"` + // EnableIPForwarding - Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` +} + +// VirtualMachineScaleSetUpdateNetworkProfile describes a virtual machine scale set network profile. +type VirtualMachineScaleSetUpdateNetworkProfile struct { + // NetworkInterfaceConfigurations - The list of network configurations. + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetUpdateNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} + +// VirtualMachineScaleSetUpdateOSDisk describes virtual machine scale set operating system disk Update +// Object. This should be used for Updating VMSS OS Disk. +type VirtualMachineScaleSetUpdateOSDisk struct { + // Caching - The caching type. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // DiskSizeGB - Specifies the size of the operating system disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

    This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // Image - The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using it to attach to the Virtual Machine. If SourceImage is provided, the destination VirtualHardDisk should not exist. + Image *VirtualHardDisk `json:"image,omitempty"` + // VhdContainers - The list of virtual hard disk container uris. + VhdContainers *[]string `json:"vhdContainers,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` +} + +// VirtualMachineScaleSetUpdateOSProfile describes a virtual machine scale set OS profile. +type VirtualMachineScaleSetUpdateOSProfile struct { + // CustomData - A base-64 encoded string of custom data. + CustomData *string `json:"customData,omitempty"` + // WindowsConfiguration - The Windows Configuration of the OS profile. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + // LinuxConfiguration - The Linux Configuration of the OS profile. + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + // Secrets - The List of certificates for addition to the VM. + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` +} + +// VirtualMachineScaleSetUpdateProperties describes the properties of a Virtual Machine Scale Set. +type VirtualMachineScaleSetUpdateProperties struct { + // UpgradePolicy - The upgrade policy. + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + // VirtualMachineProfile - The virtual machine profile. + VirtualMachineProfile *VirtualMachineScaleSetUpdateVMProfile `json:"virtualMachineProfile,omitempty"` + // Overprovision - Specifies whether the Virtual Machine Scale Set should be overprovisioned. + Overprovision *bool `json:"overprovision,omitempty"` + // SinglePlacementGroup - When true this limits the scale set to a single placement group, of max size 100 virtual machines. + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + // AdditionalCapabilities - Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to support attaching managed data disks with UltraSSD_LRS storage account type. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` +} + +// VirtualMachineScaleSetUpdatePublicIPAddressConfiguration describes a virtual machines scale set IP +// Configuration's PublicIPAddress configuration +type VirtualMachineScaleSetUpdatePublicIPAddressConfiguration struct { + // Name - The publicIP address configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetUpdatePublicIPAddressConfiguration. +func (vmssupiac VirtualMachineScaleSetUpdatePublicIPAddressConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmssupiac.Name != nil { + objectMap["name"] = vmssupiac.Name + } + if vmssupiac.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties != nil { + objectMap["properties"] = vmssupiac.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetUpdatePublicIPAddressConfiguration struct. +func (vmssupiac *VirtualMachineScaleSetUpdatePublicIPAddressConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssupiac.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties) + if err != nil { + return err + } + vmssupiac.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties = &virtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties + } + } + } + + return nil +} + +// VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties describes a virtual machines scale +// set IP Configuration's PublicIPAddress configuration +type VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties struct { + // IdleTimeoutInMinutes - The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // DNSSettings - The dns settings to be applied on the publicIP addresses . + DNSSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings `json:"dnsSettings,omitempty"` +} + +// VirtualMachineScaleSetUpdateStorageProfile describes a virtual machine scale set storage profile. +type VirtualMachineScaleSetUpdateStorageProfile struct { + // ImageReference - The image reference. + ImageReference *ImageReference `json:"imageReference,omitempty"` + // OsDisk - The OS disk. + OsDisk *VirtualMachineScaleSetUpdateOSDisk `json:"osDisk,omitempty"` + // DataDisks - The data disks. + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` +} + +// VirtualMachineScaleSetUpdateVMProfile describes a virtual machine scale set virtual machine profile. +type VirtualMachineScaleSetUpdateVMProfile struct { + // OsProfile - The virtual machine scale set OS profile. + OsProfile *VirtualMachineScaleSetUpdateOSProfile `json:"osProfile,omitempty"` + // StorageProfile - The virtual machine scale set storage profile. + StorageProfile *VirtualMachineScaleSetUpdateStorageProfile `json:"storageProfile,omitempty"` + // NetworkProfile - The virtual machine scale set network profile. + NetworkProfile *VirtualMachineScaleSetUpdateNetworkProfile `json:"networkProfile,omitempty"` + // DiagnosticsProfile - The virtual machine scale set diagnostics profile. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + // ExtensionProfile - The virtual machine scale set extension profile. + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + // LicenseType - The license type, which is for bring your own license scenario. + LicenseType *string `json:"licenseType,omitempty"` +} + +// VirtualMachineScaleSetVM describes a virtual machine scale set virtual machine. +type VirtualMachineScaleSetVM struct { + autorest.Response `json:"-"` + // InstanceID - READ-ONLY; The virtual machine instance ID. + InstanceID *string `json:"instanceId,omitempty"` + // Sku - READ-ONLY; The virtual machine SKU. + Sku *Sku `json:"sku,omitempty"` + *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` + // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + Plan *Plan `json:"plan,omitempty"` + // Resources - READ-ONLY; The virtual machine child extension resources. + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + // Zones - READ-ONLY; The virtual machine zones. + Zones *[]string `json:"zones,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineScaleSetVM. +func (vmssv VirtualMachineScaleSetVM) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmssv.VirtualMachineScaleSetVMProperties != nil { + objectMap["properties"] = vmssv.VirtualMachineScaleSetVMProperties + } + if vmssv.Plan != nil { + objectMap["plan"] = vmssv.Plan + } + if vmssv.Location != nil { + objectMap["location"] = vmssv.Location + } + if vmssv.Tags != nil { + objectMap["tags"] = vmssv.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetVM struct. +func (vmssv *VirtualMachineScaleSetVM) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "instanceId": + if v != nil { + var instanceID string + err = json.Unmarshal(*v, &instanceID) + if err != nil { + return err + } + vmssv.InstanceID = &instanceID + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + vmssv.Sku = &sku + } + case "properties": + if v != nil { + var virtualMachineScaleSetVMProperties VirtualMachineScaleSetVMProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetVMProperties) + if err != nil { + return err + } + vmssv.VirtualMachineScaleSetVMProperties = &virtualMachineScaleSetVMProperties + } + case "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + vmssv.Plan = &plan + } + case "resources": + if v != nil { + var resources []VirtualMachineExtension + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + vmssv.Resources = &resources + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + vmssv.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssv.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssv.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmssv.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vmssv.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmssv.Tags = tags + } + } + } + + return nil +} + +// VirtualMachineScaleSetVMExtensionsSummary extensions summary for virtual machines of a virtual machine +// scale set. +type VirtualMachineScaleSetVMExtensionsSummary struct { + // Name - READ-ONLY; The extension name. + Name *string `json:"name,omitempty"` + // StatusesSummary - READ-ONLY; The extensions information. + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` +} + +// VirtualMachineScaleSetVMInstanceIDs specifies a list of virtual machine instance IDs from the VM scale +// set. +type VirtualMachineScaleSetVMInstanceIDs struct { + // InstanceIds - The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. + InstanceIds *[]string `json:"instanceIds,omitempty"` +} + +// VirtualMachineScaleSetVMInstanceRequiredIDs specifies a list of virtual machine instance IDs from the VM +// scale set. +type VirtualMachineScaleSetVMInstanceRequiredIDs struct { + // InstanceIds - The virtual machine scale set instance ids. + InstanceIds *[]string `json:"instanceIds,omitempty"` +} + +// VirtualMachineScaleSetVMInstanceView the instance view of a virtual machine scale set VM. +type VirtualMachineScaleSetVMInstanceView struct { + autorest.Response `json:"-"` + // PlatformUpdateDomain - The Update Domain count. + PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` + // PlatformFaultDomain - The Fault Domain count. + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + // RdpThumbPrint - The Remote desktop certificate thumbprint. + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + // VMAgent - The VM Agent running on the virtual machine. + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + // MaintenanceRedeployStatus - The Maintenance Operation status on the virtual machine. + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + // Disks - The disks information. + Disks *[]DiskInstanceView `json:"disks,omitempty"` + // Extensions - The extensions information. + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + // VMHealth - READ-ONLY; The health status for the VM. + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty"` + // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status.

    You can easily view the output of your console log.

    Azure also enables you to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + // PlacementGroupID - The placement group in which the VM is running. If the VM is deallocated it will not have a placementGroupId. + PlacementGroupID *string `json:"placementGroupId,omitempty"` +} + +// VirtualMachineScaleSetVMListResult the List Virtual Machine Scale Set VMs operation response. +type VirtualMachineScaleSetVMListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine scale sets VMs. + Value *[]VirtualMachineScaleSetVM `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Virtual Machine Scale Set VMs. Call ListNext() with this to fetch the next page of VMSS VMs + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetVMListResultIterator provides access to a complete listing of +// VirtualMachineScaleSetVM values. +type VirtualMachineScaleSetVMListResultIterator struct { + i int + page VirtualMachineScaleSetVMListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualMachineScaleSetVMListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualMachineScaleSetVMListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualMachineScaleSetVMListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualMachineScaleSetVMListResultIterator) Response() VirtualMachineScaleSetVMListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualMachineScaleSetVMListResultIterator) Value() VirtualMachineScaleSetVM { + if !iter.page.NotDone() { + return VirtualMachineScaleSetVM{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualMachineScaleSetVMListResultIterator type. +func NewVirtualMachineScaleSetVMListResultIterator(page VirtualMachineScaleSetVMListResultPage) VirtualMachineScaleSetVMListResultIterator { + return VirtualMachineScaleSetVMListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmssvlr VirtualMachineScaleSetVMListResult) IsEmpty() bool { + return vmssvlr.Value == nil || len(*vmssvlr.Value) == 0 +} + +// virtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmssvlr VirtualMachineScaleSetVMListResult) virtualMachineScaleSetVMListResultPreparer(ctx context.Context) (*http.Request, error) { + if vmssvlr.NextLink == nil || len(to.String(vmssvlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmssvlr.NextLink))) +} + +// VirtualMachineScaleSetVMListResultPage contains a page of VirtualMachineScaleSetVM values. +type VirtualMachineScaleSetVMListResultPage struct { + fn func(context.Context, VirtualMachineScaleSetVMListResult) (VirtualMachineScaleSetVMListResult, error) + vmssvlr VirtualMachineScaleSetVMListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualMachineScaleSetVMListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vmssvlr) + if err != nil { + return err + } + page.vmssvlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualMachineScaleSetVMListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualMachineScaleSetVMListResultPage) NotDone() bool { + return !page.vmssvlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualMachineScaleSetVMListResultPage) Response() VirtualMachineScaleSetVMListResult { + return page.vmssvlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualMachineScaleSetVMListResultPage) Values() []VirtualMachineScaleSetVM { + if page.vmssvlr.IsEmpty() { + return nil + } + return *page.vmssvlr.Value +} + +// Creates a new instance of the VirtualMachineScaleSetVMListResultPage type. +func NewVirtualMachineScaleSetVMListResultPage(getNextPage func(context.Context, VirtualMachineScaleSetVMListResult) (VirtualMachineScaleSetVMListResult, error)) VirtualMachineScaleSetVMListResultPage { + return VirtualMachineScaleSetVMListResultPage{fn: getNextPage} +} + +// VirtualMachineScaleSetVMNetworkProfileConfiguration describes a virtual machine scale set VM network +// profile. +type VirtualMachineScaleSetVMNetworkProfileConfiguration struct { + // NetworkInterfaceConfigurations - The list of network configurations. + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} + +// VirtualMachineScaleSetVMProfile describes a virtual machine scale set virtual machine profile. +type VirtualMachineScaleSetVMProfile struct { + // OsProfile - Specifies the operating system settings for the virtual machines in the scale set. + OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` + // StorageProfile - Specifies the storage settings for the virtual machine disks. + StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` + // NetworkProfile - Specifies properties of the network interfaces of the virtual machines in the scale set. + NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` + // DiagnosticsProfile - Specifies the boot diagnostic settings state.

    Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + // ExtensionProfile - Specifies a collection of settings for extensions installed on virtual machines in the scale set. + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + // LicenseType - Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system.

    Possible values are:

    Windows_Client

    Windows_Server

    If this element is included in a request for an update, the value must match the initial value. This value cannot be updated.

    For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    Minimum api-version: 2015-06-15 + LicenseType *string `json:"licenseType,omitempty"` + // Priority - Specifies the priority for the virtual machines in the scale set.

    Minimum api-version: 2017-10-30-preview. Possible values include: 'Regular', 'Low' + Priority VirtualMachinePriorityTypes `json:"priority,omitempty"` + // EvictionPolicy - Specifies the eviction policy for virtual machines in a low priority scale set.

    Minimum api-version: 2017-10-30-preview. Possible values include: 'Deallocate', 'Delete' + EvictionPolicy VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` +} + +// VirtualMachineScaleSetVMProperties describes the properties of a virtual machine scale set virtual +// machine. +type VirtualMachineScaleSetVMProperties struct { + // LatestModelApplied - READ-ONLY; Specifies whether the latest model has been applied to the virtual machine. + LatestModelApplied *bool `json:"latestModelApplied,omitempty"` + // VMID - READ-ONLY; Azure VM unique ID. + VMID *string `json:"vmId,omitempty"` + // InstanceView - READ-ONLY; The virtual machine instance view. + InstanceView *VirtualMachineScaleSetVMInstanceView `json:"instanceView,omitempty"` + // HardwareProfile - Specifies the hardware settings for the virtual machine. + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + // StorageProfile - Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // AdditionalCapabilities - Specifies additional capabilities enabled or disabled on the virtual machine in the scale set. For instance: whether the virtual machine has the capability to support attaching managed data disks with UltraSSD_LRS storage account type. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + // OsProfile - Specifies the operating system settings for the virtual machine. + OsProfile *OSProfile `json:"osProfile,omitempty"` + // NetworkProfile - Specifies the network interfaces of the virtual machine. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // NetworkProfileConfiguration - Specifies the network profile configuration of the virtual machine. + NetworkProfileConfiguration *VirtualMachineScaleSetVMNetworkProfileConfiguration `json:"networkProfileConfiguration,omitempty"` + // DiagnosticsProfile - Specifies the boot diagnostic settings state.

    Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + // AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).

    For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // LicenseType - Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system.

    Possible values are:

    Windows_Client

    Windows_Server

    If this element is included in a request for an update, the value must match the initial value. This value cannot be updated.

    For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    Minimum api-version: 2015-06-15 + LicenseType *string `json:"licenseType,omitempty"` + // ModelDefinitionApplied - READ-ONLY; Specifies whether the model applied to the virtual machine is the model of the virtual machine scale set or the customized model for the virtual machine. + ModelDefinitionApplied *string `json:"modelDefinitionApplied,omitempty"` + // ProtectionPolicy - Specifies the protection policy of the virtual machine. + ProtectionPolicy *VirtualMachineScaleSetVMProtectionPolicy `json:"protectionPolicy,omitempty"` +} + +// VirtualMachineScaleSetVMProtectionPolicy the protection policy of a virtual machine scale set VM. +type VirtualMachineScaleSetVMProtectionPolicy struct { + // ProtectFromScaleIn - Indicates that the virtual machine scale set VM shouldn't be considered for deletion during a scale-in operation. + ProtectFromScaleIn *bool `json:"protectFromScaleIn,omitempty"` + // ProtectFromScaleSetActions - Indicates that model updates or actions (including scale-in) initiated on the virtual machine scale set should not be applied to the virtual machine scale set VM. + ProtectFromScaleSetActions *bool `json:"protectFromScaleSetActions,omitempty"` +} + +// VirtualMachineScaleSetVMReimageParameters describes a Virtual Machine Scale Set VM Reimage Parameters. +type VirtualMachineScaleSetVMReimageParameters struct { + // TempDisk - Specifies whether to reimage temp disk. Default value: false. + TempDisk *bool `json:"tempDisk,omitempty"` +} + +// VirtualMachineScaleSetVMsDeallocateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsDeallocateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsDeallocateFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeallocateFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetVMsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsDeleteFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetVMsPerformMaintenanceFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualMachineScaleSetVMsPerformMaintenanceFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsPerformMaintenanceFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetVMsPowerOffFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsPowerOffFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsPowerOffFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPowerOffFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetVMsRedeployFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsRedeployFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsRedeployFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRedeployFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRedeployFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetVMsReimageAllFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsReimageAllFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsReimageAllFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageAllFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetVMsReimageFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsReimageFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsReimageFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetVMsRestartFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsRestartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsRestartFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetVMsRunCommandFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsRunCommandFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsRunCommandFuture) Result(client VirtualMachineScaleSetVMsClient) (rcr RunCommandResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRunCommandFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRunCommandFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rcr.Response.Response, err = future.GetResult(sender); err == nil && rcr.Response.Response.StatusCode != http.StatusNoContent { + rcr, err = client.RunCommandResponder(rcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRunCommandFuture", "Result", rcr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachineScaleSetVMsStartFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsStartFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineScaleSetVMsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineScaleSetVMsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineScaleSetVMsUpdateFuture) Result(client VirtualMachineScaleSetVMsClient) (vmssv VirtualMachineScaleSetVM, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmssv.Response.Response, err = future.GetResult(sender); err == nil && vmssv.Response.Response.StatusCode != http.StatusNoContent { + vmssv, err = client.UpdateResponder(vmssv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsUpdateFuture", "Result", vmssv.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachinesCaptureFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesCaptureFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesCaptureFuture) Result(client VirtualMachinesClient) (vmcr VirtualMachineCaptureResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmcr.Response.Response, err = future.GetResult(sender); err == nil && vmcr.Response.Response.StatusCode != http.StatusNoContent { + vmcr, err = client.CaptureResponder(vmcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", vmcr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachinesConvertToManagedDisksFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachinesConvertToManagedDisksFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesConvertToManagedDisksFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesConvertToManagedDisksFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachinesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesCreateOrUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if VM.Response.Response, err = future.GetResult(sender); err == nil && VM.Response.Response.StatusCode != http.StatusNoContent { + VM, err = client.CreateOrUpdateResponder(VM.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachinesDeallocateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachinesDeallocateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesDeallocateFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeallocateFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesDeleteFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineSize describes the properties of a VM size. +type VirtualMachineSize struct { + // Name - The name of the virtual machine size. + Name *string `json:"name,omitempty"` + // NumberOfCores - The number of cores supported by the virtual machine size. + NumberOfCores *int32 `json:"numberOfCores,omitempty"` + // OsDiskSizeInMB - The OS disk size, in MB, allowed by the virtual machine size. + OsDiskSizeInMB *int32 `json:"osDiskSizeInMB,omitempty"` + // ResourceDiskSizeInMB - The resource disk size, in MB, allowed by the virtual machine size. + ResourceDiskSizeInMB *int32 `json:"resourceDiskSizeInMB,omitempty"` + // MemoryInMB - The amount of memory, in MB, supported by the virtual machine size. + MemoryInMB *int32 `json:"memoryInMB,omitempty"` + // MaxDataDiskCount - The maximum number of data disks that can be attached to the virtual machine size. + MaxDataDiskCount *int32 `json:"maxDataDiskCount,omitempty"` +} + +// VirtualMachineSizeListResult the List Virtual Machine operation response. +type VirtualMachineSizeListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine sizes. + Value *[]VirtualMachineSize `json:"value,omitempty"` +} + +// VirtualMachinesPerformMaintenanceFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachinesPerformMaintenanceFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesPerformMaintenanceFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPerformMaintenanceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPerformMaintenanceFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesPowerOffFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesPowerOffFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesPowerOffFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPowerOffFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesRedeployFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesRedeployFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesRedeployFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRedeployFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesReimageFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesReimageFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesReimageFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesReimageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesReimageFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesRestartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesRestartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesRestartFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesRunCommandFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachinesRunCommandFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesRunCommandFuture) Result(client VirtualMachinesClient) (rcr RunCommandResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRunCommandFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRunCommandFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rcr.Response.Response, err = future.GetResult(sender); err == nil && rcr.Response.Response.StatusCode != http.StatusNoContent { + rcr, err = client.RunCommandResponder(rcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRunCommandFuture", "Result", rcr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesStartFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesStartFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineStatusCodeCount the status code and count of the virtual machine scale set instance view +// status summary. +type VirtualMachineStatusCodeCount struct { + // Code - READ-ONLY; The instance view status code. + Code *string `json:"code,omitempty"` + // Count - READ-ONLY; The number of instances having a particular status code. + Count *int32 `json:"count,omitempty"` +} + +// VirtualMachinesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if VM.Response.Response, err = future.GetResult(sender); err == nil && VM.Response.Response.StatusCode != http.StatusNoContent { + VM, err = client.UpdateResponder(VM.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachineUpdate describes a Virtual Machine Update. +type VirtualMachineUpdate struct { + // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineProperties `json:"properties,omitempty"` + // Identity - The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity `json:"identity,omitempty"` + // Zones - The virtual machine zones. + Zones *[]string `json:"zones,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineUpdate. +func (vmu VirtualMachineUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmu.Plan != nil { + objectMap["plan"] = vmu.Plan + } + if vmu.VirtualMachineProperties != nil { + objectMap["properties"] = vmu.VirtualMachineProperties + } + if vmu.Identity != nil { + objectMap["identity"] = vmu.Identity + } + if vmu.Zones != nil { + objectMap["zones"] = vmu.Zones + } + if vmu.Tags != nil { + objectMap["tags"] = vmu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineUpdate struct. +func (vmu *VirtualMachineUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + vmu.Plan = &plan + } + case "properties": + if v != nil { + var virtualMachineProperties VirtualMachineProperties + err = json.Unmarshal(*v, &virtualMachineProperties) + if err != nil { + return err + } + vmu.VirtualMachineProperties = &virtualMachineProperties + } + case "identity": + if v != nil { + var identity VirtualMachineIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + vmu.Identity = &identity + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + vmu.Zones = &zones + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmu.Tags = tags + } + } + } + + return nil +} + +// VMScaleSetConvertToSinglePlacementGroupInput ... +type VMScaleSetConvertToSinglePlacementGroupInput struct { + // ActivePlacementGroupID - Id of the placement group in which you want future virtual machine instances to be placed. To query placement group Id, please use Virtual Machine Scale Set VMs - Get API. If not provided, the platform will choose one with maximum number of virtual machine instances. + ActivePlacementGroupID *string `json:"activePlacementGroupId,omitempty"` +} + +// WindowsConfiguration specifies Windows operating system settings on the virtual machine. +type WindowsConfiguration struct { + // ProvisionVMAgent - Indicates whether virtual machine agent should be provisioned on the virtual machine.

    When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later. + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + // EnableAutomaticUpdates - Indicates whether virtual machine is enabled for automatic Windows updates. Default value is true.

    For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning. + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + // TimeZone - Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time" + TimeZone *string `json:"timeZone,omitempty"` + // AdditionalUnattendContent - Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + // WinRM - Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} + +// WinRMConfiguration describes Windows Remote Management configuration of the VM +type WinRMConfiguration struct { + // Listeners - The list of Windows Remote Management listeners + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} + +// WinRMListener describes Protocol and thumbprint of Windows Remote Management listener +type WinRMListener struct { + // Protocol - Specifies the protocol of listener.

    Possible values are:
    **http**

    **https**. Possible values include: 'HTTP', 'HTTPS' + Protocol ProtocolTypes `json:"protocol,omitempty"` + // CertificateURL - This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8:

    {
    "data":"",
    "dataType":"pfx",
    "password":""
    } + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/operations.go new file mode 100644 index 000000000..63d91871b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/operations.go @@ -0,0 +1,109 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the compute Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets a list of compute operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Compute/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/proximityplacementgroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/proximityplacementgroups.go new file mode 100644 index 000000000..d549979a3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/proximityplacementgroups.go @@ -0,0 +1,577 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProximityPlacementGroupsClient is the compute Client +type ProximityPlacementGroupsClient struct { + BaseClient +} + +// NewProximityPlacementGroupsClient creates an instance of the ProximityPlacementGroupsClient client. +func NewProximityPlacementGroupsClient(subscriptionID string) ProximityPlacementGroupsClient { + return NewProximityPlacementGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProximityPlacementGroupsClientWithBaseURI creates an instance of the ProximityPlacementGroupsClient client. +func NewProximityPlacementGroupsClientWithBaseURI(baseURI string, subscriptionID string) ProximityPlacementGroupsClient { + return ProximityPlacementGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a proximity placement group. +// Parameters: +// resourceGroupName - the name of the resource group. +// proximityPlacementGroupName - the name of the proximity placement group. +// parameters - parameters supplied to the Create Proximity Placement Group operation. +func (client ProximityPlacementGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup) (result ProximityPlacementGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, proximityPlacementGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProximityPlacementGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "proximityPlacementGroupName": autorest.Encode("path", proximityPlacementGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ProximityPlacementGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ProximityPlacementGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ProximityPlacementGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a proximity placement group. +// Parameters: +// resourceGroupName - the name of the resource group. +// proximityPlacementGroupName - the name of the proximity placement group. +func (client ProximityPlacementGroupsClient) Delete(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, proximityPlacementGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProximityPlacementGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "proximityPlacementGroupName": autorest.Encode("path", proximityPlacementGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProximityPlacementGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProximityPlacementGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves information about a proximity placement group . +// Parameters: +// resourceGroupName - the name of the resource group. +// proximityPlacementGroupName - the name of the proximity placement group. +func (client ProximityPlacementGroupsClient) Get(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (result ProximityPlacementGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, proximityPlacementGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProximityPlacementGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "proximityPlacementGroupName": autorest.Encode("path", proximityPlacementGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProximityPlacementGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProximityPlacementGroupsClient) GetResponder(resp *http.Response) (result ProximityPlacementGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists all proximity placement groups in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ProximityPlacementGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ProximityPlacementGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ppglr.Response.Response != nil { + sc = result.ppglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ppglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ppglr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ProximityPlacementGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ProximityPlacementGroupsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ProximityPlacementGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ProximityPlacementGroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ProximityPlacementGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ProximityPlacementGroupListResult) (result ProximityPlacementGroupListResult, err error) { + req, err := lastResults.proximityPlacementGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProximityPlacementGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ProximityPlacementGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription lists all proximity placement groups in a subscription. +func (client ProximityPlacementGroupsClient) ListBySubscription(ctx context.Context) (result ProximityPlacementGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.ListBySubscription") + defer func() { + sc := -1 + if result.ppglr.Response.Response != nil { + sc = result.ppglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.ppglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.ppglr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ProximityPlacementGroupsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ProximityPlacementGroupsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ProximityPlacementGroupsClient) ListBySubscriptionResponder(resp *http.Response) (result ProximityPlacementGroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client ProximityPlacementGroupsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ProximityPlacementGroupListResult) (result ProximityPlacementGroupListResult, err error) { + req, err := lastResults.proximityPlacementGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProximityPlacementGroupsClient) ListBySubscriptionComplete(ctx context.Context) (result ProximityPlacementGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update update a proximity placement group. +// Parameters: +// resourceGroupName - the name of the resource group. +// proximityPlacementGroupName - the name of the proximity placement group. +// parameters - parameters supplied to the Update Proximity Placement Group operation. +func (client ProximityPlacementGroupsClient) Update(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate) (result ProximityPlacementGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, proximityPlacementGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProximityPlacementGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "proximityPlacementGroupName": autorest.Encode("path", proximityPlacementGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ProximityPlacementGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProximityPlacementGroupsClient) UpdateResponder(resp *http.Response) (result ProximityPlacementGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/resourceskus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/resourceskus.go new file mode 100644 index 000000000..91e3cd42e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/resourceskus.go @@ -0,0 +1,151 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourceSkusClient is the compute Client +type ResourceSkusClient struct { + BaseClient +} + +// NewResourceSkusClient creates an instance of the ResourceSkusClient client. +func NewResourceSkusClient(subscriptionID string) ResourceSkusClient { + return NewResourceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceSkusClientWithBaseURI creates an instance of the ResourceSkusClient client. +func NewResourceSkusClientWithBaseURI(baseURI string, subscriptionID string) ResourceSkusClient { + return ResourceSkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the list of Microsoft.Compute SKUs available for your Subscription. +func (client ResourceSkusClient) List(ctx context.Context) (result ResourceSkusResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusClient.List") + defer func() { + sc := -1 + if result.rsr.Response.Response != nil { + sc = result.rsr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", resp, "Failure sending request") + return + } + + result.rsr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ResourceSkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceSkusClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ResourceSkusClient) ListResponder(resp *http.Response) (result ResourceSkusResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ResourceSkusClient) listNextResults(ctx context.Context, lastResults ResourceSkusResult) (result ResourceSkusResult, err error) { + req, err := lastResults.resourceSkusResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourceSkusClient) ListComplete(ctx context.Context) (result ResourceSkusResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/snapshots.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/snapshots.go new file mode 100644 index 000000000..214585b28 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/snapshots.go @@ -0,0 +1,760 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SnapshotsClient is the compute Client +type SnapshotsClient struct { + BaseClient +} + +// NewSnapshotsClient creates an instance of the SnapshotsClient client. +func NewSnapshotsClient(subscriptionID string) SnapshotsClient { + return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client. +func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { + return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a snapshot. +// Parameters: +// resourceGroupName - the name of the resource group. +// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot +// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. +// snapshot - snapshot object supplied in the body of the Put disk operation. +func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (result SnapshotsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: snapshot, + Constraints: []validation.Constraint{{Target: "snapshot.SnapshotProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "snapshot.SnapshotProperties.CreationData", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "snapshot.SnapshotProperties.CreationData.ImageReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "snapshot.SnapshotProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "snapshot.SnapshotProperties.EncryptionSettingsCollection", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "snapshot.SnapshotProperties.EncryptionSettingsCollection.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("compute.SnapshotsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + snapshot.ManagedBy = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), + autorest.WithJSON(snapshot), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (future SnapshotsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a snapshot. +// Parameters: +// resourceGroupName - the name of the resource group. +// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot +// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. +func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) DeleteSender(req *http.Request) (future SnapshotsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about a snapshot. +// Parameters: +// resourceGroupName - the name of the resource group. +// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot +// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. +func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, snapshotName string) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GrantAccess grants access to a snapshot. +// Parameters: +// resourceGroupName - the name of the resource group. +// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot +// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. +// grantAccessData - access data object supplied in the body of the get snapshot access operation. +func (client SnapshotsClient) GrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (result SnapshotsGrantAccessFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.GrantAccess") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: grantAccessData, + Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.SnapshotsClient", "GrantAccess", err.Error()) + } + + req, err := client.GrantAccessPreparer(ctx, resourceGroupName, snapshotName, grantAccessData) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", nil, "Failure preparing request") + return + } + + result, err = client.GrantAccessSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", result.Response(), "Failure sending request") + return + } + + return +} + +// GrantAccessPreparer prepares the GrantAccess request. +func (client SnapshotsClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", pathParameters), + autorest.WithJSON(grantAccessData), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GrantAccessSender sends the GrantAccess request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) GrantAccessSender(req *http.Request) (future SnapshotsGrantAccessFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// GrantAccessResponder handles the response to the GrantAccess request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists snapshots under a subscription. +func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure sending request") + return + } + + result.sl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) listNextResults(ctx context.Context, lastResults SnapshotList) (result SnapshotList, err error) { + req, err := lastResults.snapshotListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists snapshots under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.sl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SnapshotList) (result SnapshotList, err error) { + req, err := lastResults.snapshotListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// RevokeAccess revokes access to a snapshot. +// Parameters: +// resourceGroupName - the name of the resource group. +// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot +// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. +func (client SnapshotsClient) RevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsRevokeAccessFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.RevokeAccess") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", nil, "Failure preparing request") + return + } + + result, err = client.RevokeAccessSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", result.Response(), "Failure sending request") + return + } + + return +} + +// RevokeAccessPreparer prepares the RevokeAccess request. +func (client SnapshotsClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevokeAccessSender sends the RevokeAccess request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) RevokeAccessSender(req *http.Request) (future SnapshotsRevokeAccessFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RevokeAccessResponder handles the response to the RevokeAccess request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates (patches) a snapshot. +// Parameters: +// resourceGroupName - the name of the resource group. +// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot +// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. +// snapshot - snapshot object supplied in the body of the Patch snapshot operation. +func (client SnapshotsClient) Update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (result SnapshotsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SnapshotsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-30" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), + autorest.WithJSON(snapshot), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) UpdateSender(req *http.Request) (future SnapshotsUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/usage.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/usage.go new file mode 100644 index 000000000..03d590866 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/usage.go @@ -0,0 +1,162 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// UsageClient is the compute Client +type UsageClient struct { + BaseClient +} + +// NewUsageClient creates an instance of the UsageClient client. +func NewUsageClient(subscriptionID string) UsageClient { + return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsageClientWithBaseURI creates an instance of the UsageClient client. +func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient { + return UsageClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets, for the specified location, the current compute resource usage information as well as the limits for +// compute resources under the subscription. +// Parameters: +// location - the location for which resource usage is queried. +func (client UsageClient) List(ctx context.Context, location string) (result ListUsagesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageClient.List") + defer func() { + sc := -1 + if result.lur.Response.Response != nil { + sc = result.lur.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.UsageClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lur.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request") + return + } + + result.lur, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsageClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsageClient) listNextResults(ctx context.Context, lastResults ListUsagesResult) (result ListUsagesResult, err error) { + req, err := lastResults.listUsagesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsageClient) ListComplete(ctx context.Context, location string) (result ListUsagesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/version.go new file mode 100644 index 000000000..184b918cc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/version.go @@ -0,0 +1,30 @@ +package compute + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " compute/2019-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensionimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensionimages.go new file mode 100644 index 000000000..5c53eeb95 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensionimages.go @@ -0,0 +1,283 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineExtensionImagesClient is the compute Client +type VirtualMachineExtensionImagesClient struct { + BaseClient +} + +// NewVirtualMachineExtensionImagesClient creates an instance of the VirtualMachineExtensionImagesClient client. +func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient { + return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the VirtualMachineExtensionImagesClient +// client. +func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient { + return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a virtual machine extension image. +// Parameters: +// location - the name of a supported Azure region. +func (client VirtualMachineExtensionImagesClient) Get(ctx context.Context, location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionImagesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, location, publisherName, typeParameter, version) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineExtensionImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, typeParameter string, version string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "type": autorest.Encode("path", typeParameter), + "version": autorest.Encode("path", version), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Response) (result VirtualMachineExtensionImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListTypes gets a list of virtual machine extension image types. +// Parameters: +// location - the name of a supported Azure region. +func (client VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionImagesClient.ListTypes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListTypesPreparer(ctx, location, publisherName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request") + return + } + + resp, err := client.ListTypesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request") + return + } + + result, err = client.ListTypesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure responding to request") + } + + return +} + +// ListTypesPreparer prepares the ListTypes request. +func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTypesSender sends the ListTypes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListTypesResponder handles the response to the ListTypes request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVersions gets a list of virtual machine extension image versions. +// Parameters: +// location - the name of a supported Azure region. +// filter - the filter to apply on the operation. +func (client VirtualMachineExtensionImagesClient) ListVersions(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result ListVirtualMachineExtensionImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionImagesClient.ListVersions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListVersionsPreparer(ctx, location, publisherName, typeParameter, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request") + return + } + + resp, err := client.ListVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request") + return + } + + result, err = client.ListVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure responding to request") + } + + return +} + +// ListVersionsPreparer prepares the ListVersions request. +func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "type": autorest.Encode("path", typeParameter), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVersionsSender sends the ListVersions request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListVersionsResponder handles the response to the ListVersions request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensions.go new file mode 100644 index 000000000..327f62703 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensions.go @@ -0,0 +1,447 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineExtensionsClient is the compute Client +type VirtualMachineExtensionsClient struct { + BaseClient +} + +// NewVirtualMachineExtensionsClient creates an instance of the VirtualMachineExtensionsClient client. +func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient { + return NewVirtualMachineExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineExtensionsClientWithBaseURI creates an instance of the VirtualMachineExtensionsClient client. +func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient { + return VirtualMachineExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the operation to create or update the extension. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine where the extension should be created or updated. +// VMExtensionName - the name of the virtual machine extension. +// extensionParameters - parameters supplied to the Create Virtual Machine Extension operation. +func (client VirtualMachineExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (result VirtualMachineExtensionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmExtensionName": autorest.Encode("path", VMExtensionName), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), + autorest.WithJSON(extensionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineExtensionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the operation to delete the extension. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine where the extension should be deleted. +// VMExtensionName - the name of the virtual machine extension. +func (client VirtualMachineExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (result VirtualMachineExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMName, VMExtensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmExtensionName": autorest.Encode("path", VMExtensionName), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineExtensionsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the operation to get the extension. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine containing the extension. +// VMExtensionName - the name of the virtual machine extension. +// expand - the expand expression to apply on the operation. +func (client VirtualMachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (result VirtualMachineExtension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMName, VMExtensionName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmExtensionName": autorest.Encode("path", VMExtensionName), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineExtension, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the operation to get all extensions of a Virtual Machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine containing the extension. +// expand - the expand expression to apply on the operation. +func (client VirtualMachineExtensionsClient) List(ctx context.Context, resourceGroupName string, VMName string, expand string) (result VirtualMachineExtensionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, VMName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, VMName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionsClient) ListResponder(resp *http.Response) (result VirtualMachineExtensionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update the operation to update the extension. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine where the extension should be updated. +// VMExtensionName - the name of the virtual machine extension. +// extensionParameters - parameters supplied to the Update Virtual Machine Extension operation. +func (client VirtualMachineExtensionsClient) Update(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtensionUpdate) (result VirtualMachineExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachineExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtensionUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmExtensionName": autorest.Encode("path", VMExtensionName), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), + autorest.WithJSON(extensionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionsClient) UpdateSender(req *http.Request) (future VirtualMachineExtensionsUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionsClient) UpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineimages.go new file mode 100644 index 000000000..3eb40a1fa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineimages.go @@ -0,0 +1,446 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineImagesClient is the compute Client +type VirtualMachineImagesClient struct { + BaseClient +} + +// NewVirtualMachineImagesClient creates an instance of the VirtualMachineImagesClient client. +func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient { + return NewVirtualMachineImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineImagesClientWithBaseURI creates an instance of the VirtualMachineImagesClient client. +func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient { + return VirtualMachineImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a virtual machine image. +// Parameters: +// location - the name of a supported Azure region. +// publisherName - a valid image publisher. +// offer - a valid image publisher offer. +// skus - a valid image SKU. +// version - a valid image SKU version. +func (client VirtualMachineImagesClient) Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, location, publisherName, offer, skus, version) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "offer": autorest.Encode("path", offer), + "publisherName": autorest.Encode("path", publisherName), + "skus": autorest.Encode("path", skus), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (result VirtualMachineImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. +// Parameters: +// location - the name of a supported Azure region. +// publisherName - a valid image publisher. +// offer - a valid image publisher offer. +// skus - a valid image SKU. +// filter - the filter to apply on the operation. +func (client VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, location, publisherName, offer, skus, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineImagesClient) ListPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "offer": autorest.Encode("path", offer), + "publisherName": autorest.Encode("path", publisherName), + "skus": autorest.Encode("path", skus), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOffers gets a list of virtual machine image offers for the specified location and publisher. +// Parameters: +// location - the name of a supported Azure region. +// publisherName - a valid image publisher. +func (client VirtualMachineImagesClient) ListOffers(ctx context.Context, location string, publisherName string) (result ListVirtualMachineImageResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.ListOffers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListOffersPreparer(ctx, location, publisherName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", nil, "Failure preparing request") + return + } + + resp, err := client.ListOffersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure sending request") + return + } + + result, err = client.ListOffersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure responding to request") + } + + return +} + +// ListOffersPreparer prepares the ListOffers request. +func (client VirtualMachineImagesClient) ListOffersPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOffersSender sends the ListOffers request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) ListOffersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListOffersResponder handles the response to the ListOffers request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishers gets a list of virtual machine image publishers for the specified Azure location. +// Parameters: +// location - the name of a supported Azure region. +func (client VirtualMachineImagesClient) ListPublishers(ctx context.Context, location string) (result ListVirtualMachineImageResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.ListPublishers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPublishersPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublishersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure sending request") + return + } + + result, err = client.ListPublishersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure responding to request") + } + + return +} + +// ListPublishersPreparer prepares the ListPublishers request. +func (client VirtualMachineImagesClient) ListPublishersPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPublishersSender sends the ListPublishers request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) ListPublishersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListPublishersResponder handles the response to the ListPublishers request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSkus gets a list of virtual machine image SKUs for the specified location, publisher, and offer. +// Parameters: +// location - the name of a supported Azure region. +// publisherName - a valid image publisher. +// offer - a valid image publisher offer. +func (client VirtualMachineImagesClient) ListSkus(ctx context.Context, location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.ListSkus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSkusPreparer(ctx, location, publisherName, offer) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client VirtualMachineImagesClient) ListSkusPreparer(ctx context.Context, location string, publisherName string, offer string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "offer": autorest.Encode("path", offer), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) ListSkusResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineruncommands.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineruncommands.go new file mode 100644 index 000000000..995414d5b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineruncommands.go @@ -0,0 +1,244 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineRunCommandsClient is the compute Client +type VirtualMachineRunCommandsClient struct { + BaseClient +} + +// NewVirtualMachineRunCommandsClient creates an instance of the VirtualMachineRunCommandsClient client. +func NewVirtualMachineRunCommandsClient(subscriptionID string) VirtualMachineRunCommandsClient { + return NewVirtualMachineRunCommandsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineRunCommandsClientWithBaseURI creates an instance of the VirtualMachineRunCommandsClient client. +func NewVirtualMachineRunCommandsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineRunCommandsClient { + return VirtualMachineRunCommandsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets specific run command for a subscription in a location. +// Parameters: +// location - the location upon which run commands is queried. +// commandID - the command id. +func (client VirtualMachineRunCommandsClient) Get(ctx context.Context, location string, commandID string) (result RunCommandDocument, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineRunCommandsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineRunCommandsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, location, commandID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineRunCommandsClient) GetPreparer(ctx context.Context, location string, commandID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commandId": autorest.Encode("path", commandID), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineRunCommandsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineRunCommandsClient) GetResponder(resp *http.Response) (result RunCommandDocument, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all available run commands for a subscription in a location. +// Parameters: +// location - the location upon which run commands is queried. +func (client VirtualMachineRunCommandsClient) List(ctx context.Context, location string) (result RunCommandListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineRunCommandsClient.List") + defer func() { + sc := -1 + if result.rclr.Response.Response != nil { + sc = result.rclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineRunCommandsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", resp, "Failure sending request") + return + } + + result.rclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineRunCommandsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineRunCommandsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineRunCommandsClient) ListResponder(resp *http.Response) (result RunCommandListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualMachineRunCommandsClient) listNextResults(ctx context.Context, lastResults RunCommandListResult) (result RunCommandListResult, err error) { + req, err := lastResults.runCommandListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineRunCommandsClient) ListComplete(ctx context.Context, location string) (result RunCommandListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineRunCommandsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachines.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachines.go new file mode 100644 index 000000000..eced919b1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachines.go @@ -0,0 +1,1755 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachinesClient is the compute Client +type VirtualMachinesClient struct { + BaseClient +} + +// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient client. +func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { + return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachinesClientWithBaseURI creates an instance of the VirtualMachinesClient client. +func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { + return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Capture captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create +// similar VMs. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +// parameters - parameters supplied to the Capture Virtual Machine operation. +func (client VirtualMachinesClient) Capture(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters) (result VirtualMachinesCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Capture") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VhdPrefix", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DestinationContainerName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.OverwriteVhds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachinesClient", "Capture", err.Error()) + } + + req, err := client.CapturePreparer(ctx, resourceGroupName, VMName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", nil, "Failure preparing request") + return + } + + result, err = client.CaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", result.Response(), "Failure sending request") + return + } + + return +} + +// CapturePreparer prepares the Capture request. +func (client VirtualMachinesClient) CapturePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CaptureSender sends the Capture request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) CaptureSender(req *http.Request) (future VirtualMachinesCaptureFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CaptureResponder handles the response to the Capture request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (result VirtualMachineCaptureResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ConvertToManagedDisks converts virtual machine disks from blob-based to managed disks. Virtual machine must be +// stop-deallocated before invoking this operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) ConvertToManagedDisks(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesConvertToManagedDisksFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ConvertToManagedDisks") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ConvertToManagedDisksPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", nil, "Failure preparing request") + return + } + + result, err = client.ConvertToManagedDisksSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", result.Response(), "Failure sending request") + return + } + + return +} + +// ConvertToManagedDisksPreparer prepares the ConvertToManagedDisks request. +func (client VirtualMachinesClient) ConvertToManagedDisksPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ConvertToManagedDisksSender sends the ConvertToManagedDisks request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ConvertToManagedDisksSender(req *http.Request) (future VirtualMachinesConvertToManagedDisksFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ConvertToManagedDisksResponder handles the response to the ConvertToManagedDisks request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ConvertToManagedDisksResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate the operation to create or update a virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +// parameters - parameters supplied to the Create Virtual Machine operation. +func (client VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachine) (result VirtualMachinesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualMachineProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachinesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachine) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Resources = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachinesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Deallocate shuts down the virtual machine and releases the compute resources. You are not billed for the compute +// resources that this virtual machine uses. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Deallocate(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesDeallocateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Deallocate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", nil, "Failure preparing request") + return + } + + result, err = client.DeallocateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", result.Response(), "Failure sending request") + return + } + + return +} + +// DeallocatePreparer prepares the Deallocate request. +func (client VirtualMachinesClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeallocateSender sends the Deallocate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) DeallocateSender(req *http.Request) (future VirtualMachinesDeallocateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeallocateResponder handles the response to the Deallocate request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) DeallocateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete the operation to delete a virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Delete(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) DeleteSender(req *http.Request) (future VirtualMachinesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Generalize sets the state of the virtual machine to generalized. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Generalize(ctx context.Context, resourceGroupName string, VMName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Generalize") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GeneralizePreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil, "Failure preparing request") + return + } + + resp, err := client.GeneralizeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request") + return + } + + result, err = client.GeneralizeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure responding to request") + } + + return +} + +// GeneralizePreparer prepares the Generalize request. +func (client VirtualMachinesClient) GeneralizePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GeneralizeSender sends the Generalize request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) GeneralizeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GeneralizeResponder handles the response to the Generalize request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves information about the model view or the instance view of a virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +// expand - the expand expression to apply on the operation. +func (client VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (result VirtualMachine, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachinesClient) GetPreparer(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// InstanceView retrieves information about the run-time state of a virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) InstanceView(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachineInstanceView, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.InstanceView") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.InstanceViewPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "InstanceView", nil, "Failure preparing request") + return + } + + resp, err := client.InstanceViewSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "InstanceView", resp, "Failure sending request") + return + } + + result, err = client.InstanceViewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "InstanceView", resp, "Failure responding to request") + } + + return +} + +// InstanceViewPreparer prepares the InstanceView request. +func (client VirtualMachinesClient) InstanceViewPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// InstanceViewSender sends the InstanceView request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) InstanceViewSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// InstanceViewResponder handles the response to the InstanceView request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) InstanceViewResponder(resp *http.Response) (result VirtualMachineInstanceView, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to +// get the next page of virtual machines. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualMachinesClient) List(ctx context.Context, resourceGroupName string) (result VirtualMachineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.List") + defer func() { + sc := -1 + if result.vmlr.Response.Response != nil { + sc = result.vmlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vmlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachinesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result VirtualMachineListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualMachinesClient) listNextResults(ctx context.Context, lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { + req, err := lastResults.virtualMachineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachinesClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualMachineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll lists all of the virtual machines in the specified subscription. Use the nextLink property in the response +// to get the next page of virtual machines. +func (client VirtualMachinesClient) ListAll(ctx context.Context) (result VirtualMachineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListAll") + defer func() { + sc := -1 + if result.vmlr.Response.Response != nil { + sc = result.vmlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.vmlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client VirtualMachinesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListAllResponder(resp *http.Response) (result VirtualMachineListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client VirtualMachinesClient) listAllNextResults(ctx context.Context, lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { + req, err := lastResults.virtualMachineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachinesClient) ListAllComplete(ctx context.Context) (result VirtualMachineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListAvailableSizes lists all available virtual machine sizes to which the specified virtual machine can be resized. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachineSizeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListAvailableSizes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableSizesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableSizesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to request") + } + + return +} + +// ListAvailableSizesPreparer prepares the ListAvailableSizes request. +func (client VirtualMachinesClient) ListAvailableSizesPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByLocation gets all the virtual machines under the specified subscription for the specified location. +// Parameters: +// location - the location for which virtual machines under the subscription are queried. +func (client VirtualMachinesClient) ListByLocation(ctx context.Context, location string) (result VirtualMachineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListByLocation") + defer func() { + sc := -1 + if result.vmlr.Response.Response != nil { + sc = result.vmlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachinesClient", "ListByLocation", err.Error()) + } + + result.fn = client.listByLocationNextResults + req, err := client.ListByLocationPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListByLocation", nil, "Failure preparing request") + return + } + + resp, err := client.ListByLocationSender(req) + if err != nil { + result.vmlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListByLocation", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListByLocation", resp, "Failure responding to request") + } + + return +} + +// ListByLocationPreparer prepares the ListByLocation request. +func (client VirtualMachinesClient) ListByLocationPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByLocationSender sends the ListByLocation request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByLocationResponder handles the response to the ListByLocation request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListByLocationResponder(resp *http.Response) (result VirtualMachineListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByLocationNextResults retrieves the next set of results, if any. +func (client VirtualMachinesClient) listByLocationNextResults(ctx context.Context, lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { + req, err := lastResults.virtualMachineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listByLocationNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listByLocationNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listByLocationNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachinesClient) ListByLocationComplete(ctx context.Context, location string) (result VirtualMachineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListByLocation") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByLocation(ctx, location) + return +} + +// PerformMaintenance the operation to perform maintenance on a virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) PerformMaintenance(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesPerformMaintenanceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.PerformMaintenance") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PerformMaintenance", nil, "Failure preparing request") + return + } + + result, err = client.PerformMaintenanceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PerformMaintenance", result.Response(), "Failure sending request") + return + } + + return +} + +// PerformMaintenancePreparer prepares the PerformMaintenance request. +func (client VirtualMachinesClient) PerformMaintenancePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PerformMaintenanceSender sends the PerformMaintenance request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) PerformMaintenanceSender(req *http.Request) (future VirtualMachinesPerformMaintenanceFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// PerformMaintenanceResponder handles the response to the PerformMaintenance request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) PerformMaintenanceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// PowerOff the operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same +// provisioned resources. You are still charged for this virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +// skipShutdown - the parameter to request non-graceful VM shutdown. True value for this flag indicates +// non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not +// specified +func (client VirtualMachinesClient) PowerOff(ctx context.Context, resourceGroupName string, VMName string, skipShutdown *bool) (result VirtualMachinesPowerOffFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.PowerOff") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMName, skipShutdown) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", nil, "Failure preparing request") + return + } + + result, err = client.PowerOffSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", result.Response(), "Failure sending request") + return + } + + return +} + +// PowerOffPreparer prepares the PowerOff request. +func (client VirtualMachinesClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMName string, skipShutdown *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skipShutdown != nil { + queryParameters["skipShutdown"] = autorest.Encode("query", *skipShutdown) + } else { + queryParameters["skipShutdown"] = autorest.Encode("query", false) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PowerOffSender sends the PowerOff request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) PowerOffSender(req *http.Request) (future VirtualMachinesPowerOffFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// PowerOffResponder handles the response to the PowerOff request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) PowerOffResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Redeploy the operation to redeploy a virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Redeploy(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesRedeployFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Redeploy") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RedeployPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", nil, "Failure preparing request") + return + } + + result, err = client.RedeploySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", result.Response(), "Failure sending request") + return + } + + return +} + +// RedeployPreparer prepares the Redeploy request. +func (client VirtualMachinesClient) RedeployPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RedeploySender sends the Redeploy request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) RedeploySender(req *http.Request) (future VirtualMachinesRedeployFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RedeployResponder handles the response to the Redeploy request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Reimage reimages the virtual machine which has an ephemeral OS disk back to its initial state. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +// parameters - parameters supplied to the Reimage Virtual Machine operation. +func (client VirtualMachinesClient) Reimage(ctx context.Context, resourceGroupName string, VMName string, parameters *VirtualMachineReimageParameters) (result VirtualMachinesReimageFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Reimage") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimagePreparer(ctx, resourceGroupName, VMName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reimage", nil, "Failure preparing request") + return + } + + result, err = client.ReimageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reimage", result.Response(), "Failure sending request") + return + } + + return +} + +// ReimagePreparer prepares the Reimage request. +func (client VirtualMachinesClient) ReimagePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters *VirtualMachineReimageParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReimageSender sends the Reimage request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ReimageSender(req *http.Request) (future VirtualMachinesReimageFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ReimageResponder handles the response to the Reimage request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restart the operation to restart a virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Restart(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Restart") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client VirtualMachinesClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) RestartSender(req *http.Request) (future VirtualMachinesRestartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RunCommand run command on the VM. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +// parameters - parameters supplied to the Run command operation. +func (client VirtualMachinesClient) RunCommand(ctx context.Context, resourceGroupName string, VMName string, parameters RunCommandInput) (result VirtualMachinesRunCommandFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.RunCommand") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CommandID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachinesClient", "RunCommand", err.Error()) + } + + req, err := client.RunCommandPreparer(ctx, resourceGroupName, VMName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "RunCommand", nil, "Failure preparing request") + return + } + + result, err = client.RunCommandSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "RunCommand", result.Response(), "Failure sending request") + return + } + + return +} + +// RunCommandPreparer prepares the RunCommand request. +func (client VirtualMachinesClient) RunCommandPreparer(ctx context.Context, resourceGroupName string, VMName string, parameters RunCommandInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunCommandSender sends the RunCommand request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) RunCommandSender(req *http.Request) (future VirtualMachinesRunCommandFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RunCommandResponder handles the response to the RunCommand request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) RunCommandResponder(resp *http.Response) (result RunCommandResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start the operation to start a virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Start(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client VirtualMachinesClient) StartPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) StartSender(req *http.Request) (future VirtualMachinesStartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update the operation to update a virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +// parameters - parameters supplied to the Update Virtual Machine operation. +func (client VirtualMachinesClient) Update(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineUpdate) (result VirtualMachinesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachinesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) UpdateSender(req *http.Request) (future VirtualMachinesUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) UpdateResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetextensions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetextensions.go new file mode 100644 index 000000000..ed59389b1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetextensions.go @@ -0,0 +1,400 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineScaleSetExtensionsClient is the compute Client +type VirtualMachineScaleSetExtensionsClient struct { + BaseClient +} + +// NewVirtualMachineScaleSetExtensionsClient creates an instance of the VirtualMachineScaleSetExtensionsClient client. +func NewVirtualMachineScaleSetExtensionsClient(subscriptionID string) VirtualMachineScaleSetExtensionsClient { + return NewVirtualMachineScaleSetExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetExtensionsClientWithBaseURI creates an instance of the +// VirtualMachineScaleSetExtensionsClient client. +func NewVirtualMachineScaleSetExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetExtensionsClient { + return VirtualMachineScaleSetExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the operation to create or update an extension. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set where the extension should be create or updated. +// vmssExtensionName - the name of the VM scale set extension. +// extensionParameters - parameters supplied to the Create VM scale set Extension operation. +func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension) (result VirtualMachineScaleSetExtensionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, extensionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + "vmssExtensionName": autorest.Encode("path", vmssExtensionName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", pathParameters), + autorest.WithJSON(extensionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineScaleSetExtensionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSetExtension, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the operation to delete the extension. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set where the extension should be deleted. +// vmssExtensionName - the name of the VM scale set extension. +func (client VirtualMachineScaleSetExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string) (result VirtualMachineScaleSetExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineScaleSetExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + "vmssExtensionName": autorest.Encode("path", vmssExtensionName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetExtensionsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the operation to get the extension. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set containing the extension. +// vmssExtensionName - the name of the VM scale set extension. +// expand - the expand expression to apply on the operation. +func (client VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (result VirtualMachineScaleSetExtension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineScaleSetExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + "vmssExtensionName": autorest.Encode("path", vmssExtensionName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetExtensionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetExtension, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all extensions in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set containing the extension. +func (client VirtualMachineScaleSetExtensionsClient) List(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.List") + defer func() { + sc := -1 + if result.vmsselr.Response.Response != nil { + sc = result.vmsselr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vmsselr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.vmsselr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineScaleSetExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetExtensionsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetExtensionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetExtensionsClient) listNextResults(ctx context.Context, lastResults VirtualMachineScaleSetExtensionListResult) (result VirtualMachineScaleSetExtensionListResult, err error) { + req, err := lastResults.virtualMachineScaleSetExtensionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineScaleSetExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, VMScaleSetName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetrollingupgrades.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetrollingupgrades.go new file mode 100644 index 000000000..7f5538a13 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetrollingupgrades.go @@ -0,0 +1,351 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineScaleSetRollingUpgradesClient is the compute Client +type VirtualMachineScaleSetRollingUpgradesClient struct { + BaseClient +} + +// NewVirtualMachineScaleSetRollingUpgradesClient creates an instance of the +// VirtualMachineScaleSetRollingUpgradesClient client. +func NewVirtualMachineScaleSetRollingUpgradesClient(subscriptionID string) VirtualMachineScaleSetRollingUpgradesClient { + return NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI creates an instance of the +// VirtualMachineScaleSetRollingUpgradesClient client. +func NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetRollingUpgradesClient { + return VirtualMachineScaleSetRollingUpgradesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel cancels the current virtual machine scale set rolling upgrade. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetRollingUpgradesClient) Cancel(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesCancelFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetRollingUpgradesClient.Cancel") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CancelPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "Cancel", nil, "Failure preparing request") + return + } + + result, err = client.CancelSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "Cancel", result.Response(), "Failure sending request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client VirtualMachineScaleSetRollingUpgradesClient) CancelPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetRollingUpgradesClient) CancelSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesCancelFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetRollingUpgradesClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetLatest gets the status of the latest virtual machine scale set rolling upgrade. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatest(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result RollingUpgradeStatusInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetRollingUpgradesClient.GetLatest") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetLatestPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", nil, "Failure preparing request") + return + } + + resp, err := client.GetLatestSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", resp, "Failure sending request") + return + } + + result, err = client.GetLatestResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", resp, "Failure responding to request") + } + + return +} + +// GetLatestPreparer prepares the GetLatest request. +func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLatestSender sends the GetLatest request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetLatestResponder handles the response to the GetLatest request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestResponder(resp *http.Response) (result RollingUpgradeStatusInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartExtensionUpgrade starts a rolling upgrade to move all extensions for all virtual machine scale set instances to +// the latest available extension version. Instances which are already running the latest extension versions are not +// affected. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgrade(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartExtensionUpgradePreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartExtensionUpgrade", nil, "Failure preparing request") + return + } + + result, err = client.StartExtensionUpgradeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartExtensionUpgrade", result.Response(), "Failure sending request") + return + } + + return +} + +// StartExtensionUpgradePreparer prepares the StartExtensionUpgrade request. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartExtensionUpgradeSender sends the StartExtensionUpgrade request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradeSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartExtensionUpgradeResponder handles the response to the StartExtensionUpgrade request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartOSUpgrade starts a rolling upgrade to move all virtual machine scale set instances to the latest available +// Platform Image OS version. Instances which are already running the latest available OS version are not affected. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgrade(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartOSUpgradePreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartOSUpgrade", nil, "Failure preparing request") + return + } + + result, err = client.StartOSUpgradeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartOSUpgrade", result.Response(), "Failure sending request") + return + } + + return +} + +// StartOSUpgradePreparer prepares the StartOSUpgrade request. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartOSUpgradeSender sends the StartOSUpgrade request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradeSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartOSUpgradeResponder handles the response to the StartOSUpgrade request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesets.go new file mode 100644 index 000000000..878146167 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesets.go @@ -0,0 +1,1905 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineScaleSetsClient is the compute Client +type VirtualMachineScaleSetsClient struct { + BaseClient +} + +// NewVirtualMachineScaleSetsClient creates an instance of the VirtualMachineScaleSetsClient client. +func NewVirtualMachineScaleSetsClient(subscriptionID string) VirtualMachineScaleSetsClient { + return NewVirtualMachineScaleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetsClientWithBaseURI creates an instance of the VirtualMachineScaleSetsClient client. +func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetsClient { + return VirtualMachineScaleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ConvertToSinglePlacementGroup converts SinglePlacementGroup property to false for a existing virtual machine scale +// set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the virtual machine scale set to create or update. +// parameters - the input object for ConvertToSinglePlacementGroup API. +func (client VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroup(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ConvertToSinglePlacementGroupPreparer(ctx, resourceGroupName, VMScaleSetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ConvertToSinglePlacementGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ConvertToSinglePlacementGroupSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ConvertToSinglePlacementGroup", resp, "Failure sending request") + return + } + + result, err = client.ConvertToSinglePlacementGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ConvertToSinglePlacementGroup", resp, "Failure responding to request") + } + + return +} + +// ConvertToSinglePlacementGroupPreparer prepares the ConvertToSinglePlacementGroup request. +func (client VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroupPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup", pathParameters), + autorest.WithJSON(parameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ConvertToSinglePlacementGroupSender sends the ConvertToSinglePlacementGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ConvertToSinglePlacementGroupResponder handles the response to the ConvertToSinglePlacementGroup request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroupResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or update a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set to create or update. +// parameters - the scale set object. +func (client VirtualMachineScaleSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VirtualMachineScaleSet) (result VirtualMachineScaleSetsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxBatchInstancePercent", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxBatchInstancePercent", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxBatchInstancePercent", Name: validation.InclusiveMinimum, Rule: 5, Chain: nil}, + }}, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyInstancePercent", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyInstancePercent", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyInstancePercent", Name: validation.InclusiveMinimum, Rule: 5, Chain: nil}, + }}, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyUpgradedInstancePercent", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyUpgradedInstancePercent", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyUpgradedInstancePercent", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VirtualMachineScaleSet) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineScaleSetsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Deallocate deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the +// compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsDeallocateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.Deallocate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", nil, "Failure preparing request") + return + } + + result, err = client.DeallocateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", result.Response(), "Failure sending request") + return + } + + return +} + +// DeallocatePreparer prepares the Deallocate request. +func (client VirtualMachineScaleSetsClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeallocateSender sends the Deallocate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) DeallocateSender(req *http.Request) (future VirtualMachineScaleSetsDeallocateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeallocateResponder handles the response to the Deallocate request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineScaleSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteInstances deletes virtual machines in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) DeleteInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsDeleteInstancesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.DeleteInstances") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: VMInstanceIDs, + Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "DeleteInstances", err.Error()) + } + + req, err := client.DeleteInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", nil, "Failure preparing request") + return + } + + result, err = client.DeleteInstancesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteInstancesPreparer prepares the DeleteInstances request. +func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", pathParameters), + autorest.WithJSON(VMInstanceIDs), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteInstancesSender sends the DeleteInstances request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) DeleteInstancesSender(req *http.Request) (future VirtualMachineScaleSetsDeleteInstancesFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteInstancesResponder handles the response to the DeleteInstances request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) DeleteInstancesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ForceRecoveryServiceFabricPlatformUpdateDomainWalk manual platform update domain walk to update virtual machines in +// a service fabric virtual machine scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// platformUpdateDomain - the platform update domain for which a manual recovery walk is requested +func (client VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx context.Context, resourceGroupName string, VMScaleSetName string, platformUpdateDomain int32) (result RecoveryWalkResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalkPreparer(ctx, resourceGroupName, VMScaleSetName, platformUpdateDomain) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ForceRecoveryServiceFabricPlatformUpdateDomainWalk", nil, "Failure preparing request") + return + } + + resp, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalkSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ForceRecoveryServiceFabricPlatformUpdateDomainWalk", resp, "Failure sending request") + return + } + + result, err = client.ForceRecoveryServiceFabricPlatformUpdateDomainWalkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ForceRecoveryServiceFabricPlatformUpdateDomainWalk", resp, "Failure responding to request") + } + + return +} + +// ForceRecoveryServiceFabricPlatformUpdateDomainWalkPreparer prepares the ForceRecoveryServiceFabricPlatformUpdateDomainWalk request. +func (client VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalkPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, platformUpdateDomain int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "platformUpdateDomain": autorest.Encode("query", platformUpdateDomain), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ForceRecoveryServiceFabricPlatformUpdateDomainWalkSender sends the ForceRecoveryServiceFabricPlatformUpdateDomainWalk request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalkSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ForceRecoveryServiceFabricPlatformUpdateDomainWalkResponder handles the response to the ForceRecoveryServiceFabricPlatformUpdateDomainWalk request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalkResponder(resp *http.Response) (result RecoveryWalkResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get display information about a virtual machine scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineScaleSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceView gets the status of a VM scale set instance. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetInstanceView, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.GetInstanceView") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceViewSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceViewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure responding to request") + } + + return +} + +// GetInstanceViewPreparer prepares the GetInstanceView request. +func (client VirtualMachineScaleSetsClient) GetInstanceViewPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceViewSender sends the GetInstanceView request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetInstanceView, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOSUpgradeHistory gets list of OS upgrades on a VM scale set instance. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistory(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListOSUpgradeHistoryPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.GetOSUpgradeHistory") + defer func() { + sc := -1 + if result.vmsslouh.Response.Response != nil { + sc = result.vmsslouh.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getOSUpgradeHistoryNextResults + req, err := client.GetOSUpgradeHistoryPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetOSUpgradeHistory", nil, "Failure preparing request") + return + } + + resp, err := client.GetOSUpgradeHistorySender(req) + if err != nil { + result.vmsslouh.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetOSUpgradeHistory", resp, "Failure sending request") + return + } + + result.vmsslouh, err = client.GetOSUpgradeHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetOSUpgradeHistory", resp, "Failure responding to request") + } + + return +} + +// GetOSUpgradeHistoryPreparer prepares the GetOSUpgradeHistory request. +func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistoryPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOSUpgradeHistorySender sends the GetOSUpgradeHistory request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistorySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetOSUpgradeHistoryResponder handles the response to the GetOSUpgradeHistory request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistoryResponder(resp *http.Response) (result VirtualMachineScaleSetListOSUpgradeHistory, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getOSUpgradeHistoryNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetsClient) getOSUpgradeHistoryNextResults(ctx context.Context, lastResults VirtualMachineScaleSetListOSUpgradeHistory) (result VirtualMachineScaleSetListOSUpgradeHistory, err error) { + req, err := lastResults.virtualMachineScaleSetListOSUpgradeHistoryPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "getOSUpgradeHistoryNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetOSUpgradeHistorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "getOSUpgradeHistoryNextResults", resp, "Failure sending next results request") + } + result, err = client.GetOSUpgradeHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "getOSUpgradeHistoryNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetOSUpgradeHistoryComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistoryComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListOSUpgradeHistoryIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.GetOSUpgradeHistory") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetOSUpgradeHistory(ctx, resourceGroupName, VMScaleSetName) + return +} + +// List gets a list of all VM scale sets under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualMachineScaleSetsClient) List(ctx context.Context, resourceGroupName string) (result VirtualMachineScaleSetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.List") + defer func() { + sc := -1 + if result.vmsslr.Response.Response != nil { + sc = result.vmsslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vmsslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure sending request") + return + } + + result.vmsslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineScaleSetsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetsClient) listNextResults(ctx context.Context, lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, err error) { + req, err := lastResults.virtualMachineScaleSetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineScaleSetsClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualMachineScaleSetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use +// nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all +// the VM Scale Sets. +func (client VirtualMachineScaleSetsClient) ListAll(ctx context.Context) (result VirtualMachineScaleSetListWithLinkResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.ListAll") + defer func() { + sc := -1 + if result.vmsslwlr.Response.Response != nil { + sc = result.vmsslwlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.vmsslwlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending request") + return + } + + result.vmsslwlr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client VirtualMachineScaleSetsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ListAllResponder(resp *http.Response) (result VirtualMachineScaleSetListWithLinkResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetsClient) listAllNextResults(ctx context.Context, lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, err error) { + req, err := lastResults.virtualMachineScaleSetListWithLinkResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineScaleSetsClient) ListAllComplete(ctx context.Context) (result VirtualMachineScaleSetListWithLinkResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListSkus gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed +// for each SKU. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) ListSkus(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListSkusResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.ListSkus") + defer func() { + sc := -1 + if result.vmsslsr.Response.Response != nil { + sc = result.vmsslsr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listSkusNextResults + req, err := client.ListSkusPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.vmsslsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending request") + return + } + + result.vmsslsr, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client VirtualMachineScaleSetsClient) ListSkusPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ListSkusResponder(resp *http.Response) (result VirtualMachineScaleSetListSkusResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSkusNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetsClient) listSkusNextResults(ctx context.Context, lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, err error) { + req, err := lastResults.virtualMachineScaleSetListSkusResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineScaleSetsClient) ListSkusComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListSkusResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.ListSkus") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSkus(ctx, resourceGroupName, VMScaleSetName) + return +} + +// PerformMaintenance perform maintenance on one or more virtual machines in a VM scale set. Operation on instances +// which are not eligible for perform maintenance will be failed. Please refer to best practices for more details: +// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) PerformMaintenance(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsPerformMaintenanceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.PerformMaintenance") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PerformMaintenance", nil, "Failure preparing request") + return + } + + result, err = client.PerformMaintenanceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PerformMaintenance", result.Response(), "Failure sending request") + return + } + + return +} + +// PerformMaintenancePreparer prepares the PerformMaintenance request. +func (client VirtualMachineScaleSetsClient) PerformMaintenancePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PerformMaintenanceSender sends the PerformMaintenance request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) PerformMaintenanceSender(req *http.Request) (future VirtualMachineScaleSetsPerformMaintenanceFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// PerformMaintenanceResponder handles the response to the PerformMaintenance request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) PerformMaintenanceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// PowerOff power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and +// you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +// skipShutdown - the parameter to request non-graceful VM shutdown. True value for this flag indicates +// non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not +// specified +func (client VirtualMachineScaleSetsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, skipShutdown *bool) (result VirtualMachineScaleSetsPowerOffFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.PowerOff") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs, skipShutdown) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", nil, "Failure preparing request") + return + } + + result, err = client.PowerOffSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", result.Response(), "Failure sending request") + return + } + + return +} + +// PowerOffPreparer prepares the PowerOff request. +func (client VirtualMachineScaleSetsClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, skipShutdown *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skipShutdown != nil { + queryParameters["skipShutdown"] = autorest.Encode("query", *skipShutdown) + } else { + queryParameters["skipShutdown"] = autorest.Encode("query", false) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PowerOffSender sends the PowerOff request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) PowerOffSender(req *http.Request) (future VirtualMachineScaleSetsPowerOffFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// PowerOffResponder handles the response to the PowerOff request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Redeploy redeploy one or more virtual machines in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Redeploy(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsRedeployFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.Redeploy") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RedeployPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Redeploy", nil, "Failure preparing request") + return + } + + result, err = client.RedeploySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Redeploy", result.Response(), "Failure sending request") + return + } + + return +} + +// RedeployPreparer prepares the Redeploy request. +func (client VirtualMachineScaleSetsClient) RedeployPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RedeploySender sends the Redeploy request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) RedeploySender(req *http.Request) (future VirtualMachineScaleSetsRedeployFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RedeployResponder handles the response to the Redeploy request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Reimage reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a +// ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial state. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMScaleSetReimageInput - parameters for Reimaging VM ScaleSet. +func (client VirtualMachineScaleSetsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMScaleSetReimageInput *VirtualMachineScaleSetReimageParameters) (result VirtualMachineScaleSetsReimageFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.Reimage") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, VMScaleSetReimageInput) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", nil, "Failure preparing request") + return + } + + result, err = client.ReimageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", result.Response(), "Failure sending request") + return + } + + return +} + +// ReimagePreparer prepares the Reimage request. +func (client VirtualMachineScaleSetsClient) ReimagePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMScaleSetReimageInput *VirtualMachineScaleSetReimageParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMScaleSetReimageInput != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMScaleSetReimageInput)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReimageSender sends the Reimage request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ReimageSender(req *http.Request) (future VirtualMachineScaleSetsReimageFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ReimageResponder handles the response to the Reimage request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ReimageAll reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation +// is only supported for managed disks. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsReimageAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.ReimageAll") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", nil, "Failure preparing request") + return + } + + result, err = client.ReimageAllSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", result.Response(), "Failure sending request") + return + } + + return +} + +// ReimageAllPreparer prepares the ReimageAll request. +func (client VirtualMachineScaleSetsClient) ReimageAllPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReimageAllSender sends the ReimageAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ReimageAllSender(req *http.Request) (future VirtualMachineScaleSetsReimageAllFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ReimageAllResponder handles the response to the ReimageAll request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ReimageAllResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restart restarts one or more virtual machines in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.Restart") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client VirtualMachineScaleSetsClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) RestartSender(req *http.Request) (future VirtualMachineScaleSetsRestartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts one or more virtual machines in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client VirtualMachineScaleSetsClient) StartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) StartSender(req *http.Request) (future VirtualMachineScaleSetsStartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update update a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set to create or update. +// parameters - the scale set object. +func (client VirtualMachineScaleSetsClient) Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VirtualMachineScaleSetUpdate) (result VirtualMachineScaleSetsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMScaleSetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachineScaleSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VirtualMachineScaleSetUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) UpdateSender(req *http.Request) (future VirtualMachineScaleSetsUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) UpdateResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateInstances upgrades one or more virtual machines to the latest SKU set in the VM scale set model. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) UpdateInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsUpdateInstancesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetsClient.UpdateInstances") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: VMInstanceIDs, + Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "UpdateInstances", err.Error()) + } + + req, err := client.UpdateInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", nil, "Failure preparing request") + return + } + + result, err = client.UpdateInstancesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateInstancesPreparer prepares the UpdateInstances request. +func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", pathParameters), + autorest.WithJSON(VMInstanceIDs), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateInstancesSender sends the UpdateInstances request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) UpdateInstancesSender(req *http.Request) (future VirtualMachineScaleSetsUpdateInstancesFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateInstancesResponder handles the response to the UpdateInstances request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) UpdateInstancesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetvms.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetvms.go new file mode 100644 index 000000000..e96f0c9b6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetvms.go @@ -0,0 +1,1242 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineScaleSetVMsClient is the compute Client +type VirtualMachineScaleSetVMsClient struct { + BaseClient +} + +// NewVirtualMachineScaleSetVMsClient creates an instance of the VirtualMachineScaleSetVMsClient client. +func NewVirtualMachineScaleSetVMsClient(subscriptionID string) VirtualMachineScaleSetVMsClient { + return NewVirtualMachineScaleSetVMsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetVMsClientWithBaseURI creates an instance of the VirtualMachineScaleSetVMsClient client. +func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetVMsClient { + return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Deallocate deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the +// compute resources it uses. You are not billed for the compute resources of this virtual machine once it is +// deallocated. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeallocateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.Deallocate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", nil, "Failure preparing request") + return + } + + result, err = client.DeallocateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", result.Response(), "Failure sending request") + return + } + + return +} + +// DeallocatePreparer prepares the Deallocate request. +func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeallocateSender sends the Deallocate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) DeallocateSender(req *http.Request) (future VirtualMachineScaleSetVMsDeallocateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeallocateResponder handles the response to the Deallocate request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes a virtual machine from a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineScaleSetVMsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetVMsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a virtual machine from a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineScaleSetVMsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetVM, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceView gets the status of a virtual machine from a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.GetInstanceView") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceViewSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceViewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure responding to request") + } + + return +} + +// GetInstanceViewPreparer prepares the GetInstanceView request. +func (client VirtualMachineScaleSetVMsClient) GetInstanceViewPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceViewSender sends the GetInstanceView request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetVMInstanceView, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all virtual machines in a VM scale sets. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the VM scale set. +// filter - the filter to apply to the operation. +// selectParameter - the list parameters. +// expand - the expand expression to apply to the operation. +func (client VirtualMachineScaleSetVMsClient) List(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.List") + defer func() { + sc := -1 + if result.vmssvlr.Response.Response != nil { + sc = result.vmssvlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vmssvlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending request") + return + } + + result.vmssvlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineScaleSetVMsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetVMListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetVMsClient) listNextResults(ctx context.Context, lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, err error) { + req, err := lastResults.virtualMachineScaleSetVMListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineScaleSetVMsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand) + return +} + +// PerformMaintenance performs maintenance on a virtual machine in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) PerformMaintenance(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsPerformMaintenanceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.PerformMaintenance") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PerformMaintenance", nil, "Failure preparing request") + return + } + + result, err = client.PerformMaintenanceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PerformMaintenance", result.Response(), "Failure sending request") + return + } + + return +} + +// PerformMaintenancePreparer prepares the PerformMaintenance request. +func (client VirtualMachineScaleSetVMsClient) PerformMaintenancePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PerformMaintenanceSender sends the PerformMaintenance request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) PerformMaintenanceSender(req *http.Request) (future VirtualMachineScaleSetVMsPerformMaintenanceFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// PerformMaintenanceResponder handles the response to the PerformMaintenance request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) PerformMaintenanceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// PowerOff power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are +// getting charged for the resources. Instead, use deallocate to release resources and avoid charges. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +// skipShutdown - the parameter to request non-graceful VM shutdown. True value for this flag indicates +// non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not +// specified +func (client VirtualMachineScaleSetVMsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, skipShutdown *bool) (result VirtualMachineScaleSetVMsPowerOffFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.PowerOff") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, skipShutdown) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", nil, "Failure preparing request") + return + } + + result, err = client.PowerOffSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", result.Response(), "Failure sending request") + return + } + + return +} + +// PowerOffPreparer prepares the PowerOff request. +func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, skipShutdown *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skipShutdown != nil { + queryParameters["skipShutdown"] = autorest.Encode("query", *skipShutdown) + } else { + queryParameters["skipShutdown"] = autorest.Encode("query", false) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PowerOffSender sends the PowerOff request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) PowerOffSender(req *http.Request) (future VirtualMachineScaleSetVMsPowerOffFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// PowerOffResponder handles the response to the PowerOff request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Redeploy redeploys a virtual machine in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Redeploy(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsRedeployFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.Redeploy") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RedeployPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Redeploy", nil, "Failure preparing request") + return + } + + result, err = client.RedeploySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Redeploy", result.Response(), "Failure sending request") + return + } + + return +} + +// RedeployPreparer prepares the Redeploy request. +func (client VirtualMachineScaleSetVMsClient) RedeployPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RedeploySender sends the Redeploy request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) RedeploySender(req *http.Request) (future VirtualMachineScaleSetVMsRedeployFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RedeployResponder handles the response to the Redeploy request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Reimage reimages (upgrade the operating system) a specific virtual machine in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +// VMScaleSetVMReimageInput - parameters for the Reimaging Virtual machine in ScaleSet. +func (client VirtualMachineScaleSetVMsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMScaleSetVMReimageInput *VirtualMachineScaleSetVMReimageParameters) (result VirtualMachineScaleSetVMsReimageFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.Reimage") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, VMScaleSetVMReimageInput) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", nil, "Failure preparing request") + return + } + + result, err = client.ReimageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", result.Response(), "Failure sending request") + return + } + + return +} + +// ReimagePreparer prepares the Reimage request. +func (client VirtualMachineScaleSetVMsClient) ReimagePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMScaleSetVMReimageInput *VirtualMachineScaleSetVMReimageParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMScaleSetVMReimageInput != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMScaleSetVMReimageInput)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReimageSender sends the Reimage request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) ReimageSender(req *http.Request) (future VirtualMachineScaleSetVMsReimageFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ReimageResponder handles the response to the Reimage request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ReimageAll allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This +// operation is only supported for managed disks. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsReimageAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.ReimageAll") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", nil, "Failure preparing request") + return + } + + result, err = client.ReimageAllSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", result.Response(), "Failure sending request") + return + } + + return +} + +// ReimageAllPreparer prepares the ReimageAll request. +func (client VirtualMachineScaleSetVMsClient) ReimageAllPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReimageAllSender sends the ReimageAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) ReimageAllSender(req *http.Request) (future VirtualMachineScaleSetVMsReimageAllFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ReimageAllResponder handles the response to the ReimageAll request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) ReimageAllResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restart restarts a virtual machine in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.Restart") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client VirtualMachineScaleSetVMsClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) RestartSender(req *http.Request) (future VirtualMachineScaleSetVMsRestartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RunCommand run command on a virtual machine in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +// parameters - parameters supplied to the Run command operation. +func (client VirtualMachineScaleSetVMsClient) RunCommand(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters RunCommandInput) (result VirtualMachineScaleSetVMsRunCommandFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.RunCommand") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CommandID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineScaleSetVMsClient", "RunCommand", err.Error()) + } + + req, err := client.RunCommandPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "RunCommand", nil, "Failure preparing request") + return + } + + result, err = client.RunCommandSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "RunCommand", result.Response(), "Failure sending request") + return + } + + return +} + +// RunCommandPreparer prepares the RunCommand request. +func (client VirtualMachineScaleSetVMsClient) RunCommandPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters RunCommandInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunCommandSender sends the RunCommand request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) RunCommandSender(req *http.Request) (future VirtualMachineScaleSetVMsRunCommandFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RunCommandResponder handles the response to the RunCommand request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) RunCommandResponder(resp *http.Response) (result RunCommandResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start starts a virtual machine in a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set. +// instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client VirtualMachineScaleSetVMsClient) StartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) StartSender(req *http.Request) (future VirtualMachineScaleSetVMsStartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates a virtual machine of a VM scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMScaleSetName - the name of the VM scale set where the extension should be create or updated. +// instanceID - the instance ID of the virtual machine. +// parameters - parameters supplied to the Update Virtual Machine Scale Sets VM operation. +func (client VirtualMachineScaleSetVMsClient) Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM) (result VirtualMachineScaleSetVMsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetVMProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineScaleSetVMsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachineScaleSetVMsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.InstanceID = nil + parameters.Sku = nil + parameters.Resources = nil + parameters.Zones = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) UpdateSender(req *http.Request) (future VirtualMachineScaleSetVMsUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) UpdateResponder(resp *http.Response) (result VirtualMachineScaleSetVM, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinesizes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinesizes.go new file mode 100644 index 000000000..ae030fa7b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinesizes.go @@ -0,0 +1,124 @@ +package compute + +// Copyright (c) Microsoft and contributors. 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. +// 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 Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineSizesClient is the compute Client +type VirtualMachineSizesClient struct { + BaseClient +} + +// NewVirtualMachineSizesClient creates an instance of the VirtualMachineSizesClient client. +func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient { + return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineSizesClientWithBaseURI creates an instance of the VirtualMachineSizesClient client. +func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient { + return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List this API is deprecated. Use [Resources +// Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) +// Parameters: +// location - the location upon which virtual-machine-sizes is queried. +func (client VirtualMachineSizesClient) List(ctx context.Context, location string) (result VirtualMachineSizeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSizesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineSizesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineSizesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/aws/aws-sdk-go/NOTICE.txt b/vendor/github.com/aws/aws-sdk-go/NOTICE.txt index 5f14d1162..899129ecc 100644 --- a/vendor/github.com/aws/aws-sdk-go/NOTICE.txt +++ b/vendor/github.com/aws/aws-sdk-go/NOTICE.txt @@ -1,3 +1,3 @@ AWS SDK for Go -Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. Copyright 2014-2015 Stripe, Inc. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go index 56fdfc2bf..99849c0e1 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go @@ -138,8 +138,27 @@ type RequestFailure interface { RequestID() string } -// NewRequestFailure returns a new request error wrapper for the given Error -// provided. +// NewRequestFailure returns a wrapped error with additional information for +// request status code, and service requestID. +// +// Should be used to wrap all request which involve service requests. Even if +// the request failed without a service response, but had an HTTP status code +// that may be meaningful. func NewRequestFailure(err Error, statusCode int, reqID string) RequestFailure { return newRequestError(err, statusCode, reqID) } + +// UnmarshalError provides the interface for the SDK failing to unmarshal data. +type UnmarshalError interface { + awsError + Bytes() []byte +} + +// NewUnmarshalError returns an initialized UnmarshalError error wrapper adding +// the bytes that fail to unmarshal to the error. +func NewUnmarshalError(err error, msg string, bytes []byte) UnmarshalError { + return &unmarshalError{ + awsError: New("UnmarshalError", msg, err), + bytes: bytes, + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go index 0202a008f..9cf7eaf40 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go @@ -1,6 +1,9 @@ package awserr -import "fmt" +import ( + "encoding/hex" + "fmt" +) // SprintError returns a string of the formatted error code. // @@ -119,6 +122,7 @@ type requestError struct { awsError statusCode int requestID string + bytes []byte } // newRequestError returns a wrapped error with additional information for @@ -170,6 +174,29 @@ func (r requestError) OrigErrs() []error { return []error{r.OrigErr()} } +type unmarshalError struct { + awsError + bytes []byte +} + +// Error returns the string representation of the error. +// Satisfies the error interface. +func (e unmarshalError) Error() string { + extra := hex.Dump(e.bytes) + return SprintError(e.Code(), e.Message(), extra, e.OrigErr()) +} + +// String returns the string representation of the error. +// Alias for Error to satisfy the stringer interface. +func (e unmarshalError) String() string { + return e.Error() +} + +// Bytes returns the bytes that failed to unmarshal. +func (e unmarshalError) Bytes() []byte { + return e.bytes +} + // An error list that satisfies the golang interface type errorList []error @@ -181,7 +208,7 @@ func (e errorList) Error() string { // How do we want to handle the array size being zero if size := len(e); size > 0 { for i := 0; i < size; i++ { - msg += fmt.Sprintf("%s", e[i].Error()) + msg += e[i].Error() // We check the next index to see if it is within the slice. // If it is, then we append a newline. We do this, because unit tests // could be broken with the additional '\n' diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go index 59fa4a558..142a7a01c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go @@ -15,7 +15,7 @@ func DeepEqual(a, b interface{}) bool { rb := reflect.Indirect(reflect.ValueOf(b)) if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { - // If the elements are both nil, and of the same type the are equal + // If the elements are both nil, and of the same type they are equal // If they are of different types they are not equal return reflect.TypeOf(a) == reflect.TypeOf(b) } else if raValid != rbValid { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go index 11c52c389..285e54d67 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go @@ -185,13 +185,12 @@ func ValuesAtPath(i interface{}, path string) ([]interface{}, error) { // SetValueAtPath sets a value at the case insensitive lexical path inside // of a structure. func SetValueAtPath(i interface{}, path string, v interface{}) { - if rvals := rValuesAtPath(i, path, true, false, v == nil); rvals != nil { - for _, rval := range rvals { - if rval.Kind() == reflect.Ptr && rval.IsNil() { - continue - } - setValue(rval, v) + rvals := rValuesAtPath(i, path, true, false, v == nil) + for _, rval := range rvals { + if rval.Kind() == reflect.Ptr && rval.IsNil() { + continue } + setValue(rval, v) } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go index ce9fb896d..8958c32d4 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go @@ -67,10 +67,14 @@ func logRequest(r *request.Request) { if !bodySeekable { r.SetReaderBody(aws.ReadSeekCloser(r.HTTPRequest.Body)) } - // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's - // Body as a NoOpCloser and will not be reset after read by the HTTP - // client reader. - r.ResetBody() + // Reset the request body because dumpRequest will re-wrap the + // r.HTTPRequest's Body as a NoOpCloser and will not be reset after + // read by the HTTP client reader. + if err := r.Error; err != nil { + r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, + r.ClientInfo.ServiceName, r.Operation.Name, err)) + return + } } r.Config.Logger.Log(fmt.Sprintf(logReqMsg, @@ -118,6 +122,12 @@ var LogHTTPResponseHandler = request.NamedHandler{ func logResponse(r *request.Request) { lw := &logWriter{r.Config.Logger, bytes.NewBuffer(nil)} + if r.HTTPResponse == nil { + lw.Logger.Log(fmt.Sprintf(logRespErrMsg, + r.ClientInfo.ServiceName, r.Operation.Name, "request's HTTPResponse is nil")) + return + } + logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) if logBody { r.HTTPResponse.Body = &teeReaderCloser{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go index 894bbc7f8..4af592158 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go @@ -50,9 +50,10 @@ package credentials import ( "fmt" - "github.com/aws/aws-sdk-go/aws/awserr" "sync" "time" + + "github.com/aws/aws-sdk-go/aws/awserr" ) // AnonymousCredentials is an empty Credential object that can be used as @@ -83,6 +84,12 @@ type Value struct { ProviderName string } +// HasKeys returns if the credentials Value has both AccessKeyID and +// SecretAccessKey value set. +func (v Value) HasKeys() bool { + return len(v.AccessKeyID) != 0 && len(v.SecretAccessKey) != 0 +} + // A Provider is the interface for any component which will provide credentials // Value. A provider is required to manage its own Expired state, and what to // be expired means. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go index 0ed791be6..43d4ed386 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/internal/sdkuri" ) @@ -142,7 +143,8 @@ func requestCredList(client *ec2metadata.EC2Metadata) ([]string, error) { } if err := s.Err(); err != nil { - return nil, awserr.New("SerializationError", "failed to read EC2 instance role from metadata service", err) + return nil, awserr.New(request.ErrCodeSerialization, + "failed to read EC2 instance role from metadata service", err) } return credsList, nil @@ -164,7 +166,7 @@ func requestCred(client *ec2metadata.EC2Metadata, credsName string) (ec2RoleCred respCreds := ec2RoleCredRespBody{} if err := json.NewDecoder(strings.NewReader(resp)).Decode(&respCreds); err != nil { return ec2RoleCredRespBody{}, - awserr.New("SerializationError", + awserr.New(request.ErrCodeSerialization, fmt.Sprintf("failed to decode %s EC2 instance role credentials", credsName), err) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go index ace513138..c2b2c5d65 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go @@ -39,6 +39,7 @@ import ( "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" ) // ProviderName is the name of the credentials provider. @@ -174,7 +175,7 @@ func unmarshalHandler(r *request.Request) { out := r.Data.(*getCredentialsOutput) if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&out); err != nil { - r.Error = awserr.New("SerializationError", + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode endpoint credentials", err, ) @@ -185,11 +186,15 @@ func unmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() var errOut errorOutput - if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&errOut); err != nil { - r.Error = awserr.New("SerializationError", - "failed to decode endpoint credentials", - err, + err := jsonutil.UnmarshalJSONError(&errOut, r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.NewRequestFailure( + awserr.New(request.ErrCodeSerialization, + "failed to decode error message", err), + r.HTTPResponse.StatusCode, + r.RequestID, ) + return } // Response body format is not consistent between metadata endpoints. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go index 4108e433e..2e528d130 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -80,16 +80,18 @@ package stscreds import ( "fmt" + "os" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/internal/sdkrand" "github.com/aws/aws-sdk-go/service/sts" ) -// StdinTokenProvider will prompt on stdout and read from stdin for a string value. +// StdinTokenProvider will prompt on stderr and read from stdin for a string value. // An error is returned if reading from stdin fails. // // Use this function go read MFA tokens from stdin. The function makes no attempt @@ -102,7 +104,7 @@ import ( // Will wait forever until something is provided on the stdin. func StdinTokenProvider() (string, error) { var v string - fmt.Printf("Assume Role MFA token code: ") + fmt.Fprintf(os.Stderr, "Assume Role MFA token code: ") _, err := fmt.Scanln(&v) return v, err @@ -193,6 +195,18 @@ type AssumeRoleProvider struct { // // If ExpiryWindow is 0 or less it will be ignored. ExpiryWindow time.Duration + + // MaxJitterFrac reduces the effective Duration of each credential requested + // by a random percentage between 0 and MaxJitterFraction. MaxJitterFrac must + // have a value between 0 and 1. Any other value may lead to expected behavior. + // With a MaxJitterFrac value of 0, default) will no jitter will be used. + // + // For example, with a Duration of 30m and a MaxJitterFrac of 0.1, the + // AssumeRole call will be made with an arbitrary Duration between 27m and + // 30m. + // + // MaxJitterFrac should not be negative. + MaxJitterFrac float64 } // NewCredentials returns a pointer to a new Credentials object wrapping the @@ -244,7 +258,6 @@ func NewCredentialsWithClient(svc AssumeRoler, roleARN string, options ...func(* // Retrieve generates a new set of temporary credentials using STS. func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { - // Apply defaults where parameters are not set. if p.RoleSessionName == "" { // Try to work out a role name that will hopefully end up unique. @@ -254,8 +267,9 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { // Expire as often as AWS permits. p.Duration = DefaultDuration } + jitter := time.Duration(sdkrand.SeededRand.Float64() * p.MaxJitterFrac * float64(p.Duration)) input := &sts.AssumeRoleInput{ - DurationSeconds: aws.Int64(int64(p.Duration / time.Second)), + DurationSeconds: aws.Int64(int64((p.Duration - jitter) / time.Second)), RoleArn: aws.String(p.RoleARN), RoleSessionName: aws.String(p.RoleSessionName), ExternalId: p.ExternalID, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go new file mode 100644 index 000000000..20510d9ae --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go @@ -0,0 +1,97 @@ +package stscreds + +import ( + "fmt" + "io/ioutil" + "strconv" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/service/sts" + "github.com/aws/aws-sdk-go/service/sts/stsiface" +) + +const ( + // ErrCodeWebIdentity will be used as an error code when constructing + // a new error to be returned during session creation or retrieval. + ErrCodeWebIdentity = "WebIdentityErr" + + // WebIdentityProviderName is the web identity provider name + WebIdentityProviderName = "WebIdentityCredentials" +) + +// now is used to return a time.Time object representing +// the current time. This can be used to easily test and +// compare test values. +var now = time.Now + +// WebIdentityRoleProvider is used to retrieve credentials using +// an OIDC token. +type WebIdentityRoleProvider struct { + credentials.Expiry + + client stsiface.STSAPI + ExpiryWindow time.Duration + + tokenFilePath string + roleARN string + roleSessionName string +} + +// NewWebIdentityCredentials will return a new set of credentials with a given +// configuration, role arn, and token file path. +func NewWebIdentityCredentials(c client.ConfigProvider, roleARN, roleSessionName, path string) *credentials.Credentials { + svc := sts.New(c) + p := NewWebIdentityRoleProvider(svc, roleARN, roleSessionName, path) + return credentials.NewCredentials(p) +} + +// NewWebIdentityRoleProvider will return a new WebIdentityRoleProvider with the +// provided stsiface.STSAPI +func NewWebIdentityRoleProvider(svc stsiface.STSAPI, roleARN, roleSessionName, path string) *WebIdentityRoleProvider { + return &WebIdentityRoleProvider{ + client: svc, + tokenFilePath: path, + roleARN: roleARN, + roleSessionName: roleSessionName, + } +} + +// Retrieve will attempt to assume a role from a token which is located at +// 'WebIdentityTokenFilePath' specified destination and if that is empty an +// error will be returned. +func (p *WebIdentityRoleProvider) Retrieve() (credentials.Value, error) { + b, err := ioutil.ReadFile(p.tokenFilePath) + if err != nil { + errMsg := fmt.Sprintf("unable to read file at %s", p.tokenFilePath) + return credentials.Value{}, awserr.New(ErrCodeWebIdentity, errMsg, err) + } + + sessionName := p.roleSessionName + if len(sessionName) == 0 { + // session name is used to uniquely identify a session. This simply + // uses unix time in nanoseconds to uniquely identify sessions. + sessionName = strconv.FormatInt(now().UnixNano(), 10) + } + resp, err := p.client.AssumeRoleWithWebIdentity(&sts.AssumeRoleWithWebIdentityInput{ + RoleArn: &p.roleARN, + RoleSessionName: &sessionName, + WebIdentityToken: aws.String(string(b)), + }) + if err != nil { + return credentials.Value{}, awserr.New(ErrCodeWebIdentity, "failed to retrieve credentials", err) + } + + p.SetExpiration(aws.TimeValue(resp.Credentials.Expiration), p.ExpiryWindow) + + value := credentials.Value{ + AccessKeyID: aws.StringValue(resp.Credentials.AccessKeyId), + SecretAccessKey: aws.StringValue(resp.Credentials.SecretAccessKey), + SessionToken: aws.StringValue(resp.Credentials.SessionToken), + ProviderName: WebIdentityProviderName, + } + return value, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go index 152d785b3..25a66d1dd 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go @@ -1,30 +1,61 @@ -// Package csm provides Client Side Monitoring (CSM) which enables sending metrics -// via UDP connection. Using the Start function will enable the reporting of -// metrics on a given port. If Start is called, with different parameters, again, -// a panic will occur. +// Package csm provides the Client Side Monitoring (CSM) client which enables +// sending metrics via UDP connection to the CSM agent. This package provides +// control options, and configuration for the CSM client. The client can be +// controlled manually, or automatically via the SDK's Session configuration. // -// Pause can be called to pause any metrics publishing on a given port. Sessions -// that have had their handlers modified via InjectHandlers may still be used. -// However, the handlers will act as a no-op meaning no metrics will be published. +// Enabling CSM client via SDK's Session configuration +// +// The CSM client can be enabled automatically via SDK's Session configuration. +// The SDK's session configuration enables the CSM client if the AWS_CSM_PORT +// environment variable is set to a non-empty value. +// +// The configuration options for the CSM client via the SDK's session +// configuration are: +// +// * AWS_CSM_PORT= +// The port number the CSM agent will receive metrics on. +// +// * AWS_CSM_HOST= +// The hostname, or IP address the CSM agent will receive metrics on. +// Without port number. +// +// Manually enabling the CSM client +// +// The CSM client can be started, paused, and resumed manually. The Start +// function will enable the CSM client to publish metrics to the CSM agent. It +// is safe to call Start concurrently, but if Start is called additional times +// with different ClientID or address it will panic. // -// Example: // r, err := csm.Start("clientID", ":31000") // if err != nil { // panic(fmt.Errorf("failed starting CSM: %v", err)) // } // +// When controlling the CSM client manually, you must also inject its request +// handlers into the SDK's Session configuration for the SDK's API clients to +// publish metrics. +// // sess, err := session.NewSession(&aws.Config{}) // if err != nil { // panic(fmt.Errorf("failed loading session: %v", err)) // } // +// // Add CSM client's metric publishing request handlers to the SDK's +// // Session Configuration. // r.InjectHandlers(&sess.Handlers) // -// client := s3.New(sess) -// resp, err := client.GetObject(&s3.GetObjectInput{ -// Bucket: aws.String("bucket"), -// Key: aws.String("key"), -// }) +// Controlling CSM client +// +// Once the CSM client has been enabled the Get function will return a Reporter +// value that you can use to pause and resume the metrics published to the CSM +// agent. If Get function is called before the reporter is enabled with the +// Start function or via SDK's Session configuration nil will be returned. +// +// The Pause method can be called to stop the CSM client publishing metrics to +// the CSM agent. The Continue method will resume metric publishing. +// +// // Get the CSM client Reporter. +// r := csm.Get() // // // Will pause monitoring // r.Pause() @@ -35,12 +66,4 @@ // // // Resume monitoring // r.Continue() -// -// Start returns a Reporter that is used to enable or disable monitoring. If -// access to the Reporter is required later, calling Get will return the Reporter -// singleton. -// -// Example: -// r := csm.Get() -// r.Continue() package csm diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go index 2f0c6eac9..4b19e2800 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go @@ -2,6 +2,7 @@ package csm import ( "fmt" + "strings" "sync" ) @@ -9,19 +10,40 @@ var ( lock sync.Mutex ) -// Client side metric handler names const ( - APICallMetricHandlerName = "awscsm.SendAPICallMetric" - APICallAttemptMetricHandlerName = "awscsm.SendAPICallAttemptMetric" + // DefaultPort is used when no port is specified. + DefaultPort = "31000" + + // DefaultHost is the host that will be used when none is specified. + DefaultHost = "127.0.0.1" ) -// Start will start the a long running go routine to capture +// AddressWithDefaults returns a CSM address built from the host and port +// values. If the host or port is not set, default values will be used +// instead. If host is "localhost" it will be replaced with "127.0.0.1". +func AddressWithDefaults(host, port string) string { + if len(host) == 0 || strings.EqualFold(host, "localhost") { + host = DefaultHost + } + + if len(port) == 0 { + port = DefaultPort + } + + // Only IP6 host can contain a colon + if strings.Contains(host, ":") { + return "[" + host + "]:" + port + } + + return host + ":" + port +} + +// Start will start a long running go routine to capture // client side metrics. Calling start multiple time will only // start the metric listener once and will panic if a different // client ID or port is passed in. // -// Example: -// r, err := csm.Start("clientID", "127.0.0.1:8094") +// r, err := csm.Start("clientID", "127.0.0.1:31000") // if err != nil { // panic(fmt.Errorf("expected no error, but received %v", err)) // } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go index 0b5571acf..c7008d8c3 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go @@ -10,11 +10,6 @@ import ( "github.com/aws/aws-sdk-go/aws/request" ) -const ( - // DefaultPort is used when no port is specified - DefaultPort = "31000" -) - // Reporter will gather metrics of API requests made and // send those metrics to the CSM endpoint. type Reporter struct { @@ -96,7 +91,7 @@ func getMetricException(err awserr.Error) metricException { switch code { case "RequestError", - "SerializationError", + request.ErrCodeSerialization, request.CanceledErrorCode: return sdkException{ requestException{exception: code, message: msg}, @@ -123,7 +118,7 @@ func (rep *Reporter) sendAPICallMetric(r *request.Request) { Type: aws.String("ApiCall"), AttemptCount: aws.Int(r.RetryCount + 1), Region: r.Config.Region, - Latency: aws.Int(int(time.Now().Sub(r.Time) / time.Millisecond)), + Latency: aws.Int(int(time.Since(r.Time) / time.Millisecond)), XAmzRequestID: aws.String(r.RequestID), MaxRetriesExceeded: aws.Int(boolIntValue(r.RetryCount >= r.MaxRetries())), } @@ -190,8 +185,9 @@ func (rep *Reporter) start() { } } -// Pause will pause the metric channel preventing any new metrics from -// being added. +// Pause will pause the metric channel preventing any new metrics from being +// added. It is safe to call concurrently with other calls to Pause, but if +// called concurently with Continue can lead to unexpected state. func (rep *Reporter) Pause() { lock.Lock() defer lock.Unlock() @@ -203,8 +199,9 @@ func (rep *Reporter) Pause() { rep.close() } -// Continue will reopen the metric channel and allow for monitoring -// to be resumed. +// Continue will reopen the metric channel and allow for monitoring to be +// resumed. It is safe to call concurrently with other calls to Continue, but +// if called concurently with Pause can lead to unexpected state. func (rep *Reporter) Continue() { lock.Lock() defer lock.Unlock() @@ -219,10 +216,18 @@ func (rep *Reporter) Continue() { rep.metricsCh.Continue() } +// Client side metric handler names +const ( + APICallMetricHandlerName = "awscsm.SendAPICallMetric" + APICallAttemptMetricHandlerName = "awscsm.SendAPICallAttemptMetric" +) + // InjectHandlers will will enable client side metrics and inject the proper // handlers to handle how metrics are sent. // -// Example: +// InjectHandlers is NOT safe to call concurrently. Calling InjectHandlers +// multiple times may lead to unexpected behavior, (e.g. duplicate metrics). +// // // Start must be called in order to inject the correct handlers // r, err := csm.Start("clientID", "127.0.0.1:8094") // if err != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go index 88e2fc707..2c8d5f56d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go @@ -24,8 +24,9 @@ func (c *EC2Metadata) GetMetadata(p string) (string, error) { output := &metadataOutput{} req := c.NewRequest(op, nil, output) + err := req.Send() - return output.Content, req.Send() + return output.Content, err } // GetUserData returns the userdata that was configured for the service. If @@ -45,8 +46,9 @@ func (c *EC2Metadata) GetUserData() (string, error) { r.Error = awserr.New("NotFoundError", "user-data not found", r.Error) } }) + err := req.Send() - return output.Content, req.Send() + return output.Content, err } // GetDynamicData uses the path provided to request information from the EC2 @@ -61,8 +63,9 @@ func (c *EC2Metadata) GetDynamicData(p string) (string, error) { output := &metadataOutput{} req := c.NewRequest(op, nil, output) + err := req.Send() - return output.Content, req.Send() + return output.Content, err } // GetInstanceIdentityDocument retrieves an identity document describing an @@ -79,7 +82,7 @@ func (c *EC2Metadata) GetInstanceIdentityDocument() (EC2InstanceIdentityDocument doc := EC2InstanceIdentityDocument{} if err := json.NewDecoder(strings.NewReader(resp)).Decode(&doc); err != nil { return EC2InstanceIdentityDocument{}, - awserr.New("SerializationError", + awserr.New(request.ErrCodeSerialization, "failed to decode EC2 instance identity document", err) } @@ -98,7 +101,7 @@ func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error) { info := EC2IAMInfo{} if err := json.NewDecoder(strings.NewReader(resp)).Decode(&info); err != nil { return EC2IAMInfo{}, - awserr.New("SerializationError", + awserr.New(request.ErrCodeSerialization, "failed to decode EC2 IAM info", err) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go index 7d1f66e4e..4c5636e35 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go @@ -92,6 +92,9 @@ func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio svc.Handlers.Send.SwapNamed(request.NamedHandler{ Name: corehandlers.SendHandler.Name, Fn: func(r *request.Request) { + r.HTTPResponse = &http.Response{ + Header: http.Header{}, + } r.Error = awserr.New( request.CanceledErrorCode, "EC2 IMDS access disabled via "+disableServiceEnvVar+" env var", @@ -120,7 +123,7 @@ func unmarshalHandler(r *request.Request) { defer r.HTTPResponse.Body.Close() b := &bytes.Buffer{} if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { - r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata respose", err) + r.Error = awserr.New(request.ErrCodeSerialization, "unable to unmarshal EC2 metadata response", err) return } @@ -133,7 +136,7 @@ func unmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() b := &bytes.Buffer{} if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { - r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata error respose", err) + r.Error = awserr.New(request.ErrCodeSerialization, "unable to unmarshal EC2 metadata error response", err) return } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index c6355cafb..d970a09fc 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -15,6 +15,7 @@ const ( // AWS Standard partition's regions. const ( + ApEast1RegionID = "ap-east-1" // Asia Pacific (Hong Kong). ApNortheast1RegionID = "ap-northeast-1" // Asia Pacific (Tokyo). ApNortheast2RegionID = "ap-northeast-2" // Asia Pacific (Seoul). ApSouth1RegionID = "ap-south-1" // Asia Pacific (Mumbai). @@ -26,6 +27,7 @@ const ( EuWest1RegionID = "eu-west-1" // EU (Ireland). EuWest2RegionID = "eu-west-2" // EU (London). EuWest3RegionID = "eu-west-3" // EU (Paris). + MeSouth1RegionID = "me-south-1" // Middle East (Bahrain). SaEast1RegionID = "sa-east-1" // South America (Sao Paulo). UsEast1RegionID = "us-east-1" // US East (N. Virginia). UsEast2RegionID = "us-east-2" // US East (Ohio). @@ -81,7 +83,7 @@ var awsPartition = partition{ DNSSuffix: "amazonaws.com", RegionRegex: regionRegex{ Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$") + reg, _ := regexp.Compile("^(us|eu|ap|sa|ca|me)\\-\\w+\\-\\d+$") return reg }(), }, @@ -91,6 +93,9 @@ var awsPartition = partition{ SignatureVersions: []string{"v4"}, }, Regions: regions{ + "ap-east-1": region{ + Description: "Asia Pacific (Hong Kong)", + }, "ap-northeast-1": region{ Description: "Asia Pacific (Tokyo)", }, @@ -124,6 +129,9 @@ var awsPartition = partition{ "eu-west-3": region{ Description: "EU (Paris)", }, + "me-south-1": region{ + Description: "Middle East (Bahrain)", + }, "sa-east-1": region{ Description: "South America (Sao Paulo)", }, @@ -150,6 +158,7 @@ var awsPartition = partition{ "acm": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -161,6 +170,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -173,18 +183,137 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, + "api.ecr": service{ + + Endpoints: endpoints{ + "ap-east-1": endpoint{ + Hostname: "api.ecr.ap-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-east-1", + }, + }, + "ap-northeast-1": endpoint{ + Hostname: "api.ecr.ap-northeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-1", + }, + }, + "ap-northeast-2": endpoint{ + Hostname: "api.ecr.ap-northeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-2", + }, + }, + "ap-south-1": endpoint{ + Hostname: "api.ecr.ap-south-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-south-1", + }, + }, + "ap-southeast-1": endpoint{ + Hostname: "api.ecr.ap-southeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-1", + }, + }, + "ap-southeast-2": endpoint{ + Hostname: "api.ecr.ap-southeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-2", + }, + }, + "ca-central-1": endpoint{ + Hostname: "api.ecr.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "eu-central-1": endpoint{ + Hostname: "api.ecr.eu-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-central-1", + }, + }, + "eu-north-1": endpoint{ + Hostname: "api.ecr.eu-north-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-north-1", + }, + }, + "eu-west-1": endpoint{ + Hostname: "api.ecr.eu-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-1", + }, + }, + "eu-west-2": endpoint{ + Hostname: "api.ecr.eu-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-2", + }, + }, + "eu-west-3": endpoint{ + Hostname: "api.ecr.eu-west-3.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-3", + }, + }, + "me-south-1": endpoint{ + Hostname: "api.ecr.me-south-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "me-south-1", + }, + }, + "sa-east-1": endpoint{ + Hostname: "api.ecr.sa-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "sa-east-1", + }, + }, + "us-east-1": endpoint{ + Hostname: "api.ecr.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{ + Hostname: "api.ecr.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{ + Hostname: "api.ecr.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{ + Hostname: "api.ecr.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, "api.mediatailor": service{ Endpoints: endpoints{ @@ -220,14 +349,39 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "api-fips.sagemaker.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "api-fips.sagemaker.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "api-fips.sagemaker.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "api-fips.sagemaker.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "apigateway": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -239,6 +393,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -255,6 +410,7 @@ var awsPartition = partition{ }, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -266,6 +422,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -273,6 +430,24 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "appmesh": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "appstream2": service{ Defaults: endpoint{ Protocols: []string{"https"}, @@ -282,6 +457,7 @@ var awsPartition = partition{ }, Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, @@ -300,6 +476,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -313,7 +490,9 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "us-east-1": endpoint{}, @@ -326,6 +505,7 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -337,6 +517,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -368,9 +549,27 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "backup": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "batch": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -378,6 +577,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -434,7 +634,9 @@ var awsPartition = partition{ "cloud9": service{ Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, "ap-southeast-1": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -458,6 +660,7 @@ var awsPartition = partition{ "cloudformation": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -469,6 +672,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -512,6 +716,7 @@ var awsPartition = partition{ }, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -523,6 +728,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -547,6 +753,7 @@ var awsPartition = partition{ "cloudtrail": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -558,6 +765,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -568,6 +776,7 @@ var awsPartition = partition{ "codebuild": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -575,9 +784,11 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-1-fips": endpoint{ @@ -619,6 +830,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -638,6 +850,7 @@ var awsPartition = partition{ "codedeploy": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -649,6 +862,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-1-fips": endpoint{ @@ -772,9 +986,24 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "comprehendmedical": service{ + + Endpoints: endpoints{ + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -783,6 +1012,7 @@ var awsPartition = partition{ "config": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -794,6 +1024,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -807,6 +1038,19 @@ var awsPartition = partition{ "us-east-1": endpoint{}, }, }, + "data.mediastore": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "datapipeline": service{ Endpoints: endpoints{ @@ -826,10 +1070,34 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "fips-us-east-1": endpoint{ + Hostname: "datasync-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "fips-us-east-2": endpoint{ + Hostname: "datasync-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "fips-us-west-1": endpoint{ + Hostname: "datasync-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "fips-us-west-2": endpoint{ + Hostname: "datasync-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "dax": service{ @@ -839,6 +1107,7 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, @@ -867,6 +1136,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -883,6 +1153,7 @@ var awsPartition = partition{ "dms": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -890,9 +1161,11 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -903,12 +1176,42 @@ var awsPartition = partition{ "docdb": service{ Endpoints: endpoints{ + "ap-northeast-1": endpoint{ + Hostname: "rds.ap-northeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-1", + }, + }, + "ap-northeast-2": endpoint{ + Hostname: "rds.ap-northeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-2", + }, + }, + "ap-southeast-2": endpoint{ + Hostname: "rds.ap-southeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-2", + }, + }, + "eu-central-1": endpoint{ + Hostname: "rds.eu-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-central-1", + }, + }, "eu-west-1": endpoint{ Hostname: "rds.eu-west-1.amazonaws.com", CredentialScope: credentialScope{ Region: "eu-west-1", }, }, + "eu-west-2": endpoint{ + Hostname: "rds.eu-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-2", + }, + }, "us-east-1": endpoint{ Hostname: "rds.us-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -939,6 +1242,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, @@ -953,17 +1257,24 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, + "ca-central-1-fips": endpoint{ + Hostname: "dynamodb-fips.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "local": endpoint{ Hostname: "localhost:8000", Protocols: []string{"http"}, @@ -971,11 +1282,36 @@ var awsPartition = partition{ Region: "us-east-1", }, }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "dynamodb-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "dynamodb-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "dynamodb-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "dynamodb-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "ec2": service{ @@ -983,6 +1319,7 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -994,6 +1331,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1012,30 +1350,10 @@ var awsPartition = partition{ }, }, }, - "ecr": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, "ecs": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1047,6 +1365,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1057,6 +1376,7 @@ var awsPartition = partition{ "elasticache": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1074,16 +1394,18 @@ var awsPartition = partition{ Region: "us-west-1", }, }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "elasticbeanstalk": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1095,6 +1417,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1107,10 +1430,14 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1122,6 +1449,7 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1133,6 +1461,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1146,6 +1475,7 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1159,6 +1489,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{ SSLCommonName: "{service}.{region}.{dnsSuffix}", @@ -1184,9 +1515,12 @@ var awsPartition = partition{ "email": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "entitlement.marketplace": service{ @@ -1202,6 +1536,7 @@ var awsPartition = partition{ "es": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1213,16 +1548,23 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "fips": endpoint{ + Hostname: "es-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "events": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1234,6 +1576,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1251,6 +1594,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1267,21 +1611,31 @@ var awsPartition = partition{ }, Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, "fsx": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "gamelift": service{ @@ -1308,6 +1662,30 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "glue": service{ + + Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1326,25 +1704,6 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "glue": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, "greengrass": service{ IsRegionalized: boxedTrue, Defaults: endpoint{ @@ -1352,19 +1711,32 @@ var awsPartition = partition{ }, Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, "us-west-2": endpoint{}, }, }, + "groundstation": service{ + + Endpoints: endpoints{ + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "guardduty": service{ IsRegionalized: boxedTrue, Defaults: endpoint{ Protocols: []string{"https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1372,6 +1744,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1424,7 +1797,9 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1443,11 +1818,16 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -1462,9 +1842,101 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "iotevents": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "ioteventsdata": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{ + Hostname: "data.iotevents.ap-northeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-1", + }, + }, + "ap-southeast-2": endpoint{ + Hostname: "data.iotevents.ap-southeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-2", + }, + }, + "eu-central-1": endpoint{ + Hostname: "data.iotevents.eu-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-central-1", + }, + }, + "eu-west-1": endpoint{ + Hostname: "data.iotevents.eu-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-1", + }, + }, + "us-east-1": endpoint{ + Hostname: "data.iotevents.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{ + Hostname: "data.iotevents.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-2": endpoint{ + Hostname: "data.iotevents.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, + "iotthingsgraph": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "iotthingsgraph", + }, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "kafka": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "kinesis": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1476,6 +1948,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1486,17 +1959,23 @@ var awsPartition = partition{ "kinesisanalytics": service{ Endpoints: endpoints{ - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "kinesisvideo": service{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, @@ -1506,6 +1985,7 @@ var awsPartition = partition{ "kms": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1517,6 +1997,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1527,6 +2008,30 @@ var awsPartition = partition{ "lambda": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "license-manager": service{ + + Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1566,6 +2071,7 @@ var awsPartition = partition{ "logs": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1577,6 +2083,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1597,6 +2104,25 @@ var awsPartition = partition{ "us-east-1": endpoint{}, }, }, + "mediaconnect": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "mediaconvert": service{ Endpoints: endpoints{ @@ -1609,6 +2135,7 @@ var awsPartition = partition{ "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1625,6 +2152,7 @@ var awsPartition = partition{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, @@ -1655,6 +2183,7 @@ var awsPartition = partition{ "ap-northeast-2": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, "us-west-2": endpoint{}, @@ -1667,6 +2196,7 @@ var awsPartition = partition{ }, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1678,6 +2208,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1714,6 +2245,7 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1725,6 +2257,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1737,10 +2270,14 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1760,6 +2297,24 @@ var awsPartition = partition{ "neptune": service{ Endpoints: endpoints{ + "ap-northeast-1": endpoint{ + Hostname: "rds.ap-northeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-1", + }, + }, + "ap-northeast-2": endpoint{ + Hostname: "rds.ap-northeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-2", + }, + }, + "ap-south-1": endpoint{ + Hostname: "rds.ap-south-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-south-1", + }, + }, "ap-southeast-1": endpoint{ Hostname: "rds.ap-southeast-1.amazonaws.com", CredentialScope: credentialScope{ @@ -1778,6 +2333,12 @@ var awsPartition = partition{ Region: "eu-central-1", }, }, + "eu-north-1": endpoint{ + Hostname: "rds.eu-north-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-north-1", + }, + }, "eu-west-1": endpoint{ Hostname: "rds.eu-west-1.amazonaws.com", CredentialScope: credentialScope{ @@ -1864,10 +2425,12 @@ var awsPartition = partition{ }, }, Endpoints: endpoints{ - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "polly": service{ @@ -1880,6 +2443,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1890,7 +2454,19 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "rds": service{ + "projects.iot1click": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "ram": service{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, @@ -1904,6 +2480,28 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "rds": service{ + + Endpoints: endpoints{ + "ap-east-1": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{ SSLCommonName: "{service}.{dnsSuffix}", @@ -1916,6 +2514,7 @@ var awsPartition = partition{ "redshift": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1927,6 +2526,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1938,16 +2538,23 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, "resource-groups": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1959,6 +2566,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1969,9 +2577,13 @@ var awsPartition = partition{ "robomaker": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "route53": service{ @@ -1999,11 +2611,18 @@ var awsPartition = partition{ }, Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -2032,9 +2651,33 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "runtime-fips.sagemaker.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "runtime-fips.sagemaker.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "runtime-fips.sagemaker.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "runtime-fips.sagemaker.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "s3": service{ @@ -2048,6 +2691,7 @@ var awsPartition = partition{ DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{ Hostname: "s3.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, @@ -2069,8 +2713,9 @@ var awsPartition = partition{ Hostname: "s3.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "s3-external-1": endpoint{ Hostname: "s3-external-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, @@ -2276,6 +2921,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2313,6 +2959,7 @@ var awsPartition = partition{ "securityhub": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2320,6 +2967,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2356,12 +3004,18 @@ var awsPartition = partition{ "eu-central-1": endpoint{ Protocols: []string{"https"}, }, + "eu-north-1": endpoint{ + Protocols: []string{"https"}, + }, "eu-west-1": endpoint{ Protocols: []string{"https"}, }, "eu-west-2": endpoint{ Protocols: []string{"https"}, }, + "eu-west-3": endpoint{ + Protocols: []string{"https"}, + }, "sa-east-1": endpoint{ Protocols: []string{"https"}, }, @@ -2389,6 +3043,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2456,6 +3111,7 @@ var awsPartition = partition{ "sms": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2463,6 +3119,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2477,6 +3134,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2497,6 +3155,7 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2508,6 +3167,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2521,6 +3181,7 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2556,7 +3217,8 @@ var awsPartition = partition{ Region: "us-west-2", }, }, - "sa-east-1": endpoint{}, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{ SSLCommonName: "queue.{dnsSuffix}", }, @@ -2568,6 +3230,7 @@ var awsPartition = partition{ "ssm": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2579,6 +3242,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2589,6 +3253,7 @@ var awsPartition = partition{ "states": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2600,6 +3265,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2621,6 +3287,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2642,11 +3309,17 @@ var awsPartition = partition{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, + "ca-central-1-fips": endpoint{ + Hostname: "dynamodb-fips.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "local": endpoint{ Hostname: "localhost:8000", Protocols: []string{"http"}, @@ -2654,11 +3327,36 @@ var awsPartition = partition{ Region: "us-east-1", }, }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "dynamodb-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "dynamodb-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "dynamodb-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "dynamodb-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "sts": service{ @@ -2670,6 +3368,12 @@ var awsPartition = partition{ }, }, Endpoints: endpoints{ + "ap-east-1": endpoint{ + Hostname: "sts.ap-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-east-1", + }, + }, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{ Hostname: "sts.ap-northeast-2.amazonaws.com", @@ -2687,8 +3391,14 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, + "me-south-1": endpoint{ + Hostname: "sts.me-south-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "me-south-1", + }, + }, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, "us-east-1-fips": endpoint{ Hostname: "sts-fips.us-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -2719,14 +3429,21 @@ var awsPartition = partition{ }, }, "support": service{ + PartitionEndpoint: "aws-global", Endpoints: endpoints{ - "us-east-1": endpoint{}, + "aws-global": endpoint{ + Hostname: "support.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, }, }, "swf": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2738,6 +3455,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2748,6 +3466,7 @@ var awsPartition = partition{ "tagging": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2759,6 +3478,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2771,6 +3491,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, @@ -2789,8 +3510,14 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, "us-east-1-fips": endpoint{ Hostname: "translate-fips.us-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -2830,9 +3557,17 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -2879,6 +3614,7 @@ var awsPartition = partition{ "xray": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2890,6 +3626,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2929,6 +3666,23 @@ var awscnPartition = partition{ }, }, Services: services{ + "api.ecr": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{ + Hostname: "api.ecr.cn-north-1.amazonaws.com.cn", + CredentialScope: credentialScope{ + Region: "cn-north-1", + }, + }, + "cn-northwest-1": endpoint{ + Hostname: "api.ecr.cn-northwest-1.amazonaws.com.cn", + CredentialScope: credentialScope{ + Region: "cn-northwest-1", + }, + }, + }, + }, "apigateway": service{ Endpoints: endpoints{ @@ -2965,6 +3719,20 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "cloudfront": service{ + PartitionEndpoint: "aws-cn-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-cn-global": endpoint{ + Hostname: "cloudfront.cn-northwest-1.amazonaws.com.cn", + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Region: "cn-northwest-1", + }, + }, + }, + }, "cloudtrail": service{ Endpoints: endpoints{ @@ -3049,13 +3817,6 @@ var awscnPartition = partition{ }, }, }, - "ecr": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, "ecs": service{ Endpoints: endpoints{ @@ -3116,6 +3877,12 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "gamelift": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "glacier": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -3125,6 +3892,15 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "greengrass": service{ + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "iam": service{ PartitionEndpoint: "aws-cn-global", IsRegionalized: boxedFalse, @@ -3155,6 +3931,13 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "kms": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, "lambda": service{ Endpoints: endpoints{ @@ -3162,6 +3945,13 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "license-manager": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, "logs": service{ Endpoints: endpoints{ @@ -3169,6 +3959,17 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "mediaconvert": service{ + + Endpoints: endpoints{ + "cn-northwest-1": endpoint{ + Hostname: "subscribe.mediaconvert.cn-northwest-1.amazonaws.com.cn", + CredentialScope: credentialScope{ + Region: "cn-northwest-1", + }, + }, + }, + }, "monitoring": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -3301,6 +4102,18 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "support": service{ + PartitionEndpoint: "aws-cn-global", + + Endpoints: endpoints{ + "aws-cn-global": endpoint{ + Hostname: "support.cn-north-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "cn-north-1", + }, + }, + }, + }, "swf": service{ Endpoints: endpoints{ @@ -3354,6 +4167,32 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "acm-pca": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "api.ecr": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{ + Hostname: "api.ecr.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, + "us-gov-west-1": endpoint{ + Hostname: "api.ecr.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, "api.sagemaker": service{ Endpoints: endpoints{ @@ -3379,6 +4218,13 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "athena": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, "autoscaling": service{ Endpoints: endpoints{ @@ -3425,6 +4271,20 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "codebuild": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "codecommit": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, "codedeploy": service{ Endpoints: endpoints{ @@ -3444,6 +4304,14 @@ var awsusgovPartition = partition{ }, }, }, + "comprehend": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "config": service{ Endpoints: endpoints{ @@ -3451,6 +4319,18 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "datasync": service{ + + Endpoints: endpoints{ + "fips-us-gov-west-1": endpoint{ + Hostname: "datasync-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-west-1": endpoint{}, + }, + }, "directconnect": service{ Endpoints: endpoints{ @@ -3468,6 +4348,7 @@ var awsusgovPartition = partition{ "ds": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -3475,6 +4356,12 @@ var awsusgovPartition = partition{ Endpoints: endpoints{ "us-gov-east-1": endpoint{}, + "us-gov-east-1-fips": endpoint{ + Hostname: "dynamodb.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, "us-gov-west-1": endpoint{}, "us-gov-west-1-fips": endpoint{ Hostname: "dynamodb.us-gov-west-1.amazonaws.com", @@ -3502,13 +4389,6 @@ var awsusgovPartition = partition{ }, }, }, - "ecr": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, "ecs": service{ Endpoints: endpoints{ @@ -3563,6 +4443,12 @@ var awsusgovPartition = partition{ "es": service{ Endpoints: endpoints{ + "fips": endpoint{ + Hostname: "es-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, @@ -3577,6 +4463,7 @@ var awsusgovPartition = partition{ "firehose": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -3589,6 +4476,22 @@ var awsusgovPartition = partition{ }, }, }, + "glue": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "greengrass": service{ + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "guardduty": service{ IsRegionalized: boxedTrue, Defaults: endpoint{ @@ -3638,6 +4541,12 @@ var awsusgovPartition = partition{ "kms": service{ Endpoints: endpoints{ + "ProdFips": endpoint{ + Hostname: "kms-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, @@ -3649,6 +4558,13 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "license-manager": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, "logs": service{ Endpoints: endpoints{ @@ -3669,6 +4585,7 @@ var awsusgovPartition = partition{ }, }, Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -3679,12 +4596,31 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "organizations": service{ + PartitionEndpoint: "aws-us-gov-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-us-gov-global": endpoint{ + Hostname: "organizations.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, "polly": service{ Endpoints: endpoints{ "us-gov-west-1": endpoint{}, }, }, + "ram": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "rds": service{ Endpoints: endpoints{ @@ -3768,6 +4704,31 @@ var awsusgovPartition = partition{ }, }, }, + "secretsmanager": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + "us-gov-west-1-fips": endpoint{ + Hostname: "secretsmanager-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + "serverlessrepo": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-gov-east-1": endpoint{ + Protocols: []string{"https"}, + }, + "us-gov-west-1": endpoint{ + Protocols: []string{"https"}, + }, + }, + }, "sms": service{ Endpoints: endpoints{ @@ -3829,6 +4790,12 @@ var awsusgovPartition = partition{ }, Endpoints: endpoints{ "us-gov-east-1": endpoint{}, + "us-gov-east-1-fips": endpoint{ + Hostname: "dynamodb.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, "us-gov-west-1": endpoint{}, "us-gov-west-1-fips": endpoint{ Hostname: "dynamodb.us-gov-west-1.amazonaws.com", @@ -3873,5 +4840,17 @@ var awsusgovPartition = partition{ }, }, }, + "waf-regional": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "workspaces": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, }, } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go index 000dd79ee..ca8fc828e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go @@ -2,7 +2,7 @@ package endpoints // Service identifiers // -// Deprecated: Use client package's EndpointID value instead of these +// Deprecated: Use client package's EndpointsID value instead of these // ServiceIDs. These IDs are not maintained, and are out of date. const ( A4bServiceID = "a4b" // A4b. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go index f82babf6f..9c936be6c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go @@ -170,10 +170,13 @@ func PartitionForRegion(ps []Partition, regionID string) (Partition, bool) { // A Partition provides the ability to enumerate the partition's regions // and services. type Partition struct { - id string - p *partition + id, dnsSuffix string + p *partition } +// DNSSuffix returns the base domain name of the partition. +func (p Partition) DNSSuffix() string { return p.dnsSuffix } + // ID returns the identifier of the partition. func (p Partition) ID() string { return p.id } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go index ff6f76db6..523ad79ac 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go @@ -54,8 +54,9 @@ type partition struct { func (p partition) Partition() Partition { return Partition{ - id: p.ID, - p: &p, + dnsSuffix: p.DNSSuffix, + id: p.ID, + p: &p, } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go index 271da432c..d9b37f4d3 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go @@ -1,18 +1,17 @@ -// +build !appengine,!plan9 - package request import ( - "net" - "os" - "syscall" + "strings" ) func isErrConnectionReset(err error) bool { - if opErr, ok := err.(*net.OpError); ok { - if sysErr, ok := opErr.Err.(*os.SyscallError); ok { - return sysErr.Err == syscall.ECONNRESET - } + if strings.Contains(err.Error(), "read: connection reset") { + return false + } + + if strings.Contains(err.Error(), "connection reset") || + strings.Contains(err.Error(), "broken pipe") { + return true } return false diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go deleted file mode 100644 index daf9eca43..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build appengine plan9 - -package request - -import ( - "strings" -) - -func isErrConnectionReset(err error) bool { - return strings.Contains(err.Error(), "connection reset") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go index 8ef8548a9..627ec722c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -59,6 +59,51 @@ func (h *Handlers) Clear() { h.Complete.Clear() } +// IsEmpty returns if there are no handlers in any of the handlerlists. +func (h *Handlers) IsEmpty() bool { + if h.Validate.Len() != 0 { + return false + } + if h.Build.Len() != 0 { + return false + } + if h.Send.Len() != 0 { + return false + } + if h.Sign.Len() != 0 { + return false + } + if h.Unmarshal.Len() != 0 { + return false + } + if h.UnmarshalStream.Len() != 0 { + return false + } + if h.UnmarshalMeta.Len() != 0 { + return false + } + if h.UnmarshalError.Len() != 0 { + return false + } + if h.ValidateResponse.Len() != 0 { + return false + } + if h.Retry.Len() != 0 { + return false + } + if h.AfterRetry.Len() != 0 { + return false + } + if h.CompleteAttempt.Len() != 0 { + return false + } + if h.Complete.Len() != 0 { + return false + } + + return true +} + // A HandlerListRunItem represents an entry in the HandlerList which // is being run. type HandlerListRunItem struct { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go index b0c2ef4fe..9370fa50c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go @@ -15,12 +15,15 @@ type offsetReader struct { closed bool } -func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { +func newOffsetReader(buf io.ReadSeeker, offset int64) (*offsetReader, error) { reader := &offsetReader{} - buf.Seek(offset, sdkio.SeekStart) + _, err := buf.Seek(offset, sdkio.SeekStart) + if err != nil { + return nil, err + } reader.buf = buf - return reader + return reader, nil } // Close will close the instance of the offset reader's access to @@ -54,7 +57,9 @@ func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { // CloseAndCopy will return a new offsetReader with a copy of the old buffer // and close the old buffer. -func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { - o.Close() +func (o *offsetReader) CloseAndCopy(offset int64) (*offsetReader, error) { + if err := o.Close(); err != nil { + return nil, err + } return newOffsetReader(o.buf, offset) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 8f2eb3e43..e7c9b2b61 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "io" + "net" "net/http" "net/url" "reflect" @@ -231,6 +232,10 @@ func (r *Request) WillRetry() bool { return r.Error != nil && aws.BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() } +func fmtAttemptCount(retryCount, maxRetries int) string { + return fmt.Sprintf("attempt %v/%v", retryCount, maxRetries) +} + // ParamsFilled returns if the request's parameters have been populated // and the parameters are valid. False is returned if no parameters are // provided or invalid. @@ -259,7 +264,18 @@ func (r *Request) SetStringBody(s string) { // SetReaderBody will set the request's body reader. func (r *Request) SetReaderBody(reader io.ReadSeeker) { r.Body = reader - r.BodyStart, _ = reader.Seek(0, sdkio.SeekCurrent) // Get the Bodies current offset. + + if aws.IsReaderSeekable(reader) { + var err error + // Get the Bodies current offset so retries will start from the same + // initial position. + r.BodyStart, err = reader.Seek(0, sdkio.SeekCurrent) + if err != nil { + r.Error = awserr.New(ErrCodeSerialization, + "failed to determine start of request body", err) + return + } + } r.ResetBody() } @@ -330,16 +346,15 @@ func getPresignedURL(r *Request, expire time.Duration) (string, http.Header, err return r.HTTPRequest.URL.String(), r.SignedHeaderVals, nil } -func debugLogReqError(r *Request, stage string, retrying bool, err error) { +const ( + notRetrying = "not retrying" +) + +func debugLogReqError(r *Request, stage, retryStr string, err error) { if !r.Config.LogLevel.Matches(aws.LogDebugWithRequestErrors) { return } - retryStr := "not retrying" - if retrying { - retryStr = "will retry" - } - r.Config.Logger.Log(fmt.Sprintf("DEBUG: %s %s/%s failed, %s, error %v", stage, r.ClientInfo.ServiceName, r.Operation.Name, retryStr, err)) } @@ -358,12 +373,12 @@ func (r *Request) Build() error { if !r.built { r.Handlers.Validate.Run(r) if r.Error != nil { - debugLogReqError(r, "Validate Request", false, r.Error) + debugLogReqError(r, "Validate Request", notRetrying, r.Error) return r.Error } r.Handlers.Build.Run(r) if r.Error != nil { - debugLogReqError(r, "Build Request", false, r.Error) + debugLogReqError(r, "Build Request", notRetrying, r.Error) return r.Error } r.built = true @@ -379,7 +394,7 @@ func (r *Request) Build() error { func (r *Request) Sign() error { r.Build() if r.Error != nil { - debugLogReqError(r, "Build Request", false, r.Error) + debugLogReqError(r, "Build Request", notRetrying, r.Error) return r.Error } @@ -387,12 +402,16 @@ func (r *Request) Sign() error { return r.Error } -func (r *Request) getNextRequestBody() (io.ReadCloser, error) { +func (r *Request) getNextRequestBody() (body io.ReadCloser, err error) { if r.safeBody != nil { r.safeBody.Close() } - r.safeBody = newOffsetReader(r.Body, r.BodyStart) + r.safeBody, err = newOffsetReader(r.Body, r.BodyStart) + if err != nil { + return nil, awserr.New(ErrCodeSerialization, + "failed to get next request body reader", err) + } // Go 1.8 tightened and clarified the rules code needs to use when building // requests with the http package. Go 1.8 removed the automatic detection @@ -409,10 +428,10 @@ func (r *Request) getNextRequestBody() (io.ReadCloser, error) { // Related golang/go#18257 l, err := aws.SeekerLen(r.Body) if err != nil { - return nil, awserr.New(ErrCodeSerialization, "failed to compute request body size", err) + return nil, awserr.New(ErrCodeSerialization, + "failed to compute request body size", err) } - var body io.ReadCloser if l == 0 { body = NoBody } else if l > 0 { @@ -473,13 +492,13 @@ func (r *Request) Send() error { r.AttemptTime = time.Now() if err := r.Sign(); err != nil { - debugLogReqError(r, "Sign Request", false, err) + debugLogReqError(r, "Sign Request", notRetrying, err) return err } if err := r.sendRequest(); err == nil { return nil - } else if !shouldRetryCancel(r.Error) { + } else if !shouldRetryError(r.Error) { return err } else { r.Handlers.Retry.Run(r) @@ -489,13 +508,16 @@ func (r *Request) Send() error { return r.Error } - r.prepareRetry() + if err := r.prepareRetry(); err != nil { + r.Error = err + return err + } continue } } } -func (r *Request) prepareRetry() { +func (r *Request) prepareRetry() error { if r.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { r.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", r.ClientInfo.ServiceName, r.Operation.Name, r.RetryCount)) @@ -506,12 +528,19 @@ func (r *Request) prepareRetry() { // the request's body even though the Client's Do returned. r.HTTPRequest = copyHTTPRequest(r.HTTPRequest, nil) r.ResetBody() + if err := r.Error; err != nil { + return awserr.New(ErrCodeSerialization, + "failed to prepare body for retry", err) + + } // Closing response body to ensure that no response body is leaked // between retry attempts. if r.HTTPResponse != nil && r.HTTPResponse.Body != nil { r.HTTPResponse.Body.Close() } + + return nil } func (r *Request) sendRequest() (sendErr error) { @@ -520,7 +549,9 @@ func (r *Request) sendRequest() (sendErr error) { r.Retryable = nil r.Handlers.Send.Run(r) if r.Error != nil { - debugLogReqError(r, "Send Request", r.WillRetry(), r.Error) + debugLogReqError(r, "Send Request", + fmtAttemptCount(r.RetryCount, r.MaxRetries()), + r.Error) return r.Error } @@ -528,13 +559,17 @@ func (r *Request) sendRequest() (sendErr error) { r.Handlers.ValidateResponse.Run(r) if r.Error != nil { r.Handlers.UnmarshalError.Run(r) - debugLogReqError(r, "Validate Response", r.WillRetry(), r.Error) + debugLogReqError(r, "Validate Response", + fmtAttemptCount(r.RetryCount, r.MaxRetries()), + r.Error) return r.Error } r.Handlers.Unmarshal.Run(r) if r.Error != nil { - debugLogReqError(r, "Unmarshal Response", r.WillRetry(), r.Error) + debugLogReqError(r, "Unmarshal Response", + fmtAttemptCount(r.RetryCount, r.MaxRetries()), + r.Error) return r.Error } @@ -565,13 +600,13 @@ type temporary interface { Temporary() bool } -func shouldRetryCancel(err error) bool { - switch err := err.(type) { +func shouldRetryError(origErr error) bool { + switch err := origErr.(type) { case awserr.Error: if err.Code() == CanceledErrorCode { return false } - return shouldRetryCancel(err.OrigErr()) + return shouldRetryError(err.OrigErr()) case *url.Error: if strings.Contains(err.Error(), "connection refused") { // Refused connections should be retried as the service may not yet @@ -581,14 +616,17 @@ func shouldRetryCancel(err error) bool { } // *url.Error only implements Temporary after golang 1.6 but since // url.Error only wraps the error: - return shouldRetryCancel(err.Err) + return shouldRetryError(err.Err) case temporary: + if netErr, ok := err.(*net.OpError); ok && netErr.Op == "dial" { + return true + } // If the error is temporary, we want to allow continuation of the // retry process - return err.Temporary() + return err.Temporary() || isErrConnectionReset(origErr) case nil: // `awserr.Error.OrigErr()` can be nil, meaning there was an error but - // because we don't know the cause, it is marked as retriable. See + // because we don't know the cause, it is marked as retryable. See // TestRequest4xxUnretryable for an example. return true default: diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go index 7c6a8000f..de1292f45 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go @@ -4,6 +4,8 @@ package request import ( "net/http" + + "github.com/aws/aws-sdk-go/aws/awserr" ) // NoBody is a http.NoBody reader instructing Go HTTP client to not include @@ -24,7 +26,8 @@ var NoBody = http.NoBody func (r *Request) ResetBody() { body, err := r.getNextRequestBody() if err != nil { - r.Error = err + r.Error = awserr.New(ErrCodeSerialization, + "failed to reset request body", err) return } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go index a633ed5ac..f093fc542 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go @@ -146,7 +146,7 @@ func (r *Request) nextPageTokens() []interface{} { return nil } case bool: - if v == false { + if !v { return nil } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go index 7bc5da782..d0aa54c6d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -38,6 +38,7 @@ var throttleCodes = map[string]struct{}{ "ThrottlingException": {}, "RequestLimitExceeded": {}, "RequestThrottled": {}, + "RequestThrottledException": {}, "TooManyRequestsException": {}, // Lambda functions "PriorRequestNotComplete": {}, // Route53 "TransactionInProgressException": {}, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go new file mode 100644 index 000000000..ea9ebb6f6 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go @@ -0,0 +1,26 @@ +// +build go1.7 + +package session + +import ( + "net" + "net/http" + "time" +) + +// Transport that should be used when a custom CA bundle is specified with the +// SDK. +func getCABundleTransport() *http.Transport { + return &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + DualStack: true, + }).DialContext, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go new file mode 100644 index 000000000..fec39dfc1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go @@ -0,0 +1,22 @@ +// +build !go1.6,go1.5 + +package session + +import ( + "net" + "net/http" + "time" +) + +// Transport that should be used when a custom CA bundle is specified with the +// SDK. +func getCABundleTransport() *http.Transport { + return &http.Transport{ + Proxy: http.ProxyFromEnvironment, + Dial: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + TLSHandshakeTimeout: 10 * time.Second, + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go new file mode 100644 index 000000000..1c5a5391e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go @@ -0,0 +1,23 @@ +// +build !go1.7,go1.6 + +package session + +import ( + "net" + "net/http" + "time" +) + +// Transport that should be used when a custom CA bundle is specified with the +// SDK. +func getCABundleTransport() *http.Transport { + return &http.Transport{ + Proxy: http.ProxyFromEnvironment, + Dial: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go new file mode 100644 index 000000000..7713ccfca --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go @@ -0,0 +1,259 @@ +package session + +import ( + "fmt" + "os" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/processcreds" + "github.com/aws/aws-sdk-go/aws/credentials/stscreds" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/internal/shareddefaults" +) + +func resolveCredentials(cfg *aws.Config, + envCfg envConfig, sharedCfg sharedConfig, + handlers request.Handlers, + sessOpts Options, +) (*credentials.Credentials, error) { + + switch { + case len(sessOpts.Profile) != 0: + // User explicitly provided an Profile in the session's configuration + // so load that profile from shared config first. + // Github(aws/aws-sdk-go#2727) + return resolveCredsFromProfile(cfg, envCfg, sharedCfg, handlers, sessOpts) + + case envCfg.Creds.HasKeys(): + // Environment credentials + return credentials.NewStaticCredentialsFromCreds(envCfg.Creds), nil + + case len(envCfg.WebIdentityTokenFilePath) != 0: + // Web identity token from environment, RoleARN required to also be + // set. + return assumeWebIdentity(cfg, handlers, + envCfg.WebIdentityTokenFilePath, + envCfg.RoleARN, + envCfg.RoleSessionName, + ) + + default: + // Fallback to the "default" credential resolution chain. + return resolveCredsFromProfile(cfg, envCfg, sharedCfg, handlers, sessOpts) + } +} + +// WebIdentityEmptyRoleARNErr will occur if 'AWS_WEB_IDENTITY_TOKEN_FILE' was set but +// 'AWS_IAM_ROLE_ARN' was not set. +var WebIdentityEmptyRoleARNErr = awserr.New(stscreds.ErrCodeWebIdentity, "role ARN is not set", nil) + +// WebIdentityEmptyTokenFilePathErr will occur if 'AWS_IAM_ROLE_ARN' was set but +// 'AWS_WEB_IDENTITY_TOKEN_FILE' was not set. +var WebIdentityEmptyTokenFilePathErr = awserr.New(stscreds.ErrCodeWebIdentity, "token file path is not set", nil) + +func assumeWebIdentity(cfg *aws.Config, handlers request.Handlers, + filepath string, + roleARN, sessionName string, +) (*credentials.Credentials, error) { + + if len(filepath) == 0 { + return nil, WebIdentityEmptyTokenFilePathErr + } + + if len(roleARN) == 0 { + return nil, WebIdentityEmptyRoleARNErr + } + + creds := stscreds.NewWebIdentityCredentials( + &Session{ + Config: cfg, + Handlers: handlers.Copy(), + }, + roleARN, + sessionName, + filepath, + ) + + return creds, nil +} + +func resolveCredsFromProfile(cfg *aws.Config, + envCfg envConfig, sharedCfg sharedConfig, + handlers request.Handlers, + sessOpts Options, +) (creds *credentials.Credentials, err error) { + + switch { + case sharedCfg.SourceProfile != nil: + // Assume IAM role with credentials source from a different profile. + creds, err = resolveCredsFromProfile(cfg, envCfg, + *sharedCfg.SourceProfile, handlers, sessOpts, + ) + + case sharedCfg.Creds.HasKeys(): + // Static Credentials from Shared Config/Credentials file. + creds = credentials.NewStaticCredentialsFromCreds( + sharedCfg.Creds, + ) + + case len(sharedCfg.CredentialProcess) != 0: + // Get credentials from CredentialProcess + creds = processcreds.NewCredentials(sharedCfg.CredentialProcess) + + case len(sharedCfg.CredentialSource) != 0: + creds, err = resolveCredsFromSource(cfg, envCfg, + sharedCfg, handlers, sessOpts, + ) + + case len(sharedCfg.WebIdentityTokenFile) != 0: + // Credentials from Assume Web Identity token require an IAM Role, and + // that roll will be assumed. May be wrapped with another assume role + // via SourceProfile. + return assumeWebIdentity(cfg, handlers, + sharedCfg.WebIdentityTokenFile, + sharedCfg.RoleARN, + sharedCfg.RoleSessionName, + ) + + default: + // Fallback to default credentials provider, include mock errors for + // the credential chain so user can identify why credentials failed to + // be retrieved. + creds = credentials.NewCredentials(&credentials.ChainProvider{ + VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), + Providers: []credentials.Provider{ + &credProviderError{ + Err: awserr.New("EnvAccessKeyNotFound", + "failed to find credentials in the environment.", nil), + }, + &credProviderError{ + Err: awserr.New("SharedCredsLoad", + fmt.Sprintf("failed to load profile, %s.", envCfg.Profile), nil), + }, + defaults.RemoteCredProvider(*cfg, handlers), + }, + }) + } + if err != nil { + return nil, err + } + + if len(sharedCfg.RoleARN) > 0 { + cfgCp := *cfg + cfgCp.Credentials = creds + return credsFromAssumeRole(cfgCp, handlers, sharedCfg, sessOpts) + } + + return creds, nil +} + +// valid credential source values +const ( + credSourceEc2Metadata = "Ec2InstanceMetadata" + credSourceEnvironment = "Environment" + credSourceECSContainer = "EcsContainer" +) + +func resolveCredsFromSource(cfg *aws.Config, + envCfg envConfig, sharedCfg sharedConfig, + handlers request.Handlers, + sessOpts Options, +) (creds *credentials.Credentials, err error) { + + switch sharedCfg.CredentialSource { + case credSourceEc2Metadata: + p := defaults.RemoteCredProvider(*cfg, handlers) + creds = credentials.NewCredentials(p) + + case credSourceEnvironment: + creds = credentials.NewStaticCredentialsFromCreds(envCfg.Creds) + + case credSourceECSContainer: + if len(os.Getenv(shareddefaults.ECSCredsProviderEnvVar)) == 0 { + return nil, ErrSharedConfigECSContainerEnvVarEmpty + } + + p := defaults.RemoteCredProvider(*cfg, handlers) + creds = credentials.NewCredentials(p) + + default: + return nil, ErrSharedConfigInvalidCredSource + } + + return creds, nil +} + +func credsFromAssumeRole(cfg aws.Config, + handlers request.Handlers, + sharedCfg sharedConfig, + sessOpts Options, +) (*credentials.Credentials, error) { + + if len(sharedCfg.MFASerial) != 0 && sessOpts.AssumeRoleTokenProvider == nil { + // AssumeRole Token provider is required if doing Assume Role + // with MFA. + return nil, AssumeRoleTokenProviderNotSetError{} + } + + return stscreds.NewCredentials( + &Session{ + Config: &cfg, + Handlers: handlers.Copy(), + }, + sharedCfg.RoleARN, + func(opt *stscreds.AssumeRoleProvider) { + opt.RoleSessionName = sharedCfg.RoleSessionName + opt.Duration = sessOpts.AssumeRoleDuration + + // Assume role with external ID + if len(sharedCfg.ExternalID) > 0 { + opt.ExternalID = aws.String(sharedCfg.ExternalID) + } + + // Assume role with MFA + if len(sharedCfg.MFASerial) > 0 { + opt.SerialNumber = aws.String(sharedCfg.MFASerial) + opt.TokenProvider = sessOpts.AssumeRoleTokenProvider + } + }, + ), nil +} + +// AssumeRoleTokenProviderNotSetError is an error returned when creating a +// session when the MFAToken option is not set when shared config is configured +// load assume a role with an MFA token. +type AssumeRoleTokenProviderNotSetError struct{} + +// Code is the short id of the error. +func (e AssumeRoleTokenProviderNotSetError) Code() string { + return "AssumeRoleTokenProviderNotSetError" +} + +// Message is the description of the error +func (e AssumeRoleTokenProviderNotSetError) Message() string { + return fmt.Sprintf("assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.") +} + +// OrigErr is the underlying error that caused the failure. +func (e AssumeRoleTokenProviderNotSetError) OrigErr() error { + return nil +} + +// Error satisfies the error interface. +func (e AssumeRoleTokenProviderNotSetError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", nil) +} + +type credProviderError struct { + Err error +} + +func (c credProviderError) Retrieve() (credentials.Value, error) { + return credentials.Value{}, c.Err +} +func (c credProviderError) IsExpired() bool { + return true +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go index 38a7b05a6..7ec66e7e5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go @@ -1,97 +1,93 @@ /* -Package session provides configuration for the SDK's service clients. - -Sessions can be shared across all service clients that share the same base -configuration. The Session is built from the SDK's default configuration and -request handlers. - -Sessions should be cached when possible, because creating a new Session will -load all configuration values from the environment, and config files each time -the Session is created. Sharing the Session value across all of your service -clients will ensure the configuration is loaded the fewest number of times possible. - -Concurrency +Package session provides configuration for the SDK's service clients. Sessions +can be shared across service clients that share the same base configuration. Sessions are safe to use concurrently as long as the Session is not being -modified. The SDK will not modify the Session once the Session has been created. -Creating service clients concurrently from a shared Session is safe. +modified. Sessions should be cached when possible, because creating a new +Session will load all configuration values from the environment, and config +files each time the Session is created. Sharing the Session value across all of +your service clients will ensure the configuration is loaded the fewest number +of times possible. -Sessions from Shared Config - -Sessions can be created using the method above that will only load the -additional config if the AWS_SDK_LOAD_CONFIG environment variable is set. -Alternatively you can explicitly create a Session with shared config enabled. -To do this you can use NewSessionWithOptions to configure how the Session will -be created. Using the NewSessionWithOptions with SharedConfigState set to -SharedConfigEnable will create the session as if the AWS_SDK_LOAD_CONFIG -environment variable was set. - -Creating Sessions - -When creating Sessions optional aws.Config values can be passed in that will -override the default, or loaded config values the Session is being created -with. This allows you to provide additional, or case based, configuration -as needed. +Sessions options from Shared Config By default NewSession will only load credentials from the shared credentials file (~/.aws/credentials). If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value the Session will be created from the configuration values from the shared config (~/.aws/config) and shared credentials -(~/.aws/credentials) files. See the section Sessions from Shared Config for -more information. +(~/.aws/credentials) files. Using the NewSessionWithOptions with +SharedConfigState set to SharedConfigEnable will create the session as if the +AWS_SDK_LOAD_CONFIG environment variable was set. -Create a Session with the default config and request handlers. With credentials -region, and profile loaded from the environment and shared config automatically. -Requires the AWS_PROFILE to be set, or "default" is used. +Credential and config loading order + +The Session will attempt to load configuration and credentials from the +environment, configuration files, and other credential sources. The order +configuration is loaded in is: + + * Environment Variables + * Shared Credentials file + * Shared Configuration file (if SharedConfig is enabled) + * EC2 Instance Metadata (credentials only) + +The Environment variables for credentials will have precedence over shared +config even if SharedConfig is enabled. To override this behavior, and use +shared config credentials instead specify the session.Options.Profile, (e.g. +when using credential_source=Environment to assume a role). + + sess, err := session.NewSessionWithOptions(session.Options{ + Profile: "myProfile", + }) + +Creating Sessions + +Creating a Session without additional options will load credentials region, and +profile loaded from the environment and shared config automatically. See, +"Environment Variables" section for information on environment variables used +by Session. // Create Session - sess := session.Must(session.NewSession()) + sess, err := session.NewSession() + + +When creating Sessions optional aws.Config values can be passed in that will +override the default, or loaded, config values the Session is being created +with. This allows you to provide additional, or case based, configuration +as needed. // Create a Session with a custom region - sess := session.Must(session.NewSession(&aws.Config{ - Region: aws.String("us-east-1"), - })) + sess, err := session.NewSession(&aws.Config{ + Region: aws.String("us-west-2"), + }) - // Create a S3 client instance from a session - sess := session.Must(session.NewSession()) - - svc := s3.New(sess) - -Create Session With Option Overrides - -In addition to NewSession, Sessions can be created using NewSessionWithOptions. -This func allows you to control and override how the Session will be created -through code instead of being driven by environment variables only. - -Use NewSessionWithOptions when you want to provide the config profile, or -override the shared config state (AWS_SDK_LOAD_CONFIG). +Use NewSessionWithOptions to provide additional configuration driving how the +Session's configuration will be loaded. Such as, specifying shared config +profile, or override the shared config state, (AWS_SDK_LOAD_CONFIG). // Equivalent to session.NewSession() - sess := session.Must(session.NewSessionWithOptions(session.Options{ + sess, err := session.NewSessionWithOptions(session.Options{ // Options - })) + }) - // Specify profile to load for the session's config - sess := session.Must(session.NewSessionWithOptions(session.Options{ - Profile: "profile_name", - })) + sess, err := session.NewSessionWithOptions(session.Options{ + // Specify profile to load for the session's config + Profile: "profile_name", - // Specify profile for config and region for requests - sess := session.Must(session.NewSessionWithOptions(session.Options{ - Config: aws.Config{Region: aws.String("us-east-1")}, - Profile: "profile_name", - })) + // Provide SDK Config options, such as Region. + Config: aws.Config{ + Region: aws.String("us-west-2"), + }, - // Force enable Shared Config support - sess := session.Must(session.NewSessionWithOptions(session.Options{ + // Force enable Shared Config support SharedConfigState: session.SharedConfigEnable, - })) + }) Adding Handlers -You can add handlers to a session for processing HTTP requests. All service -clients that use the session inherit the handlers. For example, the following -handler logs every request and its payload made by a service client: +You can add handlers to a session to decorate API operation, (e.g. adding HTTP +headers). All clients that use the Session receive a copy of the Session's +handlers. For example, the following request handler added to the Session logs +every requests made. // Create a session, and add additional handlers for all service // clients created with the Session to inherit. Adds logging handler. @@ -99,22 +95,15 @@ handler logs every request and its payload made by a service client: sess.Handlers.Send.PushFront(func(r *request.Request) { // Log every request made and its payload - logger.Printf("Request: %s/%s, Payload: %s", + logger.Printf("Request: %s/%s, Params: %s", r.ClientInfo.ServiceName, r.Operation, r.Params) }) -Deprecated "New" function - -The New session function has been deprecated because it does not provide good -way to return errors that occur when loading the configuration files and values. -Because of this, NewSession was created so errors can be retrieved when -creating a session fails. - Shared Config Fields -By default the SDK will only load the shared credentials file's (~/.aws/credentials) -credentials values, and all other config is provided by the environment variables, -SDK defaults, and user provided aws.Config values. +By default the SDK will only load the shared credentials file's +(~/.aws/credentials) credentials values, and all other config is provided by +the environment variables, SDK defaults, and user provided aws.Config values. If the AWS_SDK_LOAD_CONFIG environment variable is set, or SharedConfigEnable option is used to create the Session the full shared config values will be @@ -125,24 +114,31 @@ files have the same format. If both config files are present the configuration from both files will be read. The Session will be created from configuration values from the shared -credentials file (~/.aws/credentials) over those in the shared config file (~/.aws/config). +credentials file (~/.aws/credentials) over those in the shared config file +(~/.aws/config). -Credentials are the values the SDK should use for authenticating requests with -AWS Services. They are from a configuration file will need to include both -aws_access_key_id and aws_secret_access_key must be provided together in the -same file to be considered valid. The values will be ignored if not a complete -group. aws_session_token is an optional field that can be provided if both of -the other two fields are also provided. +Credentials are the values the SDK uses to authenticating requests with AWS +Services. When specified in a file, both aws_access_key_id and +aws_secret_access_key must be provided together in the same file to be +considered valid. They will be ignored if both are not present. +aws_session_token is an optional field that can be provided in addition to the +other two fields. aws_access_key_id = AKID aws_secret_access_key = SECRET aws_session_token = TOKEN -Assume Role values allow you to configure the SDK to assume an IAM role using -a set of credentials provided in a config file via the source_profile field. -Both "role_arn" and "source_profile" are required. The SDK supports assuming -a role with MFA token if the session option AssumeRoleTokenProvider -is set. + ; region only supported if SharedConfigEnabled. + region = us-east-1 + +Assume Role configuration + +The role_arn field allows you to configure the SDK to assume an IAM role using +a set of credentials from another source. Such as when paired with static +credentials, "profile_source", "credential_process", or "credential_source" +fields. If "role_arn" is provided, a source of credentials must also be +specified, such as "source_profile", "credential_source", or +"credential_process". role_arn = arn:aws:iam:::role/ source_profile = profile_with_creds @@ -150,40 +146,16 @@ is set. mfa_serial = role_session_name = session_name -Region is the region the SDK should use for looking up AWS service endpoints -and signing requests. - region = us-east-1 - -Assume Role with MFA token - -To create a session with support for assuming an IAM role with MFA set the -session option AssumeRoleTokenProvider to a function that will prompt for the -MFA token code when the SDK assumes the role and refreshes the role's credentials. -This allows you to configure the SDK via the shared config to assumea role -with MFA tokens. - -In order for the SDK to assume a role with MFA the SharedConfigState -session option must be set to SharedConfigEnable, or AWS_SDK_LOAD_CONFIG -environment variable set. - -The shared configuration instructs the SDK to assume an IAM role with MFA -when the mfa_serial configuration field is set in the shared config -(~/.aws/config) or shared credentials (~/.aws/credentials) file. - -If mfa_serial is set in the configuration, the SDK will assume the role, and -the AssumeRoleTokenProvider session option is not set an an error will -be returned when creating the session. +The SDK supports assuming a role with MFA token. If "mfa_serial" is set, you +must also set the Session Option.AssumeRoleTokenProvider. The Session will fail +to load if the AssumeRoleTokenProvider is not specified. sess := session.Must(session.NewSessionWithOptions(session.Options{ AssumeRoleTokenProvider: stscreds.StdinTokenProvider, })) - // Create service client value configured for credentials - // from assumed role. - svc := s3.New(sess) - -To setup assume role outside of a session see the stscreds.AssumeRoleProvider +To setup Assume Role outside of a session see the stscreds.AssumeRoleProvider documentation. Environment Variables diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go index e3959b959..3a998d5bd 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go @@ -102,18 +102,38 @@ type envConfig struct { CSMEnabled bool CSMPort string CSMClientID string + CSMHost string - enableEndpointDiscovery string // Enables endpoint discovery via environment variables. // // AWS_ENABLE_ENDPOINT_DISCOVERY=true EnableEndpointDiscovery *bool + enableEndpointDiscovery string + + // Specifies the WebIdentity token the SDK should use to assume a role + // with. + // + // AWS_WEB_IDENTITY_TOKEN_FILE=file_path + WebIdentityTokenFilePath string + + // Specifies the IAM role arn to use when assuming an role. + // + // AWS_ROLE_ARN=role_arn + RoleARN string + + // Specifies the IAM role session name to use when assuming a role. + // + // AWS_ROLE_SESSION_NAME=session_name + RoleSessionName string } var ( csmEnabledEnvKey = []string{ "AWS_CSM_ENABLED", } + csmHostEnvKey = []string{ + "AWS_CSM_HOST", + } csmPortEnvKey = []string{ "AWS_CSM_PORT", } @@ -150,6 +170,15 @@ var ( sharedConfigFileEnvKey = []string{ "AWS_CONFIG_FILE", } + webIdentityTokenFilePathEnvKey = []string{ + "AWS_WEB_IDENTITY_TOKEN_FILE", + } + roleARNEnvKey = []string{ + "AWS_ROLE_ARN", + } + roleSessionNameEnvKey = []string{ + "AWS_ROLE_SESSION_NAME", + } ) // loadEnvConfig retrieves the SDK's environment configuration. @@ -178,23 +207,31 @@ func envConfigLoad(enableSharedConfig bool) envConfig { cfg.EnableSharedConfig = enableSharedConfig - setFromEnvVal(&cfg.Creds.AccessKeyID, credAccessEnvKey) - setFromEnvVal(&cfg.Creds.SecretAccessKey, credSecretEnvKey) - setFromEnvVal(&cfg.Creds.SessionToken, credSessionEnvKey) + // Static environment credentials + var creds credentials.Value + setFromEnvVal(&creds.AccessKeyID, credAccessEnvKey) + setFromEnvVal(&creds.SecretAccessKey, credSecretEnvKey) + setFromEnvVal(&creds.SessionToken, credSessionEnvKey) + if creds.HasKeys() { + // Require logical grouping of credentials + creds.ProviderName = EnvProviderName + cfg.Creds = creds + } + + // Role Metadata + setFromEnvVal(&cfg.RoleARN, roleARNEnvKey) + setFromEnvVal(&cfg.RoleSessionName, roleSessionNameEnvKey) + + // Web identity environment variables + setFromEnvVal(&cfg.WebIdentityTokenFilePath, webIdentityTokenFilePathEnvKey) // CSM environment variables setFromEnvVal(&cfg.csmEnabled, csmEnabledEnvKey) + setFromEnvVal(&cfg.CSMHost, csmHostEnvKey) setFromEnvVal(&cfg.CSMPort, csmPortEnvKey) setFromEnvVal(&cfg.CSMClientID, csmClientIDEnvKey) cfg.CSMEnabled = len(cfg.csmEnabled) > 0 - // Require logical grouping of credentials - if len(cfg.Creds.AccessKeyID) == 0 || len(cfg.Creds.SecretAccessKey) == 0 { - cfg.Creds = credentials.Value{} - } else { - cfg.Creds.ProviderName = EnvProviderName - } - regionKeys := regionEnvKeys profileKeys := profileEnvKeys if !cfg.EnableSharedConfig { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 9bdbafd65..1b4fcdb10 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -8,19 +8,17 @@ import ( "io/ioutil" "net/http" "os" + "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/credentials/processcreds" - "github.com/aws/aws-sdk-go/aws/credentials/stscreds" "github.com/aws/aws-sdk-go/aws/csm" "github.com/aws/aws-sdk-go/aws/defaults" "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/shareddefaults" ) const ( @@ -107,7 +105,15 @@ func New(cfgs ...*aws.Config) *Session { s := deprecatedNewSession(cfgs...) if envCfg.CSMEnabled { - enableCSM(&s.Handlers, envCfg.CSMClientID, envCfg.CSMPort, s.Config.Logger) + err := enableCSM(&s.Handlers, envCfg.CSMClientID, + envCfg.CSMHost, envCfg.CSMPort, s.Config.Logger) + if err != nil { + err = fmt.Errorf("failed to enable CSM, %v", err) + s.Config.Logger.Log("ERROR:", err.Error()) + s.Handlers.Validate.PushBack(func(r *request.Request) { + r.Error = err + }) + } } return s @@ -210,6 +216,12 @@ type Options struct { // the config enables assume role wit MFA via the mfa_serial field. AssumeRoleTokenProvider func() (string, error) + // When the SDK's shared config is configured to assume a role this option + // may be provided to set the expiry duration of the STS credentials. + // Defaults to 15 minutes if not set as documented in the + // stscreds.AssumeRoleProvider. + AssumeRoleDuration time.Duration + // Reader for a custom Credentials Authority (CA) bundle in PEM format that // the SDK will use instead of the default system's root CA bundle. Use this // only if you want to replace the CA bundle the SDK uses for TLS requests. @@ -224,6 +236,12 @@ type Options struct { // to also enable this feature. CustomCABundle session option field has priority // over the AWS_CA_BUNDLE environment variable, and will be used if both are set. CustomCABundle io.Reader + + // The handlers that the session and all API clients will be created with. + // This must be a complete set of handlers. Use the defaults.Handlers() + // function to initialize this value before changing the handlers to be + // used by the SDK. + Handlers request.Handlers } // NewSessionWithOptions returns a new Session created from SDK defaults, config files, @@ -263,7 +281,7 @@ func NewSessionWithOptions(opts Options) (*Session, error) { envCfg = loadEnvConfig() } - if len(opts.Profile) > 0 { + if len(opts.Profile) != 0 { envCfg.Profile = opts.Profile } @@ -329,27 +347,36 @@ func deprecatedNewSession(cfgs ...*aws.Config) *Session { return s } -func enableCSM(handlers *request.Handlers, clientID string, port string, logger aws.Logger) { - logger.Log("Enabling CSM") - if len(port) == 0 { - port = csm.DefaultPort +func enableCSM(handlers *request.Handlers, + clientID, host, port string, + logger aws.Logger, +) error { + if logger != nil { + logger.Log("Enabling CSM") } - r, err := csm.Start(clientID, "127.0.0.1:"+port) + r, err := csm.Start(clientID, csm.AddressWithDefaults(host, port)) if err != nil { - return + return err } r.InjectHandlers(handlers) + + return nil } func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { cfg := defaults.Config() - handlers := defaults.Handlers() + + handlers := opts.Handlers + if handlers.IsEmpty() { + handlers = defaults.Handlers() + } // Get a merged version of the user provided config to determine if // credentials were. userCfg := &aws.Config{} userCfg.MergeIn(cfgs...) + cfg.MergeIn(userCfg) // Ordered config files will be loaded in with later files overwriting // previous config file values. @@ -366,9 +393,11 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, } // Load additional config from file(s) - sharedCfg, err := loadSharedConfig(envCfg.Profile, cfgFiles) + sharedCfg, err := loadSharedConfig(envCfg.Profile, cfgFiles, envCfg.EnableSharedConfig) if err != nil { - return nil, err + if _, ok := err.(SharedConfigProfileNotExistsError); !ok { + return nil, err + } } if err := mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers, opts); err != nil { @@ -382,7 +411,11 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, initHandlers(s) if envCfg.CSMEnabled { - enableCSM(&s.Handlers, envCfg.CSMClientID, envCfg.CSMPort, s.Config.Logger) + err := enableCSM(&s.Handlers, envCfg.CSMClientID, + envCfg.CSMHost, envCfg.CSMPort, s.Config.Logger) + if err != nil { + return nil, err + } } // Setup HTTP client with custom cert bundle if enabled @@ -407,7 +440,10 @@ func loadCustomCABundle(s *Session, bundle io.Reader) error { } } if t == nil { - t = &http.Transport{} + // Nil transport implies `http.DefaultTransport` should be used. Since + // the SDK cannot modify, nor copy the `DefaultTransport` specifying + // the values the next closest behavior. + t = getCABundleTransport() } p, err := loadCertPool(bundle) @@ -440,9 +476,11 @@ func loadCertPool(r io.Reader) (*x509.CertPool, error) { return p, nil } -func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers, sessOpts Options) error { - // Merge in user provided configuration - cfg.MergeIn(userCfg) +func mergeConfigSrcs(cfg, userCfg *aws.Config, + envCfg envConfig, sharedCfg sharedConfig, + handlers request.Handlers, + sessOpts Options, +) error { // Region if not already set by user if len(aws.StringValue(cfg.Region)) == 0 { @@ -461,164 +499,19 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg share } } - // Configure credentials if not already set + // Configure credentials if not already set by the user when creating the + // Session. if cfg.Credentials == credentials.AnonymousCredentials && userCfg.Credentials == nil { - - // inspect the profile to see if a credential source has been specified. - if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.CredentialSource) > 0 { - - // if both credential_source and source_profile have been set, return an error - // as this is undefined behavior. - if len(sharedCfg.AssumeRole.SourceProfile) > 0 { - return ErrSharedConfigSourceCollision - } - - // valid credential source values - const ( - credSourceEc2Metadata = "Ec2InstanceMetadata" - credSourceEnvironment = "Environment" - credSourceECSContainer = "EcsContainer" - ) - - switch sharedCfg.AssumeRole.CredentialSource { - case credSourceEc2Metadata: - cfgCp := *cfg - p := defaults.RemoteCredProvider(cfgCp, handlers) - cfgCp.Credentials = credentials.NewCredentials(p) - - if len(sharedCfg.AssumeRole.MFASerial) > 0 && sessOpts.AssumeRoleTokenProvider == nil { - // AssumeRole Token provider is required if doing Assume Role - // with MFA. - return AssumeRoleTokenProviderNotSetError{} - } - - cfg.Credentials = assumeRoleCredentials(cfgCp, handlers, sharedCfg, sessOpts) - case credSourceEnvironment: - cfg.Credentials = credentials.NewStaticCredentialsFromCreds( - envCfg.Creds, - ) - case credSourceECSContainer: - if len(os.Getenv(shareddefaults.ECSCredsProviderEnvVar)) == 0 { - return ErrSharedConfigECSContainerEnvVarEmpty - } - - cfgCp := *cfg - p := defaults.RemoteCredProvider(cfgCp, handlers) - creds := credentials.NewCredentials(p) - - cfg.Credentials = creds - default: - return ErrSharedConfigInvalidCredSource - } - - return nil - } - - if len(envCfg.Creds.AccessKeyID) > 0 { - cfg.Credentials = credentials.NewStaticCredentialsFromCreds( - envCfg.Creds, - ) - } else if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.RoleARN) > 0 && sharedCfg.AssumeRoleSource != nil { - cfgCp := *cfg - cfgCp.Credentials = credentials.NewStaticCredentialsFromCreds( - sharedCfg.AssumeRoleSource.Creds, - ) - - if len(sharedCfg.AssumeRole.MFASerial) > 0 && sessOpts.AssumeRoleTokenProvider == nil { - // AssumeRole Token provider is required if doing Assume Role - // with MFA. - return AssumeRoleTokenProviderNotSetError{} - } - - cfg.Credentials = assumeRoleCredentials(cfgCp, handlers, sharedCfg, sessOpts) - } else if len(sharedCfg.Creds.AccessKeyID) > 0 { - cfg.Credentials = credentials.NewStaticCredentialsFromCreds( - sharedCfg.Creds, - ) - } else if len(sharedCfg.CredentialProcess) > 0 { - cfg.Credentials = processcreds.NewCredentials( - sharedCfg.CredentialProcess, - ) - } else { - // Fallback to default credentials provider, include mock errors - // for the credential chain so user can identify why credentials - // failed to be retrieved. - cfg.Credentials = credentials.NewCredentials(&credentials.ChainProvider{ - VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), - Providers: []credentials.Provider{ - &credProviderError{Err: awserr.New("EnvAccessKeyNotFound", "failed to find credentials in the environment.", nil)}, - &credProviderError{Err: awserr.New("SharedCredsLoad", fmt.Sprintf("failed to load profile, %s.", envCfg.Profile), nil)}, - defaults.RemoteCredProvider(*cfg, handlers), - }, - }) + creds, err := resolveCredentials(cfg, envCfg, sharedCfg, handlers, sessOpts) + if err != nil { + return err } + cfg.Credentials = creds } return nil } -func assumeRoleCredentials(cfg aws.Config, handlers request.Handlers, sharedCfg sharedConfig, sessOpts Options) *credentials.Credentials { - return stscreds.NewCredentials( - &Session{ - Config: &cfg, - Handlers: handlers.Copy(), - }, - sharedCfg.AssumeRole.RoleARN, - func(opt *stscreds.AssumeRoleProvider) { - opt.RoleSessionName = sharedCfg.AssumeRole.RoleSessionName - - // Assume role with external ID - if len(sharedCfg.AssumeRole.ExternalID) > 0 { - opt.ExternalID = aws.String(sharedCfg.AssumeRole.ExternalID) - } - - // Assume role with MFA - if len(sharedCfg.AssumeRole.MFASerial) > 0 { - opt.SerialNumber = aws.String(sharedCfg.AssumeRole.MFASerial) - opt.TokenProvider = sessOpts.AssumeRoleTokenProvider - } - }, - ) -} - -// AssumeRoleTokenProviderNotSetError is an error returned when creating a session when the -// MFAToken option is not set when shared config is configured load assume a -// role with an MFA token. -type AssumeRoleTokenProviderNotSetError struct{} - -// Code is the short id of the error. -func (e AssumeRoleTokenProviderNotSetError) Code() string { - return "AssumeRoleTokenProviderNotSetError" -} - -// Message is the description of the error -func (e AssumeRoleTokenProviderNotSetError) Message() string { - return fmt.Sprintf("assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.") -} - -// OrigErr is the underlying error that caused the failure. -func (e AssumeRoleTokenProviderNotSetError) OrigErr() error { - return nil -} - -// Error satisfies the error interface. -func (e AssumeRoleTokenProviderNotSetError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", nil) -} - -type credProviderError struct { - Err error -} - -var emptyCreds = credentials.Value{} - -func (c credProviderError) Retrieve() (credentials.Value, error) { - return credentials.Value{}, c.Err -} -func (c credProviderError) IsExpired() bool { - return true -} - func initHandlers(s *Session) { // Add the Validate parameter handler if it is not disabled. s.Handlers.Validate.Remove(corehandlers.ValidateParametersHandler) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go index 7cb44021b..5170b4982 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go @@ -5,7 +5,6 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/internal/ini" ) @@ -28,8 +27,12 @@ const ( // endpoint discovery group enableEndpointDiscoveryKey = `endpoint_discovery_enabled` // optional + // External Credential Process - credentialProcessKey = `credential_process` + credentialProcessKey = `credential_process` // optional + + // Web Identity Token File + webIdentityTokenFileKey = `web_identity_token_file` // optional // DefaultSharedConfigProfile is the default profile to be used when // loading configuration from the config files if another profile name @@ -37,36 +40,33 @@ const ( DefaultSharedConfigProfile = `default` ) -type assumeRoleConfig struct { - RoleARN string - SourceProfile string - CredentialSource string - ExternalID string - MFASerial string - RoleSessionName string -} - // sharedConfig represents the configuration fields of the SDK config files. type sharedConfig struct { - // Credentials values from the config file. Both aws_access_key_id - // and aws_secret_access_key must be provided together in the same file - // to be considered valid. The values will be ignored if not a complete group. - // aws_session_token is an optional field that can be provided if both of the - // other two fields are also provided. + // Credentials values from the config file. Both aws_access_key_id and + // aws_secret_access_key must be provided together in the same file to be + // considered valid. The values will be ignored if not a complete group. + // aws_session_token is an optional field that can be provided if both of + // the other two fields are also provided. // // aws_access_key_id // aws_secret_access_key // aws_session_token Creds credentials.Value - AssumeRole assumeRoleConfig - AssumeRoleSource *sharedConfig + CredentialSource string + CredentialProcess string + WebIdentityTokenFile string - // An external process to request credentials - CredentialProcess string + RoleARN string + RoleSessionName string + ExternalID string + MFASerial string - // Region is the region the SDK should use for looking up AWS service endpoints - // and signing requests. + SourceProfileName string + SourceProfile *sharedConfig + + // Region is the region the SDK should use for looking up AWS service + // endpoints and signing requests. // // region Region string @@ -83,17 +83,18 @@ type sharedConfigFile struct { IniData ini.Sections } -// loadSharedConfig retrieves the configuration from the list of files -// using the profile provided. The order the files are listed will determine +// loadSharedConfig retrieves the configuration from the list of files using +// the profile provided. The order the files are listed will determine // precedence. Values in subsequent files will overwrite values defined in // earlier files. // // For example, given two files A and B. Both define credentials. If the order -// of the files are A then B, B's credential values will be used instead of A's. +// of the files are A then B, B's credential values will be used instead of +// A's. // // See sharedConfig.setFromFile for information how the config files // will be loaded. -func loadSharedConfig(profile string, filenames []string) (sharedConfig, error) { +func loadSharedConfig(profile string, filenames []string, exOpts bool) (sharedConfig, error) { if len(profile) == 0 { profile = DefaultSharedConfigProfile } @@ -104,16 +105,11 @@ func loadSharedConfig(profile string, filenames []string) (sharedConfig, error) } cfg := sharedConfig{} - if err = cfg.setFromIniFiles(profile, files); err != nil { + profiles := map[string]struct{}{} + if err = cfg.setFromIniFiles(profiles, profile, files, exOpts); err != nil { return sharedConfig{}, err } - if len(cfg.AssumeRole.SourceProfile) > 0 { - if err := cfg.setAssumeRoleSource(profile, files); err != nil { - return sharedConfig{}, err - } - } - return cfg, nil } @@ -137,60 +133,88 @@ func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { return files, nil } -func (cfg *sharedConfig) setAssumeRoleSource(origProfile string, files []sharedConfigFile) error { - var assumeRoleSrc sharedConfig - - if len(cfg.AssumeRole.CredentialSource) > 0 { - // setAssumeRoleSource is only called when source_profile is found. - // If both source_profile and credential_source are set, then - // ErrSharedConfigSourceCollision will be returned - return ErrSharedConfigSourceCollision - } - - // Multiple level assume role chains are not support - if cfg.AssumeRole.SourceProfile == origProfile { - assumeRoleSrc = *cfg - assumeRoleSrc.AssumeRole = assumeRoleConfig{} - } else { - err := assumeRoleSrc.setFromIniFiles(cfg.AssumeRole.SourceProfile, files) - if err != nil { - return err - } - } - - if len(assumeRoleSrc.Creds.AccessKeyID) == 0 { - return SharedConfigAssumeRoleError{RoleARN: cfg.AssumeRole.RoleARN} - } - - cfg.AssumeRoleSource = &assumeRoleSrc - - return nil -} - -func (cfg *sharedConfig) setFromIniFiles(profile string, files []sharedConfigFile) error { +func (cfg *sharedConfig) setFromIniFiles(profiles map[string]struct{}, profile string, files []sharedConfigFile, exOpts bool) error { // Trim files from the list that don't exist. + var skippedFiles int + var profileNotFoundErr error for _, f := range files { - if err := cfg.setFromIniFile(profile, f); err != nil { + if err := cfg.setFromIniFile(profile, f, exOpts); err != nil { if _, ok := err.(SharedConfigProfileNotExistsError); ok { - // Ignore proviles missings + // Ignore profiles not defined in individual files. + profileNotFoundErr = err + skippedFiles++ continue } return err } } + if skippedFiles == len(files) { + // If all files were skipped because the profile is not found, return + // the original profile not found error. + return profileNotFoundErr + } + + if _, ok := profiles[profile]; ok { + // if this is the second instance of the profile the Assume Role + // options must be cleared because they are only valid for the + // first reference of a profile. The self linked instance of the + // profile only have credential provider options. + cfg.clearAssumeRoleOptions() + } else { + // First time a profile has been seen, It must either be a assume role + // or credentials. Assert if the credential type requires a role ARN, + // the ARN is also set. + if err := cfg.validateCredentialsRequireARN(profile); err != nil { + return err + } + } + profiles[profile] = struct{}{} + + if err := cfg.validateCredentialType(); err != nil { + return err + } + + // Link source profiles for assume roles + if len(cfg.SourceProfileName) != 0 { + // Linked profile via source_profile ignore credential provider + // options, the source profile must provide the credentials. + cfg.clearCredentialOptions() + + srcCfg := &sharedConfig{} + err := srcCfg.setFromIniFiles(profiles, cfg.SourceProfileName, files, exOpts) + if err != nil { + // SourceProfile that doesn't exist is an error in configuration. + if _, ok := err.(SharedConfigProfileNotExistsError); ok { + err = SharedConfigAssumeRoleError{ + RoleARN: cfg.RoleARN, + SourceProfile: cfg.SourceProfileName, + } + } + return err + } + + if !srcCfg.hasCredentials() { + return SharedConfigAssumeRoleError{ + RoleARN: cfg.RoleARN, + SourceProfile: cfg.SourceProfileName, + } + } + + cfg.SourceProfile = srcCfg + } return nil } -// setFromFile loads the configuration from the file using -// the profile provided. A sharedConfig pointer type value is used so that -// multiple config file loadings can be chained. +// setFromFile loads the configuration from the file using the profile +// provided. A sharedConfig pointer type value is used so that multiple config +// file loadings can be chained. // // Only loads complete logically grouped values, and will not set fields in cfg -// for incomplete grouped values in the config. Such as credentials. For example -// if a config file only includes aws_access_key_id but no aws_secret_access_key -// the aws_access_key_id will be ignored. -func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile) error { +// for incomplete grouped values in the config. Such as credentials. For +// example if a config file only includes aws_access_key_id but no +// aws_secret_access_key the aws_access_key_id will be ignored. +func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile, exOpts bool) error { section, ok := file.IniData.GetSection(profile) if !ok { // Fallback to to alternate profile name: profile @@ -200,42 +224,30 @@ func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile) e } } + if exOpts { + // Assume Role Parameters + updateString(&cfg.RoleARN, section, roleArnKey) + updateString(&cfg.ExternalID, section, externalIDKey) + updateString(&cfg.MFASerial, section, mfaSerialKey) + updateString(&cfg.RoleSessionName, section, roleSessionNameKey) + updateString(&cfg.SourceProfileName, section, sourceProfileKey) + updateString(&cfg.CredentialSource, section, credentialSourceKey) + + updateString(&cfg.Region, section, regionKey) + } + + updateString(&cfg.CredentialProcess, section, credentialProcessKey) + updateString(&cfg.WebIdentityTokenFile, section, webIdentityTokenFileKey) + // Shared Credentials - akid := section.String(accessKeyIDKey) - secret := section.String(secretAccessKey) - if len(akid) > 0 && len(secret) > 0 { - cfg.Creds = credentials.Value{ - AccessKeyID: akid, - SecretAccessKey: secret, - SessionToken: section.String(sessionTokenKey), - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename), - } + creds := credentials.Value{ + AccessKeyID: section.String(accessKeyIDKey), + SecretAccessKey: section.String(secretAccessKey), + SessionToken: section.String(sessionTokenKey), + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename), } - - // Assume Role - roleArn := section.String(roleArnKey) - srcProfile := section.String(sourceProfileKey) - credentialSource := section.String(credentialSourceKey) - hasSource := len(srcProfile) > 0 || len(credentialSource) > 0 - if len(roleArn) > 0 && hasSource { - cfg.AssumeRole = assumeRoleConfig{ - RoleARN: roleArn, - SourceProfile: srcProfile, - CredentialSource: credentialSource, - ExternalID: section.String(externalIDKey), - MFASerial: section.String(mfaSerialKey), - RoleSessionName: section.String(roleSessionNameKey), - } - } - - // `credential_process` - if credProc := section.String(credentialProcessKey); len(credProc) > 0 { - cfg.CredentialProcess = credProc - } - - // Region - if v := section.String(regionKey); len(v) > 0 { - cfg.Region = v + if creds.HasKeys() { + cfg.Creds = creds } // Endpoint discovery @@ -247,6 +259,95 @@ func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile) e return nil } +func (cfg *sharedConfig) validateCredentialsRequireARN(profile string) error { + var credSource string + + switch { + case len(cfg.SourceProfileName) != 0: + credSource = sourceProfileKey + case len(cfg.CredentialSource) != 0: + credSource = credentialSourceKey + case len(cfg.WebIdentityTokenFile) != 0: + credSource = webIdentityTokenFileKey + } + + if len(credSource) != 0 && len(cfg.RoleARN) == 0 { + return CredentialRequiresARNError{ + Type: credSource, + Profile: profile, + } + } + + return nil +} + +func (cfg *sharedConfig) validateCredentialType() error { + // Only one or no credential type can be defined. + if !oneOrNone( + len(cfg.SourceProfileName) != 0, + len(cfg.CredentialSource) != 0, + len(cfg.CredentialProcess) != 0, + len(cfg.WebIdentityTokenFile) != 0, + ) { + return ErrSharedConfigSourceCollision + } + + return nil +} + +func (cfg *sharedConfig) hasCredentials() bool { + switch { + case len(cfg.SourceProfileName) != 0: + case len(cfg.CredentialSource) != 0: + case len(cfg.CredentialProcess) != 0: + case len(cfg.WebIdentityTokenFile) != 0: + case cfg.Creds.HasKeys(): + default: + return false + } + + return true +} + +func (cfg *sharedConfig) clearCredentialOptions() { + cfg.CredentialSource = "" + cfg.CredentialProcess = "" + cfg.WebIdentityTokenFile = "" + cfg.Creds = credentials.Value{} +} + +func (cfg *sharedConfig) clearAssumeRoleOptions() { + cfg.RoleARN = "" + cfg.ExternalID = "" + cfg.MFASerial = "" + cfg.RoleSessionName = "" + cfg.SourceProfileName = "" +} + +func oneOrNone(bs ...bool) bool { + var count int + + for _, b := range bs { + if b { + count++ + if count > 1 { + return false + } + } + } + + return true +} + +// updateString will only update the dst with the value in the section key, key +// is present in the section. +func updateString(dst *string, section ini.Section, key string) { + if !section.Has(key) { + return + } + *dst = section.String(key) +} + // SharedConfigLoadError is an error for the shared config file failed to load. type SharedConfigLoadError struct { Filename string @@ -304,7 +405,8 @@ func (e SharedConfigProfileNotExistsError) Error() string { // profile contains assume role information, but that information is invalid // or not complete. type SharedConfigAssumeRoleError struct { - RoleARN string + RoleARN string + SourceProfile string } // Code is the short id of the error. @@ -314,8 +416,10 @@ func (e SharedConfigAssumeRoleError) Code() string { // Message is the description of the error func (e SharedConfigAssumeRoleError) Message() string { - return fmt.Sprintf("failed to load assume role for %s, source profile has no shared credentials", - e.RoleARN) + return fmt.Sprintf( + "failed to load assume role for %s, source profile %s has no shared credentials", + e.RoleARN, e.SourceProfile, + ) } // OrigErr is the underlying error that caused the failure. @@ -327,3 +431,36 @@ func (e SharedConfigAssumeRoleError) OrigErr() error { func (e SharedConfigAssumeRoleError) Error() string { return awserr.SprintError(e.Code(), e.Message(), "", nil) } + +// CredentialRequiresARNError provides the error for shared config credentials +// that are incorrectly configured in the shared config or credentials file. +type CredentialRequiresARNError struct { + // type of credentials that were configured. + Type string + + // Profile name the credentials were in. + Profile string +} + +// Code is the short id of the error. +func (e CredentialRequiresARNError) Code() string { + return "CredentialRequiresARNError" +} + +// Message is the description of the error +func (e CredentialRequiresARNError) Message() string { + return fmt.Sprintf( + "credential type %s requires role_arn, profile %s", + e.Type, e.Profile, + ) +} + +// OrigErr is the underlying error that caused the failure. +func (e CredentialRequiresARNError) OrigErr() error { + return nil +} + +// Error satisfies the error interface. +func (e CredentialRequiresARNError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", nil) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go index 523db79f8..8104793aa 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go @@ -687,7 +687,11 @@ func (ctx *signingCtx) buildBodyDigest() error { if !aws.IsReaderSeekable(ctx.Body) { return fmt.Errorf("cannot use unseekable request body %T, for signed request with body", ctx.Body) } - hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) + hashBytes, err := makeSha256Reader(ctx.Body) + if err != nil { + return err + } + hash = hex.EncodeToString(hashBytes) } if includeSHA256Header { @@ -734,10 +738,16 @@ func makeSha256(data []byte) []byte { return hash.Sum(nil) } -func makeSha256Reader(reader io.ReadSeeker) []byte { +func makeSha256Reader(reader io.ReadSeeker) (hashBytes []byte, err error) { hash := sha256.New() - start, _ := reader.Seek(0, sdkio.SeekCurrent) - defer reader.Seek(start, sdkio.SeekStart) + start, err := reader.Seek(0, sdkio.SeekCurrent) + if err != nil { + return nil, err + } + defer func() { + // ensure error is return if unable to seek back to start of payload. + _, err = reader.Seek(start, sdkio.SeekStart) + }() // Use CopyN to avoid allocating the 32KB buffer in io.Copy for bodies // smaller than 32KB. Fall back to io.Copy if we fail to determine the size. @@ -748,7 +758,7 @@ func makeSha256Reader(reader io.ReadSeeker) []byte { io.CopyN(hash, reader, size) } - return hash.Sum(nil) + return hash.Sum(nil), nil } const doubleSpace = " " diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types.go b/vendor/github.com/aws/aws-sdk-go/aws/types.go index 8b6f23425..455091540 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/types.go @@ -7,13 +7,18 @@ import ( "github.com/aws/aws-sdk-go/internal/sdkio" ) -// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Should -// only be used with an io.Reader that is also an io.Seeker. Doing so may -// cause request signature errors, or request body's not sent for GET, HEAD -// and DELETE HTTP methods. +// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Allows the +// SDK to accept an io.Reader that is not also an io.Seeker for unsigned +// streaming payload API operations. // -// Deprecated: Should only be used with io.ReadSeeker. If using for -// S3 PutObject to stream content use s3manager.Uploader instead. +// A ReadSeekCloser wrapping an nonseekable io.Reader used in an API +// operation's input will prevent that operation being retried in the case of +// network errors, and cause operation requests to fail if the operation +// requires payload signing. +// +// Note: If using With S3 PutObject to stream an object upload The SDK's S3 +// Upload manager (s3manager.Uploader) provides support for streaming with the +// ability to retry network errors. func ReadSeekCloser(r io.Reader) ReaderSeekerCloser { return ReaderSeekerCloser{r} } @@ -43,7 +48,8 @@ func IsReaderSeekable(r io.Reader) bool { // Read reads from the reader up to size of p. The number of bytes read, and // error if it occurred will be returned. // -// If the reader is not an io.Reader zero bytes read, and nil error will be returned. +// If the reader is not an io.Reader zero bytes read, and nil error will be +// returned. // // Performs the same functionality as io.Reader Read func (r ReaderSeekerCloser) Read(p []byte) (int, error) { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 8bfe6c294..b4fc0ded4 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.16.24" +const SDKVersion = "1.22.2" diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go index f99703372..e56dcee2f 100644 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go @@ -304,7 +304,9 @@ loop: stmt := newCommentStatement(tok) stack.Push(stmt) default: - return nil, NewParseError(fmt.Sprintf("invalid state with ASTKind %v and TokenType %v", k, tok)) + return nil, NewParseError( + fmt.Sprintf("invalid state with ASTKind %v and TokenType %v", + k, tok.Type())) } if len(tokens) > 0 { @@ -314,7 +316,7 @@ loop: // this occurs when a statement has not been completed if stack.top > 1 { - return nil, NewParseError(fmt.Sprintf("incomplete expression: %v", stack.container)) + return nil, NewParseError(fmt.Sprintf("incomplete ini expression")) } // returns a sublist which excludes the start symbol diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go index 3104e6ce4..50c5ed760 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go @@ -21,7 +21,8 @@ func Build(r *request.Request) { "Version": {r.ClientInfo.APIVersion}, } if err := queryutil.Parse(body, r.Params, true); err != nil { - r.Error = awserr.New("SerializationError", "failed encoding EC2 Query request", err) + r.Error = awserr.New(request.ErrCodeSerialization, + "failed encoding EC2 Query request", err) } if !r.IsPresigned() { diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go index 5793c0473..105d732f9 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go @@ -4,7 +4,6 @@ package ec2query import ( "encoding/xml" - "io" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" @@ -28,7 +27,8 @@ func Unmarshal(r *request.Request) { err := xmlutil.UnmarshalXML(r.Data, decoder, "") if err != nil { r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", "failed decoding EC2 Query response", err), + awserr.New(request.ErrCodeSerialization, + "failed decoding EC2 Query response", err), r.HTTPResponse.StatusCode, r.RequestID, ) @@ -39,7 +39,11 @@ func Unmarshal(r *request.Request) { // UnmarshalMeta unmarshals response headers for the EC2 protocol. func UnmarshalMeta(r *request.Request) { - // TODO implement unmarshaling of request IDs + r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") + if r.RequestID == "" { + // Alternative version of request id in the header + r.RequestID = r.HTTPResponse.Header.Get("X-Amz-Request-Id") + } } type xmlErrorResponse struct { @@ -53,19 +57,21 @@ type xmlErrorResponse struct { func UnmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() - resp := &xmlErrorResponse{} - err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) - if err != nil && err != io.EOF { + var respErr xmlErrorResponse + err := xmlutil.UnmarshalXMLError(&respErr, r.HTTPResponse.Body) + if err != nil { r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", "failed decoding EC2 Query error response", err), + awserr.New(request.ErrCodeSerialization, + "failed to unmarshal error message", err), r.HTTPResponse.StatusCode, r.RequestID, ) - } else { - r.Error = awserr.NewRequestFailure( - awserr.New(resp.Code, resp.Message, nil), - r.HTTPResponse.StatusCode, - resp.RequestID, - ) + return } + + r.Error = awserr.NewRequestFailure( + awserr.New(respErr.Code, respErr.Message, nil), + r.HTTPResponse.StatusCode, + respErr.RequestID, + ) } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go index b11f3ee45..ea0da79a5 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go @@ -1,6 +1,7 @@ package jsonutil import ( + "bytes" "encoding/base64" "encoding/json" "fmt" @@ -9,9 +10,30 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/private/protocol" ) +// UnmarshalJSONError unmarshal's the reader's JSON document into the passed in +// type. The value to unmarshal the json document into must be a pointer to the +// type. +func UnmarshalJSONError(v interface{}, stream io.Reader) error { + var errBuf bytes.Buffer + body := io.TeeReader(stream, &errBuf) + + err := json.NewDecoder(body).Decode(v) + if err != nil { + msg := "failed decoding error message" + if err == io.EOF { + msg = "error message missing" + err = nil + } + return awserr.NewUnmarshalError(err, msg, errBuf.Bytes()) + } + + return nil +} + // UnmarshalJSON reads a stream and unmarshals the results in object v. func UnmarshalJSON(v interface{}, stream io.Reader) error { var out interface{} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go index 9a7ba27ad..bfedc9fd4 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go @@ -6,8 +6,6 @@ package jsonrpc //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/json.json unmarshal_test.go import ( - "encoding/json" - "io" "strings" "github.com/aws/aws-sdk-go/aws/awserr" @@ -37,7 +35,7 @@ func Build(req *request.Request) { if req.ParamsFilled() { buf, err = jsonutil.BuildJSON(req.Params) if err != nil { - req.Error = awserr.New("SerializationError", "failed encoding JSON RPC request", err) + req.Error = awserr.New(request.ErrCodeSerialization, "failed encoding JSON RPC request", err) return } } else { @@ -52,9 +50,12 @@ func Build(req *request.Request) { target := req.ClientInfo.TargetPrefix + "." + req.Operation.Name req.HTTPRequest.Header.Add("X-Amz-Target", target) } - if req.ClientInfo.JSONVersion != "" { + + // Only set the content type if one is not already specified and an + // JSONVersion is specified. + if ct, v := req.HTTPRequest.Header.Get("Content-Type"), req.ClientInfo.JSONVersion; len(ct) == 0 && len(v) != 0 { jsonVersion := req.ClientInfo.JSONVersion - req.HTTPRequest.Header.Add("Content-Type", "application/x-amz-json-"+jsonVersion) + req.HTTPRequest.Header.Set("Content-Type", "application/x-amz-json-"+jsonVersion) } } @@ -65,7 +66,7 @@ func Unmarshal(req *request.Request) { err := jsonutil.UnmarshalJSON(req.Data, req.HTTPResponse.Body) if err != nil { req.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", "failed decoding JSON RPC response", err), + awserr.New(request.ErrCodeSerialization, "failed decoding JSON RPC response", err), req.HTTPResponse.StatusCode, req.RequestID, ) @@ -84,17 +85,11 @@ func UnmarshalError(req *request.Request) { defer req.HTTPResponse.Body.Close() var jsonErr jsonErrorResponse - err := json.NewDecoder(req.HTTPResponse.Body).Decode(&jsonErr) - if err == io.EOF { + err := jsonutil.UnmarshalJSONError(&jsonErr, req.HTTPResponse.Body) + if err != nil { req.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", req.HTTPResponse.Status, nil), - req.HTTPResponse.StatusCode, - req.RequestID, - ) - return - } else if err != nil { - req.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", "failed decoding JSON RPC error response", err), + awserr.New(request.ErrCodeSerialization, + "failed to unmarshal error message", err), req.HTTPResponse.StatusCode, req.RequestID, ) diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go index 60e5b09d5..0cb99eb57 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go @@ -21,7 +21,7 @@ func Build(r *request.Request) { "Version": {r.ClientInfo.APIVersion}, } if err := queryutil.Parse(body, r.Params, false); err != nil { - r.Error = awserr.New("SerializationError", "failed encoding Query request", err) + r.Error = awserr.New(request.ErrCodeSerialization, "failed encoding Query request", err) return } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go index 3495c7307..f69c1efc9 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go @@ -24,7 +24,7 @@ func Unmarshal(r *request.Request) { err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") if err != nil { r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", "failed decoding Query response", err), + awserr.New(request.ErrCodeSerialization, "failed decoding Query response", err), r.HTTPResponse.StatusCode, r.RequestID, ) diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go index 46d354e82..831b0110c 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go @@ -2,73 +2,68 @@ package query import ( "encoding/xml" - "io/ioutil" + "fmt" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" ) -type xmlErrorResponse struct { - XMLName xml.Name `xml:"ErrorResponse"` - Code string `xml:"Error>Code"` - Message string `xml:"Error>Message"` - RequestID string `xml:"RequestId"` -} - -type xmlServiceUnavailableResponse struct { - XMLName xml.Name `xml:"ServiceUnavailableException"` -} - // UnmarshalErrorHandler is a name request handler to unmarshal request errors var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} +type xmlErrorResponse struct { + Code string `xml:"Error>Code"` + Message string `xml:"Error>Message"` + RequestID string `xml:"RequestId"` +} + +type xmlResponseError struct { + xmlErrorResponse +} + +func (e *xmlResponseError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + const svcUnavailableTagName = "ServiceUnavailableException" + const errorResponseTagName = "ErrorResponse" + + switch start.Name.Local { + case svcUnavailableTagName: + e.Code = svcUnavailableTagName + e.Message = "service is unavailable" + return d.Skip() + + case errorResponseTagName: + return d.DecodeElement(&e.xmlErrorResponse, &start) + + default: + return fmt.Errorf("unknown error response tag, %v", start) + } +} + // UnmarshalError unmarshals an error response for an AWS Query service. func UnmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() - bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) + var respErr xmlResponseError + err := xmlutil.UnmarshalXMLError(&respErr, r.HTTPResponse.Body) if err != nil { r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", "failed to read from query HTTP response body", err), + awserr.New(request.ErrCodeSerialization, + "failed to unmarshal error message", err), r.HTTPResponse.StatusCode, r.RequestID, ) return } - // First check for specific error - resp := xmlErrorResponse{} - decodeErr := xml.Unmarshal(bodyBytes, &resp) - if decodeErr == nil { - reqID := resp.RequestID - if reqID == "" { - reqID = r.RequestID - } - r.Error = awserr.NewRequestFailure( - awserr.New(resp.Code, resp.Message, nil), - r.HTTPResponse.StatusCode, - reqID, - ) - return + reqID := respErr.RequestID + if len(reqID) == 0 { + reqID = r.RequestID } - // Check for unhandled error - servUnavailResp := xmlServiceUnavailableResponse{} - unavailErr := xml.Unmarshal(bodyBytes, &servUnavailResp) - if unavailErr == nil { - r.Error = awserr.NewRequestFailure( - awserr.New("ServiceUnavailableException", "service is unavailable", nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } - - // Failed to retrieve any error message from the response body r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", - "failed to decode query XML error response", decodeErr), + awserr.New(respErr.Code, respErr.Message, nil), r.HTTPResponse.StatusCode, - r.RequestID, + reqID, ) } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go index b34f5258a..1301b149d 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go @@ -25,6 +25,8 @@ var noEscape [256]bool var errValueNotSet = fmt.Errorf("value not set") +var byteSliceType = reflect.TypeOf([]byte{}) + func init() { for i := 0; i < len(noEscape); i++ { // AWS expects every character except these to be escaped @@ -94,6 +96,14 @@ func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bo continue } + // Support the ability to customize values to be marshaled as a + // blob even though they were modeled as a string. Required for S3 + // API operations like SSECustomerKey is modeled as stirng but + // required to be base64 encoded in request. + if field.Tag.Get("marshal-as") == "blob" { + m = m.Convert(byteSliceType) + } + var err error switch field.Tag.Get("location") { case "headers": // header maps @@ -137,7 +147,7 @@ func buildBody(r *request.Request, v reflect.Value) { case string: r.SetStringBody(reader) default: - r.Error = awserr.New("SerializationError", + r.Error = awserr.New(request.ErrCodeSerialization, "failed to encode REST request", fmt.Errorf("unknown payload type %s", payload.Type())) } @@ -152,9 +162,12 @@ func buildHeader(header *http.Header, v reflect.Value, name string, tag reflect. if err == errValueNotSet { return nil } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) + return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) } + name = strings.TrimSpace(name) + str = strings.TrimSpace(str) + header.Add(name, str) return nil @@ -167,11 +180,13 @@ func buildHeaderMap(header *http.Header, v reflect.Value, tag reflect.StructTag) if err == errValueNotSet { continue } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) + return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) } + keyStr := strings.TrimSpace(key.String()) + str = strings.TrimSpace(str) - header.Add(prefix+key.String(), str) + header.Add(prefix+keyStr, str) } return nil } @@ -181,7 +196,7 @@ func buildURI(u *url.URL, v reflect.Value, name string, tag reflect.StructTag) e if err == errValueNotSet { return nil } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) + return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) } u.Path = strings.Replace(u.Path, "{"+name+"}", value, -1) @@ -214,7 +229,7 @@ func buildQueryString(query url.Values, v reflect.Value, name string, tag reflec if err == errValueNotSet { return nil } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) + return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) } query.Set(name, str) } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go index 33fd53b12..de021367d 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go @@ -57,7 +57,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { defer r.HTTPResponse.Body.Close() b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) } else { payload.Set(reflect.ValueOf(b)) } @@ -65,7 +65,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { defer r.HTTPResponse.Body.Close() b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) } else { str := string(b) payload.Set(reflect.ValueOf(&str)) @@ -77,7 +77,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { case "io.ReadSeeker": b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { - r.Error = awserr.New("SerializationError", + r.Error = awserr.New(request.ErrCodeSerialization, "failed to read response body", err) return } @@ -85,7 +85,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { default: io.Copy(ioutil.Discard, r.HTTPResponse.Body) defer r.HTTPResponse.Body.Close() - r.Error = awserr.New("SerializationError", + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", fmt.Errorf("unknown payload type %s", payload.Type())) } @@ -115,14 +115,14 @@ func unmarshalLocationElements(r *request.Request, v reflect.Value) { case "header": err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name), field.Tag) if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) break } case "headers": prefix := field.Tag.Get("locationName") err := unmarshalHeaderMap(m, r.HTTPResponse.Header, prefix) if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) break } } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go index b0f4e2456..cf569645d 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go @@ -37,7 +37,8 @@ func Build(r *request.Request) { err := xmlutil.BuildXML(r.Params, xml.NewEncoder(&buf)) if err != nil { r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", "failed to encode rest XML request", err), + awserr.New(request.ErrCodeSerialization, + "failed to encode rest XML request", err), r.HTTPResponse.StatusCode, r.RequestID, ) @@ -55,7 +56,8 @@ func Unmarshal(r *request.Request) { err := xmlutil.UnmarshalXML(r.Data, decoder, "") if err != nil { r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", "failed to decode REST XML response", err), + awserr.New(request.ErrCodeSerialization, + "failed to decode REST XML response", err), r.HTTPResponse.StatusCode, r.RequestID, ) diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go index ff1ef6830..7108d3800 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go @@ -1,6 +1,7 @@ package xmlutil import ( + "bytes" "encoding/base64" "encoding/xml" "fmt" @@ -10,9 +11,27 @@ import ( "strings" "time" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/private/protocol" ) +// UnmarshalXMLError unmarshals the XML error from the stream into the value +// type specified. The value must be a pointer. If the message fails to +// unmarshal, the message content will be included in the returned error as a +// awserr.UnmarshalError. +func UnmarshalXMLError(v interface{}, stream io.Reader) error { + var errBuf bytes.Buffer + body := io.TeeReader(stream, &errBuf) + + err := xml.NewDecoder(body).Decode(v) + if err != nil && err != io.EOF { + return awserr.NewUnmarshalError(err, + "failed to unmarshal error message", errBuf.Bytes()) + } + + return nil +} + // UnmarshalXML deserializes an xml.Decoder into the container v. V // needs to match the shape of the XML expected to be decoded. // If the shape doesn't match unmarshaling will fail. diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go index 8ccb729e5..0385cb15b 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -290,8 +290,8 @@ func (c *EC2) AcceptVpcPeeringConnectionRequest(input *AcceptVpcPeeringConnectio // of the peer VPC. Use DescribeVpcPeeringConnections to view your outstanding // VPC peering connection requests. // -// For an inter-region VPC peering connection request, you must accept the VPC -// peering connection in the region of the accepter VPC. +// For an inter-Region VPC peering connection request, you must accept the VPC +// peering connection in the Region of the accepter VPC. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -463,7 +463,7 @@ func (c *EC2) AllocateAddressRequest(input *AllocateAddressInput) (req *request. // or from an address pool created from a public IPv4 address range that you // have brought to AWS for use with your AWS resources using bring your own // IP addresses (BYOIP). For more information, see Bring Your Own IP Addresses -// (BYOIP) (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-byoip.html) +// (BYOIP) (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-byoip.html) // in the Amazon Elastic Compute Cloud User Guide. // // [EC2-VPC] If you release an Elastic IP address, you might be able to recover @@ -474,9 +474,9 @@ func (c *EC2) AllocateAddressRequest(input *AllocateAddressInput) (req *request. // // An Elastic IP address is for use either in the EC2-Classic platform or in // a VPC. By default, you can allocate 5 Elastic IP addresses for EC2-Classic -// per region and 5 Elastic IP addresses for EC2-VPC per region. +// per Region and 5 Elastic IP addresses for EC2-VPC per Region. // -// For more information, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// For more information, see Elastic IP Addresses (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -708,7 +708,7 @@ func (c *EC2) AssignIpv6AddressesRequest(input *AssignIpv6AddressesInput) (req * // CIDR block range. You can assign as many IPv6 addresses to a network interface // as you can assign private IPv4 addresses, and the limit varies per instance // type. For information, see IP Addresses Per Network Interface Per Instance -// Type (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) +// Type (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -778,7 +778,6 @@ func (c *EC2) AssignPrivateIpAddressesRequest(input *AssignPrivateIpAddressesInp output = &AssignPrivateIpAddressesOutput{} req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(ec2query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } @@ -791,9 +790,9 @@ func (c *EC2) AssignPrivateIpAddressesRequest(input *AssignPrivateIpAddressesInp // the number of secondary IP addresses to be automatically assigned within // the subnet's CIDR block range. The number of secondary IP addresses that // you can assign to an instance varies by instance type. For information about -// instance types, see Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) +// instance types, see Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) // in the Amazon Elastic Compute Cloud User Guide. For more information about -// Elastic IP addresses, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// Elastic IP addresses, see Elastic IP Addresses (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) // in the Amazon Elastic Compute Cloud User Guide. // // When you move a secondary private IP address to another network interface, @@ -879,7 +878,7 @@ func (c *EC2) AssociateAddressRequest(input *AssociateAddressInput) (req *reques // Before you can use an Elastic IP address, you must allocate it to your account. // // An Elastic IP address is for use in either the EC2-Classic platform or in -// a VPC. For more information, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// a VPC. For more information, see Elastic IP Addresses (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) // in the Amazon Elastic Compute Cloud User Guide. // // [EC2-Classic, VPC in an EC2-VPC-only account] If the Elastic IP address is @@ -1062,7 +1061,7 @@ func (c *EC2) AssociateDhcpOptionsRequest(input *AssociateDhcpOptionsInput) (req // its DHCP lease. You can explicitly renew the lease using the operating system // on the instance. // -// For more information, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) +// For more information, see DHCP Options Sets (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_DHCP_Options.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1218,7 +1217,7 @@ func (c *EC2) AssociateRouteTableRequest(input *AssociateRouteTableInput) (req * // an association ID, which you need in order to disassociate the route table // from the subnet later. A route table can be associated with multiple subnets. // -// For more information, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// For more information, see Route Tables (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1449,7 +1448,7 @@ func (c *EC2) AssociateVpcCidrBlockRequest(input *AssociateVpcCidrBlockInput) (r // IPv6 CIDR block size is fixed at /56. // // For more information about associating CIDR blocks with your VPC and applicable -// restrictions, see VPC and Subnet Sizing (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html#VPC_Sizing) +// restrictions, see VPC and Subnet Sizing (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html#VPC_Sizing) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1612,7 +1611,7 @@ func (c *EC2) AttachInternetGatewayRequest(input *AttachInternetGatewayInput) (r // // Attaches an internet gateway to a VPC, enabling connectivity between the // internet and the VPC. For more information about your VPC and internet gateway, -// see the Amazon Virtual Private Cloud User Guide (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/). +// see the Amazon Virtual Private Cloud User Guide (https://docs.aws.amazon.com/vpc/latest/userguide/). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1763,15 +1762,12 @@ func (c *EC2) AttachVolumeRequest(input *AttachVolumeInput) (req *request.Reques // Attaches an EBS volume to a running or stopped instance and exposes it to // the instance with the specified device name. // -// Encrypted EBS volumes may only be attached to instances that support Amazon -// EBS encryption. For more information, see Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// Encrypted EBS volumes must be attached to instances that support Amazon EBS +// encryption. For more information, see Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) // in the Amazon Elastic Compute Cloud User Guide. // -// For a list of supported device names, see Attaching an EBS Volume to an Instance -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html). -// Any device names that aren't reserved for instance store volumes can be used -// for EBS volumes. For more information, see Amazon EC2 Instance Store (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html) -// in the Amazon Elastic Compute Cloud User Guide. +// After you attach an EBS volume, you must make it available. For more information, +// see Making an EBS Volume Available For Use (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html). // // If a volume has an AWS Marketplace product code: // @@ -1785,8 +1781,7 @@ func (c *EC2) AttachVolumeRequest(input *AttachVolumeInput) (req *request.Reques // the product. For example, you can't detach a volume from a Windows instance // and attach it to a Linux instance. // -// For more information about EBS volumes, see Attaching Amazon EBS Volumes -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html) +// For more information, see Attaching Amazon EBS Volumes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1864,8 +1859,8 @@ func (c *EC2) AttachVpnGatewayRequest(input *AttachVpnGatewayInput) (req *reques // Attaches a virtual private gateway to a VPC. You can attach one virtual private // gateway to one VPC at a time. // -// For more information, see AWS Managed VPN Connections (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. +// For more information, see AWS Site-to-Site VPN (https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html) +// in the AWS Site-to-Site VPN User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2017,25 +2012,24 @@ func (c *EC2) AuthorizeSecurityGroupEgressRequest(input *AuthorizeSecurityGroupE // AuthorizeSecurityGroupEgress API operation for Amazon Elastic Compute Cloud. // -// [EC2-VPC only] Adds one or more egress rules to a security group for use -// with a VPC. Specifically, this action permits instances to send traffic to -// one or more destination IPv4 or IPv6 CIDR address ranges, or to one or more -// destination security groups for the same VPC. This action doesn't apply to -// security groups for use in EC2-Classic. For more information, see Security -// Groups for Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) -// in the Amazon Virtual Private Cloud User Guide. For more information about -// security group limits, see Amazon VPC Limits (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Appendix_Limits.html). +// [VPC only] Adds the specified egress rules to a security group for use with +// a VPC. // -// Each rule consists of the protocol (for example, TCP), plus either a CIDR -// range or a source group. For the TCP and UDP protocols, you must also specify -// the destination port or port range. For the ICMP protocol, you must also -// specify the ICMP type and code. You can use -1 for the type or code to mean -// all types or all codes. You can optionally specify a description for the -// rule. +// An outbound rule permits instances to send traffic to the specified IPv4 +// or IPv6 CIDR address ranges, or to the instances associated with the specified +// destination security groups. +// +// You specify a protocol for each rule (for example, TCP). For the TCP and +// UDP protocols, you must also specify the destination port or port range. +// For the ICMP protocol, you must also specify the ICMP type and code. You +// can use -1 for the type or code to mean all types or all codes. // // Rule changes are propagated to affected instances as quickly as possible. // However, a small delay might occur. // +// For more information about VPC security group limits, see Amazon VPC Limits +// (https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2109,25 +2103,22 @@ func (c *EC2) AuthorizeSecurityGroupIngressRequest(input *AuthorizeSecurityGroup // AuthorizeSecurityGroupIngress API operation for Amazon Elastic Compute Cloud. // -// Adds one or more ingress rules to a security group. +// Adds the specified ingress rules to a security group. +// +// An inbound rule permits instances to receive traffic from the specified IPv4 +// or IPv6 CIDR address ranges, or from the instances associated with the specified +// destination security groups. +// +// You specify a protocol for each rule (for example, TCP). For TCP and UDP, +// you must also specify the destination port or port range. For ICMP/ICMPv6, +// you must also specify the ICMP/ICMPv6 type and code. You can use -1 to mean +// all types or all codes. // // Rule changes are propagated to instances within the security group as quickly // as possible. However, a small delay might occur. // -// [EC2-Classic] This action gives one or more IPv4 CIDR address ranges permission -// to access a security group in your account, or gives one or more security -// groups (called the source groups) permission to access a security group for -// your account. A source group can be for your own AWS account, or another. -// You can have up to 100 rules per group. -// -// [EC2-VPC] This action gives one or more IPv4 or IPv6 CIDR address ranges -// permission to access a security group in your VPC, or gives one or more other -// security groups (called the source groups) permission to access a security -// group for your VPC. The security groups must all be for the same VPC or a -// peer VPC in a VPC peering connection. For more information about VPC security -// group limits, see Amazon VPC Limits (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Appendix_Limits.html). -// -// You can optionally specify a description for the security group rule. +// For more information about VPC security group limits, see Amazon VPC Limits +// (https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2444,7 +2435,7 @@ func (c *EC2) CancelConversionTaskRequest(input *CancelConversionTaskInput) (req // and returns an exception. // // For more information, see Importing a Virtual Machine Using the Amazon EC2 -// CLI (http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ec2-cli-vmimport-export.html). +// CLI (https://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ec2-cli-vmimport-export.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2673,7 +2664,7 @@ func (c *EC2) CancelReservedInstancesListingRequest(input *CancelReservedInstanc // Cancels the specified Reserved Instance listing in the Reserved Instance // Marketplace. // -// For more information, see Reserved Instance Marketplace (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) +// For more information, see Reserved Instance Marketplace (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -2982,7 +2973,7 @@ func (c *EC2) CopyFpgaImageRequest(input *CopyFpgaImageInput) (req *request.Requ // CopyFpgaImage API operation for Amazon Elastic Compute Cloud. // -// Copies the specified Amazon FPGA Image (AFI) to the current region. +// Copies the specified Amazon FPGA Image (AFI) to the current Region. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3056,8 +3047,8 @@ func (c *EC2) CopyImageRequest(input *CopyImageInput) (req *request.Request, out // CopyImage API operation for Amazon Elastic Compute Cloud. // -// Initiates the copy of an AMI from the specified source region to the current -// region. You specify the destination region by using its endpoint when making +// Initiates the copy of an AMI from the specified source Region to the current +// Region. You specify the destination Region by using its endpoint when making // the request. // // Copies of encrypted backing snapshots for the AMI are encrypted. Copies of @@ -3066,7 +3057,7 @@ func (c *EC2) CopyImageRequest(input *CopyImageInput) (req *request.Request, out // backing snapshot. // // For more information about the prerequisites and limits when copying an AMI, -// see Copying an AMI (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html) +// see Copying an AMI (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3142,16 +3133,15 @@ func (c *EC2) CopySnapshotRequest(input *CopySnapshotInput) (req *request.Reques // CopySnapshot API operation for Amazon Elastic Compute Cloud. // // Copies a point-in-time snapshot of an EBS volume and stores it in Amazon -// S3. You can copy the snapshot within the same region or from one region to +// S3. You can copy the snapshot within the same Region or from one Region to // another. You can use the snapshot to create EBS volumes or Amazon Machine -// Images (AMIs). The snapshot is copied to the regional endpoint that you send -// the HTTP request to. +// Images (AMIs). // // Copies of encrypted EBS snapshots remain encrypted. Copies of unencrypted -// snapshots remain unencrypted, unless the Encrypted flag is specified during -// the snapshot copy operation. By default, encrypted snapshot copies use the -// default AWS Key Management Service (AWS KMS) customer master key (CMK); however, -// you can specify a non-default CMK with the KmsKeyId parameter. +// snapshots remain unencrypted, unless you enable encryption for the snapshot +// copy operation. By default, encrypted snapshot copies use the default AWS +// Key Management Service (AWS KMS) customer master key (CMK); however, you +// can specify a different CMK. // // To copy an encrypted snapshot that has been shared from another account, // you must have permissions for the CMK used to encrypt the snapshot. @@ -3159,7 +3149,7 @@ func (c *EC2) CopySnapshotRequest(input *CopySnapshotInput) (req *request.Reques // Snapshots created by copying another snapshot have an arbitrary volume ID // that should not be used for any purpose. // -// For more information, see Copying an Amazon EBS Snapshot (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-copy-snapshot.html) +// For more information, see Copying an Amazon EBS Snapshot (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-copy-snapshot.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3242,7 +3232,7 @@ func (c *EC2) CreateCapacityReservationRequest(input *CreateCapacityReservationI // Regional RI discounts for that usage. By creating Capacity Reservations, // you ensure that you always have access to Amazon EC2 capacity when you need // it, for as long as you need it. For more information, see Capacity Reservations -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-capacity-reservations.html) +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-capacity-reservations.html) // in the Amazon Elastic Compute Cloud User Guide. // // Your request to create a Capacity Reservation could fail if Amazon EC2 does @@ -3256,7 +3246,7 @@ func (c *EC2) CreateCapacityReservationRequest(input *CreateCapacityReservationI // Instance limit for the selected instance type. If your request fails due // to limit constraints, increase your On-Demand Instance limit for the required // instance type and try again. For more information about increasing your instance -// limits, see Amazon EC2 Service Limits (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-resource-limits.html) +// limits, see Amazon EC2 Service Limits (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-resource-limits.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3409,8 +3399,8 @@ func (c *EC2) CreateClientVpnRouteRequest(input *CreateClientVpnRouteInput) (req // // Adds a route to a network to a Client VPN endpoint. Each Client VPN endpoint // has a route table that describes the available destination network routes. -// Each route in the route table specifies the path for traffic to specific resources -// or networks. +// Each route in the route table specifies the path for traffic to specific +// resources or networks. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3497,12 +3487,11 @@ func (c *EC2) CreateCustomerGatewayRequest(input *CreateCustomerGatewayInput) (r // a private ASN (in the 64512 - 65534 range). // // Amazon EC2 supports all 2-byte ASN numbers in the range of 1 - 65534, with -// the exception of 7224, which is reserved in the us-east-1 region, and 9059, -// which is reserved in the eu-west-1 region. +// the exception of 7224, which is reserved in the us-east-1 Region, and 9059, +// which is reserved in the eu-west-1 Region. // -// For more information about VPN customer gateways, see AWS Managed VPN Connections -// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) in the -// Amazon Virtual Private Cloud User Guide. +// For more information, see AWS Site-to-Site VPN (https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html) +// in the AWS Site-to-Site VPN User Guide. // // You cannot create more than one customer gateway with the same VPN type, // IP address, and BGP ASN parameter values. If you run an identical request @@ -3585,7 +3574,7 @@ func (c *EC2) CreateDefaultSubnetRequest(input *CreateDefaultSubnetInput) (req * // Creates a default subnet with a size /20 IPv4 CIDR block in the specified // Availability Zone in your default VPC. You can have only one default subnet // per Availability Zone. For more information, see Creating a Default Subnet -// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html#create-default-subnet) +// (https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html#create-default-subnet) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3662,7 +3651,7 @@ func (c *EC2) CreateDefaultVpcRequest(input *CreateDefaultVpcInput) (req *reques // // Creates a default VPC with a size /16 IPv4 CIDR block and a default subnet // in each Availability Zone. For more information about the components of a -// default VPC, see Default VPC and Default Subnets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) +// default VPC, see Default VPC and Default Subnets (https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html) // in the Amazon Virtual Private Cloud User Guide. You cannot specify the components // of the default VPC yourself. // @@ -3755,12 +3744,12 @@ func (c *EC2) CreateDhcpOptionsRequest(input *CreateDhcpOptionsInput) (req *requ // * domain-name-servers - The IP addresses of up to four domain name servers, // or AmazonProvidedDNS. The default DHCP option set specifies AmazonProvidedDNS. // If specifying more than one domain name server, specify the IP addresses -// in a single parameter, separated by commas. ITo have your instance to -// receive a custom DNS hostname as specified in domain-name, you must set -// domain-name-servers to a custom DNS server. +// in a single parameter, separated by commas. To have your instance receive +// a custom DNS hostname as specified in domain-name, you must set domain-name-servers +// to a custom DNS server. // // * domain-name - If you're using AmazonProvidedDNS in us-east-1, specify -// ec2.internal. If you're using AmazonProvidedDNS in another region, specify +// ec2.internal. If you're using AmazonProvidedDNS in another Region, specify // region.compute.internal (for example, ap-northeast-1.compute.internal). // Otherwise, specify a domain name (for example, MyCompany.com). This value // is used to complete unqualified DNS hostnames. Important: Some Linux operating @@ -3783,7 +3772,7 @@ func (c *EC2) CreateDhcpOptionsRequest(input *CreateDhcpOptionsInput) (req *requ // only a DNS server that we provide (AmazonProvidedDNS). If you create a set // of options, and if your VPC has an internet gateway, make sure to set the // domain-name-servers option either to AmazonProvidedDNS or to a domain name -// server of your choice. For more information, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) +// server of your choice. For more information, see DHCP Options Sets (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_DHCP_Options.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3940,7 +3929,7 @@ func (c *EC2) CreateFleetRequest(input *CreateFleetInput) (req *request.Request, // You can create a single EC2 Fleet that includes multiple launch specifications // that vary by instance type, AMI, Availability Zone, or subnet. // -// For more information, see Launching an EC2 Fleet (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet.html) +// For more information, see Launching an EC2 Fleet (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4020,7 +4009,7 @@ func (c *EC2) CreateFlowLogsRequest(input *CreateFlowLogsInput) (req *request.Re // // Flow log data for a monitored network interface is recorded as flow log records, // which are log events consisting of fields that describe the traffic flow. -// For more information, see Flow Log Records (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/flow-logs.html#flow-log-records) +// For more information, see Flow Log Records (https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html#flow-log-records) // in the Amazon Virtual Private Cloud User Guide. // // When publishing to CloudWatch Logs, flow log records are published to a log @@ -4029,7 +4018,7 @@ func (c *EC2) CreateFlowLogsRequest(input *CreateFlowLogsInput) (req *request.Re // interfaces are published to a single log file object that is stored in the // specified bucket. // -// For more information, see VPC Flow Logs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/flow-logs.html) +// For more information, see VPC Flow Logs (https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4110,8 +4099,8 @@ func (c *EC2) CreateFpgaImageRequest(input *CreateFpgaImageInput) (req *request. // use, check the output logs. // // An AFI contains the FPGA bitstream that is ready to download to an FPGA. -// You can securely deploy an AFI on one or more FPGA-accelerated instances. -// For more information, see the AWS FPGA Hardware Development Kit (https://github.com/aws/aws-fpga/). +// You can securely deploy an AFI on multiple FPGA-accelerated instances. For +// more information, see the AWS FPGA Hardware Development Kit (https://github.com/aws/aws-fpga/). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -4193,7 +4182,7 @@ func (c *EC2) CreateImageRequest(input *CreateImageInput) (req *request.Request, // mapping information for those volumes. When you launch an instance from this // new AMI, the instance automatically launches with those additional volumes. // -// For more information, see Creating Amazon EBS-Backed Linux AMIs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-ebs.html) +// For more information, see Creating Amazon EBS-Backed Linux AMIs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-ebs.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4272,7 +4261,7 @@ func (c *EC2) CreateInstanceExportTaskRequest(input *CreateInstanceExportTaskInp // // For information about the supported operating systems, image formats, and // known limitations for the types of instances you can export, see Exporting -// an Instance as a VM Using VM Import/Export (http://docs.aws.amazon.com/vm-import/latest/userguide/vmexport.html) +// an Instance as a VM Using VM Import/Export (https://docs.aws.amazon.com/vm-import/latest/userguide/vmexport.html) // in the VM Import/Export User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4351,7 +4340,7 @@ func (c *EC2) CreateInternetGatewayRequest(input *CreateInternetGatewayInput) (r // gateway, you attach it to a VPC using AttachInternetGateway. // // For more information about your VPC and internet gateway, see the Amazon -// Virtual Private Cloud User Guide (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/). +// Virtual Private Cloud User Guide (https://docs.aws.amazon.com/vpc/latest/userguide/). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -4430,13 +4419,13 @@ func (c *EC2) CreateKeyPairRequest(input *CreateKeyPairInput) (req *request.Requ // private key is returned as an unencrypted PEM encoded PKCS#1 private key. // If a key with the specified name already exists, Amazon EC2 returns an error. // -// You can have up to five thousand key pairs per region. +// You can have up to five thousand key pairs per Region. // -// The key pair returned to you is available only in the region in which you +// The key pair returned to you is available only in the Region in which you // create it. If you prefer, you can create your own key pair using a third-party -// tool and upload it to any region using ImportKeyPair. +// tool and upload it to any Region using ImportKeyPair. // -// For more information, see Key Pairs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) +// For more information, see Key Pairs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4670,7 +4659,7 @@ func (c *EC2) CreateNatGatewayRequest(input *CreateNatGatewayInput) (req *reques // the IP address range of the subnet. Internet-bound traffic from a private // subnet can be routed to the NAT gateway, therefore enabling instances in // the private subnet to connect to the internet. For more information, see -// NAT Gateways (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html) +// NAT Gateways (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4748,7 +4737,7 @@ func (c *EC2) CreateNetworkAclRequest(input *CreateNetworkAclInput) (req *reques // Creates a network ACL in a VPC. Network ACLs provide an optional layer of // security (in addition to security groups) for the instances in your VPC. // -// For more information, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) +// For more information, see Network ACLs (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_ACLs.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4839,7 +4828,7 @@ func (c *EC2) CreateNetworkAclEntryRequest(input *CreateNetworkAclEntryInput) (r // After you add an entry, you can't modify it; you must either replace it, // or create an entry and delete the old one. // -// For more information about network ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) +// For more information about network ACLs, see Network ACLs (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_ACLs.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4917,7 +4906,7 @@ func (c *EC2) CreateNetworkInterfaceRequest(input *CreateNetworkInterfaceInput) // Creates a network interface in the specified subnet. // // For more information about network interfaces, see Elastic Network Interfaces -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html) in the +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html) in the // Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5081,7 +5070,7 @@ func (c *EC2) CreatePlacementGroupRequest(input *CreatePlacementGroupInput) (req // instances in one partition do not share the same hardware with instances // in another partition. // -// For more information, see Placement Groups (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) +// For more information, see Placement Groups (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5161,9 +5150,8 @@ func (c *EC2) CreateReservedInstancesListingRequest(input *CreateReservedInstanc // listing at a time. To get a list of your Standard Reserved Instances, you // can use the DescribeReservedInstances operation. // -// Only Standard Reserved Instances with a capacity reservation can be sold -// in the Reserved Instance Marketplace. Convertible Reserved Instances and -// Standard Reserved Instances with a regional benefit cannot be sold. +// Only Standard Reserved Instances can be sold in the Reserved Instance Marketplace. +// Convertible Reserved Instances cannot be sold. // // The Reserved Instance Marketplace matches sellers who want to resell Standard // Reserved Instance capacity that they no longer need with buyers who want @@ -5178,7 +5166,7 @@ func (c *EC2) CreateReservedInstancesListingRequest(input *CreateReservedInstanc // for purchase. To view the details of your Standard Reserved Instance listing, // you can use the DescribeReservedInstancesListings operation. // -// For more information, see Reserved Instance Marketplace (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) +// For more information, see Reserved Instance Marketplace (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5271,7 +5259,7 @@ func (c *EC2) CreateRouteRequest(input *CreateRouteInput) (req *request.Request, // route in the list covers a smaller number of IP addresses and is therefore // more specific, so we use that route to determine where to target the traffic. // -// For more information about route tables, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// For more information about route tables, see Route Tables (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5349,7 +5337,7 @@ func (c *EC2) CreateRouteTableRequest(input *CreateRouteTableInput) (req *reques // Creates a route table for the specified VPC. After you create a route table, // you can add routes and associate the table with a subnet. // -// For more information, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// For more information, see Route Tables (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5426,17 +5414,13 @@ func (c *EC2) CreateSecurityGroupRequest(input *CreateSecurityGroupInput) (req * // // Creates a security group. // -// A security group is for use with instances either in the EC2-Classic platform -// or in a specific VPC. For more information, see Amazon EC2 Security Groups -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html) +// A security group acts as a virtual firewall for your instance to control +// inbound and outbound traffic. For more information, see Amazon EC2 Security +// Groups (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html) // in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your -// VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) +// VPC (https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) // in the Amazon Virtual Private Cloud User Guide. // -// EC2-Classic: You can have up to 500 security groups. -// -// EC2-VPC: You can create up to 500 security groups per VPC. -// // When you create a security group, you specify a friendly name of your choice. // You can have a security group for use in EC2-Classic with the same name as // a security group for use in a VPC. However, you can't have two security groups @@ -5452,6 +5436,9 @@ func (c *EC2) CreateSecurityGroupRequest(input *CreateSecurityGroupInput) (req * // You can add or remove rules from your security groups using AuthorizeSecurityGroupIngress, // AuthorizeSecurityGroupEgress, RevokeSecurityGroupIngress, and RevokeSecurityGroupEgress. // +// For more information about VPC security group limits, see Amazon VPC Limits +// (https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -5550,11 +5537,11 @@ func (c *EC2) CreateSnapshotRequest(input *CreateSnapshotInput) (req *request.Re // protected. // // You can tag your snapshots during creation. For more information, see Tagging -// Your Amazon EC2 Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) +// Your Amazon EC2 Resources (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) // in the Amazon Elastic Compute Cloud User Guide. // -// For more information, see Amazon Elastic Block Store (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) -// and Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// For more information, see Amazon Elastic Block Store (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) +// and Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5585,6 +5572,83 @@ func (c *EC2) CreateSnapshotWithContext(ctx aws.Context, input *CreateSnapshotIn return out, req.Send() } +const opCreateSnapshots = "CreateSnapshots" + +// CreateSnapshotsRequest generates a "aws/request.Request" representing the +// client's request for the CreateSnapshots operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateSnapshots for more information on using the CreateSnapshots +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateSnapshotsRequest method. +// req, resp := client.CreateSnapshotsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateSnapshots +func (c *EC2) CreateSnapshotsRequest(input *CreateSnapshotsInput) (req *request.Request, output *CreateSnapshotsOutput) { + op := &request.Operation{ + Name: opCreateSnapshots, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateSnapshotsInput{} + } + + output = &CreateSnapshotsOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateSnapshots API operation for Amazon Elastic Compute Cloud. +// +// Creates crash-consistent snapshots of multiple EBS volumes and stores the +// data in S3. Volumes are chosen by specifying an instance. Any attached volumes +// will produce one snapshot each that is crash-consistent across the instance. +// Boot volumes can be excluded by changing the paramaters. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation CreateSnapshots for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateSnapshots +func (c *EC2) CreateSnapshots(input *CreateSnapshotsInput) (*CreateSnapshotsOutput, error) { + req, out := c.CreateSnapshotsRequest(input) + return out, req.Send() +} + +// CreateSnapshotsWithContext is the same as CreateSnapshots with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSnapshots for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) CreateSnapshotsWithContext(ctx aws.Context, input *CreateSnapshotsInput, opts ...request.Option) (*CreateSnapshotsOutput, error) { + req, out := c.CreateSnapshotsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opCreateSpotDatafeedSubscription = "CreateSpotDatafeedSubscription" // CreateSpotDatafeedSubscriptionRequest generates a "aws/request.Request" representing the @@ -5631,7 +5695,7 @@ func (c *EC2) CreateSpotDatafeedSubscriptionRequest(input *CreateSpotDatafeedSub // // Creates a data feed for Spot Instances, enabling you to view Spot Instance // usage logs. You can create one data feed per AWS account. For more information, -// see Spot Instance Data Feed (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) +// see Spot Instance Data Feed (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) // in the Amazon EC2 User Guide for Linux Instances. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5731,7 +5795,7 @@ func (c *EC2) CreateSubnetRequest(input *CreateSubnetInput) (req *request.Reques // It's therefore possible to have a subnet with no running instances (they're // all stopped), but no remaining IP addresses available. // -// For more information about subnets, see Your VPC and Subnets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) +// For more information about subnets, see Your VPC and Subnets (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5807,14 +5871,14 @@ func (c *EC2) CreateTagsRequest(input *CreateTagsInput) (req *request.Request, o // CreateTags API operation for Amazon Elastic Compute Cloud. // -// Adds or overwrites one or more tags for the specified Amazon EC2 resource +// Adds or overwrites the specified tags for the specified Amazon EC2 resource // or resources. Each resource can have a maximum of 50 tags. Each tag consists // of a key and optional value. Tag keys must be unique per resource. // -// For more information about tags, see Tagging Your Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) +// For more information about tags, see Tagging Your Resources (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) // in the Amazon Elastic Compute Cloud User Guide. For more information about // creating IAM policies that control users' access to resources based on tags, -// see Supported Resource-Level Permissions for Amazon EC2 API Actions (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-iam-actions-resources.html) +// see Supported Resource-Level Permissions for Amazon EC2 API Actions (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-iam-actions-resources.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5845,6 +5909,333 @@ func (c *EC2) CreateTagsWithContext(ctx aws.Context, input *CreateTagsInput, opt return out, req.Send() } +const opCreateTrafficMirrorFilter = "CreateTrafficMirrorFilter" + +// CreateTrafficMirrorFilterRequest generates a "aws/request.Request" representing the +// client's request for the CreateTrafficMirrorFilter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateTrafficMirrorFilter for more information on using the CreateTrafficMirrorFilter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateTrafficMirrorFilterRequest method. +// req, resp := client.CreateTrafficMirrorFilterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateTrafficMirrorFilter +func (c *EC2) CreateTrafficMirrorFilterRequest(input *CreateTrafficMirrorFilterInput) (req *request.Request, output *CreateTrafficMirrorFilterOutput) { + op := &request.Operation{ + Name: opCreateTrafficMirrorFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateTrafficMirrorFilterInput{} + } + + output = &CreateTrafficMirrorFilterOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateTrafficMirrorFilter API operation for Amazon Elastic Compute Cloud. +// +// Creates a Traffic Mirror filter. +// +// A Traffic Mirror filter is a set of rules that defines the traffic to mirror. +// +// By default, no traffic is mirrored. To mirror traffic, use CreateTrafficMirrorFilterRule +// to add Traffic Mirror rules to the filter. The rules you add define what +// traffic gets mirrored. You can also use ModifyTrafficMirrorFilterNetworkServices +// to mirror supported network services. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation CreateTrafficMirrorFilter for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateTrafficMirrorFilter +func (c *EC2) CreateTrafficMirrorFilter(input *CreateTrafficMirrorFilterInput) (*CreateTrafficMirrorFilterOutput, error) { + req, out := c.CreateTrafficMirrorFilterRequest(input) + return out, req.Send() +} + +// CreateTrafficMirrorFilterWithContext is the same as CreateTrafficMirrorFilter with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTrafficMirrorFilter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) CreateTrafficMirrorFilterWithContext(ctx aws.Context, input *CreateTrafficMirrorFilterInput, opts ...request.Option) (*CreateTrafficMirrorFilterOutput, error) { + req, out := c.CreateTrafficMirrorFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateTrafficMirrorFilterRule = "CreateTrafficMirrorFilterRule" + +// CreateTrafficMirrorFilterRuleRequest generates a "aws/request.Request" representing the +// client's request for the CreateTrafficMirrorFilterRule operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateTrafficMirrorFilterRule for more information on using the CreateTrafficMirrorFilterRule +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateTrafficMirrorFilterRuleRequest method. +// req, resp := client.CreateTrafficMirrorFilterRuleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateTrafficMirrorFilterRule +func (c *EC2) CreateTrafficMirrorFilterRuleRequest(input *CreateTrafficMirrorFilterRuleInput) (req *request.Request, output *CreateTrafficMirrorFilterRuleOutput) { + op := &request.Operation{ + Name: opCreateTrafficMirrorFilterRule, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateTrafficMirrorFilterRuleInput{} + } + + output = &CreateTrafficMirrorFilterRuleOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateTrafficMirrorFilterRule API operation for Amazon Elastic Compute Cloud. +// +// Creates a Traffic Mirror rule. +// +// A Traffic Mirror rule defines the Traffic Mirror source traffic to mirror. +// +// You need the Traffic Mirror filter ID when you create the rule. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation CreateTrafficMirrorFilterRule for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateTrafficMirrorFilterRule +func (c *EC2) CreateTrafficMirrorFilterRule(input *CreateTrafficMirrorFilterRuleInput) (*CreateTrafficMirrorFilterRuleOutput, error) { + req, out := c.CreateTrafficMirrorFilterRuleRequest(input) + return out, req.Send() +} + +// CreateTrafficMirrorFilterRuleWithContext is the same as CreateTrafficMirrorFilterRule with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTrafficMirrorFilterRule for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) CreateTrafficMirrorFilterRuleWithContext(ctx aws.Context, input *CreateTrafficMirrorFilterRuleInput, opts ...request.Option) (*CreateTrafficMirrorFilterRuleOutput, error) { + req, out := c.CreateTrafficMirrorFilterRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateTrafficMirrorSession = "CreateTrafficMirrorSession" + +// CreateTrafficMirrorSessionRequest generates a "aws/request.Request" representing the +// client's request for the CreateTrafficMirrorSession operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateTrafficMirrorSession for more information on using the CreateTrafficMirrorSession +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateTrafficMirrorSessionRequest method. +// req, resp := client.CreateTrafficMirrorSessionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateTrafficMirrorSession +func (c *EC2) CreateTrafficMirrorSessionRequest(input *CreateTrafficMirrorSessionInput) (req *request.Request, output *CreateTrafficMirrorSessionOutput) { + op := &request.Operation{ + Name: opCreateTrafficMirrorSession, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateTrafficMirrorSessionInput{} + } + + output = &CreateTrafficMirrorSessionOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateTrafficMirrorSession API operation for Amazon Elastic Compute Cloud. +// +// Creates a Traffic Mirror session. +// +// A Traffic Mirror session actively copies packets from a Traffic Mirror source +// to a Traffic Mirror target. Create a filter, and then assign it to the session +// to define a subset of the traffic to mirror, for example all TCP traffic. +// +// The Traffic Mirror source and the Traffic Mirror target (monitoring appliances) +// can be in the same VPC, or in a different VPC connected via VPC peering or +// a transit gateway. +// +// By default, no traffic is mirrored. Use CreateTrafficMirrorFilter to create +// filter rules that specify the traffic to mirror. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation CreateTrafficMirrorSession for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateTrafficMirrorSession +func (c *EC2) CreateTrafficMirrorSession(input *CreateTrafficMirrorSessionInput) (*CreateTrafficMirrorSessionOutput, error) { + req, out := c.CreateTrafficMirrorSessionRequest(input) + return out, req.Send() +} + +// CreateTrafficMirrorSessionWithContext is the same as CreateTrafficMirrorSession with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTrafficMirrorSession for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) CreateTrafficMirrorSessionWithContext(ctx aws.Context, input *CreateTrafficMirrorSessionInput, opts ...request.Option) (*CreateTrafficMirrorSessionOutput, error) { + req, out := c.CreateTrafficMirrorSessionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateTrafficMirrorTarget = "CreateTrafficMirrorTarget" + +// CreateTrafficMirrorTargetRequest generates a "aws/request.Request" representing the +// client's request for the CreateTrafficMirrorTarget operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateTrafficMirrorTarget for more information on using the CreateTrafficMirrorTarget +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateTrafficMirrorTargetRequest method. +// req, resp := client.CreateTrafficMirrorTargetRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateTrafficMirrorTarget +func (c *EC2) CreateTrafficMirrorTargetRequest(input *CreateTrafficMirrorTargetInput) (req *request.Request, output *CreateTrafficMirrorTargetOutput) { + op := &request.Operation{ + Name: opCreateTrafficMirrorTarget, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateTrafficMirrorTargetInput{} + } + + output = &CreateTrafficMirrorTargetOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateTrafficMirrorTarget API operation for Amazon Elastic Compute Cloud. +// +// Creates a target for your Traffic Mirror session. +// +// A Traffic Mirror target is the destination for mirrored traffic. The Traffic +// Mirror source and the Traffic Mirror target (monitoring appliances) can be +// in the same VPC, or in different VPCs connected via VPC peering or a transit +// gateway. +// +// A Traffic Mirror target can be a network interface, or a Network Load Balancer. +// +// To use the target in a Traffic Mirror session, use CreateTrafficMirrorSession. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation CreateTrafficMirrorTarget for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateTrafficMirrorTarget +func (c *EC2) CreateTrafficMirrorTarget(input *CreateTrafficMirrorTargetInput) (*CreateTrafficMirrorTargetOutput, error) { + req, out := c.CreateTrafficMirrorTargetRequest(input) + return out, req.Send() +} + +// CreateTrafficMirrorTargetWithContext is the same as CreateTrafficMirrorTarget with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTrafficMirrorTarget for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) CreateTrafficMirrorTargetWithContext(ctx aws.Context, input *CreateTrafficMirrorTargetInput, opts ...request.Option) (*CreateTrafficMirrorTargetOutput, error) { + req, out := c.CreateTrafficMirrorTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opCreateTransitGateway = "CreateTransitGateway" // CreateTransitGatewayRequest generates a "aws/request.Request" representing the @@ -6213,23 +6604,23 @@ func (c *EC2) CreateVolumeRequest(input *CreateVolumeInput) (req *request.Reques // // Creates an EBS volume that can be attached to an instance in the same Availability // Zone. The volume is created in the regional endpoint that you send the HTTP -// request to. For more information see Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html). +// request to. For more information see Regions and Endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html). // // You can create a new empty volume or restore a volume from an EBS snapshot. // Any AWS Marketplace product codes from the snapshot are propagated to the // volume. // -// You can create encrypted volumes with the Encrypted parameter. Encrypted -// volumes may only be attached to instances that support Amazon EBS encryption. -// Volumes that are created from encrypted snapshots are also automatically -// encrypted. For more information, see Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// You can create encrypted volumes. Encrypted volumes must be attached to instances +// that support Amazon EBS encryption. Volumes that are created from encrypted +// snapshots are also automatically encrypted. For more information, see Amazon +// EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) // in the Amazon Elastic Compute Cloud User Guide. // // You can tag your volumes during creation. For more information, see Tagging -// Your Amazon EC2 Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) +// Your Amazon EC2 Resources (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) // in the Amazon Elastic Compute Cloud User Guide. // -// For more information, see Creating an Amazon EBS Volume (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-volume.html) +// For more information, see Creating an Amazon EBS Volume (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-volume.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -6307,7 +6698,7 @@ func (c *EC2) CreateVpcRequest(input *CreateVpcInput) (req *request.Request, out // Creates a VPC with the specified IPv4 CIDR block. The smallest VPC you can // create uses a /28 netmask (16 IPv4 addresses), and the largest uses a /16 // netmask (65,536 IPv4 addresses). For more information about how large to -// make your VPC, see Your VPC and Subnets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) +// make your VPC, see Your VPC and Subnets (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html) // in the Amazon Virtual Private Cloud User Guide. // // You can optionally request an Amazon-provided IPv6 CIDR block for the VPC. @@ -6316,12 +6707,12 @@ func (c *EC2) CreateVpcRequest(input *CreateVpcInput) (req *request.Request, out // // By default, each instance you launch in the VPC has the default DHCP options, // which include only a default DNS server that we provide (AmazonProvidedDNS). -// For more information, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) +// For more information, see DHCP Options Sets (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_DHCP_Options.html) // in the Amazon Virtual Private Cloud User Guide. // // You can specify the instance tenancy value for the VPC when you create it. // You can't change this value for the VPC after you create it. For more information, -// see Dedicated Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-instance.html) +// see Dedicated Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-instance.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -6399,7 +6790,7 @@ func (c *EC2) CreateVpcEndpointRequest(input *CreateVpcEndpointInput) (req *requ // Creates a VPC endpoint for a specified service. An endpoint enables you to // create a private connection between your VPC and the service. The service // may be provided by AWS, an AWS Marketplace partner, or another AWS account. -// For more information, see VPC Endpoints (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-endpoints.html) +// For more information, see VPC Endpoints (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints.html) // in the Amazon Virtual Private Cloud User Guide. // // A gateway endpoint serves as a target for a route in your route table for @@ -6489,7 +6880,7 @@ func (c *EC2) CreateVpcEndpointConnectionNotificationRequest(input *CreateVpcEnd // Creates a connection notification for a specified VPC endpoint or VPC endpoint // service. A connection notification notifies you of specific endpoint events. // You must create an SNS topic to receive notifications. For more information, -// see Create a Topic (http://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html) +// see Create a Topic (https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html) // in the Amazon Simple Notification Service Developer Guide. // // You can create a connection notification for interface endpoints only. @@ -6572,7 +6963,7 @@ func (c *EC2) CreateVpcEndpointServiceConfigurationRequest(input *CreateVpcEndpo // // To create an endpoint service configuration, you must first create a Network // Load Balancer for your service. For more information, see VPC Endpoint Services -// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/endpoint-service.html) +// (https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-service.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -6654,7 +7045,7 @@ func (c *EC2) CreateVpcPeeringConnectionRequest(input *CreateVpcPeeringConnectio // CIDR blocks. // // Limitations and rules apply to a VPC peering connection. For more information, -// see the limitations (http://docs.aws.amazon.com/AmazonVPC/latest/PeeringGuide/vpc-peering-basics.html#vpc-peering-limitations) +// see the limitations (https://docs.aws.amazon.com/vpc/latest/peering/vpc-peering-basics.html#vpc-peering-limitations) // section in the VPC Peering Guide. // // The owner of the accepter VPC must accept the peering request to activate @@ -6737,7 +7128,7 @@ func (c *EC2) CreateVpnConnectionRequest(input *CreateVpnConnectionInput) (req * // CreateVpnConnection API operation for Amazon Elastic Compute Cloud. // // Creates a VPN connection between an existing virtual private gateway and -// a VPN customer gateway. The only supported connection type is ipsec.1. +// a VPN customer gateway. The supported connection types is ipsec.1. // // The response includes information that you need to give to your network administrator // to configure your customer gateway. @@ -6753,8 +7144,8 @@ func (c *EC2) CreateVpnConnectionRequest(input *CreateVpnConnectionInput) (req * // This is an idempotent operation. If you perform the operation more than once, // Amazon EC2 doesn't return an error. // -// For more information, see AWS Managed VPN Connections (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. +// For more information, see AWS Site-to-Site VPN (https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html) +// in the AWS Site-to-Site VPN User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -6834,9 +7225,8 @@ func (c *EC2) CreateVpnConnectionRouteRequest(input *CreateVpnConnectionRouteInp // traffic to be routed from the virtual private gateway to the VPN customer // gateway. // -// For more information about VPN connections, see AWS Managed VPN Connections -// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) in the -// Amazon Virtual Private Cloud User Guide. +// For more information, see AWS Site-to-Site VPN (https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html) +// in the AWS Site-to-Site VPN User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -6914,9 +7304,8 @@ func (c *EC2) CreateVpnGatewayRequest(input *CreateVpnGatewayInput) (req *reques // on the VPC side of your VPN connection. You can create a virtual private // gateway before creating the VPC itself. // -// For more information about virtual private gateways, see AWS Managed VPN -// Connections (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. +// For more information, see AWS Site-to-Site VPN (https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html) +// in the AWS Site-to-Site VPN User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -8286,7 +8675,7 @@ func (c *EC2) DeletePlacementGroupRequest(input *DeletePlacementGroupInput) (req // // Deletes the specified placement group. You must terminate all instances in // the placement group before you can delete the placement group. For more information, -// see Placement Groups (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) +// see Placement Groups (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -8606,7 +8995,7 @@ func (c *EC2) DeleteSnapshotRequest(input *DeleteSnapshotInput) (req *request.Re // a registered AMI. You must first de-register the AMI before you can delete // the snapshot. // -// For more information, see Deleting an Amazon EBS Snapshot (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-deleting-snapshot.html) +// For more information, see Deleting an Amazon EBS Snapshot (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-deleting-snapshot.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -8836,7 +9225,7 @@ func (c *EC2) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Request, o // Deletes the specified set of tags from the specified set of resources. // // To list the current tags, use DescribeTags. For more information about tags, -// see Tagging Your Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) +// see Tagging Your Resources (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -8867,6 +9256,308 @@ func (c *EC2) DeleteTagsWithContext(ctx aws.Context, input *DeleteTagsInput, opt return out, req.Send() } +const opDeleteTrafficMirrorFilter = "DeleteTrafficMirrorFilter" + +// DeleteTrafficMirrorFilterRequest generates a "aws/request.Request" representing the +// client's request for the DeleteTrafficMirrorFilter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteTrafficMirrorFilter for more information on using the DeleteTrafficMirrorFilter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteTrafficMirrorFilterRequest method. +// req, resp := client.DeleteTrafficMirrorFilterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteTrafficMirrorFilter +func (c *EC2) DeleteTrafficMirrorFilterRequest(input *DeleteTrafficMirrorFilterInput) (req *request.Request, output *DeleteTrafficMirrorFilterOutput) { + op := &request.Operation{ + Name: opDeleteTrafficMirrorFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteTrafficMirrorFilterInput{} + } + + output = &DeleteTrafficMirrorFilterOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteTrafficMirrorFilter API operation for Amazon Elastic Compute Cloud. +// +// Deletes the specified Traffic Mirror filter. +// +// You cannot delete a Traffic Mirror filter that is in use by a Traffic Mirror +// session. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation DeleteTrafficMirrorFilter for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteTrafficMirrorFilter +func (c *EC2) DeleteTrafficMirrorFilter(input *DeleteTrafficMirrorFilterInput) (*DeleteTrafficMirrorFilterOutput, error) { + req, out := c.DeleteTrafficMirrorFilterRequest(input) + return out, req.Send() +} + +// DeleteTrafficMirrorFilterWithContext is the same as DeleteTrafficMirrorFilter with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTrafficMirrorFilter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DeleteTrafficMirrorFilterWithContext(ctx aws.Context, input *DeleteTrafficMirrorFilterInput, opts ...request.Option) (*DeleteTrafficMirrorFilterOutput, error) { + req, out := c.DeleteTrafficMirrorFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteTrafficMirrorFilterRule = "DeleteTrafficMirrorFilterRule" + +// DeleteTrafficMirrorFilterRuleRequest generates a "aws/request.Request" representing the +// client's request for the DeleteTrafficMirrorFilterRule operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteTrafficMirrorFilterRule for more information on using the DeleteTrafficMirrorFilterRule +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteTrafficMirrorFilterRuleRequest method. +// req, resp := client.DeleteTrafficMirrorFilterRuleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteTrafficMirrorFilterRule +func (c *EC2) DeleteTrafficMirrorFilterRuleRequest(input *DeleteTrafficMirrorFilterRuleInput) (req *request.Request, output *DeleteTrafficMirrorFilterRuleOutput) { + op := &request.Operation{ + Name: opDeleteTrafficMirrorFilterRule, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteTrafficMirrorFilterRuleInput{} + } + + output = &DeleteTrafficMirrorFilterRuleOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteTrafficMirrorFilterRule API operation for Amazon Elastic Compute Cloud. +// +// Deletes the specified Traffic Mirror rule. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation DeleteTrafficMirrorFilterRule for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteTrafficMirrorFilterRule +func (c *EC2) DeleteTrafficMirrorFilterRule(input *DeleteTrafficMirrorFilterRuleInput) (*DeleteTrafficMirrorFilterRuleOutput, error) { + req, out := c.DeleteTrafficMirrorFilterRuleRequest(input) + return out, req.Send() +} + +// DeleteTrafficMirrorFilterRuleWithContext is the same as DeleteTrafficMirrorFilterRule with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTrafficMirrorFilterRule for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DeleteTrafficMirrorFilterRuleWithContext(ctx aws.Context, input *DeleteTrafficMirrorFilterRuleInput, opts ...request.Option) (*DeleteTrafficMirrorFilterRuleOutput, error) { + req, out := c.DeleteTrafficMirrorFilterRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteTrafficMirrorSession = "DeleteTrafficMirrorSession" + +// DeleteTrafficMirrorSessionRequest generates a "aws/request.Request" representing the +// client's request for the DeleteTrafficMirrorSession operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteTrafficMirrorSession for more information on using the DeleteTrafficMirrorSession +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteTrafficMirrorSessionRequest method. +// req, resp := client.DeleteTrafficMirrorSessionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteTrafficMirrorSession +func (c *EC2) DeleteTrafficMirrorSessionRequest(input *DeleteTrafficMirrorSessionInput) (req *request.Request, output *DeleteTrafficMirrorSessionOutput) { + op := &request.Operation{ + Name: opDeleteTrafficMirrorSession, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteTrafficMirrorSessionInput{} + } + + output = &DeleteTrafficMirrorSessionOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteTrafficMirrorSession API operation for Amazon Elastic Compute Cloud. +// +// Deletes the specified Traffic Mirror session. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation DeleteTrafficMirrorSession for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteTrafficMirrorSession +func (c *EC2) DeleteTrafficMirrorSession(input *DeleteTrafficMirrorSessionInput) (*DeleteTrafficMirrorSessionOutput, error) { + req, out := c.DeleteTrafficMirrorSessionRequest(input) + return out, req.Send() +} + +// DeleteTrafficMirrorSessionWithContext is the same as DeleteTrafficMirrorSession with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTrafficMirrorSession for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DeleteTrafficMirrorSessionWithContext(ctx aws.Context, input *DeleteTrafficMirrorSessionInput, opts ...request.Option) (*DeleteTrafficMirrorSessionOutput, error) { + req, out := c.DeleteTrafficMirrorSessionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteTrafficMirrorTarget = "DeleteTrafficMirrorTarget" + +// DeleteTrafficMirrorTargetRequest generates a "aws/request.Request" representing the +// client's request for the DeleteTrafficMirrorTarget operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteTrafficMirrorTarget for more information on using the DeleteTrafficMirrorTarget +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteTrafficMirrorTargetRequest method. +// req, resp := client.DeleteTrafficMirrorTargetRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteTrafficMirrorTarget +func (c *EC2) DeleteTrafficMirrorTargetRequest(input *DeleteTrafficMirrorTargetInput) (req *request.Request, output *DeleteTrafficMirrorTargetOutput) { + op := &request.Operation{ + Name: opDeleteTrafficMirrorTarget, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteTrafficMirrorTargetInput{} + } + + output = &DeleteTrafficMirrorTargetOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteTrafficMirrorTarget API operation for Amazon Elastic Compute Cloud. +// +// Deletes the specified Traffic Mirror target. +// +// You cannot delete a Traffic Mirror target that is in use by a Traffic Mirror +// session. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation DeleteTrafficMirrorTarget for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteTrafficMirrorTarget +func (c *EC2) DeleteTrafficMirrorTarget(input *DeleteTrafficMirrorTargetInput) (*DeleteTrafficMirrorTargetOutput, error) { + req, out := c.DeleteTrafficMirrorTargetRequest(input) + return out, req.Send() +} + +// DeleteTrafficMirrorTargetWithContext is the same as DeleteTrafficMirrorTarget with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTrafficMirrorTarget for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DeleteTrafficMirrorTargetWithContext(ctx aws.Context, input *DeleteTrafficMirrorTargetInput, opts ...request.Option) (*DeleteTrafficMirrorTargetOutput, error) { + req, out := c.DeleteTrafficMirrorTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDeleteTransitGateway = "DeleteTransitGateway" // DeleteTransitGatewayRequest generates a "aws/request.Request" representing the @@ -9215,7 +9906,7 @@ func (c *EC2) DeleteVolumeRequest(input *DeleteVolumeInput) (req *request.Reques // // The volume can remain in the deleting state for several minutes. // -// For more information, see Deleting an Amazon EBS Volume (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-deleting-volume.html) +// For more information, see Deleting an Amazon EBS Volume (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-deleting-volume.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -10171,10 +10862,10 @@ func (c *EC2) DescribeAddressesRequest(input *DescribeAddressesInput) (req *requ // DescribeAddresses API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your Elastic IP addresses. +// Describes the specified Elastic IP addresses or all of your Elastic IP addresses. // // An Elastic IP address is for use in either the EC2-Classic platform or in -// a VPC. For more information, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// a VPC. For more information, see Elastic IP Addresses (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -10250,8 +10941,8 @@ func (c *EC2) DescribeAggregateIdFormatRequest(input *DescribeAggregateIdFormatI // DescribeAggregateIdFormat API operation for Amazon Elastic Compute Cloud. // // Describes the longer ID format settings for all resource types in a specific -// region. This request is useful for performing a quick audit to determine -// whether a specific region is fully opted in for longer IDs (17-character +// Region. This request is useful for performing a quick audit to determine +// whether a specific Region is fully opted in for longer IDs (17-character // IDs). // // This request only returns information about resource types that support longer @@ -10337,12 +11028,12 @@ func (c *EC2) DescribeAvailabilityZonesRequest(input *DescribeAvailabilityZonesI // DescribeAvailabilityZones API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of the Availability Zones that are available to you. -// The results include zones only for the region you're currently using. If -// there is an event impacting an Availability Zone, you can use this request -// to view the state and any provided message for that Availability Zone. +// Describes the Availability Zones that are available to you. The results include +// zones only for the Region you're currently using. If there is an event impacting +// an Availability Zone, you can use this request to view the state and any +// provided message for that Availability Zone. // -// For more information, see Regions and Availability Zones (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) +// For more information, see Regions and Availability Zones (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -10417,7 +11108,7 @@ func (c *EC2) DescribeBundleTasksRequest(input *DescribeBundleTasksInput) (req * // DescribeBundleTasks API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your bundling tasks. +// Describes the specified bundle tasks or all of your bundle tasks. // // Completed bundle tasks are listed for only a limited time. If your bundle // task is no longer in the list, you can still register an AMI from it. Just @@ -10483,6 +11174,12 @@ func (c *EC2) DescribeByoipCidrsRequest(input *DescribeByoipCidrsInput) (req *re Name: opDescribeByoipCidrs, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -10529,6 +11226,56 @@ func (c *EC2) DescribeByoipCidrsWithContext(ctx aws.Context, input *DescribeByoi return out, req.Send() } +// DescribeByoipCidrsPages iterates over the pages of a DescribeByoipCidrs operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeByoipCidrs method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeByoipCidrs operation. +// pageNum := 0 +// err := client.DescribeByoipCidrsPages(params, +// func(page *ec2.DescribeByoipCidrsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeByoipCidrsPages(input *DescribeByoipCidrsInput, fn func(*DescribeByoipCidrsOutput, bool) bool) error { + return c.DescribeByoipCidrsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeByoipCidrsPagesWithContext same as DescribeByoipCidrsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeByoipCidrsPagesWithContext(ctx aws.Context, input *DescribeByoipCidrsInput, fn func(*DescribeByoipCidrsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeByoipCidrsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeByoipCidrsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeByoipCidrsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeCapacityReservations = "DescribeCapacityReservations" // DescribeCapacityReservationsRequest generates a "aws/request.Request" representing the @@ -10560,6 +11307,12 @@ func (c *EC2) DescribeCapacityReservationsRequest(input *DescribeCapacityReserva Name: opDescribeCapacityReservations, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -10604,6 +11357,56 @@ func (c *EC2) DescribeCapacityReservationsWithContext(ctx aws.Context, input *De return out, req.Send() } +// DescribeCapacityReservationsPages iterates over the pages of a DescribeCapacityReservations operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeCapacityReservations method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeCapacityReservations operation. +// pageNum := 0 +// err := client.DescribeCapacityReservationsPages(params, +// func(page *ec2.DescribeCapacityReservationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeCapacityReservationsPages(input *DescribeCapacityReservationsInput, fn func(*DescribeCapacityReservationsOutput, bool) bool) error { + return c.DescribeCapacityReservationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeCapacityReservationsPagesWithContext same as DescribeCapacityReservationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeCapacityReservationsPagesWithContext(ctx aws.Context, input *DescribeCapacityReservationsInput, fn func(*DescribeCapacityReservationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeCapacityReservationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCapacityReservationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeCapacityReservationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeClassicLinkInstances = "DescribeClassicLinkInstances" // DescribeClassicLinkInstancesRequest generates a "aws/request.Request" representing the @@ -10635,6 +11438,12 @@ func (c *EC2) DescribeClassicLinkInstancesRequest(input *DescribeClassicLinkInst Name: opDescribeClassicLinkInstances, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -10681,6 +11490,56 @@ func (c *EC2) DescribeClassicLinkInstancesWithContext(ctx aws.Context, input *De return out, req.Send() } +// DescribeClassicLinkInstancesPages iterates over the pages of a DescribeClassicLinkInstances operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeClassicLinkInstances method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeClassicLinkInstances operation. +// pageNum := 0 +// err := client.DescribeClassicLinkInstancesPages(params, +// func(page *ec2.DescribeClassicLinkInstancesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeClassicLinkInstancesPages(input *DescribeClassicLinkInstancesInput, fn func(*DescribeClassicLinkInstancesOutput, bool) bool) error { + return c.DescribeClassicLinkInstancesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClassicLinkInstancesPagesWithContext same as DescribeClassicLinkInstancesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeClassicLinkInstancesPagesWithContext(ctx aws.Context, input *DescribeClassicLinkInstancesInput, fn func(*DescribeClassicLinkInstancesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClassicLinkInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClassicLinkInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClassicLinkInstancesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeClientVpnAuthorizationRules = "DescribeClientVpnAuthorizationRules" // DescribeClientVpnAuthorizationRulesRequest generates a "aws/request.Request" representing the @@ -10712,6 +11571,12 @@ func (c *EC2) DescribeClientVpnAuthorizationRulesRequest(input *DescribeClientVp Name: opDescribeClientVpnAuthorizationRules, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -10755,6 +11620,56 @@ func (c *EC2) DescribeClientVpnAuthorizationRulesWithContext(ctx aws.Context, in return out, req.Send() } +// DescribeClientVpnAuthorizationRulesPages iterates over the pages of a DescribeClientVpnAuthorizationRules operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeClientVpnAuthorizationRules method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeClientVpnAuthorizationRules operation. +// pageNum := 0 +// err := client.DescribeClientVpnAuthorizationRulesPages(params, +// func(page *ec2.DescribeClientVpnAuthorizationRulesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeClientVpnAuthorizationRulesPages(input *DescribeClientVpnAuthorizationRulesInput, fn func(*DescribeClientVpnAuthorizationRulesOutput, bool) bool) error { + return c.DescribeClientVpnAuthorizationRulesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClientVpnAuthorizationRulesPagesWithContext same as DescribeClientVpnAuthorizationRulesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeClientVpnAuthorizationRulesPagesWithContext(ctx aws.Context, input *DescribeClientVpnAuthorizationRulesInput, fn func(*DescribeClientVpnAuthorizationRulesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClientVpnAuthorizationRulesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClientVpnAuthorizationRulesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClientVpnAuthorizationRulesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeClientVpnConnections = "DescribeClientVpnConnections" // DescribeClientVpnConnectionsRequest generates a "aws/request.Request" representing the @@ -10786,6 +11701,12 @@ func (c *EC2) DescribeClientVpnConnectionsRequest(input *DescribeClientVpnConnec Name: opDescribeClientVpnConnections, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -10830,6 +11751,56 @@ func (c *EC2) DescribeClientVpnConnectionsWithContext(ctx aws.Context, input *De return out, req.Send() } +// DescribeClientVpnConnectionsPages iterates over the pages of a DescribeClientVpnConnections operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeClientVpnConnections method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeClientVpnConnections operation. +// pageNum := 0 +// err := client.DescribeClientVpnConnectionsPages(params, +// func(page *ec2.DescribeClientVpnConnectionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeClientVpnConnectionsPages(input *DescribeClientVpnConnectionsInput, fn func(*DescribeClientVpnConnectionsOutput, bool) bool) error { + return c.DescribeClientVpnConnectionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClientVpnConnectionsPagesWithContext same as DescribeClientVpnConnectionsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeClientVpnConnectionsPagesWithContext(ctx aws.Context, input *DescribeClientVpnConnectionsInput, fn func(*DescribeClientVpnConnectionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClientVpnConnectionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClientVpnConnectionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClientVpnConnectionsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeClientVpnEndpoints = "DescribeClientVpnEndpoints" // DescribeClientVpnEndpointsRequest generates a "aws/request.Request" representing the @@ -10861,6 +11832,12 @@ func (c *EC2) DescribeClientVpnEndpointsRequest(input *DescribeClientVpnEndpoint Name: opDescribeClientVpnEndpoints, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -10904,6 +11881,56 @@ func (c *EC2) DescribeClientVpnEndpointsWithContext(ctx aws.Context, input *Desc return out, req.Send() } +// DescribeClientVpnEndpointsPages iterates over the pages of a DescribeClientVpnEndpoints operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeClientVpnEndpoints method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeClientVpnEndpoints operation. +// pageNum := 0 +// err := client.DescribeClientVpnEndpointsPages(params, +// func(page *ec2.DescribeClientVpnEndpointsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeClientVpnEndpointsPages(input *DescribeClientVpnEndpointsInput, fn func(*DescribeClientVpnEndpointsOutput, bool) bool) error { + return c.DescribeClientVpnEndpointsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClientVpnEndpointsPagesWithContext same as DescribeClientVpnEndpointsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeClientVpnEndpointsPagesWithContext(ctx aws.Context, input *DescribeClientVpnEndpointsInput, fn func(*DescribeClientVpnEndpointsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClientVpnEndpointsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClientVpnEndpointsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClientVpnEndpointsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeClientVpnRoutes = "DescribeClientVpnRoutes" // DescribeClientVpnRoutesRequest generates a "aws/request.Request" representing the @@ -10935,6 +11962,12 @@ func (c *EC2) DescribeClientVpnRoutesRequest(input *DescribeClientVpnRoutesInput Name: opDescribeClientVpnRoutes, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -10978,6 +12011,56 @@ func (c *EC2) DescribeClientVpnRoutesWithContext(ctx aws.Context, input *Describ return out, req.Send() } +// DescribeClientVpnRoutesPages iterates over the pages of a DescribeClientVpnRoutes operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeClientVpnRoutes method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeClientVpnRoutes operation. +// pageNum := 0 +// err := client.DescribeClientVpnRoutesPages(params, +// func(page *ec2.DescribeClientVpnRoutesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeClientVpnRoutesPages(input *DescribeClientVpnRoutesInput, fn func(*DescribeClientVpnRoutesOutput, bool) bool) error { + return c.DescribeClientVpnRoutesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClientVpnRoutesPagesWithContext same as DescribeClientVpnRoutesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeClientVpnRoutesPagesWithContext(ctx aws.Context, input *DescribeClientVpnRoutesInput, fn func(*DescribeClientVpnRoutesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClientVpnRoutesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClientVpnRoutesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClientVpnRoutesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeClientVpnTargetNetworks = "DescribeClientVpnTargetNetworks" // DescribeClientVpnTargetNetworksRequest generates a "aws/request.Request" representing the @@ -11009,6 +12092,12 @@ func (c *EC2) DescribeClientVpnTargetNetworksRequest(input *DescribeClientVpnTar Name: opDescribeClientVpnTargetNetworks, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -11052,6 +12141,56 @@ func (c *EC2) DescribeClientVpnTargetNetworksWithContext(ctx aws.Context, input return out, req.Send() } +// DescribeClientVpnTargetNetworksPages iterates over the pages of a DescribeClientVpnTargetNetworks operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeClientVpnTargetNetworks method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeClientVpnTargetNetworks operation. +// pageNum := 0 +// err := client.DescribeClientVpnTargetNetworksPages(params, +// func(page *ec2.DescribeClientVpnTargetNetworksOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeClientVpnTargetNetworksPages(input *DescribeClientVpnTargetNetworksInput, fn func(*DescribeClientVpnTargetNetworksOutput, bool) bool) error { + return c.DescribeClientVpnTargetNetworksPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClientVpnTargetNetworksPagesWithContext same as DescribeClientVpnTargetNetworksPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeClientVpnTargetNetworksPagesWithContext(ctx aws.Context, input *DescribeClientVpnTargetNetworksInput, fn func(*DescribeClientVpnTargetNetworksOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClientVpnTargetNetworksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClientVpnTargetNetworksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClientVpnTargetNetworksOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeConversionTasks = "DescribeConversionTasks" // DescribeConversionTasksRequest generates a "aws/request.Request" representing the @@ -11096,11 +12235,11 @@ func (c *EC2) DescribeConversionTasksRequest(input *DescribeConversionTasksInput // DescribeConversionTasks API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your conversion tasks. For more information, see -// the VM Import/Export User Guide (http://docs.aws.amazon.com/vm-import/latest/userguide/). +// Describes the specified conversion tasks or all your conversion tasks. For +// more information, see the VM Import/Export User Guide (https://docs.aws.amazon.com/vm-import/latest/userguide/). // // For information about the import manifest referenced by this API action, -// see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). +// see VM Import Manifest (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -11176,9 +12315,8 @@ func (c *EC2) DescribeCustomerGatewaysRequest(input *DescribeCustomerGatewaysInp // // Describes one or more of your VPN customer gateways. // -// For more information about VPN customer gateways, see AWS Managed VPN Connections -// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) in the -// Amazon Virtual Private Cloud User Guide. +// For more information, see AWS Site-to-Site VPN (https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html) +// in the AWS Site-to-Site VPN User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -11239,6 +12377,12 @@ func (c *EC2) DescribeDhcpOptionsRequest(input *DescribeDhcpOptionsInput) (req * Name: opDescribeDhcpOptions, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -11254,7 +12398,7 @@ func (c *EC2) DescribeDhcpOptionsRequest(input *DescribeDhcpOptionsInput) (req * // // Describes one or more of your DHCP options sets. // -// For more information, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) +// For more information, see DHCP Options Sets (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_DHCP_Options.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -11285,6 +12429,56 @@ func (c *EC2) DescribeDhcpOptionsWithContext(ctx aws.Context, input *DescribeDhc return out, req.Send() } +// DescribeDhcpOptionsPages iterates over the pages of a DescribeDhcpOptions operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeDhcpOptions method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeDhcpOptions operation. +// pageNum := 0 +// err := client.DescribeDhcpOptionsPages(params, +// func(page *ec2.DescribeDhcpOptionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeDhcpOptionsPages(input *DescribeDhcpOptionsInput, fn func(*DescribeDhcpOptionsOutput, bool) bool) error { + return c.DescribeDhcpOptionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDhcpOptionsPagesWithContext same as DescribeDhcpOptionsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeDhcpOptionsPagesWithContext(ctx aws.Context, input *DescribeDhcpOptionsInput, fn func(*DescribeDhcpOptionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDhcpOptionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDhcpOptionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDhcpOptionsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeEgressOnlyInternetGateways = "DescribeEgressOnlyInternetGateways" // DescribeEgressOnlyInternetGatewaysRequest generates a "aws/request.Request" representing the @@ -11316,6 +12510,12 @@ func (c *EC2) DescribeEgressOnlyInternetGatewaysRequest(input *DescribeEgressOnl Name: opDescribeEgressOnlyInternetGateways, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -11359,6 +12559,56 @@ func (c *EC2) DescribeEgressOnlyInternetGatewaysWithContext(ctx aws.Context, inp return out, req.Send() } +// DescribeEgressOnlyInternetGatewaysPages iterates over the pages of a DescribeEgressOnlyInternetGateways operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeEgressOnlyInternetGateways method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeEgressOnlyInternetGateways operation. +// pageNum := 0 +// err := client.DescribeEgressOnlyInternetGatewaysPages(params, +// func(page *ec2.DescribeEgressOnlyInternetGatewaysOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeEgressOnlyInternetGatewaysPages(input *DescribeEgressOnlyInternetGatewaysInput, fn func(*DescribeEgressOnlyInternetGatewaysOutput, bool) bool) error { + return c.DescribeEgressOnlyInternetGatewaysPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEgressOnlyInternetGatewaysPagesWithContext same as DescribeEgressOnlyInternetGatewaysPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeEgressOnlyInternetGatewaysPagesWithContext(ctx aws.Context, input *DescribeEgressOnlyInternetGatewaysInput, fn func(*DescribeEgressOnlyInternetGatewaysOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEgressOnlyInternetGatewaysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEgressOnlyInternetGatewaysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEgressOnlyInternetGatewaysOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeElasticGpus = "DescribeElasticGpus" // DescribeElasticGpusRequest generates a "aws/request.Request" representing the @@ -11405,7 +12655,7 @@ func (c *EC2) DescribeElasticGpusRequest(input *DescribeElasticGpusInput) (req * // // Describes the Elastic Graphics accelerator associated with your instances. // For more information about Elastic Graphics, see Amazon Elastic Graphics -// (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html). +// (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -11479,7 +12729,7 @@ func (c *EC2) DescribeExportTasksRequest(input *DescribeExportTasksInput) (req * // DescribeExportTasks API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your export tasks. +// Describes the specified export tasks or all your export tasks. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -11688,6 +12938,12 @@ func (c *EC2) DescribeFleetsRequest(input *DescribeFleetsInput) (req *request.Re Name: opDescribeFleets, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -11701,7 +12957,7 @@ func (c *EC2) DescribeFleetsRequest(input *DescribeFleetsInput) (req *request.Re // DescribeFleets API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your EC2 Fleets. +// Describes the specified EC2 Fleets or all your EC2 Fleets. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -11731,6 +12987,56 @@ func (c *EC2) DescribeFleetsWithContext(ctx aws.Context, input *DescribeFleetsIn return out, req.Send() } +// DescribeFleetsPages iterates over the pages of a DescribeFleets operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeFleets method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeFleets operation. +// pageNum := 0 +// err := client.DescribeFleetsPages(params, +// func(page *ec2.DescribeFleetsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeFleetsPages(input *DescribeFleetsInput, fn func(*DescribeFleetsOutput, bool) bool) error { + return c.DescribeFleetsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeFleetsPagesWithContext same as DescribeFleetsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeFleetsPagesWithContext(ctx aws.Context, input *DescribeFleetsInput, fn func(*DescribeFleetsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeFleetsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeFleetsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeFleetsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeFlowLogs = "DescribeFlowLogs" // DescribeFlowLogsRequest generates a "aws/request.Request" representing the @@ -11762,6 +13068,12 @@ func (c *EC2) DescribeFlowLogsRequest(input *DescribeFlowLogsInput) (req *reques Name: opDescribeFlowLogs, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -11807,6 +13119,56 @@ func (c *EC2) DescribeFlowLogsWithContext(ctx aws.Context, input *DescribeFlowLo return out, req.Send() } +// DescribeFlowLogsPages iterates over the pages of a DescribeFlowLogs operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeFlowLogs method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeFlowLogs operation. +// pageNum := 0 +// err := client.DescribeFlowLogsPages(params, +// func(page *ec2.DescribeFlowLogsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeFlowLogsPages(input *DescribeFlowLogsInput, fn func(*DescribeFlowLogsOutput, bool) bool) error { + return c.DescribeFlowLogsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeFlowLogsPagesWithContext same as DescribeFlowLogsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeFlowLogsPagesWithContext(ctx aws.Context, input *DescribeFlowLogsInput, fn func(*DescribeFlowLogsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeFlowLogsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeFlowLogsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeFlowLogsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeFpgaImageAttribute = "DescribeFpgaImageAttribute" // DescribeFpgaImageAttributeRequest generates a "aws/request.Request" representing the @@ -11912,6 +13274,12 @@ func (c *EC2) DescribeFpgaImagesRequest(input *DescribeFpgaImagesInput) (req *re Name: opDescribeFpgaImages, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -11925,9 +13293,9 @@ func (c *EC2) DescribeFpgaImagesRequest(input *DescribeFpgaImagesInput) (req *re // DescribeFpgaImages API operation for Amazon Elastic Compute Cloud. // -// Describes one or more available Amazon FPGA Images (AFIs). These include -// public AFIs, private AFIs that you own, and AFIs owned by other AWS accounts -// for which you have load permissions. +// Describes the Amazon FPGA Images (AFIs) available to you. These include public +// AFIs, private AFIs that you own, and AFIs owned by other AWS accounts for +// which you have load permissions. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -11957,6 +13325,56 @@ func (c *EC2) DescribeFpgaImagesWithContext(ctx aws.Context, input *DescribeFpga return out, req.Send() } +// DescribeFpgaImagesPages iterates over the pages of a DescribeFpgaImages operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeFpgaImages method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeFpgaImages operation. +// pageNum := 0 +// err := client.DescribeFpgaImagesPages(params, +// func(page *ec2.DescribeFpgaImagesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeFpgaImagesPages(input *DescribeFpgaImagesInput, fn func(*DescribeFpgaImagesOutput, bool) bool) error { + return c.DescribeFpgaImagesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeFpgaImagesPagesWithContext same as DescribeFpgaImagesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeFpgaImagesPagesWithContext(ctx aws.Context, input *DescribeFpgaImagesInput, fn func(*DescribeFpgaImagesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeFpgaImagesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeFpgaImagesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeFpgaImagesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeHostReservationOfferings = "DescribeHostReservationOfferings" // DescribeHostReservationOfferingsRequest generates a "aws/request.Request" representing the @@ -11988,6 +13406,12 @@ func (c *EC2) DescribeHostReservationOfferingsRequest(input *DescribeHostReserva Name: opDescribeHostReservationOfferings, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -12008,7 +13432,7 @@ func (c *EC2) DescribeHostReservationOfferingsRequest(input *DescribeHostReserva // Hosts. When purchasing an offering, ensure that the instance family and Region // of the offering matches that of the Dedicated Hosts with which it is to be // associated. For more information about supported instance types, see Dedicated -// Hosts Overview (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-overview.html) +// Hosts Overview (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-overview.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -12039,6 +13463,56 @@ func (c *EC2) DescribeHostReservationOfferingsWithContext(ctx aws.Context, input return out, req.Send() } +// DescribeHostReservationOfferingsPages iterates over the pages of a DescribeHostReservationOfferings operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeHostReservationOfferings method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeHostReservationOfferings operation. +// pageNum := 0 +// err := client.DescribeHostReservationOfferingsPages(params, +// func(page *ec2.DescribeHostReservationOfferingsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeHostReservationOfferingsPages(input *DescribeHostReservationOfferingsInput, fn func(*DescribeHostReservationOfferingsOutput, bool) bool) error { + return c.DescribeHostReservationOfferingsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeHostReservationOfferingsPagesWithContext same as DescribeHostReservationOfferingsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeHostReservationOfferingsPagesWithContext(ctx aws.Context, input *DescribeHostReservationOfferingsInput, fn func(*DescribeHostReservationOfferingsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeHostReservationOfferingsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeHostReservationOfferingsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeHostReservationOfferingsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeHostReservations = "DescribeHostReservations" // DescribeHostReservationsRequest generates a "aws/request.Request" representing the @@ -12070,6 +13544,12 @@ func (c *EC2) DescribeHostReservationsRequest(input *DescribeHostReservationsInp Name: opDescribeHostReservations, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -12113,6 +13593,56 @@ func (c *EC2) DescribeHostReservationsWithContext(ctx aws.Context, input *Descri return out, req.Send() } +// DescribeHostReservationsPages iterates over the pages of a DescribeHostReservations operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeHostReservations method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeHostReservations operation. +// pageNum := 0 +// err := client.DescribeHostReservationsPages(params, +// func(page *ec2.DescribeHostReservationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeHostReservationsPages(input *DescribeHostReservationsInput, fn func(*DescribeHostReservationsOutput, bool) bool) error { + return c.DescribeHostReservationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeHostReservationsPagesWithContext same as DescribeHostReservationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeHostReservationsPagesWithContext(ctx aws.Context, input *DescribeHostReservationsInput, fn func(*DescribeHostReservationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeHostReservationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeHostReservationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeHostReservationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeHosts = "DescribeHosts" // DescribeHostsRequest generates a "aws/request.Request" representing the @@ -12144,6 +13674,12 @@ func (c *EC2) DescribeHostsRequest(input *DescribeHostsInput) (req *request.Requ Name: opDescribeHosts, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -12157,7 +13693,7 @@ func (c *EC2) DescribeHostsRequest(input *DescribeHostsInput) (req *request.Requ // DescribeHosts API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your Dedicated Hosts. +// Describes the specified Dedicated Hosts or all your Dedicated Hosts. // // The results describe only the Dedicated Hosts in the Region you're currently // using. All listed instances consume capacity on your Dedicated Host. Dedicated @@ -12191,6 +13727,56 @@ func (c *EC2) DescribeHostsWithContext(ctx aws.Context, input *DescribeHostsInpu return out, req.Send() } +// DescribeHostsPages iterates over the pages of a DescribeHosts operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeHosts method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeHosts operation. +// pageNum := 0 +// err := client.DescribeHostsPages(params, +// func(page *ec2.DescribeHostsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeHostsPages(input *DescribeHostsInput, fn func(*DescribeHostsOutput, bool) bool) error { + return c.DescribeHostsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeHostsPagesWithContext same as DescribeHostsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeHostsPagesWithContext(ctx aws.Context, input *DescribeHostsInput, fn func(*DescribeHostsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeHostsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeHostsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeHostsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeIamInstanceProfileAssociations = "DescribeIamInstanceProfileAssociations" // DescribeIamInstanceProfileAssociationsRequest generates a "aws/request.Request" representing the @@ -12222,6 +13808,12 @@ func (c *EC2) DescribeIamInstanceProfileAssociationsRequest(input *DescribeIamIn Name: opDescribeIamInstanceProfileAssociations, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -12265,6 +13857,56 @@ func (c *EC2) DescribeIamInstanceProfileAssociationsWithContext(ctx aws.Context, return out, req.Send() } +// DescribeIamInstanceProfileAssociationsPages iterates over the pages of a DescribeIamInstanceProfileAssociations operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeIamInstanceProfileAssociations method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeIamInstanceProfileAssociations operation. +// pageNum := 0 +// err := client.DescribeIamInstanceProfileAssociationsPages(params, +// func(page *ec2.DescribeIamInstanceProfileAssociationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeIamInstanceProfileAssociationsPages(input *DescribeIamInstanceProfileAssociationsInput, fn func(*DescribeIamInstanceProfileAssociationsOutput, bool) bool) error { + return c.DescribeIamInstanceProfileAssociationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeIamInstanceProfileAssociationsPagesWithContext same as DescribeIamInstanceProfileAssociationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeIamInstanceProfileAssociationsPagesWithContext(ctx aws.Context, input *DescribeIamInstanceProfileAssociationsInput, fn func(*DescribeIamInstanceProfileAssociationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeIamInstanceProfileAssociationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeIamInstanceProfileAssociationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeIamInstanceProfileAssociationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeIdFormat = "DescribeIdFormat" // DescribeIdFormatRequest generates a "aws/request.Request" representing the @@ -12309,7 +13951,7 @@ func (c *EC2) DescribeIdFormatRequest(input *DescribeIdFormatInput) (req *reques // DescribeIdFormat API operation for Amazon Elastic Compute Cloud. // -// Describes the ID format settings for your resources on a per-region basis, +// Describes the ID format settings for your resources on a per-Region basis, // for example, to view which resource types are enabled for longer IDs. This // request only returns information about resource types whose ID formats can // be modified; it does not return information about other resource types. @@ -12405,7 +14047,7 @@ func (c *EC2) DescribeIdentityIdFormatRequest(input *DescribeIdentityIdFormatInp // IAM role, or root user. For example, you can view the resource types that // are enabled for longer IDs. This request only returns information about resource // types whose ID formats can be modified; it does not return information about -// other resource types. For more information, see Resource IDs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) +// other resource types. For more information, see Resource IDs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) // in the Amazon Elastic Compute Cloud User Guide. // // The following resource types support longer IDs: bundle | conversion-task @@ -12566,13 +14208,17 @@ func (c *EC2) DescribeImagesRequest(input *DescribeImagesInput) (req *request.Re // DescribeImages API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of the images (AMIs, AKIs, and ARIs) available to you. -// Images available to you include public images, private images that you own, -// and private images owned by other AWS accounts but for which you have explicit +// Describes the specified images (AMIs, AKIs, and ARIs) available to you or +// all of the images available to you. +// +// The images available to you include public images, private images that you +// own, and private images owned by other AWS accounts for which you have explicit // launch permissions. // -// Deregistered images are included in the returned results for an unspecified -// interval after deregistration. +// Recently deregistered images appear in the returned results for a short interval +// and then return empty results. After all instances that reference a deregistered +// AMI are terminated, specifying the ID of the image results in an error indicating +// that the AMI ID cannot be found. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -12633,6 +14279,12 @@ func (c *EC2) DescribeImportImageTasksRequest(input *DescribeImportImageTasksInp Name: opDescribeImportImageTasks, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -12677,6 +14329,56 @@ func (c *EC2) DescribeImportImageTasksWithContext(ctx aws.Context, input *Descri return out, req.Send() } +// DescribeImportImageTasksPages iterates over the pages of a DescribeImportImageTasks operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeImportImageTasks method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeImportImageTasks operation. +// pageNum := 0 +// err := client.DescribeImportImageTasksPages(params, +// func(page *ec2.DescribeImportImageTasksOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeImportImageTasksPages(input *DescribeImportImageTasksInput, fn func(*DescribeImportImageTasksOutput, bool) bool) error { + return c.DescribeImportImageTasksPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeImportImageTasksPagesWithContext same as DescribeImportImageTasksPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeImportImageTasksPagesWithContext(ctx aws.Context, input *DescribeImportImageTasksInput, fn func(*DescribeImportImageTasksOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeImportImageTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeImportImageTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeImportImageTasksOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeImportSnapshotTasks = "DescribeImportSnapshotTasks" // DescribeImportSnapshotTasksRequest generates a "aws/request.Request" representing the @@ -12708,6 +14410,12 @@ func (c *EC2) DescribeImportSnapshotTasksRequest(input *DescribeImportSnapshotTa Name: opDescribeImportSnapshotTasks, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -12751,6 +14459,56 @@ func (c *EC2) DescribeImportSnapshotTasksWithContext(ctx aws.Context, input *Des return out, req.Send() } +// DescribeImportSnapshotTasksPages iterates over the pages of a DescribeImportSnapshotTasks operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeImportSnapshotTasks method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeImportSnapshotTasks operation. +// pageNum := 0 +// err := client.DescribeImportSnapshotTasksPages(params, +// func(page *ec2.DescribeImportSnapshotTasksOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeImportSnapshotTasksPages(input *DescribeImportSnapshotTasksInput, fn func(*DescribeImportSnapshotTasksOutput, bool) bool) error { + return c.DescribeImportSnapshotTasksPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeImportSnapshotTasksPagesWithContext same as DescribeImportSnapshotTasksPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeImportSnapshotTasksPagesWithContext(ctx aws.Context, input *DescribeImportSnapshotTasksInput, fn func(*DescribeImportSnapshotTasksOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeImportSnapshotTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeImportSnapshotTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeImportSnapshotTasksOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeInstanceAttribute = "DescribeInstanceAttribute" // DescribeInstanceAttributeRequest generates a "aws/request.Request" representing the @@ -12860,6 +14618,12 @@ func (c *EC2) DescribeInstanceCreditSpecificationsRequest(input *DescribeInstanc Name: opDescribeInstanceCreditSpecifications, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -12873,8 +14637,8 @@ func (c *EC2) DescribeInstanceCreditSpecificationsRequest(input *DescribeInstanc // DescribeInstanceCreditSpecifications API operation for Amazon Elastic Compute Cloud. // -// Describes the credit option for CPU usage of one or more of your T2 or T3 -// instances. The credit options are standard and unlimited. +// Describes the credit option for CPU usage of the specified T2 or T3 instances. +// The credit options are standard and unlimited. // // If you do not specify an instance ID, Amazon EC2 returns T2 and T3 instances // with the unlimited credit option, as well as instances that were previously @@ -12895,7 +14659,7 @@ func (c *EC2) DescribeInstanceCreditSpecificationsRequest(input *DescribeInstanc // all, the call fails. If you specify only instance IDs in an unaffected zone, // the call works normally. // -// For more information, see Burstable Performance Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) +// For more information, see Burstable Performance Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -12926,6 +14690,56 @@ func (c *EC2) DescribeInstanceCreditSpecificationsWithContext(ctx aws.Context, i return out, req.Send() } +// DescribeInstanceCreditSpecificationsPages iterates over the pages of a DescribeInstanceCreditSpecifications operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeInstanceCreditSpecifications method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeInstanceCreditSpecifications operation. +// pageNum := 0 +// err := client.DescribeInstanceCreditSpecificationsPages(params, +// func(page *ec2.DescribeInstanceCreditSpecificationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeInstanceCreditSpecificationsPages(input *DescribeInstanceCreditSpecificationsInput, fn func(*DescribeInstanceCreditSpecificationsOutput, bool) bool) error { + return c.DescribeInstanceCreditSpecificationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeInstanceCreditSpecificationsPagesWithContext same as DescribeInstanceCreditSpecificationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeInstanceCreditSpecificationsPagesWithContext(ctx aws.Context, input *DescribeInstanceCreditSpecificationsInput, fn func(*DescribeInstanceCreditSpecificationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeInstanceCreditSpecificationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstanceCreditSpecificationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeInstanceCreditSpecificationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeInstanceStatus = "DescribeInstanceStatus" // DescribeInstanceStatusRequest generates a "aws/request.Request" representing the @@ -12976,27 +14790,27 @@ func (c *EC2) DescribeInstanceStatusRequest(input *DescribeInstanceStatusInput) // DescribeInstanceStatus API operation for Amazon Elastic Compute Cloud. // -// Describes the status of one or more instances. By default, only running instances -// are described, unless you specifically indicate to return the status of all -// instances. +// Describes the status of the specified instances or all of your instances. +// By default, only running instances are described, unless you specifically +// indicate to return the status of all instances. // // Instance status includes the following components: // // * Status checks - Amazon EC2 performs status checks on running EC2 instances // to identify hardware and software issues. For more information, see Status -// Checks for Your Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-system-instance-status-check.html) -// and Troubleshooting Instances with Failed Status Checks (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstances.html) +// Checks for Your Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-system-instance-status-check.html) +// and Troubleshooting Instances with Failed Status Checks (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstances.html) // in the Amazon Elastic Compute Cloud User Guide. // // * Scheduled events - Amazon EC2 can schedule events (such as reboot, stop, // or terminate) for your instances related to hardware issues, software // updates, or system maintenance. For more information, see Scheduled Events -// for Your Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html) +// for Your Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html) // in the Amazon Elastic Compute Cloud User Guide. // // * Instance state - You can manage your instances from the moment you launch // them through their termination. For more information, see Instance Lifecycle -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -13038,7 +14852,7 @@ func (c *EC2) DescribeInstanceStatusWithContext(ctx aws.Context, input *Describe // // Example iterating over at most 3 pages of a DescribeInstanceStatus operation. // pageNum := 0 // err := client.DescribeInstanceStatusPages(params, -// func(page *DescribeInstanceStatusOutput, lastPage bool) bool { +// func(page *ec2.DescribeInstanceStatusOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -13127,7 +14941,7 @@ func (c *EC2) DescribeInstancesRequest(input *DescribeInstancesInput) (req *requ // DescribeInstances API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your instances. +// Describes the specified instances or all of AWS account's instances. // // If you specify one or more instance IDs, Amazon EC2 returns information for // those instances. If you do not specify instance IDs, Amazon EC2 returns information @@ -13183,7 +14997,7 @@ func (c *EC2) DescribeInstancesWithContext(ctx aws.Context, input *DescribeInsta // // Example iterating over at most 3 pages of a DescribeInstances operation. // pageNum := 0 // err := client.DescribeInstancesPages(params, -// func(page *DescribeInstancesOutput, lastPage bool) bool { +// func(page *ec2.DescribeInstancesOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -13253,6 +15067,12 @@ func (c *EC2) DescribeInternetGatewaysRequest(input *DescribeInternetGatewaysInp Name: opDescribeInternetGateways, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -13296,6 +15116,56 @@ func (c *EC2) DescribeInternetGatewaysWithContext(ctx aws.Context, input *Descri return out, req.Send() } +// DescribeInternetGatewaysPages iterates over the pages of a DescribeInternetGateways operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeInternetGateways method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeInternetGateways operation. +// pageNum := 0 +// err := client.DescribeInternetGatewaysPages(params, +// func(page *ec2.DescribeInternetGatewaysOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeInternetGatewaysPages(input *DescribeInternetGatewaysInput, fn func(*DescribeInternetGatewaysOutput, bool) bool) error { + return c.DescribeInternetGatewaysPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeInternetGatewaysPagesWithContext same as DescribeInternetGatewaysPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeInternetGatewaysPagesWithContext(ctx aws.Context, input *DescribeInternetGatewaysInput, fn func(*DescribeInternetGatewaysOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeInternetGatewaysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInternetGatewaysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeInternetGatewaysOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeKeyPairs = "DescribeKeyPairs" // DescribeKeyPairsRequest generates a "aws/request.Request" representing the @@ -13340,9 +15210,9 @@ func (c *EC2) DescribeKeyPairsRequest(input *DescribeKeyPairsInput) (req *reques // DescribeKeyPairs API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your key pairs. +// Describes the specified key pairs or all of your key pairs. // -// For more information about key pairs, see Key Pairs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) +// For more information about key pairs, see Key Pairs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -13404,6 +15274,12 @@ func (c *EC2) DescribeLaunchTemplateVersionsRequest(input *DescribeLaunchTemplat Name: opDescribeLaunchTemplateVersions, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -13448,6 +15324,56 @@ func (c *EC2) DescribeLaunchTemplateVersionsWithContext(ctx aws.Context, input * return out, req.Send() } +// DescribeLaunchTemplateVersionsPages iterates over the pages of a DescribeLaunchTemplateVersions operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeLaunchTemplateVersions method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeLaunchTemplateVersions operation. +// pageNum := 0 +// err := client.DescribeLaunchTemplateVersionsPages(params, +// func(page *ec2.DescribeLaunchTemplateVersionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeLaunchTemplateVersionsPages(input *DescribeLaunchTemplateVersionsInput, fn func(*DescribeLaunchTemplateVersionsOutput, bool) bool) error { + return c.DescribeLaunchTemplateVersionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeLaunchTemplateVersionsPagesWithContext same as DescribeLaunchTemplateVersionsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeLaunchTemplateVersionsPagesWithContext(ctx aws.Context, input *DescribeLaunchTemplateVersionsInput, fn func(*DescribeLaunchTemplateVersionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeLaunchTemplateVersionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeLaunchTemplateVersionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeLaunchTemplateVersionsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeLaunchTemplates = "DescribeLaunchTemplates" // DescribeLaunchTemplatesRequest generates a "aws/request.Request" representing the @@ -13479,6 +15405,12 @@ func (c *EC2) DescribeLaunchTemplatesRequest(input *DescribeLaunchTemplatesInput Name: opDescribeLaunchTemplates, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -13522,6 +15454,56 @@ func (c *EC2) DescribeLaunchTemplatesWithContext(ctx aws.Context, input *Describ return out, req.Send() } +// DescribeLaunchTemplatesPages iterates over the pages of a DescribeLaunchTemplates operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeLaunchTemplates method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeLaunchTemplates operation. +// pageNum := 0 +// err := client.DescribeLaunchTemplatesPages(params, +// func(page *ec2.DescribeLaunchTemplatesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeLaunchTemplatesPages(input *DescribeLaunchTemplatesInput, fn func(*DescribeLaunchTemplatesOutput, bool) bool) error { + return c.DescribeLaunchTemplatesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeLaunchTemplatesPagesWithContext same as DescribeLaunchTemplatesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeLaunchTemplatesPagesWithContext(ctx aws.Context, input *DescribeLaunchTemplatesInput, fn func(*DescribeLaunchTemplatesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeLaunchTemplatesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeLaunchTemplatesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeLaunchTemplatesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeMovingAddresses = "DescribeMovingAddresses" // DescribeMovingAddressesRequest generates a "aws/request.Request" representing the @@ -13553,6 +15535,12 @@ func (c *EC2) DescribeMovingAddressesRequest(input *DescribeMovingAddressesInput Name: opDescribeMovingAddresses, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -13598,6 +15586,56 @@ func (c *EC2) DescribeMovingAddressesWithContext(ctx aws.Context, input *Describ return out, req.Send() } +// DescribeMovingAddressesPages iterates over the pages of a DescribeMovingAddresses operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeMovingAddresses method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeMovingAddresses operation. +// pageNum := 0 +// err := client.DescribeMovingAddressesPages(params, +// func(page *ec2.DescribeMovingAddressesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeMovingAddressesPages(input *DescribeMovingAddressesInput, fn func(*DescribeMovingAddressesOutput, bool) bool) error { + return c.DescribeMovingAddressesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeMovingAddressesPagesWithContext same as DescribeMovingAddressesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeMovingAddressesPagesWithContext(ctx aws.Context, input *DescribeMovingAddressesInput, fn func(*DescribeMovingAddressesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeMovingAddressesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeMovingAddressesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeMovingAddressesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeNatGateways = "DescribeNatGateways" // DescribeNatGatewaysRequest generates a "aws/request.Request" representing the @@ -13689,7 +15727,7 @@ func (c *EC2) DescribeNatGatewaysWithContext(ctx aws.Context, input *DescribeNat // // Example iterating over at most 3 pages of a DescribeNatGateways operation. // pageNum := 0 // err := client.DescribeNatGatewaysPages(params, -// func(page *DescribeNatGatewaysOutput, lastPage bool) bool { +// func(page *ec2.DescribeNatGatewaysOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -13759,6 +15797,12 @@ func (c *EC2) DescribeNetworkAclsRequest(input *DescribeNetworkAclsInput) (req * Name: opDescribeNetworkAcls, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -13774,7 +15818,7 @@ func (c *EC2) DescribeNetworkAclsRequest(input *DescribeNetworkAclsInput) (req * // // Describes one or more of your network ACLs. // -// For more information, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) +// For more information, see Network ACLs (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_ACLs.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -13805,6 +15849,56 @@ func (c *EC2) DescribeNetworkAclsWithContext(ctx aws.Context, input *DescribeNet return out, req.Send() } +// DescribeNetworkAclsPages iterates over the pages of a DescribeNetworkAcls operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeNetworkAcls method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeNetworkAcls operation. +// pageNum := 0 +// err := client.DescribeNetworkAclsPages(params, +// func(page *ec2.DescribeNetworkAclsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeNetworkAclsPages(input *DescribeNetworkAclsInput, fn func(*DescribeNetworkAclsOutput, bool) bool) error { + return c.DescribeNetworkAclsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeNetworkAclsPagesWithContext same as DescribeNetworkAclsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeNetworkAclsPagesWithContext(ctx aws.Context, input *DescribeNetworkAclsInput, fn func(*DescribeNetworkAclsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeNetworkAclsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeNetworkAclsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeNetworkAclsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeNetworkInterfaceAttribute = "DescribeNetworkInterfaceAttribute" // DescribeNetworkInterfaceAttributeRequest generates a "aws/request.Request" representing the @@ -13911,6 +16005,12 @@ func (c *EC2) DescribeNetworkInterfacePermissionsRequest(input *DescribeNetworkI Name: opDescribeNetworkInterfacePermissions, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -13954,6 +16054,56 @@ func (c *EC2) DescribeNetworkInterfacePermissionsWithContext(ctx aws.Context, in return out, req.Send() } +// DescribeNetworkInterfacePermissionsPages iterates over the pages of a DescribeNetworkInterfacePermissions operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeNetworkInterfacePermissions method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeNetworkInterfacePermissions operation. +// pageNum := 0 +// err := client.DescribeNetworkInterfacePermissionsPages(params, +// func(page *ec2.DescribeNetworkInterfacePermissionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeNetworkInterfacePermissionsPages(input *DescribeNetworkInterfacePermissionsInput, fn func(*DescribeNetworkInterfacePermissionsOutput, bool) bool) error { + return c.DescribeNetworkInterfacePermissionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeNetworkInterfacePermissionsPagesWithContext same as DescribeNetworkInterfacePermissionsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeNetworkInterfacePermissionsPagesWithContext(ctx aws.Context, input *DescribeNetworkInterfacePermissionsInput, fn func(*DescribeNetworkInterfacePermissionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeNetworkInterfacePermissionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeNetworkInterfacePermissionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeNetworkInterfacePermissionsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeNetworkInterfaces = "DescribeNetworkInterfaces" // DescribeNetworkInterfacesRequest generates a "aws/request.Request" representing the @@ -14045,7 +16195,7 @@ func (c *EC2) DescribeNetworkInterfacesWithContext(ctx aws.Context, input *Descr // // Example iterating over at most 3 pages of a DescribeNetworkInterfaces operation. // pageNum := 0 // err := client.DescribeNetworkInterfacesPages(params, -// func(page *DescribeNetworkInterfacesOutput, lastPage bool) bool { +// func(page *ec2.DescribeNetworkInterfacesOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -14128,8 +16278,8 @@ func (c *EC2) DescribePlacementGroupsRequest(input *DescribePlacementGroupsInput // DescribePlacementGroups API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your placement groups. For more information, see -// Placement Groups (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) +// Describes the specified placement groups or all of your placement groups. +// For more information, see Placement Groups (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -14191,6 +16341,12 @@ func (c *EC2) DescribePrefixListsRequest(input *DescribePrefixListsInput) (req * Name: opDescribePrefixLists, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -14239,6 +16395,56 @@ func (c *EC2) DescribePrefixListsWithContext(ctx aws.Context, input *DescribePre return out, req.Send() } +// DescribePrefixListsPages iterates over the pages of a DescribePrefixLists operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribePrefixLists method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribePrefixLists operation. +// pageNum := 0 +// err := client.DescribePrefixListsPages(params, +// func(page *ec2.DescribePrefixListsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribePrefixListsPages(input *DescribePrefixListsInput, fn func(*DescribePrefixListsOutput, bool) bool) error { + return c.DescribePrefixListsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribePrefixListsPagesWithContext same as DescribePrefixListsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribePrefixListsPagesWithContext(ctx aws.Context, input *DescribePrefixListsInput, fn func(*DescribePrefixListsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribePrefixListsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribePrefixListsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribePrefixListsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribePrincipalIdFormat = "DescribePrincipalIdFormat" // DescribePrincipalIdFormatRequest generates a "aws/request.Request" representing the @@ -14270,6 +16476,12 @@ func (c *EC2) DescribePrincipalIdFormatRequest(input *DescribePrincipalIdFormatI Name: opDescribePrincipalIdFormat, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -14327,6 +16539,56 @@ func (c *EC2) DescribePrincipalIdFormatWithContext(ctx aws.Context, input *Descr return out, req.Send() } +// DescribePrincipalIdFormatPages iterates over the pages of a DescribePrincipalIdFormat operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribePrincipalIdFormat method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribePrincipalIdFormat operation. +// pageNum := 0 +// err := client.DescribePrincipalIdFormatPages(params, +// func(page *ec2.DescribePrincipalIdFormatOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribePrincipalIdFormatPages(input *DescribePrincipalIdFormatInput, fn func(*DescribePrincipalIdFormatOutput, bool) bool) error { + return c.DescribePrincipalIdFormatPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribePrincipalIdFormatPagesWithContext same as DescribePrincipalIdFormatPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribePrincipalIdFormatPagesWithContext(ctx aws.Context, input *DescribePrincipalIdFormatInput, fn func(*DescribePrincipalIdFormatOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribePrincipalIdFormatInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribePrincipalIdFormatRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribePrincipalIdFormatOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribePublicIpv4Pools = "DescribePublicIpv4Pools" // DescribePublicIpv4PoolsRequest generates a "aws/request.Request" representing the @@ -14358,6 +16620,12 @@ func (c *EC2) DescribePublicIpv4PoolsRequest(input *DescribePublicIpv4PoolsInput Name: opDescribePublicIpv4Pools, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -14401,6 +16669,56 @@ func (c *EC2) DescribePublicIpv4PoolsWithContext(ctx aws.Context, input *Describ return out, req.Send() } +// DescribePublicIpv4PoolsPages iterates over the pages of a DescribePublicIpv4Pools operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribePublicIpv4Pools method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribePublicIpv4Pools operation. +// pageNum := 0 +// err := client.DescribePublicIpv4PoolsPages(params, +// func(page *ec2.DescribePublicIpv4PoolsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribePublicIpv4PoolsPages(input *DescribePublicIpv4PoolsInput, fn func(*DescribePublicIpv4PoolsOutput, bool) bool) error { + return c.DescribePublicIpv4PoolsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribePublicIpv4PoolsPagesWithContext same as DescribePublicIpv4PoolsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribePublicIpv4PoolsPagesWithContext(ctx aws.Context, input *DescribePublicIpv4PoolsInput, fn func(*DescribePublicIpv4PoolsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribePublicIpv4PoolsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribePublicIpv4PoolsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribePublicIpv4PoolsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeRegions = "DescribeRegions" // DescribeRegionsRequest generates a "aws/request.Request" representing the @@ -14445,10 +16763,14 @@ func (c *EC2) DescribeRegionsRequest(input *DescribeRegionsInput) (req *request. // DescribeRegions API operation for Amazon Elastic Compute Cloud. // -// Describes one or more regions that are currently available to you. +// Describes the Regions that are enabled for your account, or all Regions. // -// For a list of the regions supported by Amazon EC2, see Regions and Endpoints -// (http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region). +// For a list of the Regions supported by Amazon EC2, see Regions and Endpoints +// (https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region). +// +// For information about enabling and disabling Regions for your account, see +// Managing AWS Regions (https://docs.aws.amazon.com/general/latest/gr/rande-manage.html) +// in the AWS General Reference. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -14524,7 +16846,7 @@ func (c *EC2) DescribeReservedInstancesRequest(input *DescribeReservedInstancesI // // Describes one or more of the Reserved Instances that you purchased. // -// For more information about Reserved Instances, see Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts-on-demand-reserved-instances.html) +// For more information about Reserved Instances, see Reserved Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts-on-demand-reserved-instances.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -14619,7 +16941,7 @@ func (c *EC2) DescribeReservedInstancesListingsRequest(input *DescribeReservedIn // demand is met. You are charged based on the total price of all of the listings // that you purchase. // -// For more information, see Reserved Instance Marketplace (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) +// For more information, see Reserved Instance Marketplace (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -14705,7 +17027,7 @@ func (c *EC2) DescribeReservedInstancesModificationsRequest(input *DescribeReser // requests is returned. If a modification ID is specified, only information // about the specific modification is returned. // -// For more information, see Modifying Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-modifying.html) +// For more information, see Modifying Reserved Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-modifying.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -14747,7 +17069,7 @@ func (c *EC2) DescribeReservedInstancesModificationsWithContext(ctx aws.Context, // // Example iterating over at most 3 pages of a DescribeReservedInstancesModifications operation. // pageNum := 0 // err := client.DescribeReservedInstancesModificationsPages(params, -// func(page *DescribeReservedInstancesModificationsOutput, lastPage bool) bool { +// func(page *ec2.DescribeReservedInstancesModificationsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -14846,7 +17168,7 @@ func (c *EC2) DescribeReservedInstancesOfferingsRequest(input *DescribeReservedI // Marketplace, they will be excluded from these results. This is to ensure // that you do not purchase your own Reserved Instances. // -// For more information, see Reserved Instance Marketplace (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) +// For more information, see Reserved Instance Marketplace (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -14888,7 +17210,7 @@ func (c *EC2) DescribeReservedInstancesOfferingsWithContext(ctx aws.Context, inp // // Example iterating over at most 3 pages of a DescribeReservedInstancesOfferings operation. // pageNum := 0 // err := client.DescribeReservedInstancesOfferingsPages(params, -// func(page *DescribeReservedInstancesOfferingsOutput, lastPage bool) bool { +// func(page *ec2.DescribeReservedInstancesOfferingsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -14984,7 +17306,7 @@ func (c *EC2) DescribeRouteTablesRequest(input *DescribeRouteTablesInput) (req * // with the main route table. This command does not return the subnet ID for // implicit associations. // -// For more information, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// For more information, see Route Tables (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -15026,7 +17348,7 @@ func (c *EC2) DescribeRouteTablesWithContext(ctx aws.Context, input *DescribeRou // // Example iterating over at most 3 pages of a DescribeRouteTables operation. // pageNum := 0 // err := client.DescribeRouteTablesPages(params, -// func(page *DescribeRouteTablesOutput, lastPage bool) bool { +// func(page *ec2.DescribeRouteTablesOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -15096,6 +17418,12 @@ func (c *EC2) DescribeScheduledInstanceAvailabilityRequest(input *DescribeSchedu Name: opDescribeScheduledInstanceAvailability, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -15147,6 +17475,56 @@ func (c *EC2) DescribeScheduledInstanceAvailabilityWithContext(ctx aws.Context, return out, req.Send() } +// DescribeScheduledInstanceAvailabilityPages iterates over the pages of a DescribeScheduledInstanceAvailability operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeScheduledInstanceAvailability method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeScheduledInstanceAvailability operation. +// pageNum := 0 +// err := client.DescribeScheduledInstanceAvailabilityPages(params, +// func(page *ec2.DescribeScheduledInstanceAvailabilityOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeScheduledInstanceAvailabilityPages(input *DescribeScheduledInstanceAvailabilityInput, fn func(*DescribeScheduledInstanceAvailabilityOutput, bool) bool) error { + return c.DescribeScheduledInstanceAvailabilityPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeScheduledInstanceAvailabilityPagesWithContext same as DescribeScheduledInstanceAvailabilityPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeScheduledInstanceAvailabilityPagesWithContext(ctx aws.Context, input *DescribeScheduledInstanceAvailabilityInput, fn func(*DescribeScheduledInstanceAvailabilityOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeScheduledInstanceAvailabilityInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeScheduledInstanceAvailabilityRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeScheduledInstanceAvailabilityOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeScheduledInstances = "DescribeScheduledInstances" // DescribeScheduledInstancesRequest generates a "aws/request.Request" representing the @@ -15178,6 +17556,12 @@ func (c *EC2) DescribeScheduledInstancesRequest(input *DescribeScheduledInstance Name: opDescribeScheduledInstances, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -15191,7 +17575,7 @@ func (c *EC2) DescribeScheduledInstancesRequest(input *DescribeScheduledInstance // DescribeScheduledInstances API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your Scheduled Instances. +// Describes the specified Scheduled Instances or all your Scheduled Instances. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -15221,6 +17605,56 @@ func (c *EC2) DescribeScheduledInstancesWithContext(ctx aws.Context, input *Desc return out, req.Send() } +// DescribeScheduledInstancesPages iterates over the pages of a DescribeScheduledInstances operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeScheduledInstances method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeScheduledInstances operation. +// pageNum := 0 +// err := client.DescribeScheduledInstancesPages(params, +// func(page *ec2.DescribeScheduledInstancesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeScheduledInstancesPages(input *DescribeScheduledInstancesInput, fn func(*DescribeScheduledInstancesOutput, bool) bool) error { + return c.DescribeScheduledInstancesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeScheduledInstancesPagesWithContext same as DescribeScheduledInstancesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeScheduledInstancesPagesWithContext(ctx aws.Context, input *DescribeScheduledInstancesInput, fn func(*DescribeScheduledInstancesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeScheduledInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeScheduledInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeScheduledInstancesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeSecurityGroupReferences = "DescribeSecurityGroupReferences" // DescribeSecurityGroupReferencesRequest generates a "aws/request.Request" representing the @@ -15265,7 +17699,7 @@ func (c *EC2) DescribeSecurityGroupReferencesRequest(input *DescribeSecurityGrou // DescribeSecurityGroupReferences API operation for Amazon Elastic Compute Cloud. // -// [EC2-VPC only] Describes the VPCs on the other side of a VPC peering connection +// [VPC only] Describes the VPCs on the other side of a VPC peering connection // that are referencing the security groups you've specified in this request. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -15346,13 +17780,13 @@ func (c *EC2) DescribeSecurityGroupsRequest(input *DescribeSecurityGroupsInput) // DescribeSecurityGroups API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of your security groups. +// Describes the specified security groups or all of your security groups. // // A security group is for use with instances either in the EC2-Classic platform // or in a specific VPC. For more information, see Amazon EC2 Security Groups -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html) +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html) // in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your -// VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) +// VPC (https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -15394,7 +17828,7 @@ func (c *EC2) DescribeSecurityGroupsWithContext(ctx aws.Context, input *Describe // // Example iterating over at most 3 pages of a DescribeSecurityGroups operation. // pageNum := 0 // err := client.DescribeSecurityGroupsPages(params, -// func(page *DescribeSecurityGroupsOutput, lastPage bool) bool { +// func(page *ec2.DescribeSecurityGroupsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -15480,7 +17914,7 @@ func (c *EC2) DescribeSnapshotAttributeRequest(input *DescribeSnapshotAttributeI // Describes the specified attribute of the specified snapshot. You can specify // only one attribute at a time. // -// For more information about EBS snapshots, see Amazon EBS Snapshots (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html) +// For more information about EBS snapshots, see Amazon EBS Snapshots (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -15561,10 +17995,12 @@ func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *requ // DescribeSnapshots API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of the EBS snapshots available to you. Available snapshots -// include public snapshots available for any AWS account to launch, private -// snapshots that you own, and private snapshots owned by another AWS account -// but for which you've been given explicit create volume permissions. +// Describes the specified EBS snapshots available to you or all of the EBS +// snapshots available to you. +// +// The snapshots available to you include public snapshots, private snapshots +// that you own, and private snapshots owned by other AWS accounts for which +// you have explicit create volume permissions. // // The create volume permissions fall into the following categories: // @@ -15605,7 +18041,7 @@ func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *requ // a NextToken value that can be passed to a subsequent DescribeSnapshots request // to retrieve the remaining results. // -// For more information about EBS snapshots, see Amazon EBS Snapshots (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html) +// For more information about EBS snapshots, see Amazon EBS Snapshots (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -15647,7 +18083,7 @@ func (c *EC2) DescribeSnapshotsWithContext(ctx aws.Context, input *DescribeSnaps // // Example iterating over at most 3 pages of a DescribeSnapshots operation. // pageNum := 0 // err := client.DescribeSnapshotsPages(params, -// func(page *DescribeSnapshotsOutput, lastPage bool) bool { +// func(page *ec2.DescribeSnapshotsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -15731,7 +18167,7 @@ func (c *EC2) DescribeSpotDatafeedSubscriptionRequest(input *DescribeSpotDatafee // DescribeSpotDatafeedSubscription API operation for Amazon Elastic Compute Cloud. // // Describes the data feed for Spot Instances. For more information, see Spot -// Instance Data Feed (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) +// Instance Data Feed (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) // in the Amazon EC2 User Guide for Linux Instances. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -16009,7 +18445,7 @@ func (c *EC2) DescribeSpotFleetRequestsWithContext(ctx aws.Context, input *Descr // // Example iterating over at most 3 pages of a DescribeSpotFleetRequests operation. // pageNum := 0 // err := client.DescribeSpotFleetRequestsPages(params, -// func(page *DescribeSpotFleetRequestsOutput, lastPage bool) bool { +// func(page *ec2.DescribeSpotFleetRequestsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -16079,6 +18515,12 @@ func (c *EC2) DescribeSpotInstanceRequestsRequest(input *DescribeSpotInstanceReq Name: opDescribeSpotInstanceRequests, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -16138,6 +18580,56 @@ func (c *EC2) DescribeSpotInstanceRequestsWithContext(ctx aws.Context, input *De return out, req.Send() } +// DescribeSpotInstanceRequestsPages iterates over the pages of a DescribeSpotInstanceRequests operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeSpotInstanceRequests method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeSpotInstanceRequests operation. +// pageNum := 0 +// err := client.DescribeSpotInstanceRequestsPages(params, +// func(page *ec2.DescribeSpotInstanceRequestsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeSpotInstanceRequestsPages(input *DescribeSpotInstanceRequestsInput, fn func(*DescribeSpotInstanceRequestsOutput, bool) bool) error { + return c.DescribeSpotInstanceRequestsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeSpotInstanceRequestsPagesWithContext same as DescribeSpotInstanceRequestsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeSpotInstanceRequestsPagesWithContext(ctx aws.Context, input *DescribeSpotInstanceRequestsInput, fn func(*DescribeSpotInstanceRequestsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeSpotInstanceRequestsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSpotInstanceRequestsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeSpotInstanceRequestsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeSpotPriceHistory = "DescribeSpotPriceHistory" // DescribeSpotPriceHistoryRequest generates a "aws/request.Request" representing the @@ -16189,7 +18681,7 @@ func (c *EC2) DescribeSpotPriceHistoryRequest(input *DescribeSpotPriceHistoryInp // DescribeSpotPriceHistory API operation for Amazon Elastic Compute Cloud. // // Describes the Spot price history. For more information, see Spot Instance -// Pricing History (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances-history.html) +// Pricing History (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances-history.html) // in the Amazon EC2 User Guide for Linux Instances. // // When you specify a start and end time, this operation returns the prices @@ -16236,7 +18728,7 @@ func (c *EC2) DescribeSpotPriceHistoryWithContext(ctx aws.Context, input *Descri // // Example iterating over at most 3 pages of a DescribeSpotPriceHistory operation. // pageNum := 0 // err := client.DescribeSpotPriceHistoryPages(params, -// func(page *DescribeSpotPriceHistoryOutput, lastPage bool) bool { +// func(page *ec2.DescribeSpotPriceHistoryOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -16306,6 +18798,12 @@ func (c *EC2) DescribeStaleSecurityGroupsRequest(input *DescribeStaleSecurityGro Name: opDescribeStaleSecurityGroups, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -16319,10 +18817,10 @@ func (c *EC2) DescribeStaleSecurityGroupsRequest(input *DescribeStaleSecurityGro // DescribeStaleSecurityGroups API operation for Amazon Elastic Compute Cloud. // -// [EC2-VPC only] Describes the stale security group rules for security groups -// in a specified VPC. Rules are stale when they reference a deleted security -// group in a peer VPC, or a security group in a peer VPC for which the VPC -// peering connection has been deleted. +// [VPC only] Describes the stale security group rules for security groups in +// a specified VPC. Rules are stale when they reference a deleted security group +// in a peer VPC, or a security group in a peer VPC for which the VPC peering +// connection has been deleted. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -16352,6 +18850,56 @@ func (c *EC2) DescribeStaleSecurityGroupsWithContext(ctx aws.Context, input *Des return out, req.Send() } +// DescribeStaleSecurityGroupsPages iterates over the pages of a DescribeStaleSecurityGroups operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeStaleSecurityGroups method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeStaleSecurityGroups operation. +// pageNum := 0 +// err := client.DescribeStaleSecurityGroupsPages(params, +// func(page *ec2.DescribeStaleSecurityGroupsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeStaleSecurityGroupsPages(input *DescribeStaleSecurityGroupsInput, fn func(*DescribeStaleSecurityGroupsOutput, bool) bool) error { + return c.DescribeStaleSecurityGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeStaleSecurityGroupsPagesWithContext same as DescribeStaleSecurityGroupsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeStaleSecurityGroupsPagesWithContext(ctx aws.Context, input *DescribeStaleSecurityGroupsInput, fn func(*DescribeStaleSecurityGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeStaleSecurityGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStaleSecurityGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeStaleSecurityGroupsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeSubnets = "DescribeSubnets" // DescribeSubnetsRequest generates a "aws/request.Request" representing the @@ -16383,6 +18931,12 @@ func (c *EC2) DescribeSubnetsRequest(input *DescribeSubnetsInput) (req *request. Name: opDescribeSubnets, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -16398,7 +18952,7 @@ func (c *EC2) DescribeSubnetsRequest(input *DescribeSubnetsInput) (req *request. // // Describes one or more of your subnets. // -// For more information, see Your VPC and Subnets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) +// For more information, see Your VPC and Subnets (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -16429,6 +18983,56 @@ func (c *EC2) DescribeSubnetsWithContext(ctx aws.Context, input *DescribeSubnets return out, req.Send() } +// DescribeSubnetsPages iterates over the pages of a DescribeSubnets operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeSubnets method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeSubnets operation. +// pageNum := 0 +// err := client.DescribeSubnetsPages(params, +// func(page *ec2.DescribeSubnetsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeSubnetsPages(input *DescribeSubnetsInput, fn func(*DescribeSubnetsOutput, bool) bool) error { + return c.DescribeSubnetsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeSubnetsPagesWithContext same as DescribeSubnetsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeSubnetsPagesWithContext(ctx aws.Context, input *DescribeSubnetsInput, fn func(*DescribeSubnetsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeSubnetsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSubnetsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeSubnetsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeTags = "DescribeTags" // DescribeTagsRequest generates a "aws/request.Request" representing the @@ -16479,9 +19083,9 @@ func (c *EC2) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Reques // DescribeTags API operation for Amazon Elastic Compute Cloud. // -// Describes one or more of the tags for your EC2 resources. +// Describes the specified tags for your EC2 resources. // -// For more information about tags, see Tagging Your Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) +// For more information about tags, see Tagging Your Resources (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -16523,7 +19127,7 @@ func (c *EC2) DescribeTagsWithContext(ctx aws.Context, input *DescribeTagsInput, // // Example iterating over at most 3 pages of a DescribeTags operation. // pageNum := 0 // err := client.DescribeTagsPages(params, -// func(page *DescribeTagsOutput, lastPage bool) bool { +// func(page *ec2.DescribeTagsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -16562,6 +19166,397 @@ func (c *EC2) DescribeTagsPagesWithContext(ctx aws.Context, input *DescribeTagsI return p.Err() } +const opDescribeTrafficMirrorFilters = "DescribeTrafficMirrorFilters" + +// DescribeTrafficMirrorFiltersRequest generates a "aws/request.Request" representing the +// client's request for the DescribeTrafficMirrorFilters operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeTrafficMirrorFilters for more information on using the DescribeTrafficMirrorFilters +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeTrafficMirrorFiltersRequest method. +// req, resp := client.DescribeTrafficMirrorFiltersRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeTrafficMirrorFilters +func (c *EC2) DescribeTrafficMirrorFiltersRequest(input *DescribeTrafficMirrorFiltersInput) (req *request.Request, output *DescribeTrafficMirrorFiltersOutput) { + op := &request.Operation{ + Name: opDescribeTrafficMirrorFilters, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeTrafficMirrorFiltersInput{} + } + + output = &DescribeTrafficMirrorFiltersOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeTrafficMirrorFilters API operation for Amazon Elastic Compute Cloud. +// +// Describes one or more Traffic Mirror filters. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation DescribeTrafficMirrorFilters for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeTrafficMirrorFilters +func (c *EC2) DescribeTrafficMirrorFilters(input *DescribeTrafficMirrorFiltersInput) (*DescribeTrafficMirrorFiltersOutput, error) { + req, out := c.DescribeTrafficMirrorFiltersRequest(input) + return out, req.Send() +} + +// DescribeTrafficMirrorFiltersWithContext is the same as DescribeTrafficMirrorFilters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTrafficMirrorFilters for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTrafficMirrorFiltersWithContext(ctx aws.Context, input *DescribeTrafficMirrorFiltersInput, opts ...request.Option) (*DescribeTrafficMirrorFiltersOutput, error) { + req, out := c.DescribeTrafficMirrorFiltersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeTrafficMirrorFiltersPages iterates over the pages of a DescribeTrafficMirrorFilters operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeTrafficMirrorFilters method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeTrafficMirrorFilters operation. +// pageNum := 0 +// err := client.DescribeTrafficMirrorFiltersPages(params, +// func(page *ec2.DescribeTrafficMirrorFiltersOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeTrafficMirrorFiltersPages(input *DescribeTrafficMirrorFiltersInput, fn func(*DescribeTrafficMirrorFiltersOutput, bool) bool) error { + return c.DescribeTrafficMirrorFiltersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeTrafficMirrorFiltersPagesWithContext same as DescribeTrafficMirrorFiltersPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTrafficMirrorFiltersPagesWithContext(ctx aws.Context, input *DescribeTrafficMirrorFiltersInput, fn func(*DescribeTrafficMirrorFiltersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeTrafficMirrorFiltersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTrafficMirrorFiltersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTrafficMirrorFiltersOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opDescribeTrafficMirrorSessions = "DescribeTrafficMirrorSessions" + +// DescribeTrafficMirrorSessionsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeTrafficMirrorSessions operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeTrafficMirrorSessions for more information on using the DescribeTrafficMirrorSessions +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeTrafficMirrorSessionsRequest method. +// req, resp := client.DescribeTrafficMirrorSessionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeTrafficMirrorSessions +func (c *EC2) DescribeTrafficMirrorSessionsRequest(input *DescribeTrafficMirrorSessionsInput) (req *request.Request, output *DescribeTrafficMirrorSessionsOutput) { + op := &request.Operation{ + Name: opDescribeTrafficMirrorSessions, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeTrafficMirrorSessionsInput{} + } + + output = &DescribeTrafficMirrorSessionsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeTrafficMirrorSessions API operation for Amazon Elastic Compute Cloud. +// +// Describes one or more Traffic Mirror sessions. By default, all Traffic Mirror +// sessions are described. Alternatively, you can filter the results. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation DescribeTrafficMirrorSessions for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeTrafficMirrorSessions +func (c *EC2) DescribeTrafficMirrorSessions(input *DescribeTrafficMirrorSessionsInput) (*DescribeTrafficMirrorSessionsOutput, error) { + req, out := c.DescribeTrafficMirrorSessionsRequest(input) + return out, req.Send() +} + +// DescribeTrafficMirrorSessionsWithContext is the same as DescribeTrafficMirrorSessions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTrafficMirrorSessions for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTrafficMirrorSessionsWithContext(ctx aws.Context, input *DescribeTrafficMirrorSessionsInput, opts ...request.Option) (*DescribeTrafficMirrorSessionsOutput, error) { + req, out := c.DescribeTrafficMirrorSessionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeTrafficMirrorSessionsPages iterates over the pages of a DescribeTrafficMirrorSessions operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeTrafficMirrorSessions method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeTrafficMirrorSessions operation. +// pageNum := 0 +// err := client.DescribeTrafficMirrorSessionsPages(params, +// func(page *ec2.DescribeTrafficMirrorSessionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeTrafficMirrorSessionsPages(input *DescribeTrafficMirrorSessionsInput, fn func(*DescribeTrafficMirrorSessionsOutput, bool) bool) error { + return c.DescribeTrafficMirrorSessionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeTrafficMirrorSessionsPagesWithContext same as DescribeTrafficMirrorSessionsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTrafficMirrorSessionsPagesWithContext(ctx aws.Context, input *DescribeTrafficMirrorSessionsInput, fn func(*DescribeTrafficMirrorSessionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeTrafficMirrorSessionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTrafficMirrorSessionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTrafficMirrorSessionsOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opDescribeTrafficMirrorTargets = "DescribeTrafficMirrorTargets" + +// DescribeTrafficMirrorTargetsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeTrafficMirrorTargets operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeTrafficMirrorTargets for more information on using the DescribeTrafficMirrorTargets +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeTrafficMirrorTargetsRequest method. +// req, resp := client.DescribeTrafficMirrorTargetsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeTrafficMirrorTargets +func (c *EC2) DescribeTrafficMirrorTargetsRequest(input *DescribeTrafficMirrorTargetsInput) (req *request.Request, output *DescribeTrafficMirrorTargetsOutput) { + op := &request.Operation{ + Name: opDescribeTrafficMirrorTargets, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeTrafficMirrorTargetsInput{} + } + + output = &DescribeTrafficMirrorTargetsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeTrafficMirrorTargets API operation for Amazon Elastic Compute Cloud. +// +// Information about one or more Traffic Mirror targets. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation DescribeTrafficMirrorTargets for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeTrafficMirrorTargets +func (c *EC2) DescribeTrafficMirrorTargets(input *DescribeTrafficMirrorTargetsInput) (*DescribeTrafficMirrorTargetsOutput, error) { + req, out := c.DescribeTrafficMirrorTargetsRequest(input) + return out, req.Send() +} + +// DescribeTrafficMirrorTargetsWithContext is the same as DescribeTrafficMirrorTargets with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTrafficMirrorTargets for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTrafficMirrorTargetsWithContext(ctx aws.Context, input *DescribeTrafficMirrorTargetsInput, opts ...request.Option) (*DescribeTrafficMirrorTargetsOutput, error) { + req, out := c.DescribeTrafficMirrorTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeTrafficMirrorTargetsPages iterates over the pages of a DescribeTrafficMirrorTargets operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeTrafficMirrorTargets method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeTrafficMirrorTargets operation. +// pageNum := 0 +// err := client.DescribeTrafficMirrorTargetsPages(params, +// func(page *ec2.DescribeTrafficMirrorTargetsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeTrafficMirrorTargetsPages(input *DescribeTrafficMirrorTargetsInput, fn func(*DescribeTrafficMirrorTargetsOutput, bool) bool) error { + return c.DescribeTrafficMirrorTargetsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeTrafficMirrorTargetsPagesWithContext same as DescribeTrafficMirrorTargetsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTrafficMirrorTargetsPagesWithContext(ctx aws.Context, input *DescribeTrafficMirrorTargetsInput, fn func(*DescribeTrafficMirrorTargetsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeTrafficMirrorTargetsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTrafficMirrorTargetsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTrafficMirrorTargetsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeTransitGatewayAttachments = "DescribeTransitGatewayAttachments" // DescribeTransitGatewayAttachmentsRequest generates a "aws/request.Request" representing the @@ -16593,6 +19588,12 @@ func (c *EC2) DescribeTransitGatewayAttachmentsRequest(input *DescribeTransitGat Name: opDescribeTransitGatewayAttachments, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -16639,6 +19640,56 @@ func (c *EC2) DescribeTransitGatewayAttachmentsWithContext(ctx aws.Context, inpu return out, req.Send() } +// DescribeTransitGatewayAttachmentsPages iterates over the pages of a DescribeTransitGatewayAttachments operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeTransitGatewayAttachments method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeTransitGatewayAttachments operation. +// pageNum := 0 +// err := client.DescribeTransitGatewayAttachmentsPages(params, +// func(page *ec2.DescribeTransitGatewayAttachmentsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeTransitGatewayAttachmentsPages(input *DescribeTransitGatewayAttachmentsInput, fn func(*DescribeTransitGatewayAttachmentsOutput, bool) bool) error { + return c.DescribeTransitGatewayAttachmentsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeTransitGatewayAttachmentsPagesWithContext same as DescribeTransitGatewayAttachmentsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTransitGatewayAttachmentsPagesWithContext(ctx aws.Context, input *DescribeTransitGatewayAttachmentsInput, fn func(*DescribeTransitGatewayAttachmentsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeTransitGatewayAttachmentsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTransitGatewayAttachmentsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTransitGatewayAttachmentsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeTransitGatewayRouteTables = "DescribeTransitGatewayRouteTables" // DescribeTransitGatewayRouteTablesRequest generates a "aws/request.Request" representing the @@ -16670,6 +19721,12 @@ func (c *EC2) DescribeTransitGatewayRouteTablesRequest(input *DescribeTransitGat Name: opDescribeTransitGatewayRouteTables, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -16714,6 +19771,56 @@ func (c *EC2) DescribeTransitGatewayRouteTablesWithContext(ctx aws.Context, inpu return out, req.Send() } +// DescribeTransitGatewayRouteTablesPages iterates over the pages of a DescribeTransitGatewayRouteTables operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeTransitGatewayRouteTables method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeTransitGatewayRouteTables operation. +// pageNum := 0 +// err := client.DescribeTransitGatewayRouteTablesPages(params, +// func(page *ec2.DescribeTransitGatewayRouteTablesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeTransitGatewayRouteTablesPages(input *DescribeTransitGatewayRouteTablesInput, fn func(*DescribeTransitGatewayRouteTablesOutput, bool) bool) error { + return c.DescribeTransitGatewayRouteTablesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeTransitGatewayRouteTablesPagesWithContext same as DescribeTransitGatewayRouteTablesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTransitGatewayRouteTablesPagesWithContext(ctx aws.Context, input *DescribeTransitGatewayRouteTablesInput, fn func(*DescribeTransitGatewayRouteTablesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeTransitGatewayRouteTablesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTransitGatewayRouteTablesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTransitGatewayRouteTablesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeTransitGatewayVpcAttachments = "DescribeTransitGatewayVpcAttachments" // DescribeTransitGatewayVpcAttachmentsRequest generates a "aws/request.Request" representing the @@ -16745,6 +19852,12 @@ func (c *EC2) DescribeTransitGatewayVpcAttachmentsRequest(input *DescribeTransit Name: opDescribeTransitGatewayVpcAttachments, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -16789,6 +19902,56 @@ func (c *EC2) DescribeTransitGatewayVpcAttachmentsWithContext(ctx aws.Context, i return out, req.Send() } +// DescribeTransitGatewayVpcAttachmentsPages iterates over the pages of a DescribeTransitGatewayVpcAttachments operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeTransitGatewayVpcAttachments method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeTransitGatewayVpcAttachments operation. +// pageNum := 0 +// err := client.DescribeTransitGatewayVpcAttachmentsPages(params, +// func(page *ec2.DescribeTransitGatewayVpcAttachmentsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeTransitGatewayVpcAttachmentsPages(input *DescribeTransitGatewayVpcAttachmentsInput, fn func(*DescribeTransitGatewayVpcAttachmentsOutput, bool) bool) error { + return c.DescribeTransitGatewayVpcAttachmentsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeTransitGatewayVpcAttachmentsPagesWithContext same as DescribeTransitGatewayVpcAttachmentsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTransitGatewayVpcAttachmentsPagesWithContext(ctx aws.Context, input *DescribeTransitGatewayVpcAttachmentsInput, fn func(*DescribeTransitGatewayVpcAttachmentsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeTransitGatewayVpcAttachmentsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTransitGatewayVpcAttachmentsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTransitGatewayVpcAttachmentsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeTransitGateways = "DescribeTransitGateways" // DescribeTransitGatewaysRequest generates a "aws/request.Request" representing the @@ -16820,6 +19983,12 @@ func (c *EC2) DescribeTransitGatewaysRequest(input *DescribeTransitGatewaysInput Name: opDescribeTransitGateways, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -16864,6 +20033,56 @@ func (c *EC2) DescribeTransitGatewaysWithContext(ctx aws.Context, input *Describ return out, req.Send() } +// DescribeTransitGatewaysPages iterates over the pages of a DescribeTransitGateways operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeTransitGateways method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeTransitGateways operation. +// pageNum := 0 +// err := client.DescribeTransitGatewaysPages(params, +// func(page *ec2.DescribeTransitGatewaysOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeTransitGatewaysPages(input *DescribeTransitGatewaysInput, fn func(*DescribeTransitGatewaysOutput, bool) bool) error { + return c.DescribeTransitGatewaysPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeTransitGatewaysPagesWithContext same as DescribeTransitGatewaysPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeTransitGatewaysPagesWithContext(ctx aws.Context, input *DescribeTransitGatewaysInput, fn func(*DescribeTransitGatewaysOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeTransitGatewaysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTransitGatewaysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTransitGatewaysOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVolumeAttribute = "DescribeVolumeAttribute" // DescribeVolumeAttributeRequest generates a "aws/request.Request" representing the @@ -16911,7 +20130,7 @@ func (c *EC2) DescribeVolumeAttributeRequest(input *DescribeVolumeAttributeInput // Describes the specified attribute of the specified volume. You can specify // only one attribute at a time. // -// For more information about EBS volumes, see Amazon EBS Volumes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumes.html) +// For more information about EBS volumes, see Amazon EBS Volumes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumes.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -17010,7 +20229,7 @@ func (c *EC2) DescribeVolumeStatusRequest(input *DescribeVolumeStatusInput) (req // If the status is insufficient-data, then the checks may still be taking place // on your volume at the time. We recommend that you retry the request. For // more information about volume status, see Monitoring the Status of Your Volumes -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-volume-status.html) +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-volume-status.html) // in the Amazon Elastic Compute Cloud User Guide. // // Events: Reflect the cause of a volume status and may require you to take @@ -17068,7 +20287,7 @@ func (c *EC2) DescribeVolumeStatusWithContext(ctx aws.Context, input *DescribeVo // // Example iterating over at most 3 pages of a DescribeVolumeStatus operation. // pageNum := 0 // err := client.DescribeVolumeStatusPages(params, -// func(page *DescribeVolumeStatusOutput, lastPage bool) bool { +// func(page *ec2.DescribeVolumeStatusOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -17157,7 +20376,7 @@ func (c *EC2) DescribeVolumesRequest(input *DescribeVolumesInput) (req *request. // DescribeVolumes API operation for Amazon Elastic Compute Cloud. // -// Describes the specified EBS volumes. +// Describes the specified EBS volumes or all of your EBS volumes. // // If you are describing a long list of volumes, you can paginate the output // to make the list more manageable. The MaxResults parameter sets the maximum @@ -17166,7 +20385,7 @@ func (c *EC2) DescribeVolumesRequest(input *DescribeVolumesInput) (req *request. // a NextToken value that can be passed to a subsequent DescribeVolumes request // to retrieve the remaining results. // -// For more information about EBS volumes, see Amazon EBS Volumes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumes.html) +// For more information about EBS volumes, see Amazon EBS Volumes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumes.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -17208,7 +20427,7 @@ func (c *EC2) DescribeVolumesWithContext(ctx aws.Context, input *DescribeVolumes // // Example iterating over at most 3 pages of a DescribeVolumes operation. // pageNum := 0 // err := client.DescribeVolumesPages(params, -// func(page *DescribeVolumesOutput, lastPage bool) bool { +// func(page *ec2.DescribeVolumesOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -17278,6 +20497,12 @@ func (c *EC2) DescribeVolumesModificationsRequest(input *DescribeVolumesModifica Name: opDescribeVolumesModifications, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -17302,8 +20527,8 @@ func (c *EC2) DescribeVolumesModificationsRequest(input *DescribeVolumesModifica // // You can also use CloudWatch Events to check the status of a modification // to an EBS volume. For information about CloudWatch Events, see the Amazon -// CloudWatch Events User Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/). -// For more information, see Monitoring Volume Modifications" (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods) +// CloudWatch Events User Guide (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/). +// For more information, see Monitoring Volume Modifications" (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -17334,6 +20559,56 @@ func (c *EC2) DescribeVolumesModificationsWithContext(ctx aws.Context, input *De return out, req.Send() } +// DescribeVolumesModificationsPages iterates over the pages of a DescribeVolumesModifications operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVolumesModifications method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVolumesModifications operation. +// pageNum := 0 +// err := client.DescribeVolumesModificationsPages(params, +// func(page *ec2.DescribeVolumesModificationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeVolumesModificationsPages(input *DescribeVolumesModificationsInput, fn func(*DescribeVolumesModificationsOutput, bool) bool) error { + return c.DescribeVolumesModificationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVolumesModificationsPagesWithContext same as DescribeVolumesModificationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeVolumesModificationsPagesWithContext(ctx aws.Context, input *DescribeVolumesModificationsInput, fn func(*DescribeVolumesModificationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVolumesModificationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVolumesModificationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVolumesModificationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVpcAttribute = "DescribeVpcAttribute" // DescribeVpcAttributeRequest generates a "aws/request.Request" representing the @@ -17514,6 +20789,12 @@ func (c *EC2) DescribeVpcClassicLinkDnsSupportRequest(input *DescribeVpcClassicL Name: opDescribeVpcClassicLinkDnsSupport, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -17532,7 +20813,7 @@ func (c *EC2) DescribeVpcClassicLinkDnsSupportRequest(input *DescribeVpcClassicL // IP address when addressed from an instance in the VPC to which it's linked. // Similarly, the DNS hostname of an instance in a VPC resolves to its private // IP address when addressed from a linked EC2-Classic instance. For more information, -// see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) +// see ClassicLink (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -17563,6 +20844,56 @@ func (c *EC2) DescribeVpcClassicLinkDnsSupportWithContext(ctx aws.Context, input return out, req.Send() } +// DescribeVpcClassicLinkDnsSupportPages iterates over the pages of a DescribeVpcClassicLinkDnsSupport operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVpcClassicLinkDnsSupport method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVpcClassicLinkDnsSupport operation. +// pageNum := 0 +// err := client.DescribeVpcClassicLinkDnsSupportPages(params, +// func(page *ec2.DescribeVpcClassicLinkDnsSupportOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeVpcClassicLinkDnsSupportPages(input *DescribeVpcClassicLinkDnsSupportInput, fn func(*DescribeVpcClassicLinkDnsSupportOutput, bool) bool) error { + return c.DescribeVpcClassicLinkDnsSupportPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVpcClassicLinkDnsSupportPagesWithContext same as DescribeVpcClassicLinkDnsSupportPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeVpcClassicLinkDnsSupportPagesWithContext(ctx aws.Context, input *DescribeVpcClassicLinkDnsSupportInput, fn func(*DescribeVpcClassicLinkDnsSupportOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVpcClassicLinkDnsSupportInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcClassicLinkDnsSupportRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVpcClassicLinkDnsSupportOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVpcEndpointConnectionNotifications = "DescribeVpcEndpointConnectionNotifications" // DescribeVpcEndpointConnectionNotificationsRequest generates a "aws/request.Request" representing the @@ -17594,6 +20925,12 @@ func (c *EC2) DescribeVpcEndpointConnectionNotificationsRequest(input *DescribeV Name: opDescribeVpcEndpointConnectionNotifications, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -17638,6 +20975,56 @@ func (c *EC2) DescribeVpcEndpointConnectionNotificationsWithContext(ctx aws.Cont return out, req.Send() } +// DescribeVpcEndpointConnectionNotificationsPages iterates over the pages of a DescribeVpcEndpointConnectionNotifications operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVpcEndpointConnectionNotifications method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVpcEndpointConnectionNotifications operation. +// pageNum := 0 +// err := client.DescribeVpcEndpointConnectionNotificationsPages(params, +// func(page *ec2.DescribeVpcEndpointConnectionNotificationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeVpcEndpointConnectionNotificationsPages(input *DescribeVpcEndpointConnectionNotificationsInput, fn func(*DescribeVpcEndpointConnectionNotificationsOutput, bool) bool) error { + return c.DescribeVpcEndpointConnectionNotificationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVpcEndpointConnectionNotificationsPagesWithContext same as DescribeVpcEndpointConnectionNotificationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeVpcEndpointConnectionNotificationsPagesWithContext(ctx aws.Context, input *DescribeVpcEndpointConnectionNotificationsInput, fn func(*DescribeVpcEndpointConnectionNotificationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVpcEndpointConnectionNotificationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcEndpointConnectionNotificationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVpcEndpointConnectionNotificationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVpcEndpointConnections = "DescribeVpcEndpointConnections" // DescribeVpcEndpointConnectionsRequest generates a "aws/request.Request" representing the @@ -17669,6 +21056,12 @@ func (c *EC2) DescribeVpcEndpointConnectionsRequest(input *DescribeVpcEndpointCo Name: opDescribeVpcEndpointConnections, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -17713,6 +21106,56 @@ func (c *EC2) DescribeVpcEndpointConnectionsWithContext(ctx aws.Context, input * return out, req.Send() } +// DescribeVpcEndpointConnectionsPages iterates over the pages of a DescribeVpcEndpointConnections operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVpcEndpointConnections method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVpcEndpointConnections operation. +// pageNum := 0 +// err := client.DescribeVpcEndpointConnectionsPages(params, +// func(page *ec2.DescribeVpcEndpointConnectionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeVpcEndpointConnectionsPages(input *DescribeVpcEndpointConnectionsInput, fn func(*DescribeVpcEndpointConnectionsOutput, bool) bool) error { + return c.DescribeVpcEndpointConnectionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVpcEndpointConnectionsPagesWithContext same as DescribeVpcEndpointConnectionsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeVpcEndpointConnectionsPagesWithContext(ctx aws.Context, input *DescribeVpcEndpointConnectionsInput, fn func(*DescribeVpcEndpointConnectionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVpcEndpointConnectionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcEndpointConnectionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVpcEndpointConnectionsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVpcEndpointServiceConfigurations = "DescribeVpcEndpointServiceConfigurations" // DescribeVpcEndpointServiceConfigurationsRequest generates a "aws/request.Request" representing the @@ -17744,6 +21187,12 @@ func (c *EC2) DescribeVpcEndpointServiceConfigurationsRequest(input *DescribeVpc Name: opDescribeVpcEndpointServiceConfigurations, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -17787,6 +21236,56 @@ func (c *EC2) DescribeVpcEndpointServiceConfigurationsWithContext(ctx aws.Contex return out, req.Send() } +// DescribeVpcEndpointServiceConfigurationsPages iterates over the pages of a DescribeVpcEndpointServiceConfigurations operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVpcEndpointServiceConfigurations method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVpcEndpointServiceConfigurations operation. +// pageNum := 0 +// err := client.DescribeVpcEndpointServiceConfigurationsPages(params, +// func(page *ec2.DescribeVpcEndpointServiceConfigurationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeVpcEndpointServiceConfigurationsPages(input *DescribeVpcEndpointServiceConfigurationsInput, fn func(*DescribeVpcEndpointServiceConfigurationsOutput, bool) bool) error { + return c.DescribeVpcEndpointServiceConfigurationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVpcEndpointServiceConfigurationsPagesWithContext same as DescribeVpcEndpointServiceConfigurationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeVpcEndpointServiceConfigurationsPagesWithContext(ctx aws.Context, input *DescribeVpcEndpointServiceConfigurationsInput, fn func(*DescribeVpcEndpointServiceConfigurationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVpcEndpointServiceConfigurationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcEndpointServiceConfigurationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVpcEndpointServiceConfigurationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVpcEndpointServicePermissions = "DescribeVpcEndpointServicePermissions" // DescribeVpcEndpointServicePermissionsRequest generates a "aws/request.Request" representing the @@ -17818,6 +21317,12 @@ func (c *EC2) DescribeVpcEndpointServicePermissionsRequest(input *DescribeVpcEnd Name: opDescribeVpcEndpointServicePermissions, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -17862,6 +21367,56 @@ func (c *EC2) DescribeVpcEndpointServicePermissionsWithContext(ctx aws.Context, return out, req.Send() } +// DescribeVpcEndpointServicePermissionsPages iterates over the pages of a DescribeVpcEndpointServicePermissions operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVpcEndpointServicePermissions method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVpcEndpointServicePermissions operation. +// pageNum := 0 +// err := client.DescribeVpcEndpointServicePermissionsPages(params, +// func(page *ec2.DescribeVpcEndpointServicePermissionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeVpcEndpointServicePermissionsPages(input *DescribeVpcEndpointServicePermissionsInput, fn func(*DescribeVpcEndpointServicePermissionsOutput, bool) bool) error { + return c.DescribeVpcEndpointServicePermissionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVpcEndpointServicePermissionsPagesWithContext same as DescribeVpcEndpointServicePermissionsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeVpcEndpointServicePermissionsPagesWithContext(ctx aws.Context, input *DescribeVpcEndpointServicePermissionsInput, fn func(*DescribeVpcEndpointServicePermissionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVpcEndpointServicePermissionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcEndpointServicePermissionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVpcEndpointServicePermissionsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVpcEndpointServices = "DescribeVpcEndpointServices" // DescribeVpcEndpointServicesRequest generates a "aws/request.Request" representing the @@ -17967,6 +21522,12 @@ func (c *EC2) DescribeVpcEndpointsRequest(input *DescribeVpcEndpointsInput) (req Name: opDescribeVpcEndpoints, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -18010,6 +21571,56 @@ func (c *EC2) DescribeVpcEndpointsWithContext(ctx aws.Context, input *DescribeVp return out, req.Send() } +// DescribeVpcEndpointsPages iterates over the pages of a DescribeVpcEndpoints operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVpcEndpoints method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVpcEndpoints operation. +// pageNum := 0 +// err := client.DescribeVpcEndpointsPages(params, +// func(page *ec2.DescribeVpcEndpointsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeVpcEndpointsPages(input *DescribeVpcEndpointsInput, fn func(*DescribeVpcEndpointsOutput, bool) bool) error { + return c.DescribeVpcEndpointsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVpcEndpointsPagesWithContext same as DescribeVpcEndpointsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeVpcEndpointsPagesWithContext(ctx aws.Context, input *DescribeVpcEndpointsInput, fn func(*DescribeVpcEndpointsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVpcEndpointsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcEndpointsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVpcEndpointsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVpcPeeringConnections = "DescribeVpcPeeringConnections" // DescribeVpcPeeringConnectionsRequest generates a "aws/request.Request" representing the @@ -18041,6 +21652,12 @@ func (c *EC2) DescribeVpcPeeringConnectionsRequest(input *DescribeVpcPeeringConn Name: opDescribeVpcPeeringConnections, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -18084,6 +21701,56 @@ func (c *EC2) DescribeVpcPeeringConnectionsWithContext(ctx aws.Context, input *D return out, req.Send() } +// DescribeVpcPeeringConnectionsPages iterates over the pages of a DescribeVpcPeeringConnections operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVpcPeeringConnections method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVpcPeeringConnections operation. +// pageNum := 0 +// err := client.DescribeVpcPeeringConnectionsPages(params, +// func(page *ec2.DescribeVpcPeeringConnectionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeVpcPeeringConnectionsPages(input *DescribeVpcPeeringConnectionsInput, fn func(*DescribeVpcPeeringConnectionsOutput, bool) bool) error { + return c.DescribeVpcPeeringConnectionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVpcPeeringConnectionsPagesWithContext same as DescribeVpcPeeringConnectionsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeVpcPeeringConnectionsPagesWithContext(ctx aws.Context, input *DescribeVpcPeeringConnectionsInput, fn func(*DescribeVpcPeeringConnectionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVpcPeeringConnectionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcPeeringConnectionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVpcPeeringConnectionsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVpcs = "DescribeVpcs" // DescribeVpcsRequest generates a "aws/request.Request" representing the @@ -18115,6 +21782,12 @@ func (c *EC2) DescribeVpcsRequest(input *DescribeVpcsInput) (req *request.Reques Name: opDescribeVpcs, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -18158,6 +21831,56 @@ func (c *EC2) DescribeVpcsWithContext(ctx aws.Context, input *DescribeVpcsInput, return out, req.Send() } +// DescribeVpcsPages iterates over the pages of a DescribeVpcs operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVpcs method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVpcs operation. +// pageNum := 0 +// err := client.DescribeVpcsPages(params, +// func(page *ec2.DescribeVpcsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeVpcsPages(input *DescribeVpcsInput, fn func(*DescribeVpcsOutput, bool) bool) error { + return c.DescribeVpcsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVpcsPagesWithContext same as DescribeVpcsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeVpcsPagesWithContext(ctx aws.Context, input *DescribeVpcsInput, fn func(*DescribeVpcsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVpcsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVpcsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opDescribeVpnConnections = "DescribeVpnConnections" // DescribeVpnConnectionsRequest generates a "aws/request.Request" representing the @@ -18204,9 +21927,8 @@ func (c *EC2) DescribeVpnConnectionsRequest(input *DescribeVpnConnectionsInput) // // Describes one or more of your VPN connections. // -// For more information about VPN connections, see AWS Managed VPN Connections -// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) in the -// Amazon Virtual Private Cloud User Guide. +// For more information, see AWS Site-to-Site VPN (https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html) +// in the AWS Site-to-Site VPN User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -18282,9 +22004,8 @@ func (c *EC2) DescribeVpnGatewaysRequest(input *DescribeVpnGatewaysInput) (req * // // Describes one or more of your virtual private gateways. // -// For more information about virtual private gateways, see AWS Managed VPN -// Connections (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. +// For more information, see AWS Site-to-Site VPN (https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html) +// in the AWS Site-to-Site VPN User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -18598,7 +22319,7 @@ func (c *EC2) DetachVolumeRequest(input *DetachVolumeInput) (req *request.Reques // When a volume with an AWS Marketplace product code is detached from an instance, // the product code is no longer associated with the instance. // -// For more information, see Detaching an Amazon EBS Volume (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-detaching-volume.html) +// For more information, see Detaching an Amazon EBS Volume (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-detaching-volume.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -18711,6 +22432,89 @@ func (c *EC2) DetachVpnGatewayWithContext(ctx aws.Context, input *DetachVpnGatew return out, req.Send() } +const opDisableEbsEncryptionByDefault = "DisableEbsEncryptionByDefault" + +// DisableEbsEncryptionByDefaultRequest generates a "aws/request.Request" representing the +// client's request for the DisableEbsEncryptionByDefault operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DisableEbsEncryptionByDefault for more information on using the DisableEbsEncryptionByDefault +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DisableEbsEncryptionByDefaultRequest method. +// req, resp := client.DisableEbsEncryptionByDefaultRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisableEbsEncryptionByDefault +func (c *EC2) DisableEbsEncryptionByDefaultRequest(input *DisableEbsEncryptionByDefaultInput) (req *request.Request, output *DisableEbsEncryptionByDefaultOutput) { + op := &request.Operation{ + Name: opDisableEbsEncryptionByDefault, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DisableEbsEncryptionByDefaultInput{} + } + + output = &DisableEbsEncryptionByDefaultOutput{} + req = c.newRequest(op, input, output) + return +} + +// DisableEbsEncryptionByDefault API operation for Amazon Elastic Compute Cloud. +// +// Disables EBS encryption by default for your account in the current Region. +// +// After you disable encryption by default, you can still create encrypted volumes +// by enabling encryption when you create each volume. +// +// Disabling encryption by default does not change the encryption status of +// your existing volumes. +// +// For more information, see Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation DisableEbsEncryptionByDefault for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisableEbsEncryptionByDefault +func (c *EC2) DisableEbsEncryptionByDefault(input *DisableEbsEncryptionByDefaultInput) (*DisableEbsEncryptionByDefaultOutput, error) { + req, out := c.DisableEbsEncryptionByDefaultRequest(input) + return out, req.Send() +} + +// DisableEbsEncryptionByDefaultWithContext is the same as DisableEbsEncryptionByDefault with the addition of +// the ability to pass a context and additional request options. +// +// See DisableEbsEncryptionByDefault for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DisableEbsEncryptionByDefaultWithContext(ctx aws.Context, input *DisableEbsEncryptionByDefaultInput, opts ...request.Option) (*DisableEbsEncryptionByDefaultOutput, error) { + req, out := c.DisableEbsEncryptionByDefaultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDisableTransitGatewayRouteTablePropagation = "DisableTransitGatewayRouteTablePropagation" // DisableTransitGatewayRouteTablePropagationRequest generates a "aws/request.Request" representing the @@ -18984,7 +22788,7 @@ func (c *EC2) DisableVpcClassicLinkDnsSupportRequest(input *DisableVpcClassicLin // Disables ClassicLink DNS support for a VPC. If disabled, DNS hostnames resolve // to public IP addresses when addressed between a linked EC2-Classic instance // and instances in the VPC to which it's linked. For more information, see -// ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) +// ClassicLink (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -19064,7 +22868,7 @@ func (c *EC2) DisassociateAddressRequest(input *DisassociateAddressInput) (req * // it's associated with. // // An Elastic IP address is for use in either the EC2-Classic platform or in -// a VPC. For more information, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// a VPC. For more information, see Elastic IP Addresses (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) // in the Amazon Elastic Compute Cloud User Guide. // // This is an idempotent operation. If you perform the operation more than once, @@ -19307,7 +23111,7 @@ func (c *EC2) DisassociateRouteTableRequest(input *DisassociateRouteTableInput) // // After you perform this action, the subnet no longer uses the routes in the // route table. Instead, it uses the routes in the VPC's main route table. For -// more information about route tables, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// more information about route tables, see Route Tables (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -19568,6 +23372,96 @@ func (c *EC2) DisassociateVpcCidrBlockWithContext(ctx aws.Context, input *Disass return out, req.Send() } +const opEnableEbsEncryptionByDefault = "EnableEbsEncryptionByDefault" + +// EnableEbsEncryptionByDefaultRequest generates a "aws/request.Request" representing the +// client's request for the EnableEbsEncryptionByDefault operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See EnableEbsEncryptionByDefault for more information on using the EnableEbsEncryptionByDefault +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the EnableEbsEncryptionByDefaultRequest method. +// req, resp := client.EnableEbsEncryptionByDefaultRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EnableEbsEncryptionByDefault +func (c *EC2) EnableEbsEncryptionByDefaultRequest(input *EnableEbsEncryptionByDefaultInput) (req *request.Request, output *EnableEbsEncryptionByDefaultOutput) { + op := &request.Operation{ + Name: opEnableEbsEncryptionByDefault, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &EnableEbsEncryptionByDefaultInput{} + } + + output = &EnableEbsEncryptionByDefaultOutput{} + req = c.newRequest(op, input, output) + return +} + +// EnableEbsEncryptionByDefault API operation for Amazon Elastic Compute Cloud. +// +// Enables EBS encryption by default for your account in the current Region. +// +// After you enable encryption by default, the EBS volumes that you create are +// are always encrypted, either using the default CMK or the CMK that you specified +// when you created each volume. For more information, see Amazon EBS Encryption +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// You can specify the default CMK for encryption by default using ModifyEbsDefaultKmsKeyId +// or ResetEbsDefaultKmsKeyId. +// +// Enabling encryption by default has no effect on the encryption status of +// your existing volumes. +// +// After you enable encryption by default, you can no longer launch instances +// using instance types that do not support encryption. For more information, +// see Supported Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation EnableEbsEncryptionByDefault for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EnableEbsEncryptionByDefault +func (c *EC2) EnableEbsEncryptionByDefault(input *EnableEbsEncryptionByDefaultInput) (*EnableEbsEncryptionByDefaultOutput, error) { + req, out := c.EnableEbsEncryptionByDefaultRequest(input) + return out, req.Send() +} + +// EnableEbsEncryptionByDefaultWithContext is the same as EnableEbsEncryptionByDefault with the addition of +// the ability to pass a context and additional request options. +// +// See EnableEbsEncryptionByDefault for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) EnableEbsEncryptionByDefaultWithContext(ctx aws.Context, input *EnableEbsEncryptionByDefaultInput, opts ...request.Option) (*EnableEbsEncryptionByDefaultOutput, error) { + req, out := c.EnableEbsEncryptionByDefaultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opEnableTransitGatewayRouteTablePropagation = "EnableTransitGatewayRouteTablePropagation" // EnableTransitGatewayRouteTablePropagationRequest generates a "aws/request.Request" representing the @@ -19844,7 +23738,7 @@ func (c *EC2) EnableVpcClassicLinkRequest(input *EnableVpcClassicLinkInput) (req // You cannot enable your VPC for ClassicLink if any of your VPC route tables // have existing routes for address ranges within the 10.0.0.0/8 IP address // range, excluding local routes for VPCs in the 10.0.0.0/16 and 10.1.0.0/16 -// IP address ranges. For more information, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) +// IP address ranges. For more information, see ClassicLink (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -19924,7 +23818,7 @@ func (c *EC2) EnableVpcClassicLinkDnsSupportRequest(input *EnableVpcClassicLinkD // IP address when addressed from an instance in the VPC to which it's linked. // Similarly, the DNS hostname of an instance in a VPC resolves to its private // IP address when addressed from a linked EC2-Classic instance. For more information, -// see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) +// see ClassicLink (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -20183,6 +24077,78 @@ func (c *EC2) ExportTransitGatewayRoutesWithContext(ctx aws.Context, input *Expo return out, req.Send() } +const opGetCapacityReservationUsage = "GetCapacityReservationUsage" + +// GetCapacityReservationUsageRequest generates a "aws/request.Request" representing the +// client's request for the GetCapacityReservationUsage operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetCapacityReservationUsage for more information on using the GetCapacityReservationUsage +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetCapacityReservationUsageRequest method. +// req, resp := client.GetCapacityReservationUsageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetCapacityReservationUsage +func (c *EC2) GetCapacityReservationUsageRequest(input *GetCapacityReservationUsageInput) (req *request.Request, output *GetCapacityReservationUsageOutput) { + op := &request.Operation{ + Name: opGetCapacityReservationUsage, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetCapacityReservationUsageInput{} + } + + output = &GetCapacityReservationUsageOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetCapacityReservationUsage API operation for Amazon Elastic Compute Cloud. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation GetCapacityReservationUsage for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetCapacityReservationUsage +func (c *EC2) GetCapacityReservationUsage(input *GetCapacityReservationUsageInput) (*GetCapacityReservationUsageOutput, error) { + req, out := c.GetCapacityReservationUsageRequest(input) + return out, req.Send() +} + +// GetCapacityReservationUsageWithContext is the same as GetCapacityReservationUsage with the addition of +// the ability to pass a context and additional request options. +// +// See GetCapacityReservationUsage for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) GetCapacityReservationUsageWithContext(ctx aws.Context, input *GetCapacityReservationUsageInput, opts ...request.Option) (*GetCapacityReservationUsageOutput, error) { + req, out := c.GetCapacityReservationUsageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opGetConsoleOutput = "GetConsoleOutput" // GetConsoleOutputRequest generates a "aws/request.Request" representing the @@ -20242,7 +24208,7 @@ func (c *EC2) GetConsoleOutputRequest(input *GetConsoleOutputInput) (req *reques // during the instance lifecycle. This option is supported on instance types // that use the Nitro hypervisor. // -// For more information, see Instance Console Output (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-console.html#instance-console-console-output) +// For more information, see Instance Console Output (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-console.html#instance-console-console-output) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -20349,6 +24315,163 @@ func (c *EC2) GetConsoleScreenshotWithContext(ctx aws.Context, input *GetConsole return out, req.Send() } +const opGetEbsDefaultKmsKeyId = "GetEbsDefaultKmsKeyId" + +// GetEbsDefaultKmsKeyIdRequest generates a "aws/request.Request" representing the +// client's request for the GetEbsDefaultKmsKeyId operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetEbsDefaultKmsKeyId for more information on using the GetEbsDefaultKmsKeyId +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetEbsDefaultKmsKeyIdRequest method. +// req, resp := client.GetEbsDefaultKmsKeyIdRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetEbsDefaultKmsKeyId +func (c *EC2) GetEbsDefaultKmsKeyIdRequest(input *GetEbsDefaultKmsKeyIdInput) (req *request.Request, output *GetEbsDefaultKmsKeyIdOutput) { + op := &request.Operation{ + Name: opGetEbsDefaultKmsKeyId, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetEbsDefaultKmsKeyIdInput{} + } + + output = &GetEbsDefaultKmsKeyIdOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetEbsDefaultKmsKeyId API operation for Amazon Elastic Compute Cloud. +// +// Describes the default customer master key (CMK) for EBS encryption by default +// for your account in this Region. You can change the default CMK for encryption +// by default using ModifyEbsDefaultKmsKeyId or ResetEbsDefaultKmsKeyId. +// +// For more information, see Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation GetEbsDefaultKmsKeyId for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetEbsDefaultKmsKeyId +func (c *EC2) GetEbsDefaultKmsKeyId(input *GetEbsDefaultKmsKeyIdInput) (*GetEbsDefaultKmsKeyIdOutput, error) { + req, out := c.GetEbsDefaultKmsKeyIdRequest(input) + return out, req.Send() +} + +// GetEbsDefaultKmsKeyIdWithContext is the same as GetEbsDefaultKmsKeyId with the addition of +// the ability to pass a context and additional request options. +// +// See GetEbsDefaultKmsKeyId for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) GetEbsDefaultKmsKeyIdWithContext(ctx aws.Context, input *GetEbsDefaultKmsKeyIdInput, opts ...request.Option) (*GetEbsDefaultKmsKeyIdOutput, error) { + req, out := c.GetEbsDefaultKmsKeyIdRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetEbsEncryptionByDefault = "GetEbsEncryptionByDefault" + +// GetEbsEncryptionByDefaultRequest generates a "aws/request.Request" representing the +// client's request for the GetEbsEncryptionByDefault operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetEbsEncryptionByDefault for more information on using the GetEbsEncryptionByDefault +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetEbsEncryptionByDefaultRequest method. +// req, resp := client.GetEbsEncryptionByDefaultRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetEbsEncryptionByDefault +func (c *EC2) GetEbsEncryptionByDefaultRequest(input *GetEbsEncryptionByDefaultInput) (req *request.Request, output *GetEbsEncryptionByDefaultOutput) { + op := &request.Operation{ + Name: opGetEbsEncryptionByDefault, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetEbsEncryptionByDefaultInput{} + } + + output = &GetEbsEncryptionByDefaultOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetEbsEncryptionByDefault API operation for Amazon Elastic Compute Cloud. +// +// Describes whether EBS encryption by default is enabled for your account in +// the current Region. +// +// For more information, see Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation GetEbsEncryptionByDefault for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetEbsEncryptionByDefault +func (c *EC2) GetEbsEncryptionByDefault(input *GetEbsEncryptionByDefaultInput) (*GetEbsEncryptionByDefaultOutput, error) { + req, out := c.GetEbsEncryptionByDefaultRequest(input) + return out, req.Send() +} + +// GetEbsEncryptionByDefaultWithContext is the same as GetEbsEncryptionByDefault with the addition of +// the ability to pass a context and additional request options. +// +// See GetEbsEncryptionByDefault for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) GetEbsEncryptionByDefaultWithContext(ctx aws.Context, input *GetEbsEncryptionByDefaultInput, opts ...request.Option) (*GetEbsEncryptionByDefaultOutput, error) { + req, out := c.GetEbsEncryptionByDefaultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opGetHostReservationPurchasePreview = "GetHostReservationPurchasePreview" // GetHostReservationPurchasePreviewRequest generates a "aws/request.Request" representing the @@ -20551,8 +24674,8 @@ func (c *EC2) GetPasswordDataRequest(input *GetPasswordDataInput) (req *request. // // The Windows password is generated at boot by the EC2Config service or EC2Launch // scripts (Windows Server 2016 and later). This usually only happens the first -// time an instance is launched. For more information, see EC2Config (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/UsingConfig_WinAMI.html) -// and EC2Launch (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch.html) +// time an instance is launched. For more information, see EC2Config (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/UsingConfig_WinAMI.html) +// and EC2Launch (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch.html) // in the Amazon Elastic Compute Cloud User Guide. // // For the EC2Config service, the password is not generated for rebundled AMIs @@ -20702,6 +24825,12 @@ func (c *EC2) GetTransitGatewayAttachmentPropagationsRequest(input *GetTransitGa Name: opGetTransitGatewayAttachmentPropagations, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -20746,6 +24875,56 @@ func (c *EC2) GetTransitGatewayAttachmentPropagationsWithContext(ctx aws.Context return out, req.Send() } +// GetTransitGatewayAttachmentPropagationsPages iterates over the pages of a GetTransitGatewayAttachmentPropagations operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See GetTransitGatewayAttachmentPropagations method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetTransitGatewayAttachmentPropagations operation. +// pageNum := 0 +// err := client.GetTransitGatewayAttachmentPropagationsPages(params, +// func(page *ec2.GetTransitGatewayAttachmentPropagationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) GetTransitGatewayAttachmentPropagationsPages(input *GetTransitGatewayAttachmentPropagationsInput, fn func(*GetTransitGatewayAttachmentPropagationsOutput, bool) bool) error { + return c.GetTransitGatewayAttachmentPropagationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetTransitGatewayAttachmentPropagationsPagesWithContext same as GetTransitGatewayAttachmentPropagationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) GetTransitGatewayAttachmentPropagationsPagesWithContext(ctx aws.Context, input *GetTransitGatewayAttachmentPropagationsInput, fn func(*GetTransitGatewayAttachmentPropagationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetTransitGatewayAttachmentPropagationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetTransitGatewayAttachmentPropagationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetTransitGatewayAttachmentPropagationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opGetTransitGatewayRouteTableAssociations = "GetTransitGatewayRouteTableAssociations" // GetTransitGatewayRouteTableAssociationsRequest generates a "aws/request.Request" representing the @@ -20777,6 +24956,12 @@ func (c *EC2) GetTransitGatewayRouteTableAssociationsRequest(input *GetTransitGa Name: opGetTransitGatewayRouteTableAssociations, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -20821,6 +25006,56 @@ func (c *EC2) GetTransitGatewayRouteTableAssociationsWithContext(ctx aws.Context return out, req.Send() } +// GetTransitGatewayRouteTableAssociationsPages iterates over the pages of a GetTransitGatewayRouteTableAssociations operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See GetTransitGatewayRouteTableAssociations method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetTransitGatewayRouteTableAssociations operation. +// pageNum := 0 +// err := client.GetTransitGatewayRouteTableAssociationsPages(params, +// func(page *ec2.GetTransitGatewayRouteTableAssociationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) GetTransitGatewayRouteTableAssociationsPages(input *GetTransitGatewayRouteTableAssociationsInput, fn func(*GetTransitGatewayRouteTableAssociationsOutput, bool) bool) error { + return c.GetTransitGatewayRouteTableAssociationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetTransitGatewayRouteTableAssociationsPagesWithContext same as GetTransitGatewayRouteTableAssociationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) GetTransitGatewayRouteTableAssociationsPagesWithContext(ctx aws.Context, input *GetTransitGatewayRouteTableAssociationsInput, fn func(*GetTransitGatewayRouteTableAssociationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetTransitGatewayRouteTableAssociationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetTransitGatewayRouteTableAssociationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetTransitGatewayRouteTableAssociationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opGetTransitGatewayRouteTablePropagations = "GetTransitGatewayRouteTablePropagations" // GetTransitGatewayRouteTablePropagationsRequest generates a "aws/request.Request" representing the @@ -20852,6 +25087,12 @@ func (c *EC2) GetTransitGatewayRouteTablePropagationsRequest(input *GetTransitGa Name: opGetTransitGatewayRouteTablePropagations, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -20896,6 +25137,56 @@ func (c *EC2) GetTransitGatewayRouteTablePropagationsWithContext(ctx aws.Context return out, req.Send() } +// GetTransitGatewayRouteTablePropagationsPages iterates over the pages of a GetTransitGatewayRouteTablePropagations operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See GetTransitGatewayRouteTablePropagations method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetTransitGatewayRouteTablePropagations operation. +// pageNum := 0 +// err := client.GetTransitGatewayRouteTablePropagationsPages(params, +// func(page *ec2.GetTransitGatewayRouteTablePropagationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) GetTransitGatewayRouteTablePropagationsPages(input *GetTransitGatewayRouteTablePropagationsInput, fn func(*GetTransitGatewayRouteTablePropagationsOutput, bool) bool) error { + return c.GetTransitGatewayRouteTablePropagationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetTransitGatewayRouteTablePropagationsPagesWithContext same as GetTransitGatewayRouteTablePropagationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) GetTransitGatewayRouteTablePropagationsPagesWithContext(ctx aws.Context, input *GetTransitGatewayRouteTablePropagationsInput, fn func(*GetTransitGatewayRouteTablePropagationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetTransitGatewayRouteTablePropagationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetTransitGatewayRouteTablePropagationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetTransitGatewayRouteTablePropagationsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opImportClientVpnClientCertificateRevocationList = "ImportClientVpnClientCertificateRevocationList" // ImportClientVpnClientCertificateRevocationListRequest generates a "aws/request.Request" representing the @@ -21020,7 +25311,7 @@ func (c *EC2) ImportImageRequest(input *ImportImageInput) (req *request.Request, // // Import single or multi-volume disk images or EBS snapshots into an Amazon // Machine Image (AMI). For more information, see Importing a VM as an Image -// Using VM Import/Export (http://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html) +// Using VM Import/Export (https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html) // in the VM Import/Export User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -21098,10 +25389,10 @@ func (c *EC2) ImportInstanceRequest(input *ImportInstanceInput) (req *request.Re // Creates an import instance task using metadata from the specified disk image. // ImportInstance only supports single-volume VMs. To import multi-volume VMs, // use ImportImage. For more information, see Importing a Virtual Machine Using -// the Amazon EC2 CLI (http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ec2-cli-vmimport-export.html). +// the Amazon EC2 CLI (https://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ec2-cli-vmimport-export.html). // // For information about the import manifest referenced by this API action, -// see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). +// see VM Import Manifest (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -21181,7 +25472,7 @@ func (c *EC2) ImportKeyPairRequest(input *ImportKeyPairInput) (req *request.Requ // you create the key pair and give AWS just the public key. The private key // is never transferred between you and AWS. // -// For more information about key pairs, see Key Pairs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) +// For more information about key pairs, see Key Pairs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -21331,10 +25622,10 @@ func (c *EC2) ImportVolumeRequest(input *ImportVolumeInput) (req *request.Reques // ImportVolume API operation for Amazon Elastic Compute Cloud. // // Creates an import volume task using metadata from the specified disk image.For -// more information, see Importing Disks to Amazon EBS (http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/importing-your-volumes-into-amazon-ebs.html). +// more information, see Importing Disks to Amazon EBS (https://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/importing-your-volumes-into-amazon-ebs.html). // // For information about the import manifest referenced by this API action, -// see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). +// see VM Import Manifest (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -21520,6 +25811,92 @@ func (c *EC2) ModifyClientVpnEndpointWithContext(ctx aws.Context, input *ModifyC return out, req.Send() } +const opModifyEbsDefaultKmsKeyId = "ModifyEbsDefaultKmsKeyId" + +// ModifyEbsDefaultKmsKeyIdRequest generates a "aws/request.Request" representing the +// client's request for the ModifyEbsDefaultKmsKeyId operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ModifyEbsDefaultKmsKeyId for more information on using the ModifyEbsDefaultKmsKeyId +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ModifyEbsDefaultKmsKeyIdRequest method. +// req, resp := client.ModifyEbsDefaultKmsKeyIdRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyEbsDefaultKmsKeyId +func (c *EC2) ModifyEbsDefaultKmsKeyIdRequest(input *ModifyEbsDefaultKmsKeyIdInput) (req *request.Request, output *ModifyEbsDefaultKmsKeyIdOutput) { + op := &request.Operation{ + Name: opModifyEbsDefaultKmsKeyId, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyEbsDefaultKmsKeyIdInput{} + } + + output = &ModifyEbsDefaultKmsKeyIdOutput{} + req = c.newRequest(op, input, output) + return +} + +// ModifyEbsDefaultKmsKeyId API operation for Amazon Elastic Compute Cloud. +// +// Changes the default customer master key (CMK) for EBS encryption by default +// for your account in this Region. +// +// AWS creates a unique AWS managed CMK in each Region for use with encryption +// by default. If you change the default CMK to a customer managed CMK, it is +// used instead of the AWS managed CMK. To reset the default CMK to the AWS +// managed CMK for EBS, use ResetEbsDefaultKmsKeyId. +// +// If you delete or disable the customer managed CMK that you specified for +// use with encryption by default, your instances will fail to launch. +// +// For more information, see Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation ModifyEbsDefaultKmsKeyId for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyEbsDefaultKmsKeyId +func (c *EC2) ModifyEbsDefaultKmsKeyId(input *ModifyEbsDefaultKmsKeyIdInput) (*ModifyEbsDefaultKmsKeyIdOutput, error) { + req, out := c.ModifyEbsDefaultKmsKeyIdRequest(input) + return out, req.Send() +} + +// ModifyEbsDefaultKmsKeyIdWithContext is the same as ModifyEbsDefaultKmsKeyId with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyEbsDefaultKmsKeyId for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) ModifyEbsDefaultKmsKeyIdWithContext(ctx aws.Context, input *ModifyEbsDefaultKmsKeyIdInput, opts ...request.Option) (*ModifyEbsDefaultKmsKeyIdOutput, error) { + req, out := c.ModifyEbsDefaultKmsKeyIdRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opModifyFleet = "ModifyFleet" // ModifyFleetRequest generates a "aws/request.Request" representing the @@ -21795,7 +26172,7 @@ func (c *EC2) ModifyIdFormatRequest(input *ModifyIdFormatInput) (req *request.Re // ModifyIdFormat API operation for Amazon Elastic Compute Cloud. // -// Modifies the ID format for the specified resource on a per-region basis. +// Modifies the ID format for the specified resource on a per-Region basis. // You can specify that resources should receive longer IDs (17-character IDs) // when they are created. // @@ -21812,7 +26189,7 @@ func (c *EC2) ModifyIdFormatRequest(input *ModifyIdFormatInput) (req *request.Re // to the entire AWS account. By default, an IAM user defaults to the same settings // as the root user. If you're using this action as the root user, then these // settings apply to the entire account, unless an IAM user explicitly overrides -// these settings for themselves. For more information, see Resource IDs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) +// these settings for themselves. For more information, see Resource IDs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) // in the Amazon Elastic Compute Cloud User Guide. // // Resources created with longer IDs are visible to all IAM roles and users, @@ -21906,7 +26283,7 @@ func (c *EC2) ModifyIdentityIdFormatRequest(input *ModifyIdentityIdFormatInput) // | security-group | subnet | subnet-cidr-block-association | vpc | vpc-cidr-block-association // | vpc-endpoint | vpc-peering-connection | vpn-connection | vpn-gateway. // -// For more information, see Resource IDs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) +// For more information, see Resource IDs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) // in the Amazon Elastic Compute Cloud User Guide. // // This setting applies to the principal specified in the request; it does not @@ -22083,7 +26460,7 @@ func (c *EC2) ModifyInstanceAttributeRequest(input *ModifyInstanceAttributeInput // we recommend that you use the ModifyNetworkInterfaceAttribute action. // // To modify some attributes, the instance must be stopped. For more information, -// see Modifying Attributes of a Stopped Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_ChangingAttributesWhileInstanceStopped.html) +// see Modifying Attributes of a Stopped Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_ChangingAttributesWhileInstanceStopped.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -22238,7 +26615,7 @@ func (c *EC2) ModifyInstanceCreditSpecificationRequest(input *ModifyInstanceCred // Modifies the credit option for CPU usage on a running or stopped T2 or T3 // instance. The credit options are standard and unlimited. // -// For more information, see Burstable Performance Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) +// For more information, see Burstable Performance Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -22269,6 +26646,80 @@ func (c *EC2) ModifyInstanceCreditSpecificationWithContext(ctx aws.Context, inpu return out, req.Send() } +const opModifyInstanceEventStartTime = "ModifyInstanceEventStartTime" + +// ModifyInstanceEventStartTimeRequest generates a "aws/request.Request" representing the +// client's request for the ModifyInstanceEventStartTime operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ModifyInstanceEventStartTime for more information on using the ModifyInstanceEventStartTime +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ModifyInstanceEventStartTimeRequest method. +// req, resp := client.ModifyInstanceEventStartTimeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyInstanceEventStartTime +func (c *EC2) ModifyInstanceEventStartTimeRequest(input *ModifyInstanceEventStartTimeInput) (req *request.Request, output *ModifyInstanceEventStartTimeOutput) { + op := &request.Operation{ + Name: opModifyInstanceEventStartTime, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyInstanceEventStartTimeInput{} + } + + output = &ModifyInstanceEventStartTimeOutput{} + req = c.newRequest(op, input, output) + return +} + +// ModifyInstanceEventStartTime API operation for Amazon Elastic Compute Cloud. +// +// Modifies the start time for a scheduled Amazon EC2 instance event. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation ModifyInstanceEventStartTime for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyInstanceEventStartTime +func (c *EC2) ModifyInstanceEventStartTime(input *ModifyInstanceEventStartTimeInput) (*ModifyInstanceEventStartTimeOutput, error) { + req, out := c.ModifyInstanceEventStartTimeRequest(input) + return out, req.Send() +} + +// ModifyInstanceEventStartTimeWithContext is the same as ModifyInstanceEventStartTime with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyInstanceEventStartTime for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) ModifyInstanceEventStartTimeWithContext(ctx aws.Context, input *ModifyInstanceEventStartTimeInput, opts ...request.Option) (*ModifyInstanceEventStartTimeOutput, error) { + req, out := c.ModifyInstanceEventStartTimeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opModifyInstancePlacement = "ModifyInstancePlacement" // ModifyInstancePlacementRequest generates a "aws/request.Request" representing the @@ -22316,7 +26767,7 @@ func (c *EC2) ModifyInstancePlacementRequest(input *ModifyInstancePlacementInput // Modifies the placement attributes for a specified instance. You can do the // following: // -// * Modify the affinity between an instance and a Dedicated Host (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-overview.html). +// * Modify the affinity between an instance and a Dedicated Host (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-overview.html). // When affinity is set to host and the instance is not associated with a // specific Dedicated Host, the next time the instance is launched, it is // automatically associated with the host on which it lands. If the instance @@ -22327,7 +26778,7 @@ func (c *EC2) ModifyInstancePlacementRequest(input *ModifyInstancePlacementInput // * Change the instance tenancy of an instance from host to dedicated, or // from dedicated to host. // -// * Move an instance to or from a placement group (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html). +// * Move an instance to or from a placement group (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html). // // At least one attribute for affinity, host ID, tenancy, or placement group // name must be specified in the request. Affinity and tenancy can be modified @@ -22486,7 +26937,8 @@ func (c *EC2) ModifyNetworkInterfaceAttributeRequest(input *ModifyNetworkInterfa // ModifyNetworkInterfaceAttribute API operation for Amazon Elastic Compute Cloud. // // Modifies the specified network interface attribute. You can specify only -// one attribute at a time. +// one attribute at a time. You can use this action to attach and detach security +// groups from an existing EC2 instance. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -22565,7 +27017,7 @@ func (c *EC2) ModifyReservedInstancesRequest(input *ModifyReservedInstancesInput // Instances to be modified must be identical, except for Availability Zone, // network platform, and instance type. // -// For more information, see Modifying Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-modifying.html) +// For more information, see Modifying Reserved Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-modifying.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -22643,16 +27095,15 @@ func (c *EC2) ModifySnapshotAttributeRequest(input *ModifySnapshotAttributeInput // // Adds or removes permission settings for the specified snapshot. You may add // or remove specified AWS account IDs from a snapshot's list of create volume -// permissions, but you cannot do both in a single API call. If you need to -// both add and remove account IDs for a snapshot, you must use multiple API -// calls. +// permissions, but you cannot do both in a single operation. If you need to +// both add and remove account IDs for a snapshot, you must use multiple operations. // // Encrypted snapshots and snapshots with AWS Marketplace product codes cannot // be made public. Snapshots encrypted with your default CMK cannot be shared // with other accounts. // // For more information about modifying snapshot permissions, see Sharing Snapshots -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-modifying-snapshot-permissions.html) +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-modifying-snapshot-permissions.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -22729,6 +27180,8 @@ func (c *EC2) ModifySpotFleetRequestRequest(input *ModifySpotFleetRequestInput) // // Modifies the specified Spot Fleet request. // +// You can only modify a Spot Fleet request of type maintain. +// // While the Spot Fleet request is being modified, it is in the modifying state. // // To scale up your Spot Fleet, increase its target capacity. The Spot Fleet @@ -22854,6 +27307,241 @@ func (c *EC2) ModifySubnetAttributeWithContext(ctx aws.Context, input *ModifySub return out, req.Send() } +const opModifyTrafficMirrorFilterNetworkServices = "ModifyTrafficMirrorFilterNetworkServices" + +// ModifyTrafficMirrorFilterNetworkServicesRequest generates a "aws/request.Request" representing the +// client's request for the ModifyTrafficMirrorFilterNetworkServices operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ModifyTrafficMirrorFilterNetworkServices for more information on using the ModifyTrafficMirrorFilterNetworkServices +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ModifyTrafficMirrorFilterNetworkServicesRequest method. +// req, resp := client.ModifyTrafficMirrorFilterNetworkServicesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyTrafficMirrorFilterNetworkServices +func (c *EC2) ModifyTrafficMirrorFilterNetworkServicesRequest(input *ModifyTrafficMirrorFilterNetworkServicesInput) (req *request.Request, output *ModifyTrafficMirrorFilterNetworkServicesOutput) { + op := &request.Operation{ + Name: opModifyTrafficMirrorFilterNetworkServices, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyTrafficMirrorFilterNetworkServicesInput{} + } + + output = &ModifyTrafficMirrorFilterNetworkServicesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ModifyTrafficMirrorFilterNetworkServices API operation for Amazon Elastic Compute Cloud. +// +// Allows or restricts mirroring network services. +// +// By default, Amazon DNS network services are not eligible for Traffic Mirror. +// Use AddNetworkServices to add network services to a Traffic Mirror filter. +// When a network service is added to the Traffic Mirror filter, all traffic +// related to that network service will be mirrored. When you no longer want +// to mirror network services, use RemoveNetworkServices to remove the network +// services from the Traffic Mirror filter. +// +// FFor information about filter rule properties, see Network Services (https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-considerations.html#traffic-mirroring-network-services) +// in the Traffic Mirroring User Guide . +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation ModifyTrafficMirrorFilterNetworkServices for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyTrafficMirrorFilterNetworkServices +func (c *EC2) ModifyTrafficMirrorFilterNetworkServices(input *ModifyTrafficMirrorFilterNetworkServicesInput) (*ModifyTrafficMirrorFilterNetworkServicesOutput, error) { + req, out := c.ModifyTrafficMirrorFilterNetworkServicesRequest(input) + return out, req.Send() +} + +// ModifyTrafficMirrorFilterNetworkServicesWithContext is the same as ModifyTrafficMirrorFilterNetworkServices with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyTrafficMirrorFilterNetworkServices for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) ModifyTrafficMirrorFilterNetworkServicesWithContext(ctx aws.Context, input *ModifyTrafficMirrorFilterNetworkServicesInput, opts ...request.Option) (*ModifyTrafficMirrorFilterNetworkServicesOutput, error) { + req, out := c.ModifyTrafficMirrorFilterNetworkServicesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opModifyTrafficMirrorFilterRule = "ModifyTrafficMirrorFilterRule" + +// ModifyTrafficMirrorFilterRuleRequest generates a "aws/request.Request" representing the +// client's request for the ModifyTrafficMirrorFilterRule operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ModifyTrafficMirrorFilterRule for more information on using the ModifyTrafficMirrorFilterRule +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ModifyTrafficMirrorFilterRuleRequest method. +// req, resp := client.ModifyTrafficMirrorFilterRuleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyTrafficMirrorFilterRule +func (c *EC2) ModifyTrafficMirrorFilterRuleRequest(input *ModifyTrafficMirrorFilterRuleInput) (req *request.Request, output *ModifyTrafficMirrorFilterRuleOutput) { + op := &request.Operation{ + Name: opModifyTrafficMirrorFilterRule, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyTrafficMirrorFilterRuleInput{} + } + + output = &ModifyTrafficMirrorFilterRuleOutput{} + req = c.newRequest(op, input, output) + return +} + +// ModifyTrafficMirrorFilterRule API operation for Amazon Elastic Compute Cloud. +// +// Modifies the specified Traffic Mirror rule. +// +// DestinationCidrBlock and SourceCidrBlock must both be an IPv4 range or an +// IPv6 range. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation ModifyTrafficMirrorFilterRule for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyTrafficMirrorFilterRule +func (c *EC2) ModifyTrafficMirrorFilterRule(input *ModifyTrafficMirrorFilterRuleInput) (*ModifyTrafficMirrorFilterRuleOutput, error) { + req, out := c.ModifyTrafficMirrorFilterRuleRequest(input) + return out, req.Send() +} + +// ModifyTrafficMirrorFilterRuleWithContext is the same as ModifyTrafficMirrorFilterRule with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyTrafficMirrorFilterRule for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) ModifyTrafficMirrorFilterRuleWithContext(ctx aws.Context, input *ModifyTrafficMirrorFilterRuleInput, opts ...request.Option) (*ModifyTrafficMirrorFilterRuleOutput, error) { + req, out := c.ModifyTrafficMirrorFilterRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opModifyTrafficMirrorSession = "ModifyTrafficMirrorSession" + +// ModifyTrafficMirrorSessionRequest generates a "aws/request.Request" representing the +// client's request for the ModifyTrafficMirrorSession operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ModifyTrafficMirrorSession for more information on using the ModifyTrafficMirrorSession +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ModifyTrafficMirrorSessionRequest method. +// req, resp := client.ModifyTrafficMirrorSessionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyTrafficMirrorSession +func (c *EC2) ModifyTrafficMirrorSessionRequest(input *ModifyTrafficMirrorSessionInput) (req *request.Request, output *ModifyTrafficMirrorSessionOutput) { + op := &request.Operation{ + Name: opModifyTrafficMirrorSession, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyTrafficMirrorSessionInput{} + } + + output = &ModifyTrafficMirrorSessionOutput{} + req = c.newRequest(op, input, output) + return +} + +// ModifyTrafficMirrorSession API operation for Amazon Elastic Compute Cloud. +// +// Modifies a Traffic Mirror session. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation ModifyTrafficMirrorSession for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyTrafficMirrorSession +func (c *EC2) ModifyTrafficMirrorSession(input *ModifyTrafficMirrorSessionInput) (*ModifyTrafficMirrorSessionOutput, error) { + req, out := c.ModifyTrafficMirrorSessionRequest(input) + return out, req.Send() +} + +// ModifyTrafficMirrorSessionWithContext is the same as ModifyTrafficMirrorSession with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyTrafficMirrorSession for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) ModifyTrafficMirrorSessionWithContext(ctx aws.Context, input *ModifyTrafficMirrorSessionInput, opts ...request.Option) (*ModifyTrafficMirrorSessionOutput, error) { + req, out := c.ModifyTrafficMirrorSessionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opModifyTransitGatewayVpcAttachment = "ModifyTransitGatewayVpcAttachment" // ModifyTransitGatewayVpcAttachmentRequest generates a "aws/request.Request" representing the @@ -22977,29 +27665,29 @@ func (c *EC2) ModifyVolumeRequest(input *ModifyVolumeInput) (req *request.Reques // current-generation EC2 instance type, you may be able to apply these changes // without stopping the instance or detaching the volume from it. For more information // about modifying an EBS volume running Linux, see Modifying the Size, IOPS, -// or Type of an EBS Volume on Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html). +// or Type of an EBS Volume on Linux (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html). // For more information about modifying an EBS volume running Windows, see Modifying -// the Size, IOPS, or Type of an EBS Volume on Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). +// the Size, IOPS, or Type of an EBS Volume on Windows (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). // // When you complete a resize operation on your volume, you need to extend the // volume's file-system size to take advantage of the new storage capacity. // For information about extending a Linux file system, see Extending a Linux -// File System (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#recognize-expanded-volume-linux). +// File System (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#recognize-expanded-volume-linux). // For information about extending a Windows file system, see Extending a Windows -// File System (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html#recognize-expanded-volume-windows). +// File System (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html#recognize-expanded-volume-windows). // // You can use CloudWatch Events to check the status of a modification to an // EBS volume. For information about CloudWatch Events, see the Amazon CloudWatch -// Events User Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/). -// You can also track the status of a modification using the DescribeVolumesModifications -// API. For information about tracking status changes using either method, see -// Monitoring Volume Modifications (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods). +// Events User Guide (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/). +// You can also track the status of a modification using DescribeVolumesModifications. +// For information about tracking status changes using either method, see Monitoring +// Volume Modifications (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods). // // With previous-generation instance types, resizing an EBS volume may require // detaching and reattaching the volume or stopping and restarting the instance. // For more information, see Modifying the Size, IOPS, or Type of an EBS Volume -// on Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html) -// and Modifying the Size, IOPS, or Type of an EBS Volume on Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). +// on Linux (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html) +// and Modifying the Size, IOPS, or Type of an EBS Volume on Windows (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). // // If you reach the maximum volume modification rate per volume limit, you will // need to wait at least six hours before applying further modifications to @@ -23238,7 +27926,7 @@ func (c *EC2) ModifyVpcEndpointRequest(input *ModifyVpcEndpointInput) (req *requ // // Modifies attributes of a specified VPC endpoint. The attributes that you // can modify depend on the type of VPC endpoint (interface or gateway). For -// more information, see VPC Endpoints (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-endpoints.html) +// more information, see VPC Endpoints (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -23466,7 +28154,7 @@ func (c *EC2) ModifyVpcEndpointServicePermissionsRequest(input *ModifyVpcEndpoin // ModifyVpcEndpointServicePermissions API operation for Amazon Elastic Compute Cloud. // -// Modifies the permissions for your VPC endpoint service (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/endpoint-service.html). +// Modifies the permissions for your VPC endpoint service (https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-service.html). // You can add or remove permissions for service consumers (IAM users, IAM roles, // and AWS accounts) to connect to your endpoint service. // @@ -23563,11 +28251,11 @@ func (c *EC2) ModifyVpcPeeringConnectionOptionsRequest(input *ModifyVpcPeeringCo // If the peered VPCs are in the same AWS account, you can enable DNS resolution // for queries from the local VPC. This ensures that queries from the local // VPC resolve to private IP addresses in the peer VPC. This option is not available -// if the peered VPCs are in different AWS accounts or different regions. For +// if the peered VPCs are in different AWS accounts or different Regions. For // peered VPCs in different AWS accounts, each AWS account owner must initiate // a separate request to modify the peering connection options. For inter-region -// peering connections, you must use the region for the requester VPC to modify -// the requester VPC peering options and the region for the accepter VPC to +// peering connections, you must use the Region for the requester VPC to modify +// the requester VPC peering options and the Region for the accepter VPC to // modify the accepter VPC peering options. To verify which VPCs are the accepter // and the requester for a VPC peering connection, use the DescribeVpcPeeringConnections // command. @@ -23652,7 +28340,7 @@ func (c *EC2) ModifyVpcTenancyRequest(input *ModifyVpcTenancyInput) (req *reques // into the VPC have a tenancy of default, unless you specify otherwise during // launch. The tenancy of any existing instances in the VPC is not affected. // -// For more information, see Dedicated Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-instance.html) +// For more information, see Dedicated Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-instance.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -23683,6 +28371,119 @@ func (c *EC2) ModifyVpcTenancyWithContext(ctx aws.Context, input *ModifyVpcTenan return out, req.Send() } +const opModifyVpnConnection = "ModifyVpnConnection" + +// ModifyVpnConnectionRequest generates a "aws/request.Request" representing the +// client's request for the ModifyVpnConnection operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ModifyVpnConnection for more information on using the ModifyVpnConnection +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ModifyVpnConnectionRequest method. +// req, resp := client.ModifyVpnConnectionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyVpnConnection +func (c *EC2) ModifyVpnConnectionRequest(input *ModifyVpnConnectionInput) (req *request.Request, output *ModifyVpnConnectionOutput) { + op := &request.Operation{ + Name: opModifyVpnConnection, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyVpnConnectionInput{} + } + + output = &ModifyVpnConnectionOutput{} + req = c.newRequest(op, input, output) + return +} + +// ModifyVpnConnection API operation for Amazon Elastic Compute Cloud. +// +// Modifies the target gateway of a AWS Site-to-Site VPN connection. The following +// migration options are available: +// +// * An existing virtual private gateway to a new virtual private gateway +// +// * An existing virtual private gateway to a transit gateway +// +// * An existing transit gateway to a new transit gateway +// +// * An existing transit gateway to a virtual private gateway +// +// Before you perform the migration to the new gateway, you must configure the +// new gateway. Use CreateVpnGateway to create a virtual private gateway, or +// CreateTransitGateway to create a transit gateway. +// +// This step is required when you migrate from a virtual private gateway with +// static routes to a transit gateway. +// +// You must delete the static routes before you migrate to the new gateway. +// +// Keep a copy of the static route before you delete it. You will need to add +// back these routes to the transit gateway after the VPN connection migration +// is complete. +// +// After you migrate to the new gateway, you might need to modify your VPC route +// table. Use CreateRoute and DeleteRoute to make the changes described in VPN +// Gateway Target Modification Required VPC Route Table Updates (https://docs.aws.amazon.com/vpn/latest/s2svpn/modify-vpn-target.html#step-update-routing) +// in the AWS Site-to-Site VPN User Guide. +// +// When the new gateway is a transit gateway, modify the transit gateway route +// table to allow traffic between the VPC and the AWS Site-to-Site VPN connection. +// Use CreateTransitGatewayRoute to add the routes. +// +// If you deleted VPN static routes, you must add the static routes to the transit +// gateway route table. +// +// After you perform this operation, the AWS VPN endpoint's IP addresses on +// the AWS side and the tunnel options remain intact. Your s2slong; connection +// will be temporarily unavailable for approximately 10 minutes while we provision +// the new endpoints +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation ModifyVpnConnection for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyVpnConnection +func (c *EC2) ModifyVpnConnection(input *ModifyVpnConnectionInput) (*ModifyVpnConnectionOutput, error) { + req, out := c.ModifyVpnConnectionRequest(input) + return out, req.Send() +} + +// ModifyVpnConnectionWithContext is the same as ModifyVpnConnection with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyVpnConnection for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) ModifyVpnConnectionWithContext(ctx aws.Context, input *ModifyVpnConnectionInput, opts ...request.Option) (*ModifyVpnConnectionOutput, error) { + req, out := c.ModifyVpnConnectionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opMonitorInstances = "MonitorInstances" // MonitorInstancesRequest generates a "aws/request.Request" representing the @@ -23729,7 +28530,7 @@ func (c *EC2) MonitorInstancesRequest(input *MonitorInstancesInput) (req *reques // // Enables detailed monitoring for a running instance. Otherwise, basic monitoring // is enabled. For more information, see Monitoring Your Instances and Volumes -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch.html) +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch.html) // in the Amazon Elastic Compute Cloud User Guide. // // To disable detailed monitoring, see . @@ -23894,7 +28695,7 @@ func (c *EC2) ProvisionByoipCidrRequest(input *ProvisionByoipCidrInput) (req *re // it. You must ensure that the address range is registered to you and that // you created an RPKI ROA to authorize Amazon ASNs 16509 and 14618 to advertise // the address range. For more information, see Bring Your Own IP Addresses -// (BYOIP) (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-byoip.html) +// (BYOIP) (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-byoip.html) // in the Amazon Elastic Compute Cloud User Guide. // // Provisioning an address range is an asynchronous operation, so the call returns @@ -24060,8 +28861,8 @@ func (c *EC2) PurchaseReservedInstancesOfferingRequest(input *PurchaseReservedIn // offerings that match your specifications. After you've purchased a Reserved // Instance, you can check for your new Reserved Instance with DescribeReservedInstances. // -// For more information, see Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts-on-demand-reserved-instances.html) -// and Reserved Instance Marketplace (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) +// For more information, see Reserved Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts-on-demand-reserved-instances.html) +// and Reserved Instance Marketplace (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -24136,7 +28937,7 @@ func (c *EC2) PurchaseScheduledInstancesRequest(input *PurchaseScheduledInstance // PurchaseScheduledInstances API operation for Amazon Elastic Compute Cloud. // -// Purchases one or more Scheduled Instances with the specified schedule. +// Purchases the Scheduled Instances with the specified schedule. // // Scheduled Instances enable you to purchase Amazon EC2 compute capacity by // the hour for a one-year term. Before you can purchase a Scheduled Instance, @@ -24220,7 +29021,7 @@ func (c *EC2) RebootInstancesRequest(input *RebootInstancesInput) (req *request. // RebootInstances API operation for Amazon Elastic Compute Cloud. // -// Requests a reboot of one or more instances. This operation is asynchronous; +// Requests a reboot of the specified instances. This operation is asynchronous; // it only queues a request to reboot the specified instances. The operation // succeeds if the instances are valid and belong to you. Requests to reboot // terminated instances are ignored. @@ -24229,7 +29030,7 @@ func (c *EC2) RebootInstancesRequest(input *RebootInstancesInput) (req *request. // performs a hard reboot. // // For more information about troubleshooting, see Getting Console Output and -// Rebooting Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-console.html) +// Rebooting Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-console.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -24306,7 +29107,7 @@ func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *request.Requ // // Registers an AMI. When you're creating an AMI, this is the final step you // must complete before you can launch an instance from the AMI. For more information -// about creating AMIs, see Creating Your Own AMIs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami.html) +// about creating AMIs, see Creating Your Own AMIs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami.html) // in the Amazon Elastic Compute Cloud User Guide. // // For Amazon EBS-backed instances, CreateImage creates and registers the AMI @@ -24315,7 +29116,7 @@ func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *request.Requ // You can also use RegisterImage to create an Amazon EBS-backed Linux AMI from // a snapshot of a root device volume. You specify the snapshot using the block // device mapping. For more information, see Launching a Linux Instance from -// a Backup (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-launch-snapshot.html) +// a Backup (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-launch-snapshot.html) // in the Amazon Elastic Compute Cloud User Guide. // // You can't register an image where a secondary (non-root) snapshot has AWS @@ -24897,7 +29698,7 @@ func (c *EC2) ReplaceNetworkAclAssociationRequest(input *ReplaceNetworkAclAssoci // // Changes which network ACL a subnet is associated with. By default when you // create a subnet, it's automatically associated with the default network ACL. -// For more information, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) +// For more information, see Network ACLs (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_ACLs.html) // in the Amazon Virtual Private Cloud User Guide. // // This is an idempotent operation. @@ -24976,8 +29777,8 @@ func (c *EC2) ReplaceNetworkAclEntryRequest(input *ReplaceNetworkAclEntryInput) // ReplaceNetworkAclEntry API operation for Amazon Elastic Compute Cloud. // // Replaces an entry (rule) in a network ACL. For more information, see Network -// ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) -// in the Amazon Virtual Private Cloud User Guide. +// ACLs (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_ACLs.html) in +// the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -25057,7 +29858,7 @@ func (c *EC2) ReplaceRouteRequest(input *ReplaceRouteInput) (req *request.Reques // instance, NAT gateway, VPC peering connection, network interface, or egress-only // internet gateway. // -// For more information, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// For more information, see Route Tables (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -25135,7 +29936,7 @@ func (c *EC2) ReplaceRouteTableAssociationRequest(input *ReplaceRouteTableAssoci // Changes the route table associated with a given subnet in a VPC. After the // operation completes, the subnet uses the routes in the new route table it's // associated with. For more information about route tables, see Route Tables -// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// (https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html) // in the Amazon Virtual Private Cloud User Guide. // // You can also use ReplaceRouteTableAssociation to change which table is the @@ -25392,7 +30193,7 @@ func (c *EC2) RequestSpotFleetRequest(input *RequestSpotFleetInput) (req *reques // types in a Spot Fleet request because only the instance resource type is // supported. // -// For more information, see Spot Fleet Requests (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet-requests.html) +// For more information, see Spot Fleet Requests (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet-requests.html) // in the Amazon EC2 User Guide for Linux Instances. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -25469,7 +30270,7 @@ func (c *EC2) RequestSpotInstancesRequest(input *RequestSpotInstancesInput) (req // // Creates a Spot Instance request. // -// For more information, see Spot Instance Requests (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html) +// For more information, see Spot Instance Requests (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html) // in the Amazon EC2 User Guide for Linux Instances. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -25500,6 +30301,86 @@ func (c *EC2) RequestSpotInstancesWithContext(ctx aws.Context, input *RequestSpo return out, req.Send() } +const opResetEbsDefaultKmsKeyId = "ResetEbsDefaultKmsKeyId" + +// ResetEbsDefaultKmsKeyIdRequest generates a "aws/request.Request" representing the +// client's request for the ResetEbsDefaultKmsKeyId operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ResetEbsDefaultKmsKeyId for more information on using the ResetEbsDefaultKmsKeyId +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ResetEbsDefaultKmsKeyIdRequest method. +// req, resp := client.ResetEbsDefaultKmsKeyIdRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ResetEbsDefaultKmsKeyId +func (c *EC2) ResetEbsDefaultKmsKeyIdRequest(input *ResetEbsDefaultKmsKeyIdInput) (req *request.Request, output *ResetEbsDefaultKmsKeyIdOutput) { + op := &request.Operation{ + Name: opResetEbsDefaultKmsKeyId, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ResetEbsDefaultKmsKeyIdInput{} + } + + output = &ResetEbsDefaultKmsKeyIdOutput{} + req = c.newRequest(op, input, output) + return +} + +// ResetEbsDefaultKmsKeyId API operation for Amazon Elastic Compute Cloud. +// +// Resets the default customer master key (CMK) for EBS encryption for your +// account in this Region to the AWS managed CMK for EBS. +// +// After resetting the default CMK to the AWS managed CMK, you can continue +// to encrypt by a customer managed CMK by specifying it when you create the +// volume. For more information, see Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation ResetEbsDefaultKmsKeyId for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ResetEbsDefaultKmsKeyId +func (c *EC2) ResetEbsDefaultKmsKeyId(input *ResetEbsDefaultKmsKeyIdInput) (*ResetEbsDefaultKmsKeyIdOutput, error) { + req, out := c.ResetEbsDefaultKmsKeyIdRequest(input) + return out, req.Send() +} + +// ResetEbsDefaultKmsKeyIdWithContext is the same as ResetEbsDefaultKmsKeyId with the addition of +// the ability to pass a context and additional request options. +// +// See ResetEbsDefaultKmsKeyId for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) ResetEbsDefaultKmsKeyIdWithContext(ctx aws.Context, input *ResetEbsDefaultKmsKeyIdInput, opts ...request.Option) (*ResetEbsDefaultKmsKeyIdOutput, error) { + req, out := c.ResetEbsDefaultKmsKeyIdRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opResetFpgaImageAttribute = "ResetFpgaImageAttribute" // ResetFpgaImageAttributeRequest generates a "aws/request.Request" representing the @@ -25704,7 +30585,7 @@ func (c *EC2) ResetInstanceAttributeRequest(input *ResetInstanceAttributeInput) // The sourceDestCheck attribute controls whether source/destination checking // is enabled. The default value is true, which means checking is enabled. This // value must be false for a NAT instance to perform NAT. For more information, -// see NAT Instances (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html) +// see NAT Instances (https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -25859,7 +30740,7 @@ func (c *EC2) ResetSnapshotAttributeRequest(input *ResetSnapshotAttributeInput) // Resets permission settings for the specified snapshot. // // For more information about modifying snapshot permissions, see Sharing Snapshots -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-modifying-snapshot-permissions.html) +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-modifying-snapshot-permissions.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -26086,10 +30967,10 @@ func (c *EC2) RevokeSecurityGroupEgressRequest(input *RevokeSecurityGroupEgressI // RevokeSecurityGroupEgress API operation for Amazon Elastic Compute Cloud. // -// [EC2-VPC only] Removes one or more egress rules from a security group for -// EC2-VPC. This action doesn't apply to security groups for use in EC2-Classic. -// To remove a rule, the values that you specify (for example, ports) must match -// the existing rule's values exactly. +// [VPC only] Removes the specified egress rules from a security group for EC2-VPC. +// This action doesn't apply to security groups for use in EC2-Classic. To remove +// a rule, the values that you specify (for example, ports) must match the existing +// rule's values exactly. // // Each rule consists of the protocol and the IPv4 or IPv6 CIDR range or source // security group. For the TCP and UDP protocols, you must also specify the @@ -26173,13 +31054,13 @@ func (c *EC2) RevokeSecurityGroupIngressRequest(input *RevokeSecurityGroupIngres // RevokeSecurityGroupIngress API operation for Amazon Elastic Compute Cloud. // -// Removes one or more ingress rules from a security group. To remove a rule, +// Removes the specified ingress rules from a security group. To remove a rule, // the values that you specify (for example, ports) must match the existing // rule's values exactly. // -// [EC2-Classic security groups only] If the values you specify do not match -// the existing rule's values, no error is returned. Use DescribeSecurityGroups -// to verify that the rule has been removed. +// [EC2-Classic only] If the values you specify do not match the existing rule's +// values, no error is returned. Use DescribeSecurityGroups to verify that the +// rule has been removed. // // Each rule consists of the protocol and the CIDR range or source security // group. For the TCP and UDP protocols, you must also specify the destination @@ -26277,22 +31158,22 @@ func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Reques // // * Some instance types must be launched into a VPC. If you do not have // a default VPC, or if you do not specify a subnet ID, the request fails. -// For more information, see Instance Types Available Only in a VPC (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-vpc.html#vpc-only-instance-types). +// For more information, see Instance Types Available Only in a VPC (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-vpc.html#vpc-only-instance-types). // // * [EC2-VPC] All instances have a network interface with a primary private // IPv4 address. If you don't specify this address, we choose one from the // IPv4 range of your subnet. // // * Not all instance types support IPv6 addresses. For more information, -// see Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). +// see Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). // // * If you don't specify a security group ID, we use the default security -// group. For more information, see Security Groups (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html). +// group. For more information, see Security Groups (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html). // // * If any of the AMIs have a product code attached for which the user has // not subscribed, the request fails. // -// You can create a launch template (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html), +// You can create a launch template (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html), // which is a resource that contains the parameters to launch an instance. When // you launch an instance using RunInstances, you can specify the launch template // instead of specifying the launch parameters. @@ -26304,17 +31185,17 @@ func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Reques // An instance is ready for you to use when it's in the running state. You can // check the state of your instance using DescribeInstances. You can tag instances // and EBS volumes during launch, after launch, or both. For more information, -// see CreateTags and Tagging Your Amazon EC2 Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html). +// see CreateTags and Tagging Your Amazon EC2 Resources (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html). // // Linux instances have access to the public key of the key pair at boot. You // can use this key to provide secure access to the instance. Amazon EC2 public // images use this feature to provide secure access without passwords. For more -// information, see Key Pairs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) +// information, see Key Pairs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) // in the Amazon Elastic Compute Cloud User Guide. // // For troubleshooting, see What To Do If An Instance Immediately Terminates -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_InstanceStraightToTerminated.html), -// and Troubleshooting Connecting to Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html) +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_InstanceStraightToTerminated.html), +// and Troubleshooting Connecting to Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -26398,7 +31279,7 @@ func (c *EC2) RunScheduledInstancesRequest(input *RunScheduledInstancesInput) (r // can't stop or reboot a Scheduled Instance, but you can terminate it as needed. // If you terminate a Scheduled Instance before the current scheduled time period // ends, you can launch it again after a few minutes. For more information, -// see Scheduled Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-scheduled-instances.html) +// see Scheduled Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-scheduled-instances.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -26568,7 +31449,7 @@ func (c *EC2) StartInstancesRequest(input *StartInstancesInput) (req *request.Re // Performing this operation on an instance that uses an instance store as its // root device returns an error. // -// For more information, see Stopping Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html) +// For more information, see Stopping Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -26646,9 +31527,9 @@ func (c *EC2) StopInstancesRequest(input *StopInstancesInput) (req *request.Requ // Stops an Amazon EBS-backed instance. // // You can use the Stop action to hibernate an instance if the instance is enabled -// for hibernation (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#enabling-hibernation) -// and it meets the hibernation prerequisites (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). -// For more information, see Hibernate Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) +// for hibernation (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#enabling-hibernation) +// and it meets the hibernation prerequisites (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). +// For more information, see Hibernate Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) // in the Amazon Elastic Compute Cloud User Guide. // // We don't charge usage for a stopped instance, or data transfer fees; however, @@ -26663,7 +31544,7 @@ func (c *EC2) StopInstancesRequest(input *StopInstancesInput) (req *request.Requ // // You can't start, stop, or hibernate Spot Instances, and you can't stop or // hibernate instance store-backed instances. For information about using hibernation -// for Spot Instances, see Hibernating Interrupted Spot Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html#hibernate-spot-instances) +// for Spot Instances, see Hibernating Interrupted Spot Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html#hibernate-spot-instances) // in the Amazon Elastic Compute Cloud User Guide. // // When you stop or hibernate an instance, we shut it down. You can restart @@ -26679,13 +31560,13 @@ func (c *EC2) StopInstancesRequest(input *StopInstancesInput) (req *request.Requ // an instance, the root device and any other devices attached during the instance // launch are automatically deleted. For more information about the differences // between rebooting, stopping, hibernating, and terminating instances, see -// Instance Lifecycle (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) +// Instance Lifecycle (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) // in the Amazon Elastic Compute Cloud User Guide. // // When you stop an instance, we attempt to shut it down forcibly after a short // while. If your instance appears stuck in the stopping state after a period // of time, there may be an issue with the underlying host computer. For more -// information, see Troubleshooting Stopping Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.html) +// information, see Troubleshooting Stopping Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -26836,8 +31717,8 @@ func (c *EC2) TerminateInstancesRequest(input *TerminateInstancesInput) (req *re // TerminateInstances API operation for Amazon Elastic Compute Cloud. // -// Shuts down one or more instances. This operation is idempotent; if you terminate -// an instance more than once, each call succeeds. +// Shuts down the specified instances. This operation is idempotent; if you +// terminate an instance more than once, each call succeeds. // // If you specify multiple instances and the request fails (for example, because // of a single incorrect instance ID), none of the instances are terminated. @@ -26855,11 +31736,11 @@ func (c *EC2) TerminateInstancesRequest(input *TerminateInstancesInput) (req *re // an instance, any attached EBS volumes with the DeleteOnTermination block // device mapping parameter set to true are automatically deleted. For more // information about the differences between stopping and terminating instances, -// see Instance Lifecycle (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) +// see Instance Lifecycle (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) // in the Amazon Elastic Compute Cloud User Guide. // // For more information about troubleshooting, see Troubleshooting Terminating -// Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesShuttingDown.html) +// Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesShuttingDown.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -27084,7 +31965,7 @@ func (c *EC2) UnmonitorInstancesRequest(input *UnmonitorInstancesInput) (req *re // UnmonitorInstances API operation for Amazon Elastic Compute Cloud. // // Disables detailed monitoring for a running instance. For more information, -// see Monitoring Your Instances and Volumes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch.html) +// see Monitoring Your Instances and Volumes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -27159,7 +32040,7 @@ func (c *EC2) UpdateSecurityGroupRuleDescriptionsEgressRequest(input *UpdateSecu // UpdateSecurityGroupRuleDescriptionsEgress API operation for Amazon Elastic Compute Cloud. // -// [EC2-VPC only] Updates the description of an egress (outbound) security group +// [VPC only] Updates the description of an egress (outbound) security group // rule. You can replace an existing description, or add a description to a // rule that did not have one previously. // @@ -27678,7 +32559,7 @@ type AccountAttribute struct { // The name of the account attribute. AttributeName *string `locationName:"attributeName" type:"string"` - // One or more values for the account attribute. + // The values for the account attribute. AttributeValues []*AccountAttributeValue `locationName:"attributeValueSet" locationNameList:"item" type:"list"` } @@ -27891,7 +32772,8 @@ func (s *Address) SetTags(v []*Tag) *Address { type AdvertiseByoipCidrInput struct { _ struct{} `type:"structure"` - // The IPv4 address range, in CIDR notation. + // The IPv4 address range, in CIDR notation. This must be the exact range that + // you provisioned. You can't advertise only a portion of the provisioned range. // // Cidr is a required field Cidr *string `type:"string" required:"true"` @@ -28074,26 +32956,35 @@ func (s *AllocateAddressOutput) SetPublicIpv4Pool(v string) *AllocateAddressOutp type AllocateHostsInput struct { _ struct{} `type:"structure"` - // This is enabled by default. This property allows instances to be automatically - // placed onto available Dedicated Hosts, when you are launching instances without - // specifying a host ID. + // Indicates whether the host accepts any untargeted instance launches that + // match its instance type configuration, or if it only accepts Host tenancy + // instance launches that specify its unique host ID. For more information, + // see Understanding Instance Placement and Host Affinity (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-dedicated-hosts-work.html#dedicated-hosts-understanding) + // in the Amazon EC2 User Guide for Linux Instances. // - // Default: Enabled + // Default: on AutoPlacement *string `locationName:"autoPlacement" type:"string" enum:"AutoPlacement"` - // The Availability Zone for the Dedicated Hosts. + // The Availability Zone in which to allocate the Dedicated Host. // // AvailabilityZone is a required field AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) - // in the Amazon Elastic Compute Cloud User Guide. + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` - // Specify the instance type for which to configure your Dedicated Hosts. When - // you specify the instance type, that is the only instance type that you can - // launch onto that host. + // Indicates whether to enable or disable host recovery for the Dedicated Host. + // Host recovery is disabled by default. For more information, see Host Recovery + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-recovery.html) + // in the Amazon Elastic Compute Cloud User Guide. + // + // Default: off + HostRecovery *string `type:"string" enum:"HostRecovery"` + + // Specifies the instance type for which to configure your Dedicated Hosts. + // When you specify the instance type, that is the only instance type that you + // can launch onto that host. // // InstanceType is a required field InstanceType *string `locationName:"instanceType" type:"string" required:"true"` @@ -28154,6 +33045,12 @@ func (s *AllocateHostsInput) SetClientToken(v string) *AllocateHostsInput { return s } +// SetHostRecovery sets the HostRecovery field's value. +func (s *AllocateHostsInput) SetHostRecovery(v string) *AllocateHostsInput { + s.HostRecovery = &v + return s +} + // SetInstanceType sets the InstanceType field's value. func (s *AllocateHostsInput) SetInstanceType(v string) *AllocateHostsInput { s.InstanceType = &v @@ -28498,6 +33395,12 @@ func (s *AssignPrivateIpAddressesInput) SetSecondaryPrivateIpAddressCount(v int6 type AssignPrivateIpAddressesOutput struct { _ struct{} `type:"structure"` + + // The private IP addresses assigned to the network interface. + AssignedPrivateIpAddresses []*AssignedPrivateIpAddress `locationName:"assignedPrivateIpAddressesSet" locationNameList:"item" type:"list"` + + // The ID of the network interface. + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` } // String returns the string representation @@ -28510,6 +33413,42 @@ func (s AssignPrivateIpAddressesOutput) GoString() string { return s.String() } +// SetAssignedPrivateIpAddresses sets the AssignedPrivateIpAddresses field's value. +func (s *AssignPrivateIpAddressesOutput) SetAssignedPrivateIpAddresses(v []*AssignedPrivateIpAddress) *AssignPrivateIpAddressesOutput { + s.AssignedPrivateIpAddresses = v + return s +} + +// SetNetworkInterfaceId sets the NetworkInterfaceId field's value. +func (s *AssignPrivateIpAddressesOutput) SetNetworkInterfaceId(v string) *AssignPrivateIpAddressesOutput { + s.NetworkInterfaceId = &v + return s +} + +// Describes the private IP addresses assigned to a network interface. +type AssignedPrivateIpAddress struct { + _ struct{} `type:"structure"` + + // The private IP address assigned to the network interface. + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` +} + +// String returns the string representation +func (s AssignedPrivateIpAddress) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssignedPrivateIpAddress) GoString() string { + return s.String() +} + +// SetPrivateIpAddress sets the PrivateIpAddress field's value. +func (s *AssignedPrivateIpAddress) SetPrivateIpAddress(v string) *AssignedPrivateIpAddress { + s.PrivateIpAddress = &v + return s +} + type AssociateAddressInput struct { _ struct{} `type:"structure"` @@ -28538,6 +33477,9 @@ type AssociateAddressInput struct { // [EC2-VPC] The ID of the network interface. If the instance has more than // one network interface, you must specify a network interface ID. + // + // For EC2-VPC, you can specify either the instance ID or the network interface + // ID, but not both. NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // [EC2-VPC] The primary or secondary private IP address to associate with the @@ -28545,7 +33487,8 @@ type AssociateAddressInput struct { // address is associated with the primary private IP address. PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` - // The Elastic IP address. This is required for EC2-Classic. + // The Elastic IP address to associate with the instance. This is required for + // EC2-Classic. PublicIp *string `type:"string"` } @@ -28628,6 +33571,10 @@ func (s *AssociateAddressOutput) SetAssociationId(v string) *AssociateAddressOut type AssociateClientVpnTargetNetworkInput struct { _ struct{} `type:"structure"` + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + // The ID of the Client VPN endpoint. // // ClientVpnEndpointId is a required field @@ -28671,6 +33618,12 @@ func (s *AssociateClientVpnTargetNetworkInput) Validate() error { return nil } +// SetClientToken sets the ClientToken field's value. +func (s *AssociateClientVpnTargetNetworkInput) SetClientToken(v string) *AssociateClientVpnTargetNetworkInput { + s.ClientToken = &v + return s +} + // SetClientVpnEndpointId sets the ClientVpnEndpointId field's value. func (s *AssociateClientVpnTargetNetworkInput) SetClientVpnEndpointId(v string) *AssociateClientVpnTargetNetworkInput { s.ClientVpnEndpointId = &v @@ -29881,6 +34834,10 @@ type AuthorizeClientVpnIngressInput struct { // who successfully establish a VPN connection access to the network. AuthorizeAllGroups *bool `type:"boolean"` + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + // The ID of the Client VPN endpoint. // // ClientVpnEndpointId is a required field @@ -29940,6 +34897,12 @@ func (s *AuthorizeClientVpnIngressInput) SetAuthorizeAllGroups(v bool) *Authoriz return s } +// SetClientToken sets the ClientToken field's value. +func (s *AuthorizeClientVpnIngressInput) SetClientToken(v string) *AuthorizeClientVpnIngressInput { + s.ClientToken = &v + return s +} + // SetClientVpnEndpointId sets the ClientVpnEndpointId field's value. func (s *AuthorizeClientVpnIngressInput) SetClientVpnEndpointId(v string) *AuthorizeClientVpnIngressInput { s.ClientVpnEndpointId = &v @@ -30007,8 +34970,8 @@ type AuthorizeSecurityGroupEgressInput struct { // GroupId is a required field GroupId *string `locationName:"groupId" type:"string" required:"true"` - // One or more sets of IP permissions. You can't specify a destination security - // group and a CIDR IP address range in the same set of permissions. + // The sets of IP permissions. You can't specify a destination security group + // and a CIDR IP address range in the same set of permissions. IpPermissions []*IpPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` // Not supported. Use a set of IP permissions to specify the protocol name or @@ -30121,8 +35084,12 @@ func (s AuthorizeSecurityGroupEgressOutput) GoString() string { type AuthorizeSecurityGroupIngressInput struct { _ struct{} `type:"structure"` - // The CIDR IPv4 address range. You can't specify this parameter when specifying - // a source security group. + // The IPv4 address range, in CIDR format. You can't specify this parameter + // when specifying a source security group. To specify an IPv6 address range, + // use a set of IP permissions. + // + // Alternatively, use a set of IP permissions to specify multiple rules and + // a description for the rule. CidrIp *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -30131,9 +35098,12 @@ type AuthorizeSecurityGroupIngressInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 - // type number. For the ICMP/ICMPv6 type number, use -1 to specify all types. - // If you specify all ICMP/ICMPv6 types, you must specify all codes. + // The start of port range for the TCP and UDP protocols, or an ICMP type number. + // For the ICMP type number, use -1 to specify all types. If you specify all + // ICMP types, you must specify all codes. + // + // Alternatively, use a set of IP permissions to specify multiple rules and + // a description for the rule. FromPort *int64 `type:"integer"` // The ID of the security group. You must specify either the security group @@ -30145,16 +35115,18 @@ type AuthorizeSecurityGroupIngressInput struct { // either the security group ID or the security group name in the request. GroupName *string `type:"string"` - // One or more sets of IP permissions. Can be used to specify multiple rules - // in a single command. + // The sets of IP permissions. IpPermissions []*IpPermission `locationNameList:"item" type:"list"` // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). - // (VPC only) Use -1 to specify all protocols. If you specify -1, or a protocol - // number other than tcp, udp, icmp, or 58 (ICMPv6), traffic on all ports is - // allowed, regardless of any ports you specify. For tcp, udp, and icmp, you - // must specify a port range. For protocol 58 (ICMPv6), you can optionally specify - // a port range; if you don't, traffic for all types and codes is allowed. + // To specify icmpv6, use a set of IP permissions. + // + // [VPC only] Use -1 to specify all protocols. If you specify -1 or a protocol + // other than tcp, udp, or icmp, traffic on all ports is allowed, regardless + // of any ports you specify. + // + // Alternatively, use a set of IP permissions to specify multiple rules and + // a description for the rule. IpProtocol *string `type:"string"` // [EC2-Classic, default VPC] The name of the source security group. You can't @@ -30166,17 +35138,20 @@ type AuthorizeSecurityGroupIngressInput struct { // be in the same VPC. SourceSecurityGroupName *string `type:"string"` - // [EC2-Classic] The AWS account ID for the source security group, if the source - // security group is in a different account. You can't specify this parameter + // [nondefault VPC] The AWS account ID for the source security group, if the + // source security group is in a different account. You can't specify this parameter // in combination with the following parameters: the CIDR IP address range, // the IP protocol, the start of the port range, and the end of the port range. // Creates rules that grant full ICMP, UDP, and TCP access. To create a rule // with a specific IP protocol and port range, use a set of IP permissions instead. SourceSecurityGroupOwnerId *string `type:"string"` - // The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code - // number. For the ICMP/ICMPv6 code number, use -1 to specify all codes. If - // you specify all ICMP/ICMPv6 types, you must specify all codes. + // The end of port range for the TCP and UDP protocols, or an ICMP code number. + // For the ICMP code number, use -1 to specify all codes. If you specify all + // ICMP types, you must specify all codes. + // + // Alternatively, use a set of IP permissions to specify multiple rules and + // a description for the rule. ToPort *int64 `type:"integer"` } @@ -30271,7 +35246,7 @@ type AvailabilityZone struct { // Any messages about the Availability Zone. Messages []*AvailabilityZoneMessage `locationName:"messageSet" locationNameList:"item" type:"list"` - // The name of the region. + // The name of the Region. RegionName *string `locationName:"regionName" type:"string"` // The state of the Availability Zone. @@ -30887,7 +35862,6 @@ func (s *CancelCapacityReservationOutput) SetReturn(v bool) *CancelCapacityReser return s } -// Contains the parameters for CancelConversionTask. type CancelConversionTaskInput struct { _ struct{} `type:"structure"` @@ -30961,7 +35935,6 @@ func (s CancelConversionTaskOutput) GoString() string { return s.String() } -// Contains the parameters for CancelExportTask. type CancelExportTaskInput struct { _ struct{} `type:"structure"` @@ -31014,7 +35987,6 @@ func (s CancelExportTaskOutput) GoString() string { return s.String() } -// Contains the parameters for CancelImportTask. type CancelImportTaskInput struct { _ struct{} `type:"structure"` @@ -31059,7 +36031,6 @@ func (s *CancelImportTaskInput) SetImportTaskId(v string) *CancelImportTaskInput return s } -// Contains the output for CancelImportTask. type CancelImportTaskOutput struct { _ struct{} `type:"structure"` @@ -31486,10 +36457,14 @@ type CapacityReservation struct { // The Availability Zone in which the capacity is reserved. AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + AvailabilityZoneId *string `locationName:"availabilityZoneId" type:"string"` + // The remaining capacity. Indicates the number of instances that can be launched // in the Capacity Reservation. AvailableInstanceCount *int64 `locationName:"availableInstanceCount" type:"integer"` + CapacityReservationArn *string `locationName:"capacityReservationArn" type:"string"` + // The ID of the Capacity Reservation. CapacityReservationId *string `locationName:"capacityReservationId" type:"string"` @@ -31544,6 +36519,8 @@ type CapacityReservation struct { // The type of instance for which the Capacity Reservation reserves capacity. InstanceType *string `locationName:"instanceType" type:"string"` + OwnerId *string `locationName:"ownerId" type:"string"` + // The current state of the Capacity Reservation. A Capacity Reservation can // be in one of the following states: // @@ -31598,12 +36575,24 @@ func (s *CapacityReservation) SetAvailabilityZone(v string) *CapacityReservation return s } +// SetAvailabilityZoneId sets the AvailabilityZoneId field's value. +func (s *CapacityReservation) SetAvailabilityZoneId(v string) *CapacityReservation { + s.AvailabilityZoneId = &v + return s +} + // SetAvailableInstanceCount sets the AvailableInstanceCount field's value. func (s *CapacityReservation) SetAvailableInstanceCount(v int64) *CapacityReservation { s.AvailableInstanceCount = &v return s } +// SetCapacityReservationArn sets the CapacityReservationArn field's value. +func (s *CapacityReservation) SetCapacityReservationArn(v string) *CapacityReservation { + s.CapacityReservationArn = &v + return s +} + // SetCapacityReservationId sets the CapacityReservationId field's value. func (s *CapacityReservation) SetCapacityReservationId(v string) *CapacityReservation { s.CapacityReservationId = &v @@ -31658,6 +36647,12 @@ func (s *CapacityReservation) SetInstanceType(v string) *CapacityReservation { return s } +// SetOwnerId sets the OwnerId field's value. +func (s *CapacityReservation) SetOwnerId(v string) *CapacityReservation { + s.OwnerId = &v + return s +} + // SetState sets the State field's value. func (s *CapacityReservation) SetState(v string) *CapacityReservation { s.State = &v @@ -31683,11 +36678,14 @@ func (s *CapacityReservation) SetTotalInstanceCount(v int64) *CapacityReservatio } // Describes an instance's Capacity Reservation targeting option. You can specify -// only one option at a time. Use the CapacityReservationPreference parameter -// to configure the instance to run as an On-Demand Instance or to run in any -// open Capacity Reservation that has matching attributes (instance type, platform, -// Availability Zone). Use the CapacityReservationTarget parameter to explicitly -// target a specific Capacity Reservation. +// only one parameter at a time. If you specify CapacityReservationPreference +// and CapacityReservationTarget, the request fails. +// +// Use the CapacityReservationPreference parameter to configure the instance +// to run as an On-Demand Instance or to run in any open Capacity Reservation +// that has matching attributes (instance type, platform, Availability Zone). +// Use the CapacityReservationTarget parameter to explicitly target a specific +// Capacity Reservation. type CapacityReservationSpecification struct { _ struct{} `type:"structure"` @@ -31870,7 +36868,10 @@ func (s *CertificateAuthenticationRequest) SetClientRootCertificateChainArn(v st } // Provides authorization for Amazon to bring a specific IP address range to -// a specific AWS account using bring your own IP addresses (BYOIP). +// a specific AWS account using bring your own IP addresses (BYOIP). For more +// information, see Prepare to Bring Your Address Range to Your AWS Account +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-byoip.html#prepare-for-byoip) +// in the Amazon Elastic Compute Cloud User Guide. type CidrAuthorizationContext struct { _ struct{} `type:"structure"` @@ -32180,8 +37181,8 @@ func (s *ClientData) SetUploadStart(v time.Time) *ClientData { // Describes the authentication methods used by a Client VPN endpoint. Client // VPN supports Active Directory and mutual authentication. For more information, -// see Authentication (vpn/latest/clientvpn-admin/authentication-authrization.html#client-authentication) -// in the AWS Client VPN Admin Guide. +// see Authentication (https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/authentication-authrization.html#client-authentication) +// in the AWS Client VPN Administrator Guide. type ClientVpnAuthentication struct { _ struct{} `type:"structure"` @@ -32225,8 +37226,8 @@ func (s *ClientVpnAuthentication) SetType(v string) *ClientVpnAuthentication { // Describes the authentication method to be used by a Client VPN endpoint. // Client VPN supports Active Directory and mutual authentication. For more -// information, see Authentication (vpn/latest/clientvpn-admin/authentication-authrization.html#client-authentication) -// in the AWS Client VPN Admin Guide. +// information, see Authentication (https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/authentication-authrization.html#client-authentication) +// in the AWS Client VPN Administrator Guide. type ClientVpnAuthenticationRequest struct { _ struct{} `type:"structure"` @@ -32478,7 +37479,9 @@ type ClientVpnEndpoint struct { // Information about the associated target networks. A target network is a subnet // in a VPC. - AssociatedTargetNetworks []*AssociatedTargetNetwork `locationName:"associatedTargetNetwork" locationNameList:"item" type:"list"` + // + // Deprecated: This property is deprecated. To view the target networks associated with a Client VPN endpoint, call DescribeClientVpnTargetNetworks and inspect the clientVpnTargetNetworks response element. + AssociatedTargetNetworks []*AssociatedTargetNetwork `locationName:"associatedTargetNetwork" locationNameList:"item" deprecated:"true" type:"list"` // Information about the authentication method used by the Client VPN endpoint. AuthenticationOptions []*ClientVpnAuthentication `locationName:"authenticationOptions" locationNameList:"item" type:"list"` @@ -32497,26 +37500,35 @@ type ClientVpnEndpoint struct { // The date and time the Client VPN endpoint was created. CreationTime *string `locationName:"creationTime" type:"string"` - // The date and time the Client VPN endpoint was deleted, if applicable. Information - // about deleted Client VPN endpoints is retained for 24 hours, unless a new - // Client VPN is created with the same name. + // The date and time the Client VPN endpoint was deleted, if applicable. DeletionTime *string `locationName:"deletionTime" type:"string"` // A brief description of the endpoint. Description *string `locationName:"description" type:"string"` - // The DNS name to be used by clients when establishing a connection. + // The DNS name to be used by clients when connecting to the Client VPN endpoint. DnsName *string `locationName:"dnsName" type:"string"` + // Information about the DNS servers to be used for DNS resolution. + DnsServers []*string `locationName:"dnsServer" locationNameList:"item" type:"list"` + // The ARN of the server certificate. ServerCertificateArn *string `locationName:"serverCertificateArn" type:"string"` - // Indicates whether VPN split tunneling is supported. + // Indicates whether split-tunnel is enabled in the AWS Client VPN endpoint + // endpoint. + // + // For information about split-tunnel VPN endpoints, see Split-Tunnel AWS Client + // VPN Endpoint (https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/split-tunnel-vpn.html) + // in the AWS Client VPN Administrator Guide. SplitTunnel *bool `locationName:"splitTunnel" type:"boolean"` // The current state of the Client VPN endpoint. Status *ClientVpnEndpointStatus `locationName:"status" type:"structure"` + // Any tags assigned to the Client VPN endpoint. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + // The transport protocol used by the Client VPN endpoint. TransportProtocol *string `locationName:"transportProtocol" type:"string" enum:"TransportProtocol"` @@ -32588,6 +37600,12 @@ func (s *ClientVpnEndpoint) SetDnsName(v string) *ClientVpnEndpoint { return s } +// SetDnsServers sets the DnsServers field's value. +func (s *ClientVpnEndpoint) SetDnsServers(v []*string) *ClientVpnEndpoint { + s.DnsServers = v + return s +} + // SetServerCertificateArn sets the ServerCertificateArn field's value. func (s *ClientVpnEndpoint) SetServerCertificateArn(v string) *ClientVpnEndpoint { s.ServerCertificateArn = &v @@ -32606,6 +37624,12 @@ func (s *ClientVpnEndpoint) SetStatus(v *ClientVpnEndpointStatus) *ClientVpnEndp return s } +// SetTags sets the Tags field's value. +func (s *ClientVpnEndpoint) SetTags(v []*Tag) *ClientVpnEndpoint { + s.Tags = v + return s +} + // SetTransportProtocol sets the TransportProtocol field's value. func (s *ClientVpnEndpoint) SetTransportProtocol(v string) *ClientVpnEndpoint { s.TransportProtocol = &v @@ -33129,7 +38153,7 @@ type CopyFpgaImageInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + // of the request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // The description for the new AFI. @@ -33149,7 +38173,7 @@ type CopyFpgaImageInput struct { // SourceFpgaImageId is a required field SourceFpgaImageId *string `type:"string" required:"true"` - // The region that contains the source AFI. + // The Region that contains the source AFI. // // SourceRegion is a required field SourceRegion *string `type:"string" required:"true"` @@ -33245,11 +38269,11 @@ type CopyImageInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier you provide to ensure idempotency of the - // request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) + // request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) // in the Amazon Elastic Compute Cloud User Guide. ClientToken *string `type:"string"` - // A description for the new AMI in the destination region. + // A description for the new AMI in the destination Region. Description *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -33263,8 +38287,8 @@ type CopyImageInput struct { // create an unencrypted copy of an encrypted snapshot. The default CMK for // EBS is used unless you specify a non-default AWS Key Management Service (AWS // KMS) CMK using KmsKeyId. For more information, see Amazon EBS Encryption - // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) in - // the Amazon Elastic Compute Cloud User Guide. + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) + // in the Amazon Elastic Compute Cloud User Guide. Encrypted *bool `locationName:"encrypted" type:"boolean"` // An identifier for the AWS Key Management Service (AWS KMS) customer master @@ -33273,31 +38297,26 @@ type CopyImageInput struct { // the default CMK for EBS is used. If a KmsKeyId is specified, the Encrypted // flag must also be set. // - // The CMK identifier may be provided in any of the following formats: + // To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias name, + // or alias ARN. When using an alias name, prefix it with "alias/". For example: // - // * Key ID + // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab // - // * Key alias, in the form alias/ExampleAlias + // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab // - // * ARN using key ID. The ID ARN contains the arn:aws:kms namespace, followed - // by the region of the CMK, the AWS account ID of the CMK owner, the key - // namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. - // - // - // * ARN using key alias. The alias ARN contains the arn:aws:kms namespace, - // followed by the region of the CMK, the AWS account ID of the CMK owner, - // the alias namespace, and then the CMK alias. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. + // * Alias name: alias/ExampleAlias // + // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias // // AWS parses KmsKeyId asynchronously, meaning that the action you call may // appear to complete even though you provided an invalid identifier. This action // will eventually report failure. // - // The specified CMK must exist in the region that the snapshot is being copied + // The specified CMK must exist in the Region that the snapshot is being copied // to. KmsKeyId *string `locationName:"kmsKeyId" type:"string"` - // The name of the new AMI in the destination region. + // The name of the new AMI in the destination Region. // // Name is a required field Name *string `type:"string" required:"true"` @@ -33307,7 +38326,7 @@ type CopyImageInput struct { // SourceImageId is a required field SourceImageId *string `type:"string" required:"true"` - // The name of the region that contains the AMI to copy. + // The name of the Region that contains the AMI to copy. // // SourceRegion is a required field SourceRegion *string `type:"string" required:"true"` @@ -33421,13 +38440,13 @@ type CopySnapshotInput struct { // A description for the EBS snapshot. Description *string `type:"string"` - // The destination region to use in the PresignedUrl parameter of a snapshot + // The destination Region to use in the PresignedUrl parameter of a snapshot // copy operation. This parameter is only valid for specifying the destination - // region in a PresignedUrl parameter, where it is required. + // Region in a PresignedUrl parameter, where it is required. // // The snapshot copy is sent to the regional endpoint that you sent the HTTP // request to (for example, ec2.us-east-1.amazonaws.com). With the AWS CLI, - // this is specified using the --region parameter or the default region in your + // this is specified using the --region parameter or the default Region in your // AWS configuration file. DestinationRegion *string `locationName:"destinationRegion" type:"string"` @@ -33437,57 +38456,50 @@ type CopySnapshotInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // Specifies whether the destination snapshot should be encrypted. You can encrypt - // a copy of an unencrypted snapshot, but you cannot use it to create an unencrypted - // copy of an encrypted snapshot. Your default CMK for EBS is used unless you - // specify a non-default AWS Key Management Service (AWS KMS) CMK using KmsKeyId. - // For more information, see Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) + // To encrypt a copy of an unencrypted snapshot if encryption by default is + // not enabled, enable encryption using this parameter. Otherwise, omit this + // parameter. Encrypted snapshots are encrypted, even if you omit this parameter + // and encryption by default is not enabled. You cannot set this parameter to + // false. For more information, see Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) // in the Amazon Elastic Compute Cloud User Guide. Encrypted *bool `locationName:"encrypted" type:"boolean"` - // An identifier for the AWS Key Management Service (AWS KMS) customer master - // key (CMK) to use when creating the encrypted volume. This parameter is only - // required if you want to use a non-default CMK; if this parameter is not specified, - // the default CMK for EBS is used. If a KmsKeyId is specified, the Encrypted - // flag must also be set. + // The identifier of the AWS Key Management Service (AWS KMS) customer master + // key (CMK) to use for Amazon EBS encryption. If this parameter is not specified, + // your AWS managed CMK for EBS is used. If KmsKeyId is specified, the encrypted + // state must be true. // - // The CMK identifier may be provided in any of the following formats: + // You can specify the CMK using any of the following: // - // * Key ID + // * Key ID. For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. // - // * Key alias + // * Key alias. For example, alias/ExampleAlias. // - // * ARN using key ID. The ID ARN contains the arn:aws:kms namespace, followed - // by the region of the CMK, the AWS account ID of the CMK owner, the key - // namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. + // * Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. // + // * Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. // - // * ARN using key alias. The alias ARN contains the arn:aws:kms namespace, - // followed by the region of the CMK, the AWS account ID of the CMK owner, - // the alias namespace, and then the CMK alias. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. - // - // - // AWS parses KmsKeyId asynchronously, meaning that the action you call may - // appear to complete even though you provided an invalid identifier. The action - // will eventually fail. + // AWS authenticates the CMK asynchronously. Therefore, if you specify an ID, + // alias, or ARN that is not valid, the action can appear to complete, but eventually + // fails. KmsKeyId *string `locationName:"kmsKeyId" type:"string"` // When you copy an encrypted source snapshot using the Amazon EC2 Query API, // you must supply a pre-signed URL. This parameter is optional for unencrypted - // snapshots. For more information, see Query Requests (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html). + // snapshots. For more information, see Query Requests (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html). // // The PresignedUrl should use the snapshot source endpoint, the CopySnapshot // action, and include the SourceRegion, SourceSnapshotId, and DestinationRegion // parameters. The PresignedUrl must be signed using AWS Signature Version 4. // Because EBS snapshots are stored in Amazon S3, the signing algorithm for // this parameter uses the same logic that is described in Authenticating Requests - // by Using Query Parameters (AWS Signature Version 4) (http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) + // by Using Query Parameters (AWS Signature Version 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) // in the Amazon Simple Storage Service API Reference. An invalid or improperly // signed PresignedUrl will cause the copy operation to fail asynchronously, // and the snapshot will move to an error state. PresignedUrl *string `locationName:"presignedUrl" type:"string"` - // The ID of the region that contains the snapshot to be copied. + // The ID of the Region that contains the snapshot to be copied. // // SourceRegion is a required field SourceRegion *string `type:"string" required:"true"` @@ -33669,12 +38681,12 @@ type CreateCapacityReservationInput struct { _ struct{} `type:"structure"` // The Availability Zone in which to create the Capacity Reservation. - // - // AvailabilityZone is a required field - AvailabilityZone *string `type:"string" required:"true"` + AvailabilityZone *string `type:"string"` + + AvailabilityZoneId *string `type:"string"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). // // Constraint: Maximum 64 ASCII characters. ClientToken *string `type:"string"` @@ -33748,7 +38760,7 @@ type CreateCapacityReservationInput struct { InstancePlatform *string `type:"string" required:"true" enum:"CapacityReservationInstancePlatform"` // The instance type for which to reserve capacity. For more information, see - // Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + // Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) // in the Amazon Elastic Compute Cloud User Guide. // // InstanceType is a required field @@ -33781,9 +38793,6 @@ func (s CreateCapacityReservationInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *CreateCapacityReservationInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "CreateCapacityReservationInput"} - if s.AvailabilityZone == nil { - invalidParams.Add(request.NewErrParamRequired("AvailabilityZone")) - } if s.InstanceCount == nil { invalidParams.Add(request.NewErrParamRequired("InstanceCount")) } @@ -33806,6 +38815,12 @@ func (s *CreateCapacityReservationInput) SetAvailabilityZone(v string) *CreateCa return s } +// SetAvailabilityZoneId sets the AvailabilityZoneId field's value. +func (s *CreateCapacityReservationInput) SetAvailabilityZoneId(v string) *CreateCapacityReservationInput { + s.AvailabilityZoneId = &v + return s +} + // SetClientToken sets the ClientToken field's value. func (s *CreateCapacityReservationInput) SetClientToken(v string) *CreateCapacityReservationInput { s.ClientToken = &v @@ -33918,8 +38933,8 @@ type CreateClientVpnEndpointInput struct { // ClientCidrBlock is a required field ClientCidrBlock *string `type:"string" required:"true"` - // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string" idempotencyToken:"true"` // Information about the client connection logging options. @@ -33954,11 +38969,24 @@ type CreateClientVpnEndpointInput struct { DryRun *bool `type:"boolean"` // The ARN of the server certificate. For more information, see the AWS Certificate - // Manager User Guide (acm/latest/userguide/acm-overview.html) . + // Manager User Guide (https://docs.aws.amazon.com/acm/latest/userguide/). // // ServerCertificateArn is a required field ServerCertificateArn *string `type:"string" required:"true"` + // Indicates whether split-tunnel is enabled on the AWS Client VPN endpoint + // endpoint. + // + // By default, split-tunnel on a VPN endpoint is disabled. + // + // For information about split-tunnel VPN endpoints, see Split-Tunnel AWS Client + // VPN Endpoint (https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/split-tunnel-vpn.html) + // in the AWS Client VPN Administrator Guide. + SplitTunnel *bool `type:"boolean"` + + // The tags to apply to the Client VPN endpoint during creation. + TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` + // The transport protocol to be used by the VPN session. // // Default value: udp @@ -34045,6 +39073,18 @@ func (s *CreateClientVpnEndpointInput) SetServerCertificateArn(v string) *Create return s } +// SetSplitTunnel sets the SplitTunnel field's value. +func (s *CreateClientVpnEndpointInput) SetSplitTunnel(v bool) *CreateClientVpnEndpointInput { + s.SplitTunnel = &v + return s +} + +// SetTagSpecifications sets the TagSpecifications field's value. +func (s *CreateClientVpnEndpointInput) SetTagSpecifications(v []*TagSpecification) *CreateClientVpnEndpointInput { + s.TagSpecifications = v + return s +} + // SetTransportProtocol sets the TransportProtocol field's value. func (s *CreateClientVpnEndpointInput) SetTransportProtocol(v string) *CreateClientVpnEndpointInput { s.TransportProtocol = &v @@ -34095,6 +39135,10 @@ func (s *CreateClientVpnEndpointOutput) SetStatus(v *ClientVpnEndpointStatus) *C type CreateClientVpnRouteInput struct { _ struct{} `type:"structure"` + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + // The ID of the Client VPN endpoint to which to add the route. // // ClientVpnEndpointId is a required field @@ -34160,6 +39204,12 @@ func (s *CreateClientVpnRouteInput) Validate() error { return nil } +// SetClientToken sets the ClientToken field's value. +func (s *CreateClientVpnRouteInput) SetClientToken(v string) *CreateClientVpnRouteInput { + s.ClientToken = &v + return s +} + // SetClientVpnEndpointId sets the ClientVpnEndpointId field's value. func (s *CreateClientVpnRouteInput) SetClientVpnEndpointId(v string) *CreateClientVpnRouteInput { s.ClientVpnEndpointId = &v @@ -34518,7 +39568,7 @@ type CreateEgressOnlyInternetGatewayInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -34612,11 +39662,11 @@ type CreateFleetError struct { _ struct{} `type:"structure"` // The error code that indicates why the instance could not be launched. For - // more information about error codes, see Error Codes (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html). + // more information about error codes, see Error Codes (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html). ErrorCode *string `locationName:"errorCode" type:"string"` // The error message that describes why the instance could not be launched. - // For more information about error messages, see ee Error Codes (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html). + // For more information about error messages, see ee Error Codes (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html). ErrorMessage *string `locationName:"errorMessage" type:"string"` // The launch templates and overrides that were used for launching the instances. @@ -34667,7 +39717,7 @@ type CreateFleetInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // the request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -34686,7 +39736,7 @@ type CreateFleetInput struct { // LaunchTemplateConfigs is a required field LaunchTemplateConfigs []*FleetLaunchTemplateConfigRequest `locationNameList:"item" type:"list" required:"true"` - // The allocation strategy of On-Demand Instances in an EC2 Fleet. + // Describes the configuration of On-Demand Instances in an EC2 Fleet. OnDemandOptions *OnDemandOptionsRequest `type:"structure"` // Indicates whether EC2 Fleet should replace unhealthy instances. @@ -34697,12 +39747,11 @@ type CreateFleetInput struct { // The key-value pair for tagging the EC2 Fleet request on creation. The value // for ResourceType must be fleet, otherwise the fleet request fails. To tag - // instances at launch, specify the tags in the launch template (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html#create-launch-template). - // For information about tagging after launch, see Tagging Your Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-resources). + // instances at launch, specify the tags in the launch template (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html#create-launch-template). + // For information about tagging after launch, see Tagging Your Resources (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-resources). TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` - // The TotalTargetCapacity, OnDemandTargetCapacity, SpotTargetCapacity, and - // DefaultCapacityType structure. + // The number of units to request. // // TargetCapacitySpecification is a required field TargetCapacitySpecification *TargetCapacitySpecificationRequest `type:"structure" required:"true"` @@ -34717,7 +39766,7 @@ type CreateFleetInput struct { // request, and returns errors for any instances that could not be launched. // A value of request places an asynchronous one-time request without maintaining // capacity or submitting requests in alternative capacity pools if capacity - // is unavailable. For more information, see EC2 Fleet Request Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-configuration-strategies.html#ec2-fleet-request-type) + // is unavailable. For more information, see EC2 Fleet Request Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-configuration-strategies.html#ec2-fleet-request-type) // in the Amazon Elastic Compute Cloud User Guide. Type *string `type:"string" enum:"FleetType"` @@ -34727,7 +39776,7 @@ type CreateFleetInput struct { // The end date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). // At this point, no new EC2 Fleet requests are placed or able to fulfill the - // request. The default end date is 7 days from the current date. + // request. If no value is specified, the request remains until you cancel it. ValidUntil *time.Time `type:"timestamp"` } @@ -34960,10 +40009,14 @@ type CreateFlowLogsInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` - // The ARN for the IAM role that's used to post flow logs to a log group. + // The ARN for the IAM role that permits Amazon EC2 to publish flow logs to + // a CloudWatch Logs log group in your account. + // + // If you specify LogDestinationType as s3, do not specify DeliverLogsPermissionArn + // or LogGroupName. DeliverLogsPermissionArn *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -34973,7 +40026,7 @@ type CreateFlowLogsInput struct { DryRun *bool `type:"boolean"` // Specifies the destination to which the flow log data is to be published. - // Flow log data can be published to an CloudWatch Logs log group or an Amazon + // Flow log data can be published to a CloudWatch Logs log group or an Amazon // S3 bucket. The value specified for this parameter depends on the value specified // for LogDestinationType. // @@ -34993,25 +40046,35 @@ type CreateFlowLogsInput struct { // flow log data to CloudWatch Logs, specify cloud-watch-logs. To publish flow // log data to Amazon S3, specify s3. // + // If you specify LogDestinationType as s3, do not specify DeliverLogsPermissionArn + // or LogGroupName. + // // Default: cloud-watch-logs LogDestinationType *string `type:"string" enum:"LogDestinationType"` - // The name of the log group. + // The name of a new or existing CloudWatch Logs log group where Amazon EC2 + // publishes your flow logs. + // + // If you specify LogDestinationType as s3, do not specify DeliverLogsPermissionArn + // or LogGroupName. LogGroupName *string `type:"string"` - // One or more subnet, network interface, or VPC IDs. + // The ID of the subnet, network interface, or VPC for which you want to create + // a flow log. // // Constraints: Maximum of 1000 resources // // ResourceIds is a required field ResourceIds []*string `locationName:"ResourceId" locationNameList:"item" type:"list" required:"true"` - // The type of resource on which to create the flow log. + // The type of resource for which to create the flow log. For example, if you + // specified a VPC ID for the ResourceId property, specify VPC for this property. // // ResourceType is a required field ResourceType *string `type:"string" required:"true" enum:"FlowLogsResourceType"` - // The type of traffic to log. + // The type of traffic to log. You can log traffic that the resource accepts + // or rejects, or all traffic. // // TrafficType is a required field TrafficType *string `type:"string" required:"true" enum:"TrafficType"` @@ -35146,7 +40209,7 @@ type CreateFpgaImageInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + // of the request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // A description for the AFI. @@ -35262,13 +40325,12 @@ func (s *CreateFpgaImageOutput) SetFpgaImageId(v string) *CreateFpgaImageOutput return s } -// Contains the parameters for CreateImage. type CreateImageInput struct { _ struct{} `type:"structure"` - // Information about one or more block device mappings. This parameter cannot - // be used to modify the encryption status of existing volumes or snapshots. - // To create an AMI with encrypted snapshots, use the CopyImage action. + // The block device mappings. This parameter cannot be used to modify the encryption + // status of existing volumes or snapshots. To create an AMI with encrypted + // snapshots, use the CopyImage action. BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` // A description for the new image. @@ -35363,7 +40425,6 @@ func (s *CreateImageInput) SetNoReboot(v bool) *CreateImageInput { return s } -// Contains the output of CreateImage. type CreateImageOutput struct { _ struct{} `type:"structure"` @@ -35387,7 +40448,6 @@ func (s *CreateImageOutput) SetImageId(v string) *CreateImageOutput { return s } -// Contains the parameters for CreateInstanceExportTask. type CreateInstanceExportTaskInput struct { _ struct{} `type:"structure"` @@ -35454,7 +40514,6 @@ func (s *CreateInstanceExportTaskInput) SetTargetEnvironment(v string) *CreateIn return s } -// Contains the output for CreateInstanceExportTask. type CreateInstanceExportTaskOutput struct { _ struct{} `type:"structure"` @@ -35625,7 +40684,9 @@ type CreateLaunchTemplateInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // the request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // + // Constraint: Maximum 128 ASCII characters. ClientToken *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -35644,6 +40705,9 @@ type CreateLaunchTemplateInput struct { // LaunchTemplateName is a required field LaunchTemplateName *string `min:"3" type:"string" required:"true"` + // The tags to apply to the launch template during creation. + TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` + // A description for the first version of the launch template. VersionDescription *string `type:"string"` } @@ -35706,6 +40770,12 @@ func (s *CreateLaunchTemplateInput) SetLaunchTemplateName(v string) *CreateLaunc return s } +// SetTagSpecifications sets the TagSpecifications field's value. +func (s *CreateLaunchTemplateInput) SetTagSpecifications(v []*TagSpecification) *CreateLaunchTemplateInput { + s.TagSpecifications = v + return s +} + // SetVersionDescription sets the VersionDescription field's value. func (s *CreateLaunchTemplateInput) SetVersionDescription(v string) *CreateLaunchTemplateInput { s.VersionDescription = &v @@ -35739,7 +40809,9 @@ type CreateLaunchTemplateVersionInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // the request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // + // Constraint: Maximum 128 ASCII characters. ClientToken *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -35877,7 +40949,7 @@ type CreateNatGatewayInput struct { AllocationId *string `type:"string" required:"true"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). // // Constraint: Maximum 64 ASCII characters. ClientToken *string `type:"string"` @@ -36223,6 +41295,11 @@ type CreateNetworkInterfaceInput struct { // The IDs of one or more security groups. Groups []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` + // Indicates the type of network interface. To create an Elastic Fabric Adapter + // (EFA), specify efa. For more information, see Elastic Fabric Adapter (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html) + // in the Amazon Elastic Compute Cloud User Guide. + InterfaceType *string `type:"string" enum:"NetworkInterfaceCreationType"` + // The number of IPv6 addresses to assign to a network interface. Amazon EC2 // automatically selects the IPv6 addresses from the subnet range. You can't // use this option if specifying specific IPv6 addresses. If your subnet has @@ -36251,7 +41328,7 @@ type CreateNetworkInterfaceInput struct { // // The number of IP addresses you can assign to a network interface varies by // instance type. For more information, see IP Addresses Per ENI Per Instance - // Type (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) + // Type (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) // in the Amazon Virtual Private Cloud User Guide. SecondaryPrivateIpAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` @@ -36302,6 +41379,12 @@ func (s *CreateNetworkInterfaceInput) SetGroups(v []*string) *CreateNetworkInter return s } +// SetInterfaceType sets the InterfaceType field's value. +func (s *CreateNetworkInterfaceInput) SetInterfaceType(v string) *CreateNetworkInterfaceInput { + s.InterfaceType = &v + return s +} + // SetIpv6AddressCount sets the Ipv6AddressCount field's value. func (s *CreateNetworkInterfaceInput) SetIpv6AddressCount(v int64) *CreateNetworkInterfaceInput { s.Ipv6AddressCount = &v @@ -36545,7 +41628,7 @@ type CreateReservedInstancesListingInput struct { // Unique, case-sensitive identifier you provide to ensure idempotency of your // listings. This helps avoid duplicate listings. For more information, see - // Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). // // ClientToken is a required field ClientToken *string `locationName:"clientToken" type:"string" required:"true"` @@ -37058,6 +42141,105 @@ func (s *CreateSnapshotInput) SetVolumeId(v string) *CreateSnapshotInput { return s } +type CreateSnapshotsInput struct { + _ struct{} `type:"structure"` + + // Copies the tags from the specified volume to corresponding snapshot. + CopyTagsFromSource *string `type:"string" enum:"CopyTagsFromSource"` + + // A description propagated to every snapshot specified by the instance. + Description *string `type:"string"` + + // Checks whether you have the required permissions for the action without actually + // making the request. Provides an error response. If you have the required + // permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The instance to specify which volumes should be included in the snapshots. + // + // InstanceSpecification is a required field + InstanceSpecification *InstanceSpecification `type:"structure" required:"true"` + + // Tags to apply to every snapshot specified by the instance. + TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s CreateSnapshotsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateSnapshotsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateSnapshotsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateSnapshotsInput"} + if s.InstanceSpecification == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceSpecification")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetCopyTagsFromSource sets the CopyTagsFromSource field's value. +func (s *CreateSnapshotsInput) SetCopyTagsFromSource(v string) *CreateSnapshotsInput { + s.CopyTagsFromSource = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *CreateSnapshotsInput) SetDescription(v string) *CreateSnapshotsInput { + s.Description = &v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *CreateSnapshotsInput) SetDryRun(v bool) *CreateSnapshotsInput { + s.DryRun = &v + return s +} + +// SetInstanceSpecification sets the InstanceSpecification field's value. +func (s *CreateSnapshotsInput) SetInstanceSpecification(v *InstanceSpecification) *CreateSnapshotsInput { + s.InstanceSpecification = v + return s +} + +// SetTagSpecifications sets the TagSpecifications field's value. +func (s *CreateSnapshotsInput) SetTagSpecifications(v []*TagSpecification) *CreateSnapshotsInput { + s.TagSpecifications = v + return s +} + +type CreateSnapshotsOutput struct { + _ struct{} `type:"structure"` + + // List of snapshots. + Snapshots []*SnapshotInfo `locationName:"snapshotSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s CreateSnapshotsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateSnapshotsOutput) GoString() string { + return s.String() +} + +// SetSnapshots sets the Snapshots field's value. +func (s *CreateSnapshotsOutput) SetSnapshots(v []*SnapshotInfo) *CreateSnapshotsOutput { + s.Snapshots = v + return s +} + // Contains the parameters for CreateSpotDatafeedSubscription. type CreateSpotDatafeedSubscriptionInput struct { _ struct{} `type:"structure"` @@ -37269,7 +42451,7 @@ type CreateTagsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // The IDs of one or more resources, separated by spaces. + // The IDs of the resources, separated by spaces. // // Constraints: Up to 1000 resource IDs. We recommend breaking up this request // into smaller batches. @@ -37277,9 +42459,9 @@ type CreateTagsInput struct { // Resources is a required field Resources []*string `locationName:"ResourceId" type:"list" required:"true"` - // One or more tags. The value parameter is required, but if you don't want - // the tag to have a value, specify the parameter with no value, and we set - // the value to an empty string. + // The tags. The value parameter is required, but if you don't want the tag + // to have a value, specify the parameter with no value, and we set the value + // to an empty string. // // Tags is a required field Tags []*Tag `locationName:"Tag" locationNameList:"item" type:"list" required:"true"` @@ -37343,6 +42525,589 @@ func (s CreateTagsOutput) GoString() string { return s.String() } +type CreateTrafficMirrorFilterInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + + // The description of the Traffic Mirror filter. + Description *string `type:"string"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The tags to assign to a Traffic Mirror filter. + TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s CreateTrafficMirrorFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateTrafficMirrorFilterInput) GoString() string { + return s.String() +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateTrafficMirrorFilterInput) SetClientToken(v string) *CreateTrafficMirrorFilterInput { + s.ClientToken = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *CreateTrafficMirrorFilterInput) SetDescription(v string) *CreateTrafficMirrorFilterInput { + s.Description = &v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *CreateTrafficMirrorFilterInput) SetDryRun(v bool) *CreateTrafficMirrorFilterInput { + s.DryRun = &v + return s +} + +// SetTagSpecifications sets the TagSpecifications field's value. +func (s *CreateTrafficMirrorFilterInput) SetTagSpecifications(v []*TagSpecification) *CreateTrafficMirrorFilterInput { + s.TagSpecifications = v + return s +} + +type CreateTrafficMirrorFilterOutput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `locationName:"clientToken" type:"string"` + + // Information about the Traffic Mirror filter. + TrafficMirrorFilter *TrafficMirrorFilter `locationName:"trafficMirrorFilter" type:"structure"` +} + +// String returns the string representation +func (s CreateTrafficMirrorFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateTrafficMirrorFilterOutput) GoString() string { + return s.String() +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateTrafficMirrorFilterOutput) SetClientToken(v string) *CreateTrafficMirrorFilterOutput { + s.ClientToken = &v + return s +} + +// SetTrafficMirrorFilter sets the TrafficMirrorFilter field's value. +func (s *CreateTrafficMirrorFilterOutput) SetTrafficMirrorFilter(v *TrafficMirrorFilter) *CreateTrafficMirrorFilterOutput { + s.TrafficMirrorFilter = v + return s +} + +type CreateTrafficMirrorFilterRuleInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + + // The description of the Traffic Mirror rule. + Description *string `type:"string"` + + // The destination CIDR block to assign to the Traffic Mirror rule. + // + // DestinationCidrBlock is a required field + DestinationCidrBlock *string `type:"string" required:"true"` + + // The destination port range. + DestinationPortRange *TrafficMirrorPortRangeRequest `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The protocol, for example UDP, to assign to the Traffic Mirror rule. + // + // For information about the protocol value, see Protocol Numbers (https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml) + // on the Internet Assigned Numbers Authority (IANA) website. + Protocol *int64 `type:"integer"` + + // The action to take (accept | reject) on the filtered traffic. + // + // RuleAction is a required field + RuleAction *string `type:"string" required:"true" enum:"TrafficMirrorRuleAction"` + + // The number of the Traffic Mirror rule. This number must be unique for each + // Traffic Mirror rule in a given direction. The rules are processed in ascending + // order by rule number. + // + // RuleNumber is a required field + RuleNumber *int64 `type:"integer" required:"true"` + + // The source CIDR block to assign to the Traffic Mirror rule. + // + // SourceCidrBlock is a required field + SourceCidrBlock *string `type:"string" required:"true"` + + // The source port range. + SourcePortRange *TrafficMirrorPortRangeRequest `type:"structure"` + + // The type of traffic (ingress | egress). + // + // TrafficDirection is a required field + TrafficDirection *string `type:"string" required:"true" enum:"TrafficDirection"` + + // The ID of the filter that this rule is associated with. + // + // TrafficMirrorFilterId is a required field + TrafficMirrorFilterId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateTrafficMirrorFilterRuleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateTrafficMirrorFilterRuleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateTrafficMirrorFilterRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateTrafficMirrorFilterRuleInput"} + if s.DestinationCidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationCidrBlock")) + } + if s.RuleAction == nil { + invalidParams.Add(request.NewErrParamRequired("RuleAction")) + } + if s.RuleNumber == nil { + invalidParams.Add(request.NewErrParamRequired("RuleNumber")) + } + if s.SourceCidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("SourceCidrBlock")) + } + if s.TrafficDirection == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficDirection")) + } + if s.TrafficMirrorFilterId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorFilterId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetClientToken(v string) *CreateTrafficMirrorFilterRuleInput { + s.ClientToken = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetDescription(v string) *CreateTrafficMirrorFilterRuleInput { + s.Description = &v + return s +} + +// SetDestinationCidrBlock sets the DestinationCidrBlock field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetDestinationCidrBlock(v string) *CreateTrafficMirrorFilterRuleInput { + s.DestinationCidrBlock = &v + return s +} + +// SetDestinationPortRange sets the DestinationPortRange field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetDestinationPortRange(v *TrafficMirrorPortRangeRequest) *CreateTrafficMirrorFilterRuleInput { + s.DestinationPortRange = v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetDryRun(v bool) *CreateTrafficMirrorFilterRuleInput { + s.DryRun = &v + return s +} + +// SetProtocol sets the Protocol field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetProtocol(v int64) *CreateTrafficMirrorFilterRuleInput { + s.Protocol = &v + return s +} + +// SetRuleAction sets the RuleAction field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetRuleAction(v string) *CreateTrafficMirrorFilterRuleInput { + s.RuleAction = &v + return s +} + +// SetRuleNumber sets the RuleNumber field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetRuleNumber(v int64) *CreateTrafficMirrorFilterRuleInput { + s.RuleNumber = &v + return s +} + +// SetSourceCidrBlock sets the SourceCidrBlock field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetSourceCidrBlock(v string) *CreateTrafficMirrorFilterRuleInput { + s.SourceCidrBlock = &v + return s +} + +// SetSourcePortRange sets the SourcePortRange field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetSourcePortRange(v *TrafficMirrorPortRangeRequest) *CreateTrafficMirrorFilterRuleInput { + s.SourcePortRange = v + return s +} + +// SetTrafficDirection sets the TrafficDirection field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetTrafficDirection(v string) *CreateTrafficMirrorFilterRuleInput { + s.TrafficDirection = &v + return s +} + +// SetTrafficMirrorFilterId sets the TrafficMirrorFilterId field's value. +func (s *CreateTrafficMirrorFilterRuleInput) SetTrafficMirrorFilterId(v string) *CreateTrafficMirrorFilterRuleInput { + s.TrafficMirrorFilterId = &v + return s +} + +type CreateTrafficMirrorFilterRuleOutput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `locationName:"clientToken" type:"string"` + + // The Traffic Mirror rule. + TrafficMirrorFilterRule *TrafficMirrorFilterRule `locationName:"trafficMirrorFilterRule" type:"structure"` +} + +// String returns the string representation +func (s CreateTrafficMirrorFilterRuleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateTrafficMirrorFilterRuleOutput) GoString() string { + return s.String() +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateTrafficMirrorFilterRuleOutput) SetClientToken(v string) *CreateTrafficMirrorFilterRuleOutput { + s.ClientToken = &v + return s +} + +// SetTrafficMirrorFilterRule sets the TrafficMirrorFilterRule field's value. +func (s *CreateTrafficMirrorFilterRuleOutput) SetTrafficMirrorFilterRule(v *TrafficMirrorFilterRule) *CreateTrafficMirrorFilterRuleOutput { + s.TrafficMirrorFilterRule = v + return s +} + +type CreateTrafficMirrorSessionInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + + // The description of the Traffic Mirror session. + Description *string `type:"string"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The ID of the source network interface. + // + // NetworkInterfaceId is a required field + NetworkInterfaceId *string `type:"string" required:"true"` + + // The number of bytes in each packet to mirror. These are bytes after the VXLAN + // header. Do not specify this parameter when you want to mirror the entire + // packet. To mirror a subset of the packet, set this to the length (in bytes) + // that you want to mirror. For example, if you set this value to 1network0, + // then the first 100 bytes that meet the filter criteria are copied to the + // target. + // + // If you do not want to mirror the entire packet, use the PacketLength parameter + // to specify the number of bytes in each packet to mirror. + PacketLength *int64 `type:"integer"` + + // The session number determines the order in which sessions are evaluated when + // an interface is used by multiple sessions. The first session with a matching + // filter is the one that mirrors the packets. + // + // Valid values are 1-32766. + // + // SessionNumber is a required field + SessionNumber *int64 `type:"integer" required:"true"` + + // The tags to assign to a Traffic Mirror session. + TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` + + // The ID of the Traffic Mirror filter. + // + // TrafficMirrorFilterId is a required field + TrafficMirrorFilterId *string `type:"string" required:"true"` + + // The ID of the Traffic Mirror target. + // + // TrafficMirrorTargetId is a required field + TrafficMirrorTargetId *string `type:"string" required:"true"` + + // The VXLAN ID for the Traffic Mirror session. For more information about the + // VXLAN protocol, see RFC 7348 (https://tools.ietf.org/html/rfc7348). If you + // do not specify a VirtualNetworkId, an account-wide unique id is chosen at + // random. + VirtualNetworkId *int64 `type:"integer"` +} + +// String returns the string representation +func (s CreateTrafficMirrorSessionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateTrafficMirrorSessionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateTrafficMirrorSessionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateTrafficMirrorSessionInput"} + if s.NetworkInterfaceId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkInterfaceId")) + } + if s.SessionNumber == nil { + invalidParams.Add(request.NewErrParamRequired("SessionNumber")) + } + if s.TrafficMirrorFilterId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorFilterId")) + } + if s.TrafficMirrorTargetId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorTargetId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateTrafficMirrorSessionInput) SetClientToken(v string) *CreateTrafficMirrorSessionInput { + s.ClientToken = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *CreateTrafficMirrorSessionInput) SetDescription(v string) *CreateTrafficMirrorSessionInput { + s.Description = &v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *CreateTrafficMirrorSessionInput) SetDryRun(v bool) *CreateTrafficMirrorSessionInput { + s.DryRun = &v + return s +} + +// SetNetworkInterfaceId sets the NetworkInterfaceId field's value. +func (s *CreateTrafficMirrorSessionInput) SetNetworkInterfaceId(v string) *CreateTrafficMirrorSessionInput { + s.NetworkInterfaceId = &v + return s +} + +// SetPacketLength sets the PacketLength field's value. +func (s *CreateTrafficMirrorSessionInput) SetPacketLength(v int64) *CreateTrafficMirrorSessionInput { + s.PacketLength = &v + return s +} + +// SetSessionNumber sets the SessionNumber field's value. +func (s *CreateTrafficMirrorSessionInput) SetSessionNumber(v int64) *CreateTrafficMirrorSessionInput { + s.SessionNumber = &v + return s +} + +// SetTagSpecifications sets the TagSpecifications field's value. +func (s *CreateTrafficMirrorSessionInput) SetTagSpecifications(v []*TagSpecification) *CreateTrafficMirrorSessionInput { + s.TagSpecifications = v + return s +} + +// SetTrafficMirrorFilterId sets the TrafficMirrorFilterId field's value. +func (s *CreateTrafficMirrorSessionInput) SetTrafficMirrorFilterId(v string) *CreateTrafficMirrorSessionInput { + s.TrafficMirrorFilterId = &v + return s +} + +// SetTrafficMirrorTargetId sets the TrafficMirrorTargetId field's value. +func (s *CreateTrafficMirrorSessionInput) SetTrafficMirrorTargetId(v string) *CreateTrafficMirrorSessionInput { + s.TrafficMirrorTargetId = &v + return s +} + +// SetVirtualNetworkId sets the VirtualNetworkId field's value. +func (s *CreateTrafficMirrorSessionInput) SetVirtualNetworkId(v int64) *CreateTrafficMirrorSessionInput { + s.VirtualNetworkId = &v + return s +} + +type CreateTrafficMirrorSessionOutput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `locationName:"clientToken" type:"string"` + + // Information about the Traffic Mirror session. + TrafficMirrorSession *TrafficMirrorSession `locationName:"trafficMirrorSession" type:"structure"` +} + +// String returns the string representation +func (s CreateTrafficMirrorSessionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateTrafficMirrorSessionOutput) GoString() string { + return s.String() +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateTrafficMirrorSessionOutput) SetClientToken(v string) *CreateTrafficMirrorSessionOutput { + s.ClientToken = &v + return s +} + +// SetTrafficMirrorSession sets the TrafficMirrorSession field's value. +func (s *CreateTrafficMirrorSessionOutput) SetTrafficMirrorSession(v *TrafficMirrorSession) *CreateTrafficMirrorSessionOutput { + s.TrafficMirrorSession = v + return s +} + +type CreateTrafficMirrorTargetInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + + // The description of the Traffic Mirror target. + Description *string `type:"string"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The network interface ID that is associated with the target. + NetworkInterfaceId *string `type:"string"` + + // The Amazon Resource Name (ARN) of the Network Load Balancer that is associated + // with the target. + NetworkLoadBalancerArn *string `type:"string"` + + // The tags to assign to the Traffic Mirror target. + TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s CreateTrafficMirrorTargetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateTrafficMirrorTargetInput) GoString() string { + return s.String() +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateTrafficMirrorTargetInput) SetClientToken(v string) *CreateTrafficMirrorTargetInput { + s.ClientToken = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *CreateTrafficMirrorTargetInput) SetDescription(v string) *CreateTrafficMirrorTargetInput { + s.Description = &v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *CreateTrafficMirrorTargetInput) SetDryRun(v bool) *CreateTrafficMirrorTargetInput { + s.DryRun = &v + return s +} + +// SetNetworkInterfaceId sets the NetworkInterfaceId field's value. +func (s *CreateTrafficMirrorTargetInput) SetNetworkInterfaceId(v string) *CreateTrafficMirrorTargetInput { + s.NetworkInterfaceId = &v + return s +} + +// SetNetworkLoadBalancerArn sets the NetworkLoadBalancerArn field's value. +func (s *CreateTrafficMirrorTargetInput) SetNetworkLoadBalancerArn(v string) *CreateTrafficMirrorTargetInput { + s.NetworkLoadBalancerArn = &v + return s +} + +// SetTagSpecifications sets the TagSpecifications field's value. +func (s *CreateTrafficMirrorTargetInput) SetTagSpecifications(v []*TagSpecification) *CreateTrafficMirrorTargetInput { + s.TagSpecifications = v + return s +} + +type CreateTrafficMirrorTargetOutput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `locationName:"clientToken" type:"string"` + + // Information about the Traffic Mirror target. + TrafficMirrorTarget *TrafficMirrorTarget `locationName:"trafficMirrorTarget" type:"structure"` +} + +// String returns the string representation +func (s CreateTrafficMirrorTargetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateTrafficMirrorTargetOutput) GoString() string { + return s.String() +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateTrafficMirrorTargetOutput) SetClientToken(v string) *CreateTrafficMirrorTargetOutput { + s.ClientToken = &v + return s +} + +// SetTrafficMirrorTarget sets the TrafficMirrorTarget field's value. +func (s *CreateTrafficMirrorTargetOutput) SetTrafficMirrorTarget(v *TrafficMirrorTarget) *CreateTrafficMirrorTargetOutput { + s.TrafficMirrorTarget = v + return s +} + type CreateTransitGatewayInput struct { _ struct{} `type:"structure"` @@ -37422,7 +43187,7 @@ func (s *CreateTransitGatewayOutput) SetTransitGateway(v *TransitGateway) *Creat type CreateTransitGatewayRouteInput struct { _ struct{} `type:"structure"` - // Indicates whether traffic matching this route is to be dropped. + // Indicates whether to drop traffic that matches this route. Blackhole *bool `type:"boolean"` // The CIDR range used for destination matches. Routing decisions are based @@ -37766,8 +43531,7 @@ func (s *CreateTransitGatewayVpcAttachmentRequestOptions) SetIpv6Support(v strin type CreateVolumeInput struct { _ struct{} `type:"structure"` - // The Availability Zone in which to create the volume. Use DescribeAvailabilityZones - // to list the Availability Zones that are currently available to you. + // The Availability Zone in which to create the volume. // // AvailabilityZone is a required field AvailabilityZone *string `type:"string" required:"true"` @@ -37778,51 +43542,45 @@ type CreateVolumeInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // Specifies whether the volume should be encrypted. Encrypted Amazon EBS volumes - // may only be attached to instances that support Amazon EBS encryption. Volumes - // that are created from encrypted snapshots are automatically encrypted. There - // is no way to create an encrypted volume from an unencrypted snapshot or vice - // versa. If your AMI uses encrypted volumes, you can only launch it on supported - // instance types. For more information, see Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) + // Specifies whether the volume should be encrypted. The effect of setting the + // encryption state to true depends on the volume origin (new or from a snapshot), + // starting encryption state, ownership, and whether encryption by default is + // enabled. For more information, see Encryption by Default (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default) // in the Amazon Elastic Compute Cloud User Guide. + // + // Encrypted Amazon EBS volumes must be attached to instances that support Amazon + // EBS encryption. For more information, see Supported Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances). Encrypted *bool `locationName:"encrypted" type:"boolean"` // The number of I/O operations per second (IOPS) to provision for the volume, // with a maximum ratio of 50 IOPS/GiB. Range is 100 to 64,000 IOPS for volumes - // in most regions. Maximum IOPS of 64,000 is guaranteed only on Nitro-based - // instances (AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances). + // in most Regions. Maximum IOPS of 64,000 is guaranteed only on Nitro-based + // instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances). // Other instance families guarantee performance up to 32,000 IOPS. For more - // information, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // information, see Amazon EBS Volume Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) // in the Amazon Elastic Compute Cloud User Guide. // // This parameter is valid only for Provisioned IOPS SSD (io1) volumes. Iops *int64 `type:"integer"` - // An identifier for the AWS Key Management Service (AWS KMS) customer master - // key (CMK) to use when creating the encrypted volume. This parameter is only - // required if you want to use a non-default CMK; if this parameter is not specified, - // the default CMK for EBS is used. If a KmsKeyId is specified, the Encrypted - // flag must also be set. + // The identifier of the AWS Key Management Service (AWS KMS) customer master + // key (CMK) to use for Amazon EBS encryption. If this parameter is not specified, + // your AWS managed CMK for EBS is used. If KmsKeyId is specified, the encrypted + // state must be true. // - // The CMK identifier may be provided in any of the following formats: + // You can specify the CMK using any of the following: // - // * Key ID + // * Key ID. For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. // - // * Key alias + // * Key alias. For example, alias/ExampleAlias. // - // * ARN using key ID. The ID ARN contains the arn:aws:kms namespace, followed - // by the region of the CMK, the AWS account ID of the CMK owner, the key - // namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. + // * Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. // + // * Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. // - // * ARN using key alias. The alias ARN contains the arn:aws:kms namespace, - // followed by the region of the CMK, the AWS account ID of the CMK owner, - // the alias namespace, and then the CMK alias. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. - // - // - // AWS parses KmsKeyId asynchronously, meaning that the action you call may - // appear to complete even though you provided an invalid identifier. The action - // will eventually fail. + // AWS authenticates the CMK asynchronously. Therefore, if you specify an ID, + // alias, or ARN that is not valid, the action can appear to complete, but eventually + // fails. KmsKeyId *string `type:"string"` // The size of the volume, in GiBs. @@ -37833,9 +43591,13 @@ type CreateVolumeInput struct { // // Default: If you're creating the volume from a snapshot and don't specify // a volume size, the default is the snapshot size. + // + // At least one of Size or SnapshotId is required. Size *int64 `type:"integer"` // The snapshot from which to create the volume. + // + // At least one of Size or SnapshotId are required. SnapshotId *string `type:"string"` // The tags to apply to the volume during creation. @@ -37848,7 +43610,7 @@ type CreateVolumeInput struct { // Defaults: If no volume type is specified, the default is standard in us-east-1, // eu-west-1, eu-central-1, us-west-2, us-west-1, sa-east-1, ap-northeast-1, // ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, us-gov-west-1, - // and cn-north-1. In all other regions, EBS defaults to gp2. + // and cn-north-1. In all other Regions, EBS defaults to gp2. VolumeType *string `type:"string" enum:"VolumeType"` } @@ -37929,17 +43691,15 @@ func (s *CreateVolumeInput) SetVolumeType(v string) *CreateVolumeInput { return s } -// Describes the user or group to be added or removed from the permissions for -// a volume. +// Describes the user or group to be added or removed from the list of create +// volume permissions for a volume. type CreateVolumePermission struct { _ struct{} `type:"structure"` - // The specific group that is to be added or removed from a volume's list of - // create volume permissions. + // The group to be added or removed. The possible value is all. Group *string `locationName:"group" type:"string" enum:"PermissionGroup"` - // The specific AWS account ID that is to be added or removed from a volume's - // list of create volume permissions. + // The AWS account ID to be added or removed. UserId *string `locationName:"userId" type:"string"` } @@ -37965,16 +43725,14 @@ func (s *CreateVolumePermission) SetUserId(v string) *CreateVolumePermission { return s } -// Describes modifications to the permissions for a volume. +// Describes modifications to the list of create volume permissions for a volume. type CreateVolumePermissionModifications struct { _ struct{} `type:"structure"` - // Adds a specific AWS account ID or group to a volume's list of create volume - // permissions. + // Adds the specified AWS account ID or group to the list. Add []*CreateVolumePermission `locationNameList:"item" type:"list"` - // Removes a specific AWS account ID or group from a volume's list of create - // volume permissions. + // Removes the specified AWS account ID or group from the list. Remove []*CreateVolumePermission `locationNameList:"item" type:"list"` } @@ -38004,7 +43762,7 @@ type CreateVpcEndpointConnectionNotificationInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // One or more endpoint events for which to receive notifications. Valid values @@ -38131,7 +43889,7 @@ type CreateVpcEndpointInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -38140,15 +43898,14 @@ type CreateVpcEndpointInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // (Gateway endpoint) A policy to attach to the endpoint that controls access - // to the service. The policy must be in valid JSON format. If this parameter - // is not specified, we attach a default policy that allows full access to the - // service. + // A policy to attach to the endpoint that controls access to the service. The + // policy must be in valid JSON format. If this parameter is not specified, + // we attach a default policy that allows full access to the service. PolicyDocument *string `type:"string"` // (Interface endpoint) Indicate whether to associate a private hosted zone // with the specified VPC. The private hosted zone contains a record set for - // the default public DNS name for the service for the region (for example, + // the default public DNS name for the service for the Region (for example, // kinesis.us-east-1.amazonaws.com) which resolves to the private IP addresses // of the endpoint network interfaces in the VPC. This enables you to make requests // to the default public DNS name for the service instead of the public DNS @@ -38158,7 +43915,7 @@ type CreateVpcEndpointInput struct { // true: enableDnsHostnames and enableDnsSupport. Use ModifyVpcAttribute to // set the VPC attributes. // - // Default: false + // Default: true PrivateDnsEnabled *bool `type:"boolean"` // (Gateway endpoint) One or more route table IDs. @@ -38317,7 +44074,7 @@ type CreateVpcEndpointServiceConfigurationInput struct { AcceptanceRequired *bool `type:"boolean"` // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + // the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -38529,10 +44286,10 @@ type CreateVpcPeeringConnectionInput struct { // Default: Your AWS account ID PeerOwnerId *string `locationName:"peerOwnerId" type:"string"` - // The region code for the accepter VPC, if the accepter VPC is located in a - // region other than the region in which you make the request. + // The Region code for the accepter VPC, if the accepter VPC is located in a + // Region other than the Region in which you make the request. // - // Default: The region in which you make the request. + // Default: The Region in which you make the request. PeerRegion *string `type:"string"` // The ID of the VPC with which you are creating the VPC peering connection. @@ -39611,6 +45368,8 @@ type DeleteFlowLogsInput struct { // One or more flow log IDs. // + // Constraint: Maximum of 1000 flow log IDs. + // // FlowLogIds is a required field FlowLogIds []*string `locationName:"FlowLogId" locationNameList:"item" type:"list" required:"true"` } @@ -40971,7 +46730,7 @@ type DeleteTagsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // The IDs of one or more resources, separated by spaces. + // The IDs of the resources, separated by spaces. // // Constraints: Up to 1000 resource IDs. We recommend breaking up this request // into smaller batches. @@ -40979,9 +46738,9 @@ type DeleteTagsInput struct { // Resources is a required field Resources []*string `locationName:"resourceId" type:"list" required:"true"` - // One or more tags to delete. Specify a tag key and an optional tag value to - // delete specific tags. If you specify a tag key without a tag value, we delete - // any tag with this key regardless of its value. If you specify a tag key with + // The tags to delete. Specify a tag key and an optional tag value to delete + // specific tags. If you specify a tag key without a tag value, we delete any + // tag with this key regardless of its value. If you specify a tag key with // an empty string as the tag value, we delete the tag only if its value is // an empty string. // @@ -41045,6 +46804,298 @@ func (s DeleteTagsOutput) GoString() string { return s.String() } +type DeleteTrafficMirrorFilterInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The ID of the Traffic Mirror filter. + // + // TrafficMirrorFilterId is a required field + TrafficMirrorFilterId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteTrafficMirrorFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteTrafficMirrorFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteTrafficMirrorFilterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteTrafficMirrorFilterInput"} + if s.TrafficMirrorFilterId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorFilterId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *DeleteTrafficMirrorFilterInput) SetDryRun(v bool) *DeleteTrafficMirrorFilterInput { + s.DryRun = &v + return s +} + +// SetTrafficMirrorFilterId sets the TrafficMirrorFilterId field's value. +func (s *DeleteTrafficMirrorFilterInput) SetTrafficMirrorFilterId(v string) *DeleteTrafficMirrorFilterInput { + s.TrafficMirrorFilterId = &v + return s +} + +type DeleteTrafficMirrorFilterOutput struct { + _ struct{} `type:"structure"` + + // The ID of the Traffic Mirror filter. + TrafficMirrorFilterId *string `locationName:"trafficMirrorFilterId" type:"string"` +} + +// String returns the string representation +func (s DeleteTrafficMirrorFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteTrafficMirrorFilterOutput) GoString() string { + return s.String() +} + +// SetTrafficMirrorFilterId sets the TrafficMirrorFilterId field's value. +func (s *DeleteTrafficMirrorFilterOutput) SetTrafficMirrorFilterId(v string) *DeleteTrafficMirrorFilterOutput { + s.TrafficMirrorFilterId = &v + return s +} + +type DeleteTrafficMirrorFilterRuleInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The ID of the Traffic Mirror rule. + // + // TrafficMirrorFilterRuleId is a required field + TrafficMirrorFilterRuleId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteTrafficMirrorFilterRuleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteTrafficMirrorFilterRuleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteTrafficMirrorFilterRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteTrafficMirrorFilterRuleInput"} + if s.TrafficMirrorFilterRuleId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorFilterRuleId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *DeleteTrafficMirrorFilterRuleInput) SetDryRun(v bool) *DeleteTrafficMirrorFilterRuleInput { + s.DryRun = &v + return s +} + +// SetTrafficMirrorFilterRuleId sets the TrafficMirrorFilterRuleId field's value. +func (s *DeleteTrafficMirrorFilterRuleInput) SetTrafficMirrorFilterRuleId(v string) *DeleteTrafficMirrorFilterRuleInput { + s.TrafficMirrorFilterRuleId = &v + return s +} + +type DeleteTrafficMirrorFilterRuleOutput struct { + _ struct{} `type:"structure"` + + // The ID of the deleted Traffic Mirror rule. + TrafficMirrorFilterRuleId *string `locationName:"trafficMirrorFilterRuleId" type:"string"` +} + +// String returns the string representation +func (s DeleteTrafficMirrorFilterRuleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteTrafficMirrorFilterRuleOutput) GoString() string { + return s.String() +} + +// SetTrafficMirrorFilterRuleId sets the TrafficMirrorFilterRuleId field's value. +func (s *DeleteTrafficMirrorFilterRuleOutput) SetTrafficMirrorFilterRuleId(v string) *DeleteTrafficMirrorFilterRuleOutput { + s.TrafficMirrorFilterRuleId = &v + return s +} + +type DeleteTrafficMirrorSessionInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The ID of the Traffic Mirror session. + // + // TrafficMirrorSessionId is a required field + TrafficMirrorSessionId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteTrafficMirrorSessionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteTrafficMirrorSessionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteTrafficMirrorSessionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteTrafficMirrorSessionInput"} + if s.TrafficMirrorSessionId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorSessionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *DeleteTrafficMirrorSessionInput) SetDryRun(v bool) *DeleteTrafficMirrorSessionInput { + s.DryRun = &v + return s +} + +// SetTrafficMirrorSessionId sets the TrafficMirrorSessionId field's value. +func (s *DeleteTrafficMirrorSessionInput) SetTrafficMirrorSessionId(v string) *DeleteTrafficMirrorSessionInput { + s.TrafficMirrorSessionId = &v + return s +} + +type DeleteTrafficMirrorSessionOutput struct { + _ struct{} `type:"structure"` + + // The ID of the deleted Traffic Mirror session. + TrafficMirrorSessionId *string `locationName:"trafficMirrorSessionId" type:"string"` +} + +// String returns the string representation +func (s DeleteTrafficMirrorSessionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteTrafficMirrorSessionOutput) GoString() string { + return s.String() +} + +// SetTrafficMirrorSessionId sets the TrafficMirrorSessionId field's value. +func (s *DeleteTrafficMirrorSessionOutput) SetTrafficMirrorSessionId(v string) *DeleteTrafficMirrorSessionOutput { + s.TrafficMirrorSessionId = &v + return s +} + +type DeleteTrafficMirrorTargetInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The ID of the Traffic Mirror target. + // + // TrafficMirrorTargetId is a required field + TrafficMirrorTargetId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteTrafficMirrorTargetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteTrafficMirrorTargetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteTrafficMirrorTargetInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteTrafficMirrorTargetInput"} + if s.TrafficMirrorTargetId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorTargetId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *DeleteTrafficMirrorTargetInput) SetDryRun(v bool) *DeleteTrafficMirrorTargetInput { + s.DryRun = &v + return s +} + +// SetTrafficMirrorTargetId sets the TrafficMirrorTargetId field's value. +func (s *DeleteTrafficMirrorTargetInput) SetTrafficMirrorTargetId(v string) *DeleteTrafficMirrorTargetInput { + s.TrafficMirrorTargetId = &v + return s +} + +type DeleteTrafficMirrorTargetOutput struct { + _ struct{} `type:"structure"` + + // The ID of the deleted Traffic Mirror target. + TrafficMirrorTargetId *string `locationName:"trafficMirrorTargetId" type:"string"` +} + +// String returns the string representation +func (s DeleteTrafficMirrorTargetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteTrafficMirrorTargetOutput) GoString() string { + return s.String() +} + +// SetTrafficMirrorTargetId sets the TrafficMirrorTargetId field's value. +func (s *DeleteTrafficMirrorTargetOutput) SetTrafficMirrorTargetId(v string) *DeleteTrafficMirrorTargetOutput { + s.TrafficMirrorTargetId = &v + return s +} + type DeleteTransitGatewayInput struct { _ struct{} `type:"structure"` @@ -42113,7 +48164,7 @@ func (s DeregisterImageOutput) GoString() string { type DescribeAccountAttributesInput struct { _ struct{} `type:"structure"` - // One or more account attribute names. + // The account attribute names. AttributeNames []*string `locationName:"attributeName" locationNameList:"attributeName" type:"list"` // Checks whether you have the required permissions for the action, without @@ -42148,7 +48199,7 @@ func (s *DescribeAccountAttributesInput) SetDryRun(v bool) *DescribeAccountAttri type DescribeAccountAttributesOutput struct { _ struct{} `type:"structure"` - // Information about one or more account attributes. + // Information about the account attributes. AccountAttributes []*AccountAttribute `locationName:"accountAttributeSet" locationNameList:"item" type:"list"` } @@ -42171,9 +48222,7 @@ func (s *DescribeAccountAttributesOutput) SetAccountAttributes(v []*AccountAttri type DescribeAddressesInput struct { _ struct{} `type:"structure"` - // [EC2-VPC] One or more allocation IDs. - // - // Default: Describes all your Elastic IP addresses. + // [EC2-VPC] Information about the allocation IDs. AllocationIds []*string `locationName:"AllocationId" locationNameList:"AllocationId" type:"list"` // Checks whether you have the required permissions for the action, without @@ -42215,7 +48264,7 @@ type DescribeAddressesInput struct { // the tag value. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // [EC2-Classic] One or more Elastic IP addresses. + // One or more Elastic IP addresses. // // Default: Describes all your Elastic IP addresses. PublicIps []*string `locationName:"PublicIp" locationNameList:"PublicIp" type:"list"` @@ -42258,7 +48307,7 @@ func (s *DescribeAddressesInput) SetPublicIps(v []*string) *DescribeAddressesInp type DescribeAddressesOutput struct { _ struct{} `type:"structure"` - // Information about one or more Elastic IP addresses. + // Information about the Elastic IP addresses. Addresses []*Address `locationName:"addressesSet" locationNameList:"item" type:"list"` } @@ -42310,9 +48359,9 @@ type DescribeAggregateIdFormatOutput struct { // Information about each resource's ID format. Statuses []*IdFormat `locationName:"statusSet" locationNameList:"item" type:"list"` - // Indicates whether all resource types in the region are configured to use + // Indicates whether all resource types in the Region are configured to use // longer IDs. This value is only true if all users are configured to use longer - // IDs for all resources types in the region. + // IDs for all resources types in the Region. UseLongIdsAggregated *bool `locationName:"useLongIdsAggregated" type:"boolean"` } @@ -42347,11 +48396,11 @@ type DescribeAvailabilityZonesInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * message - Information about the Availability Zone. // - // * region-name - The name of the region for the Availability Zone (for + // * region-name - The name of the Region for the Availability Zone (for // example, us-east-1). // // * state - The state of the Availability Zone (available | information @@ -42362,10 +48411,10 @@ type DescribeAvailabilityZonesInput struct { // * zone-name - The name of the Availability Zone (for example, us-east-1a). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // The IDs of one or more Availability Zones. + // The IDs of the Availability Zones. ZoneIds []*string `locationName:"ZoneId" locationNameList:"ZoneId" type:"list"` - // The names of one or more Availability Zones. + // The names of the Availability Zones. ZoneNames []*string `locationName:"ZoneName" locationNameList:"ZoneName" type:"list"` } @@ -42406,7 +48455,7 @@ func (s *DescribeAvailabilityZonesInput) SetZoneNames(v []*string) *DescribeAvai type DescribeAvailabilityZonesOutput struct { _ struct{} `type:"structure"` - // Information about one or more Availability Zones. + // Information about the Availability Zones. AvailabilityZones []*AvailabilityZone `locationName:"availabilityZoneInfo" locationNameList:"item" type:"list"` } @@ -42426,11 +48475,10 @@ func (s *DescribeAvailabilityZonesOutput) SetAvailabilityZones(v []*Availability return s } -// Contains the parameters for DescribeBundleTasks. type DescribeBundleTasksInput struct { _ struct{} `type:"structure"` - // One or more bundle task IDs. + // The bundle task IDs. // // Default: Describes all your bundle tasks. BundleIds []*string `locationName:"BundleId" locationNameList:"BundleId" type:"list"` @@ -42441,7 +48489,7 @@ type DescribeBundleTasksInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * bundle-id - The ID of the bundle task. // @@ -42495,11 +48543,10 @@ func (s *DescribeBundleTasksInput) SetFilters(v []*Filter) *DescribeBundleTasksI return s } -// Contains the output of DescribeBundleTasks. type DescribeBundleTasksOutput struct { _ struct{} `type:"structure"` - // Information about one or more bundle tasks. + // Information about the bundle tasks. BundleTasks []*BundleTask `locationName:"bundleInstanceTasksSet" locationNameList:"item" type:"list"` } @@ -42532,10 +48579,10 @@ type DescribeByoipCidrsInput struct { // remaining results, make another call with the returned nextToken value. // // MaxResults is a required field - MaxResults *int64 `min:"5" type:"integer" required:"true"` + MaxResults *int64 `min:"1" type:"integer" required:"true"` // The token for the next page of results. - NextToken *string `min:"1" type:"string"` + NextToken *string `type:"string"` } // String returns the string representation @@ -42554,11 +48601,8 @@ func (s *DescribeByoipCidrsInput) Validate() error { if s.MaxResults == nil { invalidParams.Add(request.NewErrParamRequired("MaxResults")) } - if s.MaxResults != nil && *s.MaxResults < 5 { - invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) - } - if s.NextToken != nil && len(*s.NextToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) } if invalidParams.Len() > 0 { @@ -42636,7 +48680,7 @@ type DescribeCapacityReservationsInput struct { // The maximum number of results to return for the request in a single page. // The remaining results can be seen by sending another request with the returned // nextToken value. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"1" type:"integer"` // The token to retrieve the next page of results. NextToken *string `type:"string"` @@ -42652,6 +48696,19 @@ func (s DescribeCapacityReservationsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeCapacityReservationsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeCapacityReservationsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetCapacityReservationIds sets the CapacityReservationIds field's value. func (s *DescribeCapacityReservationsInput) SetCapacityReservationIds(v []*string) *DescribeCapacityReservationsInput { s.CapacityReservationIds = v @@ -42741,25 +48798,20 @@ type DescribeClassicLinkInstancesInput struct { // to find all resources assigned a tag with a specific key, regardless of // the tag value. // - // * vpc-id - The ID of the VPC to which the instance is linked. - // - // vpc-id - The ID of the VPC that the instance is linked to. + // * vpc-id - The ID of the VPC to which the instance is linked. vpc-id - + // The ID of the VPC that the instance is linked to. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // One or more instance IDs. Must be instances linked to a VPC through ClassicLink. InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` - // The maximum number of results to return for the request in a single page. - // The remaining results of the initial request can be seen by sending another - // request with the returned NextToken value. This value can be between 5 and - // 1000. If MaxResults is given a value larger than 1000, only 1000 results - // are returned. You cannot specify this parameter and the instance IDs parameter - // in the same request. + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. // // Constraint: If the value is greater than 1000, we return only 1000 items. - MaxResults *int64 `locationName:"maxResults" type:"integer"` + MaxResults *int64 `locationName:"maxResults" min:"5" type:"integer"` - // The token to retrieve the next page of results. + // The token for the next page of results. NextToken *string `locationName:"nextToken" type:"string"` } @@ -42773,6 +48825,19 @@ func (s DescribeClassicLinkInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeClassicLinkInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeClassicLinkInstancesInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeClassicLinkInstancesInput) SetDryRun(v bool) *DescribeClassicLinkInstancesInput { s.DryRun = &v @@ -42859,7 +48924,7 @@ type DescribeClientVpnAuthorizationRulesInput struct { MaxResults *int64 `min:"5" type:"integer"` // The token to retrieve the next page of results. - NextToken *string `min:"1" type:"string"` + NextToken *string `type:"string"` } // String returns the string representation @@ -42881,9 +48946,6 @@ func (s *DescribeClientVpnAuthorizationRulesInput) Validate() error { if s.MaxResults != nil && *s.MaxResults < 5 { invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) } - if s.NextToken != nil && len(*s.NextToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -42929,7 +48991,7 @@ type DescribeClientVpnAuthorizationRulesOutput struct { // The token to use to retrieve the next page of results. This value is null // when there are no more results to return. - NextToken *string `locationName:"nextToken" min:"1" type:"string"` + NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation @@ -42977,7 +49039,7 @@ type DescribeClientVpnConnectionsInput struct { MaxResults *int64 `min:"5" type:"integer"` // The token to retrieve the next page of results. - NextToken *string `min:"1" type:"string"` + NextToken *string `type:"string"` } // String returns the string representation @@ -42999,9 +49061,6 @@ func (s *DescribeClientVpnConnectionsInput) Validate() error { if s.MaxResults != nil && *s.MaxResults < 5 { invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) } - if s.NextToken != nil && len(*s.NextToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -43047,7 +49106,7 @@ type DescribeClientVpnConnectionsOutput struct { // The token to use to retrieve the next page of results. This value is null // when there are no more results to return. - NextToken *string `locationName:"nextToken" min:"1" type:"string"` + NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation @@ -43093,7 +49152,7 @@ type DescribeClientVpnEndpointsInput struct { MaxResults *int64 `min:"5" type:"integer"` // The token to retrieve the next page of results. - NextToken *string `min:"1" type:"string"` + NextToken *string `type:"string"` } // String returns the string representation @@ -43112,9 +49171,6 @@ func (s *DescribeClientVpnEndpointsInput) Validate() error { if s.MaxResults != nil && *s.MaxResults < 5 { invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) } - if s.NextToken != nil && len(*s.NextToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -43160,7 +49216,7 @@ type DescribeClientVpnEndpointsOutput struct { // The token to use to retrieve the next page of results. This value is null // when there are no more results to return. - NextToken *string `locationName:"nextToken" min:"1" type:"string"` + NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation @@ -43208,7 +49264,7 @@ type DescribeClientVpnRoutesInput struct { MaxResults *int64 `min:"5" type:"integer"` // The token to retrieve the next page of results. - NextToken *string `min:"1" type:"string"` + NextToken *string `type:"string"` } // String returns the string representation @@ -43230,9 +49286,6 @@ func (s *DescribeClientVpnRoutesInput) Validate() error { if s.MaxResults != nil && *s.MaxResults < 5 { invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) } - if s.NextToken != nil && len(*s.NextToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -43275,7 +49328,7 @@ type DescribeClientVpnRoutesOutput struct { // The token to use to retrieve the next page of results. This value is null // when there are no more results to return. - NextToken *string `locationName:"nextToken" min:"1" type:"string"` + NextToken *string `locationName:"nextToken" type:"string"` // Information about the Client VPN endpoint routes. Routes []*ClientVpnRoute `locationName:"routes" locationNameList:"item" type:"list"` @@ -43329,7 +49382,7 @@ type DescribeClientVpnTargetNetworksInput struct { MaxResults *int64 `min:"5" type:"integer"` // The token to retrieve the next page of results. - NextToken *string `min:"1" type:"string"` + NextToken *string `type:"string"` } // String returns the string representation @@ -43351,9 +49404,6 @@ func (s *DescribeClientVpnTargetNetworksInput) Validate() error { if s.MaxResults != nil && *s.MaxResults < 5 { invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) } - if s.NextToken != nil && len(*s.NextToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -43405,7 +49455,7 @@ type DescribeClientVpnTargetNetworksOutput struct { // The token to use to retrieve the next page of results. This value is null // when there are no more results to return. - NextToken *string `locationName:"nextToken" min:"1" type:"string"` + NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation @@ -43430,11 +49480,10 @@ func (s *DescribeClientVpnTargetNetworksOutput) SetNextToken(v string) *Describe return s } -// Contains the parameters for DescribeConversionTasks. type DescribeConversionTasksInput struct { _ struct{} `type:"structure"` - // One or more conversion task IDs. + // The conversion task IDs. ConversionTaskIds []*string `locationName:"conversionTaskId" locationNameList:"item" type:"list"` // Checks whether you have the required permissions for the action, without @@ -43466,7 +49515,6 @@ func (s *DescribeConversionTasksInput) SetDryRun(v bool) *DescribeConversionTask return s } -// Contains the output for DescribeConversionTasks. type DescribeConversionTasksOutput struct { _ struct{} `type:"structure"` @@ -43619,6 +49667,13 @@ type DescribeDhcpOptionsInput struct { // to find all resources assigned a tag with a specific key, regardless of // the tag value. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next page of results. + NextToken *string `type:"string"` } // String returns the string representation @@ -43631,6 +49686,19 @@ func (s DescribeDhcpOptionsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeDhcpOptionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeDhcpOptionsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDhcpOptionsIds sets the DhcpOptionsIds field's value. func (s *DescribeDhcpOptionsInput) SetDhcpOptionsIds(v []*string) *DescribeDhcpOptionsInput { s.DhcpOptionsIds = v @@ -43649,11 +49717,27 @@ func (s *DescribeDhcpOptionsInput) SetFilters(v []*Filter) *DescribeDhcpOptionsI return s } +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeDhcpOptionsInput) SetMaxResults(v int64) *DescribeDhcpOptionsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeDhcpOptionsInput) SetNextToken(v string) *DescribeDhcpOptionsInput { + s.NextToken = &v + return s +} + type DescribeDhcpOptionsOutput struct { _ struct{} `type:"structure"` // Information about one or more DHCP options sets. DhcpOptions []*DhcpOptions `locationName:"dhcpOptionsSet" locationNameList:"item" type:"list"` + + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation @@ -43672,6 +49756,12 @@ func (s *DescribeDhcpOptionsOutput) SetDhcpOptions(v []*DhcpOptions) *DescribeDh return s } +// SetNextToken sets the NextToken field's value. +func (s *DescribeDhcpOptionsOutput) SetNextToken(v string) *DescribeDhcpOptionsOutput { + s.NextToken = &v + return s +} + type DescribeEgressOnlyInternetGatewaysInput struct { _ struct{} `type:"structure"` @@ -43684,13 +49774,11 @@ type DescribeEgressOnlyInternetGatewaysInput struct { // One or more egress-only internet gateway IDs. EgressOnlyInternetGatewayIds []*string `locationName:"EgressOnlyInternetGatewayId" locationNameList:"item" type:"list"` - // The maximum number of results to return for the request in a single page. - // The remaining results can be seen by sending another request with the returned - // NextToken value. This value can be between 5 and 1000. If MaxResults is given - // a value larger than 1000, only 1000 results are returned. - MaxResults *int64 `type:"integer"` + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` - // The token to retrieve the next page of results. + // The token for the next page of results. NextToken *string `type:"string"` } @@ -43704,6 +49792,19 @@ func (s DescribeEgressOnlyInternetGatewaysInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeEgressOnlyInternetGatewaysInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeEgressOnlyInternetGatewaysInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeEgressOnlyInternetGatewaysInput) SetDryRun(v bool) *DescribeEgressOnlyInternetGatewaysInput { s.DryRun = &v @@ -43734,7 +49835,8 @@ type DescribeEgressOnlyInternetGatewaysOutput struct { // Information about the egress-only internet gateways. EgressOnlyInternetGateways []*EgressOnlyInternetGateway `locationName:"egressOnlyInternetGatewaySet" locationNameList:"item" type:"list"` - // The token to use to retrieve the next page of results. + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. NextToken *string `locationName:"nextToken" type:"string"` } @@ -43769,10 +49871,10 @@ type DescribeElasticGpusInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more Elastic Graphics accelerator IDs. + // The Elastic Graphics accelerator IDs. ElasticGpuIds []*string `locationName:"ElasticGpuId" locationNameList:"item" type:"list"` - // One or more filters. + // The filters. // // * availability-zone - The Availability Zone in which the Elastic Graphics // accelerator resides. @@ -43792,7 +49894,7 @@ type DescribeElasticGpusInput struct { // The maximum number of results to return in a single call. To retrieve the // remaining results, make another call with the returned NextToken value. This // value can be between 5 and 1000. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"10" type:"integer"` // The token to request the next page of results. NextToken *string `type:"string"` @@ -43808,6 +49910,19 @@ func (s DescribeElasticGpusInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeElasticGpusInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeElasticGpusInput"} + if s.MaxResults != nil && *s.MaxResults < 10 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 10)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeElasticGpusInput) SetDryRun(v bool) *DescribeElasticGpusInput { s.DryRun = &v @@ -43882,11 +49997,10 @@ func (s *DescribeElasticGpusOutput) SetNextToken(v string) *DescribeElasticGpusO return s } -// Contains the parameters for DescribeExportTasks. type DescribeExportTasksInput struct { _ struct{} `type:"structure"` - // One or more export task IDs. + // The export task IDs. ExportTaskIds []*string `locationName:"exportTaskId" locationNameList:"ExportTaskId" type:"list"` } @@ -43906,7 +50020,6 @@ func (s *DescribeExportTasksInput) SetExportTaskIds(v []*string) *DescribeExport return s } -// Contains the output for DescribeExportTasks. type DescribeExportTasksOutput struct { _ struct{} `type:"structure"` @@ -43935,11 +50048,11 @@ type DescribeFleetError struct { _ struct{} `type:"structure"` // The error code that indicates why the instance could not be launched. For - // more information about error codes, see Error Codes (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html). + // more information about error codes, see Error Codes (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html). ErrorCode *string `locationName:"errorCode" type:"string"` // The error message that describes why the instance could not be launched. - // For more information about error messages, see ee Error Codes (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html). + // For more information about error messages, see ee Error Codes (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html). ErrorMessage *string `locationName:"errorMessage" type:"string"` // The launch templates and overrides that were used for launching the instances. @@ -44150,7 +50263,7 @@ type DescribeFleetInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more filters. + // The filters. // // * instance-type - The instance type. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -44273,7 +50386,7 @@ type DescribeFleetsInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more filters. + // The filters. // // * activity-status - The progress of the EC2 Fleet ( error | pending-fulfillment // | pending-termination | fulfilled). @@ -44465,16 +50578,15 @@ type DescribeFlowLogsInput struct { Filter []*Filter `locationNameList:"Filter" type:"list"` // One or more flow log IDs. + // + // Constraint: Maximum of 1000 flow log IDs. FlowLogIds []*string `locationName:"FlowLogId" locationNameList:"item" type:"list"` - // The maximum number of results to return for the request in a single page. - // The remaining results can be seen by sending another request with the returned - // NextToken value. This value can be between 5 and 1000. If MaxResults is given - // a value larger than 1000, only 1000 results are returned. You cannot specify - // this parameter and the flow log IDs parameter in the same request. + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. MaxResults *int64 `type:"integer"` - // The token to retrieve the next page of results. + // The token for the next page of results. NextToken *string `type:"string"` } @@ -44647,7 +50759,7 @@ type DescribeFpgaImagesInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more filters. + // The filters. // // * create-time - The creation time of the AFI. // @@ -44679,14 +50791,14 @@ type DescribeFpgaImagesInput struct { // * update-time - The time of the most recent update. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // One or more AFI IDs. + // The AFI IDs. FpgaImageIds []*string `locationName:"FpgaImageId" locationNameList:"item" type:"list"` // The maximum number of results to return in a single call. MaxResults *int64 `min:"5" type:"integer"` // The token to retrieve the next page of results. - NextToken *string `min:"1" type:"string"` + NextToken *string `type:"string"` // Filters the AFI by owner. Specify an AWS account ID, self (owner is the sender // of the request), or an AWS owner alias (valid values are amazon | aws-marketplace). @@ -44709,9 +50821,6 @@ func (s *DescribeFpgaImagesInput) Validate() error { if s.MaxResults != nil && *s.MaxResults < 5 { invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) } - if s.NextToken != nil && len(*s.NextToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -44758,12 +50867,12 @@ func (s *DescribeFpgaImagesInput) SetOwners(v []*string) *DescribeFpgaImagesInpu type DescribeFpgaImagesOutput struct { _ struct{} `type:"structure"` - // Information about one or more FPGA images. + // Information about the FPGA images. FpgaImages []*FpgaImage `locationName:"fpgaImageSet" locationNameList:"item" type:"list"` // The token to use to retrieve the next page of results. This value is null // when there are no more results to return. - NextToken *string `locationName:"nextToken" min:"1" type:"string"` + NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation @@ -44791,7 +50900,7 @@ func (s *DescribeFpgaImagesOutput) SetNextToken(v string) *DescribeFpgaImagesOut type DescribeHostReservationOfferingsInput struct { _ struct{} `type:"structure"` - // One or more filters. + // The filters. // // * instance-family - The instance family of the offering (for example, // m4). @@ -44810,7 +50919,7 @@ type DescribeHostReservationOfferingsInput struct { // The remaining results can be seen by sending another request with the returned // nextToken value. This value can be between 5 and 500. If maxResults is given // a larger value than 500, you receive an error. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"5" type:"integer"` // This is the minimum duration of the reservation you'd like to purchase, specified // in seconds. Reservations are available in one-year and three-year terms. @@ -44836,6 +50945,19 @@ func (s DescribeHostReservationOfferingsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeHostReservationOfferingsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeHostReservationOfferingsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetFilter sets the Filter field's value. func (s *DescribeHostReservationOfferingsInput) SetFilter(v []*Filter) *DescribeHostReservationOfferingsInput { s.Filter = v @@ -44908,7 +51030,7 @@ func (s *DescribeHostReservationOfferingsOutput) SetOfferingSet(v []*HostOfferin type DescribeHostReservationsInput struct { _ struct{} `type:"structure"` - // One or more filters. + // The filters. // // * instance-family - The instance family (for example, m4). // @@ -44916,9 +51038,19 @@ type DescribeHostReservationsInput struct { // // * state - The state of the reservation (payment-pending | payment-failed // | active | retired). + // + // * tag: - The key/value combination of a tag assigned to the resource. + // Use the tag key in the filter name and the tag value as the filter value. + // For example, to find all resources that have a tag with the key Owner + // and the value TeamA, specify tag:Owner for the filter name and TeamA for + // the filter value. + // + // * tag-key - The key of a tag assigned to the resource. Use this filter + // to find all resources assigned a tag with a specific key, regardless of + // the tag value. Filter []*Filter `locationNameList:"Filter" type:"list"` - // One or more host reservation IDs. + // The host reservation IDs. HostReservationIdSet []*string `locationNameList:"item" type:"list"` // The maximum number of results to return for the request in a single page. @@ -45001,7 +51133,7 @@ func (s *DescribeHostReservationsOutput) SetNextToken(v string) *DescribeHostRes type DescribeHostsInput struct { _ struct{} `type:"structure"` - // One or more filters. + // The filters. // // * auto-placement - Whether auto-placement is enabled or disabled (on | // off). @@ -45030,11 +51162,13 @@ type DescribeHostsInput struct { // The maximum number of results to return for the request in a single page. // The remaining results can be seen by sending another request with the returned // nextToken value. This value can be between 5 and 500. If maxResults is given - // a larger value than 500, you receive an error. You cannot specify this parameter - // and the host IDs parameter in the same request. + // a larger value than 500, you receive an error. + // + // You cannot specify this parameter and the host IDs parameter in the same + // request. MaxResults *int64 `locationName:"maxResults" type:"integer"` - // The token to retrieve the next page of results. + // The token to use to retrieve the next page of results. NextToken *string `locationName:"nextToken" type:"string"` } @@ -45108,10 +51242,10 @@ func (s *DescribeHostsOutput) SetNextToken(v string) *DescribeHostsOutput { type DescribeIamInstanceProfileAssociationsInput struct { _ struct{} `type:"structure"` - // One or more IAM instance profile associations. + // The IAM instance profile associations. AssociationIds []*string `locationName:"AssociationId" locationNameList:"AssociationId" type:"list"` - // One or more filters. + // The filters. // // * instance-id - The ID of the instance. // @@ -45124,7 +51258,7 @@ type DescribeIamInstanceProfileAssociationsInput struct { MaxResults *int64 `min:"5" type:"integer"` // The token to request the next page of results. - NextToken *string `min:"1" type:"string"` + NextToken *string `type:"string"` } // String returns the string representation @@ -45143,9 +51277,6 @@ func (s *DescribeIamInstanceProfileAssociationsInput) Validate() error { if s.MaxResults != nil && *s.MaxResults < 5 { invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) } - if s.NextToken != nil && len(*s.NextToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -45180,12 +51311,12 @@ func (s *DescribeIamInstanceProfileAssociationsInput) SetNextToken(v string) *De type DescribeIamInstanceProfileAssociationsOutput struct { _ struct{} `type:"structure"` - // Information about one or more IAM instance profile associations. + // Information about the IAM instance profile associations. IamInstanceProfileAssociations []*IamInstanceProfileAssociation `locationName:"iamInstanceProfileAssociationSet" locationNameList:"item" type:"list"` // The token to use to retrieve the next page of results. This value is null // when there are no more results to return. - NextToken *string `locationName:"nextToken" min:"1" type:"string"` + NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation @@ -45412,7 +51543,7 @@ func (s *DescribeImageAttributeInput) SetImageId(v string) *DescribeImageAttribu type DescribeImageAttributeOutput struct { _ struct{} `type:"structure"` - // One or more block device mapping entries. + // The block device mapping entries. BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` // A description for the AMI. @@ -45424,10 +51555,10 @@ type DescribeImageAttributeOutput struct { // The kernel ID. KernelId *AttributeValue `locationName:"kernel" type:"structure"` - // One or more launch permissions. + // The launch permissions. LaunchPermissions []*LaunchPermission `locationName:"launchPermission" locationNameList:"item" type:"list"` - // One or more product codes. + // The product codes. ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` // The RAM disk ID. @@ -45496,7 +51627,6 @@ func (s *DescribeImageAttributeOutput) SetSriovNetSupport(v *AttributeValue) *De return s } -// Contains the parameters for DescribeImages. type DescribeImagesInput struct { _ struct{} `type:"structure"` @@ -45510,9 +51640,9 @@ type DescribeImagesInput struct { // account ID, self (the sender of the request), or all (public AMIs). ExecutableUsers []*string `locationName:"ExecutableBy" locationNameList:"ExecutableBy" type:"list"` - // One or more filters. + // The filters. // - // * architecture - The image architecture (i386 | x86_64). + // * architecture - The image architecture (i386 | x86_64 | arm64). // // * block-device-mapping.delete-on-termination - A Boolean value that indicates // whether the Amazon EBS volume is deleted on instance termination. @@ -45529,6 +51659,9 @@ type DescribeImagesInput struct { // * block-device-mapping.volume-type - The volume type of the EBS volume // (gp2 | io1 | st1 | sc1 | standard). // + // * block-device-mapping.encrypted - A Boolean that indicates whether the + // EBS volume is encrypted. + // // * description - The description of the image (provided during image creation). // // * ena-support - A Boolean that indicates whether enhanced networking with @@ -45589,7 +51722,7 @@ type DescribeImagesInput struct { // * virtualization-type - The virtualization type (paravirtual | hvm). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // One or more image IDs. + // The image IDs. // // Default: Describes all images available to you. ImageIds []*string `locationName:"ImageId" locationNameList:"ImageId" type:"list"` @@ -45641,11 +51774,10 @@ func (s *DescribeImagesInput) SetOwners(v []*string) *DescribeImagesInput { return s } -// Contains the output of DescribeImages. type DescribeImagesOutput struct { _ struct{} `type:"structure"` - // Information about one or more images. + // Information about the images. Images []*Image `locationName:"imagesSet" locationNameList:"item" type:"list"` } @@ -45665,7 +51797,6 @@ func (s *DescribeImagesOutput) SetImages(v []*Image) *DescribeImagesOutput { return s } -// Contains the parameters for DescribeImportImageTasks. type DescribeImportImageTasksInput struct { _ struct{} `type:"structure"` @@ -45730,7 +51861,6 @@ func (s *DescribeImportImageTasksInput) SetNextToken(v string) *DescribeImportIm return s } -// Contains the output for DescribeImportImageTasks. type DescribeImportImageTasksOutput struct { _ struct{} `type:"structure"` @@ -45765,7 +51895,6 @@ func (s *DescribeImportImageTasksOutput) SetNextToken(v string) *DescribeImportI return s } -// Contains the parameters for DescribeImportSnapshotTasks. type DescribeImportSnapshotTasksInput struct { _ struct{} `type:"structure"` @@ -45775,7 +51904,7 @@ type DescribeImportSnapshotTasksInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more filters. + // The filters. Filters []*Filter `locationNameList:"Filter" type:"list"` // A list of import snapshot task IDs. @@ -45829,7 +51958,6 @@ func (s *DescribeImportSnapshotTasksInput) SetNextToken(v string) *DescribeImpor return s } -// Contains the output for DescribeImportSnapshotTasks. type DescribeImportSnapshotTasksOutput struct { _ struct{} `type:"structure"` @@ -46094,12 +52222,12 @@ type DescribeInstanceCreditSpecificationsInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more filters. + // The filters. // // * instance-id - The ID of the instance. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // One or more instance IDs. + // The instance IDs. // // Default: Describes all your instances. // @@ -46110,7 +52238,7 @@ type DescribeInstanceCreditSpecificationsInput struct { // remaining results, make another call with the returned NextToken value. This // value can be between 5 and 1000. You cannot specify this parameter and the // instance IDs parameter in the same call. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"5" type:"integer"` // The token to retrieve the next page of results. NextToken *string `type:"string"` @@ -46126,6 +52254,19 @@ func (s DescribeInstanceCreditSpecificationsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeInstanceCreditSpecificationsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeInstanceCreditSpecificationsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeInstanceCreditSpecificationsInput) SetDryRun(v bool) *DescribeInstanceCreditSpecificationsInput { s.DryRun = &v @@ -46198,7 +52339,7 @@ type DescribeInstanceStatusInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * availability-zone - The Availability Zone of the instance. // @@ -46207,12 +52348,18 @@ type DescribeInstanceStatusInput struct { // // * event.description - A description of the event. // + // * event.instance-event-id - The ID of the event whose date and time you + // are modifying. + // // * event.not-after - The latest end time for the scheduled event (for example, // 2014-09-15T17:15:20.000Z). // // * event.not-before - The earliest start time for the scheduled event (for // example, 2014-09-15T17:15:20.000Z). // + // * event.not-before-deadline - The deadline for starting the event (for + // example, 2014-09-15T17:15:20.000Z). + // // * instance-state-code - The code for the instance state, as a 16-bit unsigned // integer. The high byte is used for internal purposes and should be ignored. // The low byte is set based on the state represented. The valid values are @@ -46241,7 +52388,7 @@ type DescribeInstanceStatusInput struct { // Default: false IncludeAllInstances *bool `locationName:"includeAllInstances" type:"boolean"` - // One or more instance IDs. + // The instance IDs. // // Default: Describes all your instances. // @@ -46307,7 +52454,7 @@ func (s *DescribeInstanceStatusInput) SetNextToken(v string) *DescribeInstanceSt type DescribeInstanceStatusOutput struct { _ struct{} `type:"structure"` - // One or more instance status descriptions. + // Information about the status of the instances. InstanceStatuses []*InstanceStatus `locationName:"instanceStatusSet" locationNameList:"item" type:"list"` // The token to use to retrieve the next page of results. This value is null @@ -46346,12 +52493,12 @@ type DescribeInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * affinity - The affinity setting for an instance running on a Dedicated // Host (default | host). // - // * architecture - The instance architecture (i386 | x86_64). + // * architecture - The instance architecture (i386 | x86_64 | arm64). // // * availability-zone - The Availability Zone of the instance. // @@ -46414,7 +52561,6 @@ type DescribeInstancesInput struct { // // * instance.group-name - The name of the security group for the instance. // - // // * ip-address - The public IPv4 address of the instance. // // * kernel-id - The kernel ID. @@ -46424,7 +52570,6 @@ type DescribeInstancesInput struct { // * launch-index - When launching multiple instances, this is the index // for the instance in the launch group (for example, 0, 1, 2, and so on). // - // // * launch-time - The time when the instance was launched. // // * monitoring-state - Indicates whether detailed monitoring is enabled @@ -46523,8 +52668,7 @@ type DescribeInstancesInput struct { // * placement-partition-number - The partition in which the instance is // located. // - // * platform - The platform. Use windows if you have Windows instances; - // otherwise, leave blank. + // * platform - The platform. To list only Windows instances, use windows. // // * private-dns-name - The private IPv4 DNS name of the instance. // @@ -46588,7 +52732,7 @@ type DescribeInstancesInput struct { // * vpc-id - The ID of the VPC that the instance is running in. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // One or more instance IDs. + // The instance IDs. // // Default: Describes all your instances. InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` @@ -46650,7 +52794,7 @@ type DescribeInstancesOutput struct { // when there are no more results to return. NextToken *string `locationName:"nextToken" type:"string"` - // Zero or more reservations. + // Information about the reservations. Reservations []*Reservation `locationName:"reservationSet" locationNameList:"item" type:"list"` } @@ -46711,6 +52855,13 @@ type DescribeInternetGatewaysInput struct { // // Default: Describes all your internet gateways. InternetGatewayIds []*string `locationName:"internetGatewayId" locationNameList:"item" type:"list"` + + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next page of results. + NextToken *string `type:"string"` } // String returns the string representation @@ -46723,6 +52874,19 @@ func (s DescribeInternetGatewaysInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeInternetGatewaysInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeInternetGatewaysInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeInternetGatewaysInput) SetDryRun(v bool) *DescribeInternetGatewaysInput { s.DryRun = &v @@ -46741,11 +52905,27 @@ func (s *DescribeInternetGatewaysInput) SetInternetGatewayIds(v []*string) *Desc return s } +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeInternetGatewaysInput) SetMaxResults(v int64) *DescribeInternetGatewaysInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeInternetGatewaysInput) SetNextToken(v string) *DescribeInternetGatewaysInput { + s.NextToken = &v + return s +} + type DescribeInternetGatewaysOutput struct { _ struct{} `type:"structure"` // Information about one or more internet gateways. InternetGateways []*InternetGateway `locationName:"internetGatewaySet" locationNameList:"item" type:"list"` + + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation @@ -46764,6 +52944,12 @@ func (s *DescribeInternetGatewaysOutput) SetInternetGateways(v []*InternetGatewa return s } +// SetNextToken sets the NextToken field's value. +func (s *DescribeInternetGatewaysOutput) SetNextToken(v string) *DescribeInternetGatewaysOutput { + s.NextToken = &v + return s +} + type DescribeKeyPairsInput struct { _ struct{} `type:"structure"` @@ -46773,14 +52959,14 @@ type DescribeKeyPairsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * fingerprint - The fingerprint of the key pair. // // * key-name - The name of the key pair. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // One or more key pair names. + // The key pair names. // // Default: Describes all your key pairs. KeyNames []*string `locationName:"KeyName" locationNameList:"KeyName" type:"list"` @@ -46817,7 +53003,7 @@ func (s *DescribeKeyPairsInput) SetKeyNames(v []*string) *DescribeKeyPairsInput type DescribeKeyPairsOutput struct { _ struct{} `type:"structure"` - // Information about one or more key pairs. + // Information about the key pairs. KeyPairs []*KeyPairInfo `locationName:"keySet" locationNameList:"item" type:"list"` } @@ -47038,7 +53224,7 @@ type DescribeLaunchTemplatesInput struct { // The maximum number of results to return in a single call. To retrieve the // remaining results, make another call with the returned NextToken value. This // value can be between 1 and 200. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"1" type:"integer"` // The token to request the next page of results. NextToken *string `type:"string"` @@ -47054,6 +53240,19 @@ func (s DescribeLaunchTemplatesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeLaunchTemplatesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeLaunchTemplatesInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeLaunchTemplatesInput) SetDryRun(v bool) *DescribeLaunchTemplatesInput { s.DryRun = &v @@ -47144,7 +53343,7 @@ type DescribeMovingAddressesInput struct { // 1000; if MaxResults is given a value outside of this range, an error is returned. // // Default: If no value is provided, the default is 1000. - MaxResults *int64 `locationName:"maxResults" type:"integer"` + MaxResults *int64 `locationName:"maxResults" min:"5" type:"integer"` // The token for the next page of results. NextToken *string `locationName:"nextToken" type:"string"` @@ -47163,6 +53362,19 @@ func (s DescribeMovingAddressesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeMovingAddressesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeMovingAddressesInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeMovingAddressesInput) SetDryRun(v bool) *DescribeMovingAddressesInput { s.DryRun = &v @@ -47251,18 +53463,14 @@ type DescribeNatGatewaysInput struct { // * vpc-id - The ID of the VPC in which the NAT gateway resides. Filter []*Filter `locationNameList:"Filter" type:"list"` - // The maximum number of items to return for this request. The request returns - // a token that you can specify in a subsequent call to get the next set of - // results. - // - // Constraint: If the value specified is greater than 1000, we return only 1000 - // items. - MaxResults *int64 `type:"integer"` + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` // One or more NAT gateway IDs. NatGatewayIds []*string `locationName:"NatGatewayId" locationNameList:"item" type:"list"` - // The token to retrieve the next page of results. + // The token for the next page of results. NextToken *string `type:"string"` } @@ -47276,6 +53484,19 @@ func (s DescribeNatGatewaysInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeNatGatewaysInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeNatGatewaysInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetFilter sets the Filter field's value. func (s *DescribeNatGatewaysInput) SetFilter(v []*Filter) *DescribeNatGatewaysInput { s.Filter = v @@ -47367,7 +53588,6 @@ type DescribeNetworkAclsInput struct { // // * entry.port-range.to - The end of the port range specified in the entry. // - // // * entry.protocol - The protocol specified in the entry (tcp | udp | icmp // or a protocol number). // @@ -47393,10 +53613,17 @@ type DescribeNetworkAclsInput struct { // * vpc-id - The ID of the VPC for the network ACL. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` + // One or more network ACL IDs. // // Default: Describes all your network ACLs. NetworkAclIds []*string `locationName:"NetworkAclId" locationNameList:"item" type:"list"` + + // The token for the next page of results. + NextToken *string `type:"string"` } // String returns the string representation @@ -47409,6 +53636,19 @@ func (s DescribeNetworkAclsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeNetworkAclsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeNetworkAclsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeNetworkAclsInput) SetDryRun(v bool) *DescribeNetworkAclsInput { s.DryRun = &v @@ -47421,17 +53661,33 @@ func (s *DescribeNetworkAclsInput) SetFilters(v []*Filter) *DescribeNetworkAclsI return s } +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeNetworkAclsInput) SetMaxResults(v int64) *DescribeNetworkAclsInput { + s.MaxResults = &v + return s +} + // SetNetworkAclIds sets the NetworkAclIds field's value. func (s *DescribeNetworkAclsInput) SetNetworkAclIds(v []*string) *DescribeNetworkAclsInput { s.NetworkAclIds = v return s } +// SetNextToken sets the NextToken field's value. +func (s *DescribeNetworkAclsInput) SetNextToken(v string) *DescribeNetworkAclsInput { + s.NextToken = &v + return s +} + type DescribeNetworkAclsOutput struct { _ struct{} `type:"structure"` // Information about one or more network ACLs. NetworkAcls []*NetworkAcl `locationName:"networkAclSet" locationNameList:"item" type:"list"` + + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation @@ -47450,6 +53706,12 @@ func (s *DescribeNetworkAclsOutput) SetNetworkAcls(v []*NetworkAcl) *DescribeNet return s } +// SetNextToken sets the NextToken field's value. +func (s *DescribeNetworkAclsOutput) SetNextToken(v string) *DescribeNetworkAclsOutput { + s.NextToken = &v + return s +} + // Contains the parameters for DescribeNetworkInterfaceAttribute. type DescribeNetworkInterfaceAttributeInput struct { _ struct{} `type:"structure"` @@ -47593,7 +53855,7 @@ type DescribeNetworkInterfacePermissionsInput struct { // The maximum number of results to return in a single call. To retrieve the // remaining results, make another call with the returned NextToken value. If // this parameter is not specified, up to 50 results are returned by default. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"5" type:"integer"` // One or more network interface permission IDs. NetworkInterfacePermissionIds []*string `locationName:"NetworkInterfacePermissionId" type:"list"` @@ -47612,6 +53874,19 @@ func (s DescribeNetworkInterfacePermissionsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeNetworkInterfacePermissionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeNetworkInterfacePermissionsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetFilters sets the Filters field's value. func (s *DescribeNetworkInterfacePermissionsInput) SetFilters(v []*Filter) *DescribeNetworkInterfacePermissionsInput { s.Filters = v @@ -47710,7 +53985,7 @@ type DescribeNetworkInterfacesInput struct { // // * attachment.attachment-id - The ID of the interface attachment. // - // * attachment.attach.time - The time that the network interface was attached + // * attachment.attach-time - The time that the network interface was attached // to an instance. // // * attachment.delete-on-termination - Indicates whether the attachment @@ -47761,7 +54036,7 @@ type DescribeNetworkInterfacesInput struct { // managed by an AWS service (for example, AWS Management Console, Auto Scaling, // and so on). // - // * source-desk-check - Indicates whether the network interface performs + // * source-dest-check - Indicates whether the network interface performs // source/destination checking. A value of true means checking is enabled, // and false means checking is disabled. The value must be false for the // network interface to perform network address translation (NAT) in your @@ -47789,7 +54064,7 @@ type DescribeNetworkInterfacesInput struct { // The maximum number of items to return for this request. The request returns // a token that you can specify in a subsequent call to get the next set of // results. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"5" type:"integer"` // One or more network interface IDs. // @@ -47810,6 +54085,19 @@ func (s DescribeNetworkInterfacesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeNetworkInterfacesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeNetworkInterfacesInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeNetworkInterfacesInput) SetDryRun(v bool) *DescribeNetworkInterfacesInput { s.DryRun = &v @@ -47883,7 +54171,7 @@ type DescribePlacementGroupsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * group-name - The name of the placement group. // @@ -47893,7 +54181,7 @@ type DescribePlacementGroupsInput struct { // * strategy - The strategy of the placement group (cluster | spread | partition). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // One or more placement group names. + // The names of the placement groups. // // Default: Describes all your placement groups, or only those otherwise specified. GroupNames []*string `locationName:"groupName" type:"list"` @@ -47930,7 +54218,7 @@ func (s *DescribePlacementGroupsInput) SetGroupNames(v []*string) *DescribePlace type DescribePlacementGroupsOutput struct { _ struct{} `type:"structure"` - // One or more placement groups. + // Information about the placement groups. PlacementGroups []*PlacementGroup `locationName:"placementGroupSet" locationNameList:"item" type:"list"` } @@ -47966,16 +54254,11 @@ type DescribePrefixListsInput struct { // * prefix-list-name: The name of a prefix list. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // The maximum number of items to return for this request. The request returns - // a token that you can specify in a subsequent call to get the next set of - // results. - // - // Constraint: If the value specified is greater than 1000, we return only 1000 - // items. + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. MaxResults *int64 `type:"integer"` - // The token for the next set of items to return. (You received this token from - // a prior call.) + // The token for the next page of results. NextToken *string `type:"string"` // One or more prefix list IDs. @@ -48025,8 +54308,8 @@ func (s *DescribePrefixListsInput) SetPrefixListIds(v []*string) *DescribePrefix type DescribePrefixListsOutput struct { _ struct{} `type:"structure"` - // The token to use when requesting the next set of items. If there are no additional - // items to return, the string is empty. + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. NextToken *string `locationName:"nextToken" type:"string"` // All available prefix lists. @@ -48066,7 +54349,7 @@ type DescribePrincipalIdFormatInput struct { // The maximum number of results to return in a single call. To retrieve the // remaining results, make another call with the returned NextToken value. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"1" type:"integer"` // The token to request the next page of results. NextToken *string `type:"string"` @@ -48091,6 +54374,19 @@ func (s DescribePrincipalIdFormatInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribePrincipalIdFormatInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribePrincipalIdFormatInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribePrincipalIdFormatInput) SetDryRun(v bool) *DescribePrincipalIdFormatInput { s.DryRun = &v @@ -48156,7 +54452,7 @@ type DescribePublicIpv4PoolsInput struct { MaxResults *int64 `min:"1" type:"integer"` // The token for the next page of results. - NextToken *string `min:"1" type:"string"` + NextToken *string `type:"string"` // The IDs of the address pools. PoolIds []*string `locationName:"PoolId" locationNameList:"item" type:"list"` @@ -48178,9 +54474,6 @@ func (s *DescribePublicIpv4PoolsInput) Validate() error { if s.MaxResults != nil && *s.MaxResults < 1 { invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) } - if s.NextToken != nil && len(*s.NextToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -48242,20 +54535,25 @@ func (s *DescribePublicIpv4PoolsOutput) SetPublicIpv4Pools(v []*PublicIpv4Pool) type DescribeRegionsInput struct { _ struct{} `type:"structure"` + // Indicates whether to display all Regions, including Regions that are disabled + // for your account. + AllRegions *bool `type:"boolean"` + // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // - // * endpoint - The endpoint of the region (for example, ec2.us-east-1.amazonaws.com). + // * endpoint - The endpoint of the Region (for example, ec2.us-east-1.amazonaws.com). // - // * region-name - The name of the region (for example, us-east-1). + // * region-name - The name of the Region (for example, us-east-1). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // The names of one or more regions. + // The names of the Regions. You can specify any Regions, whether they are enabled + // and disabled for your account. RegionNames []*string `locationName:"RegionName" locationNameList:"RegionName" type:"list"` } @@ -48269,6 +54567,12 @@ func (s DescribeRegionsInput) GoString() string { return s.String() } +// SetAllRegions sets the AllRegions field's value. +func (s *DescribeRegionsInput) SetAllRegions(v bool) *DescribeRegionsInput { + s.AllRegions = &v + return s +} + // SetDryRun sets the DryRun field's value. func (s *DescribeRegionsInput) SetDryRun(v bool) *DescribeRegionsInput { s.DryRun = &v @@ -48290,7 +54594,7 @@ func (s *DescribeRegionsInput) SetRegionNames(v []*string) *DescribeRegionsInput type DescribeRegionsOutput struct { _ struct{} `type:"structure"` - // Information about one or more regions. + // Information about the Regions. Regions []*Region `locationName:"regionInfo" locationNameList:"item" type:"list"` } @@ -48517,7 +54821,7 @@ type DescribeReservedInstancesModificationsInput struct { // * modification-result.target-configuration.availability-zone - The Availability // Zone for the new Reserved Instances. // - // * modification-result.target-configuration.instance-count - The number + // * modification-result.target-configuration.instance-count - The number // of new Reserved Instances. // // * modification-result.target-configuration.instance-type - The instance @@ -48645,7 +54949,7 @@ type DescribeReservedInstancesOfferingsInput struct { // SUSE Linux (Amazon VPC) | Red Hat Enterprise Linux | Red Hat Enterprise // Linux (Amazon VPC) | Windows | Windows (Amazon VPC) | Windows with SQL // Server Standard | Windows with SQL Server Standard (Amazon VPC) | Windows - // with SQL Server Web | Windows with SQL Server Web (Amazon VPC) | Windows + // with SQL Server Web | Windows with SQL Server Web (Amazon VPC) | Windows // with SQL Server Enterprise | Windows with SQL Server Enterprise (Amazon // VPC)) // @@ -48671,7 +54975,7 @@ type DescribeReservedInstancesOfferingsInput struct { InstanceTenancy *string `locationName:"instanceTenancy" type:"string" enum:"Tenancy"` // The instance type that the reservation will cover (for example, m1.small). - // For more information, see Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + // For more information, see Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) // in the Amazon Elastic Compute Cloud User Guide. InstanceType *string `type:"string" enum:"InstanceType"` @@ -48951,12 +55255,11 @@ type DescribeRouteTablesInput struct { // * vpc-id - The ID of the VPC for the route table. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // The maximum number of results to return in a single call. To retrieve the - // remaining results, make another call with the returned NextToken value. This - // value can be between 5 and 100. - MaxResults *int64 `type:"integer"` + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` - // The token to retrieve the next page of results. + // The token for the next page of results. NextToken *string `type:"string"` // One or more route table IDs. @@ -48975,6 +55278,19 @@ func (s DescribeRouteTablesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeRouteTablesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeRouteTablesInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeRouteTablesInput) SetDryRun(v bool) *DescribeRouteTablesInput { s.DryRun = &v @@ -49049,7 +55365,7 @@ type DescribeScheduledInstanceAvailabilityInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more filters. + // The filters. // // * availability-zone - The Availability Zone (for example, us-west-2a). // @@ -49068,7 +55384,7 @@ type DescribeScheduledInstanceAvailabilityInput struct { // The maximum number of results to return in a single call. This value can // be between 5 and 300. The default value is 300. To retrieve the remaining // results, make another call with the returned NextToken value. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"5" type:"integer"` // The maximum available duration, in hours. This value must be greater than // MinSlotDurationInHours and less than 1,720. @@ -49105,6 +55421,9 @@ func (s *DescribeScheduledInstanceAvailabilityInput) Validate() error { if s.FirstSlotStartTimeRange == nil { invalidParams.Add(request.NewErrParamRequired("FirstSlotStartTimeRange")) } + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } if s.Recurrence == nil { invalidParams.Add(request.NewErrParamRequired("Recurrence")) } @@ -49212,7 +55531,7 @@ type DescribeScheduledInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more filters. + // The filters. // // * availability-zone - The Availability Zone (for example, us-west-2a). // @@ -49231,7 +55550,7 @@ type DescribeScheduledInstancesInput struct { // The token for the next set of results. NextToken *string `type:"string"` - // One or more Scheduled Instance IDs. + // The Scheduled Instance IDs. ScheduledInstanceIds []*string `locationName:"ScheduledInstanceId" locationNameList:"ScheduledInstanceId" type:"list"` // The time period for the first schedule to start. @@ -49327,7 +55646,7 @@ type DescribeSecurityGroupReferencesInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more security group IDs in your account. + // The IDs of the security groups in your account. // // GroupId is a required field GroupId []*string `locationNameList:"item" type:"list" required:"true"` @@ -49400,9 +55719,9 @@ type DescribeSecurityGroupsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. If using multiple filters for rules, the results include - // security groups for which any combination of rules - not necessarily a single - // rule - match all filters. + // The filters. If using multiple filters for rules, the results include security + // groups for which any combination of rules - not necessarily a single rule + // - match all filters. // // * description - The description of the security group. // @@ -49479,13 +55798,13 @@ type DescribeSecurityGroupsInput struct { // * vpc-id - The ID of the VPC specified when the security group was created. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // One or more security group IDs. Required for security groups in a nondefault + // The IDs of the security groups. Required for security groups in a nondefault // VPC. // // Default: Describes all your security groups. GroupIds []*string `locationName:"GroupId" locationNameList:"groupId" type:"list"` - // [EC2-Classic and default VPC only] One or more security group names. You + // [EC2-Classic and default VPC only] The names of the security groups. You // can specify either the security group name or the security group ID. For // security groups in a nondefault VPC, use the group-name filter to describe // security groups by name. @@ -49497,7 +55816,7 @@ type DescribeSecurityGroupsInput struct { // remaining results, make another request with the returned NextToken value. // This value can be between 5 and 1000. If this parameter is not specified, // then all results are returned. - MaxResults *int64 `type:"integer"` + MaxResults *int64 `min:"5" type:"integer"` // The token to request the next page of results. NextToken *string `type:"string"` @@ -49513,6 +55832,19 @@ func (s DescribeSecurityGroupsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeSecurityGroupsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeSecurityGroupsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeSecurityGroupsInput) SetDryRun(v bool) *DescribeSecurityGroupsInput { s.DryRun = &v @@ -49556,7 +55888,7 @@ type DescribeSecurityGroupsOutput struct { // when there are no more results to return. NextToken *string `locationName:"nextToken" type:"string"` - // Information about one or more security groups. + // Information about the security groups. SecurityGroups []*SecurityGroup `locationName:"securityGroupInfo" locationNameList:"item" type:"list"` } @@ -49651,10 +55983,11 @@ func (s *DescribeSnapshotAttributeInput) SetSnapshotId(v string) *DescribeSnapsh type DescribeSnapshotAttributeOutput struct { _ struct{} `type:"structure"` - // A list of permissions for creating volumes from the snapshot. + // The users and groups that have the permissions for creating volumes from + // the snapshot. CreateVolumePermissions []*CreateVolumePermission `locationName:"createVolumePermission" locationNameList:"item" type:"list"` - // A list of product codes. + // The product codes. ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` // The ID of the EBS snapshot. @@ -49689,7 +56022,6 @@ func (s *DescribeSnapshotAttributeOutput) SetSnapshotId(v string) *DescribeSnaps return s } -// Contains the parameters for DescribeSnapshots. type DescribeSnapshotsInput struct { _ struct{} `type:"structure"` @@ -49699,13 +56031,16 @@ type DescribeSnapshotsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * description - A description of the snapshot. // - // * owner-alias - Value from an Amazon-maintained list (amazon | aws-marketplace - // | microsoft) of snapshot owners. Not to be confused with the user-configured - // AWS account alias, which is set from the IAM console. + // * encrypted - Indicates whether the snapshot is encrypted (true | false) + // + // * owner-alias - Value from an Amazon-maintained list (amazon | self | + // all | aws-marketplace | microsoft) of snapshot owners. Not to be confused + // with the user-configured AWS account alias, which is set from the IAM + // console. // // * owner-id - The ID of the AWS account that owns the snapshot. // @@ -49751,16 +56086,15 @@ type DescribeSnapshotsInput struct { // to return. NextToken *string `type:"string"` - // Returns the snapshots owned by the specified owner. Multiple owners can be - // specified. + // Describes the snapshots owned by these owners. OwnerIds []*string `locationName:"Owner" locationNameList:"Owner" type:"list"` - // One or more AWS accounts IDs that can create volumes from the snapshot. + // The IDs of the AWS accounts that can create volumes from the snapshot. RestorableByUserIds []*string `locationName:"RestorableBy" type:"list"` - // One or more snapshot IDs. + // The snapshot IDs. // - // Default: Describes snapshots for which you have launch permissions. + // Default: Describes the snapshots for which you have create volume permissions. SnapshotIds []*string `locationName:"SnapshotId" locationNameList:"SnapshotId" type:"list"` } @@ -49816,7 +56150,6 @@ func (s *DescribeSnapshotsInput) SetSnapshotIds(v []*string) *DescribeSnapshotsI return s } -// Contains the output of DescribeSnapshots. type DescribeSnapshotsOutput struct { _ struct{} `type:"structure"` @@ -49916,7 +56249,7 @@ type DescribeSpotFleetInstancesInput struct { // The maximum number of results to return in a single call. Specify a value // between 1 and 1000. The default value is 1000. To retrieve the remaining // results, make another call with the returned NextToken value. - MaxResults *int64 `locationName:"maxResults" type:"integer"` + MaxResults *int64 `locationName:"maxResults" min:"1" type:"integer"` // The token for the next set of results. NextToken *string `locationName:"nextToken" type:"string"` @@ -49940,6 +56273,9 @@ func (s DescribeSpotFleetInstancesInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *DescribeSpotFleetInstancesInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "DescribeSpotFleetInstancesInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } if s.SpotFleetRequestId == nil { invalidParams.Add(request.NewErrParamRequired("SpotFleetRequestId")) } @@ -50034,7 +56370,7 @@ type DescribeSpotFleetRequestHistoryInput struct { // The maximum number of results to return in a single call. Specify a value // between 1 and 1000. The default value is 1000. To retrieve the remaining // results, make another call with the returned NextToken value. - MaxResults *int64 `locationName:"maxResults" type:"integer"` + MaxResults *int64 `locationName:"maxResults" min:"1" type:"integer"` // The token for the next set of results. NextToken *string `locationName:"nextToken" type:"string"` @@ -50063,6 +56399,9 @@ func (s DescribeSpotFleetRequestHistoryInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *DescribeSpotFleetRequestHistoryInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "DescribeSpotFleetRequestHistoryInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } if s.SpotFleetRequestId == nil { invalidParams.Add(request.NewErrParamRequired("SpotFleetRequestId")) } @@ -50358,7 +56697,7 @@ type DescribeSpotInstanceRequestsInput struct { // * state - The state of the Spot Instance request (open | active | closed // | cancelled | failed). Spot request status information can help you track // your Amazon EC2 Spot Instance requests. For more information, see Spot - // Request Status (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) + // Request Status (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) // in the Amazon EC2 User Guide for Linux Instances. // // * status-code - The short code describing the most recent evaluation of @@ -50791,6 +57130,13 @@ type DescribeSubnetsInput struct { // * vpc-id - The ID of the VPC for the subnet. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next page of results. + NextToken *string `type:"string"` + // One or more subnet IDs. // // Default: Describes all your subnets. @@ -50807,6 +57153,19 @@ func (s DescribeSubnetsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeSubnetsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeSubnetsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeSubnetsInput) SetDryRun(v bool) *DescribeSubnetsInput { s.DryRun = &v @@ -50819,6 +57178,18 @@ func (s *DescribeSubnetsInput) SetFilters(v []*Filter) *DescribeSubnetsInput { return s } +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeSubnetsInput) SetMaxResults(v int64) *DescribeSubnetsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeSubnetsInput) SetNextToken(v string) *DescribeSubnetsInput { + s.NextToken = &v + return s +} + // SetSubnetIds sets the SubnetIds field's value. func (s *DescribeSubnetsInput) SetSubnetIds(v []*string) *DescribeSubnetsInput { s.SubnetIds = v @@ -50828,6 +57199,10 @@ func (s *DescribeSubnetsInput) SetSubnetIds(v []*string) *DescribeSubnetsInput { type DescribeSubnetsOutput struct { _ struct{} `type:"structure"` + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + // Information about one or more subnets. Subnets []*Subnet `locationName:"subnetSet" locationNameList:"item" type:"list"` } @@ -50842,6 +57217,12 @@ func (s DescribeSubnetsOutput) GoString() string { return s.String() } +// SetNextToken sets the NextToken field's value. +func (s *DescribeSubnetsOutput) SetNextToken(v string) *DescribeSubnetsOutput { + s.NextToken = &v + return s +} + // SetSubnets sets the Subnets field's value. func (s *DescribeSubnetsOutput) SetSubnets(v []*Subnet) *DescribeSubnetsOutput { s.Subnets = v @@ -50857,7 +57238,7 @@ type DescribeTagsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * key - The tag key. // @@ -50865,9 +57246,10 @@ type DescribeTagsInput struct { // // * resource-type - The resource type (customer-gateway | dedicated-host // | dhcp-options | elastic-ip | fleet | fpga-image | image | instance | - // internet-gateway | launch-template | natgateway | network-acl | network-interface - // | reserved-instances | route-table | security-group | snapshot | spot-instances-request - // | subnet | volume | vpc | vpc-peering-connection | vpn-connection | vpn-gateway). + // host-reservation | internet-gateway | launch-template | natgateway | network-acl + // | network-interface | reserved-instances | route-table | security-group + // | snapshot | spot-instances-request | subnet | volume | vpc | vpc-peering-connection + // | vpn-connection | vpn-gateway). // // * tag: - The key/value combination of the tag. For example, specify // "tag:Owner" for the filter name and "TeamA" for the filter value to find @@ -50952,6 +57334,367 @@ func (s *DescribeTagsOutput) SetTags(v []*TagDescription) *DescribeTagsOutput { return s } +type DescribeTrafficMirrorFiltersInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // One or more filters. The possible values are: + // + // * description: The Traffic Mirror filter description. + // + // * traffic-mirror-filter-id: The ID of the Traffic Mirror filter. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next page of results. + NextToken *string `type:"string"` + + // The ID of the Traffic Mirror filter. + TrafficMirrorFilterIds []*string `locationName:"TrafficMirrorFilterId" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeTrafficMirrorFiltersInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeTrafficMirrorFiltersInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeTrafficMirrorFiltersInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeTrafficMirrorFiltersInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *DescribeTrafficMirrorFiltersInput) SetDryRun(v bool) *DescribeTrafficMirrorFiltersInput { + s.DryRun = &v + return s +} + +// SetFilters sets the Filters field's value. +func (s *DescribeTrafficMirrorFiltersInput) SetFilters(v []*Filter) *DescribeTrafficMirrorFiltersInput { + s.Filters = v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeTrafficMirrorFiltersInput) SetMaxResults(v int64) *DescribeTrafficMirrorFiltersInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeTrafficMirrorFiltersInput) SetNextToken(v string) *DescribeTrafficMirrorFiltersInput { + s.NextToken = &v + return s +} + +// SetTrafficMirrorFilterIds sets the TrafficMirrorFilterIds field's value. +func (s *DescribeTrafficMirrorFiltersInput) SetTrafficMirrorFilterIds(v []*string) *DescribeTrafficMirrorFiltersInput { + s.TrafficMirrorFilterIds = v + return s +} + +type DescribeTrafficMirrorFiltersOutput struct { + _ struct{} `type:"structure"` + + // The token to use to retrieve the next page of results. The value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // Information about one or more Traffic Mirror filters. + TrafficMirrorFilters []*TrafficMirrorFilter `locationName:"trafficMirrorFilterSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeTrafficMirrorFiltersOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeTrafficMirrorFiltersOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeTrafficMirrorFiltersOutput) SetNextToken(v string) *DescribeTrafficMirrorFiltersOutput { + s.NextToken = &v + return s +} + +// SetTrafficMirrorFilters sets the TrafficMirrorFilters field's value. +func (s *DescribeTrafficMirrorFiltersOutput) SetTrafficMirrorFilters(v []*TrafficMirrorFilter) *DescribeTrafficMirrorFiltersOutput { + s.TrafficMirrorFilters = v + return s +} + +type DescribeTrafficMirrorSessionsInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // One or more filters. The possible values are: + // + // * description: The Traffic Mirror session description. + // + // * network-interface-id: The ID of the Traffic Mirror session network interface. + // + // * owner-id: The ID of the account that owns the Traffic Mirror session. + // + // * packet-length: The assigned number of packets to mirror. + // + // * session-number: The assigned session number. + // + // * traffic-mirror-filter-id: The ID of the Traffic Mirror filter. + // + // * traffic-mirror-session-id: The ID of the Traffic Mirror session. + // + // * traffic-mirror-target-id: The ID of the Traffic Mirror target. + // + // * virtual-network-id: The virtual network ID of the Traffic Mirror session. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next page of results. + NextToken *string `type:"string"` + + // The ID of the Traffic Mirror session. + TrafficMirrorSessionIds []*string `locationName:"TrafficMirrorSessionId" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeTrafficMirrorSessionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeTrafficMirrorSessionsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeTrafficMirrorSessionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeTrafficMirrorSessionsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *DescribeTrafficMirrorSessionsInput) SetDryRun(v bool) *DescribeTrafficMirrorSessionsInput { + s.DryRun = &v + return s +} + +// SetFilters sets the Filters field's value. +func (s *DescribeTrafficMirrorSessionsInput) SetFilters(v []*Filter) *DescribeTrafficMirrorSessionsInput { + s.Filters = v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeTrafficMirrorSessionsInput) SetMaxResults(v int64) *DescribeTrafficMirrorSessionsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeTrafficMirrorSessionsInput) SetNextToken(v string) *DescribeTrafficMirrorSessionsInput { + s.NextToken = &v + return s +} + +// SetTrafficMirrorSessionIds sets the TrafficMirrorSessionIds field's value. +func (s *DescribeTrafficMirrorSessionsInput) SetTrafficMirrorSessionIds(v []*string) *DescribeTrafficMirrorSessionsInput { + s.TrafficMirrorSessionIds = v + return s +} + +type DescribeTrafficMirrorSessionsOutput struct { + _ struct{} `type:"structure"` + + // The token to use to retrieve the next page of results. The value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // Describes one or more Traffic Mirror sessions. By default, all Traffic Mirror + // sessions are described. Alternatively, you can filter the results. + TrafficMirrorSessions []*TrafficMirrorSession `locationName:"trafficMirrorSessionSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeTrafficMirrorSessionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeTrafficMirrorSessionsOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeTrafficMirrorSessionsOutput) SetNextToken(v string) *DescribeTrafficMirrorSessionsOutput { + s.NextToken = &v + return s +} + +// SetTrafficMirrorSessions sets the TrafficMirrorSessions field's value. +func (s *DescribeTrafficMirrorSessionsOutput) SetTrafficMirrorSessions(v []*TrafficMirrorSession) *DescribeTrafficMirrorSessionsOutput { + s.TrafficMirrorSessions = v + return s +} + +type DescribeTrafficMirrorTargetsInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // One or more filters. The possible values are: + // + // * description: The Traffic Mirror target description. + // + // * network-interface-id: The ID of the Traffic Mirror session network interface. + // + // * network-load-balancer-arn: The Amazon Resource Name (ARN) of the Network + // Load Balancer that is associated with the session. + // + // * owner-id: The ID of the account that owns the Traffic Mirror session. + // + // * traffic-mirror-target-id: The ID of the Traffic Mirror target. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next page of results. + NextToken *string `type:"string"` + + // The ID of the Traffic Mirror targets. + TrafficMirrorTargetIds []*string `locationName:"TrafficMirrorTargetId" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeTrafficMirrorTargetsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeTrafficMirrorTargetsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeTrafficMirrorTargetsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeTrafficMirrorTargetsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *DescribeTrafficMirrorTargetsInput) SetDryRun(v bool) *DescribeTrafficMirrorTargetsInput { + s.DryRun = &v + return s +} + +// SetFilters sets the Filters field's value. +func (s *DescribeTrafficMirrorTargetsInput) SetFilters(v []*Filter) *DescribeTrafficMirrorTargetsInput { + s.Filters = v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeTrafficMirrorTargetsInput) SetMaxResults(v int64) *DescribeTrafficMirrorTargetsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeTrafficMirrorTargetsInput) SetNextToken(v string) *DescribeTrafficMirrorTargetsInput { + s.NextToken = &v + return s +} + +// SetTrafficMirrorTargetIds sets the TrafficMirrorTargetIds field's value. +func (s *DescribeTrafficMirrorTargetsInput) SetTrafficMirrorTargetIds(v []*string) *DescribeTrafficMirrorTargetsInput { + s.TrafficMirrorTargetIds = v + return s +} + +type DescribeTrafficMirrorTargetsOutput struct { + _ struct{} `type:"structure"` + + // The token to use to retrieve the next page of results. The value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // Information about one or more Traffic Mirror targets. + TrafficMirrorTargets []*TrafficMirrorTarget `locationName:"trafficMirrorTargetSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeTrafficMirrorTargetsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeTrafficMirrorTargetsOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeTrafficMirrorTargetsOutput) SetNextToken(v string) *DescribeTrafficMirrorTargetsOutput { + s.NextToken = &v + return s +} + +// SetTrafficMirrorTargets sets the TrafficMirrorTargets field's value. +func (s *DescribeTrafficMirrorTargetsOutput) SetTrafficMirrorTargets(v []*TrafficMirrorTarget) *DescribeTrafficMirrorTargetsOutput { + s.TrafficMirrorTargets = v + return s +} + type DescribeTransitGatewayAttachmentsInput struct { _ struct{} `type:"structure"` @@ -50963,26 +57706,27 @@ type DescribeTransitGatewayAttachmentsInput struct { // One or more filters. The possible values are: // - // * association.transit-gateway-route-table-id - The ID of the route table - // for the transit gateway. - // // * association.state - The state of the association (associating | associated // | disassociating). // + // * association.transit-gateway-route-table-id - The ID of the route table + // for the transit gateway. + // // * resource-id - The ID of the resource. // - // * resource-owner - The ID of the AWS account that owns the resource. + // * resource-owner-id - The ID of the AWS account that owns the resource. // // * resource-type - The resource type (vpc | vpn). // - // * state - The state of the attachment (pendingAcceptance | pending | available - // | modifying | deleting | deleted | failed | rejected). + // * state - The state of the attachment (available | deleted | deleting + // | failed | modifying | pendingAcceptance | pending | rollingBack | rejected + // | rejecting). // // * transit-gateway-attachment-id - The ID of the attachment. // // * transit-gateway-id - The ID of the transit gateway. // - // * transit-gateway-owner - The ID of the AWS account that owns the transit + // * transit-gateway-owner-id - The ID of the AWS account that owns the transit // gateway. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -51100,8 +57844,9 @@ type DescribeTransitGatewayRouteTablesInput struct { // * default-propagation-route-table - Indicates whether this is the default // propagation route table for the transit gateway (true | false). // - // * state - The state of the attachment (pendingAcceptance | pending | available - // | modifying | deleting | deleted | failed | rejected). + // * state - The state of the attachment (available | deleted | deleting + // | failed | modifying | pendingAcceptance | pending | rollingBack | rejected + // | rejecting). // // * transit-gateway-id - The ID of the transit gateway. // @@ -51217,8 +57962,9 @@ type DescribeTransitGatewayVpcAttachmentsInput struct { // One or more filters. The possible values are: // - // * state - The state of the attachment (pendingAcceptance | pending | available - // | modifying | deleting | deleted | failed | rejected). + // * state - The state of the attachment (available | deleted | deleting + // | failed | modifying | pendingAcceptance | pending | rollingBack | rejected + // | rejecting). // // * transit-gateway-attachment-id - The ID of the attachment. // @@ -51335,8 +58081,6 @@ type DescribeTransitGatewaysInput struct { // One or more filters. The possible values are: // - // * owner-id - The ID of the AWS account that owns the transit gateway. - // // * options.propagation-default-route-table-id - The ID of the default propagation // route table. // @@ -51363,13 +58107,13 @@ type DescribeTransitGatewaysInput struct { // * options.vpn-ecmp-support - Indicates whether Equal Cost Multipath Protocol // support is enabled (enable | disable). // - // * state - The state of the attachment (pendingAcceptance | pending | available - // | modifying | deleting | deleted | failed | rejected). + // * owner-id - The ID of the AWS account that owns the transit gateway. + // + // * state - The state of the attachment (available | deleted | deleting + // | failed | modifying | pendingAcceptance | pending | rollingBack | rejected + // | rejecting). // // * transit-gateway-id - The ID of the transit gateway. - // - // * transit-gateway-state - The state of the transit gateway (pending | - // available | deleting | deleted). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // The maximum number of results to return with a single call. To retrieve the @@ -51576,7 +58320,6 @@ func (s *DescribeVolumeAttributeOutput) SetVolumeId(v string) *DescribeVolumeAtt return s } -// Contains the parameters for DescribeVolumeStatus. type DescribeVolumeStatusInput struct { _ struct{} `type:"structure"` @@ -51586,7 +58329,7 @@ type DescribeVolumeStatusInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * action.code - The action code for the event (for example, enable-volume-io). // @@ -51635,7 +58378,7 @@ type DescribeVolumeStatusInput struct { // more results to return. NextToken *string `type:"string"` - // One or more volume IDs. + // The IDs of the volumes. // // Default: Describes all your volumes. VolumeIds []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` @@ -51681,7 +58424,6 @@ func (s *DescribeVolumeStatusInput) SetVolumeIds(v []*string) *DescribeVolumeSta return s } -// Contains the output of DescribeVolumeStatus. type DescribeVolumeStatusOutput struct { _ struct{} `type:"structure"` @@ -51689,7 +58431,7 @@ type DescribeVolumeStatusOutput struct { // when there are no more results to return. NextToken *string `locationName:"nextToken" type:"string"` - // A list of volumes. + // Information about the status of the volumes. VolumeStatuses []*VolumeStatusItem `locationName:"volumeStatusSet" locationNameList:"item" type:"list"` } @@ -51715,7 +58457,6 @@ func (s *DescribeVolumeStatusOutput) SetVolumeStatuses(v []*VolumeStatusItem) *D return s } -// Contains the parameters for DescribeVolumes. type DescribeVolumesInput struct { _ struct{} `type:"structure"` @@ -51725,7 +58466,7 @@ type DescribeVolumesInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // The filters. // // * attachment.attach-time - The time stamp when the attachment initiated. // @@ -51744,7 +58485,7 @@ type DescribeVolumesInput struct { // // * create-time - The time stamp when the volume was created. // - // * encrypted - The encryption status of the volume. + // * encrypted - Indicates whether the volume is encrypted (true | false) // // * size - The size of the volume, in GiB. // @@ -51787,7 +58528,7 @@ type DescribeVolumesInput struct { // NextToken value. This value is null when there are no more results to return. NextToken *string `locationName:"nextToken" type:"string"` - // One or more volume IDs. + // The volume IDs. VolumeIds []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` } @@ -51840,7 +58581,7 @@ type DescribeVolumesModificationsInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more filters. Supported filters: volume-id, modification-state, target-size, + // The filters. Supported filters: volume-id, modification-state, target-size, // target-iops, target-volume-type, original-size, original-iops, original-volume-type, // start-time. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -51852,7 +58593,7 @@ type DescribeVolumesModificationsInput struct { // The nextToken value returned by a previous paginated request. NextToken *string `type:"string"` - // One or more volume IDs for which in-progress modifications will be described. + // The IDs of the volumes for which in-progress modifications will be described. VolumeIds []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` } @@ -51902,7 +58643,7 @@ type DescribeVolumesModificationsOutput struct { // Token for pagination, null if there are no more results NextToken *string `locationName:"nextToken" type:"string"` - // A list of returned VolumeModification objects. + // Information about the volume modifications. VolumesModifications []*VolumeModification `locationName:"volumeModificationSet" locationNameList:"item" type:"list"` } @@ -51928,7 +58669,6 @@ func (s *DescribeVolumesModificationsOutput) SetVolumesModifications(v []*Volume return s } -// Contains the output of DescribeVolumes. type DescribeVolumesOutput struct { _ struct{} `type:"structure"` @@ -52076,13 +58816,11 @@ func (s *DescribeVpcAttributeOutput) SetVpcId(v string) *DescribeVpcAttributeOut type DescribeVpcClassicLinkDnsSupportInput struct { _ struct{} `type:"structure"` - // The maximum number of items to return for this request. The request returns - // a token that you can specify in a subsequent call to get the next set of - // results. + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. MaxResults *int64 `locationName:"maxResults" min:"5" type:"integer"` - // The token for the next set of items to return. (You received this token from - // a prior call.) + // The token for the next page of results. NextToken *string `locationName:"nextToken" min:"1" type:"string"` // One or more VPC IDs. @@ -52136,7 +58874,8 @@ func (s *DescribeVpcClassicLinkDnsSupportInput) SetVpcIds(v []*string) *Describe type DescribeVpcClassicLinkDnsSupportOutput struct { _ struct{} `type:"structure"` - // The token to use when requesting the next set of items. + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. NextToken *string `locationName:"nextToken" min:"1" type:"string"` // Information about the ClassicLink DNS support status of the VPCs. @@ -52470,6 +59209,16 @@ type DescribeVpcEndpointServiceConfigurationsInput struct { // // * service-state - The state of the service (Pending | Available | Deleting // | Deleted | Failed). + // + // * tag: - The key/value combination of a tag assigned to the resource. + // Use the tag key in the filter name and the tag value as the filter value. + // For example, to find all resources that have a tag with the key Owner + // and the value TeamA, specify tag:Owner for the filter name and TeamA for + // the filter value. + // + // * tag-key - The key of a tag assigned to the resource. Use this filter + // to find all resources assigned a tag with a specific key, regardless of + // the tag value. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // The maximum number of results to return for the request in a single page. @@ -52691,6 +59440,16 @@ type DescribeVpcEndpointServicesInput struct { // One or more filters. // // * service-name: The name of the service. + // + // * tag: - The key/value combination of a tag assigned to the resource. + // Use the tag key in the filter name and the tag value as the filter value. + // For example, to find all resources that have a tag with the key Owner + // and the value TeamA, specify tag:Owner for the filter name and TeamA for + // the filter value. + // + // * tag-key - The key of a tag assigned to the resource. Use this filter + // to find all resources assigned a tag with a specific key, regardless of + // the tag value. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // The maximum number of items to return for this request. The request returns @@ -52811,6 +59570,16 @@ type DescribeVpcEndpointsInput struct { // // * vpc-endpoint-state: The state of the endpoint. (pending | available // | deleting | deleted) + // + // * tag: - The key/value combination of a tag assigned to the resource. + // Use the tag key in the filter name and the tag value as the filter value. + // For example, to find all resources that have a tag with the key Owner + // and the value TeamA, specify tag:Owner for the filter name and TeamA for + // the filter value. + // + // * tag-key - The key of a tag assigned to the resource. Use this filter + // to find all resources assigned a tag with a specific key, regardless of + // the tag value. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // The maximum number of items to return for this request. The request returns @@ -52949,6 +59718,13 @@ type DescribeVpcPeeringConnectionsInput struct { // * vpc-peering-connection-id - The ID of the VPC peering connection. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next page of results. + NextToken *string `type:"string"` + // One or more VPC peering connection IDs. // // Default: Describes all your VPC peering connections. @@ -52965,6 +59741,19 @@ func (s DescribeVpcPeeringConnectionsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeVpcPeeringConnectionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeVpcPeeringConnectionsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeVpcPeeringConnectionsInput) SetDryRun(v bool) *DescribeVpcPeeringConnectionsInput { s.DryRun = &v @@ -52977,6 +59766,18 @@ func (s *DescribeVpcPeeringConnectionsInput) SetFilters(v []*Filter) *DescribeVp return s } +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeVpcPeeringConnectionsInput) SetMaxResults(v int64) *DescribeVpcPeeringConnectionsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeVpcPeeringConnectionsInput) SetNextToken(v string) *DescribeVpcPeeringConnectionsInput { + s.NextToken = &v + return s +} + // SetVpcPeeringConnectionIds sets the VpcPeeringConnectionIds field's value. func (s *DescribeVpcPeeringConnectionsInput) SetVpcPeeringConnectionIds(v []*string) *DescribeVpcPeeringConnectionsInput { s.VpcPeeringConnectionIds = v @@ -52986,6 +59787,10 @@ func (s *DescribeVpcPeeringConnectionsInput) SetVpcPeeringConnectionIds(v []*str type DescribeVpcPeeringConnectionsOutput struct { _ struct{} `type:"structure"` + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + // Information about the VPC peering connections. VpcPeeringConnections []*VpcPeeringConnection `locationName:"vpcPeeringConnectionSet" locationNameList:"item" type:"list"` } @@ -53000,6 +59805,12 @@ func (s DescribeVpcPeeringConnectionsOutput) GoString() string { return s.String() } +// SetNextToken sets the NextToken field's value. +func (s *DescribeVpcPeeringConnectionsOutput) SetNextToken(v string) *DescribeVpcPeeringConnectionsOutput { + s.NextToken = &v + return s +} + // SetVpcPeeringConnections sets the VpcPeeringConnections field's value. func (s *DescribeVpcPeeringConnectionsOutput) SetVpcPeeringConnections(v []*VpcPeeringConnection) *DescribeVpcPeeringConnectionsOutput { s.VpcPeeringConnections = v @@ -53061,6 +59872,13 @@ type DescribeVpcsInput struct { // * vpc-id - The ID of the VPC. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + // The maximum number of results to return with a single call. To retrieve the + // remaining results, make another call with the returned nextToken value. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next page of results. + NextToken *string `type:"string"` + // One or more VPC IDs. // // Default: Describes all your VPCs. @@ -53077,6 +59895,19 @@ func (s DescribeVpcsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeVpcsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeVpcsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDryRun sets the DryRun field's value. func (s *DescribeVpcsInput) SetDryRun(v bool) *DescribeVpcsInput { s.DryRun = &v @@ -53089,6 +59920,18 @@ func (s *DescribeVpcsInput) SetFilters(v []*Filter) *DescribeVpcsInput { return s } +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeVpcsInput) SetMaxResults(v int64) *DescribeVpcsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeVpcsInput) SetNextToken(v string) *DescribeVpcsInput { + s.NextToken = &v + return s +} + // SetVpcIds sets the VpcIds field's value. func (s *DescribeVpcsInput) SetVpcIds(v []*string) *DescribeVpcsInput { s.VpcIds = v @@ -53098,6 +59941,10 @@ func (s *DescribeVpcsInput) SetVpcIds(v []*string) *DescribeVpcsInput { type DescribeVpcsOutput struct { _ struct{} `type:"structure"` + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + // Information about one or more VPCs. Vpcs []*Vpc `locationName:"vpcSet" locationNameList:"item" type:"list"` } @@ -53112,6 +59959,12 @@ func (s DescribeVpcsOutput) GoString() string { return s.String() } +// SetNextToken sets the NextToken field's value. +func (s *DescribeVpcsOutput) SetNextToken(v string) *DescribeVpcsOutput { + s.NextToken = &v + return s +} + // SetVpcs sets the Vpcs field's value. func (s *DescribeVpcsOutput) SetVpcs(v []*Vpc) *DescribeVpcsOutput { s.Vpcs = v @@ -53860,6 +60713,55 @@ func (s *DirectoryServiceAuthenticationRequest) SetDirectoryId(v string) *Direct return s } +type DisableEbsEncryptionByDefaultInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` +} + +// String returns the string representation +func (s DisableEbsEncryptionByDefaultInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisableEbsEncryptionByDefaultInput) GoString() string { + return s.String() +} + +// SetDryRun sets the DryRun field's value. +func (s *DisableEbsEncryptionByDefaultInput) SetDryRun(v bool) *DisableEbsEncryptionByDefaultInput { + s.DryRun = &v + return s +} + +type DisableEbsEncryptionByDefaultOutput struct { + _ struct{} `type:"structure"` + + // The updated status of encryption by default. + EbsEncryptionByDefault *bool `locationName:"ebsEncryptionByDefault" type:"boolean"` +} + +// String returns the string representation +func (s DisableEbsEncryptionByDefaultOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisableEbsEncryptionByDefaultOutput) GoString() string { + return s.String() +} + +// SetEbsEncryptionByDefault sets the EbsEncryptionByDefault field's value. +func (s *DisableEbsEncryptionByDefaultOutput) SetEbsEncryptionByDefault(v bool) *DisableEbsEncryptionByDefaultOutput { + s.EbsEncryptionByDefault = &v + return s +} + type DisableTransitGatewayRouteTablePropagationInput struct { _ struct{} `type:"structure"` @@ -54724,11 +61626,11 @@ type DiskImageDescription struct { // A presigned URL for the import manifest stored in Amazon S3. For information // about creating a presigned URL for an Amazon S3 object, read the "Query String // Request Authentication Alternative" section of the Authenticating REST Requests - // (http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) + // (https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // topic in the Amazon Simple Storage Service Developer Guide. // // For information about the import manifest referenced by this API action, - // see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). + // see VM Import Manifest (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). ImportManifestUrl *string `locationName:"importManifestUrl" type:"string"` // The size of the disk image, in GiB. @@ -54786,11 +61688,11 @@ type DiskImageDetail struct { // A presigned URL for the import manifest stored in Amazon S3 and presented // here as an Amazon S3 presigned URL. For information about creating a presigned // URL for an Amazon S3 object, read the "Query String Request Authentication - // Alternative" section of the Authenticating REST Requests (http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) + // Alternative" section of the Authenticating REST Requests (https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // topic in the Amazon Simple Storage Service Developer Guide. // // For information about the import manifest referenced by this API action, - // see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). + // see VM Import Manifest (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). // // ImportManifestUrl is a required field ImportManifestUrl *string `locationName:"importManifestUrl" type:"string" required:"true"` @@ -54952,43 +61854,44 @@ type EbsBlockDevice struct { // Indicates whether the EBS volume is deleted on instance termination. DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` - // Indicates whether the EBS volume is encrypted. Encrypted volumes can only - // be attached to instances that support Amazon EBS encryption. + // Indicates whether the encryption state of an EBS volume is changed while + // being restored from a backing snapshot. The effect of setting the encryption + // state to true depends on the volume origin (new or from a snapshot), starting + // encryption state, ownership, and whether encryption by default is enabled. + // For more information, see Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-parameters) + // in the Amazon Elastic Compute Cloud User Guide. // - // If you are creating a volume from a snapshot, you cannot specify an encryption - // value. This is because only blank volumes can be encrypted on creation. If - // you are creating a snapshot from an existing EBS volume, you cannot specify - // an encryption value that differs from that of the EBS volume. We recommend - // that you omit the encryption value from the block device mappings when creating - // an image from an instance. + // In no case can you remove encryption from an encrypted volume. + // + // Encrypted volumes can only be attached to instances that support Amazon EBS + // encryption. For more information, see Supported Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances). Encrypted *bool `locationName:"encrypted" type:"boolean"` // The number of I/O operations per second (IOPS) that the volume supports. - // For io1, this represents the number of IOPS that are provisioned for the - // volume. For gp2, this represents the baseline performance of the volume and - // the rate at which the volume accumulates I/O credits for bursting. For more - // information about General Purpose SSD baseline performance, I/O credits, - // and bursting, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // For io1 volumes, this represents the number of IOPS that are provisioned + // for the volume. For gp2 volumes, this represents the baseline performance + // of the volume and the rate at which the volume accumulates I/O credits for + // bursting. For more information, see Amazon EBS Volume Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) // in the Amazon Elastic Compute Cloud User Guide. // // Constraints: Range is 100-16,000 IOPS for gp2 volumes and 100 to 64,000IOPS - // for io1 volumes in most Regions. Maximum io1IOPS of 64,000 is guaranteed - // only on Nitro-based instances (AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances). + // for io1 volumes in most Regions. Maximum io1 IOPS of 64,000 is guaranteed + // only on Nitro-based instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances). // Other instance families guarantee performance up to 32,000 IOPS. For more - // information, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // information, see Amazon EBS Volume Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) // in the Amazon Elastic Compute Cloud User Guide. // // Condition: This parameter is required for requests to create io1 volumes; // it is not used in requests to create gp2, st1, sc1, or standard volumes. Iops *int64 `locationName:"iops" type:"integer"` - // Identifier (key ID, key alias, ID ARN, or alias ARN) for a user-managed CMK - // under which the EBS volume is encrypted. + // Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed + // CMK under which the EBS volume is encrypted. // // This parameter is only supported on BlockDeviceMapping objects called by - // RunInstances (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html), - // RequestSpotFleet (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html), - // and RequestSpotInstances (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html). + // RunInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html), + // RequestSpotFleet (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html), + // and RequestSpotInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html). KmsKeyId *string `type:"string"` // The ID of the snapshot. @@ -54996,17 +61899,17 @@ type EbsBlockDevice struct { // The size of the volume, in GiB. // + // Default: If you're creating the volume from a snapshot and don't specify + // a volume size, the default is the snapshot size. + // // Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned // IOPS SSD (io1), 500-16384 for Throughput Optimized HDD (st1), 500-16384 for // Cold HDD (sc1), and 1-1024 for Magnetic (standard) volumes. If you specify // a snapshot, the volume size must be equal to or larger than the snapshot // size. - // - // Default: If you're creating the volume from a snapshot and don't specify - // a volume size, the default is the snapshot size. VolumeSize *int64 `locationName:"volumeSize" type:"integer"` - // The volume type: gp2, io1, st1, sc1, or standard. + // The volume type. If you set the type to io1, you must also set the Iops property. // // Default: standard VolumeType *string `locationName:"volumeType" type:"string" enum:"VolumeType"` @@ -55482,6 +62385,55 @@ func (s *ElasticInferenceAcceleratorAssociation) SetElasticInferenceAcceleratorA return s } +type EnableEbsEncryptionByDefaultInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` +} + +// String returns the string representation +func (s EnableEbsEncryptionByDefaultInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnableEbsEncryptionByDefaultInput) GoString() string { + return s.String() +} + +// SetDryRun sets the DryRun field's value. +func (s *EnableEbsEncryptionByDefaultInput) SetDryRun(v bool) *EnableEbsEncryptionByDefaultInput { + s.DryRun = &v + return s +} + +type EnableEbsEncryptionByDefaultOutput struct { + _ struct{} `type:"structure"` + + // The updated status of encryption by default. + EbsEncryptionByDefault *bool `locationName:"ebsEncryptionByDefault" type:"boolean"` +} + +// String returns the string representation +func (s EnableEbsEncryptionByDefaultOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnableEbsEncryptionByDefaultOutput) GoString() string { + return s.String() +} + +// SetEbsEncryptionByDefault sets the EbsEncryptionByDefault field's value. +func (s *EnableEbsEncryptionByDefaultOutput) SetEbsEncryptionByDefault(v bool) *EnableEbsEncryptionByDefaultOutput { + s.EbsEncryptionByDefault = &v + return s +} + type EnableTransitGatewayRouteTablePropagationInput struct { _ struct{} `type:"structure"` @@ -55573,12 +62525,15 @@ func (s *EnableTransitGatewayRouteTablePropagationOutput) SetPropagation(v *Tran type EnableVgwRoutePropagationInput struct { _ struct{} `type:"structure"` - // The ID of the virtual private gateway. + // The ID of the virtual private gateway that is attached to a VPC. The virtual + // private gateway must be attached to the same VPC that the routing tables + // are associated with. // // GatewayId is a required field GatewayId *string `type:"string" required:"true"` - // The ID of the route table. + // The ID of the route table. The routing table must be associated with the + // same VPC that the virtual private gateway is attached to. // // RouteTableId is a required field RouteTableId *string `type:"string" required:"true"` @@ -55820,7 +62775,7 @@ func (s *EnableVpcClassicLinkOutput) SetReturn(v bool) *EnableVpcClassicLinkOutp return s } -// Describes a Spot Fleet event. +// Describes an EC2 Fleet or Spot Fleet event. type EventInformation struct { _ struct{} `type:"structure"` @@ -55831,12 +62786,8 @@ type EventInformation struct { // // The following are the error events: // - // * iamFleetRoleInvalid - The Spot Fleet did not have the required permissions - // either to launch or terminate an instance. - // - // * launchSpecTemporarilyBlacklisted - The configuration is not valid and - // several attempts to launch instances have failed. For more information, - // see the description of the event. + // * iamFleetRoleInvalid - The EC2 Fleet or Spot Fleet did not have the required + // permissions either to launch or terminate an instance. // // * spotFleetRequestConfigurationInvalid - The configuration is not valid. // For more information, see the description of the event. @@ -55846,33 +62797,35 @@ type EventInformation struct { // // The following are the fleetRequestChange events: // - // * active - The Spot Fleet has been validated and Amazon EC2 is attempting - // to maintain the target number of running Spot Instances. + // * active - The EC2 Fleet or Spot Fleet request has been validated and + // Amazon EC2 is attempting to maintain the target number of running Spot + // Instances. // - // * cancelled - The Spot Fleet is canceled and has no running Spot Instances. - // The Spot Fleet will be deleted two days after its instances were terminated. + // * cancelled - The EC2 Fleet or Spot Fleet request is canceled and has + // no running Spot Instances. The EC2 Fleet or Spot Fleet will be deleted + // two days after its instances were terminated. // - // * cancelled_running - The Spot Fleet is canceled and does not launch additional - // Spot Instances. Existing Spot Instances continue to run until they are - // interrupted or terminated. + // * cancelled_running - The EC2 Fleet or Spot Fleet request is canceled + // and does not launch additional Spot Instances. Existing Spot Instances + // continue to run until they are interrupted or terminated. // - // * cancelled_terminating - The Spot Fleet is canceled and its Spot Instances - // are terminating. + // * cancelled_terminating - The EC2 Fleet or Spot Fleet request is canceled + // and its Spot Instances are terminating. // - // * expired - The Spot Fleet request has expired. A subsequent event indicates - // that the instances were terminated, if the request was created with TerminateInstancesWithExpiration - // set. + // * expired - The EC2 Fleet or Spot Fleet request has expired. A subsequent + // event indicates that the instances were terminated, if the request was + // created with TerminateInstancesWithExpiration set. // - // * modify_in_progress - A request to modify the Spot Fleet request was - // accepted and is in progress. + // * modify_in_progress - A request to modify the EC2 Fleet or Spot Fleet + // request was accepted and is in progress. // - // * modify_successful - The Spot Fleet request was modified. + // * modify_successful - The EC2 Fleet or Spot Fleet request was modified. // // * price_update - The price for a launch configuration was adjusted because // it was too high. This change is permanent. // - // * submitted - The Spot Fleet request is being evaluated and Amazon EC2 - // is preparing to launch the target number of Spot Instances. + // * submitted - The EC2 Fleet or Spot Fleet request is being evaluated and + // Amazon EC2 is preparing to launch the target number of Spot Instances. // // The following are the instanceChange events: // @@ -55882,6 +62835,10 @@ type EventInformation struct { // // The following are the Information events: // + // * launchSpecTemporarilyBlacklisted - The configuration is not valid and + // several attempts to launch instances have failed. For more information, + // see the description of the event. + // // * launchSpecUnusable - The price in a launch specification is not valid // because it is below the Spot price or the Spot price is above the On-Demand // price. @@ -56265,16 +63222,31 @@ type ExportTransitGatewayRoutesInput struct { // One or more filters. The possible values are: // - // * transit-gateway-route-destination-cidr-block - The CIDR range. - // - // * transit-gateway-route-state - The state of the route (active | blackhole). - // - // * transit-gateway-route-transit-gateway-attachment-id - The ID of the + // * attachment.transit-gateway-attachment-id - The id of the transit gateway // attachment. // - // * transit-gateway-route-type - The route type (static | propagated). + // * attachment.resource-id - The resource id of the transit gateway attachment. // - // * transit-gateway-route-vpn-connection-id - The ID of the VPN connection. + // * route-search.exact-match - The exact match of the specified filter. + // + // * route-search.longest-prefix-match - The longest prefix that matches + // the route. + // + // * route-search.subnet-of-match - The routes with a subnet that match the + // specified CIDR filter. + // + // * route-search.supernet-of-match - The routes with a CIDR that encompass + // the CIDR filter. For example, if you have 10.0.1.0/29 and 10.0.1.0/31 + // routes in your route table and you specify supernet-of-match as 10.0.1.0/30, + // then the result returns 10.0.1.0/29. + // + // * state - The state of the attachment (available | deleted | deleting + // | failed | modifying | pendingAcceptance | pending | rollingBack | rejected + // | rejecting). + // + // * transit-gateway-route-destination-cidr-block - The CIDR range. + // + // * type - The type of route (active | blackhole). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // The name of the S3 bucket. @@ -56392,7 +63364,7 @@ type Filter struct { // The name of the filter. Filter names are case-sensitive. Name *string `type:"string"` - // One or more filter values. Filter values are case-sensitive. + // The filter values. Filter values are case-sensitive. Values []*string `locationName:"Value" locationNameList:"item" type:"list"` } @@ -56430,7 +63402,7 @@ type FleetData struct { ActivityStatus *string `locationName:"activityStatus" type:"string" enum:"FleetActivityStatus"` // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // the request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). // // Constraints: Maximum 64 ASCII characters ClientToken *string `locationName:"clientToken" type:"string"` @@ -56958,7 +63930,8 @@ type FleetLaunchTemplateSpecificationRequest struct { // The name of the launch template. LaunchTemplateName *string `min:"3" type:"string"` - // The version number of the launch template. + // The version number of the launch template. Note: This is a required parameter + // and will be updated soon. Version *string `type:"string"` } @@ -57135,6 +64108,9 @@ type FpgaImage struct { // The date and time the AFI was created. CreateTime *time.Time `locationName:"createTime" type:"timestamp"` + // Indicates whether data retention support is enabled for the AFI. + DataRetentionSupport *bool `locationName:"dataRetentionSupport" type:"boolean"` + // The description of the AFI. Description *string `locationName:"description" type:"string"` @@ -57191,6 +64167,12 @@ func (s *FpgaImage) SetCreateTime(v time.Time) *FpgaImage { return s } +// SetDataRetentionSupport sets the DataRetentionSupport field's value. +func (s *FpgaImage) SetDataRetentionSupport(v bool) *FpgaImage { + s.DataRetentionSupport = &v + return s +} + // SetDescription sets the Description field's value. func (s *FpgaImage) SetDescription(v string) *FpgaImage { s.Description = &v @@ -57279,13 +64261,13 @@ type FpgaImageAttribute struct { // The ID of the AFI. FpgaImageId *string `locationName:"fpgaImageId" type:"string"` - // One or more load permissions. + // The load permissions. LoadPermissions []*LoadPermission `locationName:"loadPermissions" locationNameList:"item" type:"list"` // The name of the AFI. Name *string `locationName:"name" type:"string"` - // One or more product codes. + // The product codes. ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` } @@ -57371,6 +64353,139 @@ func (s *FpgaImageState) SetMessage(v string) *FpgaImageState { return s } +type GetCapacityReservationUsageInput struct { + _ struct{} `type:"structure"` + + // CapacityReservationId is a required field + CapacityReservationId *string `type:"string" required:"true"` + + DryRun *bool `type:"boolean"` + + MaxResults *int64 `min:"1" type:"integer"` + + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s GetCapacityReservationUsageInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCapacityReservationUsageInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetCapacityReservationUsageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetCapacityReservationUsageInput"} + if s.CapacityReservationId == nil { + invalidParams.Add(request.NewErrParamRequired("CapacityReservationId")) + } + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetCapacityReservationId sets the CapacityReservationId field's value. +func (s *GetCapacityReservationUsageInput) SetCapacityReservationId(v string) *GetCapacityReservationUsageInput { + s.CapacityReservationId = &v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *GetCapacityReservationUsageInput) SetDryRun(v bool) *GetCapacityReservationUsageInput { + s.DryRun = &v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *GetCapacityReservationUsageInput) SetMaxResults(v int64) *GetCapacityReservationUsageInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *GetCapacityReservationUsageInput) SetNextToken(v string) *GetCapacityReservationUsageInput { + s.NextToken = &v + return s +} + +type GetCapacityReservationUsageOutput struct { + _ struct{} `type:"structure"` + + AvailableInstanceCount *int64 `locationName:"availableInstanceCount" type:"integer"` + + CapacityReservationId *string `locationName:"capacityReservationId" type:"string"` + + InstanceType *string `locationName:"instanceType" type:"string"` + + InstanceUsages []*InstanceUsage `locationName:"instanceUsageSet" locationNameList:"item" type:"list"` + + NextToken *string `locationName:"nextToken" type:"string"` + + State *string `locationName:"state" type:"string" enum:"CapacityReservationState"` + + TotalInstanceCount *int64 `locationName:"totalInstanceCount" type:"integer"` +} + +// String returns the string representation +func (s GetCapacityReservationUsageOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCapacityReservationUsageOutput) GoString() string { + return s.String() +} + +// SetAvailableInstanceCount sets the AvailableInstanceCount field's value. +func (s *GetCapacityReservationUsageOutput) SetAvailableInstanceCount(v int64) *GetCapacityReservationUsageOutput { + s.AvailableInstanceCount = &v + return s +} + +// SetCapacityReservationId sets the CapacityReservationId field's value. +func (s *GetCapacityReservationUsageOutput) SetCapacityReservationId(v string) *GetCapacityReservationUsageOutput { + s.CapacityReservationId = &v + return s +} + +// SetInstanceType sets the InstanceType field's value. +func (s *GetCapacityReservationUsageOutput) SetInstanceType(v string) *GetCapacityReservationUsageOutput { + s.InstanceType = &v + return s +} + +// SetInstanceUsages sets the InstanceUsages field's value. +func (s *GetCapacityReservationUsageOutput) SetInstanceUsages(v []*InstanceUsage) *GetCapacityReservationUsageOutput { + s.InstanceUsages = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *GetCapacityReservationUsageOutput) SetNextToken(v string) *GetCapacityReservationUsageOutput { + s.NextToken = &v + return s +} + +// SetState sets the State field's value. +func (s *GetCapacityReservationUsageOutput) SetState(v string) *GetCapacityReservationUsageOutput { + s.State = &v + return s +} + +// SetTotalInstanceCount sets the TotalInstanceCount field's value. +func (s *GetCapacityReservationUsageOutput) SetTotalInstanceCount(v int64) *GetCapacityReservationUsageOutput { + s.TotalInstanceCount = &v + return s +} + type GetConsoleOutputInput struct { _ struct{} `type:"structure"` @@ -57566,6 +64681,104 @@ func (s *GetConsoleScreenshotOutput) SetInstanceId(v string) *GetConsoleScreensh return s } +type GetEbsDefaultKmsKeyIdInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` +} + +// String returns the string representation +func (s GetEbsDefaultKmsKeyIdInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetEbsDefaultKmsKeyIdInput) GoString() string { + return s.String() +} + +// SetDryRun sets the DryRun field's value. +func (s *GetEbsDefaultKmsKeyIdInput) SetDryRun(v bool) *GetEbsDefaultKmsKeyIdInput { + s.DryRun = &v + return s +} + +type GetEbsDefaultKmsKeyIdOutput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the default CMK for encryption by default. + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` +} + +// String returns the string representation +func (s GetEbsDefaultKmsKeyIdOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetEbsDefaultKmsKeyIdOutput) GoString() string { + return s.String() +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *GetEbsDefaultKmsKeyIdOutput) SetKmsKeyId(v string) *GetEbsDefaultKmsKeyIdOutput { + s.KmsKeyId = &v + return s +} + +type GetEbsEncryptionByDefaultInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` +} + +// String returns the string representation +func (s GetEbsEncryptionByDefaultInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetEbsEncryptionByDefaultInput) GoString() string { + return s.String() +} + +// SetDryRun sets the DryRun field's value. +func (s *GetEbsEncryptionByDefaultInput) SetDryRun(v bool) *GetEbsEncryptionByDefaultInput { + s.DryRun = &v + return s +} + +type GetEbsEncryptionByDefaultOutput struct { + _ struct{} `type:"structure"` + + // Indicates whether encryption by default is enabled. + EbsEncryptionByDefault *bool `locationName:"ebsEncryptionByDefault" type:"boolean"` +} + +// String returns the string representation +func (s GetEbsEncryptionByDefaultOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetEbsEncryptionByDefaultOutput) GoString() string { + return s.String() +} + +// SetEbsEncryptionByDefault sets the EbsEncryptionByDefault field's value. +func (s *GetEbsEncryptionByDefaultOutput) SetEbsEncryptionByDefault(v bool) *GetEbsEncryptionByDefaultOutput { + s.EbsEncryptionByDefault = &v + return s +} + type GetHostReservationPurchasePreviewInput struct { _ struct{} `type:"structure"` @@ -58393,9 +65606,9 @@ func (s *GroupIdentifier) SetGroupName(v string) *GroupIdentifier { } // Indicates whether your instance is configured for hibernation. This parameter -// is valid only if the instance meets the hibernation prerequisites (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). +// is valid only if the instance meets the hibernation prerequisites (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). // Hibernation is currently supported only for Amazon Linux. For more information, -// see Hibernate Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) +// see Hibernate Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) // in the Amazon Elastic Compute Cloud User Guide. type HibernationOptions struct { _ struct{} `type:"structure"` @@ -58422,9 +65635,9 @@ func (s *HibernationOptions) SetConfigured(v bool) *HibernationOptions { } // Indicates whether your instance is configured for hibernation. This parameter -// is valid only if the instance meets the hibernation prerequisites (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). +// is valid only if the instance meets the hibernation prerequisites (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). // Hibernation is currently supported only for Amazon Linux. For more information, -// see Hibernate Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) +// see Hibernate Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) // in the Amazon Elastic Compute Cloud User Guide. type HibernationOptionsRequest struct { _ struct{} `type:"structure"` @@ -58560,9 +65773,8 @@ type Host struct { // The number of new instances that can be launched onto the Dedicated Host. AvailableCapacity *AvailableCapacity `locationName:"availableCapacity" type:"structure"` - // Unique, case-sensitive identifier that you provide to ensure idempotency - // of the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) - // in the Amazon Elastic Compute Cloud User Guide. + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` // The ID of the Dedicated Host. @@ -58571,6 +65783,10 @@ type Host struct { // The hardware specifications of the Dedicated Host. HostProperties *HostProperties `locationName:"hostProperties" type:"structure"` + // Indicates whether host recovery is enabled or disabled for the Dedicated + // Host. + HostRecovery *string `locationName:"hostRecovery" type:"string" enum:"HostRecovery"` + // The reservation ID of the Dedicated Host. This returns a null response if // the Dedicated Host doesn't have an associated reservation. HostReservationId *string `locationName:"hostReservationId" type:"string"` @@ -58640,6 +65856,12 @@ func (s *Host) SetHostProperties(v *HostProperties) *Host { return s } +// SetHostRecovery sets the HostRecovery field's value. +func (s *Host) SetHostRecovery(v string) *Host { + s.HostRecovery = &v + return s +} + // SetHostReservationId sets the HostReservationId field's value. func (s *Host) SetHostReservationId(v string) *Host { s.HostReservationId = &v @@ -58877,6 +66099,9 @@ type HostReservation struct { // The state of the reservation. State *string `locationName:"state" type:"string" enum:"ReservationState"` + // Any tags assigned to the Dedicated Host Reservation. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + // The upfront price of the reservation. UpfrontPrice *string `locationName:"upfrontPrice" type:"string"` } @@ -58963,6 +66188,12 @@ func (s *HostReservation) SetState(v string) *HostReservation { return s } +// SetTags sets the Tags field's value. +func (s *HostReservation) SetTags(v []*Tag) *HostReservation { + s.Tags = v + return s +} + // SetUpfrontPrice sets the UpfrontPrice field's value. func (s *HostReservation) SetUpfrontPrice(v string) *HostReservation { s.UpfrontPrice = &v @@ -59217,7 +66448,7 @@ type Image struct { // The AWS account ID of the image owner. OwnerId *string `locationName:"imageOwnerId" type:"string"` - // The value is Windows for Windows AMIs; otherwise blank. + // This value is set to windows for Windows AMIs; otherwise, it is blank. Platform *string `locationName:"platform" type:"string" enum:"PlatformValues"` // Any product codes associated with the AMI. @@ -59487,8 +66718,8 @@ type ImportClientVpnClientCertificateRevocationListInput struct { _ struct{} `type:"structure"` // The client certificate revocation list file. For more information, see Generate - // a Client Certificate Revocation List (vpn/latest/clientvpn-admin/cvpn-working-certificates.html#cvpn-working-certificates-generate) - // in the AWS Client VPN Admin Guide. + // a Client Certificate Revocation List (https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/cvpn-working-certificates.html#cvpn-working-certificates-generate) + // in the AWS Client VPN Administrator Guide. // // CertificateRevocationList is a required field CertificateRevocationList *string `type:"string" required:"true"` @@ -59573,13 +66804,12 @@ func (s *ImportClientVpnClientCertificateRevocationListOutput) SetReturn(v bool) return s } -// Contains the parameters for ImportImage. type ImportImageInput struct { _ struct{} `type:"structure"` // The architecture of the virtual machine. // - // Valid values: i386 | x86_64 + // Valid values: i386 | x86_64 | arm64 Architecture *string `type:"string"` // The client-specific data. @@ -59603,7 +66833,7 @@ type ImportImageInput struct { // Specifies whether the destination AMI of the imported image should be encrypted. // The default CMK for EBS is used unless you specify a non-default AWS Key // Management Service (AWS KMS) CMK using KmsKeyId. For more information, see - // Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) + // Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) // in the Amazon Elastic Compute Cloud User Guide. Encrypted *bool `type:"boolean"` @@ -59622,32 +66852,36 @@ type ImportImageInput struct { // // * Key ID // - // * Key alias, in the form alias/ExampleAlias + // * Key alias. The alias ARN contains the arn:aws:kms namespace, followed + // by the Region of the CMK, the AWS account ID of the CMK owner, the alias + // namespace, and then the CMK alias. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. // // * ARN using key ID. The ID ARN contains the arn:aws:kms namespace, followed - // by the region of the CMK, the AWS account ID of the CMK owner, the key + // by the Region of the CMK, the AWS account ID of the CMK owner, the key // namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. // // * ARN using key alias. The alias ARN contains the arn:aws:kms namespace, - // followed by the region of the CMK, the AWS account ID of the CMK owner, + // followed by the Region of the CMK, the AWS account ID of the CMK owner, // the alias namespace, and then the CMK alias. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. // - // // AWS parses KmsKeyId asynchronously, meaning that the action you call may // appear to complete even though you provided an invalid identifier. This action // will eventually report failure. // - // The specified CMK must exist in the region that the AMI is being copied to. + // The specified CMK must exist in the Region that the AMI is being copied to. KmsKeyId *string `type:"string"` // The license type to be used for the Amazon Machine Image (AMI) after importing. // - // Note: You may only use BYOL if you have existing licenses with rights to - // use these licenses in a third party cloud like AWS. For more information, - // see Prerequisites (http://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html#prerequisites-image) - // in the VM Import/Export User Guide. + // By default, we detect the source-system operating system (OS) and apply the + // appropriate license. Specify AWS to replace the source-system license with + // an AWS license, if appropriate. Specify BYOL to retain the source-system + // license, if appropriate. // - // Valid values: AWS | BYOL + // To use BYOL, you must have existing licenses with rights to use these licenses + // in a third party cloud, such as AWS. For more information, see Prerequisites + // (https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html#prerequisites-image) + // in the VM Import/Export User Guide. LicenseType *string `type:"string"` // The operating system of the virtual machine. @@ -59741,7 +66975,6 @@ func (s *ImportImageInput) SetRoleName(v string) *ImportImageInput { return s } -// Contains the output for ImportImage. type ImportImageOutput struct { _ struct{} `type:"structure"` @@ -59880,7 +67113,7 @@ type ImportImageTask struct { // The architecture of the virtual machine. // - // Valid values: i386 | x86_64 + // Valid values: i386 | x86_64 | arm64 Architecture *string `locationName:"architecture" type:"string"` // A description of the import task. @@ -60011,7 +67244,6 @@ func (s *ImportImageTask) SetStatusMessage(v string) *ImportImageTask { return s } -// Contains the parameters for ImportInstance. type ImportInstanceInput struct { _ struct{} `type:"structure"` @@ -60109,10 +67341,10 @@ type ImportInstanceLaunchSpecification struct { // The architecture of the instance. Architecture *string `locationName:"architecture" type:"string" enum:"ArchitectureValues"` - // One or more security group IDs. + // The security group IDs. GroupIds []*string `locationName:"GroupId" locationNameList:"SecurityGroupId" type:"list"` - // One or more security group names. + // The security group names. GroupNames []*string `locationName:"GroupName" locationNameList:"SecurityGroup" type:"list"` // Indicates whether an instance stops or terminates when you initiate shutdown @@ -60120,7 +67352,7 @@ type ImportInstanceLaunchSpecification struct { InstanceInitiatedShutdownBehavior *string `locationName:"instanceInitiatedShutdownBehavior" type:"string" enum:"ShutdownBehavior"` // The instance type. For more information about the instance types that you - // can import, see Instance Types (http://docs.aws.amazon.com/vm-import/latest/userguide/vmie_prereqs.html#vmimport-instance-types) + // can import, see Instance Types (https://docs.aws.amazon.com/vm-import/latest/userguide/vmie_prereqs.html#vmimport-instance-types) // in the VM Import/Export User Guide. InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` @@ -60216,7 +67448,6 @@ func (s *ImportInstanceLaunchSpecification) SetUserData(v *UserData) *ImportInst return s } -// Contains the output for ImportInstance. type ImportInstanceOutput struct { _ struct{} `type:"structure"` @@ -60253,7 +67484,7 @@ type ImportInstanceTaskDetails struct { // The instance operating system. Platform *string `locationName:"platform" type:"string" enum:"PlatformValues"` - // One or more volumes. + // The volumes. Volumes []*ImportInstanceVolumeDetailItem `locationName:"volumes" locationNameList:"item" type:"list"` } @@ -60468,7 +67699,6 @@ func (s *ImportKeyPairOutput) SetKeyName(v string) *ImportKeyPairOutput { return s } -// Contains the parameters for ImportSnapshot. type ImportSnapshotInput struct { _ struct{} `type:"structure"` @@ -60493,7 +67723,7 @@ type ImportSnapshotInput struct { // Specifies whether the destination snapshot of the imported image should be // encrypted. The default CMK for EBS is used unless you specify a non-default // AWS Key Management Service (AWS KMS) CMK using KmsKeyId. For more information, - // see Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) + // see Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) // in the Amazon Elastic Compute Cloud User Guide. Encrypted *bool `type:"boolean"` @@ -60507,22 +67737,23 @@ type ImportSnapshotInput struct { // // * Key ID // - // * Key alias, in the form alias/ExampleAlias + // * Key alias. The alias ARN contains the arn:aws:kms namespace, followed + // by the Region of the CMK, the AWS account ID of the CMK owner, the alias + // namespace, and then the CMK alias. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. // // * ARN using key ID. The ID ARN contains the arn:aws:kms namespace, followed - // by the region of the CMK, the AWS account ID of the CMK owner, the key + // by the Region of the CMK, the AWS account ID of the CMK owner, the key // namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. // // * ARN using key alias. The alias ARN contains the arn:aws:kms namespace, - // followed by the region of the CMK, the AWS account ID of the CMK owner, + // followed by the Region of the CMK, the AWS account ID of the CMK owner, // the alias namespace, and then the CMK alias. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. // - // // AWS parses KmsKeyId asynchronously, meaning that the action you call may // appear to complete even though you provided an invalid identifier. This action // will eventually report failure. // - // The specified CMK must exist in the region that the snapshot is being copied + // The specified CMK must exist in the Region that the snapshot is being copied // to. KmsKeyId *string `type:"string"` @@ -60588,7 +67819,6 @@ func (s *ImportSnapshotInput) SetRoleName(v string) *ImportSnapshotInput { return s } -// Contains the output for ImportSnapshot. type ImportSnapshotOutput struct { _ struct{} `type:"structure"` @@ -60672,7 +67902,6 @@ func (s *ImportSnapshotTask) SetSnapshotTaskDetail(v *SnapshotTaskDetail) *Impor return s } -// Contains the parameters for ImportVolume. type ImportVolumeInput struct { _ struct{} `type:"structure"` @@ -60770,7 +67999,6 @@ func (s *ImportVolumeInput) SetVolume(v *VolumeDetail) *ImportVolumeInput { return s } -// Contains the output for ImportVolume. type ImportVolumeOutput struct { _ struct{} `type:"structure"` @@ -60933,7 +68161,7 @@ type Instance struct { // The monitoring for the instance. Monitoring *Monitoring `locationName:"monitoring" type:"structure"` - // [EC2-VPC] One or more network interfaces for the instance. + // [EC2-VPC] The network interfaces for the instance. NetworkInterfaces []*InstanceNetworkInterface `locationName:"networkInterfaceSet" locationNameList:"item" type:"list"` // The location where the instance launched, if applicable. @@ -60976,14 +68204,14 @@ type Instance struct { // instance store volume. RootDeviceType *string `locationName:"rootDeviceType" type:"string" enum:"DeviceType"` - // One or more security groups for the instance. + // The security groups for the instance. SecurityGroups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` // Specifies whether to enable an instance launched in a VPC to perform NAT. // This controls whether source/destination checking is enabled on the instance. // A value of true means that checking is enabled, and false means that checking // is disabled. The value must be false for the instance to perform NAT. For - // more information, see NAT Instances (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html) + // more information, see NAT Instances (https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html) // in the Amazon Virtual Private Cloud User Guide. SourceDestCheck *bool `locationName:"sourceDestCheck" type:"boolean"` @@ -61689,6 +68917,11 @@ type InstanceNetworkInterface struct { // One or more security groups. Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` + // Describes the type of network interface. + // + // Valid values: interface | efa + InterfaceType *string `locationName:"interfaceType" type:"string"` + // One or more IPv6 addresses associated with the network interface. Ipv6Addresses []*InstanceIpv6Address `locationName:"ipv6AddressesSet" locationNameList:"item" type:"list"` @@ -61757,6 +68990,12 @@ func (s *InstanceNetworkInterface) SetGroups(v []*GroupIdentifier) *InstanceNetw return s } +// SetInterfaceType sets the InterfaceType field's value. +func (s *InstanceNetworkInterface) SetInterfaceType(v string) *InstanceNetworkInterface { + s.InterfaceType = &v + return s +} + // SetIpv6Addresses sets the Ipv6Addresses field's value. func (s *InstanceNetworkInterface) SetIpv6Addresses(v []*InstanceIpv6Address) *InstanceNetworkInterface { s.Ipv6Addresses = v @@ -61945,15 +69184,26 @@ type InstanceNetworkInterfaceSpecification struct { // interface when launching an instance. Description *string `locationName:"description" type:"string"` - // The index of the device on the instance for the network interface attachment. - // If you are specifying a network interface in a RunInstances request, you - // must provide the device index. + // The position of the network interface in the attachment order. A primary + // network interface has a device index of 0. + // + // If you specify a network interface when launching an instance, you must specify + // the device index. DeviceIndex *int64 `locationName:"deviceIndex" type:"integer"` // The IDs of the security groups for the network interface. Applies only if // creating a network interface when launching an instance. Groups []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` + // The type of network interface. To create an Elastic Fabric Adapter (EFA), + // specify efa. For more information, see Elastic Fabric Adapter (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html) + // in the Amazon Elastic Compute Cloud User Guide. + // + // If you are not creating an EFA, specify interface or omit this parameter. + // + // Valid values: interface | efa + InterfaceType *string `type:"string"` + // A number of IPv6 addresses to assign to the network interface. Amazon EC2 // chooses the IPv6 addresses from the range of the subnet. You cannot specify // this option and the option to assign specific IPv6 addresses in the same @@ -61972,19 +69222,22 @@ type InstanceNetworkInterfaceSpecification struct { // The private IPv4 address of the network interface. Applies only if creating // a network interface when launching an instance. You cannot specify this option - // if you're launching more than one instance in a RunInstances request. + // if you're launching more than one instance in a RunInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html) + // request. PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // One or more private IPv4 addresses to assign to the network interface. Only // one private IPv4 address can be designated as primary. You cannot specify // this option if you're launching more than one instance in a RunInstances + // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html) // request. PrivateIpAddresses []*PrivateIpAddressSpecification `locationName:"privateIpAddressesSet" queryName:"PrivateIpAddresses" locationNameList:"item" type:"list"` // The number of secondary private IPv4 addresses. You can't specify this option // and specify more than one private IP address using the private IP addresses // option. You cannot specify this option if you're launching more than one - // instance in a RunInstances request. + // instance in a RunInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html) + // request. SecondaryPrivateIpAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` // The ID of the subnet associated with the network string. Applies only if @@ -62032,6 +69285,12 @@ func (s *InstanceNetworkInterfaceSpecification) SetGroups(v []*string) *Instance return s } +// SetInterfaceType sets the InterfaceType field's value. +func (s *InstanceNetworkInterfaceSpecification) SetInterfaceType(v string) *InstanceNetworkInterfaceSpecification { + s.InterfaceType = &v + return s +} + // SetIpv6AddressCount sets the Ipv6AddressCount field's value. func (s *InstanceNetworkInterfaceSpecification) SetIpv6AddressCount(v int64) *InstanceNetworkInterfaceSpecification { s.Ipv6AddressCount = &v @@ -62126,12 +69385,54 @@ func (s *InstancePrivateIpAddress) SetPrivateIpAddress(v string) *InstancePrivat return s } +// The instance details to specify which volumes should be snapshotted. +type InstanceSpecification struct { + _ struct{} `type:"structure"` + + // Excludes the root volume from being snapshotted. + ExcludeBootVolume *bool `type:"boolean"` + + // The instance to specify which volumes should be snapshotted. + InstanceId *string `type:"string"` +} + +// String returns the string representation +func (s InstanceSpecification) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceSpecification) GoString() string { + return s.String() +} + +// SetExcludeBootVolume sets the ExcludeBootVolume field's value. +func (s *InstanceSpecification) SetExcludeBootVolume(v bool) *InstanceSpecification { + s.ExcludeBootVolume = &v + return s +} + +// SetInstanceId sets the InstanceId field's value. +func (s *InstanceSpecification) SetInstanceId(v string) *InstanceSpecification { + s.InstanceId = &v + return s +} + // Describes the current state of an instance. type InstanceState struct { _ struct{} `type:"structure"` - // The low byte represents the state. The high byte is used for internal purposes - // and should be ignored. + // The state of the instance as a 16-bit unsigned integer. + // + // The high byte is all of the bits between 2^8 and (2^16)-1, which equals decimal + // values between 256 and 65,535. These numerical values are used for internal + // purposes and should be ignored. + // + // The low byte is all of the bits between 2^0 and (2^8)-1, which equals decimal + // values between 0 and 255. + // + // The valid values for instance-state-code will all be in the range of the + // low byte and they are: // // * 0 : pending // @@ -62144,6 +69445,9 @@ type InstanceState struct { // * 64 : stopping // // * 80 : stopped + // + // You can ignore the high byte value by zeroing out all of the bits above 2^8 + // or 256 in decimal. Code *int64 `locationName:"code" type:"integer"` // The current state of the instance. @@ -62344,11 +69648,17 @@ type InstanceStatusEvent struct { // following text: [Completed]. Description *string `locationName:"description" type:"string"` + // The ID of the event. + InstanceEventId *string `locationName:"instanceEventId" type:"string"` + // The latest scheduled end time for the event. NotAfter *time.Time `locationName:"notAfter" type:"timestamp"` // The earliest scheduled start time for the event. NotBefore *time.Time `locationName:"notBefore" type:"timestamp"` + + // The deadline for starting the event. + NotBeforeDeadline *time.Time `locationName:"notBeforeDeadline" type:"timestamp"` } // String returns the string representation @@ -62373,6 +69683,12 @@ func (s *InstanceStatusEvent) SetDescription(v string) *InstanceStatusEvent { return s } +// SetInstanceEventId sets the InstanceEventId field's value. +func (s *InstanceStatusEvent) SetInstanceEventId(v string) *InstanceStatusEvent { + s.InstanceEventId = &v + return s +} + // SetNotAfter sets the NotAfter field's value. func (s *InstanceStatusEvent) SetNotAfter(v time.Time) *InstanceStatusEvent { s.NotAfter = &v @@ -62385,6 +69701,12 @@ func (s *InstanceStatusEvent) SetNotBefore(v time.Time) *InstanceStatusEvent { return s } +// SetNotBeforeDeadline sets the NotBeforeDeadline field's value. +func (s *InstanceStatusEvent) SetNotBeforeDeadline(v time.Time) *InstanceStatusEvent { + s.NotBeforeDeadline = &v + return s +} + // Describes the status of an instance. type InstanceStatusSummary struct { _ struct{} `type:"structure"` @@ -62418,6 +69740,36 @@ func (s *InstanceStatusSummary) SetStatus(v string) *InstanceStatusSummary { return s } +type InstanceUsage struct { + _ struct{} `type:"structure"` + + AccountId *string `locationName:"accountId" type:"string"` + + UsedInstanceCount *int64 `locationName:"usedInstanceCount" type:"integer"` +} + +// String returns the string representation +func (s InstanceUsage) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceUsage) GoString() string { + return s.String() +} + +// SetAccountId sets the AccountId field's value. +func (s *InstanceUsage) SetAccountId(v string) *InstanceUsage { + s.AccountId = &v + return s +} + +// SetUsedInstanceCount sets the UsedInstanceCount field's value. +func (s *InstanceUsage) SetUsedInstanceCount(v int64) *InstanceUsage { + s.UsedInstanceCount = &v + return s +} + // Describes an internet gateway. type InternetGateway struct { _ struct{} `type:"structure"` @@ -62513,33 +69865,34 @@ type IpPermission struct { // all ICMP/ICMPv6 types, you must specify all codes. FromPort *int64 `locationName:"fromPort" type:"integer"` - // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). + // The IP protocol name (tcp, udp, icmp, icmpv6) or number (see Protocol Numbers + // (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). // - // [EC2-VPC only] Use -1 to specify all protocols. When authorizing security - // group rules, specifying -1 or a protocol number other than tcp, udp, icmp, - // or 58 (ICMPv6) allows traffic on all ports, regardless of any port range - // you specify. For tcp, udp, and icmp, you must specify a port range. For 58 - // (ICMPv6), you can optionally specify a port range; if you don't, traffic - // for all types and codes is allowed when authorizing rules. + // [VPC only] Use -1 to specify all protocols. When authorizing security group + // rules, specifying -1 or a protocol number other than tcp, udp, icmp, or icmpv6 + // allows traffic on all ports, regardless of any port range you specify. For + // tcp, udp, and icmp, you must specify a port range. For icmpv6, the port range + // is optional; if you omit the port range, traffic for all types and codes + // is allowed. IpProtocol *string `locationName:"ipProtocol" type:"string"` - // One or more IPv4 ranges. + // The IPv4 ranges. IpRanges []*IpRange `locationName:"ipRanges" locationNameList:"item" type:"list"` - // [EC2-VPC only] One or more IPv6 ranges. + // [VPC only] The IPv6 ranges. Ipv6Ranges []*Ipv6Range `locationName:"ipv6Ranges" locationNameList:"item" type:"list"` - // [EC2-VPC only] One or more prefix list IDs for an AWS service. With AuthorizeSecurityGroupEgress, - // this is the AWS service that you want to access through a VPC endpoint from - // instances associated with the security group. + // [VPC only] The prefix list IDs for an AWS service. With outbound rules, this + // is the AWS service to access through a VPC endpoint from instances associated + // with the security group. PrefixListIds []*PrefixListId `locationName:"prefixListIds" locationNameList:"item" type:"list"` // The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code. - // A value of -1 indicates all ICMP/ICMPv6 codes for the specified ICMP type. - // If you specify all ICMP/ICMPv6 types, you must specify all codes. + // A value of -1 indicates all ICMP/ICMPv6 codes. If you specify all ICMP/ICMPv6 + // types, you must specify all codes. ToPort *int64 `locationName:"toPort" type:"integer"` - // One or more security group and AWS account ID pairs. + // The security group and AWS account ID pairs. UserIdGroupPairs []*UserIdGroupPair `locationName:"groups" locationNameList:"item" type:"list"` } @@ -63476,8 +70829,8 @@ type LaunchTemplateEbsBlockDeviceRequest struct { // volume. For gp2, this represents the baseline performance of the volume and // the rate at which the volume accumulates I/O credits for bursting. For more // information about General Purpose SSD baseline performance, I/O credits, - // and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud - // User Guide. + // and bursting, see Amazon EBS Volume Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // in the Amazon Elastic Compute Cloud User Guide. // // Condition: This parameter is required for requests to create io1 volumes; // it is not used in requests to create gp2, st1, sc1, or standard volumes. @@ -63642,7 +70995,7 @@ func (s *LaunchTemplateHibernationOptions) SetConfigured(v bool) *LaunchTemplate } // Indicates whether the instance is configured for hibernation. This parameter -// is valid only if the instance meets the hibernation prerequisites (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). +// is valid only if the instance meets the hibernation prerequisites (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). // Hibernation is currently supported only for Amazon Linux. type LaunchTemplateHibernationOptionsRequest struct { _ struct{} `type:"structure"` @@ -63821,6 +71174,9 @@ type LaunchTemplateInstanceNetworkInterfaceSpecification struct { // The IDs of one or more security groups. Groups []*string `locationName:"groupSet" locationNameList:"groupId" type:"list"` + // The type of network interface. + InterfaceType *string `locationName:"interfaceType" type:"string"` + // The number of IPv6 addresses for the network interface. Ipv6AddressCount *int64 `locationName:"ipv6AddressCount" type:"integer"` @@ -63883,6 +71239,12 @@ func (s *LaunchTemplateInstanceNetworkInterfaceSpecification) SetGroups(v []*str return s } +// SetInterfaceType sets the InterfaceType field's value. +func (s *LaunchTemplateInstanceNetworkInterfaceSpecification) SetInterfaceType(v string) *LaunchTemplateInstanceNetworkInterfaceSpecification { + s.InterfaceType = &v + return s +} + // SetIpv6AddressCount sets the Ipv6AddressCount field's value. func (s *LaunchTemplateInstanceNetworkInterfaceSpecification) SetIpv6AddressCount(v int64) *LaunchTemplateInstanceNetworkInterfaceSpecification { s.Ipv6AddressCount = &v @@ -63944,6 +71306,15 @@ type LaunchTemplateInstanceNetworkInterfaceSpecificationRequest struct { // The IDs of one or more security groups. Groups []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` + // The type of network interface. To create an Elastic Fabric Adapter (EFA), + // specify efa. For more information, see Elastic Fabric Adapter (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html) + // in the Amazon Elastic Compute Cloud User Guide. + // + // If you are not creating an EFA, specify interface or omit this parameter. + // + // Valid values: interface | efa + InterfaceType *string `type:"string"` + // The number of IPv6 addresses to assign to a network interface. Amazon EC2 // automatically selects the IPv6 addresses from the subnet range. You can't // use this option if specifying specific IPv6 addresses. @@ -64009,6 +71380,12 @@ func (s *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) SetGroups(v return s } +// SetInterfaceType sets the InterfaceType field's value. +func (s *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) SetInterfaceType(v string) *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest { + s.InterfaceType = &v + return s +} + // SetIpv6AddressCount sets the Ipv6AddressCount field's value. func (s *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest) SetIpv6AddressCount(v int64) *LaunchTemplateInstanceNetworkInterfaceSpecificationRequest { s.Ipv6AddressCount = &v @@ -64528,7 +71905,7 @@ type LaunchTemplateTagSpecificationRequest struct { // The type of resource to tag. Currently, the resource types that support tagging // on creation are instance and volume. To tag a resource after it has been - // created, see CreateTags. + // created, see CreateTags (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html). ResourceType *string `type:"string" enum:"ResourceType"` // The tags to apply to the resource. @@ -65050,6 +72427,13 @@ type ModifyClientVpnEndpointInput struct { // The ARN of the server certificate to be used. The server certificate must // be provisioned in AWS Certificate Manager (ACM). ServerCertificateArn *string `type:"string"` + + // Indicates whether the VPN is split-tunnel. + // + // For information about split-tunnel VPN endpoints, see Split-Tunnel AWS Client + // VPN Endpoint (https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/split-tunnel-vpn.html) + // in the AWS Client VPN Administrator Guide. + SplitTunnel *bool `type:"boolean"` } // String returns the string representation @@ -65111,6 +72495,12 @@ func (s *ModifyClientVpnEndpointInput) SetServerCertificateArn(v string) *Modify return s } +// SetSplitTunnel sets the SplitTunnel field's value. +func (s *ModifyClientVpnEndpointInput) SetSplitTunnel(v bool) *ModifyClientVpnEndpointInput { + s.SplitTunnel = &v + return s +} + type ModifyClientVpnEndpointOutput struct { _ struct{} `type:"structure"` @@ -65134,6 +72524,96 @@ func (s *ModifyClientVpnEndpointOutput) SetReturn(v bool) *ModifyClientVpnEndpoi return s } +type ModifyEbsDefaultKmsKeyIdInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The identifier of the AWS Key Management Service (AWS KMS) customer master + // key (CMK) to use for Amazon EBS encryption. If this parameter is not specified, + // your AWS managed CMK for EBS is used. If KmsKeyId is specified, the encrypted + // state must be true. + // + // You can specify the CMK using any of the following: + // + // * Key ID. For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. + // + // * Key alias. For example, alias/ExampleAlias. + // + // * Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. + // + // * Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias. + // + // AWS authenticates the CMK asynchronously. Therefore, if you specify an ID, + // alias, or ARN that is not valid, the action can appear to complete, but eventually + // fails. + // + // KmsKeyId is a required field + KmsKeyId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ModifyEbsDefaultKmsKeyIdInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyEbsDefaultKmsKeyIdInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyEbsDefaultKmsKeyIdInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyEbsDefaultKmsKeyIdInput"} + if s.KmsKeyId == nil { + invalidParams.Add(request.NewErrParamRequired("KmsKeyId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *ModifyEbsDefaultKmsKeyIdInput) SetDryRun(v bool) *ModifyEbsDefaultKmsKeyIdInput { + s.DryRun = &v + return s +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *ModifyEbsDefaultKmsKeyIdInput) SetKmsKeyId(v string) *ModifyEbsDefaultKmsKeyIdInput { + s.KmsKeyId = &v + return s +} + +type ModifyEbsDefaultKmsKeyIdOutput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the default CMK for encryption by default. + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` +} + +// String returns the string representation +func (s ModifyEbsDefaultKmsKeyIdOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyEbsDefaultKmsKeyIdOutput) GoString() string { + return s.String() +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *ModifyEbsDefaultKmsKeyIdOutput) SetKmsKeyId(v string) *ModifyEbsDefaultKmsKeyIdOutput { + s.KmsKeyId = &v + return s +} + type ModifyFleetInput struct { _ struct{} `type:"structure"` @@ -65266,17 +72746,16 @@ type ModifyFpgaImageAttributeInput struct { // The operation type. OperationType *string `type:"string" enum:"OperationType"` - // One or more product codes. After you add a product code to an AFI, it can't - // be removed. This parameter is valid only when modifying the productCodes - // attribute. + // The product codes. After you add a product code to an AFI, it can't be removed. + // This parameter is valid only when modifying the productCodes attribute. ProductCodes []*string `locationName:"ProductCode" locationNameList:"ProductCode" type:"list"` - // One or more user groups. This parameter is valid only when modifying the - // loadPermission attribute. + // The user groups. This parameter is valid only when modifying the loadPermission + // attribute. UserGroups []*string `locationName:"UserGroup" locationNameList:"UserGroup" type:"list"` - // One or more AWS account IDs. This parameter is valid only when modifying - // the loadPermission attribute. + // The AWS account IDs. This parameter is valid only when modifying the loadPermission + // attribute. UserIds []*string `locationName:"UserId" locationNameList:"UserId" type:"list"` } @@ -65390,14 +72869,17 @@ type ModifyHostsInput struct { _ struct{} `type:"structure"` // Specify whether to enable or disable auto-placement. - // - // AutoPlacement is a required field - AutoPlacement *string `locationName:"autoPlacement" type:"string" required:"true" enum:"AutoPlacement"` + AutoPlacement *string `locationName:"autoPlacement" type:"string" enum:"AutoPlacement"` // The IDs of the Dedicated Hosts to modify. // // HostIds is a required field HostIds []*string `locationName:"hostId" locationNameList:"item" type:"list" required:"true"` + + // Indicates whether to enable or disable host recovery for the Dedicated Host. + // For more information, see Host Recovery (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-recovery.html) + // in the Amazon Elastic Compute Cloud User Guide. + HostRecovery *string `type:"string" enum:"HostRecovery"` } // String returns the string representation @@ -65413,9 +72895,6 @@ func (s ModifyHostsInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *ModifyHostsInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "ModifyHostsInput"} - if s.AutoPlacement == nil { - invalidParams.Add(request.NewErrParamRequired("AutoPlacement")) - } if s.HostIds == nil { invalidParams.Add(request.NewErrParamRequired("HostIds")) } @@ -65438,6 +72917,12 @@ func (s *ModifyHostsInput) SetHostIds(v []*string) *ModifyHostsInput { return s } +// SetHostRecovery sets the HostRecovery field's value. +func (s *ModifyHostsInput) SetHostRecovery(v string) *ModifyHostsInput { + s.HostRecovery = &v + return s +} + type ModifyHostsOutput struct { _ struct{} `type:"structure"` @@ -65666,16 +73151,16 @@ type ModifyImageAttributeInput struct { // is launchPermission. OperationType *string `type:"string" enum:"OperationType"` - // One or more DevPay product codes. After you add a product code to an AMI, - // it can't be removed. + // The DevPay product codes. After you add a product code to an AMI, it can't + // be removed. ProductCodes []*string `locationName:"ProductCode" locationNameList:"ProductCode" type:"list"` - // One or more user groups. This parameter can be used only when the Attribute - // parameter is launchPermission. + // The user groups. This parameter can be used only when the Attribute parameter + // is launchPermission. UserGroups []*string `locationName:"UserGroup" locationNameList:"UserGroup" type:"list"` - // One or more AWS account IDs. This parameter can be used only when the Attribute - // parameter is launchPermission. + // The AWS account IDs. This parameter can be used only when the Attribute parameter + // is launchPermission. UserIds []*string `locationName:"UserId" locationNameList:"UserId" type:"list"` // The value of the attribute being modified. This parameter can be used only @@ -65793,7 +73278,7 @@ type ModifyInstanceAttributeInput struct { // // To add instance store volumes to an Amazon EBS-backed instance, you must // add them when you launch the instance. For more information, see Updating - // the Block Device Mapping when Launching an Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM) + // the Block Device Mapping when Launching an Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM) // in the Amazon Elastic Compute Cloud User Guide. BlockDeviceMappings []*InstanceBlockDeviceMappingSpecification `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` @@ -65836,18 +73321,18 @@ type ModifyInstanceAttributeInput struct { InstanceInitiatedShutdownBehavior *AttributeValue `locationName:"instanceInitiatedShutdownBehavior" type:"structure"` // Changes the instance type to the specified value. For more information, see - // Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). + // Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). // If the instance type is not valid, the error returned is InvalidInstanceAttributeValue. InstanceType *AttributeValue `locationName:"instanceType" type:"structure"` // Changes the instance's kernel to the specified value. We recommend that you // use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB - // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html). + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html). Kernel *AttributeValue `locationName:"kernel" type:"structure"` // Changes the instance's RAM disk to the specified value. We recommend that // you use PV-GRUB instead of kernels and RAM disks. For more information, see - // PV-GRUB (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html). + // PV-GRUB (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html). Ramdisk *AttributeValue `locationName:"ramdisk" type:"structure"` // Specifies whether source/destination checking is enabled. A value of true @@ -66101,7 +73586,7 @@ type ModifyInstanceCreditSpecificationInput struct { // A unique, case-sensitive token that you provide to ensure idempotency of // your modification request. For more information, see Ensuring Idempotency - // (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -66191,6 +73676,107 @@ func (s *ModifyInstanceCreditSpecificationOutput) SetUnsuccessfulInstanceCreditS return s } +type ModifyInstanceEventStartTimeInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The ID of the event whose date and time you are modifying. + // + // InstanceEventId is a required field + InstanceEventId *string `type:"string" required:"true"` + + // The ID of the instance with the scheduled event. + // + // InstanceId is a required field + InstanceId *string `type:"string" required:"true"` + + // The new date and time when the event will take place. + // + // NotBefore is a required field + NotBefore *time.Time `type:"timestamp" required:"true"` +} + +// String returns the string representation +func (s ModifyInstanceEventStartTimeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyInstanceEventStartTimeInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyInstanceEventStartTimeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyInstanceEventStartTimeInput"} + if s.InstanceEventId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceEventId")) + } + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.NotBefore == nil { + invalidParams.Add(request.NewErrParamRequired("NotBefore")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *ModifyInstanceEventStartTimeInput) SetDryRun(v bool) *ModifyInstanceEventStartTimeInput { + s.DryRun = &v + return s +} + +// SetInstanceEventId sets the InstanceEventId field's value. +func (s *ModifyInstanceEventStartTimeInput) SetInstanceEventId(v string) *ModifyInstanceEventStartTimeInput { + s.InstanceEventId = &v + return s +} + +// SetInstanceId sets the InstanceId field's value. +func (s *ModifyInstanceEventStartTimeInput) SetInstanceId(v string) *ModifyInstanceEventStartTimeInput { + s.InstanceId = &v + return s +} + +// SetNotBefore sets the NotBefore field's value. +func (s *ModifyInstanceEventStartTimeInput) SetNotBefore(v time.Time) *ModifyInstanceEventStartTimeInput { + s.NotBefore = &v + return s +} + +type ModifyInstanceEventStartTimeOutput struct { + _ struct{} `type:"structure"` + + // Describes a scheduled event for an instance. + Event *InstanceStatusEvent `locationName:"event" type:"structure"` +} + +// String returns the string representation +func (s ModifyInstanceEventStartTimeOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyInstanceEventStartTimeOutput) GoString() string { + return s.String() +} + +// SetEvent sets the Event field's value. +func (s *ModifyInstanceEventStartTimeOutput) SetEvent(v *InstanceStatusEvent) *ModifyInstanceEventStartTimeOutput { + s.Event = v + return s +} + type ModifyInstancePlacementInput struct { _ struct{} `type:"structure"` @@ -66306,7 +73892,9 @@ type ModifyLaunchTemplateInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // the request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // + // Constraint: Maximum 128 ASCII characters. ClientToken *string `type:"string"` // The version number of the launch template to set as the default version. @@ -66434,7 +74022,7 @@ type ModifyNetworkInterfaceAttributeInput struct { // Indicates whether source/destination checking is enabled. A value of true // means checking is enabled, and false means checking is disabled. This value // must be false for a NAT instance to perform NAT. For more information, see - // NAT Instances (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html) + // NAT Instances (https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html) // in the Amazon Virtual Private Cloud User Guide. SourceDestCheck *AttributeBooleanValue `locationName:"sourceDestCheck" type:"structure"` } @@ -66517,7 +74105,7 @@ type ModifyReservedInstancesInput struct { _ struct{} `type:"structure"` // A unique, case-sensitive token you provide to ensure idempotency of your - // modification request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // modification request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` // The IDs of the Reserved Instances to modify. @@ -66719,6 +74307,9 @@ type ModifySpotFleetRequestInput struct { // the Spot Fleet. ExcessCapacityTerminationPolicy *string `locationName:"excessCapacityTerminationPolicy" type:"string" enum:"ExcessCapacityTerminationPolicy"` + // The number of On-Demand Instances in the fleet. + OnDemandTargetCapacity *int64 `type:"integer"` + // The ID of the Spot Fleet request. // // SpotFleetRequestId is a required field @@ -66757,6 +74348,12 @@ func (s *ModifySpotFleetRequestInput) SetExcessCapacityTerminationPolicy(v strin return s } +// SetOnDemandTargetCapacity sets the OnDemandTargetCapacity field's value. +func (s *ModifySpotFleetRequestInput) SetOnDemandTargetCapacity(v int64) *ModifySpotFleetRequestInput { + s.OnDemandTargetCapacity = &v + return s +} + // SetSpotFleetRequestId sets the SpotFleetRequestId field's value. func (s *ModifySpotFleetRequestInput) SetSpotFleetRequestId(v string) *ModifySpotFleetRequestInput { s.SpotFleetRequestId = &v @@ -66806,10 +74403,8 @@ type ModifySubnetAttributeInput struct { // or later of the Amazon EC2 API. AssignIpv6AddressOnCreation *AttributeBooleanValue `type:"structure"` - // Specify true to indicate that network interfaces created in the specified - // subnet should be assigned a public IPv4 address. This includes a network - // interface that's created when launching an instance into the subnet (the - // instance therefore receives a public IPv4 address). + // Specify true to indicate that ENIs attached to instances created in the specified + // subnet should be assigned a public IPv4 address. MapPublicIpOnLaunch *AttributeBooleanValue `type:"structure"` // The ID of the subnet. @@ -66873,6 +74468,413 @@ func (s ModifySubnetAttributeOutput) GoString() string { return s.String() } +type ModifyTrafficMirrorFilterNetworkServicesInput struct { + _ struct{} `type:"structure"` + + // The network service, for example Amazon DNS, that you want to mirror. + AddNetworkServices []*string `locationName:"AddNetworkService" locationNameList:"item" type:"list"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The network service, for example Amazon DNS, that you no longer want to mirror. + RemoveNetworkServices []*string `locationName:"RemoveNetworkService" locationNameList:"item" type:"list"` + + // The ID of the Traffic Mirror filter. + // + // TrafficMirrorFilterId is a required field + TrafficMirrorFilterId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ModifyTrafficMirrorFilterNetworkServicesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyTrafficMirrorFilterNetworkServicesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyTrafficMirrorFilterNetworkServicesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyTrafficMirrorFilterNetworkServicesInput"} + if s.TrafficMirrorFilterId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorFilterId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAddNetworkServices sets the AddNetworkServices field's value. +func (s *ModifyTrafficMirrorFilterNetworkServicesInput) SetAddNetworkServices(v []*string) *ModifyTrafficMirrorFilterNetworkServicesInput { + s.AddNetworkServices = v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *ModifyTrafficMirrorFilterNetworkServicesInput) SetDryRun(v bool) *ModifyTrafficMirrorFilterNetworkServicesInput { + s.DryRun = &v + return s +} + +// SetRemoveNetworkServices sets the RemoveNetworkServices field's value. +func (s *ModifyTrafficMirrorFilterNetworkServicesInput) SetRemoveNetworkServices(v []*string) *ModifyTrafficMirrorFilterNetworkServicesInput { + s.RemoveNetworkServices = v + return s +} + +// SetTrafficMirrorFilterId sets the TrafficMirrorFilterId field's value. +func (s *ModifyTrafficMirrorFilterNetworkServicesInput) SetTrafficMirrorFilterId(v string) *ModifyTrafficMirrorFilterNetworkServicesInput { + s.TrafficMirrorFilterId = &v + return s +} + +type ModifyTrafficMirrorFilterNetworkServicesOutput struct { + _ struct{} `type:"structure"` + + // The Traffic Mirror filter that the network service is associated with. + TrafficMirrorFilter *TrafficMirrorFilter `locationName:"trafficMirrorFilter" type:"structure"` +} + +// String returns the string representation +func (s ModifyTrafficMirrorFilterNetworkServicesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyTrafficMirrorFilterNetworkServicesOutput) GoString() string { + return s.String() +} + +// SetTrafficMirrorFilter sets the TrafficMirrorFilter field's value. +func (s *ModifyTrafficMirrorFilterNetworkServicesOutput) SetTrafficMirrorFilter(v *TrafficMirrorFilter) *ModifyTrafficMirrorFilterNetworkServicesOutput { + s.TrafficMirrorFilter = v + return s +} + +type ModifyTrafficMirrorFilterRuleInput struct { + _ struct{} `type:"structure"` + + // The description to assign to the Traffic Mirror rule. + Description *string `type:"string"` + + // The destination CIDR block to assign to the Traffic Mirror rule. + DestinationCidrBlock *string `type:"string"` + + // The destination ports that are associated with the Traffic Mirror rule. + DestinationPortRange *TrafficMirrorPortRangeRequest `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The protocol, for example TCP, to assign to the Traffic Mirror rule. + Protocol *int64 `type:"integer"` + + // The properties that you want to remove from the Traffic Mirror filter rule. + // + // When you remove a property from a Traffic Mirror filter rule, the property + // is set to the default. + RemoveFields []*string `locationName:"RemoveField" type:"list"` + + // The action to assign to the rule. + RuleAction *string `type:"string" enum:"TrafficMirrorRuleAction"` + + // The number of the Traffic Mirror rule. This number must be unique for each + // Traffic Mirror rule in a given direction. The rules are processed in ascending + // order by rule number. + RuleNumber *int64 `type:"integer"` + + // The source CIDR block to assign to the Traffic Mirror rule. + SourceCidrBlock *string `type:"string"` + + // The port range to assign to the Traffic Mirror rule. + SourcePortRange *TrafficMirrorPortRangeRequest `type:"structure"` + + // The type of traffic (ingress | egress) to assign to the rule. + TrafficDirection *string `type:"string" enum:"TrafficDirection"` + + // The ID of the Traffic Mirror rule. + // + // TrafficMirrorFilterRuleId is a required field + TrafficMirrorFilterRuleId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ModifyTrafficMirrorFilterRuleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyTrafficMirrorFilterRuleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyTrafficMirrorFilterRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyTrafficMirrorFilterRuleInput"} + if s.TrafficMirrorFilterRuleId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorFilterRuleId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDescription sets the Description field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetDescription(v string) *ModifyTrafficMirrorFilterRuleInput { + s.Description = &v + return s +} + +// SetDestinationCidrBlock sets the DestinationCidrBlock field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetDestinationCidrBlock(v string) *ModifyTrafficMirrorFilterRuleInput { + s.DestinationCidrBlock = &v + return s +} + +// SetDestinationPortRange sets the DestinationPortRange field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetDestinationPortRange(v *TrafficMirrorPortRangeRequest) *ModifyTrafficMirrorFilterRuleInput { + s.DestinationPortRange = v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetDryRun(v bool) *ModifyTrafficMirrorFilterRuleInput { + s.DryRun = &v + return s +} + +// SetProtocol sets the Protocol field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetProtocol(v int64) *ModifyTrafficMirrorFilterRuleInput { + s.Protocol = &v + return s +} + +// SetRemoveFields sets the RemoveFields field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetRemoveFields(v []*string) *ModifyTrafficMirrorFilterRuleInput { + s.RemoveFields = v + return s +} + +// SetRuleAction sets the RuleAction field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetRuleAction(v string) *ModifyTrafficMirrorFilterRuleInput { + s.RuleAction = &v + return s +} + +// SetRuleNumber sets the RuleNumber field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetRuleNumber(v int64) *ModifyTrafficMirrorFilterRuleInput { + s.RuleNumber = &v + return s +} + +// SetSourceCidrBlock sets the SourceCidrBlock field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetSourceCidrBlock(v string) *ModifyTrafficMirrorFilterRuleInput { + s.SourceCidrBlock = &v + return s +} + +// SetSourcePortRange sets the SourcePortRange field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetSourcePortRange(v *TrafficMirrorPortRangeRequest) *ModifyTrafficMirrorFilterRuleInput { + s.SourcePortRange = v + return s +} + +// SetTrafficDirection sets the TrafficDirection field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetTrafficDirection(v string) *ModifyTrafficMirrorFilterRuleInput { + s.TrafficDirection = &v + return s +} + +// SetTrafficMirrorFilterRuleId sets the TrafficMirrorFilterRuleId field's value. +func (s *ModifyTrafficMirrorFilterRuleInput) SetTrafficMirrorFilterRuleId(v string) *ModifyTrafficMirrorFilterRuleInput { + s.TrafficMirrorFilterRuleId = &v + return s +} + +type ModifyTrafficMirrorFilterRuleOutput struct { + _ struct{} `type:"structure"` + + // Modifies a Traffic Mirror rule. + TrafficMirrorFilterRule *TrafficMirrorFilterRule `locationName:"trafficMirrorFilterRule" type:"structure"` +} + +// String returns the string representation +func (s ModifyTrafficMirrorFilterRuleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyTrafficMirrorFilterRuleOutput) GoString() string { + return s.String() +} + +// SetTrafficMirrorFilterRule sets the TrafficMirrorFilterRule field's value. +func (s *ModifyTrafficMirrorFilterRuleOutput) SetTrafficMirrorFilterRule(v *TrafficMirrorFilterRule) *ModifyTrafficMirrorFilterRuleOutput { + s.TrafficMirrorFilterRule = v + return s +} + +type ModifyTrafficMirrorSessionInput struct { + _ struct{} `type:"structure"` + + // The description to assign to the Traffic Mirror session. + Description *string `type:"string"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The number of bytes in each packet to mirror. These are bytes after the VXLAN + // header. To mirror a subset, set this to the length (in bytes) to mirror. + // For example, if you set this value to 100, then the first 100 bytes that + // meet the filter criteria are copied to the target. Do not specify this parameter + // when you want to mirror the entire packet. + PacketLength *int64 `type:"integer"` + + // The properties that you want to remove from the Traffic Mirror session. + // + // When you remove a property from a Traffic Mirror session, the property is + // set to the default. + RemoveFields []*string `locationName:"RemoveField" type:"list"` + + // The session number determines the order in which sessions are evaluated when + // an interface is used by multiple sessions. The first session with a matching + // filter is the one that mirrors the packets. + // + // Valid values are 1-32766. + SessionNumber *int64 `type:"integer"` + + // The ID of the Traffic Mirror filter. + TrafficMirrorFilterId *string `type:"string"` + + // The ID of the Traffic Mirror session. + // + // TrafficMirrorSessionId is a required field + TrafficMirrorSessionId *string `type:"string" required:"true"` + + // The Traffic Mirror target. The target must be in the same VPC as the source, + // or have a VPC peering connection with the source. + TrafficMirrorTargetId *string `type:"string"` + + // The virtual network ID of the Traffic Mirror session. + VirtualNetworkId *int64 `type:"integer"` +} + +// String returns the string representation +func (s ModifyTrafficMirrorSessionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyTrafficMirrorSessionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyTrafficMirrorSessionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyTrafficMirrorSessionInput"} + if s.TrafficMirrorSessionId == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficMirrorSessionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDescription sets the Description field's value. +func (s *ModifyTrafficMirrorSessionInput) SetDescription(v string) *ModifyTrafficMirrorSessionInput { + s.Description = &v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *ModifyTrafficMirrorSessionInput) SetDryRun(v bool) *ModifyTrafficMirrorSessionInput { + s.DryRun = &v + return s +} + +// SetPacketLength sets the PacketLength field's value. +func (s *ModifyTrafficMirrorSessionInput) SetPacketLength(v int64) *ModifyTrafficMirrorSessionInput { + s.PacketLength = &v + return s +} + +// SetRemoveFields sets the RemoveFields field's value. +func (s *ModifyTrafficMirrorSessionInput) SetRemoveFields(v []*string) *ModifyTrafficMirrorSessionInput { + s.RemoveFields = v + return s +} + +// SetSessionNumber sets the SessionNumber field's value. +func (s *ModifyTrafficMirrorSessionInput) SetSessionNumber(v int64) *ModifyTrafficMirrorSessionInput { + s.SessionNumber = &v + return s +} + +// SetTrafficMirrorFilterId sets the TrafficMirrorFilterId field's value. +func (s *ModifyTrafficMirrorSessionInput) SetTrafficMirrorFilterId(v string) *ModifyTrafficMirrorSessionInput { + s.TrafficMirrorFilterId = &v + return s +} + +// SetTrafficMirrorSessionId sets the TrafficMirrorSessionId field's value. +func (s *ModifyTrafficMirrorSessionInput) SetTrafficMirrorSessionId(v string) *ModifyTrafficMirrorSessionInput { + s.TrafficMirrorSessionId = &v + return s +} + +// SetTrafficMirrorTargetId sets the TrafficMirrorTargetId field's value. +func (s *ModifyTrafficMirrorSessionInput) SetTrafficMirrorTargetId(v string) *ModifyTrafficMirrorSessionInput { + s.TrafficMirrorTargetId = &v + return s +} + +// SetVirtualNetworkId sets the VirtualNetworkId field's value. +func (s *ModifyTrafficMirrorSessionInput) SetVirtualNetworkId(v int64) *ModifyTrafficMirrorSessionInput { + s.VirtualNetworkId = &v + return s +} + +type ModifyTrafficMirrorSessionOutput struct { + _ struct{} `type:"structure"` + + // Information about the Traffic Mirror session. + TrafficMirrorSession *TrafficMirrorSession `locationName:"trafficMirrorSession" type:"structure"` +} + +// String returns the string representation +func (s ModifyTrafficMirrorSessionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyTrafficMirrorSessionOutput) GoString() string { + return s.String() +} + +// SetTrafficMirrorSession sets the TrafficMirrorSession field's value. +func (s *ModifyTrafficMirrorSessionOutput) SetTrafficMirrorSession(v *TrafficMirrorSession) *ModifyTrafficMirrorSessionOutput { + s.TrafficMirrorSession = v + return s +} + type ModifyTransitGatewayVpcAttachmentInput struct { _ struct{} `type:"structure"` @@ -67093,14 +75095,14 @@ type ModifyVolumeInput struct { // The target IOPS rate of the volume. // // This is only valid for Provisioned IOPS SSD (io1) volumes. For more information, - // see Provisioned IOPS SSD (io1) Volumes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html#EBSVolumeTypes_piops). + // see Provisioned IOPS SSD (io1) Volumes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html#EBSVolumeTypes_piops). // // Default: If no IOPS value is specified, the existing value is retained. Iops *int64 `type:"integer"` // The target size of the volume, in GiB. The target volume size must be greater // than or equal to than the existing size of the volume. For information about - // available EBS volume sizes, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html). + // available EBS volume sizes, see Amazon EBS Volume Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html). // // Default: If no size is specified, the existing size is retained. Size *int64 `type:"integer"` @@ -67386,8 +75388,9 @@ type ModifyVpcEndpointInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // (Gateway endpoint) A policy document to attach to the endpoint. The policy - // must be in valid JSON format. + // A policy to attach to the endpoint that controls access to the service. The + // policy must be in valid JSON format. If this parameter is not specified, + // we attach a default policy that allows full access to the service. PolicyDocument *string `type:"string"` // (Interface endpoint) Indicate whether a private hosted zone is associated @@ -67909,6 +75912,97 @@ func (s *ModifyVpcTenancyOutput) SetReturnValue(v bool) *ModifyVpcTenancyOutput return s } +type ModifyVpnConnectionInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The ID of the transit gateway. + TransitGatewayId *string `type:"string"` + + // The ID of the VPN connection. + // + // VpnConnectionId is a required field + VpnConnectionId *string `type:"string" required:"true"` + + // The ID of the virtual private gateway at the AWS side of the VPN connection. + VpnGatewayId *string `type:"string"` +} + +// String returns the string representation +func (s ModifyVpnConnectionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyVpnConnectionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyVpnConnectionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyVpnConnectionInput"} + if s.VpnConnectionId == nil { + invalidParams.Add(request.NewErrParamRequired("VpnConnectionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDryRun sets the DryRun field's value. +func (s *ModifyVpnConnectionInput) SetDryRun(v bool) *ModifyVpnConnectionInput { + s.DryRun = &v + return s +} + +// SetTransitGatewayId sets the TransitGatewayId field's value. +func (s *ModifyVpnConnectionInput) SetTransitGatewayId(v string) *ModifyVpnConnectionInput { + s.TransitGatewayId = &v + return s +} + +// SetVpnConnectionId sets the VpnConnectionId field's value. +func (s *ModifyVpnConnectionInput) SetVpnConnectionId(v string) *ModifyVpnConnectionInput { + s.VpnConnectionId = &v + return s +} + +// SetVpnGatewayId sets the VpnGatewayId field's value. +func (s *ModifyVpnConnectionInput) SetVpnGatewayId(v string) *ModifyVpnConnectionInput { + s.VpnGatewayId = &v + return s +} + +type ModifyVpnConnectionOutput struct { + _ struct{} `type:"structure"` + + // Describes a VPN connection. + VpnConnection *VpnConnection `locationName:"vpnConnection" type:"structure"` +} + +// String returns the string representation +func (s ModifyVpnConnectionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyVpnConnectionOutput) GoString() string { + return s.String() +} + +// SetVpnConnection sets the VpnConnection field's value. +func (s *ModifyVpnConnectionOutput) SetVpnConnection(v *VpnConnection) *ModifyVpnConnectionOutput { + s.VpnConnection = v + return s +} + type MonitorInstancesInput struct { _ struct{} `type:"structure"` @@ -67918,7 +76012,7 @@ type MonitorInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more instance IDs. + // The IDs of the instances. // // InstanceIds is a required field InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` @@ -68168,7 +76262,7 @@ type NatGateway struct { NatGatewayId *string `locationName:"natGatewayId" type:"string"` // Reserved. If you need to sustain traffic greater than the documented limits - // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html), // contact us through the Support Center (https://console.aws.amazon.com/support/home?). ProvisionedBandwidth *ProvisionedBandwidth `locationName:"provisionedBandwidth" type:"structure"` @@ -68558,7 +76652,7 @@ type NetworkInterface struct { // Any security groups for the network interface. Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` - // The type of interface. + // The type of network interface. InterfaceType *string `locationName:"interfaceType" type:"string" enum:"NetworkInterfaceType"` // The IPv6 addresses associated with the network interface. @@ -69115,7 +77209,7 @@ func (s *NewDhcpConfiguration) SetValues(v []*string) *NewDhcpConfiguration { return s } -// The allocation strategy of On-Demand Instances in an EC2 Fleet. +// Describes the configuration of On-Demand Instances in an EC2 Fleet. type OnDemandOptions struct { _ struct{} `type:"structure"` @@ -69127,6 +77221,10 @@ type OnDemandOptions struct { // Fleet defaults to lowest-price. AllocationStrategy *string `locationName:"allocationStrategy" type:"string" enum:"FleetOnDemandAllocationStrategy"` + // The maximum amount per hour for On-Demand Instances that you're willing to + // pay. + MaxTotalPrice *string `locationName:"maxTotalPrice" type:"string"` + // The minimum target capacity for On-Demand Instances in the fleet. If the // minimum target capacity is not reached, the fleet launches no instances. MinTargetCapacity *int64 `locationName:"minTargetCapacity" type:"integer"` @@ -69156,6 +77254,12 @@ func (s *OnDemandOptions) SetAllocationStrategy(v string) *OnDemandOptions { return s } +// SetMaxTotalPrice sets the MaxTotalPrice field's value. +func (s *OnDemandOptions) SetMaxTotalPrice(v string) *OnDemandOptions { + s.MaxTotalPrice = &v + return s +} + // SetMinTargetCapacity sets the MinTargetCapacity field's value. func (s *OnDemandOptions) SetMinTargetCapacity(v int64) *OnDemandOptions { s.MinTargetCapacity = &v @@ -69174,7 +77278,7 @@ func (s *OnDemandOptions) SetSingleInstanceType(v bool) *OnDemandOptions { return s } -// The allocation strategy of On-Demand Instances in an EC2 Fleet. +// Describes the configuration of On-Demand Instances in an EC2 Fleet. type OnDemandOptionsRequest struct { _ struct{} `type:"structure"` @@ -69186,6 +77290,10 @@ type OnDemandOptionsRequest struct { // Fleet defaults to lowest-price. AllocationStrategy *string `type:"string" enum:"FleetOnDemandAllocationStrategy"` + // The maximum amount per hour for On-Demand Instances that you're willing to + // pay. + MaxTotalPrice *string `type:"string"` + // The minimum target capacity for On-Demand Instances in the fleet. If the // minimum target capacity is not reached, the fleet launches no instances. MinTargetCapacity *int64 `type:"integer"` @@ -69215,6 +77323,12 @@ func (s *OnDemandOptionsRequest) SetAllocationStrategy(v string) *OnDemandOption return s } +// SetMaxTotalPrice sets the MaxTotalPrice field's value. +func (s *OnDemandOptionsRequest) SetMaxTotalPrice(v string) *OnDemandOptionsRequest { + s.MaxTotalPrice = &v + return s +} + // SetMinTargetCapacity sets the MinTargetCapacity field's value. func (s *OnDemandOptionsRequest) SetMinTargetCapacity(v int64) *OnDemandOptionsRequest { s.MinTargetCapacity = &v @@ -69384,6 +77498,9 @@ type Placement struct { Affinity *string `locationName:"affinity" type:"string"` // The Availability Zone of the instance. + // + // If not specified, an Availability Zone will be automatically chosen for you + // based on the load balancing criteria for the Region. AvailabilityZone *string `locationName:"availabilityZone" type:"string"` // The name of the placement group the instance is in. @@ -69913,7 +78030,7 @@ type ProvisionByoipCidrInput struct { // The public IPv4 address range, in CIDR notation. The most specific prefix // that you can specify is /24. The address range cannot overlap with another - // address range that you've brought to this or another region. + // address range that you've brought to this or another Region. // // Cidr is a required field Cidr *string `type:"string" required:"true"` @@ -70008,33 +78125,33 @@ func (s *ProvisionByoipCidrOutput) SetByoipCidr(v *ByoipCidr) *ProvisionByoipCid } // Reserved. If you need to sustain traffic greater than the documented limits -// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), +// (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html), // contact us through the Support Center (https://console.aws.amazon.com/support/home?). type ProvisionedBandwidth struct { _ struct{} `type:"structure"` // Reserved. If you need to sustain traffic greater than the documented limits - // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html), // contact us through the Support Center (https://console.aws.amazon.com/support/home?). ProvisionTime *time.Time `locationName:"provisionTime" type:"timestamp"` // Reserved. If you need to sustain traffic greater than the documented limits - // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html), // contact us through the Support Center (https://console.aws.amazon.com/support/home?). Provisioned *string `locationName:"provisioned" type:"string"` // Reserved. If you need to sustain traffic greater than the documented limits - // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html), // contact us through the Support Center (https://console.aws.amazon.com/support/home?). RequestTime *time.Time `locationName:"requestTime" type:"timestamp"` // Reserved. If you need to sustain traffic greater than the documented limits - // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html), // contact us through the Support Center (https://console.aws.amazon.com/support/home?). Requested *string `locationName:"requested" type:"string"` // Reserved. If you need to sustain traffic greater than the documented limits - // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html), // contact us through the Support Center (https://console.aws.amazon.com/support/home?). Status *string `locationName:"status" type:"string"` } @@ -70282,9 +78399,8 @@ func (s *Purchase) SetUpfrontPrice(v string) *Purchase { type PurchaseHostReservationInput struct { _ struct{} `type:"structure"` - // Unique, case-sensitive identifier you provide to ensure idempotency of the - // request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) - // in the Amazon Elastic Compute Cloud User Guide. + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // The currency in which the totalUpfrontPrice, LimitPrice, and totalHourlyPrice @@ -70369,9 +78485,8 @@ func (s *PurchaseHostReservationInput) SetOfferingId(v string) *PurchaseHostRese type PurchaseHostReservationOutput struct { _ struct{} `type:"structure"` - // Unique, case-sensitive identifier you provide to ensure idempotency of the - // request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) - // in the Amazon Elastic Compute Cloud User Guide. + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` // The currency in which the totalUpfrontPrice and totalHourlyPrice amounts @@ -70586,7 +78701,7 @@ type PurchaseScheduledInstancesInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that ensures the idempotency of the request. - // For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string" idempotencyToken:"true"` // Checks whether you have the required permissions for the action, without @@ -70595,7 +78710,7 @@ type PurchaseScheduledInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more purchase requests. + // The purchase requests. // // PurchaseRequests is a required field PurchaseRequests []*PurchaseRequest `locationName:"PurchaseRequest" locationNameList:"PurchaseRequest" min:"1" type:"list" required:"true"` @@ -70688,7 +78803,7 @@ type RebootInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more instance IDs. + // The instance IDs. // // InstanceIds is a required field InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` @@ -70776,14 +78891,18 @@ func (s *RecurringCharge) SetFrequency(v string) *RecurringCharge { return s } -// Describes a region. +// Describes a Region. type Region struct { _ struct{} `type:"structure"` - // The region service endpoint. + // The Region service endpoint. Endpoint *string `locationName:"regionEndpoint" type:"string"` - // The name of the region. + // The Region opt-in status. The possible values are opt-in-not-required, opted-in, + // and not-opted-in. + OptInStatus *string `locationName:"optInStatus" type:"string"` + + // The name of the Region. RegionName *string `locationName:"regionName" type:"string"` } @@ -70803,6 +78922,12 @@ func (s *Region) SetEndpoint(v string) *Region { return s } +// SetOptInStatus sets the OptInStatus field's value. +func (s *Region) SetOptInStatus(v string) *Region { + s.OptInStatus = &v + return s +} + // SetRegionName sets the RegionName field's value. func (s *Region) SetRegionName(v string) *Region { s.RegionName = &v @@ -70824,7 +78949,7 @@ type RegisterImageInput struct { // use of an AMI. BillingProducts []*string `locationName:"BillingProduct" locationNameList:"item" type:"list"` - // One or more block device mapping entries. + // The block device mapping entries. BlockDeviceMappings []*BlockDeviceMapping `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` // A description for your AMI. @@ -70843,7 +78968,10 @@ type RegisterImageInput struct { // PV AMI can make instances launched from the AMI unreachable. EnaSupport *bool `locationName:"enaSupport" type:"boolean"` - // The full path to your AMI manifest in Amazon S3 storage. + // The full path to your AMI manifest in Amazon S3 storage. The specified bucket + // must have the aws-exec-read canned access control list (ACL) to ensure that + // it can be accessed by Amazon EC2. For more information, see Canned ACLs (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) + // in the Amazon S3 Service Developer Guide. ImageLocation *string `type:"string"` // The ID of the kernel. @@ -72051,12 +80179,12 @@ type ReportInstanceStatusInput struct { // The time at which the reported instance health state ended. EndTime *time.Time `locationName:"endTime" type:"timestamp"` - // One or more instances. + // The instances. // // Instances is a required field Instances []*string `locationName:"instanceId" locationNameList:"InstanceId" type:"list" required:"true"` - // One or more reason codes that describe the health state of your instance. + // The reason codes that describe the health state of your instance. // // * instance-stuck-in-state: My instance is stuck in a state. // @@ -72189,11 +80317,14 @@ type RequestLaunchTemplateData struct { // cannot be changed using this action. BlockDeviceMappings []*LaunchTemplateBlockDeviceMappingRequest `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` - // The Capacity Reservation targeting option. + // The Capacity Reservation targeting option. If you do not specify this parameter, + // the instance's Capacity Reservation preference defaults to open, which enables + // it to run in any open Capacity Reservation that has matching attributes (instance + // type, platform, Availability Zone). CapacityReservationSpecification *LaunchTemplateCapacityReservationSpecificationRequest `type:"structure"` // The CPU options for the instance. For more information, see Optimizing CPU - // Options (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) + // Options (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) // in the Amazon Elastic Compute Cloud User Guide. CpuOptions *LaunchTemplateCpuOptionsRequest `type:"structure"` @@ -72201,8 +80332,11 @@ type RequestLaunchTemplateData struct { // only. CreditSpecification *CreditSpecificationRequest `type:"structure"` - // If set to true, you can't terminate the instance using the Amazon EC2 console, - // CLI, or API. To change this attribute to false after launch, use ModifyInstanceAttribute. + // If you set this parameter to true, you can't terminate the instance using + // the Amazon EC2 console, CLI, or API; otherwise, you can. To change this attribute + // after launch, use ModifyInstanceAttribute (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html). + // Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, + // you can terminate the instance by running the shutdown command from the instance. DisableApiTermination *bool `type:"boolean"` // Indicates whether the instance is optimized for Amazon EBS I/O. This optimization @@ -72219,16 +80353,16 @@ type RequestLaunchTemplateData struct { ElasticInferenceAccelerators []*LaunchTemplateElasticInferenceAccelerator `locationName:"ElasticInferenceAccelerator" locationNameList:"item" type:"list"` // Indicates whether an instance is enabled for hibernation. This parameter - // is valid only if the instance meets the hibernation prerequisites (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). + // is valid only if the instance meets the hibernation prerequisites (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites). // Hibernation is currently supported only for Amazon Linux. For more information, - // see Hibernate Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + // see Hibernate Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) // in the Amazon Elastic Compute Cloud User Guide. HibernationOptions *LaunchTemplateHibernationOptionsRequest `type:"structure"` // The IAM instance profile. IamInstanceProfile *LaunchTemplateIamInstanceProfileSpecificationRequest `type:"structure"` - // The ID of the AMI, which you can get by using DescribeImages. + // The ID of the AMI. ImageId *string `type:"string"` // Indicates whether an instance stops or terminates when you initiate shutdown @@ -72240,19 +80374,19 @@ type RequestLaunchTemplateData struct { // The market (purchasing) option for the instances. InstanceMarketOptions *LaunchTemplateInstanceMarketOptionsRequest `type:"structure"` - // The instance type. For more information, see Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + // The instance type. For more information, see Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) // in the Amazon Elastic Compute Cloud User Guide. InstanceType *string `type:"string" enum:"InstanceType"` // The ID of the kernel. // // We recommend that you use PV-GRUB instead of kernels and RAM disks. For more - // information, see User Provided Kernels (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + // information, see User Provided Kernels (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) // in the Amazon Elastic Compute Cloud User Guide. KernelId *string `type:"string"` - // The name of the key pair. You can create a key pair using CreateKeyPair or - // ImportKeyPair. + // The name of the key pair. You can create a key pair using CreateKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html) + // or ImportKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html). // // If you do not specify a key pair, you can't connect to the instance unless // you choose an AMI that is configured to allow users another way to log in. @@ -72264,7 +80398,8 @@ type RequestLaunchTemplateData struct { // The monitoring for the instance. Monitoring *LaunchTemplatesMonitoringRequest `type:"structure"` - // One or more network interfaces. + // One or more network interfaces. If you specify a network interface, you must + // specify any security groups and subnets as part of the network interface. NetworkInterfaces []*LaunchTemplateInstanceNetworkInterfaceSpecificationRequest `locationName:"NetworkInterface" locationNameList:"InstanceNetworkInterfaceSpecification" type:"list"` // The placement for the instance. @@ -72273,11 +80408,12 @@ type RequestLaunchTemplateData struct { // The ID of the RAM disk. // // We recommend that you use PV-GRUB instead of kernels and RAM disks. For more - // information, see User Provided Kernels (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + // information, see User Provided Kernels (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) // in the Amazon Elastic Compute Cloud User Guide. RamDiskId *string `type:"string"` - // One or more security group IDs. You can create a security group using CreateSecurityGroup. + // One or more security group IDs. You can create a security group using CreateSecurityGroup + // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html). // You cannot specify both a security group ID and security name in the same // request. SecurityGroupIds []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` @@ -72290,12 +80426,12 @@ type RequestLaunchTemplateData struct { // The tags to apply to the resources during launch. You can only tag instances // and volumes on launch. The specified tags are applied to all instances or // volumes that are created during launch. To tag a resource after it has been - // created, see CreateTags. + // created, see CreateTags (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html). TagSpecifications []*LaunchTemplateTagSpecificationRequest `locationName:"TagSpecification" locationNameList:"LaunchTemplateTagSpecificationRequest" type:"list"` // The Base64-encoded user data to make available to the instance. For more - // information, see Running Commands on Your Linux Instance at Launch (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) - // (Linux) and Adding User Data (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) + // information, see Running Commands on Your Linux Instance at Launch (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) + // (Linux) and Adding User Data (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) // (Windows). UserData *string `type:"string"` } @@ -72614,7 +80750,7 @@ type RequestSpotInstancesInput struct { BlockDurationMinutes *int64 `locationName:"blockDurationMinutes" type:"integer"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) + // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) // in the Amazon EC2 User Guide for Linux Instances. ClientToken *string `locationName:"clientToken" type:"string"` @@ -72849,7 +80985,8 @@ type RequestSpotLaunchSpecification struct { // The ID of the subnet in which to launch the instance. SubnetId *string `locationName:"subnetId" type:"string"` - // The Base64-encoded user data for the instance. + // The Base64-encoded user data for the instance. User data is limited to 16 + // KB. UserData *string `locationName:"userData" type:"string"` } @@ -72978,10 +81115,10 @@ func (s *RequestSpotLaunchSpecification) SetUserData(v string) *RequestSpotLaunc type Reservation struct { _ struct{} `type:"structure"` - // [EC2-Classic only] One or more security groups. + // [EC2-Classic only] The security groups. Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` - // One or more instances. + // The instances. Instances []*Instance `locationName:"instancesSet" locationNameList:"item" type:"list"` // The ID of the AWS account that owns the reservation. @@ -73332,6 +81469,8 @@ type ReservedInstancesConfiguration struct { AvailabilityZone *string `locationName:"availabilityZone" type:"string"` // The number of modified Reserved Instances. + // + // This is a required field for a request. InstanceCount *int64 `locationName:"instanceCount" type:"integer"` // The instance type for the modified Reserved Instances. @@ -73341,7 +81480,7 @@ type ReservedInstancesConfiguration struct { // EC2-Classic or EC2-VPC. Platform *string `locationName:"platform" type:"string"` - // Whether the Reserved Instance is applied to instances in a region or instances + // Whether the Reserved Instance is applied to instances in a Region or instances // in a specific Availability Zone. Scope *string `locationName:"scope" type:"string" enum:"scope"` } @@ -73415,7 +81554,7 @@ type ReservedInstancesListing struct { _ struct{} `type:"structure"` // A unique, case-sensitive key supplied by the client to ensure that the request - // is idempotent. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // is idempotent. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` // The time the listing was created. @@ -73522,7 +81661,7 @@ type ReservedInstancesModification struct { _ struct{} `type:"structure"` // A unique, case-sensitive key supplied by the client to ensure that the request - // is idempotent. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // is idempotent. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` // The time when the modification request was created. @@ -73700,7 +81839,7 @@ type ReservedInstancesOffering struct { // GetReservedInstancesExchangeQuote to confirm that an exchange can be made. ReservedInstancesOfferingId *string `locationName:"reservedInstancesOfferingId" type:"string"` - // Whether the Reserved Instance is applied to instances in a region or an Availability + // Whether the Reserved Instance is applied to instances in a Region or an Availability // Zone. Scope *string `locationName:"scope" type:"string" enum:"scope"` @@ -73808,6 +81947,55 @@ func (s *ReservedInstancesOffering) SetUsagePrice(v float64) *ReservedInstancesO return s } +type ResetEbsDefaultKmsKeyIdInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` +} + +// String returns the string representation +func (s ResetEbsDefaultKmsKeyIdInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResetEbsDefaultKmsKeyIdInput) GoString() string { + return s.String() +} + +// SetDryRun sets the DryRun field's value. +func (s *ResetEbsDefaultKmsKeyIdInput) SetDryRun(v bool) *ResetEbsDefaultKmsKeyIdInput { + s.DryRun = &v + return s +} + +type ResetEbsDefaultKmsKeyIdOutput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the default CMK for EBS encryption by default. + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` +} + +// String returns the string representation +func (s ResetEbsDefaultKmsKeyIdOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResetEbsDefaultKmsKeyIdOutput) GoString() string { + return s.String() +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *ResetEbsDefaultKmsKeyIdOutput) SetKmsKeyId(v string) *ResetEbsDefaultKmsKeyIdOutput { + s.KmsKeyId = &v + return s +} + type ResetFpgaImageAttributeInput struct { _ struct{} `type:"structure"` @@ -74250,7 +82438,7 @@ type ResponseLaunchTemplateData struct { CapacityReservationSpecification *LaunchTemplateCapacityReservationSpecificationResponse `locationName:"capacityReservationSpecification" type:"structure"` // The CPU options for the instance. For more information, see Optimizing CPU - // Options (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) + // Options (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) // in the Amazon Elastic Compute Cloud User Guide. CpuOptions *LaunchTemplateCpuOptions `locationName:"cpuOptions" type:"structure"` @@ -74271,7 +82459,7 @@ type ResponseLaunchTemplateData struct { ElasticInferenceAccelerators []*LaunchTemplateElasticInferenceAcceleratorResponse `locationName:"elasticInferenceAcceleratorSet" locationNameList:"item" type:"list"` // Indicates whether an instance is configured for hibernation. For more information, - // see Hibernate Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + // see Hibernate Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) // in the Amazon Elastic Compute Cloud User Guide. HibernationOptions *LaunchTemplateHibernationOptions `locationName:"hibernationOptions" type:"structure"` @@ -74693,8 +82881,8 @@ type RevokeSecurityGroupEgressInput struct { // GroupId is a required field GroupId *string `locationName:"groupId" type:"string" required:"true"` - // One or more sets of IP permissions. You can't specify a destination security - // group and a CIDR IP address range in the same set of permissions. + // The sets of IP permissions. You can't specify a destination security group + // and a CIDR IP address range in the same set of permissions. IpPermissions []*IpPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` // Not supported. Use a set of IP permissions to specify the protocol name or @@ -74830,8 +83018,8 @@ type RevokeSecurityGroupIngressInput struct { // either the security group ID or the security group name in the request. GroupName *string `type:"string"` - // One or more sets of IP permissions. You can't specify a source security group - // and a CIDR IP address range in the same set of permissions. + // The sets of IP permissions. You can't specify a source security group and + // a CIDR IP address range in the same set of permissions. IpPermissions []*IpPermission `locationNameList:"item" type:"list"` // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). @@ -75219,29 +83407,30 @@ type RunInstancesInput struct { // Reserved. AdditionalInfo *string `locationName:"additionalInfo" type:"string"` - // One or more block device mapping entries. You can't specify both a snapshot - // ID and an encryption value. This is because only blank volumes can be encrypted - // on creation. If a snapshot is the basis for a volume, it is not blank and - // its encryption status is used for the volume encryption status. + // The block device mapping entries. BlockDeviceMappings []*BlockDeviceMapping `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` - // Information about the Capacity Reservation targeting option. + // Information about the Capacity Reservation targeting option. If you do not + // specify this parameter, the instance's Capacity Reservation preference defaults + // to open, which enables it to run in any open Capacity Reservation that has + // matching attributes (instance type, platform, Availability Zone). CapacityReservationSpecification *CapacityReservationSpecification `type:"structure"` // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // the request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). // // Constraints: Maximum 64 ASCII characters ClientToken *string `locationName:"clientToken" type:"string"` // The CPU options for the instance. For more information, see Optimizing CPU - // Options (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) + // Options (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) // in the Amazon Elastic Compute Cloud User Guide. CpuOptions *CpuOptionsRequest `type:"structure"` - // The credit option for CPU usage of the instance. Valid values are standard - // and unlimited. To change this attribute after launch, use ModifyInstanceCreditSpecification. - // For more information, see Burstable Performance Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) + // The credit option for CPU usage of the T2 or T3 instance. Valid values are + // standard and unlimited. To change this attribute after launch, use ModifyInstanceCreditSpecification + // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceCreditSpecification.html). + // For more information, see Burstable Performance Instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) // in the Amazon Elastic Compute Cloud User Guide. // // Default: standard (T2 instances) or unlimited (T3 instances) @@ -75249,9 +83438,9 @@ type RunInstancesInput struct { // If you set this parameter to true, you can't terminate the instance using // the Amazon EC2 console, CLI, or API; otherwise, you can. To change this attribute - // to false after launch, use ModifyInstanceAttribute. Alternatively, if you - // set InstanceInitiatedShutdownBehavior to terminate, you can terminate the - // instance by running the shutdown command from the instance. + // after launch, use ModifyInstanceAttribute (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html). + // Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, + // you can terminate the instance by running the shutdown command from the instance. // // Default: false DisableApiTermination *bool `locationName:"disableApiTermination" type:"boolean"` @@ -75271,23 +83460,27 @@ type RunInstancesInput struct { // Default: false EbsOptimized *bool `locationName:"ebsOptimized" type:"boolean"` - // An elastic GPU to associate with the instance. + // An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource + // that you can attach to your Windows instance to accelerate the graphics performance + // of your applications. For more information, see Amazon EC2 Elastic GPUs (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html) + // in the Amazon Elastic Compute Cloud User Guide. ElasticGpuSpecification []*ElasticGpuSpecification `locationNameList:"item" type:"list"` - // An elastic inference accelerator. + // An elastic inference accelerator to associate with the instance. Elastic + // inference accelerators are a resource you can attach to your Amazon EC2 instances + // to accelerate your Deep Learning (DL) inference workloads. ElasticInferenceAccelerators []*ElasticInferenceAccelerator `locationName:"ElasticInferenceAccelerator" locationNameList:"item" type:"list"` // Indicates whether an instance is enabled for hibernation. For more information, - // see Hibernate Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + // see Hibernate Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) // in the Amazon Elastic Compute Cloud User Guide. HibernationOptions *HibernationOptionsRequest `type:"structure"` // The IAM instance profile. IamInstanceProfile *IamInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` - // The ID of the AMI, which you can get by calling DescribeImages. An AMI is - // required to launch an instance and must be specified here or in a launch - // template. + // The ID of the AMI. An AMI ID is required to launch an instance and must be + // specified here or in a launch template. ImageId *string `type:"string"` // Indicates whether an instance stops or terminates when you initiate shutdown @@ -75302,35 +83495,40 @@ type RunInstancesInput struct { // InstanceInterruptionBehavior is set to either hibernate or stop. InstanceMarketOptions *InstanceMarketOptionsRequest `type:"structure"` - // The instance type. For more information, see Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + // The instance type. For more information, see Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) // in the Amazon Elastic Compute Cloud User Guide. // // Default: m1.small InstanceType *string `type:"string" enum:"InstanceType"` - // [EC2-VPC] A number of IPv6 addresses to associate with the primary network + // [EC2-VPC] The number of IPv6 addresses to associate with the primary network // interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. // You cannot specify this option and the option to assign specific IPv6 addresses // in the same request. You can specify this option if you've specified a minimum // number of instances to launch. + // + // You cannot specify this option and the network interfaces option in the same + // request. Ipv6AddressCount *int64 `type:"integer"` - // [EC2-VPC] Specify one or more IPv6 addresses from the range of the subnet - // to associate with the primary network interface. You cannot specify this - // option and the option to assign a number of IPv6 addresses in the same request. - // You cannot specify this option if you've specified a minimum number of instances - // to launch. + // [EC2-VPC] The IPv6 addresses from the range of the subnet to associate with + // the primary network interface. You cannot specify this option and the option + // to assign a number of IPv6 addresses in the same request. You cannot specify + // this option if you've specified a minimum number of instances to launch. + // + // You cannot specify this option and the network interfaces option in the same + // request. Ipv6Addresses []*InstanceIpv6Address `locationName:"Ipv6Address" locationNameList:"item" type:"list"` // The ID of the kernel. // // We recommend that you use PV-GRUB instead of kernels and RAM disks. For more - // information, see PV-GRUB (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + // information, see PV-GRUB (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) // in the Amazon Elastic Compute Cloud User Guide. KernelId *string `type:"string"` - // The name of the key pair. You can create a key pair using CreateKeyPair or - // ImportKeyPair. + // The name of the key pair. You can create a key pair using CreateKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html) + // or ImportKeyPair (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html). // // If you do not specify a key pair, you can't connect to the instance unless // you choose an AMI that is configured to allow users another way to log in. @@ -75368,10 +83566,12 @@ type RunInstancesInput struct { // MinCount is a required field MinCount *int64 `type:"integer" required:"true"` - // The monitoring for the instance. + // Specifies whether detailed monitoring is enabled for the instance. Monitoring *RunInstancesMonitoringEnabled `type:"structure"` - // One or more network interfaces. + // The network interfaces to associate with the instance. If you specify a network + // interface, you must specify any security groups and subnets as part of the + // network interface. NetworkInterfaces []*InstanceNetworkInterfaceSpecification `locationName:"networkInterface" locationNameList:"item" type:"list"` // The placement for the instance. @@ -75384,41 +83584,55 @@ type RunInstancesInput struct { // this option if you've specified the option to designate a private IP address // as the primary IP address in a network interface specification. You cannot // specify this option if you're launching more than one instance in the request. + // + // You cannot specify this option and the network interfaces option in the same + // request. PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` - // The ID of the RAM disk. + // The ID of the RAM disk to select. Some kernels require additional drivers + // at launch. Check the kernel requirements for information about whether you + // need to specify a RAM disk. To find kernel requirements, go to the AWS Resource + // Center and search for the kernel ID. // // We recommend that you use PV-GRUB instead of kernels and RAM disks. For more - // information, see PV-GRUB (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + // information, see PV-GRUB (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) // in the Amazon Elastic Compute Cloud User Guide. RamdiskId *string `type:"string"` - // One or more security group IDs. You can create a security group using CreateSecurityGroup. + // The IDs of the security groups. You can create a security group using CreateSecurityGroup + // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html). // - // Default: Amazon EC2 uses the default security group. + // If you specify a network interface, you must specify any security groups + // as part of the network interface. SecurityGroupIds []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` - // [EC2-Classic, default VPC] One or more security group names. For a nondefault + // [EC2-Classic, default VPC] The names of the security groups. For a nondefault // VPC, you must use security group IDs instead. // + // If you specify a network interface, you must specify any security groups + // as part of the network interface. + // // Default: Amazon EC2 uses the default security group. SecurityGroups []*string `locationName:"SecurityGroup" locationNameList:"SecurityGroup" type:"list"` // [EC2-VPC] The ID of the subnet to launch the instance into. + // + // If you specify a network interface, you must specify any subnets as part + // of the network interface. SubnetId *string `type:"string"` // The tags to apply to the resources during launch. You can only tag instances // and volumes on launch. The specified tags are applied to all instances or // volumes that are created during launch. To tag a resource after it has been - // created, see CreateTags. + // created, see CreateTags (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html). TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` // The user data to make available to the instance. For more information, see - // Running Commands on Your Linux Instance at Launch (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) - // (Linux) and Adding User Data (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) + // Running Commands on Your Linux Instance at Launch (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) + // (Linux) and Adding User Data (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) // (Windows). If you are using a command line tool, base64-encoding is performed // for you, and you can load the text from a file. Otherwise, you must provide - // base64-encoded text. + // base64-encoded text. User data is limited to 16 KB. UserData *string `type:"string"` } @@ -75733,7 +83947,7 @@ type RunScheduledInstancesInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that ensures the idempotency of the request. - // For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string" idempotencyToken:"true"` // Checks whether you have the required permissions for the action, without @@ -75851,7 +84065,7 @@ type S3Storage struct { // The access key ID of the owner of the bucket. Before you specify a value // for your access key ID, review and follow the guidance in Best Practices - // for Managing AWS Access Keys (http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html). + // for Managing AWS Access Keys (https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html). AWSAccessKeyId *string `type:"string"` // The bucket in which to store the AMI. You can specify a bucket that you already @@ -76404,7 +84618,7 @@ type ScheduledInstancesEbs struct { // for the volume. For gp2 volumes, this represents the baseline performance // of the volume and the rate at which the volume accumulates I/O credits for // bursting. For more information about gp2 baseline performance, I/O credits, - // and bursting, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // and bursting, see Amazon EBS Volume Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) // in the Amazon Elastic Compute Cloud User Guide. // // Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for @@ -76541,7 +84755,7 @@ func (s *ScheduledInstancesIpv6Address) SetIpv6Address(v string) *ScheduledInsta type ScheduledInstancesLaunchSpecification struct { _ struct{} `type:"structure"` - // One or more block device mapping entries. + // The block device mapping entries. BlockDeviceMappings []*ScheduledInstancesBlockDeviceMapping `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` // Indicates whether the instances are optimized for EBS I/O. This optimization @@ -76573,7 +84787,7 @@ type ScheduledInstancesLaunchSpecification struct { // Enable or disable monitoring for the instances. Monitoring *ScheduledInstancesMonitoring `type:"structure"` - // One or more network interfaces. + // The network interfaces. NetworkInterfaces []*ScheduledInstancesNetworkInterface `locationName:"NetworkInterface" locationNameList:"NetworkInterface" type:"list"` // The placement information. @@ -76582,7 +84796,7 @@ type ScheduledInstancesLaunchSpecification struct { // The ID of the RAM disk. RamdiskId *string `type:"string"` - // The IDs of one or more security groups. + // The IDs of the security groups. SecurityGroupIds []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` // The ID of the subnet in which to launch the instances. @@ -76743,14 +84957,14 @@ type ScheduledInstancesNetworkInterface struct { // The index of the device for the network interface attachment. DeviceIndex *int64 `type:"integer"` - // The IDs of one or more security groups. + // The IDs of the security groups. Groups []*string `locationName:"Group" locationNameList:"SecurityGroupId" type:"list"` // The number of IPv6 addresses to assign to the network interface. The IPv6 // addresses are automatically selected from the subnet range. Ipv6AddressCount *int64 `type:"integer"` - // One or more specific IPv6 addresses from the subnet range. + // The specific IPv6 addresses from the subnet range. Ipv6Addresses []*ScheduledInstancesIpv6Address `locationName:"Ipv6Address" locationNameList:"Ipv6Address" type:"list"` // The ID of the network interface. @@ -76929,14 +85143,29 @@ type SearchTransitGatewayRoutesInput struct { // One or more filters. The possible values are: // - // * transit-gateway-route-destination-cidr-block - The CIDR range. - // - // * transit-gateway-route-state - The state of the route (active | blackhole). - // - // * transit-gateway-route-transit-gateway-attachment-id - The ID of the + // * attachment.transit-gateway-attachment-id- The id of the transit gateway // attachment. // - // * transit-gateway-route-type - The route type (static | propagated). + // * attachment.resource-id - The resource id of the transit gateway attachment. + // + // * attachment.resource-type - The attachment resource type (vpc | vpn). + // + // * route-search.exact-match - The exact match of the specified filter. + // + // * route-search.longest-prefix-match - The longest prefix that matches + // the route. + // + // * route-search.subnet-of-match - The routes with a subnet that match the + // specified CIDR filter. + // + // * route-search.supernet-of-match - The routes with a CIDR that encompass + // the CIDR filter. For example, if you have 10.0.1.0/29 and 10.0.1.0/31 + // routes in your route table and you specify supernet-of-match as 10.0.1.0/30, + // then the result returns 10.0.1.0/29. + // + // * state - The state of the route (active | blackhole). + // + // * type - The type of roue (propagated | static). // // Filters is a required field Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list" required:"true"` @@ -77048,10 +85277,10 @@ type SecurityGroup struct { // The name of the security group. GroupName *string `locationName:"groupName" type:"string"` - // One or more inbound rules associated with the security group. + // The inbound rules associated with the security group. IpPermissions []*IpPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` - // [EC2-VPC] One or more outbound rules associated with the security group. + // [VPC only] The outbound rules associated with the security group. IpPermissionsEgress []*IpPermission `locationName:"ipPermissionsEgress" locationNameList:"item" type:"list"` // The AWS account ID of the owner of the security group. @@ -77060,7 +85289,7 @@ type SecurityGroup struct { // Any tags assigned to the security group. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - // [EC2-VPC] The ID of the VPC for the security group. + // [VPC only] The ID of the VPC for the security group. VpcId *string `locationName:"vpcId" type:"string"` } @@ -77211,6 +85440,10 @@ type ServiceConfiguration struct { // The DNS names for the service. BaseEndpointDnsNames []*string `locationName:"baseEndpointDnsNameSet" locationNameList:"item" type:"list"` + // Indicates whether the service manages it's VPC endpoints. Management of the + // service VPC endpoints using the VPC endpoint API is restricted. + ManagesVpcEndpoints *bool `locationName:"managesVpcEndpoints" type:"boolean"` + // The Amazon Resource Names (ARNs) of the Network Load Balancers for the service. NetworkLoadBalancerArns []*string `locationName:"networkLoadBalancerArnSet" locationNameList:"item" type:"list"` @@ -77228,6 +85461,9 @@ type ServiceConfiguration struct { // The type of service. ServiceType []*ServiceTypeDetail `locationName:"serviceType" locationNameList:"item" type:"list"` + + // Any tags assigned to the service. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` } // String returns the string representation @@ -77258,6 +85494,12 @@ func (s *ServiceConfiguration) SetBaseEndpointDnsNames(v []*string) *ServiceConf return s } +// SetManagesVpcEndpoints sets the ManagesVpcEndpoints field's value. +func (s *ServiceConfiguration) SetManagesVpcEndpoints(v bool) *ServiceConfiguration { + s.ManagesVpcEndpoints = &v + return s +} + // SetNetworkLoadBalancerArns sets the NetworkLoadBalancerArns field's value. func (s *ServiceConfiguration) SetNetworkLoadBalancerArns(v []*string) *ServiceConfiguration { s.NetworkLoadBalancerArns = v @@ -77294,6 +85536,12 @@ func (s *ServiceConfiguration) SetServiceType(v []*ServiceTypeDetail) *ServiceCo return s } +// SetTags sets the Tags field's value. +func (s *ServiceConfiguration) SetTags(v []*Tag) *ServiceConfiguration { + s.Tags = v + return s +} + // Describes a VPC endpoint service. type ServiceDetail struct { _ struct{} `type:"structure"` @@ -77308,18 +85556,28 @@ type ServiceDetail struct { // The DNS names for the service. BaseEndpointDnsNames []*string `locationName:"baseEndpointDnsNameSet" locationNameList:"item" type:"list"` + // Indicates whether the service manages it's VPC endpoints. Management of the + // service VPC endpoints using the VPC endpoint API is restricted. + ManagesVpcEndpoints *bool `locationName:"managesVpcEndpoints" type:"boolean"` + // The AWS account ID of the service owner. Owner *string `locationName:"owner" type:"string"` // The private DNS name for the service. PrivateDnsName *string `locationName:"privateDnsName" type:"string"` + // The ID of the endpoint service. + ServiceId *string `locationName:"serviceId" type:"string"` + // The Amazon Resource Name (ARN) of the service. ServiceName *string `locationName:"serviceName" type:"string"` // The type of service. ServiceType []*ServiceTypeDetail `locationName:"serviceType" locationNameList:"item" type:"list"` + // Any tags assigned to the service. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + // Indicates whether the service supports endpoint policies. VpcEndpointPolicySupported *bool `locationName:"vpcEndpointPolicySupported" type:"boolean"` } @@ -77352,6 +85610,12 @@ func (s *ServiceDetail) SetBaseEndpointDnsNames(v []*string) *ServiceDetail { return s } +// SetManagesVpcEndpoints sets the ManagesVpcEndpoints field's value. +func (s *ServiceDetail) SetManagesVpcEndpoints(v bool) *ServiceDetail { + s.ManagesVpcEndpoints = &v + return s +} + // SetOwner sets the Owner field's value. func (s *ServiceDetail) SetOwner(v string) *ServiceDetail { s.Owner = &v @@ -77364,6 +85628,12 @@ func (s *ServiceDetail) SetPrivateDnsName(v string) *ServiceDetail { return s } +// SetServiceId sets the ServiceId field's value. +func (s *ServiceDetail) SetServiceId(v string) *ServiceDetail { + s.ServiceId = &v + return s +} + // SetServiceName sets the ServiceName field's value. func (s *ServiceDetail) SetServiceName(v string) *ServiceDetail { s.ServiceName = &v @@ -77376,6 +85646,12 @@ func (s *ServiceDetail) SetServiceType(v []*ServiceTypeDetail) *ServiceDetail { return s } +// SetTags sets the Tags field's value. +func (s *ServiceDetail) SetTags(v []*Tag) *ServiceDetail { + s.Tags = v + return s +} + // SetVpcEndpointPolicySupported sets the VpcEndpointPolicySupported field's value. func (s *ServiceDetail) SetVpcEndpointPolicySupported(v bool) *ServiceDetail { s.VpcEndpointPolicySupported = &v @@ -77504,7 +85780,7 @@ type Snapshot struct { // the original volume or snapshot copy. Because data encryption keys are inherited // by volumes created from snapshots, and vice versa, if snapshots share the // same data encryption key identifier, then they belong to the same volume/snapshot - // lineage. This parameter is only returned by the DescribeSnapshots API operation. + // lineage. This parameter is only returned by DescribeSnapshots. DataEncryptionKeyId *string `locationName:"dataEncryptionKeyId" type:"string"` // The description for the snapshot. @@ -77513,14 +85789,14 @@ type Snapshot struct { // Indicates whether the snapshot is encrypted. Encrypted *bool `locationName:"encrypted" type:"boolean"` - // The full ARN of the AWS Key Management Service (AWS KMS) customer master - // key (CMK) that was used to protect the volume encryption key for the parent - // volume. + // The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) + // customer master key (CMK) that was used to protect the volume encryption + // key for the parent volume. KmsKeyId *string `locationName:"kmsKeyId" type:"string"` - // Value from an Amazon-maintained list (amazon | aws-marketplace | microsoft) - // of snapshot owners. Not to be confused with the user-configured AWS account - // alias, which is set from the IAM console. + // Value from an Amazon-maintained list (amazon | self | all | aws-marketplace + // | microsoft) of snapshot owners. Not to be confused with the user-configured + // AWS account alias, which is set from the IAM console. OwnerAlias *string `locationName:"ownerAlias" type:"string"` // The AWS account ID of the EBS snapshot owner. @@ -77543,7 +85819,7 @@ type Snapshot struct { // operation fails (for example, if the proper AWS Key Management Service (AWS // KMS) permissions are not obtained) this field displays error state details // to help you diagnose why the error occurred. This parameter is only returned - // by the DescribeSnapshots API operation. + // by DescribeSnapshots. StateMessage *string `locationName:"statusMessage" type:"string"` // Any tags assigned to the snapshot. @@ -77811,6 +86087,113 @@ func (s *SnapshotDiskContainer) SetUserBucket(v *UserBucket) *SnapshotDiskContai return s } +// Information about a snapshot. +type SnapshotInfo struct { + _ struct{} `type:"structure"` + + // Description specified by the CreateSnapshotRequest that has been applied + // to all snapshots. + Description *string `locationName:"description" type:"string"` + + // Indicates whether the snapshot is encrypted. + Encrypted *bool `locationName:"encrypted" type:"boolean"` + + // Account id used when creating this snapshot. + OwnerId *string `locationName:"ownerId" type:"string"` + + // Progress this snapshot has made towards completing. + Progress *string `locationName:"progress" type:"string"` + + // Snapshot id that can be used to describe this snapshot. + SnapshotId *string `locationName:"snapshotId" type:"string"` + + // Time this snapshot was started. This is the same for all snapshots initiated + // by the same request. + StartTime *time.Time `locationName:"startTime" type:"timestamp"` + + // Current state of the snapshot. + State *string `locationName:"state" type:"string" enum:"SnapshotState"` + + // Tags associated with this snapshot. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // Source volume from which this snapshot was created. + VolumeId *string `locationName:"volumeId" type:"string"` + + // Size of the volume from which this snapshot was created. + VolumeSize *int64 `locationName:"volumeSize" type:"integer"` +} + +// String returns the string representation +func (s SnapshotInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SnapshotInfo) GoString() string { + return s.String() +} + +// SetDescription sets the Description field's value. +func (s *SnapshotInfo) SetDescription(v string) *SnapshotInfo { + s.Description = &v + return s +} + +// SetEncrypted sets the Encrypted field's value. +func (s *SnapshotInfo) SetEncrypted(v bool) *SnapshotInfo { + s.Encrypted = &v + return s +} + +// SetOwnerId sets the OwnerId field's value. +func (s *SnapshotInfo) SetOwnerId(v string) *SnapshotInfo { + s.OwnerId = &v + return s +} + +// SetProgress sets the Progress field's value. +func (s *SnapshotInfo) SetProgress(v string) *SnapshotInfo { + s.Progress = &v + return s +} + +// SetSnapshotId sets the SnapshotId field's value. +func (s *SnapshotInfo) SetSnapshotId(v string) *SnapshotInfo { + s.SnapshotId = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *SnapshotInfo) SetStartTime(v time.Time) *SnapshotInfo { + s.StartTime = &v + return s +} + +// SetState sets the State field's value. +func (s *SnapshotInfo) SetState(v string) *SnapshotInfo { + s.State = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *SnapshotInfo) SetTags(v []*Tag) *SnapshotInfo { + s.Tags = v + return s +} + +// SetVolumeId sets the VolumeId field's value. +func (s *SnapshotInfo) SetVolumeId(v string) *SnapshotInfo { + s.VolumeId = &v + return s +} + +// SetVolumeSize sets the VolumeSize field's value. +func (s *SnapshotInfo) SetVolumeSize(v int64) *SnapshotInfo { + s.VolumeSize = &v + return s +} + // Details about the import snapshot task. type SnapshotTaskDetail struct { _ struct{} `type:"structure"` @@ -77986,17 +86369,20 @@ func (s *SpotDatafeedSubscription) SetState(v string) *SpotDatafeedSubscription return s } -// Describes the launch specification for one or more Spot Instances. +// Describes the launch specification for one or more Spot Instances. If you +// include On-Demand capacity in your fleet request, you can't use SpotFleetLaunchSpecification; +// you must use LaunchTemplateConfig (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_LaunchTemplateConfig.html). type SpotFleetLaunchSpecification struct { _ struct{} `type:"structure"` // Deprecated. AddressingType *string `locationName:"addressingType" type:"string"` - // One or more block device mapping entries. You can't specify both a snapshot - // ID and an encryption value. This is because only blank volumes can be encrypted - // on creation. If a snapshot is the basis for a volume, it is not blank and - // its encryption status is used for the volume encryption status. + // One or more block devices that are mapped to the Spot instances. You can't + // specify both a snapshot ID and an encryption value. This is because only + // blank volumes can be encrypted on creation. If a snapshot is the basis for + // a volume, it is not blank and its encryption status is used for the volume + // encryption status. BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` // Indicates whether the instances are optimized for EBS I/O. This optimization @@ -78033,7 +86419,10 @@ type SpotFleetLaunchSpecification struct { // The placement information. Placement *SpotPlacement `locationName:"placement" type:"structure"` - // The ID of the RAM disk. + // The ID of the RAM disk. Some kernels require additional drivers at launch. + // Check the kernel requirements for information about whether you need to specify + // a RAM disk. To find kernel requirements, refer to the AWS Resource Center + // and search for the kernel ID. RamdiskId *string `locationName:"ramdiskId" type:"string"` // One or more security groups. When requesting instances in a VPC, you must @@ -78054,16 +86443,16 @@ type SpotFleetLaunchSpecification struct { // The tags to apply during creation. TagSpecifications []*SpotFleetTagSpecification `locationName:"tagSpecificationSet" locationNameList:"item" type:"list"` - // The Base64-encoded user data to make available to the instances. + // The Base64-encoded user data that instances use when starting up. UserData *string `locationName:"userData" type:"string"` // The number of units provided by the specified instance type. These are the - // same units that you chose to set the target capacity in terms (instances - // or a performance characteristic such as vCPUs, memory, or I/O). + // same units that you chose to set the target capacity in terms of instances, + // or a performance characteristic such as vCPUs, memory, or I/O. // - // If the target capacity divided by this value is not a whole number, we round - // the number of instances to the next whole number. If this value is not specified, - // the default is 1. + // If the target capacity divided by this value is not a whole number, Amazon + // EC2 rounds the number of instances to the next whole number. If this value + // is not specified, the default is 1. WeightedCapacity *float64 `locationName:"weightedCapacity" type:"double"` } @@ -78285,21 +86674,26 @@ type SpotFleetRequestConfigData struct { // A unique, case-sensitive identifier that you provide to ensure the idempotency // of your listings. This helps to avoid duplicate listings. For more information, - // see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` - // Indicates whether running Spot Instances should be terminated if the target - // capacity of the Spot Fleet request is decreased below the current size of - // the Spot Fleet. + // Indicates whether running Spot Instances should be terminated if you decrease + // the target capacity of the Spot Fleet request below the current size of the + // Spot Fleet. ExcessCapacityTerminationPolicy *string `locationName:"excessCapacityTerminationPolicy" type:"string" enum:"ExcessCapacityTerminationPolicy"` // The number of units fulfilled by this request compared to the set target // capacity. You cannot set this value. FulfilledCapacity *float64 `locationName:"fulfilledCapacity" type:"double"` - // Grants the Spot Fleet permission to terminate Spot Instances on your behalf - // when you cancel its Spot Fleet request using CancelSpotFleetRequests or when - // the Spot Fleet request expires, if you set terminateInstancesWithExpiration. + // The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) + // role that grants the Spot Fleet the permission to request, launch, terminate, + // and tag instances on your behalf. For more information, see Spot Fleet Prerequisites + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet-requests.html#spot-fleet-prerequisites) + // in the Amazon EC2 User Guide for Linux Instances. Spot Fleet can terminate + // Spot Instances on your behalf when you cancel its Spot Fleet request using + // CancelSpotFleetRequests or when the Spot Fleet request expires, if you set + // TerminateInstancesWithExpiration. // // IamFleetRole is a required field IamFleetRole *string `locationName:"iamFleetRole" type:"string" required:"true"` @@ -78313,10 +86707,14 @@ type SpotFleetRequestConfigData struct { // across the number of Spot pools that you specify. InstancePoolsToUseCount *int64 `locationName:"instancePoolsToUseCount" type:"integer"` - // The launch specifications for the Spot Fleet request. + // The launch specifications for the Spot Fleet request. If you specify LaunchSpecifications, + // you can't specify LaunchTemplateConfigs. If you include On-Demand capacity + // in your request, you must use LaunchTemplateConfigs. LaunchSpecifications []*SpotFleetLaunchSpecification `locationName:"launchSpecifications" locationNameList:"item" type:"list"` - // The launch template and overrides. + // The launch template and overrides. If you specify LaunchTemplateConfigs, + // you can't specify LaunchSpecifications. If you include On-Demand capacity + // in your request, you must use LaunchTemplateConfigs. LaunchTemplateConfigs []*LaunchTemplateConfig `locationName:"launchTemplateConfigs" locationNameList:"item" type:"list"` // One or more Classic Load Balancers and target groups to attach to the Spot @@ -78340,6 +86738,16 @@ type SpotFleetRequestConfigData struct { // target On-Demand capacity. OnDemandFulfilledCapacity *float64 `locationName:"onDemandFulfilledCapacity" type:"double"` + // The maximum amount per hour for On-Demand Instances that you're willing to + // pay. You can use the onDemandMaxTotalPrice parameter, the spotMaxTotalPrice + // parameter, or both parameters to ensure that your fleet cost does not exceed + // your budget. If you set a maximum price per hour for the On-Demand Instances + // and Spot Instances in your request, Spot Fleet will launch instances until + // it reaches the maximum amount you're willing to pay. When the maximum amount + // you're willing to pay is reached, the fleet stops launching instances even + // if it hasn’t met the target capacity. + OnDemandMaxTotalPrice *string `locationName:"onDemandMaxTotalPrice" type:"string"` + // The number of On-Demand units to request. You can choose to set the target // capacity in terms of instances or a performance characteristic that is important // to your application workload, such as vCPUs, memory, or I/O. If the request @@ -78350,21 +86758,31 @@ type SpotFleetRequestConfigData struct { // Indicates whether Spot Fleet should replace unhealthy instances. ReplaceUnhealthyInstances *bool `locationName:"replaceUnhealthyInstances" type:"boolean"` + // The maximum amount per hour for Spot Instances that you're willing to pay. + // You can use the spotdMaxTotalPrice parameter, the onDemandMaxTotalPrice parameter, + // or both parameters to ensure that your fleet cost does not exceed your budget. + // If you set a maximum price per hour for the On-Demand Instances and Spot + // Instances in your request, Spot Fleet will launch instances until it reaches + // the maximum amount you're willing to pay. When the maximum amount you're + // willing to pay is reached, the fleet stops launching instances even if it + // hasn’t met the target capacity. + SpotMaxTotalPrice *string `locationName:"spotMaxTotalPrice" type:"string"` + // The maximum price per unit hour that you are willing to pay for a Spot Instance. // The default is the On-Demand price. SpotPrice *string `locationName:"spotPrice" type:"string"` - // The number of units to request. You can choose to set the target capacity - // in terms of instances or a performance characteristic that is important to - // your application workload, such as vCPUs, memory, or I/O. If the request - // type is maintain, you can specify a target capacity of 0 and add capacity - // later. + // The number of units to request for the Spot Fleet. You can choose to set + // the target capacity in terms of instances or a performance characteristic + // that is important to your application workload, such as vCPUs, memory, or + // I/O. If the request type is maintain, you can specify a target capacity of + // 0 and add capacity later. // // TargetCapacity is a required field TargetCapacity *int64 `locationName:"targetCapacity" type:"integer" required:"true"` - // Indicates whether running Spot Instances should be terminated when the Spot - // Fleet request expires. + // Indicates whether running Spot Instances are terminated when the Spot Fleet + // request expires. TerminateInstancesWithExpiration *bool `locationName:"terminateInstancesWithExpiration" type:"boolean"` // The type of request. Indicates whether the Spot Fleet only requests the target @@ -78377,13 +86795,14 @@ type SpotFleetRequestConfigData struct { // Default: maintain. instant is listed but is not used by Spot Fleet. Type *string `locationName:"type" type:"string" enum:"FleetType"` - // The start date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). - // The default is to start fulfilling the request immediately. + // The start date and time of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). + // By default, Amazon EC2 starts fulfilling the request immediately. ValidFrom *time.Time `locationName:"validFrom" type:"timestamp"` - // The end date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). - // At this point, no new Spot Instance requests are placed or able to fulfill - // the request. The default end date is 7 days from the current date. + // The end date and time of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). + // After the end date and time, no new Spot Instance requests are placed or + // able to fulfill the request. If no value is specified, the Spot Fleet request + // remains until you cancel it. ValidUntil *time.Time `locationName:"validUntil" type:"timestamp"` } @@ -78500,6 +86919,12 @@ func (s *SpotFleetRequestConfigData) SetOnDemandFulfilledCapacity(v float64) *Sp return s } +// SetOnDemandMaxTotalPrice sets the OnDemandMaxTotalPrice field's value. +func (s *SpotFleetRequestConfigData) SetOnDemandMaxTotalPrice(v string) *SpotFleetRequestConfigData { + s.OnDemandMaxTotalPrice = &v + return s +} + // SetOnDemandTargetCapacity sets the OnDemandTargetCapacity field's value. func (s *SpotFleetRequestConfigData) SetOnDemandTargetCapacity(v int64) *SpotFleetRequestConfigData { s.OnDemandTargetCapacity = &v @@ -78512,6 +86937,12 @@ func (s *SpotFleetRequestConfigData) SetReplaceUnhealthyInstances(v bool) *SpotF return s } +// SetSpotMaxTotalPrice sets the SpotMaxTotalPrice field's value. +func (s *SpotFleetRequestConfigData) SetSpotMaxTotalPrice(v string) *SpotFleetRequestConfigData { + s.SpotMaxTotalPrice = &v + return s +} + // SetSpotPrice sets the SpotPrice field's value. func (s *SpotFleetRequestConfigData) SetSpotPrice(v string) *SpotFleetRequestConfigData { s.SpotPrice = &v @@ -78632,7 +87063,7 @@ type SpotInstanceRequest struct { SpotPrice *string `locationName:"spotPrice" type:"string"` // The state of the Spot Instance request. Spot status information helps track - // your Spot Instance requests. For more information, see Spot Status (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) + // your Spot Instance requests. For more information, see Spot Status (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) // in the Amazon EC2 User Guide for Linux Instances. State *string `locationName:"state" type:"string" enum:"SpotInstanceState"` @@ -78818,7 +87249,7 @@ func (s *SpotInstanceStateFault) SetMessage(v string) *SpotInstanceStateFault { type SpotInstanceStatus struct { _ struct{} `type:"structure"` - // The status code. For a list of status codes, see Spot Status Codes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html#spot-instance-bid-status-understand) + // The status code. For a list of status codes, see Spot Status Codes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html#spot-instance-bid-status-understand) // in the Amazon EC2 User Guide for Linux Instances. Code *string `locationName:"code" type:"string"` @@ -78944,6 +87375,9 @@ type SpotOptions struct { // the number of Spot pools that you specify. InstancePoolsToUseCount *int64 `locationName:"instancePoolsToUseCount" type:"integer"` + // The maximum amount per hour for Spot Instances that you're willing to pay. + MaxTotalPrice *string `locationName:"maxTotalPrice" type:"string"` + // The minimum target capacity for Spot Instances in the fleet. If the minimum // target capacity is not reached, the fleet launches no instances. MinTargetCapacity *int64 `locationName:"minTargetCapacity" type:"integer"` @@ -78985,6 +87419,12 @@ func (s *SpotOptions) SetInstancePoolsToUseCount(v int64) *SpotOptions { return s } +// SetMaxTotalPrice sets the MaxTotalPrice field's value. +func (s *SpotOptions) SetMaxTotalPrice(v string) *SpotOptions { + s.MaxTotalPrice = &v + return s +} + // SetMinTargetCapacity sets the MinTargetCapacity field's value. func (s *SpotOptions) SetMinTargetCapacity(v int64) *SpotOptions { s.MinTargetCapacity = &v @@ -79020,6 +87460,9 @@ type SpotOptionsRequest struct { // across the number of Spot pools that you specify. InstancePoolsToUseCount *int64 `type:"integer"` + // The maximum amount per hour for Spot Instances that you're willing to pay. + MaxTotalPrice *string `type:"string"` + // The minimum target capacity for Spot Instances in the fleet. If the minimum // target capacity is not reached, the fleet launches no instances. MinTargetCapacity *int64 `type:"integer"` @@ -79061,6 +87504,12 @@ func (s *SpotOptionsRequest) SetInstancePoolsToUseCount(v int64) *SpotOptionsReq return s } +// SetMaxTotalPrice sets the MaxTotalPrice field's value. +func (s *SpotOptionsRequest) SetMaxTotalPrice(v string) *SpotOptionsRequest { + s.MaxTotalPrice = &v + return s +} + // SetMinTargetCapacity sets the MinTargetCapacity field's value. func (s *SpotOptionsRequest) SetMinTargetCapacity(v int64) *SpotOptionsRequest { s.MinTargetCapacity = &v @@ -79199,19 +87648,19 @@ type StaleIpPermission struct { // (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). IpProtocol *string `locationName:"ipProtocol" type:"string"` - // One or more IP ranges. Not applicable for stale security group rules. + // The IP ranges. Not applicable for stale security group rules. IpRanges []*string `locationName:"ipRanges" locationNameList:"item" type:"list"` - // One or more prefix list IDs for an AWS service. Not applicable for stale - // security group rules. + // The prefix list IDs for an AWS service. Not applicable for stale security + // group rules. PrefixListIds []*string `locationName:"prefixListIds" locationNameList:"item" type:"list"` // The end of the port range for the TCP and UDP protocols, or an ICMP type // number. A value of -1 indicates all ICMP types. ToPort *int64 `locationName:"toPort" type:"integer"` - // One or more security group pairs. Returns the ID of the referenced security - // group and VPC, and the ID and status of the VPC peering connection. + // The security group pairs. Returns the ID of the referenced security group + // and VPC, and the ID and status of the VPC peering connection. UserIdGroupPairs []*UserIdGroupPair `locationName:"groups" locationNameList:"item" type:"list"` } @@ -79342,7 +87791,7 @@ type StartInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more instance IDs. + // The IDs of the instances. // // InstanceIds is a required field InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` @@ -79392,7 +87841,7 @@ func (s *StartInstancesInput) SetInstanceIds(v []*string) *StartInstancesInput { type StartInstancesOutput struct { _ struct{} `type:"structure"` - // Information about one or more started instances. + // Information about the started instances. StartingInstances []*InstanceStateChange `locationName:"instancesSet" locationNameList:"item" type:"list"` } @@ -79502,13 +87951,13 @@ type StopInstancesInput struct { // Hibernates the instance if the instance was enabled for hibernation at launch. // If the instance cannot hibernate successfully, a normal shutdown occurs. - // For more information, see Hibernate Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) + // For more information, see Hibernate Your Instance (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html) // in the Amazon Elastic Compute Cloud User Guide. // // Default: false Hibernate *bool `type:"boolean"` - // One or more instance IDs. + // The IDs of the instances. // // InstanceIds is a required field InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` @@ -79564,7 +88013,7 @@ func (s *StopInstancesInput) SetInstanceIds(v []*string) *StopInstancesInput { type StopInstancesOutput struct { _ struct{} `type:"structure"` - // Information about one or more stopped instances. + // Information about the stopped instances. StoppingInstances []*InstanceStateChange `locationName:"instancesSet" locationNameList:"item" type:"list"` } @@ -79980,8 +88429,11 @@ type TagSpecification struct { _ struct{} `type:"structure"` // The type of resource to tag. Currently, the resource types that support tagging - // on creation are fleet, dedicated-host, instance, snapshot, and volume. To - // tag a resource after it has been created, see CreateTags. + // on creation are: capacity-reservation | client-vpn-endpoint | dedicated-host + // | fleet | instance | launch-template | snapshot | transit-gateway | transit-gateway-attachment + // | transit-gateway-route-table | volume. + // + // To tag a resource after it has been created, see CreateTags. ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"` // The tags to apply to the resource. @@ -80015,16 +88467,27 @@ func (s *TagSpecification) SetTags(v []*Tag) *TagSpecification { // your application workload, such as vCPUs, memory, or I/O. If the request // type is maintain, you can specify a target capacity of 0 and add capacity // later. +// +// You can use the On-Demand Instance MaxTotalPrice parameter, the Spot Instance +// MaxTotalPrice, or both to ensure your fleet cost does not exceed your budget. +// If you set a maximum price per hour for the On-Demand Instances and Spot +// Instances in your request, EC2 Fleet will launch instances until it reaches +// the maximum amount you're willing to pay. When the maximum amount you're +// willing to pay is reached, the fleet stops launching instances even if it +// hasn’t met the target capacity. The MaxTotalPrice parameters are located +// in and type TargetCapacitySpecification struct { _ struct{} `type:"structure"` // The default TotalTargetCapacity, which is either Spot or On-Demand. DefaultTargetCapacityType *string `locationName:"defaultTargetCapacityType" type:"string" enum:"DefaultTargetCapacityType"` - // The number of On-Demand units to request. + // The number of On-Demand units to request. If you specify a target capacity + // for Spot units, you cannot specify a target capacity for On-Demand units. OnDemandTargetCapacity *int64 `locationName:"onDemandTargetCapacity" type:"integer"` - // The maximum number of Spot units to launch. + // The maximum number of Spot units to launch. If you specify a target capacity + // for On-Demand units, you cannot specify a target capacity for Spot units. SpotTargetCapacity *int64 `locationName:"spotTargetCapacity" type:"integer"` // The number of units to request, filled using DefaultTargetCapacityType. @@ -80066,10 +88529,19 @@ func (s *TargetCapacitySpecification) SetTotalTargetCapacity(v int64) *TargetCap } // The number of units to request. You can choose to set the target capacity -// in terms of instances or a performance characteristic that is important to -// your application workload, such as vCPUs, memory, or I/O. If the request -// type is maintain, you can specify a target capacity of 0 and add capacity -// later. +// as the number of instances. Or you can set the target capacity to a performance +// characteristic that is important to your application workload, such as vCPUs, +// memory, or I/O. If the request type is maintain, you can specify a target +// capacity of 0 and add capacity later. +// +// You can use the On-Demand Instance MaxTotalPrice parameter, the Spot Instance +// MaxTotalPrice parameter, or both parameters to ensure that your fleet cost +// does not exceed your budget. If you set a maximum price per hour for the +// On-Demand Instances and Spot Instances in your request, EC2 Fleet will launch +// instances until it reaches the maximum amount you're willing to pay. When +// the maximum amount you're willing to pay is reached, the fleet stops launching +// instances even if it hasn’t met the target capacity. The MaxTotalPrice +// parameters are located in and . type TargetCapacitySpecificationRequest struct { _ struct{} `type:"structure"` @@ -80547,7 +89019,7 @@ type TerminateInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more instance IDs. + // The IDs of the instances. // // Constraints: Up to 1000 instance IDs. We recommend breaking up this request // into smaller batches. @@ -80594,7 +89066,7 @@ func (s *TerminateInstancesInput) SetInstanceIds(v []*string) *TerminateInstance type TerminateInstancesOutput struct { _ struct{} `type:"structure"` - // Information about one or more terminated instances. + // Information about the terminated instances. TerminatingInstances []*InstanceStateChange `locationName:"instancesSet" locationNameList:"item" type:"list"` } @@ -80614,6 +89086,452 @@ func (s *TerminateInstancesOutput) SetTerminatingInstances(v []*InstanceStateCha return s } +// Describes the Traffic Mirror filter. +type TrafficMirrorFilter struct { + _ struct{} `type:"structure"` + + // The description of the Traffic Mirror filter. + Description *string `locationName:"description" type:"string"` + + // Information about the egress rules that are associated with the Traffic Mirror + // filter. + EgressFilterRules []*TrafficMirrorFilterRule `locationName:"egressFilterRuleSet" locationNameList:"item" type:"list"` + + // Information about the ingress rules that are associated with the Traffic + // Mirror filter. + IngressFilterRules []*TrafficMirrorFilterRule `locationName:"ingressFilterRuleSet" locationNameList:"item" type:"list"` + + // The network service traffic that is associated with the Traffic Mirror filter. + NetworkServices []*string `locationName:"networkServiceSet" locationNameList:"item" type:"list"` + + // The tags assigned to the Traffic Mirror filter. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the Traffic Mirror filter. + TrafficMirrorFilterId *string `locationName:"trafficMirrorFilterId" type:"string"` +} + +// String returns the string representation +func (s TrafficMirrorFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TrafficMirrorFilter) GoString() string { + return s.String() +} + +// SetDescription sets the Description field's value. +func (s *TrafficMirrorFilter) SetDescription(v string) *TrafficMirrorFilter { + s.Description = &v + return s +} + +// SetEgressFilterRules sets the EgressFilterRules field's value. +func (s *TrafficMirrorFilter) SetEgressFilterRules(v []*TrafficMirrorFilterRule) *TrafficMirrorFilter { + s.EgressFilterRules = v + return s +} + +// SetIngressFilterRules sets the IngressFilterRules field's value. +func (s *TrafficMirrorFilter) SetIngressFilterRules(v []*TrafficMirrorFilterRule) *TrafficMirrorFilter { + s.IngressFilterRules = v + return s +} + +// SetNetworkServices sets the NetworkServices field's value. +func (s *TrafficMirrorFilter) SetNetworkServices(v []*string) *TrafficMirrorFilter { + s.NetworkServices = v + return s +} + +// SetTags sets the Tags field's value. +func (s *TrafficMirrorFilter) SetTags(v []*Tag) *TrafficMirrorFilter { + s.Tags = v + return s +} + +// SetTrafficMirrorFilterId sets the TrafficMirrorFilterId field's value. +func (s *TrafficMirrorFilter) SetTrafficMirrorFilterId(v string) *TrafficMirrorFilter { + s.TrafficMirrorFilterId = &v + return s +} + +// Describes the Traffic Mirror rule. +type TrafficMirrorFilterRule struct { + _ struct{} `type:"structure"` + + // The description of the Traffic Mirror rule. + Description *string `locationName:"description" type:"string"` + + // The destination CIDR block assigned to the Traffic Mirror rule. + DestinationCidrBlock *string `locationName:"destinationCidrBlock" type:"string"` + + // The destination port range assigned to the Traffic Mirror rule. + DestinationPortRange *TrafficMirrorPortRange `locationName:"destinationPortRange" type:"structure"` + + // The protocol assigned to the Traffic Mirror rule. + Protocol *int64 `locationName:"protocol" type:"integer"` + + // The action assigned to the Traffic Mirror rule. + RuleAction *string `locationName:"ruleAction" type:"string" enum:"TrafficMirrorRuleAction"` + + // The rule number of the Traffic Mirror rule. + RuleNumber *int64 `locationName:"ruleNumber" type:"integer"` + + // The source CIDR block assigned to the Traffic Mirror rule. + SourceCidrBlock *string `locationName:"sourceCidrBlock" type:"string"` + + // The source port range assigned to the Traffic Mirror rule. + SourcePortRange *TrafficMirrorPortRange `locationName:"sourcePortRange" type:"structure"` + + // The traffic direction assigned to the Traffic Mirror rule. + TrafficDirection *string `locationName:"trafficDirection" type:"string" enum:"TrafficDirection"` + + // The ID of the Traffic Mirror filter that the rule is associated with. + TrafficMirrorFilterId *string `locationName:"trafficMirrorFilterId" type:"string"` + + // The ID of the Traffic Mirror rule. + TrafficMirrorFilterRuleId *string `locationName:"trafficMirrorFilterRuleId" type:"string"` +} + +// String returns the string representation +func (s TrafficMirrorFilterRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TrafficMirrorFilterRule) GoString() string { + return s.String() +} + +// SetDescription sets the Description field's value. +func (s *TrafficMirrorFilterRule) SetDescription(v string) *TrafficMirrorFilterRule { + s.Description = &v + return s +} + +// SetDestinationCidrBlock sets the DestinationCidrBlock field's value. +func (s *TrafficMirrorFilterRule) SetDestinationCidrBlock(v string) *TrafficMirrorFilterRule { + s.DestinationCidrBlock = &v + return s +} + +// SetDestinationPortRange sets the DestinationPortRange field's value. +func (s *TrafficMirrorFilterRule) SetDestinationPortRange(v *TrafficMirrorPortRange) *TrafficMirrorFilterRule { + s.DestinationPortRange = v + return s +} + +// SetProtocol sets the Protocol field's value. +func (s *TrafficMirrorFilterRule) SetProtocol(v int64) *TrafficMirrorFilterRule { + s.Protocol = &v + return s +} + +// SetRuleAction sets the RuleAction field's value. +func (s *TrafficMirrorFilterRule) SetRuleAction(v string) *TrafficMirrorFilterRule { + s.RuleAction = &v + return s +} + +// SetRuleNumber sets the RuleNumber field's value. +func (s *TrafficMirrorFilterRule) SetRuleNumber(v int64) *TrafficMirrorFilterRule { + s.RuleNumber = &v + return s +} + +// SetSourceCidrBlock sets the SourceCidrBlock field's value. +func (s *TrafficMirrorFilterRule) SetSourceCidrBlock(v string) *TrafficMirrorFilterRule { + s.SourceCidrBlock = &v + return s +} + +// SetSourcePortRange sets the SourcePortRange field's value. +func (s *TrafficMirrorFilterRule) SetSourcePortRange(v *TrafficMirrorPortRange) *TrafficMirrorFilterRule { + s.SourcePortRange = v + return s +} + +// SetTrafficDirection sets the TrafficDirection field's value. +func (s *TrafficMirrorFilterRule) SetTrafficDirection(v string) *TrafficMirrorFilterRule { + s.TrafficDirection = &v + return s +} + +// SetTrafficMirrorFilterId sets the TrafficMirrorFilterId field's value. +func (s *TrafficMirrorFilterRule) SetTrafficMirrorFilterId(v string) *TrafficMirrorFilterRule { + s.TrafficMirrorFilterId = &v + return s +} + +// SetTrafficMirrorFilterRuleId sets the TrafficMirrorFilterRuleId field's value. +func (s *TrafficMirrorFilterRule) SetTrafficMirrorFilterRuleId(v string) *TrafficMirrorFilterRule { + s.TrafficMirrorFilterRuleId = &v + return s +} + +// Describes the Traffic Mirror port range. +type TrafficMirrorPortRange struct { + _ struct{} `type:"structure"` + + // The start of the Traffic Mirror port range. This applies to the TCP and UDP + // protocols. + FromPort *int64 `locationName:"fromPort" type:"integer"` + + // The end of the Traffic Mirror port range. This applies to the TCP and UDP + // protocols. + ToPort *int64 `locationName:"toPort" type:"integer"` +} + +// String returns the string representation +func (s TrafficMirrorPortRange) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TrafficMirrorPortRange) GoString() string { + return s.String() +} + +// SetFromPort sets the FromPort field's value. +func (s *TrafficMirrorPortRange) SetFromPort(v int64) *TrafficMirrorPortRange { + s.FromPort = &v + return s +} + +// SetToPort sets the ToPort field's value. +func (s *TrafficMirrorPortRange) SetToPort(v int64) *TrafficMirrorPortRange { + s.ToPort = &v + return s +} + +// Information about the Traffic Mirror filter rule port range. +type TrafficMirrorPortRangeRequest struct { + _ struct{} `type:"structure"` + + // The first port in the Traffic Mirror port range. This applies to the TCP + // and UDP protocols. + FromPort *int64 `type:"integer"` + + // The last port in the Traffic Mirror port range. This applies to the TCP and + // UDP protocols. + ToPort *int64 `type:"integer"` +} + +// String returns the string representation +func (s TrafficMirrorPortRangeRequest) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TrafficMirrorPortRangeRequest) GoString() string { + return s.String() +} + +// SetFromPort sets the FromPort field's value. +func (s *TrafficMirrorPortRangeRequest) SetFromPort(v int64) *TrafficMirrorPortRangeRequest { + s.FromPort = &v + return s +} + +// SetToPort sets the ToPort field's value. +func (s *TrafficMirrorPortRangeRequest) SetToPort(v int64) *TrafficMirrorPortRangeRequest { + s.ToPort = &v + return s +} + +// Describes a Traffic Mirror session. +type TrafficMirrorSession struct { + _ struct{} `type:"structure"` + + // The description of the Traffic Mirror session. + Description *string `locationName:"description" type:"string"` + + // The ID of the Traffic Mirror session's network interface. + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` + + // The ID of the account that owns the Traffic Mirror session. + OwnerId *string `locationName:"ownerId" type:"string"` + + // The number of bytes in each packet to mirror. These are the bytes after the + // VXLAN header. To mirror a subset, set this to the length (in bytes) to mirror. + // For example, if you set this value to 100, then the first 100 bytes that + // meet the filter criteria are copied to the target. Do not specify this parameter + // when you want to mirror the entire packet + PacketLength *int64 `locationName:"packetLength" type:"integer"` + + // The session number determines the order in which sessions are evaluated when + // an interface is used by multiple sessions. The first session with a matching + // filter is the one that mirrors the packets. + // + // Valid values are 1-32766. + SessionNumber *int64 `locationName:"sessionNumber" type:"integer"` + + // The tags assigned to the Traffic Mirror session. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the Traffic Mirror filter. + TrafficMirrorFilterId *string `locationName:"trafficMirrorFilterId" type:"string"` + + // The ID for the Traffic Mirror session. + TrafficMirrorSessionId *string `locationName:"trafficMirrorSessionId" type:"string"` + + // The ID of the Traffic Mirror target. + TrafficMirrorTargetId *string `locationName:"trafficMirrorTargetId" type:"string"` + + // The virtual network ID associated with the Traffic Mirror session. + VirtualNetworkId *int64 `locationName:"virtualNetworkId" type:"integer"` +} + +// String returns the string representation +func (s TrafficMirrorSession) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TrafficMirrorSession) GoString() string { + return s.String() +} + +// SetDescription sets the Description field's value. +func (s *TrafficMirrorSession) SetDescription(v string) *TrafficMirrorSession { + s.Description = &v + return s +} + +// SetNetworkInterfaceId sets the NetworkInterfaceId field's value. +func (s *TrafficMirrorSession) SetNetworkInterfaceId(v string) *TrafficMirrorSession { + s.NetworkInterfaceId = &v + return s +} + +// SetOwnerId sets the OwnerId field's value. +func (s *TrafficMirrorSession) SetOwnerId(v string) *TrafficMirrorSession { + s.OwnerId = &v + return s +} + +// SetPacketLength sets the PacketLength field's value. +func (s *TrafficMirrorSession) SetPacketLength(v int64) *TrafficMirrorSession { + s.PacketLength = &v + return s +} + +// SetSessionNumber sets the SessionNumber field's value. +func (s *TrafficMirrorSession) SetSessionNumber(v int64) *TrafficMirrorSession { + s.SessionNumber = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TrafficMirrorSession) SetTags(v []*Tag) *TrafficMirrorSession { + s.Tags = v + return s +} + +// SetTrafficMirrorFilterId sets the TrafficMirrorFilterId field's value. +func (s *TrafficMirrorSession) SetTrafficMirrorFilterId(v string) *TrafficMirrorSession { + s.TrafficMirrorFilterId = &v + return s +} + +// SetTrafficMirrorSessionId sets the TrafficMirrorSessionId field's value. +func (s *TrafficMirrorSession) SetTrafficMirrorSessionId(v string) *TrafficMirrorSession { + s.TrafficMirrorSessionId = &v + return s +} + +// SetTrafficMirrorTargetId sets the TrafficMirrorTargetId field's value. +func (s *TrafficMirrorSession) SetTrafficMirrorTargetId(v string) *TrafficMirrorSession { + s.TrafficMirrorTargetId = &v + return s +} + +// SetVirtualNetworkId sets the VirtualNetworkId field's value. +func (s *TrafficMirrorSession) SetVirtualNetworkId(v int64) *TrafficMirrorSession { + s.VirtualNetworkId = &v + return s +} + +// Describes a Traffic Mirror target. +type TrafficMirrorTarget struct { + _ struct{} `type:"structure"` + + // Information about the Traffic Mirror target. + Description *string `locationName:"description" type:"string"` + + // The network interface ID that is attached to the target. + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` + + // The Amazon Resource Name (ARN) of the Network Load Balancer. + NetworkLoadBalancerArn *string `locationName:"networkLoadBalancerArn" type:"string"` + + // The ID of the account that owns the Traffic Mirror target. + OwnerId *string `locationName:"ownerId" type:"string"` + + // The tags assigned to the Traffic Mirror target. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the Traffic Mirror target. + TrafficMirrorTargetId *string `locationName:"trafficMirrorTargetId" type:"string"` + + // The type of Traffic Mirror target. + Type *string `locationName:"type" type:"string" enum:"TrafficMirrorTargetType"` +} + +// String returns the string representation +func (s TrafficMirrorTarget) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TrafficMirrorTarget) GoString() string { + return s.String() +} + +// SetDescription sets the Description field's value. +func (s *TrafficMirrorTarget) SetDescription(v string) *TrafficMirrorTarget { + s.Description = &v + return s +} + +// SetNetworkInterfaceId sets the NetworkInterfaceId field's value. +func (s *TrafficMirrorTarget) SetNetworkInterfaceId(v string) *TrafficMirrorTarget { + s.NetworkInterfaceId = &v + return s +} + +// SetNetworkLoadBalancerArn sets the NetworkLoadBalancerArn field's value. +func (s *TrafficMirrorTarget) SetNetworkLoadBalancerArn(v string) *TrafficMirrorTarget { + s.NetworkLoadBalancerArn = &v + return s +} + +// SetOwnerId sets the OwnerId field's value. +func (s *TrafficMirrorTarget) SetOwnerId(v string) *TrafficMirrorTarget { + s.OwnerId = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TrafficMirrorTarget) SetTags(v []*Tag) *TrafficMirrorTarget { + s.Tags = v + return s +} + +// SetTrafficMirrorTargetId sets the TrafficMirrorTargetId field's value. +func (s *TrafficMirrorTarget) SetTrafficMirrorTargetId(v string) *TrafficMirrorTarget { + s.TrafficMirrorTargetId = &v + return s +} + +// SetType sets the Type field's value. +func (s *TrafficMirrorTarget) SetType(v string) *TrafficMirrorTarget { + s.Type = &v + return s +} + // Describes a transit gateway. type TransitGateway struct { _ struct{} `type:"structure"` @@ -81723,7 +90641,7 @@ type UnmonitorInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more instance IDs. + // The IDs of the instances. // // InstanceIds is a required field InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` @@ -81890,7 +90808,7 @@ func (s *UnsuccessfulItem) SetResourceId(v string) *UnsuccessfulItem { } // Information about the error that occurred. For more information about errors, -// see Error Codes (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html). +// see Error Codes (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html). type UnsuccessfulItemError struct { _ struct{} `type:"structure"` @@ -82371,31 +91289,29 @@ type Volume struct { // The time stamp when volume creation was initiated. CreateTime *time.Time `locationName:"createTime" type:"timestamp"` - // Indicates whether the volume will be encrypted. + // Indicates whether the volume is encrypted. Encrypted *bool `locationName:"encrypted" type:"boolean"` // The number of I/O operations per second (IOPS) that the volume supports. // For Provisioned IOPS SSD volumes, this represents the number of IOPS that // are provisioned for the volume. For General Purpose SSD volumes, this represents // the baseline performance of the volume and the rate at which the volume accumulates - // I/O credits for bursting. For more information about General Purpose SSD - // baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types - // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // I/O credits for bursting. For more information, see Amazon EBS Volume Types + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) // in the Amazon Elastic Compute Cloud User Guide. // // Constraints: Range is 100-16,000 IOPS for gp2 volumes and 100 to 64,000IOPS - // for io1 volumes in most regions. Maximum io1IOPS of 64,000 is guaranteed - // only on Nitro-based instances (AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances). - // Other instance families guarantee performance up to 32,000 IOPS. For more - // information, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) - // in the Amazon Elastic Compute Cloud User Guide. + // for io1 volumes, in most Regions. The maximum IOPS for io1 of 64,000 is guaranteed + // only on Nitro-based instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances). + // Other instance families guarantee performance up to 32,000 IOPS. // // Condition: This parameter is required for requests to create io1 volumes; // it is not used in requests to create gp2, st1, sc1, or standard volumes. Iops *int64 `locationName:"iops" type:"integer"` - // The full ARN of the AWS Key Management Service (AWS KMS) customer master - // key (CMK) that was used to protect the volume encryption key for the volume. + // The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) + // customer master key (CMK) that was used to protect the volume encryption + // key for the volume. KmsKeyId *string `locationName:"kmsKeyId" type:"string"` // The size of the volume, in GiBs. @@ -83245,6 +92161,9 @@ type VpcEndpoint struct { // (Interface endpoint) One or more network interfaces for the endpoint. NetworkInterfaceIds []*string `locationName:"networkInterfaceIdSet" locationNameList:"item" type:"list"` + // The ID of the AWS account that owns the VPC endpoint. + OwnerId *string `locationName:"ownerId" type:"string"` + // The policy document associated with the endpoint, if applicable. PolicyDocument *string `locationName:"policyDocument" type:"string"` @@ -83252,6 +92171,9 @@ type VpcEndpoint struct { // hosted zone. PrivateDnsEnabled *bool `locationName:"privateDnsEnabled" type:"boolean"` + // Indicates whether the VPC endpoint is being managed by its service. + RequesterManaged *bool `locationName:"requesterManaged" type:"boolean"` + // (Gateway endpoint) One or more route tables associated with the endpoint. RouteTableIds []*string `locationName:"routeTableIdSet" locationNameList:"item" type:"list"` @@ -83264,6 +92186,9 @@ type VpcEndpoint struct { // (Interface endpoint) One or more subnets in which the endpoint is located. SubnetIds []*string `locationName:"subnetIdSet" locationNameList:"item" type:"list"` + // Any tags assigned to the VPC endpoint. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + // The ID of the VPC endpoint. VpcEndpointId *string `locationName:"vpcEndpointId" type:"string"` @@ -83308,6 +92233,12 @@ func (s *VpcEndpoint) SetNetworkInterfaceIds(v []*string) *VpcEndpoint { return s } +// SetOwnerId sets the OwnerId field's value. +func (s *VpcEndpoint) SetOwnerId(v string) *VpcEndpoint { + s.OwnerId = &v + return s +} + // SetPolicyDocument sets the PolicyDocument field's value. func (s *VpcEndpoint) SetPolicyDocument(v string) *VpcEndpoint { s.PolicyDocument = &v @@ -83320,6 +92251,12 @@ func (s *VpcEndpoint) SetPrivateDnsEnabled(v bool) *VpcEndpoint { return s } +// SetRequesterManaged sets the RequesterManaged field's value. +func (s *VpcEndpoint) SetRequesterManaged(v bool) *VpcEndpoint { + s.RequesterManaged = &v + return s +} + // SetRouteTableIds sets the RouteTableIds field's value. func (s *VpcEndpoint) SetRouteTableIds(v []*string) *VpcEndpoint { s.RouteTableIds = v @@ -83344,6 +92281,12 @@ func (s *VpcEndpoint) SetSubnetIds(v []*string) *VpcEndpoint { return s } +// SetTags sets the Tags field's value. +func (s *VpcEndpoint) SetTags(v []*Tag) *VpcEndpoint { + s.Tags = v + return s +} + // SetVpcEndpointId sets the VpcEndpointId field's value. func (s *VpcEndpoint) SetVpcEndpointId(v string) *VpcEndpoint { s.VpcEndpointId = &v @@ -83369,6 +92312,12 @@ type VpcEndpointConnection struct { // The date and time the VPC endpoint was created. CreationTimestamp *time.Time `locationName:"creationTimestamp" type:"timestamp"` + // The DNS entries for the VPC endpoint. + DnsEntries []*DnsEntry `locationName:"dnsEntrySet" locationNameList:"item" type:"list"` + + // The Amazon Resource Names (ARNs) of the network load balancers for the service. + NetworkLoadBalancerArns []*string `locationName:"networkLoadBalancerArnSet" locationNameList:"item" type:"list"` + // The ID of the service to which the endpoint is connected. ServiceId *string `locationName:"serviceId" type:"string"` @@ -83398,6 +92347,18 @@ func (s *VpcEndpointConnection) SetCreationTimestamp(v time.Time) *VpcEndpointCo return s } +// SetDnsEntries sets the DnsEntries field's value. +func (s *VpcEndpointConnection) SetDnsEntries(v []*DnsEntry) *VpcEndpointConnection { + s.DnsEntries = v + return s +} + +// SetNetworkLoadBalancerArns sets the NetworkLoadBalancerArns field's value. +func (s *VpcEndpointConnection) SetNetworkLoadBalancerArns(v []*string) *VpcEndpointConnection { + s.NetworkLoadBalancerArns = v + return s +} + // SetServiceId sets the ServiceId field's value. func (s *VpcEndpointConnection) SetServiceId(v string) *VpcEndpointConnection { s.ServiceId = &v @@ -83633,7 +92594,7 @@ type VpcPeeringConnectionVpcInfo struct { // requester VPC. PeeringOptions *VpcPeeringConnectionOptionsDescription `locationName:"peeringOptions" type:"structure"` - // The region in which the VPC is located. + // The Region in which the VPC is located. Region *string `locationName:"region" type:"string"` // The ID of the VPC. @@ -83697,9 +92658,7 @@ type VpnConnection struct { _ struct{} `type:"structure"` // The category of the VPN connection. A value of VPN indicates an AWS VPN connection. - // A value of VPN-Classic indicates an AWS Classic VPN connection. For more - // information, see AWS Managed VPN Categories (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html#vpn-categories) - // in the Amazon Virtual Private Cloud User Guide. + // A value of VPN-Classic indicates an AWS Classic VPN connection. Category *string `locationName:"category" type:"string"` // The configuration information for the VPN connection's customer gateway (in @@ -84178,6 +93137,9 @@ const ( // AllocationStateReleasedPermanentFailure is a AllocationState enum value AllocationStateReleasedPermanentFailure = "released-permanent-failure" + + // AllocationStatePending is a AllocationState enum value + AllocationStatePending = "pending" ) const ( @@ -84186,6 +93148,9 @@ const ( // AllocationStrategyDiversified is a AllocationStrategy enum value AllocationStrategyDiversified = "diversified" + + // AllocationStrategyCapacityOptimized is a AllocationStrategy enum value + AllocationStrategyCapacityOptimized = "capacityOptimized" ) const ( @@ -84389,6 +93354,15 @@ const ( // CapacityReservationInstancePlatformWindowswithSqlserverWeb is a CapacityReservationInstancePlatform enum value CapacityReservationInstancePlatformWindowswithSqlserverWeb = "Windows with SQL Server Web" + + // CapacityReservationInstancePlatformLinuxwithSqlserverStandard is a CapacityReservationInstancePlatform enum value + CapacityReservationInstancePlatformLinuxwithSqlserverStandard = "Linux with SQL Server Standard" + + // CapacityReservationInstancePlatformLinuxwithSqlserverWeb is a CapacityReservationInstancePlatform enum value + CapacityReservationInstancePlatformLinuxwithSqlserverWeb = "Linux with SQL Server Web" + + // CapacityReservationInstancePlatformLinuxwithSqlserverEnterprise is a CapacityReservationInstancePlatform enum value + CapacityReservationInstancePlatformLinuxwithSqlserverEnterprise = "Linux with SQL Server Enterprise" ) const ( @@ -84528,6 +93502,11 @@ const ( ConversionTaskStateCompleted = "completed" ) +const ( + // CopyTagsFromSourceVolume is a CopyTagsFromSource enum value + CopyTagsFromSourceVolume = "volume" +) + const ( // CurrencyCodeValuesUsd is a CurrencyCodeValues enum value CurrencyCodeValuesUsd = "USD" @@ -84661,6 +93640,9 @@ const ( // EventTypeError is a EventType enum value EventTypeError = "error" + + // EventTypeInformation is a EventType enum value + EventTypeInformation = "information" ) const ( @@ -84815,6 +93797,14 @@ const ( GatewayTypeIpsec1 = "ipsec.1" ) +const ( + // HostRecoveryOn is a HostRecovery enum value + HostRecoveryOn = "on" + + // HostRecoveryOff is a HostRecovery enum value + HostRecoveryOff = "off" +) + const ( // HostTenancyDedicated is a HostTenancy enum value HostTenancyDedicated = "dedicated" @@ -85055,6 +94045,27 @@ const ( // InstanceTypeT32xlarge is a InstanceType enum value InstanceTypeT32xlarge = "t3.2xlarge" + // InstanceTypeT3aNano is a InstanceType enum value + InstanceTypeT3aNano = "t3a.nano" + + // InstanceTypeT3aMicro is a InstanceType enum value + InstanceTypeT3aMicro = "t3a.micro" + + // InstanceTypeT3aSmall is a InstanceType enum value + InstanceTypeT3aSmall = "t3a.small" + + // InstanceTypeT3aMedium is a InstanceType enum value + InstanceTypeT3aMedium = "t3a.medium" + + // InstanceTypeT3aLarge is a InstanceType enum value + InstanceTypeT3aLarge = "t3a.large" + + // InstanceTypeT3aXlarge is a InstanceType enum value + InstanceTypeT3aXlarge = "t3a.xlarge" + + // InstanceTypeT3a2xlarge is a InstanceType enum value + InstanceTypeT3a2xlarge = "t3a.2xlarge" + // InstanceTypeM1Small is a InstanceType enum value InstanceTypeM1Small = "m1.small" @@ -85154,9 +94165,15 @@ const ( // InstanceTypeR54xlarge is a InstanceType enum value InstanceTypeR54xlarge = "r5.4xlarge" + // InstanceTypeR58xlarge is a InstanceType enum value + InstanceTypeR58xlarge = "r5.8xlarge" + // InstanceTypeR512xlarge is a InstanceType enum value InstanceTypeR512xlarge = "r5.12xlarge" + // InstanceTypeR516xlarge is a InstanceType enum value + InstanceTypeR516xlarge = "r5.16xlarge" + // InstanceTypeR524xlarge is a InstanceType enum value InstanceTypeR524xlarge = "r5.24xlarge" @@ -85175,9 +94192,15 @@ const ( // InstanceTypeR5a4xlarge is a InstanceType enum value InstanceTypeR5a4xlarge = "r5a.4xlarge" + // InstanceTypeR5a8xlarge is a InstanceType enum value + InstanceTypeR5a8xlarge = "r5a.8xlarge" + // InstanceTypeR5a12xlarge is a InstanceType enum value InstanceTypeR5a12xlarge = "r5a.12xlarge" + // InstanceTypeR5a16xlarge is a InstanceType enum value + InstanceTypeR5a16xlarge = "r5a.16xlarge" + // InstanceTypeR5a24xlarge is a InstanceType enum value InstanceTypeR5a24xlarge = "r5a.24xlarge" @@ -85193,15 +94216,45 @@ const ( // InstanceTypeR5d4xlarge is a InstanceType enum value InstanceTypeR5d4xlarge = "r5d.4xlarge" + // InstanceTypeR5d8xlarge is a InstanceType enum value + InstanceTypeR5d8xlarge = "r5d.8xlarge" + // InstanceTypeR5d12xlarge is a InstanceType enum value InstanceTypeR5d12xlarge = "r5d.12xlarge" + // InstanceTypeR5d16xlarge is a InstanceType enum value + InstanceTypeR5d16xlarge = "r5d.16xlarge" + // InstanceTypeR5d24xlarge is a InstanceType enum value InstanceTypeR5d24xlarge = "r5d.24xlarge" // InstanceTypeR5dMetal is a InstanceType enum value InstanceTypeR5dMetal = "r5d.metal" + // InstanceTypeR5adLarge is a InstanceType enum value + InstanceTypeR5adLarge = "r5ad.large" + + // InstanceTypeR5adXlarge is a InstanceType enum value + InstanceTypeR5adXlarge = "r5ad.xlarge" + + // InstanceTypeR5ad2xlarge is a InstanceType enum value + InstanceTypeR5ad2xlarge = "r5ad.2xlarge" + + // InstanceTypeR5ad4xlarge is a InstanceType enum value + InstanceTypeR5ad4xlarge = "r5ad.4xlarge" + + // InstanceTypeR5ad8xlarge is a InstanceType enum value + InstanceTypeR5ad8xlarge = "r5ad.8xlarge" + + // InstanceTypeR5ad12xlarge is a InstanceType enum value + InstanceTypeR5ad12xlarge = "r5ad.12xlarge" + + // InstanceTypeR5ad16xlarge is a InstanceType enum value + InstanceTypeR5ad16xlarge = "r5ad.16xlarge" + + // InstanceTypeR5ad24xlarge is a InstanceType enum value + InstanceTypeR5ad24xlarge = "r5ad.24xlarge" + // InstanceTypeX116xlarge is a InstanceType enum value InstanceTypeX116xlarge = "x1.16xlarge" @@ -85259,6 +94312,27 @@ const ( // InstanceTypeI3Metal is a InstanceType enum value InstanceTypeI3Metal = "i3.metal" + // InstanceTypeI3enLarge is a InstanceType enum value + InstanceTypeI3enLarge = "i3en.large" + + // InstanceTypeI3enXlarge is a InstanceType enum value + InstanceTypeI3enXlarge = "i3en.xlarge" + + // InstanceTypeI3en2xlarge is a InstanceType enum value + InstanceTypeI3en2xlarge = "i3en.2xlarge" + + // InstanceTypeI3en3xlarge is a InstanceType enum value + InstanceTypeI3en3xlarge = "i3en.3xlarge" + + // InstanceTypeI3en6xlarge is a InstanceType enum value + InstanceTypeI3en6xlarge = "i3en.6xlarge" + + // InstanceTypeI3en12xlarge is a InstanceType enum value + InstanceTypeI3en12xlarge = "i3en.12xlarge" + + // InstanceTypeI3en24xlarge is a InstanceType enum value + InstanceTypeI3en24xlarge = "i3en.24xlarge" + // InstanceTypeHi14xlarge is a InstanceType enum value InstanceTypeHi14xlarge = "hi1.4xlarge" @@ -85316,9 +94390,18 @@ const ( // InstanceTypeC59xlarge is a InstanceType enum value InstanceTypeC59xlarge = "c5.9xlarge" + // InstanceTypeC512xlarge is a InstanceType enum value + InstanceTypeC512xlarge = "c5.12xlarge" + // InstanceTypeC518xlarge is a InstanceType enum value InstanceTypeC518xlarge = "c5.18xlarge" + // InstanceTypeC524xlarge is a InstanceType enum value + InstanceTypeC524xlarge = "c5.24xlarge" + + // InstanceTypeC5Metal is a InstanceType enum value + InstanceTypeC5Metal = "c5.metal" + // InstanceTypeC5dLarge is a InstanceType enum value InstanceTypeC5dLarge = "c5d.large" @@ -85436,12 +94519,21 @@ const ( // InstanceTypeM54xlarge is a InstanceType enum value InstanceTypeM54xlarge = "m5.4xlarge" + // InstanceTypeM58xlarge is a InstanceType enum value + InstanceTypeM58xlarge = "m5.8xlarge" + // InstanceTypeM512xlarge is a InstanceType enum value InstanceTypeM512xlarge = "m5.12xlarge" + // InstanceTypeM516xlarge is a InstanceType enum value + InstanceTypeM516xlarge = "m5.16xlarge" + // InstanceTypeM524xlarge is a InstanceType enum value InstanceTypeM524xlarge = "m5.24xlarge" + // InstanceTypeM5Metal is a InstanceType enum value + InstanceTypeM5Metal = "m5.metal" + // InstanceTypeM5aLarge is a InstanceType enum value InstanceTypeM5aLarge = "m5a.large" @@ -85454,9 +94546,15 @@ const ( // InstanceTypeM5a4xlarge is a InstanceType enum value InstanceTypeM5a4xlarge = "m5a.4xlarge" + // InstanceTypeM5a8xlarge is a InstanceType enum value + InstanceTypeM5a8xlarge = "m5a.8xlarge" + // InstanceTypeM5a12xlarge is a InstanceType enum value InstanceTypeM5a12xlarge = "m5a.12xlarge" + // InstanceTypeM5a16xlarge is a InstanceType enum value + InstanceTypeM5a16xlarge = "m5a.16xlarge" + // InstanceTypeM5a24xlarge is a InstanceType enum value InstanceTypeM5a24xlarge = "m5a.24xlarge" @@ -85472,12 +94570,45 @@ const ( // InstanceTypeM5d4xlarge is a InstanceType enum value InstanceTypeM5d4xlarge = "m5d.4xlarge" + // InstanceTypeM5d8xlarge is a InstanceType enum value + InstanceTypeM5d8xlarge = "m5d.8xlarge" + // InstanceTypeM5d12xlarge is a InstanceType enum value InstanceTypeM5d12xlarge = "m5d.12xlarge" + // InstanceTypeM5d16xlarge is a InstanceType enum value + InstanceTypeM5d16xlarge = "m5d.16xlarge" + // InstanceTypeM5d24xlarge is a InstanceType enum value InstanceTypeM5d24xlarge = "m5d.24xlarge" + // InstanceTypeM5dMetal is a InstanceType enum value + InstanceTypeM5dMetal = "m5d.metal" + + // InstanceTypeM5adLarge is a InstanceType enum value + InstanceTypeM5adLarge = "m5ad.large" + + // InstanceTypeM5adXlarge is a InstanceType enum value + InstanceTypeM5adXlarge = "m5ad.xlarge" + + // InstanceTypeM5ad2xlarge is a InstanceType enum value + InstanceTypeM5ad2xlarge = "m5ad.2xlarge" + + // InstanceTypeM5ad4xlarge is a InstanceType enum value + InstanceTypeM5ad4xlarge = "m5ad.4xlarge" + + // InstanceTypeM5ad8xlarge is a InstanceType enum value + InstanceTypeM5ad8xlarge = "m5ad.8xlarge" + + // InstanceTypeM5ad12xlarge is a InstanceType enum value + InstanceTypeM5ad12xlarge = "m5ad.12xlarge" + + // InstanceTypeM5ad16xlarge is a InstanceType enum value + InstanceTypeM5ad16xlarge = "m5ad.16xlarge" + + // InstanceTypeM5ad24xlarge is a InstanceType enum value + InstanceTypeM5ad24xlarge = "m5ad.24xlarge" + // InstanceTypeH12xlarge is a InstanceType enum value InstanceTypeH12xlarge = "h1.2xlarge" @@ -85508,6 +94639,9 @@ const ( // InstanceTypeZ1d12xlarge is a InstanceType enum value InstanceTypeZ1d12xlarge = "z1d.12xlarge" + // InstanceTypeZ1dMetal is a InstanceType enum value + InstanceTypeZ1dMetal = "z1d.metal" + // InstanceTypeU6tb1Metal is a InstanceType enum value InstanceTypeU6tb1Metal = "u-6tb1.metal" @@ -85663,6 +94797,11 @@ const ( NetworkInterfaceAttributeAttachment = "attachment" ) +const ( + // NetworkInterfaceCreationTypeEfa is a NetworkInterfaceCreationType enum value + NetworkInterfaceCreationTypeEfa = "efa" +) + const ( // NetworkInterfacePermissionStateCodePending is a NetworkInterfacePermissionStateCode enum value NetworkInterfacePermissionStateCodePending = "pending" @@ -85700,6 +94839,9 @@ const ( // NetworkInterfaceTypeNatGateway is a NetworkInterfaceType enum value NetworkInterfaceTypeNatGateway = "natGateway" + + // NetworkInterfaceTypeEfa is a NetworkInterfaceType enum value + NetworkInterfaceTypeEfa = "efa" ) const ( @@ -85915,6 +95057,9 @@ const ( ) const ( + // ResourceTypeClientVpnEndpoint is a ResourceType enum value + ResourceTypeClientVpnEndpoint = "client-vpn-endpoint" + // ResourceTypeCustomerGateway is a ResourceType enum value ResourceTypeCustomerGateway = "customer-gateway" @@ -85933,6 +95078,9 @@ const ( // ResourceTypeFpgaImage is a ResourceType enum value ResourceTypeFpgaImage = "fpga-image" + // ResourceTypeHostReservation is a ResourceType enum value + ResourceTypeHostReservation = "host-reservation" + // ResourceTypeImage is a ResourceType enum value ResourceTypeImage = "image" @@ -85972,6 +95120,15 @@ const ( // ResourceTypeSubnet is a ResourceType enum value ResourceTypeSubnet = "subnet" + // ResourceTypeTrafficMirrorFilter is a ResourceType enum value + ResourceTypeTrafficMirrorFilter = "traffic-mirror-filter" + + // ResourceTypeTrafficMirrorSession is a ResourceType enum value + ResourceTypeTrafficMirrorSession = "traffic-mirror-session" + + // ResourceTypeTrafficMirrorTarget is a ResourceType enum value + ResourceTypeTrafficMirrorTarget = "traffic-mirror-target" + // ResourceTypeTransitGateway is a ResourceType enum value ResourceTypeTransitGateway = "transit-gateway" @@ -86082,6 +95239,9 @@ const ( // SpotAllocationStrategyDiversified is a SpotAllocationStrategy enum value SpotAllocationStrategyDiversified = "diversified" + + // SpotAllocationStrategyCapacityOptimized is a SpotAllocationStrategy enum value + SpotAllocationStrategyCapacityOptimized = "capacity-optimized" ) const ( @@ -86240,6 +95400,60 @@ const ( TenancyHost = "host" ) +const ( + // TrafficDirectionIngress is a TrafficDirection enum value + TrafficDirectionIngress = "ingress" + + // TrafficDirectionEgress is a TrafficDirection enum value + TrafficDirectionEgress = "egress" +) + +const ( + // TrafficMirrorFilterRuleFieldDestinationPortRange is a TrafficMirrorFilterRuleField enum value + TrafficMirrorFilterRuleFieldDestinationPortRange = "destination-port-range" + + // TrafficMirrorFilterRuleFieldSourcePortRange is a TrafficMirrorFilterRuleField enum value + TrafficMirrorFilterRuleFieldSourcePortRange = "source-port-range" + + // TrafficMirrorFilterRuleFieldProtocol is a TrafficMirrorFilterRuleField enum value + TrafficMirrorFilterRuleFieldProtocol = "protocol" + + // TrafficMirrorFilterRuleFieldDescription is a TrafficMirrorFilterRuleField enum value + TrafficMirrorFilterRuleFieldDescription = "description" +) + +const ( + // TrafficMirrorNetworkServiceAmazonDns is a TrafficMirrorNetworkService enum value + TrafficMirrorNetworkServiceAmazonDns = "amazon-dns" +) + +const ( + // TrafficMirrorRuleActionAccept is a TrafficMirrorRuleAction enum value + TrafficMirrorRuleActionAccept = "accept" + + // TrafficMirrorRuleActionReject is a TrafficMirrorRuleAction enum value + TrafficMirrorRuleActionReject = "reject" +) + +const ( + // TrafficMirrorSessionFieldPacketLength is a TrafficMirrorSessionField enum value + TrafficMirrorSessionFieldPacketLength = "packet-length" + + // TrafficMirrorSessionFieldDescription is a TrafficMirrorSessionField enum value + TrafficMirrorSessionFieldDescription = "description" + + // TrafficMirrorSessionFieldVirtualNetworkId is a TrafficMirrorSessionField enum value + TrafficMirrorSessionFieldVirtualNetworkId = "virtual-network-id" +) + +const ( + // TrafficMirrorTargetTypeNetworkInterface is a TrafficMirrorTargetType enum value + TrafficMirrorTargetTypeNetworkInterface = "network-interface" + + // TrafficMirrorTargetTypeNetworkLoadBalancer is a TrafficMirrorTargetType enum value + TrafficMirrorTargetTypeNetworkLoadBalancer = "network-load-balancer" +) + const ( // TrafficTypeAccept is a TrafficType enum value TrafficTypeAccept = "ACCEPT" @@ -86271,6 +95485,9 @@ const ( // TransitGatewayAttachmentResourceTypeVpn is a TransitGatewayAttachmentResourceType enum value TransitGatewayAttachmentResourceTypeVpn = "vpn" + + // TransitGatewayAttachmentResourceTypeDirectConnectGateway is a TransitGatewayAttachmentResourceType enum value + TransitGatewayAttachmentResourceTypeDirectConnectGateway = "direct-connect-gateway" ) const ( diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go index c258e0e85..e403b84a4 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go @@ -7,18 +7,19 @@ // capacity in the AWS cloud. Using Amazon EC2 eliminates the need to invest // in hardware up front, so you can develop and deploy applications faster. // -// To learn more about Amazon EC2, Amazon EBS, and Amazon VPC, see the following -// resources: +// To learn more, see the following resources: // -// * Amazon EC2 product page (http://aws.amazon.com/ec2) +// * Amazon EC2: Amazon EC2 product page (http://aws.amazon.com/ec2), Amazon +// EC2 documentation (http://aws.amazon.com/documentation/ec2) // -// * Amazon EC2 documentation (http://aws.amazon.com/documentation/ec2) +// * Amazon EBS: Amazon EBS product page (http://aws.amazon.com/ebs), Amazon +// EBS documentation (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) // -// * Amazon EBS product page (http://aws.amazon.com/ebs) +// * Amazon VPC: Amazon VPC product page (http://aws.amazon.com/vpc), Amazon +// VPC documentation (http://aws.amazon.com/documentation/vpc) // -// * Amazon VPC product page (http://aws.amazon.com/vpc) -// -// * Amazon VPC documentation (http://aws.amazon.com/documentation/vpc) +// * AWS VPN: AWS VPN product page (http://aws.amazon.com/vpn), AWS VPN documentation +// (http://aws.amazon.com/documentation/vpn) // // See https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15 for more information on this service. // diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go index b501759b6..6edcf2508 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go @@ -328,6 +328,10 @@ type EC2API interface { CreateSnapshotWithContext(aws.Context, *ec2.CreateSnapshotInput, ...request.Option) (*ec2.Snapshot, error) CreateSnapshotRequest(*ec2.CreateSnapshotInput) (*request.Request, *ec2.Snapshot) + CreateSnapshots(*ec2.CreateSnapshotsInput) (*ec2.CreateSnapshotsOutput, error) + CreateSnapshotsWithContext(aws.Context, *ec2.CreateSnapshotsInput, ...request.Option) (*ec2.CreateSnapshotsOutput, error) + CreateSnapshotsRequest(*ec2.CreateSnapshotsInput) (*request.Request, *ec2.CreateSnapshotsOutput) + CreateSpotDatafeedSubscription(*ec2.CreateSpotDatafeedSubscriptionInput) (*ec2.CreateSpotDatafeedSubscriptionOutput, error) CreateSpotDatafeedSubscriptionWithContext(aws.Context, *ec2.CreateSpotDatafeedSubscriptionInput, ...request.Option) (*ec2.CreateSpotDatafeedSubscriptionOutput, error) CreateSpotDatafeedSubscriptionRequest(*ec2.CreateSpotDatafeedSubscriptionInput) (*request.Request, *ec2.CreateSpotDatafeedSubscriptionOutput) @@ -340,6 +344,22 @@ type EC2API interface { CreateTagsWithContext(aws.Context, *ec2.CreateTagsInput, ...request.Option) (*ec2.CreateTagsOutput, error) CreateTagsRequest(*ec2.CreateTagsInput) (*request.Request, *ec2.CreateTagsOutput) + CreateTrafficMirrorFilter(*ec2.CreateTrafficMirrorFilterInput) (*ec2.CreateTrafficMirrorFilterOutput, error) + CreateTrafficMirrorFilterWithContext(aws.Context, *ec2.CreateTrafficMirrorFilterInput, ...request.Option) (*ec2.CreateTrafficMirrorFilterOutput, error) + CreateTrafficMirrorFilterRequest(*ec2.CreateTrafficMirrorFilterInput) (*request.Request, *ec2.CreateTrafficMirrorFilterOutput) + + CreateTrafficMirrorFilterRule(*ec2.CreateTrafficMirrorFilterRuleInput) (*ec2.CreateTrafficMirrorFilterRuleOutput, error) + CreateTrafficMirrorFilterRuleWithContext(aws.Context, *ec2.CreateTrafficMirrorFilterRuleInput, ...request.Option) (*ec2.CreateTrafficMirrorFilterRuleOutput, error) + CreateTrafficMirrorFilterRuleRequest(*ec2.CreateTrafficMirrorFilterRuleInput) (*request.Request, *ec2.CreateTrafficMirrorFilterRuleOutput) + + CreateTrafficMirrorSession(*ec2.CreateTrafficMirrorSessionInput) (*ec2.CreateTrafficMirrorSessionOutput, error) + CreateTrafficMirrorSessionWithContext(aws.Context, *ec2.CreateTrafficMirrorSessionInput, ...request.Option) (*ec2.CreateTrafficMirrorSessionOutput, error) + CreateTrafficMirrorSessionRequest(*ec2.CreateTrafficMirrorSessionInput) (*request.Request, *ec2.CreateTrafficMirrorSessionOutput) + + CreateTrafficMirrorTarget(*ec2.CreateTrafficMirrorTargetInput) (*ec2.CreateTrafficMirrorTargetOutput, error) + CreateTrafficMirrorTargetWithContext(aws.Context, *ec2.CreateTrafficMirrorTargetInput, ...request.Option) (*ec2.CreateTrafficMirrorTargetOutput, error) + CreateTrafficMirrorTargetRequest(*ec2.CreateTrafficMirrorTargetInput) (*request.Request, *ec2.CreateTrafficMirrorTargetOutput) + CreateTransitGateway(*ec2.CreateTransitGatewayInput) (*ec2.CreateTransitGatewayOutput, error) CreateTransitGatewayWithContext(aws.Context, *ec2.CreateTransitGatewayInput, ...request.Option) (*ec2.CreateTransitGatewayOutput, error) CreateTransitGatewayRequest(*ec2.CreateTransitGatewayInput) (*request.Request, *ec2.CreateTransitGatewayOutput) @@ -492,6 +512,22 @@ type EC2API interface { DeleteTagsWithContext(aws.Context, *ec2.DeleteTagsInput, ...request.Option) (*ec2.DeleteTagsOutput, error) DeleteTagsRequest(*ec2.DeleteTagsInput) (*request.Request, *ec2.DeleteTagsOutput) + DeleteTrafficMirrorFilter(*ec2.DeleteTrafficMirrorFilterInput) (*ec2.DeleteTrafficMirrorFilterOutput, error) + DeleteTrafficMirrorFilterWithContext(aws.Context, *ec2.DeleteTrafficMirrorFilterInput, ...request.Option) (*ec2.DeleteTrafficMirrorFilterOutput, error) + DeleteTrafficMirrorFilterRequest(*ec2.DeleteTrafficMirrorFilterInput) (*request.Request, *ec2.DeleteTrafficMirrorFilterOutput) + + DeleteTrafficMirrorFilterRule(*ec2.DeleteTrafficMirrorFilterRuleInput) (*ec2.DeleteTrafficMirrorFilterRuleOutput, error) + DeleteTrafficMirrorFilterRuleWithContext(aws.Context, *ec2.DeleteTrafficMirrorFilterRuleInput, ...request.Option) (*ec2.DeleteTrafficMirrorFilterRuleOutput, error) + DeleteTrafficMirrorFilterRuleRequest(*ec2.DeleteTrafficMirrorFilterRuleInput) (*request.Request, *ec2.DeleteTrafficMirrorFilterRuleOutput) + + DeleteTrafficMirrorSession(*ec2.DeleteTrafficMirrorSessionInput) (*ec2.DeleteTrafficMirrorSessionOutput, error) + DeleteTrafficMirrorSessionWithContext(aws.Context, *ec2.DeleteTrafficMirrorSessionInput, ...request.Option) (*ec2.DeleteTrafficMirrorSessionOutput, error) + DeleteTrafficMirrorSessionRequest(*ec2.DeleteTrafficMirrorSessionInput) (*request.Request, *ec2.DeleteTrafficMirrorSessionOutput) + + DeleteTrafficMirrorTarget(*ec2.DeleteTrafficMirrorTargetInput) (*ec2.DeleteTrafficMirrorTargetOutput, error) + DeleteTrafficMirrorTargetWithContext(aws.Context, *ec2.DeleteTrafficMirrorTargetInput, ...request.Option) (*ec2.DeleteTrafficMirrorTargetOutput, error) + DeleteTrafficMirrorTargetRequest(*ec2.DeleteTrafficMirrorTargetInput) (*request.Request, *ec2.DeleteTrafficMirrorTargetOutput) + DeleteTransitGateway(*ec2.DeleteTransitGatewayInput) (*ec2.DeleteTransitGatewayOutput, error) DeleteTransitGatewayWithContext(aws.Context, *ec2.DeleteTransitGatewayInput, ...request.Option) (*ec2.DeleteTransitGatewayOutput, error) DeleteTransitGatewayRequest(*ec2.DeleteTransitGatewayInput) (*request.Request, *ec2.DeleteTransitGatewayOutput) @@ -576,34 +612,58 @@ type EC2API interface { DescribeByoipCidrsWithContext(aws.Context, *ec2.DescribeByoipCidrsInput, ...request.Option) (*ec2.DescribeByoipCidrsOutput, error) DescribeByoipCidrsRequest(*ec2.DescribeByoipCidrsInput) (*request.Request, *ec2.DescribeByoipCidrsOutput) + DescribeByoipCidrsPages(*ec2.DescribeByoipCidrsInput, func(*ec2.DescribeByoipCidrsOutput, bool) bool) error + DescribeByoipCidrsPagesWithContext(aws.Context, *ec2.DescribeByoipCidrsInput, func(*ec2.DescribeByoipCidrsOutput, bool) bool, ...request.Option) error + DescribeCapacityReservations(*ec2.DescribeCapacityReservationsInput) (*ec2.DescribeCapacityReservationsOutput, error) DescribeCapacityReservationsWithContext(aws.Context, *ec2.DescribeCapacityReservationsInput, ...request.Option) (*ec2.DescribeCapacityReservationsOutput, error) DescribeCapacityReservationsRequest(*ec2.DescribeCapacityReservationsInput) (*request.Request, *ec2.DescribeCapacityReservationsOutput) + DescribeCapacityReservationsPages(*ec2.DescribeCapacityReservationsInput, func(*ec2.DescribeCapacityReservationsOutput, bool) bool) error + DescribeCapacityReservationsPagesWithContext(aws.Context, *ec2.DescribeCapacityReservationsInput, func(*ec2.DescribeCapacityReservationsOutput, bool) bool, ...request.Option) error + DescribeClassicLinkInstances(*ec2.DescribeClassicLinkInstancesInput) (*ec2.DescribeClassicLinkInstancesOutput, error) DescribeClassicLinkInstancesWithContext(aws.Context, *ec2.DescribeClassicLinkInstancesInput, ...request.Option) (*ec2.DescribeClassicLinkInstancesOutput, error) DescribeClassicLinkInstancesRequest(*ec2.DescribeClassicLinkInstancesInput) (*request.Request, *ec2.DescribeClassicLinkInstancesOutput) + DescribeClassicLinkInstancesPages(*ec2.DescribeClassicLinkInstancesInput, func(*ec2.DescribeClassicLinkInstancesOutput, bool) bool) error + DescribeClassicLinkInstancesPagesWithContext(aws.Context, *ec2.DescribeClassicLinkInstancesInput, func(*ec2.DescribeClassicLinkInstancesOutput, bool) bool, ...request.Option) error + DescribeClientVpnAuthorizationRules(*ec2.DescribeClientVpnAuthorizationRulesInput) (*ec2.DescribeClientVpnAuthorizationRulesOutput, error) DescribeClientVpnAuthorizationRulesWithContext(aws.Context, *ec2.DescribeClientVpnAuthorizationRulesInput, ...request.Option) (*ec2.DescribeClientVpnAuthorizationRulesOutput, error) DescribeClientVpnAuthorizationRulesRequest(*ec2.DescribeClientVpnAuthorizationRulesInput) (*request.Request, *ec2.DescribeClientVpnAuthorizationRulesOutput) + DescribeClientVpnAuthorizationRulesPages(*ec2.DescribeClientVpnAuthorizationRulesInput, func(*ec2.DescribeClientVpnAuthorizationRulesOutput, bool) bool) error + DescribeClientVpnAuthorizationRulesPagesWithContext(aws.Context, *ec2.DescribeClientVpnAuthorizationRulesInput, func(*ec2.DescribeClientVpnAuthorizationRulesOutput, bool) bool, ...request.Option) error + DescribeClientVpnConnections(*ec2.DescribeClientVpnConnectionsInput) (*ec2.DescribeClientVpnConnectionsOutput, error) DescribeClientVpnConnectionsWithContext(aws.Context, *ec2.DescribeClientVpnConnectionsInput, ...request.Option) (*ec2.DescribeClientVpnConnectionsOutput, error) DescribeClientVpnConnectionsRequest(*ec2.DescribeClientVpnConnectionsInput) (*request.Request, *ec2.DescribeClientVpnConnectionsOutput) + DescribeClientVpnConnectionsPages(*ec2.DescribeClientVpnConnectionsInput, func(*ec2.DescribeClientVpnConnectionsOutput, bool) bool) error + DescribeClientVpnConnectionsPagesWithContext(aws.Context, *ec2.DescribeClientVpnConnectionsInput, func(*ec2.DescribeClientVpnConnectionsOutput, bool) bool, ...request.Option) error + DescribeClientVpnEndpoints(*ec2.DescribeClientVpnEndpointsInput) (*ec2.DescribeClientVpnEndpointsOutput, error) DescribeClientVpnEndpointsWithContext(aws.Context, *ec2.DescribeClientVpnEndpointsInput, ...request.Option) (*ec2.DescribeClientVpnEndpointsOutput, error) DescribeClientVpnEndpointsRequest(*ec2.DescribeClientVpnEndpointsInput) (*request.Request, *ec2.DescribeClientVpnEndpointsOutput) + DescribeClientVpnEndpointsPages(*ec2.DescribeClientVpnEndpointsInput, func(*ec2.DescribeClientVpnEndpointsOutput, bool) bool) error + DescribeClientVpnEndpointsPagesWithContext(aws.Context, *ec2.DescribeClientVpnEndpointsInput, func(*ec2.DescribeClientVpnEndpointsOutput, bool) bool, ...request.Option) error + DescribeClientVpnRoutes(*ec2.DescribeClientVpnRoutesInput) (*ec2.DescribeClientVpnRoutesOutput, error) DescribeClientVpnRoutesWithContext(aws.Context, *ec2.DescribeClientVpnRoutesInput, ...request.Option) (*ec2.DescribeClientVpnRoutesOutput, error) DescribeClientVpnRoutesRequest(*ec2.DescribeClientVpnRoutesInput) (*request.Request, *ec2.DescribeClientVpnRoutesOutput) + DescribeClientVpnRoutesPages(*ec2.DescribeClientVpnRoutesInput, func(*ec2.DescribeClientVpnRoutesOutput, bool) bool) error + DescribeClientVpnRoutesPagesWithContext(aws.Context, *ec2.DescribeClientVpnRoutesInput, func(*ec2.DescribeClientVpnRoutesOutput, bool) bool, ...request.Option) error + DescribeClientVpnTargetNetworks(*ec2.DescribeClientVpnTargetNetworksInput) (*ec2.DescribeClientVpnTargetNetworksOutput, error) DescribeClientVpnTargetNetworksWithContext(aws.Context, *ec2.DescribeClientVpnTargetNetworksInput, ...request.Option) (*ec2.DescribeClientVpnTargetNetworksOutput, error) DescribeClientVpnTargetNetworksRequest(*ec2.DescribeClientVpnTargetNetworksInput) (*request.Request, *ec2.DescribeClientVpnTargetNetworksOutput) + DescribeClientVpnTargetNetworksPages(*ec2.DescribeClientVpnTargetNetworksInput, func(*ec2.DescribeClientVpnTargetNetworksOutput, bool) bool) error + DescribeClientVpnTargetNetworksPagesWithContext(aws.Context, *ec2.DescribeClientVpnTargetNetworksInput, func(*ec2.DescribeClientVpnTargetNetworksOutput, bool) bool, ...request.Option) error + DescribeConversionTasks(*ec2.DescribeConversionTasksInput) (*ec2.DescribeConversionTasksOutput, error) DescribeConversionTasksWithContext(aws.Context, *ec2.DescribeConversionTasksInput, ...request.Option) (*ec2.DescribeConversionTasksOutput, error) DescribeConversionTasksRequest(*ec2.DescribeConversionTasksInput) (*request.Request, *ec2.DescribeConversionTasksOutput) @@ -616,10 +676,16 @@ type EC2API interface { DescribeDhcpOptionsWithContext(aws.Context, *ec2.DescribeDhcpOptionsInput, ...request.Option) (*ec2.DescribeDhcpOptionsOutput, error) DescribeDhcpOptionsRequest(*ec2.DescribeDhcpOptionsInput) (*request.Request, *ec2.DescribeDhcpOptionsOutput) + DescribeDhcpOptionsPages(*ec2.DescribeDhcpOptionsInput, func(*ec2.DescribeDhcpOptionsOutput, bool) bool) error + DescribeDhcpOptionsPagesWithContext(aws.Context, *ec2.DescribeDhcpOptionsInput, func(*ec2.DescribeDhcpOptionsOutput, bool) bool, ...request.Option) error + DescribeEgressOnlyInternetGateways(*ec2.DescribeEgressOnlyInternetGatewaysInput) (*ec2.DescribeEgressOnlyInternetGatewaysOutput, error) DescribeEgressOnlyInternetGatewaysWithContext(aws.Context, *ec2.DescribeEgressOnlyInternetGatewaysInput, ...request.Option) (*ec2.DescribeEgressOnlyInternetGatewaysOutput, error) DescribeEgressOnlyInternetGatewaysRequest(*ec2.DescribeEgressOnlyInternetGatewaysInput) (*request.Request, *ec2.DescribeEgressOnlyInternetGatewaysOutput) + DescribeEgressOnlyInternetGatewaysPages(*ec2.DescribeEgressOnlyInternetGatewaysInput, func(*ec2.DescribeEgressOnlyInternetGatewaysOutput, bool) bool) error + DescribeEgressOnlyInternetGatewaysPagesWithContext(aws.Context, *ec2.DescribeEgressOnlyInternetGatewaysInput, func(*ec2.DescribeEgressOnlyInternetGatewaysOutput, bool) bool, ...request.Option) error + DescribeElasticGpus(*ec2.DescribeElasticGpusInput) (*ec2.DescribeElasticGpusOutput, error) DescribeElasticGpusWithContext(aws.Context, *ec2.DescribeElasticGpusInput, ...request.Option) (*ec2.DescribeElasticGpusOutput, error) DescribeElasticGpusRequest(*ec2.DescribeElasticGpusInput) (*request.Request, *ec2.DescribeElasticGpusOutput) @@ -640,10 +706,16 @@ type EC2API interface { DescribeFleetsWithContext(aws.Context, *ec2.DescribeFleetsInput, ...request.Option) (*ec2.DescribeFleetsOutput, error) DescribeFleetsRequest(*ec2.DescribeFleetsInput) (*request.Request, *ec2.DescribeFleetsOutput) + DescribeFleetsPages(*ec2.DescribeFleetsInput, func(*ec2.DescribeFleetsOutput, bool) bool) error + DescribeFleetsPagesWithContext(aws.Context, *ec2.DescribeFleetsInput, func(*ec2.DescribeFleetsOutput, bool) bool, ...request.Option) error + DescribeFlowLogs(*ec2.DescribeFlowLogsInput) (*ec2.DescribeFlowLogsOutput, error) DescribeFlowLogsWithContext(aws.Context, *ec2.DescribeFlowLogsInput, ...request.Option) (*ec2.DescribeFlowLogsOutput, error) DescribeFlowLogsRequest(*ec2.DescribeFlowLogsInput) (*request.Request, *ec2.DescribeFlowLogsOutput) + DescribeFlowLogsPages(*ec2.DescribeFlowLogsInput, func(*ec2.DescribeFlowLogsOutput, bool) bool) error + DescribeFlowLogsPagesWithContext(aws.Context, *ec2.DescribeFlowLogsInput, func(*ec2.DescribeFlowLogsOutput, bool) bool, ...request.Option) error + DescribeFpgaImageAttribute(*ec2.DescribeFpgaImageAttributeInput) (*ec2.DescribeFpgaImageAttributeOutput, error) DescribeFpgaImageAttributeWithContext(aws.Context, *ec2.DescribeFpgaImageAttributeInput, ...request.Option) (*ec2.DescribeFpgaImageAttributeOutput, error) DescribeFpgaImageAttributeRequest(*ec2.DescribeFpgaImageAttributeInput) (*request.Request, *ec2.DescribeFpgaImageAttributeOutput) @@ -652,22 +724,37 @@ type EC2API interface { DescribeFpgaImagesWithContext(aws.Context, *ec2.DescribeFpgaImagesInput, ...request.Option) (*ec2.DescribeFpgaImagesOutput, error) DescribeFpgaImagesRequest(*ec2.DescribeFpgaImagesInput) (*request.Request, *ec2.DescribeFpgaImagesOutput) + DescribeFpgaImagesPages(*ec2.DescribeFpgaImagesInput, func(*ec2.DescribeFpgaImagesOutput, bool) bool) error + DescribeFpgaImagesPagesWithContext(aws.Context, *ec2.DescribeFpgaImagesInput, func(*ec2.DescribeFpgaImagesOutput, bool) bool, ...request.Option) error + DescribeHostReservationOfferings(*ec2.DescribeHostReservationOfferingsInput) (*ec2.DescribeHostReservationOfferingsOutput, error) DescribeHostReservationOfferingsWithContext(aws.Context, *ec2.DescribeHostReservationOfferingsInput, ...request.Option) (*ec2.DescribeHostReservationOfferingsOutput, error) DescribeHostReservationOfferingsRequest(*ec2.DescribeHostReservationOfferingsInput) (*request.Request, *ec2.DescribeHostReservationOfferingsOutput) + DescribeHostReservationOfferingsPages(*ec2.DescribeHostReservationOfferingsInput, func(*ec2.DescribeHostReservationOfferingsOutput, bool) bool) error + DescribeHostReservationOfferingsPagesWithContext(aws.Context, *ec2.DescribeHostReservationOfferingsInput, func(*ec2.DescribeHostReservationOfferingsOutput, bool) bool, ...request.Option) error + DescribeHostReservations(*ec2.DescribeHostReservationsInput) (*ec2.DescribeHostReservationsOutput, error) DescribeHostReservationsWithContext(aws.Context, *ec2.DescribeHostReservationsInput, ...request.Option) (*ec2.DescribeHostReservationsOutput, error) DescribeHostReservationsRequest(*ec2.DescribeHostReservationsInput) (*request.Request, *ec2.DescribeHostReservationsOutput) + DescribeHostReservationsPages(*ec2.DescribeHostReservationsInput, func(*ec2.DescribeHostReservationsOutput, bool) bool) error + DescribeHostReservationsPagesWithContext(aws.Context, *ec2.DescribeHostReservationsInput, func(*ec2.DescribeHostReservationsOutput, bool) bool, ...request.Option) error + DescribeHosts(*ec2.DescribeHostsInput) (*ec2.DescribeHostsOutput, error) DescribeHostsWithContext(aws.Context, *ec2.DescribeHostsInput, ...request.Option) (*ec2.DescribeHostsOutput, error) DescribeHostsRequest(*ec2.DescribeHostsInput) (*request.Request, *ec2.DescribeHostsOutput) + DescribeHostsPages(*ec2.DescribeHostsInput, func(*ec2.DescribeHostsOutput, bool) bool) error + DescribeHostsPagesWithContext(aws.Context, *ec2.DescribeHostsInput, func(*ec2.DescribeHostsOutput, bool) bool, ...request.Option) error + DescribeIamInstanceProfileAssociations(*ec2.DescribeIamInstanceProfileAssociationsInput) (*ec2.DescribeIamInstanceProfileAssociationsOutput, error) DescribeIamInstanceProfileAssociationsWithContext(aws.Context, *ec2.DescribeIamInstanceProfileAssociationsInput, ...request.Option) (*ec2.DescribeIamInstanceProfileAssociationsOutput, error) DescribeIamInstanceProfileAssociationsRequest(*ec2.DescribeIamInstanceProfileAssociationsInput) (*request.Request, *ec2.DescribeIamInstanceProfileAssociationsOutput) + DescribeIamInstanceProfileAssociationsPages(*ec2.DescribeIamInstanceProfileAssociationsInput, func(*ec2.DescribeIamInstanceProfileAssociationsOutput, bool) bool) error + DescribeIamInstanceProfileAssociationsPagesWithContext(aws.Context, *ec2.DescribeIamInstanceProfileAssociationsInput, func(*ec2.DescribeIamInstanceProfileAssociationsOutput, bool) bool, ...request.Option) error + DescribeIdFormat(*ec2.DescribeIdFormatInput) (*ec2.DescribeIdFormatOutput, error) DescribeIdFormatWithContext(aws.Context, *ec2.DescribeIdFormatInput, ...request.Option) (*ec2.DescribeIdFormatOutput, error) DescribeIdFormatRequest(*ec2.DescribeIdFormatInput) (*request.Request, *ec2.DescribeIdFormatOutput) @@ -688,10 +775,16 @@ type EC2API interface { DescribeImportImageTasksWithContext(aws.Context, *ec2.DescribeImportImageTasksInput, ...request.Option) (*ec2.DescribeImportImageTasksOutput, error) DescribeImportImageTasksRequest(*ec2.DescribeImportImageTasksInput) (*request.Request, *ec2.DescribeImportImageTasksOutput) + DescribeImportImageTasksPages(*ec2.DescribeImportImageTasksInput, func(*ec2.DescribeImportImageTasksOutput, bool) bool) error + DescribeImportImageTasksPagesWithContext(aws.Context, *ec2.DescribeImportImageTasksInput, func(*ec2.DescribeImportImageTasksOutput, bool) bool, ...request.Option) error + DescribeImportSnapshotTasks(*ec2.DescribeImportSnapshotTasksInput) (*ec2.DescribeImportSnapshotTasksOutput, error) DescribeImportSnapshotTasksWithContext(aws.Context, *ec2.DescribeImportSnapshotTasksInput, ...request.Option) (*ec2.DescribeImportSnapshotTasksOutput, error) DescribeImportSnapshotTasksRequest(*ec2.DescribeImportSnapshotTasksInput) (*request.Request, *ec2.DescribeImportSnapshotTasksOutput) + DescribeImportSnapshotTasksPages(*ec2.DescribeImportSnapshotTasksInput, func(*ec2.DescribeImportSnapshotTasksOutput, bool) bool) error + DescribeImportSnapshotTasksPagesWithContext(aws.Context, *ec2.DescribeImportSnapshotTasksInput, func(*ec2.DescribeImportSnapshotTasksOutput, bool) bool, ...request.Option) error + DescribeInstanceAttribute(*ec2.DescribeInstanceAttributeInput) (*ec2.DescribeInstanceAttributeOutput, error) DescribeInstanceAttributeWithContext(aws.Context, *ec2.DescribeInstanceAttributeInput, ...request.Option) (*ec2.DescribeInstanceAttributeOutput, error) DescribeInstanceAttributeRequest(*ec2.DescribeInstanceAttributeInput) (*request.Request, *ec2.DescribeInstanceAttributeOutput) @@ -700,6 +793,9 @@ type EC2API interface { DescribeInstanceCreditSpecificationsWithContext(aws.Context, *ec2.DescribeInstanceCreditSpecificationsInput, ...request.Option) (*ec2.DescribeInstanceCreditSpecificationsOutput, error) DescribeInstanceCreditSpecificationsRequest(*ec2.DescribeInstanceCreditSpecificationsInput) (*request.Request, *ec2.DescribeInstanceCreditSpecificationsOutput) + DescribeInstanceCreditSpecificationsPages(*ec2.DescribeInstanceCreditSpecificationsInput, func(*ec2.DescribeInstanceCreditSpecificationsOutput, bool) bool) error + DescribeInstanceCreditSpecificationsPagesWithContext(aws.Context, *ec2.DescribeInstanceCreditSpecificationsInput, func(*ec2.DescribeInstanceCreditSpecificationsOutput, bool) bool, ...request.Option) error + DescribeInstanceStatus(*ec2.DescribeInstanceStatusInput) (*ec2.DescribeInstanceStatusOutput, error) DescribeInstanceStatusWithContext(aws.Context, *ec2.DescribeInstanceStatusInput, ...request.Option) (*ec2.DescribeInstanceStatusOutput, error) DescribeInstanceStatusRequest(*ec2.DescribeInstanceStatusInput) (*request.Request, *ec2.DescribeInstanceStatusOutput) @@ -718,6 +814,9 @@ type EC2API interface { DescribeInternetGatewaysWithContext(aws.Context, *ec2.DescribeInternetGatewaysInput, ...request.Option) (*ec2.DescribeInternetGatewaysOutput, error) DescribeInternetGatewaysRequest(*ec2.DescribeInternetGatewaysInput) (*request.Request, *ec2.DescribeInternetGatewaysOutput) + DescribeInternetGatewaysPages(*ec2.DescribeInternetGatewaysInput, func(*ec2.DescribeInternetGatewaysOutput, bool) bool) error + DescribeInternetGatewaysPagesWithContext(aws.Context, *ec2.DescribeInternetGatewaysInput, func(*ec2.DescribeInternetGatewaysOutput, bool) bool, ...request.Option) error + DescribeKeyPairs(*ec2.DescribeKeyPairsInput) (*ec2.DescribeKeyPairsOutput, error) DescribeKeyPairsWithContext(aws.Context, *ec2.DescribeKeyPairsInput, ...request.Option) (*ec2.DescribeKeyPairsOutput, error) DescribeKeyPairsRequest(*ec2.DescribeKeyPairsInput) (*request.Request, *ec2.DescribeKeyPairsOutput) @@ -726,14 +825,23 @@ type EC2API interface { DescribeLaunchTemplateVersionsWithContext(aws.Context, *ec2.DescribeLaunchTemplateVersionsInput, ...request.Option) (*ec2.DescribeLaunchTemplateVersionsOutput, error) DescribeLaunchTemplateVersionsRequest(*ec2.DescribeLaunchTemplateVersionsInput) (*request.Request, *ec2.DescribeLaunchTemplateVersionsOutput) + DescribeLaunchTemplateVersionsPages(*ec2.DescribeLaunchTemplateVersionsInput, func(*ec2.DescribeLaunchTemplateVersionsOutput, bool) bool) error + DescribeLaunchTemplateVersionsPagesWithContext(aws.Context, *ec2.DescribeLaunchTemplateVersionsInput, func(*ec2.DescribeLaunchTemplateVersionsOutput, bool) bool, ...request.Option) error + DescribeLaunchTemplates(*ec2.DescribeLaunchTemplatesInput) (*ec2.DescribeLaunchTemplatesOutput, error) DescribeLaunchTemplatesWithContext(aws.Context, *ec2.DescribeLaunchTemplatesInput, ...request.Option) (*ec2.DescribeLaunchTemplatesOutput, error) DescribeLaunchTemplatesRequest(*ec2.DescribeLaunchTemplatesInput) (*request.Request, *ec2.DescribeLaunchTemplatesOutput) + DescribeLaunchTemplatesPages(*ec2.DescribeLaunchTemplatesInput, func(*ec2.DescribeLaunchTemplatesOutput, bool) bool) error + DescribeLaunchTemplatesPagesWithContext(aws.Context, *ec2.DescribeLaunchTemplatesInput, func(*ec2.DescribeLaunchTemplatesOutput, bool) bool, ...request.Option) error + DescribeMovingAddresses(*ec2.DescribeMovingAddressesInput) (*ec2.DescribeMovingAddressesOutput, error) DescribeMovingAddressesWithContext(aws.Context, *ec2.DescribeMovingAddressesInput, ...request.Option) (*ec2.DescribeMovingAddressesOutput, error) DescribeMovingAddressesRequest(*ec2.DescribeMovingAddressesInput) (*request.Request, *ec2.DescribeMovingAddressesOutput) + DescribeMovingAddressesPages(*ec2.DescribeMovingAddressesInput, func(*ec2.DescribeMovingAddressesOutput, bool) bool) error + DescribeMovingAddressesPagesWithContext(aws.Context, *ec2.DescribeMovingAddressesInput, func(*ec2.DescribeMovingAddressesOutput, bool) bool, ...request.Option) error + DescribeNatGateways(*ec2.DescribeNatGatewaysInput) (*ec2.DescribeNatGatewaysOutput, error) DescribeNatGatewaysWithContext(aws.Context, *ec2.DescribeNatGatewaysInput, ...request.Option) (*ec2.DescribeNatGatewaysOutput, error) DescribeNatGatewaysRequest(*ec2.DescribeNatGatewaysInput) (*request.Request, *ec2.DescribeNatGatewaysOutput) @@ -745,6 +853,9 @@ type EC2API interface { DescribeNetworkAclsWithContext(aws.Context, *ec2.DescribeNetworkAclsInput, ...request.Option) (*ec2.DescribeNetworkAclsOutput, error) DescribeNetworkAclsRequest(*ec2.DescribeNetworkAclsInput) (*request.Request, *ec2.DescribeNetworkAclsOutput) + DescribeNetworkAclsPages(*ec2.DescribeNetworkAclsInput, func(*ec2.DescribeNetworkAclsOutput, bool) bool) error + DescribeNetworkAclsPagesWithContext(aws.Context, *ec2.DescribeNetworkAclsInput, func(*ec2.DescribeNetworkAclsOutput, bool) bool, ...request.Option) error + DescribeNetworkInterfaceAttribute(*ec2.DescribeNetworkInterfaceAttributeInput) (*ec2.DescribeNetworkInterfaceAttributeOutput, error) DescribeNetworkInterfaceAttributeWithContext(aws.Context, *ec2.DescribeNetworkInterfaceAttributeInput, ...request.Option) (*ec2.DescribeNetworkInterfaceAttributeOutput, error) DescribeNetworkInterfaceAttributeRequest(*ec2.DescribeNetworkInterfaceAttributeInput) (*request.Request, *ec2.DescribeNetworkInterfaceAttributeOutput) @@ -753,6 +864,9 @@ type EC2API interface { DescribeNetworkInterfacePermissionsWithContext(aws.Context, *ec2.DescribeNetworkInterfacePermissionsInput, ...request.Option) (*ec2.DescribeNetworkInterfacePermissionsOutput, error) DescribeNetworkInterfacePermissionsRequest(*ec2.DescribeNetworkInterfacePermissionsInput) (*request.Request, *ec2.DescribeNetworkInterfacePermissionsOutput) + DescribeNetworkInterfacePermissionsPages(*ec2.DescribeNetworkInterfacePermissionsInput, func(*ec2.DescribeNetworkInterfacePermissionsOutput, bool) bool) error + DescribeNetworkInterfacePermissionsPagesWithContext(aws.Context, *ec2.DescribeNetworkInterfacePermissionsInput, func(*ec2.DescribeNetworkInterfacePermissionsOutput, bool) bool, ...request.Option) error + DescribeNetworkInterfaces(*ec2.DescribeNetworkInterfacesInput) (*ec2.DescribeNetworkInterfacesOutput, error) DescribeNetworkInterfacesWithContext(aws.Context, *ec2.DescribeNetworkInterfacesInput, ...request.Option) (*ec2.DescribeNetworkInterfacesOutput, error) DescribeNetworkInterfacesRequest(*ec2.DescribeNetworkInterfacesInput) (*request.Request, *ec2.DescribeNetworkInterfacesOutput) @@ -768,14 +882,23 @@ type EC2API interface { DescribePrefixListsWithContext(aws.Context, *ec2.DescribePrefixListsInput, ...request.Option) (*ec2.DescribePrefixListsOutput, error) DescribePrefixListsRequest(*ec2.DescribePrefixListsInput) (*request.Request, *ec2.DescribePrefixListsOutput) + DescribePrefixListsPages(*ec2.DescribePrefixListsInput, func(*ec2.DescribePrefixListsOutput, bool) bool) error + DescribePrefixListsPagesWithContext(aws.Context, *ec2.DescribePrefixListsInput, func(*ec2.DescribePrefixListsOutput, bool) bool, ...request.Option) error + DescribePrincipalIdFormat(*ec2.DescribePrincipalIdFormatInput) (*ec2.DescribePrincipalIdFormatOutput, error) DescribePrincipalIdFormatWithContext(aws.Context, *ec2.DescribePrincipalIdFormatInput, ...request.Option) (*ec2.DescribePrincipalIdFormatOutput, error) DescribePrincipalIdFormatRequest(*ec2.DescribePrincipalIdFormatInput) (*request.Request, *ec2.DescribePrincipalIdFormatOutput) + DescribePrincipalIdFormatPages(*ec2.DescribePrincipalIdFormatInput, func(*ec2.DescribePrincipalIdFormatOutput, bool) bool) error + DescribePrincipalIdFormatPagesWithContext(aws.Context, *ec2.DescribePrincipalIdFormatInput, func(*ec2.DescribePrincipalIdFormatOutput, bool) bool, ...request.Option) error + DescribePublicIpv4Pools(*ec2.DescribePublicIpv4PoolsInput) (*ec2.DescribePublicIpv4PoolsOutput, error) DescribePublicIpv4PoolsWithContext(aws.Context, *ec2.DescribePublicIpv4PoolsInput, ...request.Option) (*ec2.DescribePublicIpv4PoolsOutput, error) DescribePublicIpv4PoolsRequest(*ec2.DescribePublicIpv4PoolsInput) (*request.Request, *ec2.DescribePublicIpv4PoolsOutput) + DescribePublicIpv4PoolsPages(*ec2.DescribePublicIpv4PoolsInput, func(*ec2.DescribePublicIpv4PoolsOutput, bool) bool) error + DescribePublicIpv4PoolsPagesWithContext(aws.Context, *ec2.DescribePublicIpv4PoolsInput, func(*ec2.DescribePublicIpv4PoolsOutput, bool) bool, ...request.Option) error + DescribeRegions(*ec2.DescribeRegionsInput) (*ec2.DescribeRegionsOutput, error) DescribeRegionsWithContext(aws.Context, *ec2.DescribeRegionsInput, ...request.Option) (*ec2.DescribeRegionsOutput, error) DescribeRegionsRequest(*ec2.DescribeRegionsInput) (*request.Request, *ec2.DescribeRegionsOutput) @@ -813,10 +936,16 @@ type EC2API interface { DescribeScheduledInstanceAvailabilityWithContext(aws.Context, *ec2.DescribeScheduledInstanceAvailabilityInput, ...request.Option) (*ec2.DescribeScheduledInstanceAvailabilityOutput, error) DescribeScheduledInstanceAvailabilityRequest(*ec2.DescribeScheduledInstanceAvailabilityInput) (*request.Request, *ec2.DescribeScheduledInstanceAvailabilityOutput) + DescribeScheduledInstanceAvailabilityPages(*ec2.DescribeScheduledInstanceAvailabilityInput, func(*ec2.DescribeScheduledInstanceAvailabilityOutput, bool) bool) error + DescribeScheduledInstanceAvailabilityPagesWithContext(aws.Context, *ec2.DescribeScheduledInstanceAvailabilityInput, func(*ec2.DescribeScheduledInstanceAvailabilityOutput, bool) bool, ...request.Option) error + DescribeScheduledInstances(*ec2.DescribeScheduledInstancesInput) (*ec2.DescribeScheduledInstancesOutput, error) DescribeScheduledInstancesWithContext(aws.Context, *ec2.DescribeScheduledInstancesInput, ...request.Option) (*ec2.DescribeScheduledInstancesOutput, error) DescribeScheduledInstancesRequest(*ec2.DescribeScheduledInstancesInput) (*request.Request, *ec2.DescribeScheduledInstancesOutput) + DescribeScheduledInstancesPages(*ec2.DescribeScheduledInstancesInput, func(*ec2.DescribeScheduledInstancesOutput, bool) bool) error + DescribeScheduledInstancesPagesWithContext(aws.Context, *ec2.DescribeScheduledInstancesInput, func(*ec2.DescribeScheduledInstancesOutput, bool) bool, ...request.Option) error + DescribeSecurityGroupReferences(*ec2.DescribeSecurityGroupReferencesInput) (*ec2.DescribeSecurityGroupReferencesOutput, error) DescribeSecurityGroupReferencesWithContext(aws.Context, *ec2.DescribeSecurityGroupReferencesInput, ...request.Option) (*ec2.DescribeSecurityGroupReferencesOutput, error) DescribeSecurityGroupReferencesRequest(*ec2.DescribeSecurityGroupReferencesInput) (*request.Request, *ec2.DescribeSecurityGroupReferencesOutput) @@ -862,6 +991,9 @@ type EC2API interface { DescribeSpotInstanceRequestsWithContext(aws.Context, *ec2.DescribeSpotInstanceRequestsInput, ...request.Option) (*ec2.DescribeSpotInstanceRequestsOutput, error) DescribeSpotInstanceRequestsRequest(*ec2.DescribeSpotInstanceRequestsInput) (*request.Request, *ec2.DescribeSpotInstanceRequestsOutput) + DescribeSpotInstanceRequestsPages(*ec2.DescribeSpotInstanceRequestsInput, func(*ec2.DescribeSpotInstanceRequestsOutput, bool) bool) error + DescribeSpotInstanceRequestsPagesWithContext(aws.Context, *ec2.DescribeSpotInstanceRequestsInput, func(*ec2.DescribeSpotInstanceRequestsOutput, bool) bool, ...request.Option) error + DescribeSpotPriceHistory(*ec2.DescribeSpotPriceHistoryInput) (*ec2.DescribeSpotPriceHistoryOutput, error) DescribeSpotPriceHistoryWithContext(aws.Context, *ec2.DescribeSpotPriceHistoryInput, ...request.Option) (*ec2.DescribeSpotPriceHistoryOutput, error) DescribeSpotPriceHistoryRequest(*ec2.DescribeSpotPriceHistoryInput) (*request.Request, *ec2.DescribeSpotPriceHistoryOutput) @@ -873,10 +1005,16 @@ type EC2API interface { DescribeStaleSecurityGroupsWithContext(aws.Context, *ec2.DescribeStaleSecurityGroupsInput, ...request.Option) (*ec2.DescribeStaleSecurityGroupsOutput, error) DescribeStaleSecurityGroupsRequest(*ec2.DescribeStaleSecurityGroupsInput) (*request.Request, *ec2.DescribeStaleSecurityGroupsOutput) + DescribeStaleSecurityGroupsPages(*ec2.DescribeStaleSecurityGroupsInput, func(*ec2.DescribeStaleSecurityGroupsOutput, bool) bool) error + DescribeStaleSecurityGroupsPagesWithContext(aws.Context, *ec2.DescribeStaleSecurityGroupsInput, func(*ec2.DescribeStaleSecurityGroupsOutput, bool) bool, ...request.Option) error + DescribeSubnets(*ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error) DescribeSubnetsWithContext(aws.Context, *ec2.DescribeSubnetsInput, ...request.Option) (*ec2.DescribeSubnetsOutput, error) DescribeSubnetsRequest(*ec2.DescribeSubnetsInput) (*request.Request, *ec2.DescribeSubnetsOutput) + DescribeSubnetsPages(*ec2.DescribeSubnetsInput, func(*ec2.DescribeSubnetsOutput, bool) bool) error + DescribeSubnetsPagesWithContext(aws.Context, *ec2.DescribeSubnetsInput, func(*ec2.DescribeSubnetsOutput, bool) bool, ...request.Option) error + DescribeTags(*ec2.DescribeTagsInput) (*ec2.DescribeTagsOutput, error) DescribeTagsWithContext(aws.Context, *ec2.DescribeTagsInput, ...request.Option) (*ec2.DescribeTagsOutput, error) DescribeTagsRequest(*ec2.DescribeTagsInput) (*request.Request, *ec2.DescribeTagsOutput) @@ -884,22 +1022,55 @@ type EC2API interface { DescribeTagsPages(*ec2.DescribeTagsInput, func(*ec2.DescribeTagsOutput, bool) bool) error DescribeTagsPagesWithContext(aws.Context, *ec2.DescribeTagsInput, func(*ec2.DescribeTagsOutput, bool) bool, ...request.Option) error + DescribeTrafficMirrorFilters(*ec2.DescribeTrafficMirrorFiltersInput) (*ec2.DescribeTrafficMirrorFiltersOutput, error) + DescribeTrafficMirrorFiltersWithContext(aws.Context, *ec2.DescribeTrafficMirrorFiltersInput, ...request.Option) (*ec2.DescribeTrafficMirrorFiltersOutput, error) + DescribeTrafficMirrorFiltersRequest(*ec2.DescribeTrafficMirrorFiltersInput) (*request.Request, *ec2.DescribeTrafficMirrorFiltersOutput) + + DescribeTrafficMirrorFiltersPages(*ec2.DescribeTrafficMirrorFiltersInput, func(*ec2.DescribeTrafficMirrorFiltersOutput, bool) bool) error + DescribeTrafficMirrorFiltersPagesWithContext(aws.Context, *ec2.DescribeTrafficMirrorFiltersInput, func(*ec2.DescribeTrafficMirrorFiltersOutput, bool) bool, ...request.Option) error + + DescribeTrafficMirrorSessions(*ec2.DescribeTrafficMirrorSessionsInput) (*ec2.DescribeTrafficMirrorSessionsOutput, error) + DescribeTrafficMirrorSessionsWithContext(aws.Context, *ec2.DescribeTrafficMirrorSessionsInput, ...request.Option) (*ec2.DescribeTrafficMirrorSessionsOutput, error) + DescribeTrafficMirrorSessionsRequest(*ec2.DescribeTrafficMirrorSessionsInput) (*request.Request, *ec2.DescribeTrafficMirrorSessionsOutput) + + DescribeTrafficMirrorSessionsPages(*ec2.DescribeTrafficMirrorSessionsInput, func(*ec2.DescribeTrafficMirrorSessionsOutput, bool) bool) error + DescribeTrafficMirrorSessionsPagesWithContext(aws.Context, *ec2.DescribeTrafficMirrorSessionsInput, func(*ec2.DescribeTrafficMirrorSessionsOutput, bool) bool, ...request.Option) error + + DescribeTrafficMirrorTargets(*ec2.DescribeTrafficMirrorTargetsInput) (*ec2.DescribeTrafficMirrorTargetsOutput, error) + DescribeTrafficMirrorTargetsWithContext(aws.Context, *ec2.DescribeTrafficMirrorTargetsInput, ...request.Option) (*ec2.DescribeTrafficMirrorTargetsOutput, error) + DescribeTrafficMirrorTargetsRequest(*ec2.DescribeTrafficMirrorTargetsInput) (*request.Request, *ec2.DescribeTrafficMirrorTargetsOutput) + + DescribeTrafficMirrorTargetsPages(*ec2.DescribeTrafficMirrorTargetsInput, func(*ec2.DescribeTrafficMirrorTargetsOutput, bool) bool) error + DescribeTrafficMirrorTargetsPagesWithContext(aws.Context, *ec2.DescribeTrafficMirrorTargetsInput, func(*ec2.DescribeTrafficMirrorTargetsOutput, bool) bool, ...request.Option) error + DescribeTransitGatewayAttachments(*ec2.DescribeTransitGatewayAttachmentsInput) (*ec2.DescribeTransitGatewayAttachmentsOutput, error) DescribeTransitGatewayAttachmentsWithContext(aws.Context, *ec2.DescribeTransitGatewayAttachmentsInput, ...request.Option) (*ec2.DescribeTransitGatewayAttachmentsOutput, error) DescribeTransitGatewayAttachmentsRequest(*ec2.DescribeTransitGatewayAttachmentsInput) (*request.Request, *ec2.DescribeTransitGatewayAttachmentsOutput) + DescribeTransitGatewayAttachmentsPages(*ec2.DescribeTransitGatewayAttachmentsInput, func(*ec2.DescribeTransitGatewayAttachmentsOutput, bool) bool) error + DescribeTransitGatewayAttachmentsPagesWithContext(aws.Context, *ec2.DescribeTransitGatewayAttachmentsInput, func(*ec2.DescribeTransitGatewayAttachmentsOutput, bool) bool, ...request.Option) error + DescribeTransitGatewayRouteTables(*ec2.DescribeTransitGatewayRouteTablesInput) (*ec2.DescribeTransitGatewayRouteTablesOutput, error) DescribeTransitGatewayRouteTablesWithContext(aws.Context, *ec2.DescribeTransitGatewayRouteTablesInput, ...request.Option) (*ec2.DescribeTransitGatewayRouteTablesOutput, error) DescribeTransitGatewayRouteTablesRequest(*ec2.DescribeTransitGatewayRouteTablesInput) (*request.Request, *ec2.DescribeTransitGatewayRouteTablesOutput) + DescribeTransitGatewayRouteTablesPages(*ec2.DescribeTransitGatewayRouteTablesInput, func(*ec2.DescribeTransitGatewayRouteTablesOutput, bool) bool) error + DescribeTransitGatewayRouteTablesPagesWithContext(aws.Context, *ec2.DescribeTransitGatewayRouteTablesInput, func(*ec2.DescribeTransitGatewayRouteTablesOutput, bool) bool, ...request.Option) error + DescribeTransitGatewayVpcAttachments(*ec2.DescribeTransitGatewayVpcAttachmentsInput) (*ec2.DescribeTransitGatewayVpcAttachmentsOutput, error) DescribeTransitGatewayVpcAttachmentsWithContext(aws.Context, *ec2.DescribeTransitGatewayVpcAttachmentsInput, ...request.Option) (*ec2.DescribeTransitGatewayVpcAttachmentsOutput, error) DescribeTransitGatewayVpcAttachmentsRequest(*ec2.DescribeTransitGatewayVpcAttachmentsInput) (*request.Request, *ec2.DescribeTransitGatewayVpcAttachmentsOutput) + DescribeTransitGatewayVpcAttachmentsPages(*ec2.DescribeTransitGatewayVpcAttachmentsInput, func(*ec2.DescribeTransitGatewayVpcAttachmentsOutput, bool) bool) error + DescribeTransitGatewayVpcAttachmentsPagesWithContext(aws.Context, *ec2.DescribeTransitGatewayVpcAttachmentsInput, func(*ec2.DescribeTransitGatewayVpcAttachmentsOutput, bool) bool, ...request.Option) error + DescribeTransitGateways(*ec2.DescribeTransitGatewaysInput) (*ec2.DescribeTransitGatewaysOutput, error) DescribeTransitGatewaysWithContext(aws.Context, *ec2.DescribeTransitGatewaysInput, ...request.Option) (*ec2.DescribeTransitGatewaysOutput, error) DescribeTransitGatewaysRequest(*ec2.DescribeTransitGatewaysInput) (*request.Request, *ec2.DescribeTransitGatewaysOutput) + DescribeTransitGatewaysPages(*ec2.DescribeTransitGatewaysInput, func(*ec2.DescribeTransitGatewaysOutput, bool) bool) error + DescribeTransitGatewaysPagesWithContext(aws.Context, *ec2.DescribeTransitGatewaysInput, func(*ec2.DescribeTransitGatewaysOutput, bool) bool, ...request.Option) error + DescribeVolumeAttribute(*ec2.DescribeVolumeAttributeInput) (*ec2.DescribeVolumeAttributeOutput, error) DescribeVolumeAttributeWithContext(aws.Context, *ec2.DescribeVolumeAttributeInput, ...request.Option) (*ec2.DescribeVolumeAttributeOutput, error) DescribeVolumeAttributeRequest(*ec2.DescribeVolumeAttributeInput) (*request.Request, *ec2.DescribeVolumeAttributeOutput) @@ -922,6 +1093,9 @@ type EC2API interface { DescribeVolumesModificationsWithContext(aws.Context, *ec2.DescribeVolumesModificationsInput, ...request.Option) (*ec2.DescribeVolumesModificationsOutput, error) DescribeVolumesModificationsRequest(*ec2.DescribeVolumesModificationsInput) (*request.Request, *ec2.DescribeVolumesModificationsOutput) + DescribeVolumesModificationsPages(*ec2.DescribeVolumesModificationsInput, func(*ec2.DescribeVolumesModificationsOutput, bool) bool) error + DescribeVolumesModificationsPagesWithContext(aws.Context, *ec2.DescribeVolumesModificationsInput, func(*ec2.DescribeVolumesModificationsOutput, bool) bool, ...request.Option) error + DescribeVpcAttribute(*ec2.DescribeVpcAttributeInput) (*ec2.DescribeVpcAttributeOutput, error) DescribeVpcAttributeWithContext(aws.Context, *ec2.DescribeVpcAttributeInput, ...request.Option) (*ec2.DescribeVpcAttributeOutput, error) DescribeVpcAttributeRequest(*ec2.DescribeVpcAttributeInput) (*request.Request, *ec2.DescribeVpcAttributeOutput) @@ -934,22 +1108,37 @@ type EC2API interface { DescribeVpcClassicLinkDnsSupportWithContext(aws.Context, *ec2.DescribeVpcClassicLinkDnsSupportInput, ...request.Option) (*ec2.DescribeVpcClassicLinkDnsSupportOutput, error) DescribeVpcClassicLinkDnsSupportRequest(*ec2.DescribeVpcClassicLinkDnsSupportInput) (*request.Request, *ec2.DescribeVpcClassicLinkDnsSupportOutput) + DescribeVpcClassicLinkDnsSupportPages(*ec2.DescribeVpcClassicLinkDnsSupportInput, func(*ec2.DescribeVpcClassicLinkDnsSupportOutput, bool) bool) error + DescribeVpcClassicLinkDnsSupportPagesWithContext(aws.Context, *ec2.DescribeVpcClassicLinkDnsSupportInput, func(*ec2.DescribeVpcClassicLinkDnsSupportOutput, bool) bool, ...request.Option) error + DescribeVpcEndpointConnectionNotifications(*ec2.DescribeVpcEndpointConnectionNotificationsInput) (*ec2.DescribeVpcEndpointConnectionNotificationsOutput, error) DescribeVpcEndpointConnectionNotificationsWithContext(aws.Context, *ec2.DescribeVpcEndpointConnectionNotificationsInput, ...request.Option) (*ec2.DescribeVpcEndpointConnectionNotificationsOutput, error) DescribeVpcEndpointConnectionNotificationsRequest(*ec2.DescribeVpcEndpointConnectionNotificationsInput) (*request.Request, *ec2.DescribeVpcEndpointConnectionNotificationsOutput) + DescribeVpcEndpointConnectionNotificationsPages(*ec2.DescribeVpcEndpointConnectionNotificationsInput, func(*ec2.DescribeVpcEndpointConnectionNotificationsOutput, bool) bool) error + DescribeVpcEndpointConnectionNotificationsPagesWithContext(aws.Context, *ec2.DescribeVpcEndpointConnectionNotificationsInput, func(*ec2.DescribeVpcEndpointConnectionNotificationsOutput, bool) bool, ...request.Option) error + DescribeVpcEndpointConnections(*ec2.DescribeVpcEndpointConnectionsInput) (*ec2.DescribeVpcEndpointConnectionsOutput, error) DescribeVpcEndpointConnectionsWithContext(aws.Context, *ec2.DescribeVpcEndpointConnectionsInput, ...request.Option) (*ec2.DescribeVpcEndpointConnectionsOutput, error) DescribeVpcEndpointConnectionsRequest(*ec2.DescribeVpcEndpointConnectionsInput) (*request.Request, *ec2.DescribeVpcEndpointConnectionsOutput) + DescribeVpcEndpointConnectionsPages(*ec2.DescribeVpcEndpointConnectionsInput, func(*ec2.DescribeVpcEndpointConnectionsOutput, bool) bool) error + DescribeVpcEndpointConnectionsPagesWithContext(aws.Context, *ec2.DescribeVpcEndpointConnectionsInput, func(*ec2.DescribeVpcEndpointConnectionsOutput, bool) bool, ...request.Option) error + DescribeVpcEndpointServiceConfigurations(*ec2.DescribeVpcEndpointServiceConfigurationsInput) (*ec2.DescribeVpcEndpointServiceConfigurationsOutput, error) DescribeVpcEndpointServiceConfigurationsWithContext(aws.Context, *ec2.DescribeVpcEndpointServiceConfigurationsInput, ...request.Option) (*ec2.DescribeVpcEndpointServiceConfigurationsOutput, error) DescribeVpcEndpointServiceConfigurationsRequest(*ec2.DescribeVpcEndpointServiceConfigurationsInput) (*request.Request, *ec2.DescribeVpcEndpointServiceConfigurationsOutput) + DescribeVpcEndpointServiceConfigurationsPages(*ec2.DescribeVpcEndpointServiceConfigurationsInput, func(*ec2.DescribeVpcEndpointServiceConfigurationsOutput, bool) bool) error + DescribeVpcEndpointServiceConfigurationsPagesWithContext(aws.Context, *ec2.DescribeVpcEndpointServiceConfigurationsInput, func(*ec2.DescribeVpcEndpointServiceConfigurationsOutput, bool) bool, ...request.Option) error + DescribeVpcEndpointServicePermissions(*ec2.DescribeVpcEndpointServicePermissionsInput) (*ec2.DescribeVpcEndpointServicePermissionsOutput, error) DescribeVpcEndpointServicePermissionsWithContext(aws.Context, *ec2.DescribeVpcEndpointServicePermissionsInput, ...request.Option) (*ec2.DescribeVpcEndpointServicePermissionsOutput, error) DescribeVpcEndpointServicePermissionsRequest(*ec2.DescribeVpcEndpointServicePermissionsInput) (*request.Request, *ec2.DescribeVpcEndpointServicePermissionsOutput) + DescribeVpcEndpointServicePermissionsPages(*ec2.DescribeVpcEndpointServicePermissionsInput, func(*ec2.DescribeVpcEndpointServicePermissionsOutput, bool) bool) error + DescribeVpcEndpointServicePermissionsPagesWithContext(aws.Context, *ec2.DescribeVpcEndpointServicePermissionsInput, func(*ec2.DescribeVpcEndpointServicePermissionsOutput, bool) bool, ...request.Option) error + DescribeVpcEndpointServices(*ec2.DescribeVpcEndpointServicesInput) (*ec2.DescribeVpcEndpointServicesOutput, error) DescribeVpcEndpointServicesWithContext(aws.Context, *ec2.DescribeVpcEndpointServicesInput, ...request.Option) (*ec2.DescribeVpcEndpointServicesOutput, error) DescribeVpcEndpointServicesRequest(*ec2.DescribeVpcEndpointServicesInput) (*request.Request, *ec2.DescribeVpcEndpointServicesOutput) @@ -958,14 +1147,23 @@ type EC2API interface { DescribeVpcEndpointsWithContext(aws.Context, *ec2.DescribeVpcEndpointsInput, ...request.Option) (*ec2.DescribeVpcEndpointsOutput, error) DescribeVpcEndpointsRequest(*ec2.DescribeVpcEndpointsInput) (*request.Request, *ec2.DescribeVpcEndpointsOutput) + DescribeVpcEndpointsPages(*ec2.DescribeVpcEndpointsInput, func(*ec2.DescribeVpcEndpointsOutput, bool) bool) error + DescribeVpcEndpointsPagesWithContext(aws.Context, *ec2.DescribeVpcEndpointsInput, func(*ec2.DescribeVpcEndpointsOutput, bool) bool, ...request.Option) error + DescribeVpcPeeringConnections(*ec2.DescribeVpcPeeringConnectionsInput) (*ec2.DescribeVpcPeeringConnectionsOutput, error) DescribeVpcPeeringConnectionsWithContext(aws.Context, *ec2.DescribeVpcPeeringConnectionsInput, ...request.Option) (*ec2.DescribeVpcPeeringConnectionsOutput, error) DescribeVpcPeeringConnectionsRequest(*ec2.DescribeVpcPeeringConnectionsInput) (*request.Request, *ec2.DescribeVpcPeeringConnectionsOutput) + DescribeVpcPeeringConnectionsPages(*ec2.DescribeVpcPeeringConnectionsInput, func(*ec2.DescribeVpcPeeringConnectionsOutput, bool) bool) error + DescribeVpcPeeringConnectionsPagesWithContext(aws.Context, *ec2.DescribeVpcPeeringConnectionsInput, func(*ec2.DescribeVpcPeeringConnectionsOutput, bool) bool, ...request.Option) error + DescribeVpcs(*ec2.DescribeVpcsInput) (*ec2.DescribeVpcsOutput, error) DescribeVpcsWithContext(aws.Context, *ec2.DescribeVpcsInput, ...request.Option) (*ec2.DescribeVpcsOutput, error) DescribeVpcsRequest(*ec2.DescribeVpcsInput) (*request.Request, *ec2.DescribeVpcsOutput) + DescribeVpcsPages(*ec2.DescribeVpcsInput, func(*ec2.DescribeVpcsOutput, bool) bool) error + DescribeVpcsPagesWithContext(aws.Context, *ec2.DescribeVpcsInput, func(*ec2.DescribeVpcsOutput, bool) bool, ...request.Option) error + DescribeVpnConnections(*ec2.DescribeVpnConnectionsInput) (*ec2.DescribeVpnConnectionsOutput, error) DescribeVpnConnectionsWithContext(aws.Context, *ec2.DescribeVpnConnectionsInput, ...request.Option) (*ec2.DescribeVpnConnectionsOutput, error) DescribeVpnConnectionsRequest(*ec2.DescribeVpnConnectionsInput) (*request.Request, *ec2.DescribeVpnConnectionsOutput) @@ -994,6 +1192,10 @@ type EC2API interface { DetachVpnGatewayWithContext(aws.Context, *ec2.DetachVpnGatewayInput, ...request.Option) (*ec2.DetachVpnGatewayOutput, error) DetachVpnGatewayRequest(*ec2.DetachVpnGatewayInput) (*request.Request, *ec2.DetachVpnGatewayOutput) + DisableEbsEncryptionByDefault(*ec2.DisableEbsEncryptionByDefaultInput) (*ec2.DisableEbsEncryptionByDefaultOutput, error) + DisableEbsEncryptionByDefaultWithContext(aws.Context, *ec2.DisableEbsEncryptionByDefaultInput, ...request.Option) (*ec2.DisableEbsEncryptionByDefaultOutput, error) + DisableEbsEncryptionByDefaultRequest(*ec2.DisableEbsEncryptionByDefaultInput) (*request.Request, *ec2.DisableEbsEncryptionByDefaultOutput) + DisableTransitGatewayRouteTablePropagation(*ec2.DisableTransitGatewayRouteTablePropagationInput) (*ec2.DisableTransitGatewayRouteTablePropagationOutput, error) DisableTransitGatewayRouteTablePropagationWithContext(aws.Context, *ec2.DisableTransitGatewayRouteTablePropagationInput, ...request.Option) (*ec2.DisableTransitGatewayRouteTablePropagationOutput, error) DisableTransitGatewayRouteTablePropagationRequest(*ec2.DisableTransitGatewayRouteTablePropagationInput) (*request.Request, *ec2.DisableTransitGatewayRouteTablePropagationOutput) @@ -1038,6 +1240,10 @@ type EC2API interface { DisassociateVpcCidrBlockWithContext(aws.Context, *ec2.DisassociateVpcCidrBlockInput, ...request.Option) (*ec2.DisassociateVpcCidrBlockOutput, error) DisassociateVpcCidrBlockRequest(*ec2.DisassociateVpcCidrBlockInput) (*request.Request, *ec2.DisassociateVpcCidrBlockOutput) + EnableEbsEncryptionByDefault(*ec2.EnableEbsEncryptionByDefaultInput) (*ec2.EnableEbsEncryptionByDefaultOutput, error) + EnableEbsEncryptionByDefaultWithContext(aws.Context, *ec2.EnableEbsEncryptionByDefaultInput, ...request.Option) (*ec2.EnableEbsEncryptionByDefaultOutput, error) + EnableEbsEncryptionByDefaultRequest(*ec2.EnableEbsEncryptionByDefaultInput) (*request.Request, *ec2.EnableEbsEncryptionByDefaultOutput) + EnableTransitGatewayRouteTablePropagation(*ec2.EnableTransitGatewayRouteTablePropagationInput) (*ec2.EnableTransitGatewayRouteTablePropagationOutput, error) EnableTransitGatewayRouteTablePropagationWithContext(aws.Context, *ec2.EnableTransitGatewayRouteTablePropagationInput, ...request.Option) (*ec2.EnableTransitGatewayRouteTablePropagationOutput, error) EnableTransitGatewayRouteTablePropagationRequest(*ec2.EnableTransitGatewayRouteTablePropagationInput) (*request.Request, *ec2.EnableTransitGatewayRouteTablePropagationOutput) @@ -1070,6 +1276,10 @@ type EC2API interface { ExportTransitGatewayRoutesWithContext(aws.Context, *ec2.ExportTransitGatewayRoutesInput, ...request.Option) (*ec2.ExportTransitGatewayRoutesOutput, error) ExportTransitGatewayRoutesRequest(*ec2.ExportTransitGatewayRoutesInput) (*request.Request, *ec2.ExportTransitGatewayRoutesOutput) + GetCapacityReservationUsage(*ec2.GetCapacityReservationUsageInput) (*ec2.GetCapacityReservationUsageOutput, error) + GetCapacityReservationUsageWithContext(aws.Context, *ec2.GetCapacityReservationUsageInput, ...request.Option) (*ec2.GetCapacityReservationUsageOutput, error) + GetCapacityReservationUsageRequest(*ec2.GetCapacityReservationUsageInput) (*request.Request, *ec2.GetCapacityReservationUsageOutput) + GetConsoleOutput(*ec2.GetConsoleOutputInput) (*ec2.GetConsoleOutputOutput, error) GetConsoleOutputWithContext(aws.Context, *ec2.GetConsoleOutputInput, ...request.Option) (*ec2.GetConsoleOutputOutput, error) GetConsoleOutputRequest(*ec2.GetConsoleOutputInput) (*request.Request, *ec2.GetConsoleOutputOutput) @@ -1078,6 +1288,14 @@ type EC2API interface { GetConsoleScreenshotWithContext(aws.Context, *ec2.GetConsoleScreenshotInput, ...request.Option) (*ec2.GetConsoleScreenshotOutput, error) GetConsoleScreenshotRequest(*ec2.GetConsoleScreenshotInput) (*request.Request, *ec2.GetConsoleScreenshotOutput) + GetEbsDefaultKmsKeyId(*ec2.GetEbsDefaultKmsKeyIdInput) (*ec2.GetEbsDefaultKmsKeyIdOutput, error) + GetEbsDefaultKmsKeyIdWithContext(aws.Context, *ec2.GetEbsDefaultKmsKeyIdInput, ...request.Option) (*ec2.GetEbsDefaultKmsKeyIdOutput, error) + GetEbsDefaultKmsKeyIdRequest(*ec2.GetEbsDefaultKmsKeyIdInput) (*request.Request, *ec2.GetEbsDefaultKmsKeyIdOutput) + + GetEbsEncryptionByDefault(*ec2.GetEbsEncryptionByDefaultInput) (*ec2.GetEbsEncryptionByDefaultOutput, error) + GetEbsEncryptionByDefaultWithContext(aws.Context, *ec2.GetEbsEncryptionByDefaultInput, ...request.Option) (*ec2.GetEbsEncryptionByDefaultOutput, error) + GetEbsEncryptionByDefaultRequest(*ec2.GetEbsEncryptionByDefaultInput) (*request.Request, *ec2.GetEbsEncryptionByDefaultOutput) + GetHostReservationPurchasePreview(*ec2.GetHostReservationPurchasePreviewInput) (*ec2.GetHostReservationPurchasePreviewOutput, error) GetHostReservationPurchasePreviewWithContext(aws.Context, *ec2.GetHostReservationPurchasePreviewInput, ...request.Option) (*ec2.GetHostReservationPurchasePreviewOutput, error) GetHostReservationPurchasePreviewRequest(*ec2.GetHostReservationPurchasePreviewInput) (*request.Request, *ec2.GetHostReservationPurchasePreviewOutput) @@ -1098,14 +1316,23 @@ type EC2API interface { GetTransitGatewayAttachmentPropagationsWithContext(aws.Context, *ec2.GetTransitGatewayAttachmentPropagationsInput, ...request.Option) (*ec2.GetTransitGatewayAttachmentPropagationsOutput, error) GetTransitGatewayAttachmentPropagationsRequest(*ec2.GetTransitGatewayAttachmentPropagationsInput) (*request.Request, *ec2.GetTransitGatewayAttachmentPropagationsOutput) + GetTransitGatewayAttachmentPropagationsPages(*ec2.GetTransitGatewayAttachmentPropagationsInput, func(*ec2.GetTransitGatewayAttachmentPropagationsOutput, bool) bool) error + GetTransitGatewayAttachmentPropagationsPagesWithContext(aws.Context, *ec2.GetTransitGatewayAttachmentPropagationsInput, func(*ec2.GetTransitGatewayAttachmentPropagationsOutput, bool) bool, ...request.Option) error + GetTransitGatewayRouteTableAssociations(*ec2.GetTransitGatewayRouteTableAssociationsInput) (*ec2.GetTransitGatewayRouteTableAssociationsOutput, error) GetTransitGatewayRouteTableAssociationsWithContext(aws.Context, *ec2.GetTransitGatewayRouteTableAssociationsInput, ...request.Option) (*ec2.GetTransitGatewayRouteTableAssociationsOutput, error) GetTransitGatewayRouteTableAssociationsRequest(*ec2.GetTransitGatewayRouteTableAssociationsInput) (*request.Request, *ec2.GetTransitGatewayRouteTableAssociationsOutput) + GetTransitGatewayRouteTableAssociationsPages(*ec2.GetTransitGatewayRouteTableAssociationsInput, func(*ec2.GetTransitGatewayRouteTableAssociationsOutput, bool) bool) error + GetTransitGatewayRouteTableAssociationsPagesWithContext(aws.Context, *ec2.GetTransitGatewayRouteTableAssociationsInput, func(*ec2.GetTransitGatewayRouteTableAssociationsOutput, bool) bool, ...request.Option) error + GetTransitGatewayRouteTablePropagations(*ec2.GetTransitGatewayRouteTablePropagationsInput) (*ec2.GetTransitGatewayRouteTablePropagationsOutput, error) GetTransitGatewayRouteTablePropagationsWithContext(aws.Context, *ec2.GetTransitGatewayRouteTablePropagationsInput, ...request.Option) (*ec2.GetTransitGatewayRouteTablePropagationsOutput, error) GetTransitGatewayRouteTablePropagationsRequest(*ec2.GetTransitGatewayRouteTablePropagationsInput) (*request.Request, *ec2.GetTransitGatewayRouteTablePropagationsOutput) + GetTransitGatewayRouteTablePropagationsPages(*ec2.GetTransitGatewayRouteTablePropagationsInput, func(*ec2.GetTransitGatewayRouteTablePropagationsOutput, bool) bool) error + GetTransitGatewayRouteTablePropagationsPagesWithContext(aws.Context, *ec2.GetTransitGatewayRouteTablePropagationsInput, func(*ec2.GetTransitGatewayRouteTablePropagationsOutput, bool) bool, ...request.Option) error + ImportClientVpnClientCertificateRevocationList(*ec2.ImportClientVpnClientCertificateRevocationListInput) (*ec2.ImportClientVpnClientCertificateRevocationListOutput, error) ImportClientVpnClientCertificateRevocationListWithContext(aws.Context, *ec2.ImportClientVpnClientCertificateRevocationListInput, ...request.Option) (*ec2.ImportClientVpnClientCertificateRevocationListOutput, error) ImportClientVpnClientCertificateRevocationListRequest(*ec2.ImportClientVpnClientCertificateRevocationListInput) (*request.Request, *ec2.ImportClientVpnClientCertificateRevocationListOutput) @@ -1138,6 +1365,10 @@ type EC2API interface { ModifyClientVpnEndpointWithContext(aws.Context, *ec2.ModifyClientVpnEndpointInput, ...request.Option) (*ec2.ModifyClientVpnEndpointOutput, error) ModifyClientVpnEndpointRequest(*ec2.ModifyClientVpnEndpointInput) (*request.Request, *ec2.ModifyClientVpnEndpointOutput) + ModifyEbsDefaultKmsKeyId(*ec2.ModifyEbsDefaultKmsKeyIdInput) (*ec2.ModifyEbsDefaultKmsKeyIdOutput, error) + ModifyEbsDefaultKmsKeyIdWithContext(aws.Context, *ec2.ModifyEbsDefaultKmsKeyIdInput, ...request.Option) (*ec2.ModifyEbsDefaultKmsKeyIdOutput, error) + ModifyEbsDefaultKmsKeyIdRequest(*ec2.ModifyEbsDefaultKmsKeyIdInput) (*request.Request, *ec2.ModifyEbsDefaultKmsKeyIdOutput) + ModifyFleet(*ec2.ModifyFleetInput) (*ec2.ModifyFleetOutput, error) ModifyFleetWithContext(aws.Context, *ec2.ModifyFleetInput, ...request.Option) (*ec2.ModifyFleetOutput, error) ModifyFleetRequest(*ec2.ModifyFleetInput) (*request.Request, *ec2.ModifyFleetOutput) @@ -1174,6 +1405,10 @@ type EC2API interface { ModifyInstanceCreditSpecificationWithContext(aws.Context, *ec2.ModifyInstanceCreditSpecificationInput, ...request.Option) (*ec2.ModifyInstanceCreditSpecificationOutput, error) ModifyInstanceCreditSpecificationRequest(*ec2.ModifyInstanceCreditSpecificationInput) (*request.Request, *ec2.ModifyInstanceCreditSpecificationOutput) + ModifyInstanceEventStartTime(*ec2.ModifyInstanceEventStartTimeInput) (*ec2.ModifyInstanceEventStartTimeOutput, error) + ModifyInstanceEventStartTimeWithContext(aws.Context, *ec2.ModifyInstanceEventStartTimeInput, ...request.Option) (*ec2.ModifyInstanceEventStartTimeOutput, error) + ModifyInstanceEventStartTimeRequest(*ec2.ModifyInstanceEventStartTimeInput) (*request.Request, *ec2.ModifyInstanceEventStartTimeOutput) + ModifyInstancePlacement(*ec2.ModifyInstancePlacementInput) (*ec2.ModifyInstancePlacementOutput, error) ModifyInstancePlacementWithContext(aws.Context, *ec2.ModifyInstancePlacementInput, ...request.Option) (*ec2.ModifyInstancePlacementOutput, error) ModifyInstancePlacementRequest(*ec2.ModifyInstancePlacementInput) (*request.Request, *ec2.ModifyInstancePlacementOutput) @@ -1202,6 +1437,18 @@ type EC2API interface { ModifySubnetAttributeWithContext(aws.Context, *ec2.ModifySubnetAttributeInput, ...request.Option) (*ec2.ModifySubnetAttributeOutput, error) ModifySubnetAttributeRequest(*ec2.ModifySubnetAttributeInput) (*request.Request, *ec2.ModifySubnetAttributeOutput) + ModifyTrafficMirrorFilterNetworkServices(*ec2.ModifyTrafficMirrorFilterNetworkServicesInput) (*ec2.ModifyTrafficMirrorFilterNetworkServicesOutput, error) + ModifyTrafficMirrorFilterNetworkServicesWithContext(aws.Context, *ec2.ModifyTrafficMirrorFilterNetworkServicesInput, ...request.Option) (*ec2.ModifyTrafficMirrorFilterNetworkServicesOutput, error) + ModifyTrafficMirrorFilterNetworkServicesRequest(*ec2.ModifyTrafficMirrorFilterNetworkServicesInput) (*request.Request, *ec2.ModifyTrafficMirrorFilterNetworkServicesOutput) + + ModifyTrafficMirrorFilterRule(*ec2.ModifyTrafficMirrorFilterRuleInput) (*ec2.ModifyTrafficMirrorFilterRuleOutput, error) + ModifyTrafficMirrorFilterRuleWithContext(aws.Context, *ec2.ModifyTrafficMirrorFilterRuleInput, ...request.Option) (*ec2.ModifyTrafficMirrorFilterRuleOutput, error) + ModifyTrafficMirrorFilterRuleRequest(*ec2.ModifyTrafficMirrorFilterRuleInput) (*request.Request, *ec2.ModifyTrafficMirrorFilterRuleOutput) + + ModifyTrafficMirrorSession(*ec2.ModifyTrafficMirrorSessionInput) (*ec2.ModifyTrafficMirrorSessionOutput, error) + ModifyTrafficMirrorSessionWithContext(aws.Context, *ec2.ModifyTrafficMirrorSessionInput, ...request.Option) (*ec2.ModifyTrafficMirrorSessionOutput, error) + ModifyTrafficMirrorSessionRequest(*ec2.ModifyTrafficMirrorSessionInput) (*request.Request, *ec2.ModifyTrafficMirrorSessionOutput) + ModifyTransitGatewayVpcAttachment(*ec2.ModifyTransitGatewayVpcAttachmentInput) (*ec2.ModifyTransitGatewayVpcAttachmentOutput, error) ModifyTransitGatewayVpcAttachmentWithContext(aws.Context, *ec2.ModifyTransitGatewayVpcAttachmentInput, ...request.Option) (*ec2.ModifyTransitGatewayVpcAttachmentOutput, error) ModifyTransitGatewayVpcAttachmentRequest(*ec2.ModifyTransitGatewayVpcAttachmentInput) (*request.Request, *ec2.ModifyTransitGatewayVpcAttachmentOutput) @@ -1242,6 +1489,10 @@ type EC2API interface { ModifyVpcTenancyWithContext(aws.Context, *ec2.ModifyVpcTenancyInput, ...request.Option) (*ec2.ModifyVpcTenancyOutput, error) ModifyVpcTenancyRequest(*ec2.ModifyVpcTenancyInput) (*request.Request, *ec2.ModifyVpcTenancyOutput) + ModifyVpnConnection(*ec2.ModifyVpnConnectionInput) (*ec2.ModifyVpnConnectionOutput, error) + ModifyVpnConnectionWithContext(aws.Context, *ec2.ModifyVpnConnectionInput, ...request.Option) (*ec2.ModifyVpnConnectionOutput, error) + ModifyVpnConnectionRequest(*ec2.ModifyVpnConnectionInput) (*request.Request, *ec2.ModifyVpnConnectionOutput) + MonitorInstances(*ec2.MonitorInstancesInput) (*ec2.MonitorInstancesOutput, error) MonitorInstancesWithContext(aws.Context, *ec2.MonitorInstancesInput, ...request.Option) (*ec2.MonitorInstancesOutput, error) MonitorInstancesRequest(*ec2.MonitorInstancesInput) (*request.Request, *ec2.MonitorInstancesOutput) @@ -1330,6 +1581,10 @@ type EC2API interface { RequestSpotInstancesWithContext(aws.Context, *ec2.RequestSpotInstancesInput, ...request.Option) (*ec2.RequestSpotInstancesOutput, error) RequestSpotInstancesRequest(*ec2.RequestSpotInstancesInput) (*request.Request, *ec2.RequestSpotInstancesOutput) + ResetEbsDefaultKmsKeyId(*ec2.ResetEbsDefaultKmsKeyIdInput) (*ec2.ResetEbsDefaultKmsKeyIdOutput, error) + ResetEbsDefaultKmsKeyIdWithContext(aws.Context, *ec2.ResetEbsDefaultKmsKeyIdInput, ...request.Option) (*ec2.ResetEbsDefaultKmsKeyIdOutput, error) + ResetEbsDefaultKmsKeyIdRequest(*ec2.ResetEbsDefaultKmsKeyIdInput) (*request.Request, *ec2.ResetEbsDefaultKmsKeyIdOutput) + ResetFpgaImageAttribute(*ec2.ResetFpgaImageAttributeInput) (*ec2.ResetFpgaImageAttributeOutput, error) ResetFpgaImageAttributeWithContext(aws.Context, *ec2.ResetFpgaImageAttributeInput, ...request.Option) (*ec2.ResetFpgaImageAttributeOutput, error) ResetFpgaImageAttributeRequest(*ec2.ResetFpgaImageAttributeInput) (*request.Request, *ec2.ResetFpgaImageAttributeOutput) diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go b/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go index e3284308c..237899c60 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go @@ -3,6 +3,7 @@ package ecr import ( + "fmt" "time" "github.com/aws/aws-sdk-go/aws" @@ -473,7 +474,7 @@ func (c *ECR) CreateRepositoryRequest(input *CreateRepositoryInput) (req *reques // * ErrCodeLimitExceededException "LimitExceededException" // The operation did not succeed because it would have exceeded a service limit // for your account. For more information, see Amazon ECR Default Service Limits -// (http://docs.aws.amazon.com/AmazonECR/latest/userguide/service_limits.html) +// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/service_limits.html) // in the Amazon Elastic Container Registry User Guide. // // See also, https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/CreateRepository @@ -884,7 +885,7 @@ func (c *ECR) DescribeImagesWithContext(ctx aws.Context, input *DescribeImagesIn // // Example iterating over at most 3 pages of a DescribeImages operation. // pageNum := 0 // err := client.DescribeImagesPages(params, -// func(page *DescribeImagesOutput, lastPage bool) bool { +// func(page *ecr.DescribeImagesOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -1027,7 +1028,7 @@ func (c *ECR) DescribeRepositoriesWithContext(ctx aws.Context, input *DescribeRe // // Example iterating over at most 3 pages of a DescribeRepositories operation. // pageNum := 0 // err := client.DescribeRepositoriesPages(params, -// func(page *DescribeRepositoriesOutput, lastPage bool) bool { +// func(page *ecr.DescribeRepositoriesOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -1728,7 +1729,7 @@ func (c *ECR) ListImagesWithContext(ctx aws.Context, input *ListImagesInput, opt // // Example iterating over at most 3 pages of a ListImages operation. // pageNum := 0 // err := client.ListImagesPages(params, -// func(page *ListImagesOutput, lastPage bool) bool { +// func(page *ecr.ListImagesOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -1934,9 +1935,13 @@ func (c *ECR) PutImageRequest(input *PutImageInput) (req *request.Request, outpu // * ErrCodeLimitExceededException "LimitExceededException" // The operation did not succeed because it would have exceeded a service limit // for your account. For more information, see Amazon ECR Default Service Limits -// (http://docs.aws.amazon.com/AmazonECR/latest/userguide/service_limits.html) +// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/service_limits.html) // in the Amazon Elastic Container Registry User Guide. // +// * ErrCodeImageTagAlreadyExistsException "ImageTagAlreadyExistsException" +// The specified image is tagged with a tag that already exists. The repository +// is configured for tag immutability. +// // See also, https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/PutImage func (c *ECR) PutImage(input *PutImageInput) (*PutImageOutput, error) { req, out := c.PutImageRequest(input) @@ -1959,6 +1964,93 @@ func (c *ECR) PutImageWithContext(ctx aws.Context, input *PutImageInput, opts .. return out, req.Send() } +const opPutImageTagMutability = "PutImageTagMutability" + +// PutImageTagMutabilityRequest generates a "aws/request.Request" representing the +// client's request for the PutImageTagMutability operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutImageTagMutability for more information on using the PutImageTagMutability +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the PutImageTagMutabilityRequest method. +// req, resp := client.PutImageTagMutabilityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/PutImageTagMutability +func (c *ECR) PutImageTagMutabilityRequest(input *PutImageTagMutabilityInput) (req *request.Request, output *PutImageTagMutabilityOutput) { + op := &request.Operation{ + Name: opPutImageTagMutability, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutImageTagMutabilityInput{} + } + + output = &PutImageTagMutabilityOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutImageTagMutability API operation for Amazon EC2 Container Registry. +// +// Updates the image tag mutability settings for a repository. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon EC2 Container Registry's +// API operation PutImageTagMutability for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServerException "ServerException" +// These errors are usually caused by a server-side issue. +// +// * ErrCodeInvalidParameterException "InvalidParameterException" +// The specified parameter is invalid. Review the available parameters for the +// API request. +// +// * ErrCodeRepositoryNotFoundException "RepositoryNotFoundException" +// The specified repository could not be found. Check the spelling of the specified +// repository and ensure that you are performing operations on the correct registry. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/PutImageTagMutability +func (c *ECR) PutImageTagMutability(input *PutImageTagMutabilityInput) (*PutImageTagMutabilityOutput, error) { + req, out := c.PutImageTagMutabilityRequest(input) + return out, req.Send() +} + +// PutImageTagMutabilityWithContext is the same as PutImageTagMutability with the addition of +// the ability to pass a context and additional request options. +// +// See PutImageTagMutability for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ECR) PutImageTagMutabilityWithContext(ctx aws.Context, input *PutImageTagMutabilityInput, opts ...request.Option) (*PutImageTagMutabilityOutput, error) { + req, out := c.PutImageTagMutabilityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opPutLifecyclePolicy = "PutLifecyclePolicy" // PutLifecyclePolicyRequest generates a "aws/request.Request" representing the @@ -2004,7 +2096,7 @@ func (c *ECR) PutLifecyclePolicyRequest(input *PutLifecyclePolicyInput) (req *re // PutLifecyclePolicy API operation for Amazon EC2 Container Registry. // // Creates or updates a lifecycle policy. For information about lifecycle policy -// syntax, see Lifecycle Policy Template (http://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html). +// syntax, see Lifecycle Policy Template (https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2092,6 +2184,8 @@ func (c *ECR) SetRepositoryPolicyRequest(input *SetRepositoryPolicyInput) (req * // SetRepositoryPolicy API operation for Amazon EC2 Container Registry. // // Applies a repository policy on a specified repository to control access permissions. +// For more information, see Amazon ECR Repository Policies (https://docs.aws.amazon.com/AmazonECR/latest/userguide/RepositoryPolicies.html) +// in the Amazon Elastic Container Registry User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2504,7 +2598,7 @@ func (c *ECR) UploadLayerPartRequest(input *UploadLayerPartInput) (req *request. // * ErrCodeLimitExceededException "LimitExceededException" // The operation did not succeed because it would have exceeded a service limit // for your account. For more information, see Amazon ECR Default Service Limits -// (http://docs.aws.amazon.com/AmazonECR/latest/userguide/service_limits.html) +// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/service_limits.html) // in the Amazon Elastic Container Registry User Guide. // // See also, https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/UploadLayerPart @@ -2723,6 +2817,16 @@ func (s *BatchDeleteImageInput) Validate() error { if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) } + if s.ImageIds != nil { + for i, v := range s.ImageIds { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ImageIds", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -2833,6 +2937,16 @@ func (s *BatchGetImageInput) Validate() error { if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) } + if s.ImageIds != nil { + for i, v := range s.ImageIds { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ImageIds", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -3032,6 +3146,12 @@ func (s *CompleteLayerUploadOutput) SetUploadId(v string) *CompleteLayerUploadOu type CreateRepositoryInput struct { _ struct{} `type:"structure"` + // The tag mutability setting for the repository. If this parameter is omitted, + // the default setting of MUTABLE will be used which will allow image tags to + // be overwritten. If IMMUTABLE is specified, all image tags within the repository + // will be immutable which will prevent them from being overwritten. + ImageTagMutability *string `locationName:"imageTagMutability" type:"string" enum:"ImageTagMutability"` + // The name to use for the repository. The repository name may be specified // on its own (such as nginx-web-app) or it can be prepended with a namespace // to group the repository into a category (such as project-a/nginx-web-app). @@ -3039,6 +3159,10 @@ type CreateRepositoryInput struct { // RepositoryName is a required field RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` + // The metadata that you apply to the repository to help you categorize and + // organize them. Each tag consists of a key and an optional value, both of + // which you define. Tag keys can have a maximum character length of 128 characters, + // and tag values can have a maximum length of 256 characters. Tags []*Tag `locationName:"tags" type:"list"` } @@ -3068,6 +3192,12 @@ func (s *CreateRepositoryInput) Validate() error { return nil } +// SetImageTagMutability sets the ImageTagMutability field's value. +func (s *CreateRepositoryInput) SetImageTagMutability(v string) *CreateRepositoryInput { + s.ImageTagMutability = &v + return s +} + // SetRepositoryName sets the RepositoryName field's value. func (s *CreateRepositoryInput) SetRepositoryName(v string) *CreateRepositoryInput { s.RepositoryName = &v @@ -3437,7 +3567,7 @@ type DescribeImagesInput struct { // registry is assumed. RegistryId *string `locationName:"registryId" type:"string"` - // A list of repositories to describe. + // The repository that contains the images to describe. // // RepositoryName is a required field RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` @@ -3468,6 +3598,16 @@ func (s *DescribeImagesInput) Validate() error { if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) } + if s.ImageIds != nil { + for i, v := range s.ImageIds { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ImageIds", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -3936,22 +4076,21 @@ type GetLifecyclePolicyPreviewInput struct { ImageIds []*ImageIdentifier `locationName:"imageIds" min:"1" type:"list"` // The maximum number of repository results returned by GetLifecyclePolicyPreviewRequest - // in
 paginated output. When this parameter is used, GetLifecyclePolicyPreviewRequest - // only returns
 maxResults results in a single page along with a nextToken - // response element. The remaining results of the initial request can be seen - // by sending
 another GetLifecyclePolicyPreviewRequest request with the returned - // nextToken
 value. This value can be between 1 and 1000. If this
 parameter - // is not used, then GetLifecyclePolicyPreviewRequest returns up to
 100 results - // and a nextToken value, if
 applicable. This option cannot be used when you - // specify images with imageIds. + // in paginated output. When this parameter is used, GetLifecyclePolicyPreviewRequest + // only returns maxResults results in a single page along with a nextToken response + // element. The remaining results of the initial request can be seen by sending + // another GetLifecyclePolicyPreviewRequest request with the returned nextToken + // value. This value can be between 1 and 1000. If this parameter is not used, + // then GetLifecyclePolicyPreviewRequest returns up to 100 results and a nextToken + // value, if applicable. This option cannot be used when you specify images + // with imageIds. MaxResults *int64 `locationName:"maxResults" min:"1" type:"integer"` - // The nextToken value returned from a previous paginated
 GetLifecyclePolicyPreviewRequest - // request where maxResults was used and the
 results exceeded the value of - // that parameter. Pagination continues from the end of the
 previous results - // that returned the nextToken value. This value is
 null when there are no - // more results to return. This option cannot be used when you specify images - // with imageIds. + // The nextToken value returned from a previous paginated GetLifecyclePolicyPreviewRequest + // request where maxResults was used and the results exceeded the value of that + // parameter. Pagination continues from the end of the previous results that + // returned the nextToken value. This value is null when there are no more results + // to return. This option cannot be used when you specify images with imageIds. NextToken *string `locationName:"nextToken" type:"string"` // The AWS account ID associated with the registry that contains the repository. @@ -3989,6 +4128,16 @@ func (s *GetLifecyclePolicyPreviewInput) Validate() error { if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) } + if s.ImageIds != nil { + for i, v := range s.ImageIds { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ImageIds", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -4380,7 +4529,7 @@ type ImageIdentifier struct { ImageDigest *string `locationName:"imageDigest" type:"string"` // The tag used for the image. - ImageTag *string `locationName:"imageTag" type:"string"` + ImageTag *string `locationName:"imageTag" min:"1" type:"string"` } // String returns the string representation @@ -4393,6 +4542,19 @@ func (s ImageIdentifier) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ImageIdentifier) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ImageIdentifier"} + if s.ImageTag != nil && len(*s.ImageTag) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ImageTag", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetImageDigest sets the ImageDigest field's value. func (s *ImageIdentifier) SetImageDigest(v string) *ImageIdentifier { s.ImageDigest = &v @@ -4943,7 +5105,7 @@ type PutImageInput struct { // The tag to associate with the image. This parameter is required for images // that use the Docker Image Manifest V2 Schema 2 or OCI formats. - ImageTag *string `locationName:"imageTag" type:"string"` + ImageTag *string `locationName:"imageTag" min:"1" type:"string"` // The AWS account ID associated with the registry that contains the repository // in which to put the image. If you do not specify a registry, the default @@ -4972,6 +5134,9 @@ func (s *PutImageInput) Validate() error { if s.ImageManifest == nil { invalidParams.Add(request.NewErrParamRequired("ImageManifest")) } + if s.ImageTag != nil && len(*s.ImageTag) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ImageTag", 1)) + } if s.RepositoryName == nil { invalidParams.Add(request.NewErrParamRequired("RepositoryName")) } @@ -5032,6 +5197,115 @@ func (s *PutImageOutput) SetImage(v *Image) *PutImageOutput { return s } +type PutImageTagMutabilityInput struct { + _ struct{} `type:"structure"` + + // The tag mutability setting for the repository. If MUTABLE is specified, image + // tags can be overwritten. If IMMUTABLE is specified, all image tags within + // the repository will be immutable which will prevent them from being overwritten. + // + // ImageTagMutability is a required field + ImageTagMutability *string `locationName:"imageTagMutability" type:"string" required:"true" enum:"ImageTagMutability"` + + // The AWS account ID associated with the registry that contains the repository + // in which to update the image tag mutability settings. If you do not specify + // a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository in which to update the image tag mutability settings. + // + // RepositoryName is a required field + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s PutImageTagMutabilityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutImageTagMutabilityInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutImageTagMutabilityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutImageTagMutabilityInput"} + if s.ImageTagMutability == nil { + invalidParams.Add(request.NewErrParamRequired("ImageTagMutability")) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetImageTagMutability sets the ImageTagMutability field's value. +func (s *PutImageTagMutabilityInput) SetImageTagMutability(v string) *PutImageTagMutabilityInput { + s.ImageTagMutability = &v + return s +} + +// SetRegistryId sets the RegistryId field's value. +func (s *PutImageTagMutabilityInput) SetRegistryId(v string) *PutImageTagMutabilityInput { + s.RegistryId = &v + return s +} + +// SetRepositoryName sets the RepositoryName field's value. +func (s *PutImageTagMutabilityInput) SetRepositoryName(v string) *PutImageTagMutabilityInput { + s.RepositoryName = &v + return s +} + +type PutImageTagMutabilityOutput struct { + _ struct{} `type:"structure"` + + // The image tag mutability setting for the repository. + ImageTagMutability *string `locationName:"imageTagMutability" type:"string" enum:"ImageTagMutability"` + + // The registry ID associated with the request. + RegistryId *string `locationName:"registryId" type:"string"` + + // The repository name associated with the request. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string"` +} + +// String returns the string representation +func (s PutImageTagMutabilityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutImageTagMutabilityOutput) GoString() string { + return s.String() +} + +// SetImageTagMutability sets the ImageTagMutability field's value. +func (s *PutImageTagMutabilityOutput) SetImageTagMutability(v string) *PutImageTagMutabilityOutput { + s.ImageTagMutability = &v + return s +} + +// SetRegistryId sets the RegistryId field's value. +func (s *PutImageTagMutabilityOutput) SetRegistryId(v string) *PutImageTagMutabilityOutput { + s.RegistryId = &v + return s +} + +// SetRepositoryName sets the RepositoryName field's value. +func (s *PutImageTagMutabilityOutput) SetRepositoryName(v string) *PutImageTagMutabilityOutput { + s.RepositoryName = &v + return s +} + type PutLifecyclePolicyInput struct { _ struct{} `type:"structure"` @@ -5041,7 +5315,7 @@ type PutLifecyclePolicyInput struct { LifecyclePolicyText *string `locationName:"lifecyclePolicyText" min:"100" type:"string" required:"true"` // The AWS account ID associated with the registry that contains the repository. - // If you do
 not specify a registry, the default registry is assumed. + // If you do not specify a registry, the default registry is assumed. RegistryId *string `locationName:"registryId" type:"string"` // The name of the repository to receive the policy. @@ -5148,6 +5422,9 @@ type Repository struct { // The date and time, in JavaScript date format, when the repository was created. CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` + // The tag mutability setting for the repository. + ImageTagMutability *string `locationName:"imageTagMutability" type:"string" enum:"ImageTagMutability"` + // The AWS account ID associated with the registry that contains the repository. RegistryId *string `locationName:"registryId" type:"string"` @@ -5181,6 +5458,12 @@ func (s *Repository) SetCreatedAt(v time.Time) *Repository { return s } +// SetImageTagMutability sets the ImageTagMutability field's value. +func (s *Repository) SetImageTagMutability(v string) *Repository { + s.ImageTagMutability = &v + return s +} + // SetRegistryId sets the RegistryId field's value. func (s *Repository) SetRegistryId(v string) *Repository { s.RegistryId = &v @@ -5213,7 +5496,9 @@ type SetRepositoryPolicyInput struct { // operation. This is intended to prevent accidental repository lock outs. Force *bool `locationName:"force" type:"boolean"` - // The JSON repository policy text to apply to the repository. + // The JSON repository policy text to apply to the repository. For more information, + // see Amazon ECR Repository Policy Examples (https://docs.aws.amazon.com/AmazonECR/latest/userguide/RepositoryPolicyExamples.html) + // in the Amazon Elastic Container Registry User Guide. // // PolicyText is a required field PolicyText *string `locationName:"policyText" type:"string" required:"true"` @@ -5792,6 +6077,14 @@ const ( ImageFailureCodeMissingDigestAndTag = "MissingDigestAndTag" ) +const ( + // ImageTagMutabilityMutable is a ImageTagMutability enum value + ImageTagMutabilityMutable = "MUTABLE" + + // ImageTagMutabilityImmutable is a ImageTagMutability enum value + ImageTagMutabilityImmutable = "IMMUTABLE" +) + const ( // LayerAvailabilityAvailable is a LayerAvailability enum value LayerAvailabilityAvailable = "AVAILABLE" diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecr/errors.go b/vendor/github.com/aws/aws-sdk-go/service/ecr/errors.go index 834905106..c1f18605c 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ecr/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ecr/errors.go @@ -23,6 +23,13 @@ const ( // The image requested does not exist in the specified repository. ErrCodeImageNotFoundException = "ImageNotFoundException" + // ErrCodeImageTagAlreadyExistsException for service response error code + // "ImageTagAlreadyExistsException". + // + // The specified image is tagged with a tag that already exists. The repository + // is configured for tag immutability. + ErrCodeImageTagAlreadyExistsException = "ImageTagAlreadyExistsException" + // ErrCodeInvalidLayerException for service response error code // "InvalidLayerException". // @@ -102,7 +109,7 @@ const ( // // The operation did not succeed because it would have exceeded a service limit // for your account. For more information, see Amazon ECR Default Service Limits - // (http://docs.aws.amazon.com/AmazonECR/latest/userguide/service_limits.html) + // (https://docs.aws.amazon.com/AmazonECR/latest/userguide/service_limits.html) // in the Amazon Elastic Container Registry User Guide. ErrCodeLimitExceededException = "LimitExceededException" diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go b/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go index 7bdf21370..3eba7f696 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go @@ -29,9 +29,9 @@ var initRequest func(*request.Request) // Service information constants const ( - ServiceName = "ecr" // Name of service. - EndpointsID = ServiceName // ID to lookup a service endpoint with. - ServiceID = "ECR" // ServiceID is a unique identifer of a specific service. + ServiceName = "ecr" // Name of service. + EndpointsID = "api.ecr" // ID to lookup a service endpoint with. + ServiceID = "ECR" // ServiceID is a unique identifer of a specific service. ) // New creates a new instance of the ECR client with a session. @@ -46,6 +46,9 @@ const ( // svc := ecr.New(mySession, aws.NewConfig().WithRegion("us-west-2")) func New(p client.ConfigProvider, cfgs ...*aws.Config) *ECR { c := p.ClientConfig(EndpointsID, cfgs...) + if c.SigningNameDerived || len(c.SigningName) == 0 { + c.SigningName = "ecr" + } return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) } diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go index 3b3c2e380..139c27d14 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go @@ -545,6 +545,10 @@ func (c *S3) DeleteBucketAnalyticsConfigurationRequest(input *DeleteBucketAnalyt // Deletes an analytics configuration for the bucket (specified by the analytics // configuration ID). // +// To use this operation, you must have permissions to perform the s3:PutAnalyticsConfiguration +// action. The bucket owner has this permission by default. The bucket owner +// can grant this permission to others. +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -1071,7 +1075,7 @@ func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) // DeleteBucketReplication API operation for Amazon Simple Storage Service. // // Deletes the replication configuration from the bucket. For information about -// replication configuration, see Cross-Region Replication (CRR) ( https://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html) +// replication configuration, see Cross-Region Replication (CRR) (https://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html) // in the Amazon S3 Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -2047,7 +2051,7 @@ func (c *S3) GetBucketLifecycleRequest(input *GetBucketLifecycleInput) (req *req // GetBucketLifecycle API operation for Amazon Simple Storage Service. // -// Deprecated, see the GetBucketLifecycleConfiguration operation. +// No longer used, see the GetBucketLifecycleConfiguration operation. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2428,7 +2432,7 @@ func (c *S3) GetBucketNotificationRequest(input *GetBucketNotificationConfigurat // GetBucketNotification API operation for Amazon Simple Storage Service. // -// Deprecated, see the GetBucketNotificationConfiguration operation. +// No longer used, see the GetBucketNotificationConfiguration operation. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3335,8 +3339,8 @@ func (c *S3) GetObjectLockConfigurationRequest(input *GetObjectLockConfiguration // GetObjectLockConfiguration API operation for Amazon Simple Storage Service. // -// Gets the Object Lock configuration for a bucket. The rule specified in the -// Object Lock configuration will be applied by default to every new object +// Gets the object lock configuration for a bucket. The rule specified in the +// object lock configuration will be applied by default to every new object // placed in the specified bucket. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4210,7 +4214,7 @@ func (c *S3) ListMultipartUploadsWithContext(ctx aws.Context, input *ListMultipa // // Example iterating over at most 3 pages of a ListMultipartUploads operation. // pageNum := 0 // err := client.ListMultipartUploadsPages(params, -// func(page *ListMultipartUploadsOutput, lastPage bool) bool { +// func(page *s3.ListMultipartUploadsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -4340,7 +4344,7 @@ func (c *S3) ListObjectVersionsWithContext(ctx aws.Context, input *ListObjectVer // // Example iterating over at most 3 pages of a ListObjectVersions operation. // pageNum := 0 // err := client.ListObjectVersionsPages(params, -// func(page *ListObjectVersionsOutput, lastPage bool) bool { +// func(page *s3.ListObjectVersionsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -4477,7 +4481,7 @@ func (c *S3) ListObjectsWithContext(ctx aws.Context, input *ListObjectsInput, op // // Example iterating over at most 3 pages of a ListObjects operation. // pageNum := 0 // err := client.ListObjectsPages(params, -// func(page *ListObjectsOutput, lastPage bool) bool { +// func(page *s3.ListObjectsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -4615,7 +4619,7 @@ func (c *S3) ListObjectsV2WithContext(ctx aws.Context, input *ListObjectsV2Input // // Example iterating over at most 3 pages of a ListObjectsV2 operation. // pageNum := 0 // err := client.ListObjectsV2Pages(params, -// func(page *ListObjectsV2Output, lastPage bool) bool { +// func(page *s3.ListObjectsV2Output, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -4745,7 +4749,7 @@ func (c *S3) ListPartsWithContext(ctx aws.Context, input *ListPartsInput, opts . // // Example iterating over at most 3 pages of a ListParts operation. // pageNum := 0 // err := client.ListPartsPages(params, -// func(page *ListPartsOutput, lastPage bool) bool { +// func(page *s3.ListPartsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -5287,7 +5291,7 @@ func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *req // PutBucketLifecycle API operation for Amazon Simple Storage Service. // -// Deprecated, see the PutBucketLifecycleConfiguration operation. +// No longer used, see the PutBucketLifecycleConfiguration operation. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -5600,7 +5604,7 @@ func (c *S3) PutBucketNotificationRequest(input *PutBucketNotificationInput) (re // PutBucketNotification API operation for Amazon Simple Storage Service. // -// Deprecated, see the PutBucketNotificationConfiguraiton operation. +// No longer used, see the PutBucketNotificationConfiguration operation. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -5754,8 +5758,7 @@ func (c *S3) PutBucketPolicyRequest(input *PutBucketPolicyInput) (req *request.R // PutBucketPolicy API operation for Amazon Simple Storage Service. // -// Replaces a policy on a bucket. If the bucket already has a policy, the one -// in this request completely replaces it. +// Applies an Amazon S3 bucket policy to an Amazon S3 bucket. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -5831,7 +5834,7 @@ func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req // PutBucketReplication API operation for Amazon Simple Storage Service. // // Creates a replication configuration or replaces an existing one. For more -// information, see Cross-Region Replication (CRR) ( https://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html) +// information, see Cross-Region Replication (CRR) (https://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html) // in the Amazon S3 Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -6439,8 +6442,8 @@ func (c *S3) PutObjectLockConfigurationRequest(input *PutObjectLockConfiguration // PutObjectLockConfiguration API operation for Amazon Simple Storage Service. // -// Places an Object Lock configuration on the specified bucket. The rule specified -// in the Object Lock configuration will be applied by default to every new +// Places an object lock configuration on the specified bucket. The rule specified +// in the object lock configuration will be applied by default to every new // object placed in the specified bucket. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -7010,13 +7013,16 @@ func (c *S3) UploadPartCopyWithContext(ctx aws.Context, input *UploadPartCopyInp return out, req.Send() } -// Specifies the days since the initiation of an Incomplete Multipart Upload -// that Lifecycle will wait before permanently removing all parts of the upload. +// Specifies the days since the initiation of an incomplete multipart upload +// that Amazon S3 will wait before permanently removing all parts of the upload. +// For more information, see Aborting Incomplete Multipart Uploads Using a Bucket +// Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) +// in the Amazon Simple Storage Service Developer Guide. type AbortIncompleteMultipartUpload struct { _ struct{} `type:"structure"` - // Indicates the number of days that must pass since initiation for Lifecycle - // to abort an Incomplete Multipart Upload. + // Specifies the number of days after which Amazon S3 aborts an incomplete multipart + // upload. DaysAfterInitiation *int64 `type:"integer"` } @@ -7039,9 +7045,13 @@ func (s *AbortIncompleteMultipartUpload) SetDaysAfterInitiation(v int64) *AbortI type AbortMultipartUploadInput struct { _ struct{} `type:"structure"` + // Name of the bucket to which the multipart upload was initiated. + // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + // Key of the object for which the multipart upload was initiated. + // // Key is a required field Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` @@ -7051,6 +7061,8 @@ type AbortMultipartUploadInput struct { // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` + // Upload ID that identifies the multipart upload. + // // UploadId is a required field UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` } @@ -7145,10 +7157,13 @@ func (s *AbortMultipartUploadOutput) SetRequestCharged(v string) *AbortMultipart return s } +// Configures the transfer acceleration state for an Amazon S3 bucket. For more +// information, see Amazon S3 Transfer Acceleration (https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html) +// in the Amazon Simple Storage Service Developer Guide. type AccelerateConfiguration struct { _ struct{} `type:"structure"` - // The accelerate configuration of the bucket. + // Specifies the transfer acceleration status of the bucket. Status *string `type:"string" enum:"BucketAccelerateStatus"` } @@ -7168,12 +7183,14 @@ func (s *AccelerateConfiguration) SetStatus(v string) *AccelerateConfiguration { return s } +// Contains the elements that set the ACL permissions for an object per grantee. type AccessControlPolicy struct { _ struct{} `type:"structure"` // A list of grants. Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` + // Container for the bucket owner's display name and ID. Owner *Owner `type:"structure"` } @@ -7223,7 +7240,9 @@ func (s *AccessControlPolicy) SetOwner(v *Owner) *AccessControlPolicy { type AccessControlTranslation struct { _ struct{} `type:"structure"` - // The override value for the owner of the replica object. + // Specifies the replica ownership. For default and valid values, see PUT bucket + // replication (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html) + // in the Amazon Simple Storage Service API Reference. // // Owner is a required field Owner *string `type:"string" required:"true" enum:"OwnerOverride"` @@ -7258,10 +7277,14 @@ func (s *AccessControlTranslation) SetOwner(v string) *AccessControlTranslation return s } +// A conjunction (logical AND) of predicates, which is used in evaluating a +// metrics filter. The operator must have at least two predicates in any combination, +// and an object must match all of the predicates for the filter to apply. type AnalyticsAndOperator struct { _ struct{} `type:"structure"` - // The prefix to use when evaluating an AND predicate. + // The prefix to use when evaluating an AND predicate: The prefix that an object + // must have to be included in the metrics results. Prefix *string `type:"string"` // The list of tags to use when evaluating an AND predicate. @@ -7310,6 +7333,11 @@ func (s *AnalyticsAndOperator) SetTags(v []*Tag) *AnalyticsAndOperator { return s } +// Specifies the configuration and any analyses for the analytics filter of +// an Amazon S3 bucket. +// +// For more information, see GET Bucket analytics (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETAnalyticsConfig.html) +// in the Amazon Simple Storage Service API Reference. type AnalyticsConfiguration struct { _ struct{} `type:"structure"` @@ -7318,13 +7346,13 @@ type AnalyticsConfiguration struct { // If no filter is provided, all objects will be considered in any analysis. Filter *AnalyticsFilter `type:"structure"` - // The identifier used to represent an analytics configuration. + // The ID that identifies the analytics configuration. // // Id is a required field Id *string `type:"string" required:"true"` - // If present, it indicates that data related to access patterns will be collected - // and made available to analyze the tradeoffs between different storage classes. + // Contains data related to access patterns to be collected and made available + // to analyze the tradeoffs between different storage classes. // // StorageClassAnalysis is a required field StorageClassAnalysis *StorageClassAnalysis `type:"structure" required:"true"` @@ -7384,6 +7412,7 @@ func (s *AnalyticsConfiguration) SetStorageClassAnalysis(v *StorageClassAnalysis return s } +// Where to publish the analytics results. type AnalyticsExportDestination struct { _ struct{} `type:"structure"` @@ -7492,7 +7521,7 @@ func (s *AnalyticsFilter) SetTag(v *Tag) *AnalyticsFilter { type AnalyticsS3BucketDestination struct { _ struct{} `type:"structure"` - // The Amazon resource name (ARN) of the bucket to which data is exported. + // The Amazon Resource Name (ARN) of the bucket to which data is exported. // // Bucket is a required field Bucket *string `type:"string" required:"true"` @@ -7501,13 +7530,12 @@ type AnalyticsS3BucketDestination struct { // the owner will not be validated prior to exporting data. BucketAccountId *string `type:"string"` - // The file format used when exporting data to Amazon S3. + // Specifies the file format used when exporting data to Amazon S3. // // Format is a required field Format *string `type:"string" required:"true" enum:"AnalyticsS3ExportFileFormat"` - // The prefix to use when exporting data. The exported data begins with this - // prefix. + // The prefix to use when exporting data. The prefix is prepended to all results. Prefix *string `type:"string"` } @@ -7600,9 +7628,14 @@ func (s *Bucket) SetName(v string) *Bucket { return s } +// Specifies the lifecycle configuration for objects in an Amazon S3 bucket. +// For more information, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) +// in the Amazon Simple Storage Service Developer Guide. type BucketLifecycleConfiguration struct { _ struct{} `type:"structure"` + // A lifecycle rule for individual objects in an Amazon S3 bucket. + // // Rules is a required field Rules []*LifecycleRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` } @@ -7649,9 +7682,10 @@ func (s *BucketLifecycleConfiguration) SetRules(v []*LifecycleRule) *BucketLifec type BucketLoggingStatus struct { _ struct{} `type:"structure"` - // Container for logging information. Presence of this element indicates that - // logging is enabled. Parameters TargetBucket and TargetPrefix are required - // in this case. + // Describes where logs are stored and the prefix that Amazon S3 assigns to + // all log object keys for a bucket. For more information, see PUT Bucket logging + // (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) + // in the Amazon Simple Storage Service API Reference. LoggingEnabled *LoggingEnabled `type:"structure"` } @@ -7686,9 +7720,15 @@ func (s *BucketLoggingStatus) SetLoggingEnabled(v *LoggingEnabled) *BucketLoggin return s } +// Describes the cross-origin access configuration for objects in an Amazon +// S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing +// (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon +// Simple Storage Service Developer Guide. type CORSConfiguration struct { _ struct{} `type:"structure"` + // A set of allowed origins and methods. + // // CORSRules is a required field CORSRules []*CORSRule `locationName:"CORSRule" type:"list" flattened:"true" required:"true"` } @@ -7732,14 +7772,18 @@ func (s *CORSConfiguration) SetCORSRules(v []*CORSRule) *CORSConfiguration { return s } +// Specifies a cross-origin access rule for an Amazon S3 bucket. type CORSRule struct { _ struct{} `type:"structure"` - // Specifies which headers are allowed in a pre-flight OPTIONS request. + // Headers that are specified in the Access-Control-Request-Headers header. + // These headers are allowed in a preflight OPTIONS request. In response to + // any preflight OPTIONS request, Amazon S3 returns any requested headers that + // are allowed. AllowedHeaders []*string `locationName:"AllowedHeader" type:"list" flattened:"true"` - // Identifies HTTP methods that the domain/origin specified in the rule is allowed - // to execute. + // An HTTP method that you allow the origin to execute. Valid values are GET, + // PUT, HEAD, POST, and DELETE. // // AllowedMethods is a required field AllowedMethods []*string `locationName:"AllowedMethod" type:"list" flattened:"true" required:"true"` @@ -8290,6 +8334,7 @@ func (s *CompletedPart) SetPartNumber(v int64) *CompletedPart { return s } +// Specifies a condition that must be met for a redirect to apply. type Condition struct { _ struct{} `type:"structure"` @@ -8409,7 +8454,7 @@ type CopyObjectInput struct { // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt // the source object. The encryption key provided in this header must be one // that was used when the source object was created. - CopySourceSSECustomerKey *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string" sensitive:"true"` + CopySourceSSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption @@ -8444,10 +8489,10 @@ type CopyObjectInput struct { // Specifies whether you want to apply a Legal Hold to the copied object. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // The Object Lock mode that you want to apply to the copied object. + // The object lock mode that you want to apply to the copied object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // The date and time when you want the copied object's Object Lock to expire. + // The date and time when you want the copied object's object lock to expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // Confirms that the requester knows that she or he will be charged for the @@ -8464,13 +8509,18 @@ type CopyObjectInput struct { // does not store the encryption key. The key must be appropriate for use with // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` + SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption // key was transmitted without error. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + // Specifies the AWS KMS Encryption Context to use for object encryption. The + // value of this header is a base64-encoded UTF-8 string holding JSON with the + // encryption context key-value pairs. + SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` + // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT // requests for an object protected by AWS KMS will fail if not made via SSL // or using SigV4. Documentation on configuring any of the officially supported @@ -8735,6 +8785,12 @@ func (s *CopyObjectInput) SetSSECustomerKeyMD5(v string) *CopyObjectInput { return s } +// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. +func (s *CopyObjectInput) SetSSEKMSEncryptionContext(v string) *CopyObjectInput { + s.SSEKMSEncryptionContext = &v + return s +} + // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *CopyObjectInput) SetSSEKMSKeyId(v string) *CopyObjectInput { s.SSEKMSKeyId = &v @@ -8795,6 +8851,11 @@ type CopyObjectOutput struct { // verification of the customer-provided encryption key. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + // If present, specifies the AWS KMS Encryption Context to use for object encryption. + // The value of this header is a base64-encoded UTF-8 string holding JSON with + // the encryption context key-value pairs. + SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` + // If present, specifies the ID of the AWS Key Management Service (KMS) master // encryption key that was used for the object. SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` @@ -8853,6 +8914,12 @@ func (s *CopyObjectOutput) SetSSECustomerKeyMD5(v string) *CopyObjectOutput { return s } +// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. +func (s *CopyObjectOutput) SetSSEKMSEncryptionContext(v string) *CopyObjectOutput { + s.SSEKMSEncryptionContext = &v + return s +} + // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *CopyObjectOutput) SetSSEKMSKeyId(v string) *CopyObjectOutput { s.SSEKMSKeyId = &v @@ -8937,7 +9004,7 @@ type CreateBucketConfiguration struct { _ struct{} `type:"structure"` // Specifies the region where the bucket will be created. If you don't specify - // a region, the bucket will be created in US Standard. + // a region, the bucket is created in US East (N. Virginia) Region (us-east-1). LocationConstraint *string `type:"string" enum:"BucketLocationConstraint"` } @@ -8984,7 +9051,8 @@ type CreateBucketInput struct { // Allows grantee to write the ACL for the applicable bucket. GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - // Specifies whether you want S3 Object Lock to be enabled for the new bucket. + // Specifies whether you want Amazon S3 object lock to be enabled for the new + // bucket. ObjectLockEnabledForBucket *bool `location:"header" locationName:"x-amz-bucket-object-lock-enabled" type:"boolean"` } @@ -9147,10 +9215,10 @@ type CreateMultipartUploadInput struct { // Specifies whether you want to apply a Legal Hold to the uploaded object. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // Specifies the Object Lock mode that you want to apply to the uploaded object. + // Specifies the object lock mode that you want to apply to the uploaded object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // Specifies the date and time when you want the Object Lock to expire. + // Specifies the date and time when you want the object lock to expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // Confirms that the requester knows that she or he will be charged for the @@ -9167,13 +9235,18 @@ type CreateMultipartUploadInput struct { // does not store the encryption key. The key must be appropriate for use with // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` + SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption // key was transmitted without error. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + // Specifies the AWS KMS Encryption Context to use for object encryption. The + // value of this header is a base64-encoded UTF-8 string holding JSON with the + // encryption context key-value pairs. + SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` + // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT // requests for an object protected by AWS KMS will fail if not made via SSL // or using SigV4. Documentation on configuring any of the officially supported @@ -9368,6 +9441,12 @@ func (s *CreateMultipartUploadInput) SetSSECustomerKeyMD5(v string) *CreateMulti return s } +// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. +func (s *CreateMultipartUploadInput) SetSSEKMSEncryptionContext(v string) *CreateMultipartUploadInput { + s.SSEKMSEncryptionContext = &v + return s +} + // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *CreateMultipartUploadInput) SetSSEKMSKeyId(v string) *CreateMultipartUploadInput { s.SSEKMSKeyId = &v @@ -9428,6 +9507,11 @@ type CreateMultipartUploadOutput struct { // verification of the customer-provided encryption key. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + // If present, specifies the AWS KMS Encryption Context to use for object encryption. + // The value of this header is a base64-encoded UTF-8 string holding JSON with + // the encryption context key-value pairs. + SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` + // If present, specifies the ID of the AWS Key Management Service (KMS) master // encryption key that was used for the object. SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` @@ -9499,6 +9583,12 @@ func (s *CreateMultipartUploadOutput) SetSSECustomerKeyMD5(v string) *CreateMult return s } +// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. +func (s *CreateMultipartUploadOutput) SetSSEKMSEncryptionContext(v string) *CreateMultipartUploadOutput { + s.SSEKMSEncryptionContext = &v + return s +} + // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *CreateMultipartUploadOutput) SetSSEKMSKeyId(v string) *CreateMultipartUploadOutput { s.SSEKMSKeyId = &v @@ -9517,7 +9607,7 @@ func (s *CreateMultipartUploadOutput) SetUploadId(v string) *CreateMultipartUplo return s } -// The container element for specifying the default Object Lock retention settings +// The container element for specifying the default object lock retention settings // for new objects placed in the specified bucket. type DefaultRetention struct { _ struct{} `type:"structure"` @@ -9525,7 +9615,7 @@ type DefaultRetention struct { // The number of days that you want to specify for the default retention period. Days *int64 `type:"integer"` - // The default Object Lock retention mode you want to apply to new objects placed + // The default object lock retention mode you want to apply to new objects placed // in the specified bucket. Mode *string `type:"string" enum:"ObjectLockRetentionMode"` @@ -9625,7 +9715,7 @@ type DeleteBucketAnalyticsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The identifier used to represent an analytics configuration. + // The ID that identifies the analytics configuration. // // Id is a required field Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` @@ -10425,7 +10515,7 @@ type DeleteObjectInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // Indicates whether S3 Object Lock should bypass Governance-mode restrictions + // Indicates whether Amazon S3 object lock should bypass governance-mode restrictions // to process this operation. BypassGovernanceRetention *bool `location:"header" locationName:"x-amz-bypass-governance-retention" type:"boolean"` @@ -10665,7 +10755,7 @@ type DeleteObjectsInput struct { Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` // Specifies whether you want to delete this object even if it has a Governance-type - // Object Lock in place. You must have sufficient permissions to perform this + // object lock in place. You must have sufficient permissions to perform this // operation. BypassGovernanceRetention *bool `location:"header" locationName:"x-amz-bypass-governance-retention" type:"boolean"` @@ -10902,33 +10992,33 @@ func (s *DeletedObject) SetVersionId(v string) *DeletedObject { return s } -// A container for information about the replication destination. +// Specifies information about where to publish analysis or configuration results +// for an Amazon S3 bucket. type Destination struct { _ struct{} `type:"structure"` - // A container for information about access control for replicas. - // - // Use this element only in a cross-account scenario where source and destination - // bucket owners are not the same to change replica ownership to the AWS account - // that owns the destination bucket. If you don't add this element to the replication - // configuration, the replicas are owned by same AWS account that owns the source - // object. + // Specify this only in a cross-account scenario (where source and destination + // bucket owners are not the same), and you want to change replica ownership + // to the AWS account that owns the destination bucket. If this is not specified + // in the replication configuration, the replicas are owned by same AWS account + // that owns the source object. AccessControlTranslation *AccessControlTranslation `type:"structure"` - // The account ID of the destination bucket. Currently, Amazon S3 verifies this - // value only if Access Control Translation is enabled. - // - // In a cross-account scenario, if you change replica ownership to the AWS account - // that owns the destination bucket by adding the AccessControlTranslation element, - // this is the account ID of the owner of the destination bucket. + // Destination bucket owner account ID. In a cross-account scenario, if you + // direct Amazon S3 to change replica ownership to the AWS account that owns + // the destination bucket by specifying the AccessControlTranslation property, + // this is the account ID of the destination bucket owner. For more information, + // see Cross-Region Replication Additional Configuration: Change Replica Owner + // (https://docs.aws.amazon.com/AmazonS3/latest/dev/crr-change-owner.html) in + // the Amazon Simple Storage Service Developer Guide. Account *string `type:"string"` // The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to // store replicas of the object identified by the rule. // - // If there are multiple rules in your replication configuration, all rules - // must specify the same bucket as the destination. A replication configuration - // can replicate objects to only one destination bucket. + // A replication configuration can replicate objects to only one destination + // bucket. If there are multiple rules in your replication configuration, all + // rules must specify the same destination bucket. // // Bucket is a required field Bucket *string `type:"string" required:"true"` @@ -10937,8 +11027,13 @@ type Destination struct { // is specified, you must specify this element. EncryptionConfiguration *EncryptionConfiguration `type:"structure"` - // The class of storage used to store the object. By default Amazon S3 uses - // storage class of the source object when creating a replica. + // The storage class to use when replicating objects, such as standard or reduced + // redundancy. By default, Amazon S3 uses the storage class of the source object + // to create the object replica. + // + // For valid values, see the StorageClass element of the PUT Bucket replication + // (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html) + // action in the Amazon Simple Storage Service API Reference. StorageClass *string `type:"string" enum:"StorageClass"` } @@ -11068,13 +11163,13 @@ func (s *Encryption) SetKMSKeyId(v string) *Encryption { return s } -// A container for information about the encryption-based configuration for -// replicas. +// Specifies encryption-related information for an Amazon S3 bucket that is +// a destination for replicated objects. type EncryptionConfiguration struct { _ struct{} `type:"structure"` - // The ID of the AWS KMS key for the AWS Region where the destination bucket - // resides. Amazon S3 uses this key to encrypt the replica object. + // Specifies the AWS KMS Key ID (Key ARN or Alias ARN) for the destination bucket. + // Amazon S3 uses this key to encrypt replica objects. ReplicaKmsKeyID *string `type:"string"` } @@ -11207,18 +11302,19 @@ func (s *ErrorDocument) SetKey(v string) *ErrorDocument { return s } -// A container for a key value pair that defines the criteria for the filter -// rule. +// Specifies the Amazon S3 object key name to filter on and whether to filter +// on the suffix or prefix of the key name. type FilterRule struct { _ struct{} `type:"structure"` // The object key name prefix or suffix identifying one or more objects to which - // the filtering rule applies. The maximum prefix length is 1,024 characters. - // Overlapping prefixes and suffixes are not supported. For more information, - // see Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // the filtering rule applies. The maximum length is 1,024 characters. Overlapping + // prefixes and suffixes are not supported. For more information, see Configuring + // Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. Name *string `type:"string" enum:"FilterRuleName"` + // The value that the filter searches for in object key names. Value *string `type:"string"` } @@ -11400,7 +11496,7 @@ type GetBucketAnalyticsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The identifier used to represent an analytics configuration. + // The ID that identifies the analytics configuration. // // Id is a required field Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` @@ -11597,8 +11693,7 @@ func (s *GetBucketEncryptionInput) getBucket() (v string) { type GetBucketEncryptionOutput struct { _ struct{} `type:"structure" payload:"ServerSideEncryptionConfiguration"` - // Container for server-side encryption configuration rules. Currently S3 supports - // one rule only. + // Specifies the default server-side-encryption configuration. ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `type:"structure"` } @@ -11956,9 +12051,10 @@ func (s *GetBucketLoggingInput) getBucket() (v string) { type GetBucketLoggingOutput struct { _ struct{} `type:"structure"` - // Container for logging information. Presence of this element indicates that - // logging is enabled. Parameters TargetBucket and TargetPrefix are required - // in this case. + // Describes where logs are stored and the prefix that Amazon S3 assigns to + // all log object keys for a bucket. For more information, see PUT Bucket logging + // (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) + // in the Amazon Simple Storage Service API Reference. LoggingEnabled *LoggingEnabled `type:"structure"` } @@ -12592,6 +12688,8 @@ type GetBucketWebsiteOutput struct { IndexDocument *IndexDocument `type:"structure"` + // Specifies the redirect behavior of all requests to a website endpoint of + // an Amazon S3 bucket. RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` @@ -12820,7 +12918,7 @@ type GetObjectInput struct { // does not store the encryption key. The key must be appropriate for use with // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` + SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption @@ -13103,7 +13201,7 @@ func (s *GetObjectLegalHoldOutput) SetLegalHold(v *ObjectLockLegalHold) *GetObje type GetObjectLockConfigurationInput struct { _ struct{} `type:"structure"` - // The bucket whose Object Lock configuration you want to retrieve. + // The bucket whose object lock configuration you want to retrieve. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -13151,7 +13249,7 @@ func (s *GetObjectLockConfigurationInput) getBucket() (v string) { type GetObjectLockConfigurationOutput struct { _ struct{} `type:"structure" payload:"ObjectLockConfiguration"` - // The specified bucket's Object Lock configuration. + // The specified bucket's object lock configuration. ObjectLockConfiguration *ObjectLockConfiguration `type:"structure"` } @@ -13235,10 +13333,10 @@ type GetObjectOutput struct { // returned if you have permission to view an object's legal hold status. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // The Object Lock mode currently in place for this object. + // The object lock mode currently in place for this object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // The date and time when this object's Object Lock will expire. + // The date and time when this object's object lock will expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // The count of parts this object has. @@ -14136,7 +14234,7 @@ type HeadObjectInput struct { // does not store the encryption key. The key must be appropriate for use with // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` + SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption @@ -14328,10 +14426,10 @@ type HeadObjectOutput struct { // The Legal Hold status for the specified object. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // The Object Lock mode currently in place for this object. + // The object lock mode currently in place for this object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // The date and time when this object's Object Lock will expire. + // The date and time when this object's object lock expires. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // The count of parts this object has. @@ -14680,6 +14778,9 @@ func (s *InputSerialization) SetParquet(v *ParquetInput) *InputSerialization { return s } +// Specifies the inventory configuration for an Amazon S3 bucket. For more information, +// see GET Bucket inventory (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETInventoryConfig.html) +// in the Amazon Simple Storage Service API Reference. type InventoryConfiguration struct { _ struct{} `type:"structure"` @@ -14697,12 +14798,16 @@ type InventoryConfiguration struct { // Id is a required field Id *string `type:"string" required:"true"` - // Specifies which object version(s) to included in the inventory results. + // Object versions to include in the inventory list. If set to All, the list + // includes all the object versions, which adds the version-related fields VersionId, + // IsLatest, and DeleteMarker to the list. If set to Current, the list does + // not contain these version-related fields. // // IncludedObjectVersions is a required field IncludedObjectVersions *string `type:"string" required:"true" enum:"InventoryIncludedObjectVersions"` - // Specifies whether the inventory is enabled or disabled. + // Specifies whether the inventory is enabled or disabled. If set to True, an + // inventory list is generated. If set to False, no inventory list is generated. // // IsEnabled is a required field IsEnabled *bool `type:"boolean" required:"true"` @@ -15145,11 +15250,15 @@ func (s *KeyFilter) SetFilterRules(v []*FilterRule) *KeyFilter { type LambdaFunctionConfiguration struct { _ struct{} `type:"structure"` + // The Amazon S3 bucket event for which to invoke the AWS Lambda function. For + // more information, see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // in the Amazon Simple Storage Service Developer Guide. + // // Events is a required field Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - // A container for object key name filtering rules. For information about key - // name filtering, see Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // Specifies object key name filtering rules. For information about key name + // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. Filter *NotificationConfigurationFilter `type:"structure"` @@ -15157,8 +15266,8 @@ type LambdaFunctionConfiguration struct { // If you don't provide one, Amazon S3 will assign an ID. Id *string `type:"string"` - // The Amazon Resource Name (ARN) of the Lambda cloud function that Amazon S3 - // can invoke when it detects events of the specified type. + // The Amazon Resource Name (ARN) of the AWS Lambda function that Amazon S3 + // invokes when the specified event type occurs. // // LambdaFunctionArn is a required field LambdaFunctionArn *string `locationName:"CloudFunction" type:"string" required:"true"` @@ -15309,8 +15418,11 @@ func (s *LifecycleExpiration) SetExpiredObjectDeleteMarker(v bool) *LifecycleExp type LifecycleRule struct { _ struct{} `type:"structure"` - // Specifies the days since the initiation of an Incomplete Multipart Upload - // that Lifecycle will wait before permanently removing all parts of the upload. + // Specifies the days since the initiation of an incomplete multipart upload + // that Amazon S3 will wait before permanently removing all parts of the upload. + // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket + // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) + // in the Amazon Simple Storage Service Developer Guide. AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` Expiration *LifecycleExpiration `type:"structure"` @@ -15332,7 +15444,7 @@ type LifecycleRule struct { NoncurrentVersionTransitions []*NoncurrentVersionTransition `locationName:"NoncurrentVersionTransition" type:"list" flattened:"true"` // Prefix identifying one or more objects to which the rule applies. This is - // deprecated; use Filter instead. + // No longer used; use Filter instead. // // Deprecated: Prefix has been deprecated Prefix *string `deprecated:"true" type:"string"` @@ -17267,9 +17379,10 @@ func (s *Location) SetUserMetadata(v []*MetadataEntry) *Location { return s } -// Container for logging information. Presence of this element indicates that -// logging is enabled. Parameters TargetBucket and TargetPrefix are required -// in this case. +// Describes where logs are stored and the prefix that Amazon S3 assigns to +// all log object keys for a bucket. For more information, see PUT Bucket logging +// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) +// in the Amazon Simple Storage Service API Reference. type LoggingEnabled struct { _ struct{} `type:"structure"` @@ -17285,8 +17398,9 @@ type LoggingEnabled struct { TargetGrants []*TargetGrant `locationNameList:"Grant" type:"list"` - // This element lets you specify a prefix for the keys that the log files will - // be stored under. + // A prefix for all log object keys. If you store log files from multiple Amazon + // S3 buckets in a single bucket, you can use a prefix to distinguish which + // log files came from which bucket. // // TargetPrefix is a required field TargetPrefix *string `type:"string" required:"true"` @@ -17429,6 +17543,13 @@ func (s *MetricsAndOperator) SetTags(v []*Tag) *MetricsAndOperator { return s } +// Specifies a metrics configuration for the CloudWatch request metrics (specified +// by the metrics configuration ID) from an Amazon S3 bucket. If you're updating +// an existing metrics configuration, note that this is a full replacement of +// the existing metrics configuration. If you don't include the elements you +// want to keep, they are erased. For more information, see PUT Bucket metrics +// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTMetricConfiguration.html) +// in the Amazon Simple Storage Service API Reference. type MetricsConfiguration struct { _ struct{} `type:"structure"` @@ -17624,8 +17745,8 @@ type NoncurrentVersionExpiration struct { // Specifies the number of days an object is noncurrent before Amazon S3 can // perform the associated action. For information about the noncurrent days // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent - // (http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) in - // the Amazon Simple Storage Service Developer Guide. + // (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#non-current-days-calculations) + // in the Amazon Simple Storage Service Developer Guide. NoncurrentDays *int64 `type:"integer"` } @@ -17646,19 +17767,20 @@ func (s *NoncurrentVersionExpiration) SetNoncurrentDays(v int64) *NoncurrentVers } // Container for the transition rule that describes when noncurrent objects -// transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING or GLACIER -// storage class. If your bucket is versioning-enabled (or versioning is suspended), -// you can set this action to request that Amazon S3 transition noncurrent object -// versions to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING or GLACIER storage -// class at a specific period in the object's lifetime. +// transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, +// or DEEP_ARCHIVE storage class. If your bucket is versioning-enabled (or versioning +// is suspended), you can set this action to request that Amazon S3 transition +// noncurrent object versions to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, +// GLACIER, or DEEP_ARCHIVE storage class at a specific period in the object's +// lifetime. type NoncurrentVersionTransition struct { _ struct{} `type:"structure"` // Specifies the number of days an object is noncurrent before Amazon S3 can // perform the associated action. For information about the noncurrent days // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent - // (http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) in - // the Amazon Simple Storage Service Developer Guide. + // (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) + // in the Amazon Simple Storage Service Developer Guide. NoncurrentDays *int64 `type:"integer"` // The class of storage used to store the object. @@ -17692,10 +17814,16 @@ func (s *NoncurrentVersionTransition) SetStorageClass(v string) *NoncurrentVersi type NotificationConfiguration struct { _ struct{} `type:"structure"` + // Describes the AWS Lambda functions to invoke and the events for which to + // invoke them. LambdaFunctionConfigurations []*LambdaFunctionConfiguration `locationName:"CloudFunctionConfiguration" type:"list" flattened:"true"` + // The Amazon Simple Queue Service queues to publish messages to and the events + // for which to publish messages. QueueConfigurations []*QueueConfiguration `locationName:"QueueConfiguration" type:"list" flattened:"true"` + // The topic to which notifications are sent and the events for which notifications + // are generated. TopicConfigurations []*TopicConfiguration `locationName:"TopicConfiguration" type:"list" flattened:"true"` } @@ -17805,8 +17933,8 @@ func (s *NotificationConfigurationDeprecated) SetTopicConfiguration(v *TopicConf return s } -// A container for object key name filtering rules. For information about key -// name filtering, see Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) +// Specifies object key name filtering rules. For information about key name +// filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. type NotificationConfigurationFilter struct { _ struct{} `type:"structure"` @@ -17944,14 +18072,14 @@ func (s *ObjectIdentifier) SetVersionId(v string) *ObjectIdentifier { return s } -// The container element for Object Lock configuration parameters. +// The container element for object lock configuration parameters. type ObjectLockConfiguration struct { _ struct{} `type:"structure"` - // Indicates whether this bucket has an Object Lock configuration enabled. + // Indicates whether this bucket has an object lock configuration enabled. ObjectLockEnabled *string `type:"string" enum:"ObjectLockEnabled"` - // The Object Lock rule in place for the specified object. + // The object lock rule in place for the specified object. Rule *ObjectLockRule `type:"structure"` } @@ -18008,7 +18136,7 @@ type ObjectLockRetention struct { // Indicates the Retention mode for the specified object. Mode *string `type:"string" enum:"ObjectLockRetentionMode"` - // The date on which this Object Lock Retention will expire. + // The date on which this object lock retention expires. RetainUntilDate *time.Time `type:"timestamp" timestampFormat:"iso8601"` } @@ -18034,7 +18162,7 @@ func (s *ObjectLockRetention) SetRetainUntilDate(v time.Time) *ObjectLockRetenti return s } -// The container element for an Object Lock rule. +// The container element for an object lock rule. type ObjectLockRule struct { _ struct{} `type:"structure"` @@ -18417,6 +18545,7 @@ func (s *ProgressEvent) UnmarshalEvent( return nil } +// Specifies the Block Public Access configuration for an Amazon S3 bucket. type PublicAccessBlockConfiguration struct { _ struct{} `type:"structure"` @@ -18574,6 +18703,7 @@ type PutBucketAclInput struct { // The canned ACL to apply to the bucket. ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"BucketCannedACL"` + // Contains the elements that set the ACL permissions for an object per grantee. AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` // Bucket is a required field @@ -18709,7 +18839,7 @@ type PutBucketAnalyticsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The identifier used to represent an analytics configuration. + // The ID that identifies the analytics configuration. // // Id is a required field Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` @@ -18797,6 +18927,11 @@ type PutBucketCorsInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + // Describes the cross-origin access configuration for objects in an Amazon + // S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing + // (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon + // Simple Storage Service Developer Guide. + // // CORSConfiguration is a required field CORSConfiguration *CORSConfiguration `locationName:"CORSConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` } @@ -18871,14 +19006,16 @@ func (s PutBucketCorsOutput) GoString() string { type PutBucketEncryptionInput struct { _ struct{} `type:"structure" payload:"ServerSideEncryptionConfiguration"` - // The name of the bucket for which the server-side encryption configuration - // is set. + // Specifies default encryption for a bucket using server-side encryption with + // Amazon S3-managed keys (SSE-S3) or AWS KMS-managed keys (SSE-KMS). For information + // about the Amazon S3 default encryption feature, see Amazon S3 Default Bucket + // Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html) + // in the Amazon Simple Storage Service Developer Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // Container for server-side encryption configuration rules. Currently S3 supports - // one rule only. + // Specifies the default server-side-encryption configuration. // // ServerSideEncryptionConfiguration is a required field ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `locationName:"ServerSideEncryptionConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` @@ -19052,6 +19189,9 @@ type PutBucketLifecycleConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + // Specifies the lifecycle configuration for objects in an Amazon S3 bucket. + // For more information, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) + // in the Amazon Simple Storage Service Developer Guide. LifecycleConfiguration *BucketLifecycleConfiguration `locationName:"LifecycleConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` } @@ -19611,6 +19751,9 @@ type PutBucketReplicationInput struct { // // ReplicationConfiguration is a required field ReplicationConfiguration *ReplicationConfiguration `locationName:"ReplicationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + // A token that allows Amazon S3 object lock to be enabled for an existing bucket. + Token *string `location:"header" locationName:"x-amz-bucket-object-lock-token" type:"string"` } // String returns the string representation @@ -19666,6 +19809,12 @@ func (s *PutBucketReplicationInput) SetReplicationConfiguration(v *ReplicationCo return s } +// SetToken sets the Token field's value. +func (s *PutBucketReplicationInput) SetToken(v string) *PutBucketReplicationInput { + s.Token = &v + return s +} + type PutBucketReplicationOutput struct { _ struct{} `type:"structure"` } @@ -19844,6 +19993,10 @@ type PutBucketVersioningInput struct { // and the value that is displayed on your authentication device. MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` + // Describes the versioning state of an Amazon S3 bucket. For more information, + // see PUT Bucket versioning (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTVersioningStatus.html) + // in the Amazon Simple Storage Service API Reference. + // // VersioningConfiguration is a required field VersioningConfiguration *VersioningConfiguration `locationName:"VersioningConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` } @@ -19922,6 +20075,8 @@ type PutBucketWebsiteInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + // Specifies website configuration parameters for an Amazon S3 bucket. + // // WebsiteConfiguration is a required field WebsiteConfiguration *WebsiteConfiguration `locationName:"WebsiteConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` } @@ -19999,6 +20154,7 @@ type PutObjectAclInput struct { // The canned ACL to apply to the object. ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` + // Contains the elements that set the ACL permissions for an object per grantee. AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` // Bucket is a required field @@ -20199,7 +20355,9 @@ type PutObjectInput struct { // body cannot be determined automatically. ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - // The base64-encoded 128-bit MD5 digest of the part data. + // The base64-encoded 128-bit MD5 digest of the part data. This parameter is + // auto-populated when using the command from the CLI. This parameted is required + // if object lock parameters are specified. ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` // A standard MIME type describing the format of the object data. @@ -20231,10 +20389,10 @@ type PutObjectInput struct { // The Legal Hold status that you want to apply to the specified object. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // The Object Lock mode that you want to apply to this object. + // The object lock mode that you want to apply to this object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // The date and time when you want this object's Object Lock to expire. + // The date and time when you want this object's object lock to expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // Confirms that the requester knows that she or he will be charged for the @@ -20251,13 +20409,18 @@ type PutObjectInput struct { // does not store the encryption key. The key must be appropriate for use with // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` + SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption // key was transmitted without error. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + // Specifies the AWS KMS Encryption Context to use for object encryption. The + // value of this header is a base64-encoded UTF-8 string holding JSON with the + // encryption context key-value pairs. + SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` + // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT // requests for an object protected by AWS KMS will fail if not made via SSL // or using SigV4. Documentation on configuring any of the officially supported @@ -20471,6 +20634,12 @@ func (s *PutObjectInput) SetSSECustomerKeyMD5(v string) *PutObjectInput { return s } +// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. +func (s *PutObjectInput) SetSSEKMSEncryptionContext(v string) *PutObjectInput { + s.SSEKMSEncryptionContext = &v + return s +} + // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *PutObjectInput) SetSSEKMSKeyId(v string) *PutObjectInput { s.SSEKMSKeyId = &v @@ -20624,12 +20793,12 @@ func (s *PutObjectLegalHoldOutput) SetRequestCharged(v string) *PutObjectLegalHo type PutObjectLockConfigurationInput struct { _ struct{} `type:"structure" payload:"ObjectLockConfiguration"` - // The bucket whose Object Lock configuration you want to create or replace. + // The bucket whose object lock configuration you want to create or replace. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The Object Lock configuration that you want to apply to the specified bucket. + // The object lock configuration that you want to apply to the specified bucket. ObjectLockConfiguration *ObjectLockConfiguration `locationName:"ObjectLockConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` // Confirms that the requester knows that she or he will be charged for the @@ -20638,6 +20807,7 @@ type PutObjectLockConfigurationInput struct { // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` + // A token to allow Amazon S3 object lock to be enabled for an existing bucket. Token *string `location:"header" locationName:"x-amz-bucket-object-lock-token" type:"string"` } @@ -20746,6 +20916,11 @@ type PutObjectOutput struct { // verification of the customer-provided encryption key. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + // If present, specifies the AWS KMS Encryption Context to use for object encryption. + // The value of this header is a base64-encoded UTF-8 string holding JSON with + // the encryption context key-value pairs. + SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` + // If present, specifies the ID of the AWS Key Management Service (KMS) master // encryption key that was used for the object. SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` @@ -20798,6 +20973,12 @@ func (s *PutObjectOutput) SetSSECustomerKeyMD5(v string) *PutObjectOutput { return s } +// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. +func (s *PutObjectOutput) SetSSEKMSEncryptionContext(v string) *PutObjectOutput { + s.SSEKMSEncryptionContext = &v + return s +} + // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *PutObjectOutput) SetSSEKMSKeyId(v string) *PutObjectOutput { s.SSEKMSKeyId = &v @@ -21136,17 +21317,16 @@ func (s PutPublicAccessBlockOutput) GoString() string { return s.String() } -// A container for specifying the configuration for publication of messages -// to an Amazon Simple Queue Service (Amazon SQS) queue.when Amazon S3 detects -// specified events. +// Specifies the configuration for publishing messages to an Amazon Simple Queue +// Service (Amazon SQS) queue when Amazon S3 detects specified events. type QueueConfiguration struct { _ struct{} `type:"structure"` // Events is a required field Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - // A container for object key name filtering rules. For information about key - // name filtering, see Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // Specifies object key name filtering rules. For information about key name + // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. Filter *NotificationConfigurationFilter `type:"structure"` @@ -21155,7 +21335,7 @@ type QueueConfiguration struct { Id *string `type:"string"` // The Amazon Resource Name (ARN) of the Amazon SQS queue to which Amazon S3 - // will publish a message when it detects events of the specified type. + // publishes a message when it detects events of the specified type. // // QueueArn is a required field QueueArn *string `locationName:"Queue" type:"string" required:"true"` @@ -21301,6 +21481,8 @@ func (s *RecordsEvent) UnmarshalEvent( return nil } +// Specifies how requests are redirected. In the event of an error, you can +// specify a different error code to return. type Redirect struct { _ struct{} `type:"structure"` @@ -21311,8 +21493,8 @@ type Redirect struct { // siblings is present. HttpRedirectCode *string `type:"string"` - // Protocol to use (http, https) when redirecting requests. The default is the - // protocol that is used in the original request. + // Protocol to use when redirecting requests. The default is the protocol that + // is used in the original request. Protocol *string `type:"string" enum:"Protocol"` // The object key prefix to use in the redirect request. For example, to redirect @@ -21324,7 +21506,7 @@ type Redirect struct { ReplaceKeyPrefixWith *string `type:"string"` // The specific object key to use in the redirect request. For example, redirect - // request to error.html. Not required if one of the sibling is present. Can + // request to error.html. Not required if one of the siblings is present. Can // be present only if ReplaceKeyPrefixWith is not provided. ReplaceKeyWith *string `type:"string"` } @@ -21369,16 +21551,18 @@ func (s *Redirect) SetReplaceKeyWith(v string) *Redirect { return s } +// Specifies the redirect behavior of all requests to a website endpoint of +// an Amazon S3 bucket. type RedirectAllRequestsTo struct { _ struct{} `type:"structure"` - // Name of the host where requests will be redirected. + // Name of the host where requests are redirected. // // HostName is a required field HostName *string `type:"string" required:"true"` - // Protocol to use (http, https) when redirecting requests. The default is the - // protocol that is used in the original request. + // Protocol to use when redirecting requests. The default is the protocol that + // is used in the original request. Protocol *string `type:"string" enum:"Protocol"` } @@ -21423,7 +21607,9 @@ type ReplicationConfiguration struct { _ struct{} `type:"structure"` // The Amazon Resource Name (ARN) of the AWS Identity and Access Management - // (IAM) role that Amazon S3 can assume when replicating the objects. + // (IAM) role that Amazon S3 assumes when replicating objects. For more information, + // see How to Set Up Cross-Region Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/crr-how-setup.html) + // in the Amazon Simple Storage Service Developer Guide. // // Role is a required field Role *string `type:"string" required:"true"` @@ -21483,7 +21669,7 @@ func (s *ReplicationConfiguration) SetRules(v []*ReplicationRule) *ReplicationCo return s } -// A container for information about a specific replication rule. +// Specifies which Amazon S3 objects to replicate and where to store the replicas. type ReplicationRule struct { _ struct{} `type:"structure"` @@ -21503,7 +21689,8 @@ type ReplicationRule struct { ID *string `type:"string"` // An object keyname prefix that identifies the object or objects to which the - // rule applies. The maximum prefix length is 1,024 characters. + // rule applies. The maximum prefix length is 1,024 characters. To include all + // objects in a bucket, specify an empty string. // // Deprecated: Prefix has been deprecated Prefix *string `deprecated:"true" type:"string"` @@ -21519,7 +21706,7 @@ type ReplicationRule struct { // * Same object qualify tag based filter criteria specified in multiple // rules // - // For more information, see Cross-Region Replication (CRR) ( https://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html) + // For more information, see Cross-Region Replication (CRR) (https://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html) // in the Amazon S3 Developer Guide. Priority *int64 `type:"integer"` @@ -21528,12 +21715,9 @@ type ReplicationRule struct { // replication of these objects. Currently, Amazon S3 supports only the filter // that you can specify for objects created with server-side encryption using // an AWS KMS-Managed Key (SSE-KMS). - // - // If you want Amazon S3 to replicate objects created with server-side encryption - // using AWS KMS-Managed Keys. SourceSelectionCriteria *SourceSelectionCriteria `type:"structure"` - // If status isn't enabled, the rule is ignored. + // Specifies whether the rule is enabled. // // Status is a required field Status *string `type:"string" required:"true" enum:"ReplicationRuleStatus"` @@ -22048,6 +22232,7 @@ func (s *RestoreRequest) SetType(v string) *RestoreRequest { return s } +// Specifies the redirect behavior and when a redirect is applied. type RoutingRule struct { _ struct{} `type:"structure"` @@ -22100,16 +22285,22 @@ func (s *RoutingRule) SetRedirect(v *Redirect) *RoutingRule { return s } +// Specifies lifecycle rules for an Amazon S3 bucket. For more information, +// see PUT Bucket lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html) +// in the Amazon Simple Storage Service API Reference. type Rule struct { _ struct{} `type:"structure"` - // Specifies the days since the initiation of an Incomplete Multipart Upload - // that Lifecycle will wait before permanently removing all parts of the upload. + // Specifies the days since the initiation of an incomplete multipart upload + // that Amazon S3 will wait before permanently removing all parts of the upload. + // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket + // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) + // in the Amazon Simple Storage Service Developer Guide. AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` Expiration *LifecycleExpiration `type:"structure"` - // Unique identifier for the rule. The value cannot be longer than 255 characters. + // Unique identifier for the rule. The value can't be longer than 255 characters. ID *string `type:"string"` // Specifies when noncurrent object versions expire. Upon expiration, Amazon @@ -22120,24 +22311,27 @@ type Rule struct { NoncurrentVersionExpiration *NoncurrentVersionExpiration `type:"structure"` // Container for the transition rule that describes when noncurrent objects - // transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING or GLACIER - // storage class. If your bucket is versioning-enabled (or versioning is suspended), - // you can set this action to request that Amazon S3 transition noncurrent object - // versions to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING or GLACIER storage - // class at a specific period in the object's lifetime. + // transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, + // or DEEP_ARCHIVE storage class. If your bucket is versioning-enabled (or versioning + // is suspended), you can set this action to request that Amazon S3 transition + // noncurrent object versions to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, + // GLACIER, or DEEP_ARCHIVE storage class at a specific period in the object's + // lifetime. NoncurrentVersionTransition *NoncurrentVersionTransition `type:"structure"` - // Prefix identifying one or more objects to which the rule applies. + // Object key prefix that identifies one or more objects to which this rule + // applies. // // Prefix is a required field Prefix *string `type:"string" required:"true"` - // If 'Enabled', the rule is currently being applied. If 'Disabled', the rule - // is not currently being applied. + // If Enabled, the rule is currently being applied. If Disabled, the rule is + // not currently being applied. // // Status is a required field Status *string `type:"string" required:"true" enum:"ExpirationStatus"` + // Specifies when an object transitions to a specified storage class. Transition *Transition `type:"structure"` } @@ -22496,7 +22690,7 @@ func (r *readSelectObjectContentEventStream) unmarshalerForEventType( // Amazon S3 uses this to parse object data into records. It returns only records // that match the specified SQL expression. You must also specify the data serialization // format for the response. For more information, see S3Select API Documentation -// (http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html). +// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html). type SelectObjectContentInput struct { _ struct{} `locationName:"SelectObjectContentRequest" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` @@ -22533,16 +22727,16 @@ type SelectObjectContentInput struct { // Specifies if periodic request progress information should be enabled. RequestProgress *RequestProgress `type:"structure"` - // The SSE Algorithm used to encrypt the object. For more information, see - // Server-Side Encryption (Using Customer-Provided Encryption Keys (http://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). + // The SSE Algorithm used to encrypt the object. For more information, see Server-Side + // Encryption (Using Customer-Provided Encryption Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - // The SSE Customer Key. For more information, see Server-Side Encryption (Using - // Customer-Provided Encryption Keys (http://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` + // The SSE Customer Key. For more information, see Server-Side Encryption (Using + // Customer-Provided Encryption Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). + SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` - // The SSE Customer Key MD5. For more information, see Server-Side Encryption - // (Using Customer-Provided Encryption Keys (http://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). + // The SSE Customer Key MD5. For more information, see Server-Side Encryption + // (Using Customer-Provided Encryption Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` } @@ -22788,13 +22982,15 @@ func (s *SelectParameters) SetOutputSerialization(v *OutputSerialization) *Selec } // Describes the default server-side encryption to apply to new objects in the -// bucket. If Put Object request does not specify any server-side encryption, -// this default encryption will be applied. +// bucket. If a PUT Object request doesn't specify any server-side encryption, +// this default encryption will be applied. For more information, see PUT Bucket +// encryption (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTencryption.html) +// in the Amazon Simple Storage Service API Reference. type ServerSideEncryptionByDefault struct { _ struct{} `type:"structure"` // KMS master key ID to use for the default encryption. This parameter is allowed - // if SSEAlgorithm is aws:kms. + // if and only if SSEAlgorithm is set to aws:kms. KMSMasterKeyID *string `type:"string" sensitive:"true"` // Server-side encryption algorithm to use for the default encryption. @@ -22838,8 +23034,7 @@ func (s *ServerSideEncryptionByDefault) SetSSEAlgorithm(v string) *ServerSideEnc return s } -// Container for server-side encryption configuration rules. Currently S3 supports -// one rule only. +// Specifies the default server-side-encryption configuration. type ServerSideEncryptionConfiguration struct { _ struct{} `type:"structure"` @@ -22889,13 +23084,12 @@ func (s *ServerSideEncryptionConfiguration) SetRules(v []*ServerSideEncryptionRu return s } -// Container for information about a particular server-side encryption configuration -// rule. +// Specifies the default server-side encryption configuration. type ServerSideEncryptionRule struct { _ struct{} `type:"structure"` - // Describes the default server-side encryption to apply to new objects in the - // bucket. If Put Object request does not specify any server-side encryption, + // Specifies the default server-side encryption to apply to new objects in the + // bucket. If a PUT Object request doesn't specify any server-side encryption, // this default encryption will be applied. ApplyServerSideEncryptionByDefault *ServerSideEncryptionByDefault `type:"structure"` } @@ -22931,13 +23125,17 @@ func (s *ServerSideEncryptionRule) SetApplyServerSideEncryptionByDefault(v *Serv return s } -// A container for filters that define which source objects should be replicated. +// A container that describes additional filters for identifying the source +// objects that you want to replicate. You can choose to enable or disable the +// replication of these objects. Currently, Amazon S3 supports only the filter +// that you can specify for objects created with server-side encryption using +// an AWS KMS-Managed Key (SSE-KMS). type SourceSelectionCriteria struct { _ struct{} `type:"structure"` - // A container for filter information for the selection of S3 objects encrypted - // with AWS KMS. If you include SourceSelectionCriteria in the replication configuration, - // this element is required. + // A container for filter information for the selection of Amazon S3 objects + // encrypted with AWS KMS. If you include SourceSelectionCriteria in the replication + // configuration, this element is required. SseKmsEncryptedObjects *SseKmsEncryptedObjects `type:"structure"` } @@ -22977,8 +23175,8 @@ func (s *SourceSelectionCriteria) SetSseKmsEncryptedObjects(v *SseKmsEncryptedOb type SseKmsEncryptedObjects struct { _ struct{} `type:"structure"` - // If the status is not Enabled, replication for S3 objects encrypted with AWS - // KMS is disabled. + // Specifies whether Amazon S3 replicates objects created with server-side encryption + // using an AWS KMS-managed key. // // Status is a required field Status *string `type:"string" required:"true" enum:"SseKmsEncryptedObjectsStatus"` @@ -23094,11 +23292,14 @@ func (s *StatsEvent) UnmarshalEvent( return nil } +// Specifies data related to access patterns to be collected and made available +// to analyze the tradeoffs between different storage classes for an Amazon +// S3 bucket. type StorageClassAnalysis struct { _ struct{} `type:"structure"` - // A container used to describe how data related to the storage class analysis - // should be exported. + // Specifies how data related to the storage class analysis for an Amazon S3 + // bucket should be exported. DataExport *StorageClassAnalysisDataExport `type:"structure"` } @@ -23338,16 +23539,20 @@ func (s *TargetGrant) SetPermission(v string) *TargetGrant { } // A container for specifying the configuration for publication of messages -// to an Amazon Simple Notification Service (Amazon SNS) topic.when Amazon S3 +// to an Amazon Simple Notification Service (Amazon SNS) topic when Amazon S3 // detects specified events. type TopicConfiguration struct { _ struct{} `type:"structure"` + // The Amazon S3 bucket event about which to send notifications. For more information, + // see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // in the Amazon Simple Storage Service Developer Guide. + // // Events is a required field Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - // A container for object key name filtering rules. For information about key - // name filtering, see Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // Specifies object key name filtering rules. For information about key name + // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. Filter *NotificationConfigurationFilter `type:"structure"` @@ -23356,7 +23561,7 @@ type TopicConfiguration struct { Id *string `type:"string"` // The Amazon Resource Name (ARN) of the Amazon SNS topic to which Amazon S3 - // will publish a message when it detects events of the specified type. + // publishes a message when it detects events of the specified type. // // TopicArn is a required field TopicArn *string `locationName:"Topic" type:"string" required:"true"` @@ -23465,18 +23670,19 @@ func (s *TopicConfigurationDeprecated) SetTopic(v string) *TopicConfigurationDep return s } +// Specifies when an object transitions to a specified storage class. type Transition struct { _ struct{} `type:"structure"` - // Indicates at what date the object is to be moved or deleted. Should be in - // GMT ISO 8601 Format. + // Indicates when objects are transitioned to the specified storage class. The + // date value must be in ISO 8601 format. The time is always midnight UTC. Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` - // Indicates the lifetime, in days, of the objects that are subject to the rule. - // The value must be a non-zero positive integer. + // Indicates the number of days after creation when objects are transitioned + // to the specified storage class. The value must be a positive integer. Days *int64 `type:"integer"` - // The class of storage used to store the object. + // The storage class to which you want the object to transition. StorageClass *string `type:"string" enum:"TransitionStorageClass"` } @@ -23537,7 +23743,7 @@ type UploadPartCopyInput struct { // the form bytes=first-last, where the first and last are the zero-based byte // offsets to copy. For example, bytes=0-9 indicates that you want to copy the // first ten bytes of the source. You can copy a range only if the source object - // is greater than 5 GB. + // is greater than 5 MB. CopySourceRange *string `location:"header" locationName:"x-amz-copy-source-range" type:"string"` // Specifies the algorithm to use when decrypting the source object (e.g., AES256). @@ -23546,7 +23752,7 @@ type UploadPartCopyInput struct { // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt // the source object. The encryption key provided in this header must be one // that was used when the source object was created. - CopySourceSSECustomerKey *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string" sensitive:"true"` + CopySourceSSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption @@ -23577,7 +23783,7 @@ type UploadPartCopyInput struct { // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm // header. This must be the same encryption key specified in the initiate multipart // upload request. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` + SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption @@ -23853,7 +24059,9 @@ type UploadPartInput struct { // body cannot be determined automatically. ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - // The base64-encoded 128-bit MD5 digest of the part data. + // The base64-encoded 128-bit MD5 digest of the part data. This parameter is + // auto-populated when using the command from the CLI. This parameted is required + // if object lock parameters are specified. ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` // Object key for which the multipart upload was initiated. @@ -23882,7 +24090,7 @@ type UploadPartInput struct { // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm // header. This must be the same encryption key specified in the initiate multipart // upload request. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` + SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption @@ -24088,6 +24296,9 @@ func (s *UploadPartOutput) SetServerSideEncryption(v string) *UploadPartOutput { return s } +// Describes the versioning state of an Amazon S3 bucket. For more information, +// see PUT Bucket versioning (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTVersioningStatus.html) +// in the Amazon Simple Storage Service API Reference. type VersioningConfiguration struct { _ struct{} `type:"structure"` @@ -24122,15 +24333,22 @@ func (s *VersioningConfiguration) SetStatus(v string) *VersioningConfiguration { return s } +// Specifies website configuration parameters for an Amazon S3 bucket. type WebsiteConfiguration struct { _ struct{} `type:"structure"` + // The name of the error document for the website. ErrorDocument *ErrorDocument `type:"structure"` + // The name of the index document for the website. IndexDocument *IndexDocument `type:"structure"` + // The redirect behavior for every request to this bucket's website endpoint. + // + // If you specify this property, you can't specify any other property. RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` + // Rules that define when a redirect is applied and the redirect behavior. RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` } @@ -24543,6 +24761,9 @@ const ( // ObjectStorageClassIntelligentTiering is a ObjectStorageClass enum value ObjectStorageClassIntelligentTiering = "INTELLIGENT_TIERING" + + // ObjectStorageClassDeepArchive is a ObjectStorageClass enum value + ObjectStorageClassDeepArchive = "DEEP_ARCHIVE" ) const ( @@ -24673,6 +24894,9 @@ const ( // StorageClassGlacier is a StorageClass enum value StorageClassGlacier = "GLACIER" + + // StorageClassDeepArchive is a StorageClass enum value + StorageClassDeepArchive = "DEEP_ARCHIVE" ) const ( @@ -24711,6 +24935,9 @@ const ( // TransitionStorageClassIntelligentTiering is a TransitionStorageClass enum value TransitionStorageClassIntelligentTiering = "INTELLIGENT_TIERING" + + // TransitionStorageClassDeepArchive is a TransitionStorageClass enum value + TransitionStorageClassDeepArchive = "DEEP_ARCHIVE" ) const ( diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go b/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go index bc68a46ac..9ba8a7887 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go @@ -80,7 +80,8 @@ func buildGetBucketLocation(r *request.Request) { out := r.Data.(*GetBucketLocationOutput) b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { - r.Error = awserr.New("SerializationError", "failed reading response body", err) + r.Error = awserr.New(request.ErrCodeSerialization, + "failed reading response body", err) return } diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go index 95f245636..23d386b16 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go @@ -17,7 +17,8 @@ func defaultInitClientFn(c *client.Client) { // Require SSL when using SSE keys c.Handlers.Validate.PushBack(validateSSERequiresSSL) - c.Handlers.Build.PushBack(computeSSEKeys) + c.Handlers.Build.PushBack(computeSSEKeyMD5) + c.Handlers.Build.PushBack(computeCopySourceSSEKeyMD5) // S3 uses custom error unmarshaling logic c.Handlers.UnmarshalError.Clear() diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go b/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go index 39b912c26..4b65f7153 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go @@ -63,6 +63,20 @@ // See the s3manager package's Downloader type documentation for more information. // https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Downloader // +// Automatic URI cleaning +// +// Interacting with objects whose keys contain adjacent slashes (e.g. bucketname/foo//bar/objectname) +// requires setting DisableRestProtocolURICleaning to true in the aws.Config struct +// used by the service client. +// +// svc := s3.New(sess, &aws.Config{ +// DisableRestProtocolURICleaning: aws.Bool(true), +// }) +// out, err := svc.GetObject(&s3.GetObjectInput { +// Bucket: aws.String("bucketname"), +// Key: aws.String("//foo//bar//moo"), +// }) +// // Get Bucket Region // // GetBucketRegion will attempt to get the region for a bucket using a region diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/batch.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/batch.go index 18215574b..22bd0b7ce 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/batch.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/batch.go @@ -273,7 +273,7 @@ type DeleteObjectsIterator struct { inc bool } -// Next will increment the default iterator's index and and ensure that there +// Next will increment the default iterator's index and ensure that there // is another object to iterator to. func (iter *DeleteObjectsIterator) Next() bool { if iter.inc { @@ -458,7 +458,7 @@ type DownloadObjectsIterator struct { inc bool } -// Next will increment the default iterator's index and and ensure that there +// Next will increment the default iterator's index and ensure that there // is another object to iterator to. func (batcher *DownloadObjectsIterator) Next() bool { if batcher.inc { @@ -497,7 +497,7 @@ type UploadObjectsIterator struct { inc bool } -// Next will increment the default iterator's index and and ensure that there +// Next will increment the default iterator's index and ensure that there // is another object to iterator to. func (batcher *UploadObjectsIterator) Next() bool { if batcher.inc { diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go index 4a9ad65e4..498f0b2b0 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go @@ -126,7 +126,8 @@ type maxRetrier interface { } // Download downloads an object in S3 and writes the payload into w using -// concurrent GET requests. +// concurrent GET requests. The n int64 returned is the size of the object downloaded +// in bytes. // // Additional functional options can be provided to configure the individual // download. These options are copies of the Downloader instance Download is called from. @@ -148,7 +149,8 @@ func (d Downloader) Download(w io.WriterAt, input *s3.GetObjectInput, options .. } // DownloadWithContext downloads an object in S3 and writes the payload into w -// using concurrent GET requests. +// using concurrent GET requests. The n int64 returned is the size of the object downloaded +// in bytes. // // DownloadWithContext is the same as Download with the additional support for // Context input parameters. The Context must not be nil. A nil Context will diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go index a9a005f0a..2cebf6180 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3iface" @@ -144,8 +145,13 @@ type Uploader struct { // MaxUploadParts is the max number of parts which will be uploaded to S3. // Will be used to calculate the partsize of the object to be uploaded. // E.g: 5GB file, with MaxUploadParts set to 100, will upload the file - // as 100, 50MB parts. - // With a limited of s3.MaxUploadParts (10,000 parts). + // as 100, 50MB parts. With a limited of s3.MaxUploadParts (10,000 parts). + // + // MaxUploadParts must not be used to limit the total number of bytes uploaded. + // Use a type like to io.LimitReader (https://golang.org/pkg/io/#LimitedReader) + // instead. An io.LimitReader is helpful when uploading an unbounded reader + // to S3, and you know its maximum size. Otherwise the reader's io.EOF returned + // error must be used to signal end of stream. // // Defaults to package const's MaxUploadParts value. MaxUploadParts int @@ -357,7 +363,9 @@ type uploader struct { // internal logic for deciding whether to upload a single part or use a // multipart upload. func (u *uploader) upload() (*UploadOutput, error) { - u.init() + if err := u.init(); err != nil { + return nil, awserr.New("ReadRequestBody", "unable to initialize upload", err) + } if u.cfg.PartSize < MinUploadPartSize { msg := fmt.Sprintf("part size must be at least %d bytes", MinUploadPartSize) @@ -377,7 +385,7 @@ func (u *uploader) upload() (*UploadOutput, error) { } // init will initialize all default options. -func (u *uploader) init() { +func (u *uploader) init() error { if u.cfg.Concurrency == 0 { u.cfg.Concurrency = DefaultUploadConcurrency } @@ -393,19 +401,19 @@ func (u *uploader) init() { } // Try to get the total size for some optimizations - u.initSize() + return u.initSize() } // initSize tries to detect the total stream size, setting u.totalSize. If // the size is not known, totalSize is set to -1. -func (u *uploader) initSize() { +func (u *uploader) initSize() error { u.totalSize = -1 switch r := u.in.Body.(type) { case io.Seeker: n, err := aws.SeekerLen(r) if err != nil { - return + return err } u.totalSize = n @@ -417,6 +425,8 @@ func (u *uploader) initSize() { u.cfg.PartSize = (u.totalSize / int64(u.cfg.MaxUploadParts)) + 1 } } + + return nil } // nextReader returns a seekable reader representing the next packet of data. @@ -541,21 +551,6 @@ func (u *multiuploader) upload(firstBuf io.ReadSeeker, firstPart []byte) (*Uploa // Read and queue the rest of the parts for u.geterr() == nil && err == nil { - num++ - // This upload exceeded maximum number of supported parts, error now. - if num > int64(u.cfg.MaxUploadParts) || num > int64(MaxUploadParts) { - var msg string - if num > int64(u.cfg.MaxUploadParts) { - msg = fmt.Sprintf("exceeded total allowed configured MaxUploadParts (%d). Adjust PartSize to fit in this limit", - u.cfg.MaxUploadParts) - } else { - msg = fmt.Sprintf("exceeded total allowed S3 limit MaxUploadParts (%d). Adjust PartSize to fit in this limit", - MaxUploadParts) - } - u.seterr(awserr.New("TotalPartsExceeded", msg, nil)) - break - } - var reader io.ReadSeeker var nextChunkLen int var part []byte @@ -576,6 +571,21 @@ func (u *multiuploader) upload(firstBuf io.ReadSeeker, firstPart []byte) (*Uploa break } + num++ + // This upload exceeded maximum number of supported parts, error now. + if num > int64(u.cfg.MaxUploadParts) || num > int64(MaxUploadParts) { + var msg string + if num > int64(u.cfg.MaxUploadParts) { + msg = fmt.Sprintf("exceeded total allowed configured MaxUploadParts (%d). Adjust PartSize to fit in this limit", + u.cfg.MaxUploadParts) + } else { + msg = fmt.Sprintf("exceeded total allowed S3 limit MaxUploadParts (%d). Adjust PartSize to fit in this limit", + MaxUploadParts) + } + u.seterr(awserr.New("TotalPartsExceeded", msg, nil)) + break + } + ch <- chunk{buf: reader, part: part, num: num} } @@ -593,8 +603,18 @@ func (u *multiuploader) upload(firstBuf io.ReadSeeker, firstPart []byte) (*Uploa uploadID: u.uploadID, } } + + // Create a presigned URL of the S3 Get Object in order to have parity with + // single part upload. + getReq, _ := u.cfg.S3.GetObjectRequest(&s3.GetObjectInput{ + Bucket: u.in.Bucket, + Key: u.in.Key, + }) + getReq.Config.Credentials = credentials.AnonymousCredentials + uploadLocation, _, _ := getReq.PresignRequest(1) + return &UploadOutput{ - Location: aws.StringValue(complete.Location), + Location: uploadLocation, VersionID: complete.VersionId, UploadID: u.uploadID, }, nil diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload_input.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload_input.go index ebf48204c..221c37f6e 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload_input.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload_input.go @@ -39,7 +39,9 @@ type UploadInput struct { // The language the content is in. ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - // The base64-encoded 128-bit MD5 digest of the part data. + // The base64-encoded 128-bit MD5 digest of the part data. This parameter is + // auto-populated when using the command from the CLI. This parameted is required + // if object lock parameters are specified. ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` // A standard MIME type describing the format of the object data. @@ -71,10 +73,10 @@ type UploadInput struct { // The Legal Hold status that you want to apply to the specified object. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // The Object Lock mode that you want to apply to this object. + // The object lock mode that you want to apply to this object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // The date and time when you want this object's Object Lock to expire. + // The date and time when you want this object's object lock to expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // Confirms that the requester knows that she or he will be charged for the @@ -91,13 +93,18 @@ type UploadInput struct { // does not store the encryption key. The key must be appropriate for use with // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` + SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure the encryption // key was transmitted without error. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + // Specifies the AWS KMS Encryption Context to use for object encryption. The + // value of this header is a base64-encoded UTF-8 string holding JSON with the + // encryption context key-value pairs. + SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` + // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT // requests for an object protected by AWS KMS will fail if not made via SSL // or using SigV4. Documentation on configuring any of the officially supported diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/sse.go b/vendor/github.com/aws/aws-sdk-go/service/s3/sse.go index 8010c4fa1..b71c835de 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/sse.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/sse.go @@ -3,6 +3,7 @@ package s3 import ( "crypto/md5" "encoding/base64" + "net/http" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" @@ -30,25 +31,54 @@ func validateSSERequiresSSL(r *request.Request) { } } -func computeSSEKeys(r *request.Request) { - headers := []string{ - "x-amz-server-side-encryption-customer-key", - "x-amz-copy-source-server-side-encryption-customer-key", +const ( + sseKeyHeader = "x-amz-server-side-encryption-customer-key" + sseKeyMD5Header = sseKeyHeader + "-md5" +) + +func computeSSEKeyMD5(r *request.Request) { + var key string + if g, ok := r.Params.(sseCustomerKeyGetter); ok { + key = g.getSSECustomerKey() } - for _, h := range headers { - md5h := h + "-md5" - if key := r.HTTPRequest.Header.Get(h); key != "" { - // Base64-encode the value - b64v := base64.StdEncoding.EncodeToString([]byte(key)) - r.HTTPRequest.Header.Set(h, b64v) + computeKeyMD5(sseKeyHeader, sseKeyMD5Header, key, r.HTTPRequest) +} - // Add MD5 if it wasn't computed - if r.HTTPRequest.Header.Get(md5h) == "" { - sum := md5.Sum([]byte(key)) - b64sum := base64.StdEncoding.EncodeToString(sum[:]) - r.HTTPRequest.Header.Set(md5h, b64sum) - } +const ( + copySrcSSEKeyHeader = "x-amz-copy-source-server-side-encryption-customer-key" + copySrcSSEKeyMD5Header = copySrcSSEKeyHeader + "-md5" +) + +func computeCopySourceSSEKeyMD5(r *request.Request) { + var key string + if g, ok := r.Params.(copySourceSSECustomerKeyGetter); ok { + key = g.getCopySourceSSECustomerKey() + } + + computeKeyMD5(copySrcSSEKeyHeader, copySrcSSEKeyMD5Header, key, r.HTTPRequest) +} + +func computeKeyMD5(keyHeader, keyMD5Header, key string, r *http.Request) { + if len(key) == 0 { + // Backwards compatiablity where user just set the header value instead + // of using the API parameter, or setting the header value for an + // operation without the parameters modeled. + key = r.Header.Get(keyHeader) + if len(key) == 0 { + return } + + // In backwards compatiable, the header's value is not base64 encoded, + // and needs to be encoded and updated by the SDK's customizations. + b64Key := base64.StdEncoding.EncodeToString([]byte(key)) + r.Header.Set(keyHeader, b64Key) + } + + // Only update Key's MD5 if not already set. + if len(r.Header.Get(keyMD5Header)) == 0 { + sum := md5.Sum([]byte(key)) + keyMD5 := base64.StdEncoding.EncodeToString(sum[:]) + r.Header.Set(keyMD5Header, keyMD5) } } diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go b/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go index fde3050f9..f6a69aed1 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go @@ -14,7 +14,7 @@ func copyMultipartStatusOKUnmarhsalError(r *request.Request) { b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", "unable to read response body", err), + awserr.New(request.ErrCodeSerialization, "unable to read response body", err), r.HTTPResponse.StatusCode, r.RequestID, ) @@ -31,7 +31,7 @@ func copyMultipartStatusOKUnmarhsalError(r *request.Request) { unmarshalError(r) if err, ok := r.Error.(awserr.Error); ok && err != nil { - if err.Code() == "SerializationError" { + if err.Code() == request.ErrCodeSerialization { r.Error = nil return } diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go index 12c0612c8..5b63fac72 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" ) type xmlErrorResponse struct { @@ -26,40 +27,50 @@ func unmarshalError(r *request.Request) { // Bucket exists in a different region, and request needs // to be made to the correct region. if r.HTTPResponse.StatusCode == http.StatusMovedPermanently { + msg := fmt.Sprintf( + "incorrect region, the bucket is not in '%s' region at endpoint '%s'", + aws.StringValue(r.Config.Region), + aws.StringValue(r.Config.Endpoint), + ) + if v := r.HTTPResponse.Header.Get("x-amz-bucket-region"); len(v) != 0 { + msg += fmt.Sprintf(", bucket is in '%s' region", v) + } r.Error = awserr.NewRequestFailure( - awserr.New("BucketRegionError", - fmt.Sprintf("incorrect region, the bucket is not in '%s' region", - aws.StringValue(r.Config.Region)), - nil), + awserr.New("BucketRegionError", msg, nil), r.HTTPResponse.StatusCode, r.RequestID, ) return } - var errCode, errMsg string - // Attempt to parse error from body if it is known - resp := &xmlErrorResponse{} - err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) - if err != nil && err != io.EOF { - errCode = "SerializationError" - errMsg = "failed to decode S3 XML error response" - } else { - errCode = resp.Code - errMsg = resp.Message + var errResp xmlErrorResponse + err := xmlutil.UnmarshalXMLError(&errResp, r.HTTPResponse.Body) + if err == io.EOF { + // Only capture the error if an unmarshal error occurs that is not EOF, + // because S3 might send an error without a error message which causes + // the XML unmarshal to fail with EOF. err = nil } + if err != nil { + r.Error = awserr.NewRequestFailure( + awserr.New(request.ErrCodeSerialization, + "failed to unmarshal error message", err), + r.HTTPResponse.StatusCode, + r.RequestID, + ) + return + } // Fallback to status code converted to message if still no error code - if len(errCode) == 0 { + if len(errResp.Code) == 0 { statusText := http.StatusText(r.HTTPResponse.StatusCode) - errCode = strings.Replace(statusText, " ", "", -1) - errMsg = statusText + errResp.Code = strings.Replace(statusText, " ", "", -1) + errResp.Message = statusText } r.Error = awserr.NewRequestFailure( - awserr.New(errCode, errMsg, err), + awserr.New(errResp.Code, errResp.Message, err), r.HTTPResponse.StatusCode, r.RequestID, ) diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go index ee908f916..eb0a6a417 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go @@ -3,10 +3,12 @@ package sts import ( + "fmt" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" ) @@ -54,38 +56,26 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // AssumeRole API operation for AWS Security Token Service. // -// Returns a set of temporary security credentials (consisting of an access -// key ID, a secret access key, and a security token) that you can use to access -// AWS resources that you might not normally have access to. Typically, you -// use AssumeRole for cross-account access or federation. For a comparison of -// AssumeRole with the other APIs that produce temporary credentials, see Requesting -// Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// Returns a set of temporary security credentials that you can use to access +// AWS resources that you might not normally have access to. These temporary +// credentials consist of an access key ID, a secret access key, and a security +// token. Typically, you use AssumeRole within your account or for cross-account +// access. For a comparison of AssumeRole with other API operations that produce +// temporary credentials, see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) // in the IAM User Guide. // -// Important: You cannot call AssumeRole by using AWS root account credentials; -// access is denied. You must use credentials for an IAM user or an IAM role -// to call AssumeRole. +// You cannot use AWS account root user credentials to call AssumeRole. You +// must use credentials for an IAM user or an IAM role to call AssumeRole. // // For cross-account access, imagine that you own multiple accounts and need // to access resources in each account. You could create long-term credentials // in each account to access those resources. However, managing all those credentials // and remembering which one can access which account can be time consuming. -// Instead, you can create one set of long-term credentials in one account and -// then use temporary security credentials to access all the other accounts +// Instead, you can create one set of long-term credentials in one account. +// Then use temporary security credentials to access all the other accounts // by assuming roles in those accounts. For more information about roles, see -// IAM Roles (Delegation and Federation) (http://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html) -// in the IAM User Guide. -// -// For federation, you can, for example, grant single sign-on access to the -// AWS Management Console. If you already have an identity and authentication -// system in your corporate network, you don't have to recreate user identities -// in AWS in order to grant those user identities access to AWS. Instead, after -// a user has been authenticated, you call AssumeRole (and specify the role -// with the appropriate permissions) to get temporary security credentials for -// that user. With those temporary security credentials, you construct a sign-in -// URL that users can use to access the console. For more information, see Common -// Scenarios for Temporary Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html#sts-introduction) +// IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) // in the IAM User Guide. // // By default, the temporary security credentials created by AssumeRole last @@ -94,69 +84,73 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // seconds (15 minutes) up to the maximum session duration setting for the role. // This setting can have a value from 1 hour to 12 hours. To learn how to view // the maximum value for your role, see View the Maximum Session Duration Setting -// for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) +// for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. The maximum session duration limit applies when you -// use the AssumeRole* API operations or the assume-role* CLI operations but -// does not apply when you use those operations to create a console URL. For -// more information, see Using IAM Roles (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) +// use the AssumeRole* API operations or the assume-role* CLI commands. However +// the limit does not apply when you use those operations to create a console +// URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) // in the IAM User Guide. // // The temporary security credentials created by AssumeRole can be used to make -// API calls to any AWS service with the following exception: you cannot call -// the STS service's GetFederationToken or GetSessionToken APIs. +// API calls to any AWS service with the following exception: You cannot call +// the AWS STS GetFederationToken or GetSessionToken API operations. // -// Optionally, you can pass an IAM access policy to this operation. If you choose -// not to pass a policy, the temporary security credentials that are returned -// by the operation have the permissions that are defined in the access policy -// of the role that is being assumed. If you pass a policy to this operation, -// the temporary security credentials that are returned by the operation have -// the permissions that are allowed by both the access policy of the role that -// is being assumed, and the policy that you pass. This gives you a way to further -// restrict the permissions for the resulting temporary security credentials. -// You cannot use the passed policy to grant permissions that are in excess -// of those allowed by the access policy of the role that is being assumed. -// For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, -// and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) +// (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// to this operation. You can pass a single JSON policy document to use as an +// inline session policy. You can also specify up to 10 managed policies to +// use as managed session policies. The plain text that you use for both inline +// and managed session policies shouldn't exceed 2048 characters. Passing policies +// to this operation returns new temporary credentials. The resulting session's +// permissions are the intersection of the role's identity-based policy and +// the session policies. You can use the role's temporary credentials in subsequent +// AWS API calls to access resources in the account that owns the role. You +// cannot use session policies to grant more permissions than those allowed +// by the identity-based policy of the role that is being assumed. For more +// information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // in the IAM User Guide. // -// To assume a role, your AWS account must be trusted by the role. The trust -// relationship is defined in the role's trust policy when the role is created. -// That trust policy states which accounts are allowed to delegate access to -// this account's role. +// To assume a role from a different account, your AWS account must be trusted +// by the role. The trust relationship is defined in the role's trust policy +// when the role is created. That trust policy states which accounts are allowed +// to delegate that access to users in the account. // -// The user who wants to access the role must also have permissions delegated -// from the role's administrator. If the user is in a different account than -// the role, then the user's administrator must attach a policy that allows -// the user to call AssumeRole on the ARN of the role in the other account. -// If the user is in the same account as the role, then you can either attach -// a policy to the user (identical to the previous different account user), -// or you can add the user as a principal directly in the role's trust policy. -// In this case, the trust policy acts as the only resource-based policy in -// IAM, and users in the same account as the role do not need explicit permission -// to assume the role. For more information about trust policies and resource-based -// policies, see IAM Policies (http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) +// A user who wants to access a role in a different account must also have permissions +// that are delegated from the user account administrator. The administrator +// must attach a policy that allows the user to call AssumeRole for the ARN +// of the role in the other account. If the user is in the same account as the +// role, then you can do either of the following: +// +// * Attach a policy to the user (identical to the previous user in a different +// account). +// +// * Add the user as a principal directly in the role's trust policy. +// +// In this case, the trust policy acts as an IAM resource-based policy. Users +// in the same account as the role do not need explicit permission to assume +// the role. For more information about trust policies and resource-based policies, +// see IAM Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) // in the IAM User Guide. // // Using MFA with AssumeRole // -// You can optionally include multi-factor authentication (MFA) information -// when you call AssumeRole. This is useful for cross-account scenarios in which -// you want to make sure that the user who is assuming the role has been authenticated -// using an AWS MFA device. In that scenario, the trust policy of the role being -// assumed includes a condition that tests for MFA authentication; if the caller -// does not include valid MFA information, the request to assume the role is -// denied. The condition in a trust policy that tests for MFA authentication -// might look like the following example. +// (Optional) You can include multi-factor authentication (MFA) information +// when you call AssumeRole. This is useful for cross-account scenarios to ensure +// that the user that assumes the role has been authenticated with an AWS MFA +// device. In that scenario, the trust policy of the role being assumed includes +// a condition that tests for MFA authentication. If the caller does not include +// valid MFA information, the request to assume the role is denied. The condition +// in a trust policy that tests for MFA authentication might look like the following +// example. // // "Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}} // -// For more information, see Configuring MFA-Protected API Access (http://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html) +// For more information, see Configuring MFA-Protected API Access (https://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html) // in the IAM User Guide guide. // // To use MFA with AssumeRole, you pass values for the SerialNumber and TokenCode // parameters. The SerialNumber value identifies the user's hardware or virtual // MFA device. The TokenCode is the time-based one-time password (TOTP) that -// the MFA devices produces. +// the MFA device produces. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -179,7 +173,7 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // STS is not activated in the requested region for the account that is being // asked to generate credentials. The account administrator must use the IAM // console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) +// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) // in the IAM User Guide. // // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRole @@ -243,6 +237,7 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re output = &AssumeRoleWithSAMLOutput{} req = c.newRequest(op, input, output) + req.Config.Credentials = credentials.AnonymousCredentials return } @@ -252,9 +247,9 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // via a SAML authentication response. This operation provides a mechanism for // tying an enterprise identity store or directory to role-based AWS access // without user-specific credentials or configuration. For a comparison of AssumeRoleWithSAML -// with the other APIs that produce temporary credentials, see Requesting Temporary -// Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// with the other API operations that produce temporary credentials, see Requesting +// Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) // in the IAM User Guide. // // The temporary security credentials returned by this operation consist of @@ -269,37 +264,36 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // a DurationSeconds value from 900 seconds (15 minutes) up to the maximum session // duration setting for the role. This setting can have a value from 1 hour // to 12 hours. To learn how to view the maximum value for your role, see View -// the Maximum Session Duration Setting for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) +// the Maximum Session Duration Setting for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. The maximum session duration limit applies when you -// use the AssumeRole* API operations or the assume-role* CLI operations but -// does not apply when you use those operations to create a console URL. For -// more information, see Using IAM Roles (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) +// use the AssumeRole* API operations or the assume-role* CLI commands. However +// the limit does not apply when you use those operations to create a console +// URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) // in the IAM User Guide. // // The temporary security credentials created by AssumeRoleWithSAML can be used // to make API calls to any AWS service with the following exception: you cannot -// call the STS service's GetFederationToken or GetSessionToken APIs. +// call the STS GetFederationToken or GetSessionToken API operations. // -// Optionally, you can pass an IAM access policy to this operation. If you choose -// not to pass a policy, the temporary security credentials that are returned -// by the operation have the permissions that are defined in the access policy -// of the role that is being assumed. If you pass a policy to this operation, -// the temporary security credentials that are returned by the operation have -// the permissions that are allowed by the intersection of both the access policy -// of the role that is being assumed, and the policy that you pass. This means -// that both policies must grant the permission for the action to be allowed. -// This gives you a way to further restrict the permissions for the resulting -// temporary security credentials. You cannot use the passed policy to grant -// permissions that are in excess of those allowed by the access policy of the -// role that is being assumed. For more information, see Permissions for AssumeRole, -// AssumeRoleWithSAML, and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) +// (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// to this operation. You can pass a single JSON policy document to use as an +// inline session policy. You can also specify up to 10 managed policies to +// use as managed session policies. The plain text that you use for both inline +// and managed session policies shouldn't exceed 2048 characters. Passing policies +// to this operation returns new temporary credentials. The resulting session's +// permissions are the intersection of the role's identity-based policy and +// the session policies. You can use the role's temporary credentials in subsequent +// AWS API calls to access resources in the account that owns the role. You +// cannot use session policies to grant more permissions than those allowed +// by the identity-based policy of the role that is being assumed. For more +// information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // in the IAM User Guide. // // Before your application can call AssumeRoleWithSAML, you must configure your // SAML identity provider (IdP) to issue the claims required by AWS. Additionally, // you must use AWS Identity and Access Management (IAM) to create a SAML provider -// entity in your AWS account that represents your identity provider, and create -// an IAM role that specifies this SAML provider in its trust policy. +// entity in your AWS account that represents your identity provider. You must +// also create an IAM role that specifies this SAML provider in its trust policy. // // Calling AssumeRoleWithSAML does not require the use of AWS security credentials. // The identity of the caller is validated by using keys in the metadata document @@ -313,16 +307,16 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // // For more information, see the following resources: // -// * About SAML 2.0-based Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) +// * About SAML 2.0-based Federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) // in the IAM User Guide. // -// * Creating SAML Identity Providers (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html) +// * Creating SAML Identity Providers (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html) // in the IAM User Guide. // -// * Configuring a Relying Party and Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html) +// * Configuring a Relying Party and Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html) // in the IAM User Guide. // -// * Creating a Role for SAML 2.0 Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html) +// * Creating a Role for SAML 2.0 Federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html) // in the IAM User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -361,7 +355,7 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // STS is not activated in the requested region for the account that is being // asked to generate credentials. The account administrator must use the IAM // console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) +// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) // in the IAM User Guide. // // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAML @@ -425,41 +419,42 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI output = &AssumeRoleWithWebIdentityOutput{} req = c.newRequest(op, input, output) + req.Config.Credentials = credentials.AnonymousCredentials return } // AssumeRoleWithWebIdentity API operation for AWS Security Token Service. // // Returns a set of temporary security credentials for users who have been authenticated -// in a mobile or web application with a web identity provider, such as Amazon -// Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible -// identity provider. +// in a mobile or web application with a web identity provider. Example providers +// include Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID +// Connect-compatible identity provider. // // For mobile applications, we recommend that you use Amazon Cognito. You can -// use Amazon Cognito with the AWS SDK for iOS (http://aws.amazon.com/sdkforios/) -// and the AWS SDK for Android (http://aws.amazon.com/sdkforandroid/) to uniquely -// identify a user and supply the user with a consistent identity throughout -// the lifetime of an application. +// use Amazon Cognito with the AWS SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/) +// and the AWS SDK for Android Developer Guide (http://aws.amazon.com/sdkforandroid/) +// to uniquely identify a user. You can also supply the user with a consistent +// identity throughout the lifetime of an application. // -// To learn more about Amazon Cognito, see Amazon Cognito Overview (http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840) -// in the AWS SDK for Android Developer Guide guide and Amazon Cognito Overview -// (http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664) +// To learn more about Amazon Cognito, see Amazon Cognito Overview (https://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840) +// in AWS SDK for Android Developer Guide and Amazon Cognito Overview (https://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664) // in the AWS SDK for iOS Developer Guide. // // Calling AssumeRoleWithWebIdentity does not require the use of AWS security // credentials. Therefore, you can distribute an application (for example, on // mobile devices) that requests temporary security credentials without including -// long-term AWS credentials in the application, and without deploying server-based -// proxy services that use long-term AWS credentials. Instead, the identity -// of the caller is validated by using a token from the web identity provider. -// For a comparison of AssumeRoleWithWebIdentity with the other APIs that produce -// temporary credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// long-term AWS credentials in the application. You also don't need to deploy +// server-based proxy services that use long-term AWS credentials. Instead, +// the identity of the caller is validated by using a token from the web identity +// provider. For a comparison of AssumeRoleWithWebIdentity with the other API +// operations that produce temporary credentials, see Requesting Temporary Security +// Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) // in the IAM User Guide. // // The temporary security credentials returned by this API consist of an access // key ID, a secret access key, and a security token. Applications can use these -// temporary security credentials to sign calls to AWS service APIs. +// temporary security credentials to sign calls to AWS service API operations. // // By default, the temporary security credentials created by AssumeRoleWithWebIdentity // last for one hour. However, you can use the optional DurationSeconds parameter @@ -467,29 +462,29 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // seconds (15 minutes) up to the maximum session duration setting for the role. // This setting can have a value from 1 hour to 12 hours. To learn how to view // the maximum value for your role, see View the Maximum Session Duration Setting -// for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) +// for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. The maximum session duration limit applies when you -// use the AssumeRole* API operations or the assume-role* CLI operations but -// does not apply when you use those operations to create a console URL. For -// more information, see Using IAM Roles (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) +// use the AssumeRole* API operations or the assume-role* CLI commands. However +// the limit does not apply when you use those operations to create a console +// URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) // in the IAM User Guide. // // The temporary security credentials created by AssumeRoleWithWebIdentity can // be used to make API calls to any AWS service with the following exception: -// you cannot call the STS service's GetFederationToken or GetSessionToken APIs. +// you cannot call the STS GetFederationToken or GetSessionToken API operations. // -// Optionally, you can pass an IAM access policy to this operation. If you choose -// not to pass a policy, the temporary security credentials that are returned -// by the operation have the permissions that are defined in the access policy -// of the role that is being assumed. If you pass a policy to this operation, -// the temporary security credentials that are returned by the operation have -// the permissions that are allowed by both the access policy of the role that -// is being assumed, and the policy that you pass. This gives you a way to further -// restrict the permissions for the resulting temporary security credentials. -// You cannot use the passed policy to grant permissions that are in excess -// of those allowed by the access policy of the role that is being assumed. -// For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, -// and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) +// (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// to this operation. You can pass a single JSON policy document to use as an +// inline session policy. You can also specify up to 10 managed policies to +// use as managed session policies. The plain text that you use for both inline +// and managed session policies shouldn't exceed 2048 characters. Passing policies +// to this operation returns new temporary credentials. The resulting session's +// permissions are the intersection of the role's identity-based policy and +// the session policies. You can use the role's temporary credentials in subsequent +// AWS API calls to access resources in the account that owns the role. You +// cannot use session policies to grant more permissions than those allowed +// by the identity-based policy of the role that is being assumed. For more +// information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // in the IAM User Guide. // // Before your application can call AssumeRoleWithWebIdentity, you must have @@ -508,21 +503,19 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // For more information about how to use web identity federation and the AssumeRoleWithWebIdentity // API, see the following resources: // -// * Using Web Identity Federation APIs for Mobile Apps (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html) -// and Federation Through a Web-based Identity Provider (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). +// * Using Web Identity Federation API Operations for Mobile Apps (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html) +// and Federation Through a Web-based Identity Provider (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). // +// * Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html). +// Walk through the process of authenticating through Login with Amazon, +// Facebook, or Google, getting temporary security credentials, and then +// using those credentials to make a request to AWS. // -// * Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html). -// This interactive website lets you walk through the process of authenticating -// via Login with Amazon, Facebook, or Google, getting temporary security -// credentials, and then using those credentials to make a request to AWS. -// -// -// * AWS SDK for iOS (http://aws.amazon.com/sdkforios/) and AWS SDK for Android -// (http://aws.amazon.com/sdkforandroid/). These toolkits contain sample -// apps that show how to invoke the identity providers, and then how to use -// the information from these providers to get and use temporary security -// credentials. +// * AWS SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/) and +// AWS SDK for Android Developer Guide (http://aws.amazon.com/sdkforandroid/). +// These toolkits contain sample apps that show how to invoke the identity +// providers, and then how to use the information from these providers to +// get and use temporary security credentials. // // * Web Identity Federation with Mobile Applications (http://aws.amazon.com/articles/web-identity-federation-with-mobile-applications). // This article discusses web identity federation and shows an example of @@ -572,7 +565,7 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // STS is not activated in the requested region for the account that is being // asked to generate credentials. The account administrator must use the IAM // console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) +// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) // in the IAM User Guide. // // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentity @@ -644,17 +637,17 @@ func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessag // Decodes additional information about the authorization status of a request // from an encoded message returned in response to an AWS request. // -// For example, if a user is not authorized to perform an action that he or -// she has requested, the request returns a Client.UnauthorizedOperation response -// (an HTTP 403 response). Some AWS actions additionally return an encoded message -// that can provide details about this authorization failure. +// For example, if a user is not authorized to perform an operation that he +// or she has requested, the request returns a Client.UnauthorizedOperation +// response (an HTTP 403 response). Some AWS operations additionally return +// an encoded message that can provide details about this authorization failure. // -// Only certain AWS actions return an encoded authorization message. The documentation -// for an individual action indicates whether that action returns an encoded -// message in addition to returning an HTTP code. +// Only certain AWS operations return an encoded authorization message. The +// documentation for an individual operation indicates whether that operation +// returns an encoded message in addition to returning an HTTP code. // // The message is encoded because the details of the authorization status can -// constitute privileged information that the user who requested the action +// constitute privileged information that the user who requested the operation // should not see. To decode an authorization status message, a user must be // granted permissions via an IAM policy to request the DecodeAuthorizationMessage // (sts:DecodeAuthorizationMessage) action. @@ -663,7 +656,7 @@ func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessag // // * Whether the request was denied due to an explicit deny or due to the // absence of an explicit allow. For more information, see Determining Whether -// a Request is Allowed or Denied (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow) +// a Request is Allowed or Denied (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow) // in the IAM User Guide. // // * The principal who made the request. @@ -709,6 +702,102 @@ func (c *STS) DecodeAuthorizationMessageWithContext(ctx aws.Context, input *Deco return out, req.Send() } +const opGetAccessKeyInfo = "GetAccessKeyInfo" + +// GetAccessKeyInfoRequest generates a "aws/request.Request" representing the +// client's request for the GetAccessKeyInfo operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetAccessKeyInfo for more information on using the GetAccessKeyInfo +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetAccessKeyInfoRequest method. +// req, resp := client.GetAccessKeyInfoRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetAccessKeyInfo +func (c *STS) GetAccessKeyInfoRequest(input *GetAccessKeyInfoInput) (req *request.Request, output *GetAccessKeyInfoOutput) { + op := &request.Operation{ + Name: opGetAccessKeyInfo, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetAccessKeyInfoInput{} + } + + output = &GetAccessKeyInfoOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetAccessKeyInfo API operation for AWS Security Token Service. +// +// Returns the account identifier for the specified access key ID. +// +// Access keys consist of two parts: an access key ID (for example, AKIAIOSFODNN7EXAMPLE) +// and a secret access key (for example, wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY). +// For more information about access keys, see Managing Access Keys for IAM +// Users (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) +// in the IAM User Guide. +// +// When you pass an access key ID to this operation, it returns the ID of the +// AWS account to which the keys belong. Access key IDs beginning with AKIA +// are long-term credentials for an IAM user or the AWS account root user. Access +// key IDs beginning with ASIA are temporary credentials that are created using +// STS operations. If the account in the response belongs to you, you can sign +// in as the root user and review your root user access keys. Then, you can +// pull a credentials report (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html) +// to learn which IAM user owns the keys. To learn who requested the temporary +// credentials for an ASIA access key, view the STS events in your CloudTrail +// logs (https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html). +// +// This operation does not indicate the state of the access key. The key might +// be active, inactive, or deleted. Active keys might not have permissions to +// perform an operation. Providing a deleted access key might return an error +// that the key doesn't exist. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS Security Token Service's +// API operation GetAccessKeyInfo for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetAccessKeyInfo +func (c *STS) GetAccessKeyInfo(input *GetAccessKeyInfoInput) (*GetAccessKeyInfoOutput, error) { + req, out := c.GetAccessKeyInfoRequest(input) + return out, req.Send() +} + +// GetAccessKeyInfoWithContext is the same as GetAccessKeyInfo with the addition of +// the ability to pass a context and additional request options. +// +// See GetAccessKeyInfo for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *STS) GetAccessKeyInfoWithContext(ctx aws.Context, input *GetAccessKeyInfoInput, opts ...request.Option) (*GetAccessKeyInfoOutput, error) { + req, out := c.GetAccessKeyInfoRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opGetCallerIdentity = "GetCallerIdentity" // GetCallerIdentityRequest generates a "aws/request.Request" representing the @@ -753,8 +842,15 @@ func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) (req *requ // GetCallerIdentity API operation for AWS Security Token Service. // -// Returns details about the IAM identity whose credentials are used to call -// the API. +// Returns details about the IAM user or role whose credentials are used to +// call the operation. +// +// No permissions are required to perform this operation. If an administrator +// adds a policy to your IAM user or role that explicitly denies access to the +// sts:GetCallerIdentity action, you can still perform this operation. Permissions +// are not required because the same information is returned when an IAM user +// or role is denied access. To view an example response, see I Am Not Authorized +// to Perform: iam:DeleteVirtualMFADevice (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -831,81 +927,65 @@ func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *re // Returns a set of temporary security credentials (consisting of an access // key ID, a secret access key, and a security token) for a federated user. // A typical use is in a proxy application that gets temporary security credentials -// on behalf of distributed applications inside a corporate network. Because -// you must call the GetFederationToken action using the long-term security -// credentials of an IAM user, this call is appropriate in contexts where those +// on behalf of distributed applications inside a corporate network. You must +// call the GetFederationToken operation using the long-term security credentials +// of an IAM user. As a result, this call is appropriate in contexts where those // credentials can be safely stored, usually in a server-based application. -// For a comparison of GetFederationToken with the other APIs that produce temporary -// credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// For a comparison of GetFederationToken with the other API operations that +// produce temporary credentials, see Requesting Temporary Security Credentials +// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) // in the IAM User Guide. // -// If you are creating a mobile-based or browser-based app that can authenticate +// You can create a mobile-based or browser-based app that can authenticate // users using a web identity provider like Login with Amazon, Facebook, Google, -// or an OpenID Connect-compatible identity provider, we recommend that you -// use Amazon Cognito (http://aws.amazon.com/cognito/) or AssumeRoleWithWebIdentity. +// or an OpenID Connect-compatible identity provider. In this case, we recommend +// that you use Amazon Cognito (http://aws.amazon.com/cognito/) or AssumeRoleWithWebIdentity. // For more information, see Federation Through a Web-based Identity Provider -// (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). +// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). // -// The GetFederationToken action must be called by using the long-term AWS security -// credentials of an IAM user. You can also call GetFederationToken using the -// security credentials of an AWS root account, but we do not recommended it. -// Instead, we recommend that you create an IAM user for the purpose of the -// proxy application and then attach a policy to the IAM user that limits federated -// users to only the actions and resources that they need access to. For more -// information, see IAM Best Practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) +// You can also call GetFederationToken using the security credentials of an +// AWS account root user, but we do not recommend it. Instead, we recommend +// that you create an IAM user for the purpose of the proxy application. Then +// attach a policy to the IAM user that limits federated users to only the actions +// and resources that they need to access. For more information, see IAM Best +// Practices (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) // in the IAM User Guide. // -// The temporary security credentials that are obtained by using the long-term -// credentials of an IAM user are valid for the specified duration, from 900 -// seconds (15 minutes) up to a maximium of 129600 seconds (36 hours). The default -// is 43200 seconds (12 hours). Temporary credentials that are obtained by using -// AWS root account credentials have a maximum duration of 3600 seconds (1 hour). +// The temporary credentials are valid for the specified duration, from 900 +// seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours). The default +// is 43,200 seconds (12 hours). Temporary credentials that are obtained by +// using AWS account root user credentials have a maximum duration of 3,600 +// seconds (1 hour). // // The temporary security credentials created by GetFederationToken can be used // to make API calls to any AWS service with the following exceptions: // -// * You cannot use these credentials to call any IAM APIs. +// * You cannot use these credentials to call any IAM API operations. // -// * You cannot call any STS APIs except GetCallerIdentity. +// * You cannot call any STS API operations except GetCallerIdentity. // // Permissions // -// The permissions for the temporary security credentials returned by GetFederationToken -// are determined by a combination of the following: +// You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// to this operation. You can pass a single JSON policy document to use as an +// inline session policy. You can also specify up to 10 managed policies to +// use as managed session policies. The plain text that you use for both inline +// and managed session policies shouldn't exceed 2048 characters. // -// * The policy or policies that are attached to the IAM user whose credentials -// are used to call GetFederationToken. -// -// * The policy that is passed as a parameter in the call. -// -// The passed policy is attached to the temporary security credentials that -// result from the GetFederationToken API call--that is, to the federated user. -// When the federated user makes an AWS request, AWS evaluates the policy attached -// to the federated user in combination with the policy or policies attached -// to the IAM user whose credentials were used to call GetFederationToken. AWS -// allows the federated user's request only when both the federated user and -// the IAM user are explicitly allowed to perform the requested action. The -// passed policy cannot grant more permissions than those that are defined in -// the IAM user policy. -// -// A typical use case is that the permissions of the IAM user whose credentials -// are used to call GetFederationToken are designed to allow access to all the -// actions and resources that any federated user will need. Then, for individual -// users, you pass a policy to the operation that scopes down the permissions -// to a level that's appropriate to that individual user, using a policy that -// allows only a subset of permissions that are granted to the IAM user. -// -// If you do not pass a policy, the resulting temporary security credentials -// have no effective permissions. The only exception is when the temporary security -// credentials are used to access a resource that has a resource-based policy -// that specifically allows the federated user to access the resource. -// -// For more information about how permissions work, see Permissions for GetFederationToken -// (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html). -// For information about using GetFederationToken to create temporary security -// credentials, see GetFederationToken—Federation Through a Custom Identity -// Broker (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken). +// Though the session policy parameters are optional, if you do not pass a policy, +// then the resulting federated user session has no permissions. The only exception +// is when the credentials are used to access a resource that has a resource-based +// policy that specifically references the federated user session in the Principal +// element of the policy. When you pass session policies, the session permissions +// are the intersection of the IAM user policies and the session policies that +// you pass. This gives you a way to further restrict the permissions for a +// federated user. You cannot use session policies to grant more permissions +// than those that are defined in the permissions policy of the IAM user. For +// more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// in the IAM User Guide. For information about using GetFederationToken to +// create temporary security credentials, see GetFederationToken—Federation +// Through a Custom Identity Broker (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -928,7 +1008,7 @@ func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *re // STS is not activated in the requested region for the account that is being // asked to generate credentials. The account administrator must use the IAM // console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) +// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) // in the IAM User Guide. // // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationToken @@ -1000,48 +1080,47 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request. // Returns a set of temporary credentials for an AWS account or IAM user. The // credentials consist of an access key ID, a secret access key, and a security // token. Typically, you use GetSessionToken if you want to use MFA to protect -// programmatic calls to specific AWS APIs like Amazon EC2 StopInstances. MFA-enabled -// IAM users would need to call GetSessionToken and submit an MFA code that -// is associated with their MFA device. Using the temporary security credentials -// that are returned from the call, IAM users can then make programmatic calls -// to APIs that require MFA authentication. If you do not supply a correct MFA -// code, then the API returns an access denied error. For a comparison of GetSessionToken -// with the other APIs that produce temporary credentials, see Requesting Temporary -// Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// programmatic calls to specific AWS API operations like Amazon EC2 StopInstances. +// MFA-enabled IAM users would need to call GetSessionToken and submit an MFA +// code that is associated with their MFA device. Using the temporary security +// credentials that are returned from the call, IAM users can then make programmatic +// calls to API operations that require MFA authentication. If you do not supply +// a correct MFA code, then the API returns an access denied error. For a comparison +// of GetSessionToken with the other API operations that produce temporary credentials, +// see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) // in the IAM User Guide. // -// The GetSessionToken action must be called by using the long-term AWS security -// credentials of the AWS account or an IAM user. Credentials that are created -// by IAM users are valid for the duration that you specify, from 900 seconds -// (15 minutes) up to a maximum of 129600 seconds (36 hours), with a default -// of 43200 seconds (12 hours); credentials that are created by using account -// credentials can range from 900 seconds (15 minutes) up to a maximum of 3600 -// seconds (1 hour), with a default of 1 hour. +// The GetSessionToken operation must be called by using the long-term AWS security +// credentials of the AWS account root user or an IAM user. Credentials that +// are created by IAM users are valid for the duration that you specify. This +// duration can range from 900 seconds (15 minutes) up to a maximum of 129,600 +// seconds (36 hours), with a default of 43,200 seconds (12 hours). Credentials +// based on account credentials can range from 900 seconds (15 minutes) up to +// 3,600 seconds (1 hour), with a default of 1 hour. // // The temporary security credentials created by GetSessionToken can be used // to make API calls to any AWS service with the following exceptions: // -// * You cannot call any IAM APIs unless MFA authentication information is -// included in the request. +// * You cannot call any IAM API operations unless MFA authentication information +// is included in the request. // -// * You cannot call any STS API exceptAssumeRole or GetCallerIdentity. +// * You cannot call any STS API except AssumeRole or GetCallerIdentity. // -// We recommend that you do not call GetSessionToken with root account credentials. -// Instead, follow our best practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users) +// We recommend that you do not call GetSessionToken with AWS account root user +// credentials. Instead, follow our best practices (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users) // by creating one or more IAM users, giving them the necessary permissions, // and using IAM users for everyday interaction with AWS. // -// The permissions associated with the temporary security credentials returned -// by GetSessionToken are based on the permissions associated with account or -// IAM user whose credentials are used to call the action. If GetSessionToken -// is called using root account credentials, the temporary credentials have -// root account permissions. Similarly, if GetSessionToken is called using the -// credentials of an IAM user, the temporary credentials have the same permissions -// as the IAM user. +// The credentials that are returned by GetSessionToken are based on permissions +// associated with the user whose credentials were used to call the operation. +// If GetSessionToken is called using AWS account root user credentials, the +// temporary credentials have root user permissions. Similarly, if GetSessionToken +// is called using the credentials of an IAM user, the temporary credentials +// have the same permissions as the IAM user. // // For more information about using GetSessionToken to create temporary credentials, -// go to Temporary Credentials for Users in Untrusted Environments (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken) +// go to Temporary Credentials for Users in Untrusted Environments (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken) // in the IAM User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1056,7 +1135,7 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request. // STS is not activated in the requested region for the account that is being // asked to generate credentials. The account administrator must use the IAM // console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) +// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) // in the IAM User Guide. // // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionToken @@ -1091,7 +1170,7 @@ type AssumeRoleInput struct { // a session duration of 12 hours, but your administrator set the maximum session // duration to 6 hours, your operation fails. To learn how to view the maximum // value for your role, see View the Maximum Session Duration Setting for a - // Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) + // Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. // // By default, the value is set to 3600 seconds. @@ -1101,51 +1180,77 @@ type AssumeRoleInput struct { // to the federation endpoint for a console sign-in token takes a SessionDuration // parameter that specifies the maximum length of the console session. For more // information, see Creating a URL that Enables Federated Users to Access the - // AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) + // AWS Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) // in the IAM User Guide. DurationSeconds *int64 `min:"900" type:"integer"` - // A unique identifier that is used by third parties when assuming roles in - // their customers' accounts. For each role that the third party can assume, - // they should instruct their customers to ensure the role's trust policy checks - // for the external ID that the third party generated. Each time the third party - // assumes the role, they should pass the customer's external ID. The external - // ID is useful in order to help third parties bind a role to the customer who - // created it. For more information about the external ID, see How to Use an - // External ID When Granting Access to Your AWS Resources to a Third Party (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) + // A unique identifier that might be required when you assume a role in another + // account. If the administrator of the account to which the role belongs provided + // you with an external ID, then provide that value in the ExternalId parameter. + // This value can be any string, such as a passphrase or account number. A cross-account + // role is usually set up to trust everyone in an account. Therefore, the administrator + // of the trusting account might send an external ID to the administrator of + // the trusted account. That way, only someone with the ID can assume the role, + // rather than everyone in the account. For more information about the external + // ID, see How to Use an External ID When Granting Access to Your AWS Resources + // to a Third Party (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) // in the IAM User Guide. // - // The regex used to validated this parameter is a string of characters consisting + // The regex used to validate this parameter is a string of characters consisting // of upper- and lower-case alphanumeric characters with no spaces. You can // also include underscores or any of the following characters: =,.@:/- ExternalId *string `min:"2" type:"string"` - // An IAM policy in JSON format. + // An IAM policy in JSON format that you want to use as an inline session policy. // - // This parameter is optional. If you pass a policy, the temporary security - // credentials that are returned by the operation have the permissions that - // are allowed by both (the intersection of) the access policy of the role that - // is being assumed, and the policy that you pass. This gives you a way to further - // restrict the permissions for the resulting temporary security credentials. - // You cannot use the passed policy to grant permissions that are in excess - // of those allowed by the access policy of the role that is being assumed. - // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, - // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) + // This parameter is optional. Passing policies to this operation returns new + // temporary credentials. The resulting session's permissions are the intersection + // of the role's identity-based policy and the session policies. You can use + // the role's temporary credentials in subsequent AWS API calls to access resources + // in the account that owns the role. You cannot use session policies to grant + // more permissions than those allowed by the identity-based policy of the role + // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // in the IAM User Guide. // - // The format for this parameter, as described by its regex pattern, is a string - // of characters up to 2048 characters in length. The characters can be any - // ASCII character from the space character to the end of the valid character - // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // The plain text that you use for both inline and managed session policies + // shouldn't exceed 2048 characters. The JSON policy characters can be any ASCII + // character from the space character to the end of the valid character list + // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), // and carriage return (\u000D) characters. // - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. Policy *string `min:"1" type:"string"` + // The Amazon Resource Names (ARNs) of the IAM managed policies that you want + // to use as managed session policies. The policies must exist in the same account + // as the role. + // + // This parameter is optional. You can provide up to 10 managed policy ARNs. + // However, the plain text that you use for both inline and managed session + // policies shouldn't exceed 2048 characters. For more information about ARNs, + // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + // + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. + // + // Passing policies to this operation returns new temporary credentials. The + // resulting session's permissions are the intersection of the role's identity-based + // policy and the session policies. You can use the role's temporary credentials + // in subsequent AWS API calls to access resources in the account that owns + // the role. You cannot use session policies to grant more permissions than + // those allowed by the identity-based policy of the role that is being assumed. + // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + PolicyArns []*PolicyDescriptorType `type:"list"` + // The Amazon Resource Name (ARN) of the role to assume. // // RoleArn is a required field @@ -1158,8 +1263,8 @@ type AssumeRoleInput struct { // scenarios, the role session name is visible to, and can be logged by the // account that owns the role. The role session name is also used in the ARN // of the assumed role principal. This means that subsequent cross-account API - // requests using the temporary security credentials will expose the role session - // name to the external account in their CloudTrail logs. + // requests that use the temporary security credentials will expose the role + // session name to the external account in their AWS CloudTrail logs. // // The regex used to validate this parameter is a string of characters consisting // of upper- and lower-case alphanumeric characters with no spaces. You can @@ -1229,6 +1334,16 @@ func (s *AssumeRoleInput) Validate() error { if s.TokenCode != nil && len(*s.TokenCode) < 6 { invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6)) } + if s.PolicyArns != nil { + for i, v := range s.PolicyArns { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -1254,6 +1369,12 @@ func (s *AssumeRoleInput) SetPolicy(v string) *AssumeRoleInput { return s } +// SetPolicyArns sets the PolicyArns field's value. +func (s *AssumeRoleInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleInput { + s.PolicyArns = v + return s +} + // SetRoleArn sets the RoleArn field's value. func (s *AssumeRoleInput) SetRoleArn(v string) *AssumeRoleInput { s.RoleArn = &v @@ -1293,10 +1414,8 @@ type AssumeRoleOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security (or session) token. // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` // A percentage value that indicates the size of the policy in packed form. @@ -1346,7 +1465,7 @@ type AssumeRoleWithSAMLInput struct { // specify a session duration of 12 hours, but your administrator set the maximum // session duration to 6 hours, your operation fails. To learn how to view the // maximum value for your role, see View the Maximum Session Duration Setting - // for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) + // for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. // // By default, the value is set to 3600 seconds. @@ -1356,36 +1475,60 @@ type AssumeRoleWithSAMLInput struct { // to the federation endpoint for a console sign-in token takes a SessionDuration // parameter that specifies the maximum length of the console session. For more // information, see Creating a URL that Enables Federated Users to Access the - // AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) + // AWS Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) // in the IAM User Guide. DurationSeconds *int64 `min:"900" type:"integer"` - // An IAM policy in JSON format. + // An IAM policy in JSON format that you want to use as an inline session policy. // - // The policy parameter is optional. If you pass a policy, the temporary security - // credentials that are returned by the operation have the permissions that - // are allowed by both the access policy of the role that is being assumed, - // and the policy that you pass. This gives you a way to further restrict the - // permissions for the resulting temporary security credentials. You cannot - // use the passed policy to grant permissions that are in excess of those allowed - // by the access policy of the role that is being assumed. For more information, - // Permissions for AssumeRole, AssumeRoleWithSAML, and AssumeRoleWithWebIdentity - // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) + // This parameter is optional. Passing policies to this operation returns new + // temporary credentials. The resulting session's permissions are the intersection + // of the role's identity-based policy and the session policies. You can use + // the role's temporary credentials in subsequent AWS API calls to access resources + // in the account that owns the role. You cannot use session policies to grant + // more permissions than those allowed by the identity-based policy of the role + // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // in the IAM User Guide. // - // The format for this parameter, as described by its regex pattern, is a string - // of characters up to 2048 characters in length. The characters can be any - // ASCII character from the space character to the end of the valid character - // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // The plain text that you use for both inline and managed session policies + // shouldn't exceed 2048 characters. The JSON policy characters can be any ASCII + // character from the space character to the end of the valid character list + // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), // and carriage return (\u000D) characters. // - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. Policy *string `min:"1" type:"string"` + // The Amazon Resource Names (ARNs) of the IAM managed policies that you want + // to use as managed session policies. The policies must exist in the same account + // as the role. + // + // This parameter is optional. You can provide up to 10 managed policy ARNs. + // However, the plain text that you use for both inline and managed session + // policies shouldn't exceed 2048 characters. For more information about ARNs, + // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + // + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. + // + // Passing policies to this operation returns new temporary credentials. The + // resulting session's permissions are the intersection of the role's identity-based + // policy and the session policies. You can use the role's temporary credentials + // in subsequent AWS API calls to access resources in the account that owns + // the role. You cannot use session policies to grant more permissions than + // those allowed by the identity-based policy of the role that is being assumed. + // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + PolicyArns []*PolicyDescriptorType `type:"list"` + // The Amazon Resource Name (ARN) of the SAML provider in IAM that describes // the IdP. // @@ -1399,8 +1542,8 @@ type AssumeRoleWithSAMLInput struct { // The base-64 encoded SAML authentication response provided by the IdP. // - // For more information, see Configuring a Relying Party and Adding Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html) - // in the Using IAM guide. + // For more information, see Configuring a Relying Party and Adding Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html) + // in the IAM User Guide. // // SAMLAssertion is a required field SAMLAssertion *string `min:"4" type:"string" required:"true"` @@ -1443,6 +1586,16 @@ func (s *AssumeRoleWithSAMLInput) Validate() error { if s.SAMLAssertion != nil && len(*s.SAMLAssertion) < 4 { invalidParams.Add(request.NewErrParamMinLen("SAMLAssertion", 4)) } + if s.PolicyArns != nil { + for i, v := range s.PolicyArns { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -1462,6 +1615,12 @@ func (s *AssumeRoleWithSAMLInput) SetPolicy(v string) *AssumeRoleWithSAMLInput { return s } +// SetPolicyArns sets the PolicyArns field's value. +func (s *AssumeRoleWithSAMLInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithSAMLInput { + s.PolicyArns = v + return s +} + // SetPrincipalArn sets the PrincipalArn field's value. func (s *AssumeRoleWithSAMLInput) SetPrincipalArn(v string) *AssumeRoleWithSAMLInput { s.PrincipalArn = &v @@ -1496,10 +1655,8 @@ type AssumeRoleWithSAMLOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security (or session) token. // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` // The value of the Issuer element of the SAML assertion. @@ -1603,7 +1760,7 @@ type AssumeRoleWithWebIdentityInput struct { // a session duration of 12 hours, but your administrator set the maximum session // duration to 6 hours, your operation fails. To learn how to view the maximum // value for your role, see View the Maximum Session Duration Setting for a - // Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) + // Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. // // By default, the value is set to 3600 seconds. @@ -1613,35 +1770,60 @@ type AssumeRoleWithWebIdentityInput struct { // to the federation endpoint for a console sign-in token takes a SessionDuration // parameter that specifies the maximum length of the console session. For more // information, see Creating a URL that Enables Federated Users to Access the - // AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) + // AWS Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) // in the IAM User Guide. DurationSeconds *int64 `min:"900" type:"integer"` - // An IAM policy in JSON format. + // An IAM policy in JSON format that you want to use as an inline session policy. // - // The policy parameter is optional. If you pass a policy, the temporary security - // credentials that are returned by the operation have the permissions that - // are allowed by both the access policy of the role that is being assumed, - // and the policy that you pass. This gives you a way to further restrict the - // permissions for the resulting temporary security credentials. You cannot - // use the passed policy to grant permissions that are in excess of those allowed - // by the access policy of the role that is being assumed. For more information, - // see Permissions for AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) + // This parameter is optional. Passing policies to this operation returns new + // temporary credentials. The resulting session's permissions are the intersection + // of the role's identity-based policy and the session policies. You can use + // the role's temporary credentials in subsequent AWS API calls to access resources + // in the account that owns the role. You cannot use session policies to grant + // more permissions than those allowed by the identity-based policy of the role + // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // in the IAM User Guide. // - // The format for this parameter, as described by its regex pattern, is a string - // of characters up to 2048 characters in length. The characters can be any - // ASCII character from the space character to the end of the valid character - // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // The plain text that you use for both inline and managed session policies + // shouldn't exceed 2048 characters. The JSON policy characters can be any ASCII + // character from the space character to the end of the valid character list + // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), // and carriage return (\u000D) characters. // - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. Policy *string `min:"1" type:"string"` + // The Amazon Resource Names (ARNs) of the IAM managed policies that you want + // to use as managed session policies. The policies must exist in the same account + // as the role. + // + // This parameter is optional. You can provide up to 10 managed policy ARNs. + // However, the plain text that you use for both inline and managed session + // policies shouldn't exceed 2048 characters. For more information about ARNs, + // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + // + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. + // + // Passing policies to this operation returns new temporary credentials. The + // resulting session's permissions are the intersection of the role's identity-based + // policy and the session policies. You can use the role's temporary credentials + // in subsequent AWS API calls to access resources in the account that owns + // the role. You cannot use session policies to grant more permissions than + // those allowed by the identity-based policy of the role that is being assumed. + // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + PolicyArns []*PolicyDescriptorType `type:"list"` + // The fully qualified host component of the domain name of the identity provider. // // Specify this value only for OAuth 2.0 access tokens. Currently www.amazon.com @@ -1718,6 +1900,16 @@ func (s *AssumeRoleWithWebIdentityInput) Validate() error { if s.WebIdentityToken != nil && len(*s.WebIdentityToken) < 4 { invalidParams.Add(request.NewErrParamMinLen("WebIdentityToken", 4)) } + if s.PolicyArns != nil { + for i, v := range s.PolicyArns { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -1737,6 +1929,12 @@ func (s *AssumeRoleWithWebIdentityInput) SetPolicy(v string) *AssumeRoleWithWebI return s } +// SetPolicyArns sets the PolicyArns field's value. +func (s *AssumeRoleWithWebIdentityInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithWebIdentityInput { + s.PolicyArns = v + return s +} + // SetProviderId sets the ProviderId field's value. func (s *AssumeRoleWithWebIdentityInput) SetProviderId(v string) *AssumeRoleWithWebIdentityInput { s.ProviderId = &v @@ -1781,10 +1979,8 @@ type AssumeRoleWithWebIdentityOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security token. // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` // A percentage value that indicates the size of the policy in packed form. @@ -1793,7 +1989,7 @@ type AssumeRoleWithWebIdentityOutput struct { PackedPolicySize *int64 `type:"integer"` // The issuing authority of the web identity token presented. For OpenID Connect - // ID Tokens this contains the value of the iss field. For OAuth 2.0 access + // ID tokens, this contains the value of the iss field. For OAuth 2.0 access // tokens, this contains the value of the ProviderId parameter that was passed // in the AssumeRoleWithWebIdentity request. Provider *string `type:"string"` @@ -1860,7 +2056,7 @@ type AssumedRoleUser struct { // The ARN of the temporary security credentials that are returned from the // AssumeRole action. For more information about ARNs and how to use them in - // policies, see IAM Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) + // policies, see IAM Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) // in Using IAM. // // Arn is a required field @@ -2028,7 +2224,7 @@ type FederatedUser struct { // The ARN that specifies the federated user that is associated with the credentials. // For more information about ARNs and how to use them in policies, see IAM - // Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) + // Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) // in Using IAM. // // Arn is a required field @@ -2063,6 +2259,73 @@ func (s *FederatedUser) SetFederatedUserId(v string) *FederatedUser { return s } +type GetAccessKeyInfoInput struct { + _ struct{} `type:"structure"` + + // The identifier of an access key. + // + // This parameter allows (through its regex pattern) a string of characters + // that can consist of any upper- or lowercased letter or digit. + // + // AccessKeyId is a required field + AccessKeyId *string `min:"16" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetAccessKeyInfoInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetAccessKeyInfoInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetAccessKeyInfoInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetAccessKeyInfoInput"} + if s.AccessKeyId == nil { + invalidParams.Add(request.NewErrParamRequired("AccessKeyId")) + } + if s.AccessKeyId != nil && len(*s.AccessKeyId) < 16 { + invalidParams.Add(request.NewErrParamMinLen("AccessKeyId", 16)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccessKeyId sets the AccessKeyId field's value. +func (s *GetAccessKeyInfoInput) SetAccessKeyId(v string) *GetAccessKeyInfoInput { + s.AccessKeyId = &v + return s +} + +type GetAccessKeyInfoOutput struct { + _ struct{} `type:"structure"` + + // The number used to identify the AWS account. + Account *string `type:"string"` +} + +// String returns the string representation +func (s GetAccessKeyInfoOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetAccessKeyInfoOutput) GoString() string { + return s.String() +} + +// SetAccount sets the Account field's value. +func (s *GetAccessKeyInfoOutput) SetAccount(v string) *GetAccessKeyInfoOutput { + s.Account = &v + return s +} + type GetCallerIdentityInput struct { _ struct{} `type:"structure"` } @@ -2090,8 +2353,8 @@ type GetCallerIdentityOutput struct { Arn *string `min:"20" type:"string"` // The unique identifier of the calling entity. The exact value depends on the - // type of entity making the call. The values returned are those listed in the - // aws:userid column in the Principal table (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable) + // type of entity that is making the call. The values returned are those listed + // in the aws:userid column in the Principal table (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable) // found on the Policy Variables reference page in the IAM User Guide. UserId *string `type:"string"` } @@ -2128,12 +2391,11 @@ type GetFederationTokenInput struct { _ struct{} `type:"structure"` // The duration, in seconds, that the session should last. Acceptable durations - // for federation sessions range from 900 seconds (15 minutes) to 129600 seconds - // (36 hours), with 43200 seconds (12 hours) as the default. Sessions obtained - // using AWS account (root) credentials are restricted to a maximum of 3600 + // for federation sessions range from 900 seconds (15 minutes) to 129,600 seconds + // (36 hours), with 43,200 seconds (12 hours) as the default. Sessions obtained + // using AWS account root user credentials are restricted to a maximum of 3,600 // seconds (one hour). If the specified duration is longer than one hour, the - // session obtained by using AWS account (root) credentials defaults to one - // hour. + // session obtained by using root user credentials defaults to one hour. DurationSeconds *int64 `min:"900" type:"integer"` // The name of the federated user. The name is used as an identifier for the @@ -2148,36 +2410,73 @@ type GetFederationTokenInput struct { // Name is a required field Name *string `min:"2" type:"string" required:"true"` - // An IAM policy in JSON format that is passed with the GetFederationToken call - // and evaluated along with the policy or policies that are attached to the - // IAM user whose credentials are used to call GetFederationToken. The passed - // policy is used to scope down the permissions that are available to the IAM - // user, by allowing only a subset of the permissions that are granted to the - // IAM user. The passed policy cannot grant more permissions than those granted - // to the IAM user. The final permissions for the federated user are the most - // restrictive set based on the intersection of the passed policy and the IAM - // user policy. + // An IAM policy in JSON format that you want to use as an inline session policy. // - // If you do not pass a policy, the resulting temporary security credentials - // have no effective permissions. The only exception is when the temporary security - // credentials are used to access a resource that has a resource-based policy - // that specifically allows the federated user to access the resource. + // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // to this operation. You can pass a single JSON policy document to use as an + // inline session policy. You can also specify up to 10 managed policies to + // use as managed session policies. // - // The format for this parameter, as described by its regex pattern, is a string - // of characters up to 2048 characters in length. The characters can be any - // ASCII character from the space character to the end of the valid character - // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // This parameter is optional. However, if you do not pass any session policies, + // then the resulting federated user session has no permissions. The only exception + // is when the credentials are used to access a resource that has a resource-based + // policy that specifically references the federated user session in the Principal + // element of the policy. + // + // When you pass session policies, the session permissions are the intersection + // of the IAM user policies and the session policies that you pass. This gives + // you a way to further restrict the permissions for a federated user. You cannot + // use session policies to grant more permissions than those that are defined + // in the permissions policy of the IAM user. For more information, see Session + // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + // + // The plain text that you use for both inline and managed session policies + // shouldn't exceed 2048 characters. The JSON policy characters can be any ASCII + // character from the space character to the end of the valid character list + // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), // and carriage return (\u000D) characters. // - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. - // - // For more information about how permissions work, see Permissions for GetFederationToken - // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html). + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. Policy *string `min:"1" type:"string"` + + // The Amazon Resource Names (ARNs) of the IAM managed policies that you want + // to use as a managed session policy. The policies must exist in the same account + // as the IAM user that is requesting federated access. + // + // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // to this operation. You can pass a single JSON policy document to use as an + // inline session policy. You can also specify up to 10 managed policies to + // use as managed session policies. The plain text that you use for both inline + // and managed session policies shouldn't exceed 2048 characters. You can provide + // up to 10 managed policy ARNs. For more information about ARNs, see Amazon + // Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + // + // This parameter is optional. However, if you do not pass any session policies, + // then the resulting federated user session has no permissions. The only exception + // is when the credentials are used to access a resource that has a resource-based + // policy that specifically references the federated user session in the Principal + // element of the policy. + // + // When you pass session policies, the session permissions are the intersection + // of the IAM user policies and the session policies that you pass. This gives + // you a way to further restrict the permissions for a federated user. You cannot + // use session policies to grant more permissions than those that are defined + // in the permissions policy of the IAM user. For more information, see Session + // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + // + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. + PolicyArns []*PolicyDescriptorType `type:"list"` } // String returns the string representation @@ -2205,6 +2504,16 @@ func (s *GetFederationTokenInput) Validate() error { if s.Policy != nil && len(*s.Policy) < 1 { invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) } + if s.PolicyArns != nil { + for i, v := range s.PolicyArns { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -2230,6 +2539,12 @@ func (s *GetFederationTokenInput) SetPolicy(v string) *GetFederationTokenInput { return s } +// SetPolicyArns sets the PolicyArns field's value. +func (s *GetFederationTokenInput) SetPolicyArns(v []*PolicyDescriptorType) *GetFederationTokenInput { + s.PolicyArns = v + return s +} + // Contains the response to a successful GetFederationToken request, including // temporary AWS credentials that can be used to make AWS requests. type GetFederationTokenOutput struct { @@ -2238,10 +2553,8 @@ type GetFederationTokenOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security (or session) token. // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` // Identifiers for the federated user associated with the credentials (such @@ -2288,11 +2601,11 @@ type GetSessionTokenInput struct { _ struct{} `type:"structure"` // The duration, in seconds, that the credentials should remain valid. Acceptable - // durations for IAM user sessions range from 900 seconds (15 minutes) to 129600 - // seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions - // for AWS account owners are restricted to a maximum of 3600 seconds (one hour). - // If the duration is longer than one hour, the session for AWS account owners - // defaults to one hour. + // durations for IAM user sessions range from 900 seconds (15 minutes) to 129,600 + // seconds (36 hours), with 43,200 seconds (12 hours) as the default. Sessions + // for AWS account owners are restricted to a maximum of 3,600 seconds (one + // hour). If the duration is longer than one hour, the session for AWS account + // owners defaults to one hour. DurationSeconds *int64 `min:"900" type:"integer"` // The identification number of the MFA device that is associated with the IAM @@ -2303,16 +2616,16 @@ type GetSessionTokenInput struct { // You can find the device for an IAM user by going to the AWS Management Console // and viewing the user's security credentials. // - // The regex used to validated this parameter is a string of characters consisting + // The regex used to validate this parameter is a string of characters consisting // of upper- and lower-case alphanumeric characters with no spaces. You can // also include underscores or any of the following characters: =,.@:/- SerialNumber *string `min:"9" type:"string"` // The value provided by the MFA device, if MFA is required. If any policy requires // the IAM user to submit an MFA code, specify this value. If MFA authentication - // is required, and the user does not provide a code when requesting a set of - // temporary security credentials, the user will receive an "access denied" - // response when requesting resources that require MFA authentication. + // is required, the user must provide a code when requesting a set of temporary + // security credentials. A user who fails to provide the code receives an "access + // denied" response when requesting resources that require MFA authentication. // // The format for this parameter, as described by its regex pattern, is a sequence // of six numeric digits. @@ -2374,10 +2687,8 @@ type GetSessionTokenOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security (or session) token. // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` } @@ -2396,3 +2707,44 @@ func (s *GetSessionTokenOutput) SetCredentials(v *Credentials) *GetSessionTokenO s.Credentials = v return s } + +// A reference to the IAM managed policy that is passed as a session policy +// for a role session or a federated user session. +type PolicyDescriptorType struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the IAM managed policy to use as a session + // policy for the role. For more information about ARNs, see Amazon Resource + // Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + Arn *string `locationName:"arn" min:"20" type:"string"` +} + +// String returns the string representation +func (s PolicyDescriptorType) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PolicyDescriptorType) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PolicyDescriptorType) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PolicyDescriptorType"} + if s.Arn != nil && len(*s.Arn) < 20 { + invalidParams.Add(request.NewErrParamMinLen("Arn", 20)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetArn sets the Arn field's value. +func (s *PolicyDescriptorType) SetArn(v string) *PolicyDescriptorType { + s.Arn = &v + return s +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go deleted file mode 100644 index 4010cc7fa..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go +++ /dev/null @@ -1,12 +0,0 @@ -package sts - -import "github.com/aws/aws-sdk-go/aws/request" - -func init() { - initRequest = func(r *request.Request) { - switch r.Operation.Name { - case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: - r.Handlers.Sign.Clear() // these operations are unsigned - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go b/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go index ef681ab0c..fcb720dca 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go @@ -7,22 +7,14 @@ // request temporary, limited-privilege credentials for AWS Identity and Access // Management (IAM) users or for users that you authenticate (federated users). // This guide provides descriptions of the STS API. For more detailed information -// about using this service, go to Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html). -// -// As an alternative to using the API, you can use one of the AWS SDKs, which -// consist of libraries and sample code for various programming languages and -// platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient -// way to create programmatic access to STS. For example, the SDKs take care -// of cryptographically signing requests, managing errors, and retrying requests -// automatically. For information about the AWS SDKs, including how to download -// and install them, see the Tools for Amazon Web Services page (http://aws.amazon.com/tools/). +// about using this service, go to Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html). // // For information about setting up signatures and authorization through the -// API, go to Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html) +// API, go to Signing AWS API Requests (https://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html) // in the AWS General Reference. For general information about the Query API, -// go to Making Query Requests (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html) +// go to Making Query Requests (https://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html) // in Using IAM. For information about using security tokens with other AWS -// products, go to AWS Services That Work with IAM (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) +// products, go to AWS Services That Work with IAM (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) // in the IAM User Guide. // // If you're new to AWS and need additional technical information about a specific @@ -31,14 +23,38 @@ // // Endpoints // -// The AWS Security Token Service (STS) has a default endpoint of https://sts.amazonaws.com -// that maps to the US East (N. Virginia) region. Additional regions are available -// and are activated by default. For more information, see Activating and Deactivating -// AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) +// By default, AWS Security Token Service (STS) is available as a global service, +// and all AWS STS requests go to a single endpoint at https://sts.amazonaws.com. +// Global requests map to the US East (N. Virginia) region. AWS recommends using +// Regional AWS STS endpoints instead of the global endpoint to reduce latency, +// build in redundancy, and increase session token validity. For more information, +// see Managing AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) // in the IAM User Guide. // -// For information about STS endpoints, see Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#sts_region) -// in the AWS General Reference. +// Most AWS Regions are enabled for operations in all AWS services by default. +// Those Regions are automatically activated for use with AWS STS. Some Regions, +// such as Asia Pacific (Hong Kong), must be manually enabled. To learn more +// about enabling and disabling AWS Regions, see Managing AWS Regions (https://docs.aws.amazon.com/general/latest/gr/rande-manage.html) +// in the AWS General Reference. When you enable these AWS Regions, they are +// automatically activated for use with AWS STS. You cannot activate the STS +// endpoint for a Region that is disabled. Tokens that are valid in all AWS +// Regions are longer than tokens that are valid in Regions that are enabled +// by default. Changing this setting might affect existing systems where you +// temporarily store tokens. For more information, see Managing Global Endpoint +// Session Tokens (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html#sts-regions-manage-tokens) +// in the IAM User Guide. +// +// After you activate a Region for use with AWS STS, you can direct AWS STS +// API calls to that Region. AWS STS recommends that you provide both the Region +// and endpoint when you make calls to a Regional endpoint. You can provide +// the Region alone for manually enabled Regions, such as Asia Pacific (Hong +// Kong). In this case, the calls are directed to the STS Regional endpoint. +// However, if you provide the Region alone for Regions enabled by default, +// the calls are directed to the global endpoint of https://sts.amazonaws.com. +// +// To view the list of AWS STS endpoints and whether they are active by default, +// see Writing Code to Use AWS STS Regions (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html#id_credentials_temp_enable-regions_writing_code) +// in the IAM User Guide. // // Recording API requests // @@ -46,8 +62,28 @@ // your AWS account and delivers log files to an Amazon S3 bucket. By using // information collected by CloudTrail, you can determine what requests were // successfully made to STS, who made the request, when it was made, and so -// on. To learn more about CloudTrail, including how to turn it on and find -// your log files, see the AWS CloudTrail User Guide (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html). +// on. +// +// If you activate AWS STS endpoints in Regions other than the default global +// endpoint, then you must also turn on CloudTrail logging in those Regions. +// This is necessary to record any AWS STS API calls that are made in those +// Regions. For more information, see Turning On CloudTrail in Additional Regions +// (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/aggregating_logs_regions_turn_on_ct.html) +// in the AWS CloudTrail User Guide. +// +// AWS Security Token Service (STS) is a global service with a single endpoint +// at https://sts.amazonaws.com. Calls to this endpoint are logged as calls +// to a global service. However, because this endpoint is physically located +// in the US East (N. Virginia) Region, your logs list us-east-1 as the event +// Region. CloudTrail does not write these logs to the US East (Ohio) Region +// unless you choose to include global service logs in that Region. CloudTrail +// writes calls to all Regional endpoints to their respective Regions. For example, +// calls to sts.us-east-2.amazonaws.com are published to the US East (Ohio) +// Region and calls to sts.eu-central-1.amazonaws.com are published to the EU +// (Frankfurt) Region. +// +// To learn more about CloudTrail, including how to turn it on and find your +// log files, see the AWS CloudTrail User Guide (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html). // // See https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15 for more information on this service. // diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go b/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go index e24884ef3..41ea09c35 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go @@ -67,7 +67,7 @@ const ( // STS is not activated in the requested region for the account that is being // asked to generate credentials. The account administrator must use the IAM // console to activate STS in that region. For more information, see Activating - // and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) + // and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) // in the IAM User Guide. ErrCodeRegionDisabledException = "RegionDisabledException" ) diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go new file mode 100644 index 000000000..e2e1d6efe --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go @@ -0,0 +1,96 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package stsiface provides an interface to enable mocking the AWS Security Token Service service client +// for testing your code. +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. +package stsiface + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/service/sts" +) + +// STSAPI provides an interface to enable mocking the +// sts.STS service client's API operation, +// paginators, and waiters. This make unit testing your code that calls out +// to the SDK's service client's calls easier. +// +// The best way to use this interface is so the SDK's service client's calls +// can be stubbed out for unit testing your code with the SDK without needing +// to inject custom request handlers into the SDK's request pipeline. +// +// // myFunc uses an SDK service client to make a request to +// // AWS Security Token Service. +// func myFunc(svc stsiface.STSAPI) bool { +// // Make svc.AssumeRole request +// } +// +// func main() { +// sess := session.New() +// svc := sts.New(sess) +// +// myFunc(svc) +// } +// +// In your _test.go file: +// +// // Define a mock struct to be used in your unit tests of myFunc. +// type mockSTSClient struct { +// stsiface.STSAPI +// } +// func (m *mockSTSClient) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) { +// // mock response/functionality +// } +// +// func TestMyFunc(t *testing.T) { +// // Setup Test +// mockSvc := &mockSTSClient{} +// +// myfunc(mockSvc) +// +// // Verify myFunc's functionality +// } +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. Its suggested to use the pattern above for testing, or using +// tooling to generate mocks to satisfy the interfaces. +type STSAPI interface { + AssumeRole(*sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) + AssumeRoleWithContext(aws.Context, *sts.AssumeRoleInput, ...request.Option) (*sts.AssumeRoleOutput, error) + AssumeRoleRequest(*sts.AssumeRoleInput) (*request.Request, *sts.AssumeRoleOutput) + + AssumeRoleWithSAML(*sts.AssumeRoleWithSAMLInput) (*sts.AssumeRoleWithSAMLOutput, error) + AssumeRoleWithSAMLWithContext(aws.Context, *sts.AssumeRoleWithSAMLInput, ...request.Option) (*sts.AssumeRoleWithSAMLOutput, error) + AssumeRoleWithSAMLRequest(*sts.AssumeRoleWithSAMLInput) (*request.Request, *sts.AssumeRoleWithSAMLOutput) + + AssumeRoleWithWebIdentity(*sts.AssumeRoleWithWebIdentityInput) (*sts.AssumeRoleWithWebIdentityOutput, error) + AssumeRoleWithWebIdentityWithContext(aws.Context, *sts.AssumeRoleWithWebIdentityInput, ...request.Option) (*sts.AssumeRoleWithWebIdentityOutput, error) + AssumeRoleWithWebIdentityRequest(*sts.AssumeRoleWithWebIdentityInput) (*request.Request, *sts.AssumeRoleWithWebIdentityOutput) + + DecodeAuthorizationMessage(*sts.DecodeAuthorizationMessageInput) (*sts.DecodeAuthorizationMessageOutput, error) + DecodeAuthorizationMessageWithContext(aws.Context, *sts.DecodeAuthorizationMessageInput, ...request.Option) (*sts.DecodeAuthorizationMessageOutput, error) + DecodeAuthorizationMessageRequest(*sts.DecodeAuthorizationMessageInput) (*request.Request, *sts.DecodeAuthorizationMessageOutput) + + GetAccessKeyInfo(*sts.GetAccessKeyInfoInput) (*sts.GetAccessKeyInfoOutput, error) + GetAccessKeyInfoWithContext(aws.Context, *sts.GetAccessKeyInfoInput, ...request.Option) (*sts.GetAccessKeyInfoOutput, error) + GetAccessKeyInfoRequest(*sts.GetAccessKeyInfoInput) (*request.Request, *sts.GetAccessKeyInfoOutput) + + GetCallerIdentity(*sts.GetCallerIdentityInput) (*sts.GetCallerIdentityOutput, error) + GetCallerIdentityWithContext(aws.Context, *sts.GetCallerIdentityInput, ...request.Option) (*sts.GetCallerIdentityOutput, error) + GetCallerIdentityRequest(*sts.GetCallerIdentityInput) (*request.Request, *sts.GetCallerIdentityOutput) + + GetFederationToken(*sts.GetFederationTokenInput) (*sts.GetFederationTokenOutput, error) + GetFederationTokenWithContext(aws.Context, *sts.GetFederationTokenInput, ...request.Option) (*sts.GetFederationTokenOutput, error) + GetFederationTokenRequest(*sts.GetFederationTokenInput) (*request.Request, *sts.GetFederationTokenOutput) + + GetSessionToken(*sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error) + GetSessionTokenWithContext(aws.Context, *sts.GetSessionTokenInput, ...request.Option) (*sts.GetSessionTokenOutput, error) + GetSessionTokenRequest(*sts.GetSessionTokenInput) (*request.Request, *sts.GetSessionTokenOutput) +} + +var _ STSAPI = (*sts.STS)(nil) diff --git a/vendor/github.com/digitalocean/go-libvirt/.travis.yml b/vendor/github.com/digitalocean/go-libvirt/.travis.yml new file mode 100644 index 000000000..0256c7352 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/.travis.yml @@ -0,0 +1,62 @@ +language: go +os: linux +dist: bionic +sudo: require + +cache: + directories: + - $HOME/.ccache + +go: + - "1.12" + +env: + global: + - CCACHE_TEMPDIR=/tmp/.ccache-temp + matrix: + - LIBVIRT=2.3.0 EXT=xz + - LIBVIRT=3.1.0 EXT=xz + - LIBVIRT=5.1.0 EXT=xz + +before_install: + - go get golang.org/x/lint/golint + - go get golang.org/x/tools/cmd/goyacc + +install: + # credit here goes to the go-libvirt authors, + # see: https://github.com/rgbkrk/libvirt-go/blob/master/.travis.yml + - sudo apt-get -qqy build-dep libvirt + - sudo apt-get -qqy install curl qemu-system-x86 + - sudo mkdir -p /usr/src && sudo chown $(id -u) /usr/src + - curl -O -s https://libvirt.org/sources/libvirt-${LIBVIRT}.tar.${EXT} + - tar -C /usr/src -xf libvirt-${LIBVIRT}.tar.${EXT} + - pushd /usr/src/libvirt-${LIBVIRT} + - ccache --show-stats + - | + env PATH=/usr/lib/ccache:$PATH \ + ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc \ + --without-polkit \ + --without-esx --without-vbox --without-xen --without-libxl --without-lxc \ + --with-qemu + - make + - sudo make install + - ccache --show-stats + - popd + - sudo libvirtd -d -l -f libvirtd.conf + - sudo virtlogd -d || true + +before_script: + - go get -d ./... + - sudo qemu-img create -f raw -o size=10M /var/lib/libvirt/images/test.raw + - sudo virsh define .travis/test-domain.xml + - sudo virsh start test + - sudo virsh pool-create .travis/test-pool.xml + - sudo virsh secret-define .travis/test-secret.xml + +script: + - ./scripts/licensecheck.sh + - LIBVIRT_SOURCE=/usr/src/libvirt-${LIBVIRT} go generate ./... + - go build ./... + - golint -set_exit_status ./... + - go vet ./... + - go test -v -tags=integration ./... diff --git a/vendor/github.com/digitalocean/go-libvirt/AUTHORS b/vendor/github.com/digitalocean/go-libvirt/AUTHORS new file mode 100644 index 000000000..26db62f75 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/AUTHORS @@ -0,0 +1,22 @@ +Maintainer +---------- +DigitalOcean, Inc + +Original Authors +---------------- +Ben LeMasurier +Matt Layher + +Contributors +------------ +Justin Kim +Ricky Medina +Charlie Drage +Michael Koppmann +Simarpreet Singh +Alexander Polyakov +Amanda Andrade +Geoff Hickey +Yuriy Taraday +Sylvain Baubeau +David Schneider diff --git a/vendor/github.com/digitalocean/go-libvirt/CONTRIBUTING.md b/vendor/github.com/digitalocean/go-libvirt/CONTRIBUTING.md new file mode 100644 index 000000000..1b5b74106 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/CONTRIBUTING.md @@ -0,0 +1,30 @@ +Contributing +============ + +The `go-libvirt` project makes use of the [GitHub Flow](https://guides.github.com/introduction/flow/) +for contributions. + +If you'd like to contribute to the project, please +[open an issue](https://github.com/digitalocean/go-libvirt/issues/new) or find an +[existing issue](https://github.com/digitalocean/go-libvirt/issues) that you'd like +to take on. This ensures that efforts are not duplicated, and that a new feature +aligns with the focus of the rest of the repository. + +Once your suggestion has been submitted and discussed, please be sure that your +code meets the following criteria: + - code is completely `gofmt`'d + - new features or codepaths have appropriate test coverage + - `go test ./...` passes + - `go vet ./...` passes + - `golint ./...` returns no warnings, including documentation comment warnings + +In addition, if this is your first time contributing to the `go-libvirt` project, +add your name and email address to the +[AUTHORS](https://github.com/digitalocean/go-libvirt/blob/master/AUTHORS) file +under the "Contributors" section using the format: +`First Last `. + +Finally, submit a pull request for review! + +Questions? Feel free to join us in [`#go-qemu` on freenode](https://webchat.freenode.net/) +if you'd like to discuss the project. diff --git a/vendor/github.com/digitalocean/go-libvirt/LICENSE.md b/vendor/github.com/digitalocean/go-libvirt/LICENSE.md new file mode 100644 index 000000000..f5f4b8b5e --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/LICENSE.md @@ -0,0 +1,195 @@ +Apache License +============== + +_Version 2.0, January 2004_ +_<>_ + +### Terms and Conditions for use, reproduction, and distribution + +#### 1. Definitions + +“License” shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +“Licensor” shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +“Legal Entity” shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, “control” means **(i)** the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the +outstanding shares, or **(iii)** beneficial ownership of such entity. + +“You” (or “Your”) shall mean an individual or Legal Entity exercising +permissions granted by this License. + +“Source” form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +“Object” form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +“Work” shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +“Derivative Works” shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +“Contribution” shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +“submitted” means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as “Not a Contribution.” + +“Contributor” shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +#### 2. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +#### 3. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +#### 4. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* **(a)** You must give any other recipients of the Work or Derivative Works a copy of +this License; and +* **(b)** You must cause any modified files to carry prominent notices stating that You +changed the files; and +* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +#### 5. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +#### 6. Trademarks + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +#### 7. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +#### 8. Limitation of Liability + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +#### 9. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +_END OF TERMS AND CONDITIONS_ + +### APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets `[]` replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same “printed page” as the copyright notice for easier identification within +third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + diff --git a/vendor/github.com/digitalocean/go-libvirt/README.md b/vendor/github.com/digitalocean/go-libvirt/README.md new file mode 100644 index 000000000..665fde333 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/README.md @@ -0,0 +1,155 @@ +libvirt [![GoDoc](http://godoc.org/github.com/digitalocean/go-libvirt?status.svg)](http://godoc.org/github.com/digitalocean/go-libvirt) [![Build Status](https://travis-ci.org/digitalocean/go-libvirt.svg?branch=master)](https://travis-ci.org/digitalocean/go-libvirt) [![Report Card](https://goreportcard.com/badge/github.com/digitalocean/go-libvirt)](https://goreportcard.com/report/github.com/digitalocean/go-libvirt) +==== + +Package `go-libvirt` provides a pure Go interface for interacting with libvirt. + +Rather than using libvirt's C bindings, this package makes use of +libvirt's RPC interface, as documented [here](https://libvirt.org/internals/rpc.html). +Connections to the libvirt server may be local, or remote. RPC packets are encoded +using the XDR standard as defined by [RFC 4506](https://tools.ietf.org/html/rfc4506.html). + +libvirt's RPC interface is quite extensive, and changes from one version to the next, so +this project uses a code generator to build the go bindings. The code generator should +be run whenever you want to build go-libvirt for a new version of libvirt. To do this, +you'll need to set an environment variable `LIBVIRT_SOURCE` to the directory containing +the untarred libvirt sources, and then run `go generate ./...` from the go-libvirt directory. +The code generator consumes [src/remote/remote_protocol.x](https://github.com/libvirt/libvirt/blob/master/src/remote/remote_protocol.x) +and produces go bindings for all the remote procedures defined there. + +[Pull requests are welcome](https://github.com/digitalocean/go-libvirt/blob/master/CONTRIBUTING.md)! + +How to Use This Library +----------------------- + +Once you've vendored go-libvirt into your project, you'll probably want to call +some libvirt functions. There's some example code below showing how to connect +to libvirt and make one such call, but once you get past the introduction you'll +next want to call some other libvirt functions. How do you find them? + +Start with the [libvirt API reference](https://libvirt.org/html/index.html). +Let's say you want to gracefully shutdown a VM, and after reading through the +libvirt docs you determine that virDomainShutdown() is the function you want to +call to do that. Where's that function in go-libvirt? We transform the names +slightly when building the go bindings. There's no need for a global prefix like +"vir" in Go, since all our functions are inside the package namespace, so we +drop it. That means the Go function for `virDomainShutdown()` is just `DomainShutdown()`, +and sure enough, you can find the Go function `DomainShutdown()` in libvirt.gen.go, +with parameters and return values equivalent to those documented in the API +reference. + +Suppose you then decide you need more control over your shutdown, so you switch +over to `virDomainShutdownFlags()`. As its name suggests, this function takes a +flag parameter which has possible values specified in an enum called +`virDomainShutdownFlagValues`. Flag types like this are a little tricky for the +code generator, because the C functions just take an integer type - only the +libvirt documentation actually ties the flags to the enum types. In most cases +though we're able to generate a wrapper function with a distinct flag type, +making it easier for Go tooling to suggest possible flag values while you're +working. Checking the documentation for this function: + +`godoc github.com/digitalocean/go-libvirt DomainShutdownFlags` + +returns this: + +`func (l *Libvirt) DomainShutdownFlags(Dom Domain, Flags DomainShutdownFlagValues) (err error)` + +If you want to see the possible flag values, `godoc` can help again: + +``` +$ godoc github.com/digitalocean/go-libvirt DomainShutdownFlagValues + +type DomainShutdownFlagValues int32 + DomainShutdownFlagValues as declared in libvirt/libvirt-domain.h:1121 + +const ( + DomainShutdownDefault DomainShutdownFlagValues = iota + DomainShutdownAcpiPowerBtn DomainShutdownFlagValues = 1 + DomainShutdownGuestAgent DomainShutdownFlagValues = 2 + DomainShutdownInitctl DomainShutdownFlagValues = 4 + DomainShutdownSignal DomainShutdownFlagValues = 8 + DomainShutdownParavirt DomainShutdownFlagValues = 16 +) + DomainShutdownFlagValues enumeration from libvirt/libvirt-domain.h:1121 +``` + +One other suggestion: most of the code in go-libvirt is now generated, but a few +hand-written routines still exist in libvirt.go, and wrap calls to the generated +code with slightly different parameters or return values. We suggest avoiding +these hand-written routines and calling the generated routines in libvirt.gen.go +instead. Over time these handwritten routines will be removed from go-libvirt. + +Warning +------- + +The libvirt project strongly recommends *against* talking to the RPC interface +directly. They consider it to be a private implementation detail with the +possibility of being entirely rearchitected in the future. + +While these package are reasonably well-tested and have seen some use inside of +DigitalOcean, there may be subtle bugs which could cause the packages to act +in unexpected ways. Use at your own risk! + +In addition, the API is not considered stable at this time. If you would like +to include package `libvirt` in a project, we highly recommend vendoring it into +your project. + +Example +------- + +```go +package main + +import ( + "fmt" + "log" + "net" + "time" + + "github.com/digitalocean/go-libvirt" +) + +func main() { + // This dials libvirt on the local machine, but you can substitute the first + // two parameters with "tcp", ":" to connect to libvirt on + // a remote machine. + c, err := net.DialTimeout("unix", "/var/run/libvirt/libvirt-sock", 2*time.Second) + if err != nil { + log.Fatalf("failed to dial libvirt: %v", err) + } + + l := libvirt.New(c) + if err := l.Connect(); err != nil { + log.Fatalf("failed to connect: %v", err) + } + + v, err := l.Version() + if err != nil { + log.Fatalf("failed to retrieve libvirt version: %v", err) + } + fmt.Println("Version:", v) + + domains, err := l.Domains() + if err != nil { + log.Fatalf("failed to retrieve domains: %v", err) + } + + fmt.Println("ID\tName\t\tUUID") + fmt.Printf("--------------------------------------------------------\n") + for _, d := range domains { + fmt.Printf("%d\t%s\t%x\n", d.ID, d.Name, d.UUID) + } + + if err := l.Disconnect(); err != nil { + log.Fatalf("failed to disconnect: %v", err) + } +} + +``` + +``` +Version: 1.3.4 +ID Name UUID +-------------------------------------------------------- +1 Test-1 dc329f87d4de47198cfd2e21c6105b01 +2 Test-2 dc229f87d4de47198cfd2e21c6105b01 +``` diff --git a/vendor/github.com/digitalocean/go-libvirt/const.gen.go b/vendor/github.com/digitalocean/go-libvirt/const.gen.go new file mode 100644 index 000000000..6b9cfdc4c --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/const.gen.go @@ -0,0 +1,2242 @@ +// Copyright 2018 The go-libvirt Authors. +// +// 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. +// + +// WARNING: This file has automatically been generated +// by https://git.io/c-for-go. DO NOT EDIT. + +package libvirt + +const ( + // ExportVar as defined in libvirt/libvirt-common.h:57 + ExportVar = 0 + // TypedParamFieldLength as defined in libvirt/libvirt-common.h:170 + TypedParamFieldLength = 80 + // SecurityLabelBuflen as defined in libvirt/libvirt-host.h:84 + SecurityLabelBuflen = 4097 + // SecurityModelBuflen as defined in libvirt/libvirt-host.h:112 + SecurityModelBuflen = 257 + // SecurityDoiBuflen as defined in libvirt/libvirt-host.h:119 + SecurityDoiBuflen = 257 + // NodeCPUStatsFieldLength as defined in libvirt/libvirt-host.h:176 + NodeCPUStatsFieldLength = 80 + // NodeCPUStatsKernel as defined in libvirt/libvirt-host.h:193 + NodeCPUStatsKernel = "kernel" + // NodeCPUStatsUser as defined in libvirt/libvirt-host.h:201 + NodeCPUStatsUser = "user" + // NodeCPUStatsIdle as defined in libvirt/libvirt-host.h:209 + NodeCPUStatsIdle = "idle" + // NodeCPUStatsIowait as defined in libvirt/libvirt-host.h:217 + NodeCPUStatsIowait = "iowait" + // NodeCPUStatsIntr as defined in libvirt/libvirt-host.h:225 + NodeCPUStatsIntr = "intr" + // NodeCPUStatsUtilization as defined in libvirt/libvirt-host.h:234 + NodeCPUStatsUtilization = "utilization" + // NodeMemoryStatsFieldLength as defined in libvirt/libvirt-host.h:254 + NodeMemoryStatsFieldLength = 80 + // NodeMemoryStatsTotal as defined in libvirt/libvirt-host.h:271 + NodeMemoryStatsTotal = "total" + // NodeMemoryStatsFree as defined in libvirt/libvirt-host.h:280 + NodeMemoryStatsFree = "free" + // NodeMemoryStatsBuffers as defined in libvirt/libvirt-host.h:288 + NodeMemoryStatsBuffers = "buffers" + // NodeMemoryStatsCached as defined in libvirt/libvirt-host.h:296 + NodeMemoryStatsCached = "cached" + // NodeMemorySharedPagesToScan as defined in libvirt/libvirt-host.h:317 + NodeMemorySharedPagesToScan = "shm_pages_to_scan" + // NodeMemorySharedSleepMillisecs as defined in libvirt/libvirt-host.h:325 + NodeMemorySharedSleepMillisecs = "shm_sleep_millisecs" + // NodeMemorySharedPagesShared as defined in libvirt/libvirt-host.h:333 + NodeMemorySharedPagesShared = "shm_pages_shared" + // NodeMemorySharedPagesSharing as defined in libvirt/libvirt-host.h:341 + NodeMemorySharedPagesSharing = "shm_pages_sharing" + // NodeMemorySharedPagesUnshared as defined in libvirt/libvirt-host.h:349 + NodeMemorySharedPagesUnshared = "shm_pages_unshared" + // NodeMemorySharedPagesVolatile as defined in libvirt/libvirt-host.h:357 + NodeMemorySharedPagesVolatile = "shm_pages_volatile" + // NodeMemorySharedFullScans as defined in libvirt/libvirt-host.h:365 + NodeMemorySharedFullScans = "shm_full_scans" + // NodeMemorySharedMergeAcrossNodes as defined in libvirt/libvirt-host.h:377 + NodeMemorySharedMergeAcrossNodes = "shm_merge_across_nodes" + // NodeSevPdh as defined in libvirt/libvirt-host.h:445 + NodeSevPdh = "pdh" + // NodeSevCertChain as defined in libvirt/libvirt-host.h:454 + NodeSevCertChain = "cert-chain" + // NodeSevCbitpos as defined in libvirt/libvirt-host.h:461 + NodeSevCbitpos = "cbitpos" + // NodeSevReducedPhysBits as defined in libvirt/libvirt-host.h:469 + NodeSevReducedPhysBits = "reduced-phys-bits" + // UUIDBuflen as defined in libvirt/libvirt-host.h:554 + UUIDBuflen = 16 + // UUIDStringBuflen as defined in libvirt/libvirt-host.h:563 + UUIDStringBuflen = 37 + // DomainSchedulerCPUShares as defined in libvirt/libvirt-domain.h:316 + DomainSchedulerCPUShares = "cpu_shares" + // DomainSchedulerGlobalPeriod as defined in libvirt/libvirt-domain.h:324 + DomainSchedulerGlobalPeriod = "global_period" + // DomainSchedulerGlobalQuota as defined in libvirt/libvirt-domain.h:332 + DomainSchedulerGlobalQuota = "global_quota" + // DomainSchedulerVCPUPeriod as defined in libvirt/libvirt-domain.h:340 + DomainSchedulerVCPUPeriod = "vcpu_period" + // DomainSchedulerVCPUQuota as defined in libvirt/libvirt-domain.h:348 + DomainSchedulerVCPUQuota = "vcpu_quota" + // DomainSchedulerEmulatorPeriod as defined in libvirt/libvirt-domain.h:357 + DomainSchedulerEmulatorPeriod = "emulator_period" + // DomainSchedulerEmulatorQuota as defined in libvirt/libvirt-domain.h:366 + DomainSchedulerEmulatorQuota = "emulator_quota" + // DomainSchedulerIothreadPeriod as defined in libvirt/libvirt-domain.h:374 + DomainSchedulerIothreadPeriod = "iothread_period" + // DomainSchedulerIothreadQuota as defined in libvirt/libvirt-domain.h:382 + DomainSchedulerIothreadQuota = "iothread_quota" + // DomainSchedulerWeight as defined in libvirt/libvirt-domain.h:390 + DomainSchedulerWeight = "weight" + // DomainSchedulerCap as defined in libvirt/libvirt-domain.h:398 + DomainSchedulerCap = "cap" + // DomainSchedulerReservation as defined in libvirt/libvirt-domain.h:406 + DomainSchedulerReservation = "reservation" + // DomainSchedulerLimit as defined in libvirt/libvirt-domain.h:414 + DomainSchedulerLimit = "limit" + // DomainSchedulerShares as defined in libvirt/libvirt-domain.h:422 + DomainSchedulerShares = "shares" + // DomainBlockStatsFieldLength as defined in libvirt/libvirt-domain.h:480 + DomainBlockStatsFieldLength = 80 + // DomainBlockStatsReadBytes as defined in libvirt/libvirt-domain.h:488 + DomainBlockStatsReadBytes = "rd_bytes" + // DomainBlockStatsReadReq as defined in libvirt/libvirt-domain.h:496 + DomainBlockStatsReadReq = "rd_operations" + // DomainBlockStatsReadTotalTimes as defined in libvirt/libvirt-domain.h:504 + DomainBlockStatsReadTotalTimes = "rd_total_times" + // DomainBlockStatsWriteBytes as defined in libvirt/libvirt-domain.h:512 + DomainBlockStatsWriteBytes = "wr_bytes" + // DomainBlockStatsWriteReq as defined in libvirt/libvirt-domain.h:520 + DomainBlockStatsWriteReq = "wr_operations" + // DomainBlockStatsWriteTotalTimes as defined in libvirt/libvirt-domain.h:528 + DomainBlockStatsWriteTotalTimes = "wr_total_times" + // DomainBlockStatsFlushReq as defined in libvirt/libvirt-domain.h:536 + DomainBlockStatsFlushReq = "flush_operations" + // DomainBlockStatsFlushTotalTimes as defined in libvirt/libvirt-domain.h:544 + DomainBlockStatsFlushTotalTimes = "flush_total_times" + // DomainBlockStatsErrs as defined in libvirt/libvirt-domain.h:551 + DomainBlockStatsErrs = "errs" + // MigrateParamURI as defined in libvirt/libvirt-domain.h:850 + MigrateParamURI = "migrate_uri" + // MigrateParamDestName as defined in libvirt/libvirt-domain.h:860 + MigrateParamDestName = "destination_name" + // MigrateParamDestXML as defined in libvirt/libvirt-domain.h:879 + MigrateParamDestXML = "destination_xml" + // MigrateParamPersistXML as defined in libvirt/libvirt-domain.h:894 + MigrateParamPersistXML = "persistent_xml" + // MigrateParamBandwidth as defined in libvirt/libvirt-domain.h:904 + MigrateParamBandwidth = "bandwidth" + // MigrateParamGraphicsURI as defined in libvirt/libvirt-domain.h:925 + MigrateParamGraphicsURI = "graphics_uri" + // MigrateParamListenAddress as defined in libvirt/libvirt-domain.h:936 + MigrateParamListenAddress = "listen_address" + // MigrateParamMigrateDisks as defined in libvirt/libvirt-domain.h:945 + MigrateParamMigrateDisks = "migrate_disks" + // MigrateParamDisksPort as defined in libvirt/libvirt-domain.h:955 + MigrateParamDisksPort = "disks_port" + // MigrateParamCompression as defined in libvirt/libvirt-domain.h:965 + MigrateParamCompression = "compression" + // MigrateParamCompressionMtLevel as defined in libvirt/libvirt-domain.h:974 + MigrateParamCompressionMtLevel = "compression.mt.level" + // MigrateParamCompressionMtThreads as defined in libvirt/libvirt-domain.h:982 + MigrateParamCompressionMtThreads = "compression.mt.threads" + // MigrateParamCompressionMtDthreads as defined in libvirt/libvirt-domain.h:990 + MigrateParamCompressionMtDthreads = "compression.mt.dthreads" + // MigrateParamCompressionXbzrleCache as defined in libvirt/libvirt-domain.h:998 + MigrateParamCompressionXbzrleCache = "compression.xbzrle.cache" + // MigrateParamAutoConvergeInitial as defined in libvirt/libvirt-domain.h:1007 + MigrateParamAutoConvergeInitial = "auto_converge.initial" + // MigrateParamAutoConvergeIncrement as defined in libvirt/libvirt-domain.h:1017 + MigrateParamAutoConvergeIncrement = "auto_converge.increment" + // DomainCPUStatsCputime as defined in libvirt/libvirt-domain.h:1270 + DomainCPUStatsCputime = "cpu_time" + // DomainCPUStatsUsertime as defined in libvirt/libvirt-domain.h:1276 + DomainCPUStatsUsertime = "user_time" + // DomainCPUStatsSystemtime as defined in libvirt/libvirt-domain.h:1282 + DomainCPUStatsSystemtime = "system_time" + // DomainCPUStatsVcputime as defined in libvirt/libvirt-domain.h:1289 + DomainCPUStatsVcputime = "vcpu_time" + // DomainBlkioWeight as defined in libvirt/libvirt-domain.h:1318 + DomainBlkioWeight = "weight" + // DomainBlkioDeviceWeight as defined in libvirt/libvirt-domain.h:1328 + DomainBlkioDeviceWeight = "device_weight" + // DomainBlkioDeviceReadIops as defined in libvirt/libvirt-domain.h:1339 + DomainBlkioDeviceReadIops = "device_read_iops_sec" + // DomainBlkioDeviceWriteIops as defined in libvirt/libvirt-domain.h:1350 + DomainBlkioDeviceWriteIops = "device_write_iops_sec" + // DomainBlkioDeviceReadBps as defined in libvirt/libvirt-domain.h:1361 + DomainBlkioDeviceReadBps = "device_read_bytes_sec" + // DomainBlkioDeviceWriteBps as defined in libvirt/libvirt-domain.h:1372 + DomainBlkioDeviceWriteBps = "device_write_bytes_sec" + // DomainMemoryParamUnlimited as defined in libvirt/libvirt-domain.h:1391 + DomainMemoryParamUnlimited = 9007199254740991 + // DomainMemoryHardLimit as defined in libvirt/libvirt-domain.h:1400 + DomainMemoryHardLimit = "hard_limit" + // DomainMemorySoftLimit as defined in libvirt/libvirt-domain.h:1409 + DomainMemorySoftLimit = "soft_limit" + // DomainMemoryMinGuarantee as defined in libvirt/libvirt-domain.h:1418 + DomainMemoryMinGuarantee = "min_guarantee" + // DomainMemorySwapHardLimit as defined in libvirt/libvirt-domain.h:1428 + DomainMemorySwapHardLimit = "swap_hard_limit" + // DomainNumaNodeset as defined in libvirt/libvirt-domain.h:1473 + DomainNumaNodeset = "numa_nodeset" + // DomainNumaMode as defined in libvirt/libvirt-domain.h:1481 + DomainNumaMode = "numa_mode" + // DomainBandwidthInAverage as defined in libvirt/libvirt-domain.h:1593 + DomainBandwidthInAverage = "inbound.average" + // DomainBandwidthInPeak as defined in libvirt/libvirt-domain.h:1600 + DomainBandwidthInPeak = "inbound.peak" + // DomainBandwidthInBurst as defined in libvirt/libvirt-domain.h:1607 + DomainBandwidthInBurst = "inbound.burst" + // DomainBandwidthInFloor as defined in libvirt/libvirt-domain.h:1614 + DomainBandwidthInFloor = "inbound.floor" + // DomainBandwidthOutAverage as defined in libvirt/libvirt-domain.h:1621 + DomainBandwidthOutAverage = "outbound.average" + // DomainBandwidthOutPeak as defined in libvirt/libvirt-domain.h:1628 + DomainBandwidthOutPeak = "outbound.peak" + // DomainBandwidthOutBurst as defined in libvirt/libvirt-domain.h:1635 + DomainBandwidthOutBurst = "outbound.burst" + // DomainIothreadPollMaxNs as defined in libvirt/libvirt-domain.h:1929 + DomainIothreadPollMaxNs = "poll_max_ns" + // DomainIothreadPollGrow as defined in libvirt/libvirt-domain.h:1939 + DomainIothreadPollGrow = "poll_grow" + // DomainIothreadPollShrink as defined in libvirt/libvirt-domain.h:1950 + DomainIothreadPollShrink = "poll_shrink" + // PerfParamCmt as defined in libvirt/libvirt-domain.h:2141 + PerfParamCmt = "cmt" + // PerfParamMbmt as defined in libvirt/libvirt-domain.h:2152 + PerfParamMbmt = "mbmt" + // PerfParamMbml as defined in libvirt/libvirt-domain.h:2162 + PerfParamMbml = "mbml" + // PerfParamCacheMisses as defined in libvirt/libvirt-domain.h:2172 + PerfParamCacheMisses = "cache_misses" + // PerfParamCacheReferences as defined in libvirt/libvirt-domain.h:2182 + PerfParamCacheReferences = "cache_references" + // PerfParamInstructions as defined in libvirt/libvirt-domain.h:2192 + PerfParamInstructions = "instructions" + // PerfParamCPUCycles as defined in libvirt/libvirt-domain.h:2202 + PerfParamCPUCycles = "cpu_cycles" + // PerfParamBranchInstructions as defined in libvirt/libvirt-domain.h:2212 + PerfParamBranchInstructions = "branch_instructions" + // PerfParamBranchMisses as defined in libvirt/libvirt-domain.h:2222 + PerfParamBranchMisses = "branch_misses" + // PerfParamBusCycles as defined in libvirt/libvirt-domain.h:2232 + PerfParamBusCycles = "bus_cycles" + // PerfParamStalledCyclesFrontend as defined in libvirt/libvirt-domain.h:2243 + PerfParamStalledCyclesFrontend = "stalled_cycles_frontend" + // PerfParamStalledCyclesBackend as defined in libvirt/libvirt-domain.h:2254 + PerfParamStalledCyclesBackend = "stalled_cycles_backend" + // PerfParamRefCPUCycles as defined in libvirt/libvirt-domain.h:2265 + PerfParamRefCPUCycles = "ref_cpu_cycles" + // PerfParamCPUClock as defined in libvirt/libvirt-domain.h:2276 + PerfParamCPUClock = "cpu_clock" + // PerfParamTaskClock as defined in libvirt/libvirt-domain.h:2287 + PerfParamTaskClock = "task_clock" + // PerfParamPageFaults as defined in libvirt/libvirt-domain.h:2297 + PerfParamPageFaults = "page_faults" + // PerfParamContextSwitches as defined in libvirt/libvirt-domain.h:2307 + PerfParamContextSwitches = "context_switches" + // PerfParamCPUMigrations as defined in libvirt/libvirt-domain.h:2317 + PerfParamCPUMigrations = "cpu_migrations" + // PerfParamPageFaultsMin as defined in libvirt/libvirt-domain.h:2327 + PerfParamPageFaultsMin = "page_faults_min" + // PerfParamPageFaultsMaj as defined in libvirt/libvirt-domain.h:2337 + PerfParamPageFaultsMaj = "page_faults_maj" + // PerfParamAlignmentFaults as defined in libvirt/libvirt-domain.h:2347 + PerfParamAlignmentFaults = "alignment_faults" + // PerfParamEmulationFaults as defined in libvirt/libvirt-domain.h:2357 + PerfParamEmulationFaults = "emulation_faults" + // DomainBlockCopyBandwidth as defined in libvirt/libvirt-domain.h:2521 + DomainBlockCopyBandwidth = "bandwidth" + // DomainBlockCopyGranularity as defined in libvirt/libvirt-domain.h:2532 + DomainBlockCopyGranularity = "granularity" + // DomainBlockCopyBufSize as defined in libvirt/libvirt-domain.h:2541 + DomainBlockCopyBufSize = "buf-size" + // DomainBlockIotuneTotalBytesSec as defined in libvirt/libvirt-domain.h:2582 + DomainBlockIotuneTotalBytesSec = "total_bytes_sec" + // DomainBlockIotuneReadBytesSec as defined in libvirt/libvirt-domain.h:2590 + DomainBlockIotuneReadBytesSec = "read_bytes_sec" + // DomainBlockIotuneWriteBytesSec as defined in libvirt/libvirt-domain.h:2598 + DomainBlockIotuneWriteBytesSec = "write_bytes_sec" + // DomainBlockIotuneTotalIopsSec as defined in libvirt/libvirt-domain.h:2606 + DomainBlockIotuneTotalIopsSec = "total_iops_sec" + // DomainBlockIotuneReadIopsSec as defined in libvirt/libvirt-domain.h:2614 + DomainBlockIotuneReadIopsSec = "read_iops_sec" + // DomainBlockIotuneWriteIopsSec as defined in libvirt/libvirt-domain.h:2621 + DomainBlockIotuneWriteIopsSec = "write_iops_sec" + // DomainBlockIotuneTotalBytesSecMax as defined in libvirt/libvirt-domain.h:2629 + DomainBlockIotuneTotalBytesSecMax = "total_bytes_sec_max" + // DomainBlockIotuneReadBytesSecMax as defined in libvirt/libvirt-domain.h:2637 + DomainBlockIotuneReadBytesSecMax = "read_bytes_sec_max" + // DomainBlockIotuneWriteBytesSecMax as defined in libvirt/libvirt-domain.h:2645 + DomainBlockIotuneWriteBytesSecMax = "write_bytes_sec_max" + // DomainBlockIotuneTotalIopsSecMax as defined in libvirt/libvirt-domain.h:2653 + DomainBlockIotuneTotalIopsSecMax = "total_iops_sec_max" + // DomainBlockIotuneReadIopsSecMax as defined in libvirt/libvirt-domain.h:2661 + DomainBlockIotuneReadIopsSecMax = "read_iops_sec_max" + // DomainBlockIotuneWriteIopsSecMax as defined in libvirt/libvirt-domain.h:2668 + DomainBlockIotuneWriteIopsSecMax = "write_iops_sec_max" + // DomainBlockIotuneTotalBytesSecMaxLength as defined in libvirt/libvirt-domain.h:2676 + DomainBlockIotuneTotalBytesSecMaxLength = "total_bytes_sec_max_length" + // DomainBlockIotuneReadBytesSecMaxLength as defined in libvirt/libvirt-domain.h:2684 + DomainBlockIotuneReadBytesSecMaxLength = "read_bytes_sec_max_length" + // DomainBlockIotuneWriteBytesSecMaxLength as defined in libvirt/libvirt-domain.h:2692 + DomainBlockIotuneWriteBytesSecMaxLength = "write_bytes_sec_max_length" + // DomainBlockIotuneTotalIopsSecMaxLength as defined in libvirt/libvirt-domain.h:2700 + DomainBlockIotuneTotalIopsSecMaxLength = "total_iops_sec_max_length" + // DomainBlockIotuneReadIopsSecMaxLength as defined in libvirt/libvirt-domain.h:2708 + DomainBlockIotuneReadIopsSecMaxLength = "read_iops_sec_max_length" + // DomainBlockIotuneWriteIopsSecMaxLength as defined in libvirt/libvirt-domain.h:2716 + DomainBlockIotuneWriteIopsSecMaxLength = "write_iops_sec_max_length" + // DomainBlockIotuneSizeIopsSec as defined in libvirt/libvirt-domain.h:2723 + DomainBlockIotuneSizeIopsSec = "size_iops_sec" + // DomainBlockIotuneGroupName as defined in libvirt/libvirt-domain.h:2730 + DomainBlockIotuneGroupName = "group_name" + // KeycodeSetRfb as defined in libvirt/libvirt-domain.h:2811 + KeycodeSetRfb = 0 + // DomainSendKeyMaxKeys as defined in libvirt/libvirt-domain.h:2818 + DomainSendKeyMaxKeys = 16 + // DomainJobOperationStr as defined in libvirt/libvirt-domain.h:3230 + DomainJobOperationStr = "operation" + // DomainJobTimeElapsed as defined in libvirt/libvirt-domain.h:3240 + DomainJobTimeElapsed = "time_elapsed" + // DomainJobTimeElapsedNet as defined in libvirt/libvirt-domain.h:3250 + DomainJobTimeElapsedNet = "time_elapsed_net" + // DomainJobTimeRemaining as defined in libvirt/libvirt-domain.h:3260 + DomainJobTimeRemaining = "time_remaining" + // DomainJobDowntime as defined in libvirt/libvirt-domain.h:3270 + DomainJobDowntime = "downtime" + // DomainJobDowntimeNet as defined in libvirt/libvirt-domain.h:3279 + DomainJobDowntimeNet = "downtime_net" + // DomainJobSetupTime as defined in libvirt/libvirt-domain.h:3288 + DomainJobSetupTime = "setup_time" + // DomainJobDataTotal as defined in libvirt/libvirt-domain.h:3303 + DomainJobDataTotal = "data_total" + // DomainJobDataProcessed as defined in libvirt/libvirt-domain.h:3313 + DomainJobDataProcessed = "data_processed" + // DomainJobDataRemaining as defined in libvirt/libvirt-domain.h:3323 + DomainJobDataRemaining = "data_remaining" + // DomainJobMemoryTotal as defined in libvirt/libvirt-domain.h:3333 + DomainJobMemoryTotal = "memory_total" + // DomainJobMemoryProcessed as defined in libvirt/libvirt-domain.h:3343 + DomainJobMemoryProcessed = "memory_processed" + // DomainJobMemoryRemaining as defined in libvirt/libvirt-domain.h:3353 + DomainJobMemoryRemaining = "memory_remaining" + // DomainJobMemoryConstant as defined in libvirt/libvirt-domain.h:3365 + DomainJobMemoryConstant = "memory_constant" + // DomainJobMemoryNormal as defined in libvirt/libvirt-domain.h:3375 + DomainJobMemoryNormal = "memory_normal" + // DomainJobMemoryNormalBytes as defined in libvirt/libvirt-domain.h:3385 + DomainJobMemoryNormalBytes = "memory_normal_bytes" + // DomainJobMemoryBps as defined in libvirt/libvirt-domain.h:3393 + DomainJobMemoryBps = "memory_bps" + // DomainJobMemoryDirtyRate as defined in libvirt/libvirt-domain.h:3401 + DomainJobMemoryDirtyRate = "memory_dirty_rate" + // DomainJobMemoryPageSize as defined in libvirt/libvirt-domain.h:3412 + DomainJobMemoryPageSize = "memory_page_size" + // DomainJobMemoryIteration as defined in libvirt/libvirt-domain.h:3423 + DomainJobMemoryIteration = "memory_iteration" + // DomainJobMemoryPostcopyReqs as defined in libvirt/libvirt-domain.h:3433 + DomainJobMemoryPostcopyReqs = "memory_postcopy_requests" + // DomainJobDiskTotal as defined in libvirt/libvirt-domain.h:3443 + DomainJobDiskTotal = "disk_total" + // DomainJobDiskProcessed as defined in libvirt/libvirt-domain.h:3453 + DomainJobDiskProcessed = "disk_processed" + // DomainJobDiskRemaining as defined in libvirt/libvirt-domain.h:3463 + DomainJobDiskRemaining = "disk_remaining" + // DomainJobDiskBps as defined in libvirt/libvirt-domain.h:3471 + DomainJobDiskBps = "disk_bps" + // DomainJobCompressionCache as defined in libvirt/libvirt-domain.h:3480 + DomainJobCompressionCache = "compression_cache" + // DomainJobCompressionBytes as defined in libvirt/libvirt-domain.h:3488 + DomainJobCompressionBytes = "compression_bytes" + // DomainJobCompressionPages as defined in libvirt/libvirt-domain.h:3496 + DomainJobCompressionPages = "compression_pages" + // DomainJobCompressionCacheMisses as defined in libvirt/libvirt-domain.h:3505 + DomainJobCompressionCacheMisses = "compression_cache_misses" + // DomainJobCompressionOverflow as defined in libvirt/libvirt-domain.h:3515 + DomainJobCompressionOverflow = "compression_overflow" + // DomainJobAutoConvergeThrottle as defined in libvirt/libvirt-domain.h:3524 + DomainJobAutoConvergeThrottle = "auto_converge_throttle" + // DomainTunableCPUVcpupin as defined in libvirt/libvirt-domain.h:4078 + DomainTunableCPUVcpupin = "cputune.vcpupin%u" + // DomainTunableCPUEmulatorpin as defined in libvirt/libvirt-domain.h:4086 + DomainTunableCPUEmulatorpin = "cputune.emulatorpin" + // DomainTunableCPUIothreadspin as defined in libvirt/libvirt-domain.h:4095 + DomainTunableCPUIothreadspin = "cputune.iothreadpin%u" + // DomainTunableCPUCpuShares as defined in libvirt/libvirt-domain.h:4103 + DomainTunableCPUCpuShares = "cputune.cpu_shares" + // DomainTunableCPUGlobalPeriod as defined in libvirt/libvirt-domain.h:4111 + DomainTunableCPUGlobalPeriod = "cputune.global_period" + // DomainTunableCPUGlobalQuota as defined in libvirt/libvirt-domain.h:4119 + DomainTunableCPUGlobalQuota = "cputune.global_quota" + // DomainTunableCPUVCPUPeriod as defined in libvirt/libvirt-domain.h:4127 + DomainTunableCPUVCPUPeriod = "cputune.vcpu_period" + // DomainTunableCPUVCPUQuota as defined in libvirt/libvirt-domain.h:4135 + DomainTunableCPUVCPUQuota = "cputune.vcpu_quota" + // DomainTunableCPUEmulatorPeriod as defined in libvirt/libvirt-domain.h:4144 + DomainTunableCPUEmulatorPeriod = "cputune.emulator_period" + // DomainTunableCPUEmulatorQuota as defined in libvirt/libvirt-domain.h:4153 + DomainTunableCPUEmulatorQuota = "cputune.emulator_quota" + // DomainTunableCPUIothreadPeriod as defined in libvirt/libvirt-domain.h:4161 + DomainTunableCPUIothreadPeriod = "cputune.iothread_period" + // DomainTunableCPUIothreadQuota as defined in libvirt/libvirt-domain.h:4169 + DomainTunableCPUIothreadQuota = "cputune.iothread_quota" + // DomainTunableBlkdevDisk as defined in libvirt/libvirt-domain.h:4177 + DomainTunableBlkdevDisk = "blkdeviotune.disk" + // DomainTunableBlkdevTotalBytesSec as defined in libvirt/libvirt-domain.h:4185 + DomainTunableBlkdevTotalBytesSec = "blkdeviotune.total_bytes_sec" + // DomainTunableBlkdevReadBytesSec as defined in libvirt/libvirt-domain.h:4193 + DomainTunableBlkdevReadBytesSec = "blkdeviotune.read_bytes_sec" + // DomainTunableBlkdevWriteBytesSec as defined in libvirt/libvirt-domain.h:4201 + DomainTunableBlkdevWriteBytesSec = "blkdeviotune.write_bytes_sec" + // DomainTunableBlkdevTotalIopsSec as defined in libvirt/libvirt-domain.h:4209 + DomainTunableBlkdevTotalIopsSec = "blkdeviotune.total_iops_sec" + // DomainTunableBlkdevReadIopsSec as defined in libvirt/libvirt-domain.h:4217 + DomainTunableBlkdevReadIopsSec = "blkdeviotune.read_iops_sec" + // DomainTunableBlkdevWriteIopsSec as defined in libvirt/libvirt-domain.h:4225 + DomainTunableBlkdevWriteIopsSec = "blkdeviotune.write_iops_sec" + // DomainTunableBlkdevTotalBytesSecMax as defined in libvirt/libvirt-domain.h:4233 + DomainTunableBlkdevTotalBytesSecMax = "blkdeviotune.total_bytes_sec_max" + // DomainTunableBlkdevReadBytesSecMax as defined in libvirt/libvirt-domain.h:4241 + DomainTunableBlkdevReadBytesSecMax = "blkdeviotune.read_bytes_sec_max" + // DomainTunableBlkdevWriteBytesSecMax as defined in libvirt/libvirt-domain.h:4249 + DomainTunableBlkdevWriteBytesSecMax = "blkdeviotune.write_bytes_sec_max" + // DomainTunableBlkdevTotalIopsSecMax as defined in libvirt/libvirt-domain.h:4257 + DomainTunableBlkdevTotalIopsSecMax = "blkdeviotune.total_iops_sec_max" + // DomainTunableBlkdevReadIopsSecMax as defined in libvirt/libvirt-domain.h:4265 + DomainTunableBlkdevReadIopsSecMax = "blkdeviotune.read_iops_sec_max" + // DomainTunableBlkdevWriteIopsSecMax as defined in libvirt/libvirt-domain.h:4273 + DomainTunableBlkdevWriteIopsSecMax = "blkdeviotune.write_iops_sec_max" + // DomainTunableBlkdevSizeIopsSec as defined in libvirt/libvirt-domain.h:4281 + DomainTunableBlkdevSizeIopsSec = "blkdeviotune.size_iops_sec" + // DomainTunableBlkdevGroupName as defined in libvirt/libvirt-domain.h:4289 + DomainTunableBlkdevGroupName = "blkdeviotune.group_name" + // DomainTunableBlkdevTotalBytesSecMaxLength as defined in libvirt/libvirt-domain.h:4298 + DomainTunableBlkdevTotalBytesSecMaxLength = "blkdeviotune.total_bytes_sec_max_length" + // DomainTunableBlkdevReadBytesSecMaxLength as defined in libvirt/libvirt-domain.h:4307 + DomainTunableBlkdevReadBytesSecMaxLength = "blkdeviotune.read_bytes_sec_max_length" + // DomainTunableBlkdevWriteBytesSecMaxLength as defined in libvirt/libvirt-domain.h:4316 + DomainTunableBlkdevWriteBytesSecMaxLength = "blkdeviotune.write_bytes_sec_max_length" + // DomainTunableBlkdevTotalIopsSecMaxLength as defined in libvirt/libvirt-domain.h:4325 + DomainTunableBlkdevTotalIopsSecMaxLength = "blkdeviotune.total_iops_sec_max_length" + // DomainTunableBlkdevReadIopsSecMaxLength as defined in libvirt/libvirt-domain.h:4334 + DomainTunableBlkdevReadIopsSecMaxLength = "blkdeviotune.read_iops_sec_max_length" + // DomainTunableBlkdevWriteIopsSecMaxLength as defined in libvirt/libvirt-domain.h:4343 + DomainTunableBlkdevWriteIopsSecMaxLength = "blkdeviotune.write_iops_sec_max_length" + // DomainSchedFieldLength as defined in libvirt/libvirt-domain.h:4631 + DomainSchedFieldLength = 80 + // DomainBlkioFieldLength as defined in libvirt/libvirt-domain.h:4675 + DomainBlkioFieldLength = 80 + // DomainMemoryFieldLength as defined in libvirt/libvirt-domain.h:4719 + DomainMemoryFieldLength = 80 + // DomainLaunchSecuritySevMeasurement as defined in libvirt/libvirt-domain.h:4845 + DomainLaunchSecuritySevMeasurement = "sev-measurement" +) + +// ConnectCloseReason as declared in libvirt/libvirt-common.h:119 +type ConnectCloseReason int32 + +// ConnectCloseReason enumeration from libvirt/libvirt-common.h:119 +const ( + ConnectCloseReasonError ConnectCloseReason = iota + ConnectCloseReasonEOF ConnectCloseReason = 1 + ConnectCloseReasonKeepalive ConnectCloseReason = 2 + ConnectCloseReasonClient ConnectCloseReason = 3 +) + +// TypedParameterType as declared in libvirt/libvirt-common.h:138 +type TypedParameterType int32 + +// TypedParameterType enumeration from libvirt/libvirt-common.h:138 +const ( + TypedParamInt TypedParameterType = 1 + TypedParamUint TypedParameterType = 2 + TypedParamLlong TypedParameterType = 3 + TypedParamUllong TypedParameterType = 4 + TypedParamDouble TypedParameterType = 5 + TypedParamBoolean TypedParameterType = 6 + TypedParamString TypedParameterType = 7 +) + +// TypedParameterFlags as declared in libvirt/libvirt-common.h:163 +type TypedParameterFlags int32 + +// TypedParameterFlags enumeration from libvirt/libvirt-common.h:163 +const ( + TypedParamStringOkay TypedParameterFlags = 4 +) + +// NodeSuspendTarget as declared in libvirt/libvirt-host.h:61 +type NodeSuspendTarget int32 + +// NodeSuspendTarget enumeration from libvirt/libvirt-host.h:61 +const ( + NodeSuspendTargetMem NodeSuspendTarget = iota + NodeSuspendTargetDisk NodeSuspendTarget = 1 + NodeSuspendTargetHybrid NodeSuspendTarget = 2 +) + +// NodeGetCPUStatsAllCPUs as declared in libvirt/libvirt-host.h:185 +type NodeGetCPUStatsAllCPUs int32 + +// NodeGetCPUStatsAllCPUs enumeration from libvirt/libvirt-host.h:185 +const ( + NodeCPUStatsAllCpus NodeGetCPUStatsAllCPUs = -1 +) + +// NodeGetMemoryStatsAllCells as declared in libvirt/libvirt-host.h:263 +type NodeGetMemoryStatsAllCells int32 + +// NodeGetMemoryStatsAllCells enumeration from libvirt/libvirt-host.h:263 +const ( + NodeMemoryStatsAllCells NodeGetMemoryStatsAllCells = -1 +) + +// ConnectFlags as declared in libvirt/libvirt-host.h:484 +type ConnectFlags int32 + +// ConnectFlags enumeration from libvirt/libvirt-host.h:484 +const ( + ConnectRo ConnectFlags = 1 + ConnectNoAliases ConnectFlags = 2 +) + +// ConnectCredentialType as declared in libvirt/libvirt-host.h:501 +type ConnectCredentialType int32 + +// ConnectCredentialType enumeration from libvirt/libvirt-host.h:501 +const ( + CredUsername ConnectCredentialType = 1 + CredAuthname ConnectCredentialType = 2 + CredLanguage ConnectCredentialType = 3 + CredCnonce ConnectCredentialType = 4 + CredPassphrase ConnectCredentialType = 5 + CredEchoprompt ConnectCredentialType = 6 + CredNoechoprompt ConnectCredentialType = 7 + CredRealm ConnectCredentialType = 8 + CredExternal ConnectCredentialType = 9 +) + +// CPUCompareResult as declared in libvirt/libvirt-host.h:674 +type CPUCompareResult int32 + +// CPUCompareResult enumeration from libvirt/libvirt-host.h:674 +const ( + CPUCompareError CPUCompareResult = -1 + CPUCompareIncompatible CPUCompareResult = 0 + CPUCompareIdentical CPUCompareResult = 1 + CPUCompareSuperset CPUCompareResult = 2 +) + +// ConnectCompareCPUFlags as declared in libvirt/libvirt-host.h:679 +type ConnectCompareCPUFlags int32 + +// ConnectCompareCPUFlags enumeration from libvirt/libvirt-host.h:679 +const ( + ConnectCompareCPUFailIncompatible ConnectCompareCPUFlags = 1 +) + +// ConnectBaselineCPUFlags as declared in libvirt/libvirt-host.h:705 +type ConnectBaselineCPUFlags int32 + +// ConnectBaselineCPUFlags enumeration from libvirt/libvirt-host.h:705 +const ( + ConnectBaselineCPUExpandFeatures ConnectBaselineCPUFlags = 1 + ConnectBaselineCPUMigratable ConnectBaselineCPUFlags = 2 +) + +// NodeAllocPagesFlags as declared in libvirt/libvirt-host.h:735 +type NodeAllocPagesFlags int32 + +// NodeAllocPagesFlags enumeration from libvirt/libvirt-host.h:735 +const ( + NodeAllocPagesAdd NodeAllocPagesFlags = iota + NodeAllocPagesSet NodeAllocPagesFlags = 1 +) + +// DomainState as declared in libvirt/libvirt-domain.h:70 +type DomainState int32 + +// DomainState enumeration from libvirt/libvirt-domain.h:70 +const ( + DomainNostate DomainState = iota + DomainRunning DomainState = 1 + DomainBlocked DomainState = 2 + DomainPaused DomainState = 3 + DomainShutdown DomainState = 4 + DomainShutoff DomainState = 5 + DomainCrashed DomainState = 6 + DomainPmsuspended DomainState = 7 +) + +// DomainNostateReason as declared in libvirt/libvirt-domain.h:78 +type DomainNostateReason int32 + +// DomainNostateReason enumeration from libvirt/libvirt-domain.h:78 +const ( + DomainNostateUnknown DomainNostateReason = iota +) + +// DomainRunningReason as declared in libvirt/libvirt-domain.h:97 +type DomainRunningReason int32 + +// DomainRunningReason enumeration from libvirt/libvirt-domain.h:97 +const ( + DomainRunningUnknown DomainRunningReason = iota + DomainRunningBooted DomainRunningReason = 1 + DomainRunningMigrated DomainRunningReason = 2 + DomainRunningRestored DomainRunningReason = 3 + DomainRunningFromSnapshot DomainRunningReason = 4 + DomainRunningUnpaused DomainRunningReason = 5 + DomainRunningMigrationCanceled DomainRunningReason = 6 + DomainRunningSaveCanceled DomainRunningReason = 7 + DomainRunningWakeup DomainRunningReason = 8 + DomainRunningCrashed DomainRunningReason = 9 + DomainRunningPostcopy DomainRunningReason = 10 +) + +// DomainBlockedReason as declared in libvirt/libvirt-domain.h:105 +type DomainBlockedReason int32 + +// DomainBlockedReason enumeration from libvirt/libvirt-domain.h:105 +const ( + DomainBlockedUnknown DomainBlockedReason = iota +) + +// DomainPausedReason as declared in libvirt/libvirt-domain.h:126 +type DomainPausedReason int32 + +// DomainPausedReason enumeration from libvirt/libvirt-domain.h:126 +const ( + DomainPausedUnknown DomainPausedReason = iota + DomainPausedUser DomainPausedReason = 1 + DomainPausedMigration DomainPausedReason = 2 + DomainPausedSave DomainPausedReason = 3 + DomainPausedDump DomainPausedReason = 4 + DomainPausedIoerror DomainPausedReason = 5 + DomainPausedWatchdog DomainPausedReason = 6 + DomainPausedFromSnapshot DomainPausedReason = 7 + DomainPausedShuttingDown DomainPausedReason = 8 + DomainPausedSnapshot DomainPausedReason = 9 + DomainPausedCrashed DomainPausedReason = 10 + DomainPausedStartingUp DomainPausedReason = 11 + DomainPausedPostcopy DomainPausedReason = 12 + DomainPausedPostcopyFailed DomainPausedReason = 13 +) + +// DomainShutdownReason as declared in libvirt/libvirt-domain.h:135 +type DomainShutdownReason int32 + +// DomainShutdownReason enumeration from libvirt/libvirt-domain.h:135 +const ( + DomainShutdownUnknown DomainShutdownReason = iota + DomainShutdownUser DomainShutdownReason = 1 +) + +// DomainShutoffReason as declared in libvirt/libvirt-domain.h:152 +type DomainShutoffReason int32 + +// DomainShutoffReason enumeration from libvirt/libvirt-domain.h:152 +const ( + DomainShutoffUnknown DomainShutoffReason = iota + DomainShutoffShutdown DomainShutoffReason = 1 + DomainShutoffDestroyed DomainShutoffReason = 2 + DomainShutoffCrashed DomainShutoffReason = 3 + DomainShutoffMigrated DomainShutoffReason = 4 + DomainShutoffSaved DomainShutoffReason = 5 + DomainShutoffFailed DomainShutoffReason = 6 + DomainShutoffFromSnapshot DomainShutoffReason = 7 + DomainShutoffDaemon DomainShutoffReason = 8 +) + +// DomainCrashedReason as declared in libvirt/libvirt-domain.h:161 +type DomainCrashedReason int32 + +// DomainCrashedReason enumeration from libvirt/libvirt-domain.h:161 +const ( + DomainCrashedUnknown DomainCrashedReason = iota + DomainCrashedPanicked DomainCrashedReason = 1 +) + +// DomainPMSuspendedReason as declared in libvirt/libvirt-domain.h:169 +type DomainPMSuspendedReason int32 + +// DomainPMSuspendedReason enumeration from libvirt/libvirt-domain.h:169 +const ( + DomainPmsuspendedUnknown DomainPMSuspendedReason = iota +) + +// DomainPMSuspendedDiskReason as declared in libvirt/libvirt-domain.h:177 +type DomainPMSuspendedDiskReason int32 + +// DomainPMSuspendedDiskReason enumeration from libvirt/libvirt-domain.h:177 +const ( + DomainPmsuspendedDiskUnknown DomainPMSuspendedDiskReason = iota +) + +// DomainControlState as declared in libvirt/libvirt-domain.h:197 +type DomainControlState int32 + +// DomainControlState enumeration from libvirt/libvirt-domain.h:197 +const ( + DomainControlOk DomainControlState = iota + DomainControlJob DomainControlState = 1 + DomainControlOccupied DomainControlState = 2 + DomainControlError DomainControlState = 3 +) + +// DomainControlErrorReason as declared in libvirt/libvirt-domain.h:217 +type DomainControlErrorReason int32 + +// DomainControlErrorReason enumeration from libvirt/libvirt-domain.h:217 +const ( + DomainControlErrorReasonNone DomainControlErrorReason = iota + DomainControlErrorReasonUnknown DomainControlErrorReason = 1 + DomainControlErrorReasonMonitor DomainControlErrorReason = 2 + DomainControlErrorReasonInternal DomainControlErrorReason = 3 +) + +// DomainModificationImpact as declared in libvirt/libvirt-domain.h:265 +type DomainModificationImpact int32 + +// DomainModificationImpact enumeration from libvirt/libvirt-domain.h:265 +const ( + DomainAffectCurrent DomainModificationImpact = iota + DomainAffectLive DomainModificationImpact = 1 + DomainAffectConfig DomainModificationImpact = 2 +) + +// DomainCreateFlags as declared in libvirt/libvirt-domain.h:305 +type DomainCreateFlags int32 + +// DomainCreateFlags enumeration from libvirt/libvirt-domain.h:305 +const ( + DomainNone DomainCreateFlags = iota + DomainStartPaused DomainCreateFlags = 1 + DomainStartAutodestroy DomainCreateFlags = 2 + DomainStartBypassCache DomainCreateFlags = 4 + DomainStartForceBoot DomainCreateFlags = 8 + DomainStartValidate DomainCreateFlags = 16 +) + +// DomainMemoryStatTags as declared in libvirt/libvirt-domain.h:648 +type DomainMemoryStatTags int32 + +// DomainMemoryStatTags enumeration from libvirt/libvirt-domain.h:648 +const ( + DomainMemoryStatSwapIn DomainMemoryStatTags = iota + DomainMemoryStatSwapOut DomainMemoryStatTags = 1 + DomainMemoryStatMajorFault DomainMemoryStatTags = 2 + DomainMemoryStatMinorFault DomainMemoryStatTags = 3 + DomainMemoryStatUnused DomainMemoryStatTags = 4 + DomainMemoryStatAvailable DomainMemoryStatTags = 5 + DomainMemoryStatActualBalloon DomainMemoryStatTags = 6 + DomainMemoryStatRss DomainMemoryStatTags = 7 + DomainMemoryStatUsable DomainMemoryStatTags = 8 + DomainMemoryStatLastUpdate DomainMemoryStatTags = 9 + DomainMemoryStatDiskCaches DomainMemoryStatTags = 10 + DomainMemoryStatNr DomainMemoryStatTags = 11 +) + +// DomainCoreDumpFlags as declared in libvirt/libvirt-domain.h:667 +type DomainCoreDumpFlags int32 + +// DomainCoreDumpFlags enumeration from libvirt/libvirt-domain.h:667 +const ( + DumpCrash DomainCoreDumpFlags = 1 + DumpLive DomainCoreDumpFlags = 2 + DumpBypassCache DomainCoreDumpFlags = 4 + DumpReset DomainCoreDumpFlags = 8 + DumpMemoryOnly DomainCoreDumpFlags = 16 +) + +// DomainCoreDumpFormat as declared in libvirt/libvirt-domain.h:690 +type DomainCoreDumpFormat int32 + +// DomainCoreDumpFormat enumeration from libvirt/libvirt-domain.h:690 +const ( + DomainCoreDumpFormatRaw DomainCoreDumpFormat = iota + DomainCoreDumpFormatKdumpZlib DomainCoreDumpFormat = 1 + DomainCoreDumpFormatKdumpLzo DomainCoreDumpFormat = 2 + DomainCoreDumpFormatKdumpSnappy DomainCoreDumpFormat = 3 +) + +// DomainMigrateFlags as declared in libvirt/libvirt-domain.h:834 +type DomainMigrateFlags int32 + +// DomainMigrateFlags enumeration from libvirt/libvirt-domain.h:834 +const ( + MigrateLive DomainMigrateFlags = 1 + MigratePeer2peer DomainMigrateFlags = 2 + MigrateTunnelled DomainMigrateFlags = 4 + MigratePersistDest DomainMigrateFlags = 8 + MigrateUndefineSource DomainMigrateFlags = 16 + MigratePaused DomainMigrateFlags = 32 + MigrateNonSharedDisk DomainMigrateFlags = 64 + MigrateNonSharedInc DomainMigrateFlags = 128 + MigrateChangeProtection DomainMigrateFlags = 256 + MigrateUnsafe DomainMigrateFlags = 512 + MigrateOffline DomainMigrateFlags = 1024 + MigrateCompressed DomainMigrateFlags = 2048 + MigrateAbortOnError DomainMigrateFlags = 4096 + MigrateAutoConverge DomainMigrateFlags = 8192 + MigrateRdmaPinAll DomainMigrateFlags = 16384 + MigratePostcopy DomainMigrateFlags = 32768 + MigrateTLS DomainMigrateFlags = 65536 +) + +// DomainShutdownFlagValues as declared in libvirt/libvirt-domain.h:1129 +type DomainShutdownFlagValues int32 + +// DomainShutdownFlagValues enumeration from libvirt/libvirt-domain.h:1129 +const ( + DomainShutdownDefault DomainShutdownFlagValues = iota + DomainShutdownAcpiPowerBtn DomainShutdownFlagValues = 1 + DomainShutdownGuestAgent DomainShutdownFlagValues = 2 + DomainShutdownInitctl DomainShutdownFlagValues = 4 + DomainShutdownSignal DomainShutdownFlagValues = 8 + DomainShutdownParavirt DomainShutdownFlagValues = 16 +) + +// DomainRebootFlagValues as declared in libvirt/libvirt-domain.h:1142 +type DomainRebootFlagValues int32 + +// DomainRebootFlagValues enumeration from libvirt/libvirt-domain.h:1142 +const ( + DomainRebootDefault DomainRebootFlagValues = iota + DomainRebootAcpiPowerBtn DomainRebootFlagValues = 1 + DomainRebootGuestAgent DomainRebootFlagValues = 2 + DomainRebootInitctl DomainRebootFlagValues = 4 + DomainRebootSignal DomainRebootFlagValues = 8 + DomainRebootParavirt DomainRebootFlagValues = 16 +) + +// DomainDestroyFlagsValues as declared in libvirt/libvirt-domain.h:1160 +type DomainDestroyFlagsValues int32 + +// DomainDestroyFlagsValues enumeration from libvirt/libvirt-domain.h:1160 +const ( + DomainDestroyDefault DomainDestroyFlagsValues = iota + DomainDestroyGraceful DomainDestroyFlagsValues = 1 +) + +// DomainSaveRestoreFlags as declared in libvirt/libvirt-domain.h:1192 +type DomainSaveRestoreFlags int32 + +// DomainSaveRestoreFlags enumeration from libvirt/libvirt-domain.h:1192 +const ( + DomainSaveBypassCache DomainSaveRestoreFlags = 1 + DomainSaveRunning DomainSaveRestoreFlags = 2 + DomainSavePaused DomainSaveRestoreFlags = 4 +) + +// DomainMemoryModFlags as declared in libvirt/libvirt-domain.h:1447 +type DomainMemoryModFlags int32 + +// DomainMemoryModFlags enumeration from libvirt/libvirt-domain.h:1447 +const ( + DomainMemCurrent DomainMemoryModFlags = iota + DomainMemLive DomainMemoryModFlags = 1 + DomainMemConfig DomainMemoryModFlags = 2 + DomainMemMaximum DomainMemoryModFlags = 4 +) + +// DomainNumatuneMemMode as declared in libvirt/libvirt-domain.h:1465 +type DomainNumatuneMemMode int32 + +// DomainNumatuneMemMode enumeration from libvirt/libvirt-domain.h:1465 +const ( + DomainNumatuneMemStrict DomainNumatuneMemMode = iota + DomainNumatuneMemPreferred DomainNumatuneMemMode = 1 + DomainNumatuneMemInterleave DomainNumatuneMemMode = 2 +) + +// DomainMetadataType as declared in libvirt/libvirt-domain.h:1527 +type DomainMetadataType int32 + +// DomainMetadataType enumeration from libvirt/libvirt-domain.h:1527 +const ( + DomainMetadataDescription DomainMetadataType = iota + DomainMetadataTitle DomainMetadataType = 1 + DomainMetadataElement DomainMetadataType = 2 +) + +// DomainXMLFlags as declared in libvirt/libvirt-domain.h:1557 +type DomainXMLFlags int32 + +// DomainXMLFlags enumeration from libvirt/libvirt-domain.h:1557 +const ( + DomainXMLSecure DomainXMLFlags = 1 + DomainXMLInactive DomainXMLFlags = 2 + DomainXMLUpdateCPU DomainXMLFlags = 4 + DomainXMLMigratable DomainXMLFlags = 8 +) + +// DomainBlockResizeFlags as declared in libvirt/libvirt-domain.h:1662 +type DomainBlockResizeFlags int32 + +// DomainBlockResizeFlags enumeration from libvirt/libvirt-domain.h:1662 +const ( + DomainBlockResizeBytes DomainBlockResizeFlags = 1 +) + +// DomainMemoryFlags as declared in libvirt/libvirt-domain.h:1725 +type DomainMemoryFlags int32 + +// DomainMemoryFlags enumeration from libvirt/libvirt-domain.h:1725 +const ( + MemoryVirtual DomainMemoryFlags = 1 + MemoryPhysical DomainMemoryFlags = 2 +) + +// DomainDefineFlags as declared in libvirt/libvirt-domain.h:1735 +type DomainDefineFlags int32 + +// DomainDefineFlags enumeration from libvirt/libvirt-domain.h:1735 +const ( + DomainDefineValidate DomainDefineFlags = 1 +) + +// DomainUndefineFlagsValues as declared in libvirt/libvirt-domain.h:1759 +type DomainUndefineFlagsValues int32 + +// DomainUndefineFlagsValues enumeration from libvirt/libvirt-domain.h:1759 +const ( + DomainUndefineManagedSave DomainUndefineFlagsValues = 1 + DomainUndefineSnapshotsMetadata DomainUndefineFlagsValues = 2 + DomainUndefineNvram DomainUndefineFlagsValues = 4 + DomainUndefineKeepNvram DomainUndefineFlagsValues = 8 +) + +// ConnectListAllDomainsFlags as declared in libvirt/libvirt-domain.h:1795 +type ConnectListAllDomainsFlags int32 + +// ConnectListAllDomainsFlags enumeration from libvirt/libvirt-domain.h:1795 +const ( + ConnectListDomainsActive ConnectListAllDomainsFlags = 1 + ConnectListDomainsInactive ConnectListAllDomainsFlags = 2 + ConnectListDomainsPersistent ConnectListAllDomainsFlags = 4 + ConnectListDomainsTransient ConnectListAllDomainsFlags = 8 + ConnectListDomainsRunning ConnectListAllDomainsFlags = 16 + ConnectListDomainsPaused ConnectListAllDomainsFlags = 32 + ConnectListDomainsShutoff ConnectListAllDomainsFlags = 64 + ConnectListDomainsOther ConnectListAllDomainsFlags = 128 + ConnectListDomainsManagedsave ConnectListAllDomainsFlags = 256 + ConnectListDomainsNoManagedsave ConnectListAllDomainsFlags = 512 + ConnectListDomainsAutostart ConnectListAllDomainsFlags = 1024 + ConnectListDomainsNoAutostart ConnectListAllDomainsFlags = 2048 + ConnectListDomainsHasSnapshot ConnectListAllDomainsFlags = 4096 + ConnectListDomainsNoSnapshot ConnectListAllDomainsFlags = 8192 +) + +// VCPUState as declared in libvirt/libvirt-domain.h:1826 +type VCPUState int32 + +// VCPUState enumeration from libvirt/libvirt-domain.h:1826 +const ( + VCPUOffline VCPUState = iota + VCPURunning VCPUState = 1 + VCPUBlocked VCPUState = 2 +) + +// DomainVCPUFlags as declared in libvirt/libvirt-domain.h:1848 +type DomainVCPUFlags int32 + +// DomainVCPUFlags enumeration from libvirt/libvirt-domain.h:1848 +const ( + DomainVCPUCurrent DomainVCPUFlags = iota + DomainVCPULive DomainVCPUFlags = 1 + DomainVCPUConfig DomainVCPUFlags = 2 + DomainVCPUMaximum DomainVCPUFlags = 4 + DomainVCPUGuest DomainVCPUFlags = 8 + DomainVCPUHotpluggable DomainVCPUFlags = 16 +) + +// DomainDeviceModifyFlags as declared in libvirt/libvirt-domain.h:2065 +type DomainDeviceModifyFlags int32 + +// DomainDeviceModifyFlags enumeration from libvirt/libvirt-domain.h:2065 +const ( + DomainDeviceModifyCurrent DomainDeviceModifyFlags = iota + DomainDeviceModifyLive DomainDeviceModifyFlags = 1 + DomainDeviceModifyConfig DomainDeviceModifyFlags = 2 + DomainDeviceModifyForce DomainDeviceModifyFlags = 4 +) + +// DomainStatsTypes as declared in libvirt/libvirt-domain.h:2097 +type DomainStatsTypes int32 + +// DomainStatsTypes enumeration from libvirt/libvirt-domain.h:2097 +const ( + DomainStatsState DomainStatsTypes = 1 + DomainStatsCPUTotal DomainStatsTypes = 2 + DomainStatsBalloon DomainStatsTypes = 4 + DomainStatsVCPU DomainStatsTypes = 8 + DomainStatsInterface DomainStatsTypes = 16 + DomainStatsBlock DomainStatsTypes = 32 + DomainStatsPerf DomainStatsTypes = 64 + DomainStatsIothread DomainStatsTypes = 128 +) + +// ConnectGetAllDomainStatsFlags as declared in libvirt/libvirt-domain.h:2115 +type ConnectGetAllDomainStatsFlags int32 + +// ConnectGetAllDomainStatsFlags enumeration from libvirt/libvirt-domain.h:2115 +const ( + ConnectGetAllDomainsStatsActive ConnectGetAllDomainStatsFlags = 1 + ConnectGetAllDomainsStatsInactive ConnectGetAllDomainStatsFlags = 2 + ConnectGetAllDomainsStatsPersistent ConnectGetAllDomainStatsFlags = 4 + ConnectGetAllDomainsStatsTransient ConnectGetAllDomainStatsFlags = 8 + ConnectGetAllDomainsStatsRunning ConnectGetAllDomainStatsFlags = 16 + ConnectGetAllDomainsStatsPaused ConnectGetAllDomainStatsFlags = 32 + ConnectGetAllDomainsStatsShutoff ConnectGetAllDomainStatsFlags = 64 + ConnectGetAllDomainsStatsOther ConnectGetAllDomainStatsFlags = 128 + ConnectGetAllDomainsStatsNowait ConnectGetAllDomainStatsFlags = 536870912 + ConnectGetAllDomainsStatsBacking ConnectGetAllDomainStatsFlags = 1073741824 + ConnectGetAllDomainsStatsEnforceStats ConnectGetAllDomainStatsFlags = -2147483648 +) + +// DomainBlockJobType as declared in libvirt/libvirt-domain.h:2399 +type DomainBlockJobType int32 + +// DomainBlockJobType enumeration from libvirt/libvirt-domain.h:2399 +const ( + DomainBlockJobTypeUnknown DomainBlockJobType = iota + DomainBlockJobTypePull DomainBlockJobType = 1 + DomainBlockJobTypeCopy DomainBlockJobType = 2 + DomainBlockJobTypeCommit DomainBlockJobType = 3 + DomainBlockJobTypeActiveCommit DomainBlockJobType = 4 +) + +// DomainBlockJobAbortFlags as declared in libvirt/libvirt-domain.h:2411 +type DomainBlockJobAbortFlags int32 + +// DomainBlockJobAbortFlags enumeration from libvirt/libvirt-domain.h:2411 +const ( + DomainBlockJobAbortAsync DomainBlockJobAbortFlags = 1 + DomainBlockJobAbortPivot DomainBlockJobAbortFlags = 2 +) + +// DomainBlockJobInfoFlags as declared in libvirt/libvirt-domain.h:2420 +type DomainBlockJobInfoFlags int32 + +// DomainBlockJobInfoFlags enumeration from libvirt/libvirt-domain.h:2420 +const ( + DomainBlockJobInfoBandwidthBytes DomainBlockJobInfoFlags = 1 +) + +// DomainBlockJobSetSpeedFlags as declared in libvirt/libvirt-domain.h:2449 +type DomainBlockJobSetSpeedFlags int32 + +// DomainBlockJobSetSpeedFlags enumeration from libvirt/libvirt-domain.h:2449 +const ( + DomainBlockJobSpeedBandwidthBytes DomainBlockJobSetSpeedFlags = 1 +) + +// DomainBlockPullFlags as declared in libvirt/libvirt-domain.h:2459 +type DomainBlockPullFlags int32 + +// DomainBlockPullFlags enumeration from libvirt/libvirt-domain.h:2459 +const ( + DomainBlockPullBandwidthBytes DomainBlockPullFlags = 64 +) + +// DomainBlockRebaseFlags as declared in libvirt/libvirt-domain.h:2483 +type DomainBlockRebaseFlags int32 + +// DomainBlockRebaseFlags enumeration from libvirt/libvirt-domain.h:2483 +const ( + DomainBlockRebaseShallow DomainBlockRebaseFlags = 1 + DomainBlockRebaseReuseExt DomainBlockRebaseFlags = 2 + DomainBlockRebaseCopyRaw DomainBlockRebaseFlags = 4 + DomainBlockRebaseCopy DomainBlockRebaseFlags = 8 + DomainBlockRebaseRelative DomainBlockRebaseFlags = 16 + DomainBlockRebaseCopyDev DomainBlockRebaseFlags = 32 + DomainBlockRebaseBandwidthBytes DomainBlockRebaseFlags = 64 +) + +// DomainBlockCopyFlags as declared in libvirt/libvirt-domain.h:2502 +type DomainBlockCopyFlags int32 + +// DomainBlockCopyFlags enumeration from libvirt/libvirt-domain.h:2502 +const ( + DomainBlockCopyShallow DomainBlockCopyFlags = 1 + DomainBlockCopyReuseExt DomainBlockCopyFlags = 2 + DomainBlockCopyTransientJob DomainBlockCopyFlags = 4 +) + +// DomainBlockCommitFlags as declared in libvirt/libvirt-domain.h:2567 +type DomainBlockCommitFlags int32 + +// DomainBlockCommitFlags enumeration from libvirt/libvirt-domain.h:2567 +const ( + DomainBlockCommitShallow DomainBlockCommitFlags = 1 + DomainBlockCommitDelete DomainBlockCommitFlags = 2 + DomainBlockCommitActive DomainBlockCommitFlags = 4 + DomainBlockCommitRelative DomainBlockCommitFlags = 8 + DomainBlockCommitBandwidthBytes DomainBlockCommitFlags = 16 +) + +// DomainDiskErrorCode as declared in libvirt/libvirt-domain.h:2758 +type DomainDiskErrorCode int32 + +// DomainDiskErrorCode enumeration from libvirt/libvirt-domain.h:2758 +const ( + DomainDiskErrorNone DomainDiskErrorCode = iota + DomainDiskErrorUnspec DomainDiskErrorCode = 1 + DomainDiskErrorNoSpace DomainDiskErrorCode = 2 +) + +// KeycodeSet as declared in libvirt/libvirt-domain.h:2804 +type KeycodeSet int32 + +// KeycodeSet enumeration from libvirt/libvirt-domain.h:2804 +const ( + KeycodeSetLinux KeycodeSet = iota + KeycodeSetXt KeycodeSet = 1 + KeycodeSetAtset1 KeycodeSet = 2 + KeycodeSetAtset2 KeycodeSet = 3 + KeycodeSetAtset3 KeycodeSet = 4 + KeycodeSetOsx KeycodeSet = 5 + KeycodeSetXtKbd KeycodeSet = 6 + KeycodeSetUsb KeycodeSet = 7 + KeycodeSetWin32 KeycodeSet = 8 + KeycodeSetQnum KeycodeSet = 9 +) + +// DomainProcessSignal as declared in libvirt/libvirt-domain.h:2913 +type DomainProcessSignal int32 + +// DomainProcessSignal enumeration from libvirt/libvirt-domain.h:2913 +const ( + DomainProcessSignalNop DomainProcessSignal = iota + DomainProcessSignalHup DomainProcessSignal = 1 + DomainProcessSignalInt DomainProcessSignal = 2 + DomainProcessSignalQuit DomainProcessSignal = 3 + DomainProcessSignalIll DomainProcessSignal = 4 + DomainProcessSignalTrap DomainProcessSignal = 5 + DomainProcessSignalAbrt DomainProcessSignal = 6 + DomainProcessSignalBus DomainProcessSignal = 7 + DomainProcessSignalFpe DomainProcessSignal = 8 + DomainProcessSignalKill DomainProcessSignal = 9 + DomainProcessSignalUsr1 DomainProcessSignal = 10 + DomainProcessSignalSegv DomainProcessSignal = 11 + DomainProcessSignalUsr2 DomainProcessSignal = 12 + DomainProcessSignalPipe DomainProcessSignal = 13 + DomainProcessSignalAlrm DomainProcessSignal = 14 + DomainProcessSignalTerm DomainProcessSignal = 15 + DomainProcessSignalStkflt DomainProcessSignal = 16 + DomainProcessSignalChld DomainProcessSignal = 17 + DomainProcessSignalCont DomainProcessSignal = 18 + DomainProcessSignalStop DomainProcessSignal = 19 + DomainProcessSignalTstp DomainProcessSignal = 20 + DomainProcessSignalTtin DomainProcessSignal = 21 + DomainProcessSignalTtou DomainProcessSignal = 22 + DomainProcessSignalUrg DomainProcessSignal = 23 + DomainProcessSignalXcpu DomainProcessSignal = 24 + DomainProcessSignalXfsz DomainProcessSignal = 25 + DomainProcessSignalVtalrm DomainProcessSignal = 26 + DomainProcessSignalProf DomainProcessSignal = 27 + DomainProcessSignalWinch DomainProcessSignal = 28 + DomainProcessSignalPoll DomainProcessSignal = 29 + DomainProcessSignalPwr DomainProcessSignal = 30 + DomainProcessSignalSys DomainProcessSignal = 31 + DomainProcessSignalRt0 DomainProcessSignal = 32 + DomainProcessSignalRt1 DomainProcessSignal = 33 + DomainProcessSignalRt2 DomainProcessSignal = 34 + DomainProcessSignalRt3 DomainProcessSignal = 35 + DomainProcessSignalRt4 DomainProcessSignal = 36 + DomainProcessSignalRt5 DomainProcessSignal = 37 + DomainProcessSignalRt6 DomainProcessSignal = 38 + DomainProcessSignalRt7 DomainProcessSignal = 39 + DomainProcessSignalRt8 DomainProcessSignal = 40 + DomainProcessSignalRt9 DomainProcessSignal = 41 + DomainProcessSignalRt10 DomainProcessSignal = 42 + DomainProcessSignalRt11 DomainProcessSignal = 43 + DomainProcessSignalRt12 DomainProcessSignal = 44 + DomainProcessSignalRt13 DomainProcessSignal = 45 + DomainProcessSignalRt14 DomainProcessSignal = 46 + DomainProcessSignalRt15 DomainProcessSignal = 47 + DomainProcessSignalRt16 DomainProcessSignal = 48 + DomainProcessSignalRt17 DomainProcessSignal = 49 + DomainProcessSignalRt18 DomainProcessSignal = 50 + DomainProcessSignalRt19 DomainProcessSignal = 51 + DomainProcessSignalRt20 DomainProcessSignal = 52 + DomainProcessSignalRt21 DomainProcessSignal = 53 + DomainProcessSignalRt22 DomainProcessSignal = 54 + DomainProcessSignalRt23 DomainProcessSignal = 55 + DomainProcessSignalRt24 DomainProcessSignal = 56 + DomainProcessSignalRt25 DomainProcessSignal = 57 + DomainProcessSignalRt26 DomainProcessSignal = 58 + DomainProcessSignalRt27 DomainProcessSignal = 59 + DomainProcessSignalRt28 DomainProcessSignal = 60 + DomainProcessSignalRt29 DomainProcessSignal = 61 + DomainProcessSignalRt30 DomainProcessSignal = 62 + DomainProcessSignalRt31 DomainProcessSignal = 63 + DomainProcessSignalRt32 DomainProcessSignal = 64 +) + +// DomainEventType as declared in libvirt/libvirt-domain.h:2951 +type DomainEventType int32 + +// DomainEventType enumeration from libvirt/libvirt-domain.h:2951 +const ( + DomainEventDefined DomainEventType = iota + DomainEventUndefined DomainEventType = 1 + DomainEventStarted DomainEventType = 2 + DomainEventSuspended DomainEventType = 3 + DomainEventResumed DomainEventType = 4 + DomainEventStopped DomainEventType = 5 + DomainEventShutdown DomainEventType = 6 + DomainEventPmsuspended DomainEventType = 7 + DomainEventCrashed DomainEventType = 8 +) + +// DomainEventDefinedDetailType as declared in libvirt/libvirt-domain.h:2967 +type DomainEventDefinedDetailType int32 + +// DomainEventDefinedDetailType enumeration from libvirt/libvirt-domain.h:2967 +const ( + DomainEventDefinedAdded DomainEventDefinedDetailType = iota + DomainEventDefinedUpdated DomainEventDefinedDetailType = 1 + DomainEventDefinedRenamed DomainEventDefinedDetailType = 2 + DomainEventDefinedFromSnapshot DomainEventDefinedDetailType = 3 +) + +// DomainEventUndefinedDetailType as declared in libvirt/libvirt-domain.h:2981 +type DomainEventUndefinedDetailType int32 + +// DomainEventUndefinedDetailType enumeration from libvirt/libvirt-domain.h:2981 +const ( + DomainEventUndefinedRemoved DomainEventUndefinedDetailType = iota + DomainEventUndefinedRenamed DomainEventUndefinedDetailType = 1 +) + +// DomainEventStartedDetailType as declared in libvirt/libvirt-domain.h:2998 +type DomainEventStartedDetailType int32 + +// DomainEventStartedDetailType enumeration from libvirt/libvirt-domain.h:2998 +const ( + DomainEventStartedBooted DomainEventStartedDetailType = iota + DomainEventStartedMigrated DomainEventStartedDetailType = 1 + DomainEventStartedRestored DomainEventStartedDetailType = 2 + DomainEventStartedFromSnapshot DomainEventStartedDetailType = 3 + DomainEventStartedWakeup DomainEventStartedDetailType = 4 +) + +// DomainEventSuspendedDetailType as declared in libvirt/libvirt-domain.h:3019 +type DomainEventSuspendedDetailType int32 + +// DomainEventSuspendedDetailType enumeration from libvirt/libvirt-domain.h:3019 +const ( + DomainEventSuspendedPaused DomainEventSuspendedDetailType = iota + DomainEventSuspendedMigrated DomainEventSuspendedDetailType = 1 + DomainEventSuspendedIoerror DomainEventSuspendedDetailType = 2 + DomainEventSuspendedWatchdog DomainEventSuspendedDetailType = 3 + DomainEventSuspendedRestored DomainEventSuspendedDetailType = 4 + DomainEventSuspendedFromSnapshot DomainEventSuspendedDetailType = 5 + DomainEventSuspendedAPIError DomainEventSuspendedDetailType = 6 + DomainEventSuspendedPostcopy DomainEventSuspendedDetailType = 7 + DomainEventSuspendedPostcopyFailed DomainEventSuspendedDetailType = 8 +) + +// DomainEventResumedDetailType as declared in libvirt/libvirt-domain.h:3036 +type DomainEventResumedDetailType int32 + +// DomainEventResumedDetailType enumeration from libvirt/libvirt-domain.h:3036 +const ( + DomainEventResumedUnpaused DomainEventResumedDetailType = iota + DomainEventResumedMigrated DomainEventResumedDetailType = 1 + DomainEventResumedFromSnapshot DomainEventResumedDetailType = 2 + DomainEventResumedPostcopy DomainEventResumedDetailType = 3 +) + +// DomainEventStoppedDetailType as declared in libvirt/libvirt-domain.h:3055 +type DomainEventStoppedDetailType int32 + +// DomainEventStoppedDetailType enumeration from libvirt/libvirt-domain.h:3055 +const ( + DomainEventStoppedShutdown DomainEventStoppedDetailType = iota + DomainEventStoppedDestroyed DomainEventStoppedDetailType = 1 + DomainEventStoppedCrashed DomainEventStoppedDetailType = 2 + DomainEventStoppedMigrated DomainEventStoppedDetailType = 3 + DomainEventStoppedSaved DomainEventStoppedDetailType = 4 + DomainEventStoppedFailed DomainEventStoppedDetailType = 5 + DomainEventStoppedFromSnapshot DomainEventStoppedDetailType = 6 +) + +// DomainEventShutdownDetailType as declared in libvirt/libvirt-domain.h:3078 +type DomainEventShutdownDetailType int32 + +// DomainEventShutdownDetailType enumeration from libvirt/libvirt-domain.h:3078 +const ( + DomainEventShutdownFinished DomainEventShutdownDetailType = iota + DomainEventShutdownGuest DomainEventShutdownDetailType = 1 + DomainEventShutdownHost DomainEventShutdownDetailType = 2 +) + +// DomainEventPMSuspendedDetailType as declared in libvirt/libvirt-domain.h:3092 +type DomainEventPMSuspendedDetailType int32 + +// DomainEventPMSuspendedDetailType enumeration from libvirt/libvirt-domain.h:3092 +const ( + DomainEventPmsuspendedMemory DomainEventPMSuspendedDetailType = iota + DomainEventPmsuspendedDisk DomainEventPMSuspendedDetailType = 1 +) + +// DomainEventCrashedDetailType as declared in libvirt/libvirt-domain.h:3105 +type DomainEventCrashedDetailType int32 + +// DomainEventCrashedDetailType enumeration from libvirt/libvirt-domain.h:3105 +const ( + DomainEventCrashedPanicked DomainEventCrashedDetailType = iota +) + +// DomainJobType as declared in libvirt/libvirt-domain.h:3149 +type DomainJobType int32 + +// DomainJobType enumeration from libvirt/libvirt-domain.h:3149 +const ( + DomainJobNone DomainJobType = iota + DomainJobBounded DomainJobType = 1 + DomainJobUnbounded DomainJobType = 2 + DomainJobCompleted DomainJobType = 3 + DomainJobFailed DomainJobType = 4 + DomainJobCancelled DomainJobType = 5 +) + +// DomainGetJobStatsFlags as declared in libvirt/libvirt-domain.h:3196 +type DomainGetJobStatsFlags int32 + +// DomainGetJobStatsFlags enumeration from libvirt/libvirt-domain.h:3196 +const ( + DomainJobStatsCompleted DomainGetJobStatsFlags = 1 +) + +// DomainJobOperation as declared in libvirt/libvirt-domain.h:3221 +type DomainJobOperation int32 + +// DomainJobOperation enumeration from libvirt/libvirt-domain.h:3221 +const ( + DomainJobOperationStrUnknown DomainJobOperation = iota + DomainJobOperationStrStart DomainJobOperation = 1 + DomainJobOperationStrSave DomainJobOperation = 2 + DomainJobOperationStrRestore DomainJobOperation = 3 + DomainJobOperationStrMigrationIn DomainJobOperation = 4 + DomainJobOperationStrMigrationOut DomainJobOperation = 5 + DomainJobOperationStrSnapshot DomainJobOperation = 6 + DomainJobOperationStrSnapshotRevert DomainJobOperation = 7 + DomainJobOperationStrDump DomainJobOperation = 8 +) + +// DomainEventWatchdogAction as declared in libvirt/libvirt-domain.h:3575 +type DomainEventWatchdogAction int32 + +// DomainEventWatchdogAction enumeration from libvirt/libvirt-domain.h:3575 +const ( + DomainEventWatchdogNone DomainEventWatchdogAction = iota + DomainEventWatchdogPause DomainEventWatchdogAction = 1 + DomainEventWatchdogReset DomainEventWatchdogAction = 2 + DomainEventWatchdogPoweroff DomainEventWatchdogAction = 3 + DomainEventWatchdogShutdown DomainEventWatchdogAction = 4 + DomainEventWatchdogDebug DomainEventWatchdogAction = 5 + DomainEventWatchdogInjectnmi DomainEventWatchdogAction = 6 +) + +// DomainEventIOErrorAction as declared in libvirt/libvirt-domain.h:3606 +type DomainEventIOErrorAction int32 + +// DomainEventIOErrorAction enumeration from libvirt/libvirt-domain.h:3606 +const ( + DomainEventIoErrorNone DomainEventIOErrorAction = iota + DomainEventIoErrorPause DomainEventIOErrorAction = 1 + DomainEventIoErrorReport DomainEventIOErrorAction = 2 +) + +// DomainEventGraphicsPhase as declared in libvirt/libvirt-domain.h:3669 +type DomainEventGraphicsPhase int32 + +// DomainEventGraphicsPhase enumeration from libvirt/libvirt-domain.h:3669 +const ( + DomainEventGraphicsConnect DomainEventGraphicsPhase = iota + DomainEventGraphicsInitialize DomainEventGraphicsPhase = 1 + DomainEventGraphicsDisconnect DomainEventGraphicsPhase = 2 +) + +// DomainEventGraphicsAddressType as declared in libvirt/libvirt-domain.h:3684 +type DomainEventGraphicsAddressType int32 + +// DomainEventGraphicsAddressType enumeration from libvirt/libvirt-domain.h:3684 +const ( + DomainEventGraphicsAddressIpv4 DomainEventGraphicsAddressType = iota + DomainEventGraphicsAddressIpv6 DomainEventGraphicsAddressType = 1 + DomainEventGraphicsAddressUnix DomainEventGraphicsAddressType = 2 +) + +// ConnectDomainEventBlockJobStatus as declared in libvirt/libvirt-domain.h:3772 +type ConnectDomainEventBlockJobStatus int32 + +// ConnectDomainEventBlockJobStatus enumeration from libvirt/libvirt-domain.h:3772 +const ( + DomainBlockJobCompleted ConnectDomainEventBlockJobStatus = iota + DomainBlockJobFailed ConnectDomainEventBlockJobStatus = 1 + DomainBlockJobCanceled ConnectDomainEventBlockJobStatus = 2 + DomainBlockJobReady ConnectDomainEventBlockJobStatus = 3 +) + +// ConnectDomainEventDiskChangeReason as declared in libvirt/libvirt-domain.h:3822 +type ConnectDomainEventDiskChangeReason int32 + +// ConnectDomainEventDiskChangeReason enumeration from libvirt/libvirt-domain.h:3822 +const ( + DomainEventDiskChangeMissingOnStart ConnectDomainEventDiskChangeReason = iota + DomainEventDiskDropMissingOnStart ConnectDomainEventDiskChangeReason = 1 +) + +// DomainEventTrayChangeReason as declared in libvirt/libvirt-domain.h:3863 +type DomainEventTrayChangeReason int32 + +// DomainEventTrayChangeReason enumeration from libvirt/libvirt-domain.h:3863 +const ( + DomainEventTrayChangeOpen DomainEventTrayChangeReason = iota + DomainEventTrayChangeClose DomainEventTrayChangeReason = 1 +) + +// ConnectDomainEventAgentLifecycleState as declared in libvirt/libvirt-domain.h:4378 +type ConnectDomainEventAgentLifecycleState int32 + +// ConnectDomainEventAgentLifecycleState enumeration from libvirt/libvirt-domain.h:4378 +const ( + ConnectDomainEventAgentLifecycleStateConnected ConnectDomainEventAgentLifecycleState = 1 + ConnectDomainEventAgentLifecycleStateDisconnected ConnectDomainEventAgentLifecycleState = 2 +) + +// ConnectDomainEventAgentLifecycleReason as declared in libvirt/libvirt-domain.h:4388 +type ConnectDomainEventAgentLifecycleReason int32 + +// ConnectDomainEventAgentLifecycleReason enumeration from libvirt/libvirt-domain.h:4388 +const ( + ConnectDomainEventAgentLifecycleReasonUnknown ConnectDomainEventAgentLifecycleReason = iota + ConnectDomainEventAgentLifecycleReasonDomainStarted ConnectDomainEventAgentLifecycleReason = 1 + ConnectDomainEventAgentLifecycleReasonChannel ConnectDomainEventAgentLifecycleReason = 2 +) + +// DomainEventID as declared in libvirt/libvirt-domain.h:4492 +type DomainEventID int32 + +// DomainEventID enumeration from libvirt/libvirt-domain.h:4492 +const ( + DomainEventIDLifecycle DomainEventID = iota + DomainEventIDReboot DomainEventID = 1 + DomainEventIDRtcChange DomainEventID = 2 + DomainEventIDWatchdog DomainEventID = 3 + DomainEventIDIoError DomainEventID = 4 + DomainEventIDGraphics DomainEventID = 5 + DomainEventIDIoErrorReason DomainEventID = 6 + DomainEventIDControlError DomainEventID = 7 + DomainEventIDBlockJob DomainEventID = 8 + DomainEventIDDiskChange DomainEventID = 9 + DomainEventIDTrayChange DomainEventID = 10 + DomainEventIDPmwakeup DomainEventID = 11 + DomainEventIDPmsuspend DomainEventID = 12 + DomainEventIDBalloonChange DomainEventID = 13 + DomainEventIDPmsuspendDisk DomainEventID = 14 + DomainEventIDDeviceRemoved DomainEventID = 15 + DomainEventIDBlockJob2 DomainEventID = 16 + DomainEventIDTunable DomainEventID = 17 + DomainEventIDAgentLifecycle DomainEventID = 18 + DomainEventIDDeviceAdded DomainEventID = 19 + DomainEventIDMigrationIteration DomainEventID = 20 + DomainEventIDJobCompleted DomainEventID = 21 + DomainEventIDDeviceRemovalFailed DomainEventID = 22 + DomainEventIDMetadataChange DomainEventID = 23 + DomainEventIDBlockThreshold DomainEventID = 24 +) + +// DomainConsoleFlags as declared in libvirt/libvirt-domain.h:4519 +type DomainConsoleFlags int32 + +// DomainConsoleFlags enumeration from libvirt/libvirt-domain.h:4519 +const ( + DomainConsoleForce DomainConsoleFlags = 1 + DomainConsoleSafe DomainConsoleFlags = 2 +) + +// DomainChannelFlags as declared in libvirt/libvirt-domain.h:4535 +type DomainChannelFlags int32 + +// DomainChannelFlags enumeration from libvirt/libvirt-domain.h:4535 +const ( + DomainChannelForce DomainChannelFlags = 1 +) + +// DomainOpenGraphicsFlags as declared in libvirt/libvirt-domain.h:4544 +type DomainOpenGraphicsFlags int32 + +// DomainOpenGraphicsFlags enumeration from libvirt/libvirt-domain.h:4544 +const ( + DomainOpenGraphicsSkipauth DomainOpenGraphicsFlags = 1 +) + +// DomainSetTimeFlags as declared in libvirt/libvirt-domain.h:4601 +type DomainSetTimeFlags int32 + +// DomainSetTimeFlags enumeration from libvirt/libvirt-domain.h:4601 +const ( + DomainTimeSync DomainSetTimeFlags = 1 +) + +// SchedParameterType as declared in libvirt/libvirt-domain.h:4622 +type SchedParameterType int32 + +// SchedParameterType enumeration from libvirt/libvirt-domain.h:4622 +const ( + DomainSchedFieldInt SchedParameterType = 1 + DomainSchedFieldUint SchedParameterType = 2 + DomainSchedFieldLlong SchedParameterType = 3 + DomainSchedFieldUllong SchedParameterType = 4 + DomainSchedFieldDouble SchedParameterType = 5 + DomainSchedFieldBoolean SchedParameterType = 6 +) + +// BlkioParameterType as declared in libvirt/libvirt-domain.h:4666 +type BlkioParameterType int32 + +// BlkioParameterType enumeration from libvirt/libvirt-domain.h:4666 +const ( + DomainBlkioParamInt BlkioParameterType = 1 + DomainBlkioParamUint BlkioParameterType = 2 + DomainBlkioParamLlong BlkioParameterType = 3 + DomainBlkioParamUllong BlkioParameterType = 4 + DomainBlkioParamDouble BlkioParameterType = 5 + DomainBlkioParamBoolean BlkioParameterType = 6 +) + +// MemoryParameterType as declared in libvirt/libvirt-domain.h:4710 +type MemoryParameterType int32 + +// MemoryParameterType enumeration from libvirt/libvirt-domain.h:4710 +const ( + DomainMemoryParamInt MemoryParameterType = 1 + DomainMemoryParamUint MemoryParameterType = 2 + DomainMemoryParamLlong MemoryParameterType = 3 + DomainMemoryParamUllong MemoryParameterType = 4 + DomainMemoryParamDouble MemoryParameterType = 5 + DomainMemoryParamBoolean MemoryParameterType = 6 +) + +// DomainInterfaceAddressesSource as declared in libvirt/libvirt-domain.h:4748 +type DomainInterfaceAddressesSource int32 + +// DomainInterfaceAddressesSource enumeration from libvirt/libvirt-domain.h:4748 +const ( + DomainInterfaceAddressesSrcLease DomainInterfaceAddressesSource = iota + DomainInterfaceAddressesSrcAgent DomainInterfaceAddressesSource = 1 + DomainInterfaceAddressesSrcArp DomainInterfaceAddressesSource = 2 +) + +// DomainSetUserPasswordFlags as declared in libvirt/libvirt-domain.h:4776 +type DomainSetUserPasswordFlags int32 + +// DomainSetUserPasswordFlags enumeration from libvirt/libvirt-domain.h:4776 +const ( + DomainPasswordEncrypted DomainSetUserPasswordFlags = 1 +) + +// DomainLifecycle as declared in libvirt/libvirt-domain.h:4815 +type DomainLifecycle int32 + +// DomainLifecycle enumeration from libvirt/libvirt-domain.h:4815 +const ( + DomainLifecyclePoweroff DomainLifecycle = iota + DomainLifecycleReboot DomainLifecycle = 1 + DomainLifecycleCrash DomainLifecycle = 2 +) + +// DomainLifecycleAction as declared in libvirt/libvirt-domain.h:4828 +type DomainLifecycleAction int32 + +// DomainLifecycleAction enumeration from libvirt/libvirt-domain.h:4828 +const ( + DomainLifecycleActionDestroy DomainLifecycleAction = iota + DomainLifecycleActionRestart DomainLifecycleAction = 1 + DomainLifecycleActionRestartRename DomainLifecycleAction = 2 + DomainLifecycleActionPreserve DomainLifecycleAction = 3 + DomainLifecycleActionCoredumpDestroy DomainLifecycleAction = 4 + DomainLifecycleActionCoredumpRestart DomainLifecycleAction = 5 +) + +// DomainSnapshotCreateFlags as declared in libvirt/libvirt-domain-snapshot.h:74 +type DomainSnapshotCreateFlags int32 + +// DomainSnapshotCreateFlags enumeration from libvirt/libvirt-domain-snapshot.h:74 +const ( + DomainSnapshotCreateRedefine DomainSnapshotCreateFlags = 1 + DomainSnapshotCreateCurrent DomainSnapshotCreateFlags = 2 + DomainSnapshotCreateNoMetadata DomainSnapshotCreateFlags = 4 + DomainSnapshotCreateHalt DomainSnapshotCreateFlags = 8 + DomainSnapshotCreateDiskOnly DomainSnapshotCreateFlags = 16 + DomainSnapshotCreateReuseExt DomainSnapshotCreateFlags = 32 + DomainSnapshotCreateQuiesce DomainSnapshotCreateFlags = 64 + DomainSnapshotCreateAtomic DomainSnapshotCreateFlags = 128 + DomainSnapshotCreateLive DomainSnapshotCreateFlags = 256 +) + +// DomainSnapshotListFlags as declared in libvirt/libvirt-domain-snapshot.h:134 +type DomainSnapshotListFlags int32 + +// DomainSnapshotListFlags enumeration from libvirt/libvirt-domain-snapshot.h:134 +const ( + DomainSnapshotListRoots DomainSnapshotListFlags = 1 + DomainSnapshotListDescendants DomainSnapshotListFlags = 1 + DomainSnapshotListLeaves DomainSnapshotListFlags = 4 + DomainSnapshotListNoLeaves DomainSnapshotListFlags = 8 + DomainSnapshotListMetadata DomainSnapshotListFlags = 2 + DomainSnapshotListNoMetadata DomainSnapshotListFlags = 16 + DomainSnapshotListInactive DomainSnapshotListFlags = 32 + DomainSnapshotListActive DomainSnapshotListFlags = 64 + DomainSnapshotListDiskOnly DomainSnapshotListFlags = 128 + DomainSnapshotListInternal DomainSnapshotListFlags = 256 + DomainSnapshotListExternal DomainSnapshotListFlags = 512 +) + +// DomainSnapshotRevertFlags as declared in libvirt/libvirt-domain-snapshot.h:191 +type DomainSnapshotRevertFlags int32 + +// DomainSnapshotRevertFlags enumeration from libvirt/libvirt-domain-snapshot.h:191 +const ( + DomainSnapshotRevertRunning DomainSnapshotRevertFlags = 1 + DomainSnapshotRevertPaused DomainSnapshotRevertFlags = 2 + DomainSnapshotRevertForce DomainSnapshotRevertFlags = 4 +) + +// DomainSnapshotDeleteFlags as declared in libvirt/libvirt-domain-snapshot.h:205 +type DomainSnapshotDeleteFlags int32 + +// DomainSnapshotDeleteFlags enumeration from libvirt/libvirt-domain-snapshot.h:205 +const ( + DomainSnapshotDeleteChildren DomainSnapshotDeleteFlags = 1 + DomainSnapshotDeleteMetadataOnly DomainSnapshotDeleteFlags = 2 + DomainSnapshotDeleteChildrenOnly DomainSnapshotDeleteFlags = 4 +) + +// EventHandleType as declared in libvirt/libvirt-event.h:43 +type EventHandleType int32 + +// EventHandleType enumeration from libvirt/libvirt-event.h:43 +const ( + EventHandleReadable EventHandleType = 1 + EventHandleWritable EventHandleType = 2 + EventHandleError EventHandleType = 4 + EventHandleHangup EventHandleType = 8 +) + +// ConnectListAllInterfacesFlags as declared in libvirt/libvirt-interface.h:64 +type ConnectListAllInterfacesFlags int32 + +// ConnectListAllInterfacesFlags enumeration from libvirt/libvirt-interface.h:64 +const ( + ConnectListInterfacesInactive ConnectListAllInterfacesFlags = 1 + ConnectListInterfacesActive ConnectListAllInterfacesFlags = 2 +) + +// InterfaceXMLFlags as declared in libvirt/libvirt-interface.h:80 +type InterfaceXMLFlags int32 + +// InterfaceXMLFlags enumeration from libvirt/libvirt-interface.h:80 +const ( + InterfaceXMLInactive InterfaceXMLFlags = 1 +) + +// NetworkXMLFlags as declared in libvirt/libvirt-network.h:32 +type NetworkXMLFlags int32 + +// NetworkXMLFlags enumeration from libvirt/libvirt-network.h:32 +const ( + NetworkXMLInactive NetworkXMLFlags = 1 +) + +// ConnectListAllNetworksFlags as declared in libvirt/libvirt-network.h:84 +type ConnectListAllNetworksFlags int32 + +// ConnectListAllNetworksFlags enumeration from libvirt/libvirt-network.h:84 +const ( + ConnectListNetworksInactive ConnectListAllNetworksFlags = 1 + ConnectListNetworksActive ConnectListAllNetworksFlags = 2 + ConnectListNetworksPersistent ConnectListAllNetworksFlags = 4 + ConnectListNetworksTransient ConnectListAllNetworksFlags = 8 + ConnectListNetworksAutostart ConnectListAllNetworksFlags = 16 + ConnectListNetworksNoAutostart ConnectListAllNetworksFlags = 32 +) + +// NetworkUpdateCommand as declared in libvirt/libvirt-network.h:133 +type NetworkUpdateCommand int32 + +// NetworkUpdateCommand enumeration from libvirt/libvirt-network.h:133 +const ( + NetworkUpdateCommandNone NetworkUpdateCommand = iota + NetworkUpdateCommandModify NetworkUpdateCommand = 1 + NetworkUpdateCommandDelete NetworkUpdateCommand = 2 + NetworkUpdateCommandAddLast NetworkUpdateCommand = 3 + NetworkUpdateCommandAddFirst NetworkUpdateCommand = 4 +) + +// NetworkUpdateSection as declared in libvirt/libvirt-network.h:159 +type NetworkUpdateSection int32 + +// NetworkUpdateSection enumeration from libvirt/libvirt-network.h:159 +const ( + NetworkSectionNone NetworkUpdateSection = iota + NetworkSectionBridge NetworkUpdateSection = 1 + NetworkSectionDomain NetworkUpdateSection = 2 + NetworkSectionIP NetworkUpdateSection = 3 + NetworkSectionIPDhcpHost NetworkUpdateSection = 4 + NetworkSectionIPDhcpRange NetworkUpdateSection = 5 + NetworkSectionForward NetworkUpdateSection = 6 + NetworkSectionForwardInterface NetworkUpdateSection = 7 + NetworkSectionForwardPf NetworkUpdateSection = 8 + NetworkSectionPortgroup NetworkUpdateSection = 9 + NetworkSectionDNSHost NetworkUpdateSection = 10 + NetworkSectionDNSTxt NetworkUpdateSection = 11 + NetworkSectionDNSSrv NetworkUpdateSection = 12 +) + +// NetworkUpdateFlags as declared in libvirt/libvirt-network.h:171 +type NetworkUpdateFlags int32 + +// NetworkUpdateFlags enumeration from libvirt/libvirt-network.h:171 +const ( + NetworkUpdateAffectCurrent NetworkUpdateFlags = iota + NetworkUpdateAffectLive NetworkUpdateFlags = 1 + NetworkUpdateAffectConfig NetworkUpdateFlags = 2 +) + +// NetworkEventLifecycleType as declared in libvirt/libvirt-network.h:229 +type NetworkEventLifecycleType int32 + +// NetworkEventLifecycleType enumeration from libvirt/libvirt-network.h:229 +const ( + NetworkEventDefined NetworkEventLifecycleType = iota + NetworkEventUndefined NetworkEventLifecycleType = 1 + NetworkEventStarted NetworkEventLifecycleType = 2 + NetworkEventStopped NetworkEventLifecycleType = 3 +) + +// NetworkEventID as declared in libvirt/libvirt-network.h:277 +type NetworkEventID int32 + +// NetworkEventID enumeration from libvirt/libvirt-network.h:277 +const ( + NetworkEventIDLifecycle NetworkEventID = iota +) + +// IPAddrType as declared in libvirt/libvirt-network.h:286 +type IPAddrType int32 + +// IPAddrType enumeration from libvirt/libvirt-network.h:286 +const ( + IPAddrTypeIpv4 IPAddrType = iota + IPAddrTypeIpv6 IPAddrType = 1 +) + +// ConnectListAllNodeDeviceFlags as declared in libvirt/libvirt-nodedev.h:84 +type ConnectListAllNodeDeviceFlags int32 + +// ConnectListAllNodeDeviceFlags enumeration from libvirt/libvirt-nodedev.h:84 +const ( + ConnectListNodeDevicesCapSystem ConnectListAllNodeDeviceFlags = 1 + ConnectListNodeDevicesCapPciDev ConnectListAllNodeDeviceFlags = 2 + ConnectListNodeDevicesCapUsbDev ConnectListAllNodeDeviceFlags = 4 + ConnectListNodeDevicesCapUsbInterface ConnectListAllNodeDeviceFlags = 8 + ConnectListNodeDevicesCapNet ConnectListAllNodeDeviceFlags = 16 + ConnectListNodeDevicesCapScsiHost ConnectListAllNodeDeviceFlags = 32 + ConnectListNodeDevicesCapScsiTarget ConnectListAllNodeDeviceFlags = 64 + ConnectListNodeDevicesCapScsi ConnectListAllNodeDeviceFlags = 128 + ConnectListNodeDevicesCapStorage ConnectListAllNodeDeviceFlags = 256 + ConnectListNodeDevicesCapFcHost ConnectListAllNodeDeviceFlags = 512 + ConnectListNodeDevicesCapVports ConnectListAllNodeDeviceFlags = 1024 + ConnectListNodeDevicesCapScsiGeneric ConnectListAllNodeDeviceFlags = 2048 + ConnectListNodeDevicesCapDrm ConnectListAllNodeDeviceFlags = 4096 + ConnectListNodeDevicesCapMdevTypes ConnectListAllNodeDeviceFlags = 8192 + ConnectListNodeDevicesCapMdev ConnectListAllNodeDeviceFlags = 16384 + ConnectListNodeDevicesCapCcwDev ConnectListAllNodeDeviceFlags = 32768 +) + +// NodeDeviceEventID as declared in libvirt/libvirt-nodedev.h:154 +type NodeDeviceEventID int32 + +// NodeDeviceEventID enumeration from libvirt/libvirt-nodedev.h:154 +const ( + NodeDeviceEventIDLifecycle NodeDeviceEventID = iota + NodeDeviceEventIDUpdate NodeDeviceEventID = 1 +) + +// NodeDeviceEventLifecycleType as declared in libvirt/libvirt-nodedev.h:196 +type NodeDeviceEventLifecycleType int32 + +// NodeDeviceEventLifecycleType enumeration from libvirt/libvirt-nodedev.h:196 +const ( + NodeDeviceEventCreated NodeDeviceEventLifecycleType = iota + NodeDeviceEventDeleted NodeDeviceEventLifecycleType = 1 +) + +// SecretUsageType as declared in libvirt/libvirt-secret.h:55 +type SecretUsageType int32 + +// SecretUsageType enumeration from libvirt/libvirt-secret.h:55 +const ( + SecretUsageTypeNone SecretUsageType = iota + SecretUsageTypeVolume SecretUsageType = 1 + SecretUsageTypeCeph SecretUsageType = 2 + SecretUsageTypeIscsi SecretUsageType = 3 + SecretUsageTypeTLS SecretUsageType = 4 +) + +// ConnectListAllSecretsFlags as declared in libvirt/libvirt-secret.h:78 +type ConnectListAllSecretsFlags int32 + +// ConnectListAllSecretsFlags enumeration from libvirt/libvirt-secret.h:78 +const ( + ConnectListSecretsEphemeral ConnectListAllSecretsFlags = 1 + ConnectListSecretsNoEphemeral ConnectListAllSecretsFlags = 2 + ConnectListSecretsPrivate ConnectListAllSecretsFlags = 4 + ConnectListSecretsNoPrivate ConnectListAllSecretsFlags = 8 +) + +// SecretEventID as declared in libvirt/libvirt-secret.h:139 +type SecretEventID int32 + +// SecretEventID enumeration from libvirt/libvirt-secret.h:139 +const ( + SecretEventIDLifecycle SecretEventID = iota + SecretEventIDValueChanged SecretEventID = 1 +) + +// SecretEventLifecycleType as declared in libvirt/libvirt-secret.h:181 +type SecretEventLifecycleType int32 + +// SecretEventLifecycleType enumeration from libvirt/libvirt-secret.h:181 +const ( + SecretEventDefined SecretEventLifecycleType = iota + SecretEventUndefined SecretEventLifecycleType = 1 +) + +// StoragePoolState as declared in libvirt/libvirt-storage.h:57 +type StoragePoolState int32 + +// StoragePoolState enumeration from libvirt/libvirt-storage.h:57 +const ( + StoragePoolInactive StoragePoolState = iota + StoragePoolBuilding StoragePoolState = 1 + StoragePoolRunning StoragePoolState = 2 + StoragePoolDegraded StoragePoolState = 3 + StoragePoolInaccessible StoragePoolState = 4 +) + +// StoragePoolBuildFlags as declared in libvirt/libvirt-storage.h:65 +type StoragePoolBuildFlags int32 + +// StoragePoolBuildFlags enumeration from libvirt/libvirt-storage.h:65 +const ( + StoragePoolBuildNew StoragePoolBuildFlags = iota + StoragePoolBuildRepair StoragePoolBuildFlags = 1 + StoragePoolBuildResize StoragePoolBuildFlags = 2 + StoragePoolBuildNoOverwrite StoragePoolBuildFlags = 4 + StoragePoolBuildOverwrite StoragePoolBuildFlags = 8 +) + +// StoragePoolDeleteFlags as declared in libvirt/libvirt-storage.h:70 +type StoragePoolDeleteFlags int32 + +// StoragePoolDeleteFlags enumeration from libvirt/libvirt-storage.h:70 +const ( + StoragePoolDeleteNormal StoragePoolDeleteFlags = iota + StoragePoolDeleteZeroed StoragePoolDeleteFlags = 1 +) + +// StoragePoolCreateFlags as declared in libvirt/libvirt-storage.h:87 +type StoragePoolCreateFlags int32 + +// StoragePoolCreateFlags enumeration from libvirt/libvirt-storage.h:87 +const ( + StoragePoolCreateNormal StoragePoolCreateFlags = iota + StoragePoolCreateWithBuild StoragePoolCreateFlags = 1 + StoragePoolCreateWithBuildOverwrite StoragePoolCreateFlags = 2 + StoragePoolCreateWithBuildNoOverwrite StoragePoolCreateFlags = 4 +) + +// StorageVolType as declared in libvirt/libvirt-storage.h:129 +type StorageVolType int32 + +// StorageVolType enumeration from libvirt/libvirt-storage.h:129 +const ( + StorageVolFile StorageVolType = iota + StorageVolBlock StorageVolType = 1 + StorageVolDir StorageVolType = 2 + StorageVolNetwork StorageVolType = 3 + StorageVolNetdir StorageVolType = 4 + StorageVolPloop StorageVolType = 5 +) + +// StorageVolDeleteFlags as declared in libvirt/libvirt-storage.h:135 +type StorageVolDeleteFlags int32 + +// StorageVolDeleteFlags enumeration from libvirt/libvirt-storage.h:135 +const ( + StorageVolDeleteNormal StorageVolDeleteFlags = iota + StorageVolDeleteZeroed StorageVolDeleteFlags = 1 + StorageVolDeleteWithSnapshots StorageVolDeleteFlags = 2 +) + +// StorageVolWipeAlgorithm as declared in libvirt/libvirt-storage.h:167 +type StorageVolWipeAlgorithm int32 + +// StorageVolWipeAlgorithm enumeration from libvirt/libvirt-storage.h:167 +const ( + StorageVolWipeAlgZero StorageVolWipeAlgorithm = iota + StorageVolWipeAlgNnsa StorageVolWipeAlgorithm = 1 + StorageVolWipeAlgDod StorageVolWipeAlgorithm = 2 + StorageVolWipeAlgBsi StorageVolWipeAlgorithm = 3 + StorageVolWipeAlgGutmann StorageVolWipeAlgorithm = 4 + StorageVolWipeAlgSchneier StorageVolWipeAlgorithm = 5 + StorageVolWipeAlgPfitzner7 StorageVolWipeAlgorithm = 6 + StorageVolWipeAlgPfitzner33 StorageVolWipeAlgorithm = 7 + StorageVolWipeAlgRandom StorageVolWipeAlgorithm = 8 + StorageVolWipeAlgTrim StorageVolWipeAlgorithm = 9 +) + +// StorageVolInfoFlags as declared in libvirt/libvirt-storage.h:175 +type StorageVolInfoFlags int32 + +// StorageVolInfoFlags enumeration from libvirt/libvirt-storage.h:175 +const ( + StorageVolUseAllocation StorageVolInfoFlags = iota + StorageVolGetPhysical StorageVolInfoFlags = 1 +) + +// StorageXMLFlags as declared in libvirt/libvirt-storage.h:189 +type StorageXMLFlags int32 + +// StorageXMLFlags enumeration from libvirt/libvirt-storage.h:189 +const ( + StorageXMLInactive StorageXMLFlags = 1 +) + +// ConnectListAllStoragePoolsFlags as declared in libvirt/libvirt-storage.h:243 +type ConnectListAllStoragePoolsFlags int32 + +// ConnectListAllStoragePoolsFlags enumeration from libvirt/libvirt-storage.h:243 +const ( + ConnectListStoragePoolsInactive ConnectListAllStoragePoolsFlags = 1 + ConnectListStoragePoolsActive ConnectListAllStoragePoolsFlags = 2 + ConnectListStoragePoolsPersistent ConnectListAllStoragePoolsFlags = 4 + ConnectListStoragePoolsTransient ConnectListAllStoragePoolsFlags = 8 + ConnectListStoragePoolsAutostart ConnectListAllStoragePoolsFlags = 16 + ConnectListStoragePoolsNoAutostart ConnectListAllStoragePoolsFlags = 32 + ConnectListStoragePoolsDir ConnectListAllStoragePoolsFlags = 64 + ConnectListStoragePoolsFs ConnectListAllStoragePoolsFlags = 128 + ConnectListStoragePoolsNetfs ConnectListAllStoragePoolsFlags = 256 + ConnectListStoragePoolsLogical ConnectListAllStoragePoolsFlags = 512 + ConnectListStoragePoolsDisk ConnectListAllStoragePoolsFlags = 1024 + ConnectListStoragePoolsIscsi ConnectListAllStoragePoolsFlags = 2048 + ConnectListStoragePoolsScsi ConnectListAllStoragePoolsFlags = 4096 + ConnectListStoragePoolsMpath ConnectListAllStoragePoolsFlags = 8192 + ConnectListStoragePoolsRbd ConnectListAllStoragePoolsFlags = 16384 + ConnectListStoragePoolsSheepdog ConnectListAllStoragePoolsFlags = 32768 + ConnectListStoragePoolsGluster ConnectListAllStoragePoolsFlags = 65536 + ConnectListStoragePoolsZfs ConnectListAllStoragePoolsFlags = 131072 + ConnectListStoragePoolsVstorage ConnectListAllStoragePoolsFlags = 262144 +) + +// StorageVolCreateFlags as declared in libvirt/libvirt-storage.h:341 +type StorageVolCreateFlags int32 + +// StorageVolCreateFlags enumeration from libvirt/libvirt-storage.h:341 +const ( + StorageVolCreatePreallocMetadata StorageVolCreateFlags = 1 + StorageVolCreateReflink StorageVolCreateFlags = 2 +) + +// StorageVolDownloadFlags as declared in libvirt/libvirt-storage.h:353 +type StorageVolDownloadFlags int32 + +// StorageVolDownloadFlags enumeration from libvirt/libvirt-storage.h:353 +const ( + StorageVolDownloadSparseStream StorageVolDownloadFlags = 1 +) + +// StorageVolUploadFlags as declared in libvirt/libvirt-storage.h:362 +type StorageVolUploadFlags int32 + +// StorageVolUploadFlags enumeration from libvirt/libvirt-storage.h:362 +const ( + StorageVolUploadSparseStream StorageVolUploadFlags = 1 +) + +// StorageVolResizeFlags as declared in libvirt/libvirt-storage.h:393 +type StorageVolResizeFlags int32 + +// StorageVolResizeFlags enumeration from libvirt/libvirt-storage.h:393 +const ( + StorageVolResizeAllocate StorageVolResizeFlags = 1 + StorageVolResizeDelta StorageVolResizeFlags = 2 + StorageVolResizeShrink StorageVolResizeFlags = 4 +) + +// StoragePoolEventID as declared in libvirt/libvirt-storage.h:429 +type StoragePoolEventID int32 + +// StoragePoolEventID enumeration from libvirt/libvirt-storage.h:429 +const ( + StoragePoolEventIDLifecycle StoragePoolEventID = iota + StoragePoolEventIDRefresh StoragePoolEventID = 1 +) + +// StoragePoolEventLifecycleType as declared in libvirt/libvirt-storage.h:475 +type StoragePoolEventLifecycleType int32 + +// StoragePoolEventLifecycleType enumeration from libvirt/libvirt-storage.h:475 +const ( + StoragePoolEventDefined StoragePoolEventLifecycleType = iota + StoragePoolEventUndefined StoragePoolEventLifecycleType = 1 + StoragePoolEventStarted StoragePoolEventLifecycleType = 2 + StoragePoolEventStopped StoragePoolEventLifecycleType = 3 + StoragePoolEventCreated StoragePoolEventLifecycleType = 4 + StoragePoolEventDeleted StoragePoolEventLifecycleType = 5 +) + +// StreamFlags as declared in libvirt/libvirt-stream.h:33 +type StreamFlags int32 + +// StreamFlags enumeration from libvirt/libvirt-stream.h:33 +const ( + StreamNonblock StreamFlags = 1 +) + +// StreamRecvFlagsValues as declared in libvirt/libvirt-stream.h:49 +type StreamRecvFlagsValues int32 + +// StreamRecvFlagsValues enumeration from libvirt/libvirt-stream.h:49 +const ( + StreamRecvStopAtHole StreamRecvFlagsValues = 1 +) + +// StreamEventType as declared in libvirt/libvirt-stream.h:237 +type StreamEventType int32 + +// StreamEventType enumeration from libvirt/libvirt-stream.h:237 +const ( + StreamEventReadable StreamEventType = 1 + StreamEventWritable StreamEventType = 2 + StreamEventError StreamEventType = 4 + StreamEventHangup StreamEventType = 8 +) + +// errorLevel as declared in libvirt/virterror.h:42 +type errorLevel int32 + +// errorLevel enumeration from libvirt/virterror.h:42 +const ( + errNone errorLevel = iota + errWarning errorLevel = 1 + errError errorLevel = 2 +) + +// errorDomain as declared in libvirt/virterror.h:139 +type errorDomain int32 + +// errorDomain enumeration from libvirt/virterror.h:139 +const ( + fromNone errorDomain = iota + fromXen errorDomain = 1 + fromXend errorDomain = 2 + fromXenstore errorDomain = 3 + fromSexpr errorDomain = 4 + fromXML errorDomain = 5 + fromDom errorDomain = 6 + fromRPC errorDomain = 7 + fromProxy errorDomain = 8 + fromConf errorDomain = 9 + fromQemu errorDomain = 10 + fromNet errorDomain = 11 + fromTest errorDomain = 12 + fromRemote errorDomain = 13 + fromOpenvz errorDomain = 14 + fromXenxm errorDomain = 15 + fromStatsLinux errorDomain = 16 + fromLxc errorDomain = 17 + fromStorage errorDomain = 18 + fromNetwork errorDomain = 19 + fromDomain errorDomain = 20 + fromUml errorDomain = 21 + fromNodedev errorDomain = 22 + fromXenInotify errorDomain = 23 + fromSecurity errorDomain = 24 + fromVbox errorDomain = 25 + fromInterface errorDomain = 26 + fromOne errorDomain = 27 + fromEsx errorDomain = 28 + fromPhyp errorDomain = 29 + fromSecret errorDomain = 30 + fromCPU errorDomain = 31 + fromXenapi errorDomain = 32 + fromNwfilter errorDomain = 33 + fromHook errorDomain = 34 + fromDomainSnapshot errorDomain = 35 + fromAudit errorDomain = 36 + fromSysinfo errorDomain = 37 + fromStreams errorDomain = 38 + fromVmware errorDomain = 39 + fromEvent errorDomain = 40 + fromLibxl errorDomain = 41 + fromLocking errorDomain = 42 + fromHyperv errorDomain = 43 + fromCapabilities errorDomain = 44 + fromURI errorDomain = 45 + fromAuth errorDomain = 46 + fromDbus errorDomain = 47 + fromParallels errorDomain = 48 + fromDevice errorDomain = 49 + fromSSH errorDomain = 50 + fromLockspace errorDomain = 51 + fromInitctl errorDomain = 52 + fromIdentity errorDomain = 53 + fromCgroup errorDomain = 54 + fromAccess errorDomain = 55 + fromSystemd errorDomain = 56 + fromBhyve errorDomain = 57 + fromCrypto errorDomain = 58 + fromFirewall errorDomain = 59 + fromPolkit errorDomain = 60 + fromThread errorDomain = 61 + fromAdmin errorDomain = 62 + fromLogging errorDomain = 63 + fromXenxl errorDomain = 64 + fromPerf errorDomain = 65 + fromLibssh errorDomain = 66 + fromResctrl errorDomain = 67 + fromFirewalld errorDomain = 68 +) + +// errorNumber as declared in libvirt/virterror.h:330 +type errorNumber int32 + +// errorNumber enumeration from libvirt/virterror.h:330 +const ( + errOk errorNumber = iota + errInternalError errorNumber = 1 + errNoMemory errorNumber = 2 + errNoSupport errorNumber = 3 + errUnknownHost errorNumber = 4 + errNoConnect errorNumber = 5 + errInvalidConn errorNumber = 6 + errInvalidDomain errorNumber = 7 + errInvalidArg errorNumber = 8 + errOperationFailed errorNumber = 9 + errGetFailed errorNumber = 10 + errPostFailed errorNumber = 11 + errHTTPError errorNumber = 12 + errSexprSerial errorNumber = 13 + errNoXen errorNumber = 14 + errXenCall errorNumber = 15 + errOsType errorNumber = 16 + errNoKernel errorNumber = 17 + errNoRoot errorNumber = 18 + errNoSource errorNumber = 19 + errNoTarget errorNumber = 20 + errNoName errorNumber = 21 + errNoOs errorNumber = 22 + errNoDevice errorNumber = 23 + errNoXenstore errorNumber = 24 + errDriverFull errorNumber = 25 + errCallFailed errorNumber = 26 + errXMLError errorNumber = 27 + errDomExist errorNumber = 28 + errOperationDenied errorNumber = 29 + errOpenFailed errorNumber = 30 + errReadFailed errorNumber = 31 + errParseFailed errorNumber = 32 + errConfSyntax errorNumber = 33 + errWriteFailed errorNumber = 34 + errXMLDetail errorNumber = 35 + errInvalidNetwork errorNumber = 36 + errNetworkExist errorNumber = 37 + errSystemError errorNumber = 38 + errRPC errorNumber = 39 + errGnutlsError errorNumber = 40 + warNoNetwork errorNumber = 41 + errNoDomain errorNumber = 42 + errNoNetwork errorNumber = 43 + errInvalidMac errorNumber = 44 + errAuthFailed errorNumber = 45 + errInvalidStoragePool errorNumber = 46 + errInvalidStorageVol errorNumber = 47 + warNoStorage errorNumber = 48 + errNoStoragePool errorNumber = 49 + errNoStorageVol errorNumber = 50 + warNoNode errorNumber = 51 + errInvalidNodeDevice errorNumber = 52 + errNoNodeDevice errorNumber = 53 + errNoSecurityModel errorNumber = 54 + errOperationInvalid errorNumber = 55 + warNoInterface errorNumber = 56 + errNoInterface errorNumber = 57 + errInvalidInterface errorNumber = 58 + errMultipleInterfaces errorNumber = 59 + warNoNwfilter errorNumber = 60 + errInvalidNwfilter errorNumber = 61 + errNoNwfilter errorNumber = 62 + errBuildFirewall errorNumber = 63 + warNoSecret errorNumber = 64 + errInvalidSecret errorNumber = 65 + errNoSecret errorNumber = 66 + errConfigUnsupported errorNumber = 67 + errOperationTimeout errorNumber = 68 + errMigratePersistFailed errorNumber = 69 + errHookScriptFailed errorNumber = 70 + errInvalidDomainSnapshot errorNumber = 71 + errNoDomainSnapshot errorNumber = 72 + errInvalidStream errorNumber = 73 + errArgumentUnsupported errorNumber = 74 + errStorageProbeFailed errorNumber = 75 + errStoragePoolBuilt errorNumber = 76 + errSnapshotRevertRisky errorNumber = 77 + errOperationAborted errorNumber = 78 + errAuthCancelled errorNumber = 79 + errNoDomainMetadata errorNumber = 80 + errMigrateUnsafe errorNumber = 81 + errOverflow errorNumber = 82 + errBlockCopyActive errorNumber = 83 + errOperationUnsupported errorNumber = 84 + errSSH errorNumber = 85 + errAgentUnresponsive errorNumber = 86 + errResourceBusy errorNumber = 87 + errAccessDenied errorNumber = 88 + errDbusService errorNumber = 89 + errStorageVolExist errorNumber = 90 + errCPUIncompatible errorNumber = 91 + errXMLInvalidSchema errorNumber = 92 + errMigrateFinishOk errorNumber = 93 + errAuthUnavailable errorNumber = 94 + errNoServer errorNumber = 95 + errNoClient errorNumber = 96 + errAgentUnsynced errorNumber = 97 + errLibssh errorNumber = 98 + errDeviceMissing errorNumber = 99 + errInvalidNwfilterBinding errorNumber = 100 + errNoNwfilterBinding errorNumber = 101 +) diff --git a/vendor/github.com/digitalocean/go-libvirt/doc.go b/vendor/github.com/digitalocean/go-libvirt/doc.go new file mode 100644 index 000000000..1229f30c8 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/doc.go @@ -0,0 +1,76 @@ +// Copyright 2016 The go-libvirt Authors. +// +// 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 libvirt provides a pure Go interface for Libvirt. + + Rather than using Libvirt's C bindings, this package makes use of + Libvirt's RPC interface, as documented here: https://libvirt.org/internals/rpc.html. + Connections to the libvirt server may be local, or remote. RPC packets are encoded + using the XDR standard as defined by RFC 4506. + + This should be considered a work in progress. Most functionaly provided by the C + bindings have not yet made their way into this library. Pull requests are welcome! + The definition of the RPC protocol is in the libvirt source tree under src/rpc/virnetprotocol.x. + + Example usage: + + package main + + import ( + "fmt" + "log" + "net" + "time" + + "github.com/digitalocean/go-libvirt" + ) + + func main() { + //c, err := net.DialTimeout("tcp", "127.0.0.1:16509", 2*time.Second) + //c, err := net.DialTimeout("tcp", "192.168.1.12:16509", 2*time.Second) + c, err := net.DialTimeout("unix", "/var/run/libvirt/libvirt-sock", 2*time.Second) + if err != nil { + log.Fatalf("failed to dial libvirt: %v", err) + } + + l := libvirt.New(c) + if err := l.Connect(); err != nil { + log.Fatalf("failed to connect: %v", err) + } + + v, err := l.Version() + if err != nil { + log.Fatalf("failed to retrieve libvirt version: %v", err) + } + fmt.Println("Version:", v) + + domains, err := l.Domains() + if err != nil { + log.Fatalf("failed to retrieve domains: %v", err) + } + + fmt.Println("ID\tName\t\tUUID") + fmt.Printf("--------------------------------------------------------\n") + for _, d := range domains { + fmt.Printf("%d\t%s\t%x\n", d.ID, d.Name, d.UUID) + } + + if err := l.Disconnect(); err != nil { + log.Fatal("failed to disconnect: %v", err) + } + } +*/ + +package libvirt diff --git a/vendor/github.com/digitalocean/go-libvirt/internal/constants/constants.gen.go b/vendor/github.com/digitalocean/go-libvirt/internal/constants/constants.gen.go new file mode 100644 index 000000000..7224cdc1c --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/internal/constants/constants.gen.go @@ -0,0 +1,992 @@ +// Copyright 2018 The go-libvirt Authors. +// +// 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 internal/lvgen/generate.go. DO NOT EDIT. +// +// To regenerate, run 'go generate' in internal/lvgen. +// + +package constants + +// qemu constants +const ( + ProgramQEMU = 0x20008087 + ProgramKeepAlive = 0x6b656570 +) + +// qemu procedure identifiers +const ( + QEMUDomainMonitor = 1 + QEMUConnectDomainMonitorEventRegister = 4 + QEMUConnectDomainMonitorEventDeregister = 5 + QEMUDomainMonitorEvent = 6 +) + +const ( + // PacketLengthSize is the packet length, in bytes. + PacketLengthSize = 4 + + // HeaderSize is the packet header size, in bytes. + HeaderSize = 24 + + // UUIDSize is the length of a UUID, in bytes. + UUIDSize = 16 +) + +// These are libvirt procedure numbers which correspond to each respective +// API call between remote_internal driver and libvirtd. Each procedure is +// identified by a unique number which *may change in any future libvirt +// update*. +// +// Examples: +// REMOTE_PROC_CONNECT_OPEN = 1 +// REMOTE_PROC_DOMAIN_DEFINE_XML = 11 +// REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207, +const ( + // From enums: + // AuthNone is libvirt's REMOTE_AUTH_NONE + AuthNone = 0 + // AuthSasl is libvirt's REMOTE_AUTH_SASL + AuthSasl = 1 + // AuthPolkit is libvirt's REMOTE_AUTH_POLKIT + AuthPolkit = 2 + // ProcConnectOpen is libvirt's REMOTE_PROC_CONNECT_OPEN + ProcConnectOpen = 1 + // ProcConnectClose is libvirt's REMOTE_PROC_CONNECT_CLOSE + ProcConnectClose = 2 + // ProcConnectGetType is libvirt's REMOTE_PROC_CONNECT_GET_TYPE + ProcConnectGetType = 3 + // ProcConnectGetVersion is libvirt's REMOTE_PROC_CONNECT_GET_VERSION + ProcConnectGetVersion = 4 + // ProcConnectGetMaxVcpus is libvirt's REMOTE_PROC_CONNECT_GET_MAX_VCPUS + ProcConnectGetMaxVcpus = 5 + // ProcNodeGetInfo is libvirt's REMOTE_PROC_NODE_GET_INFO + ProcNodeGetInfo = 6 + // ProcConnectGetCapabilities is libvirt's REMOTE_PROC_CONNECT_GET_CAPABILITIES + ProcConnectGetCapabilities = 7 + // ProcDomainAttachDevice is libvirt's REMOTE_PROC_DOMAIN_ATTACH_DEVICE + ProcDomainAttachDevice = 8 + // ProcDomainCreate is libvirt's REMOTE_PROC_DOMAIN_CREATE + ProcDomainCreate = 9 + // ProcDomainCreateXML is libvirt's REMOTE_PROC_DOMAIN_CREATE_XML + ProcDomainCreateXML = 10 + // ProcDomainDefineXML is libvirt's REMOTE_PROC_DOMAIN_DEFINE_XML + ProcDomainDefineXML = 11 + // ProcDomainDestroy is libvirt's REMOTE_PROC_DOMAIN_DESTROY + ProcDomainDestroy = 12 + // ProcDomainDetachDevice is libvirt's REMOTE_PROC_DOMAIN_DETACH_DEVICE + ProcDomainDetachDevice = 13 + // ProcDomainGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_GET_XML_DESC + ProcDomainGetXMLDesc = 14 + // ProcDomainGetAutostart is libvirt's REMOTE_PROC_DOMAIN_GET_AUTOSTART + ProcDomainGetAutostart = 15 + // ProcDomainGetInfo is libvirt's REMOTE_PROC_DOMAIN_GET_INFO + ProcDomainGetInfo = 16 + // ProcDomainGetMaxMemory is libvirt's REMOTE_PROC_DOMAIN_GET_MAX_MEMORY + ProcDomainGetMaxMemory = 17 + // ProcDomainGetMaxVcpus is libvirt's REMOTE_PROC_DOMAIN_GET_MAX_VCPUS + ProcDomainGetMaxVcpus = 18 + // ProcDomainGetOsType is libvirt's REMOTE_PROC_DOMAIN_GET_OS_TYPE + ProcDomainGetOsType = 19 + // ProcDomainGetVcpus is libvirt's REMOTE_PROC_DOMAIN_GET_VCPUS + ProcDomainGetVcpus = 20 + // ProcConnectListDefinedDomains is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_DOMAINS + ProcConnectListDefinedDomains = 21 + // ProcDomainLookupByID is libvirt's REMOTE_PROC_DOMAIN_LOOKUP_BY_ID + ProcDomainLookupByID = 22 + // ProcDomainLookupByName is libvirt's REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME + ProcDomainLookupByName = 23 + // ProcDomainLookupByUUID is libvirt's REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID + ProcDomainLookupByUUID = 24 + // ProcConnectNumOfDefinedDomains is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_DOMAINS + ProcConnectNumOfDefinedDomains = 25 + // ProcDomainPinVcpu is libvirt's REMOTE_PROC_DOMAIN_PIN_VCPU + ProcDomainPinVcpu = 26 + // ProcDomainReboot is libvirt's REMOTE_PROC_DOMAIN_REBOOT + ProcDomainReboot = 27 + // ProcDomainResume is libvirt's REMOTE_PROC_DOMAIN_RESUME + ProcDomainResume = 28 + // ProcDomainSetAutostart is libvirt's REMOTE_PROC_DOMAIN_SET_AUTOSTART + ProcDomainSetAutostart = 29 + // ProcDomainSetMaxMemory is libvirt's REMOTE_PROC_DOMAIN_SET_MAX_MEMORY + ProcDomainSetMaxMemory = 30 + // ProcDomainSetMemory is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY + ProcDomainSetMemory = 31 + // ProcDomainSetVcpus is libvirt's REMOTE_PROC_DOMAIN_SET_VCPUS + ProcDomainSetVcpus = 32 + // ProcDomainShutdown is libvirt's REMOTE_PROC_DOMAIN_SHUTDOWN + ProcDomainShutdown = 33 + // ProcDomainSuspend is libvirt's REMOTE_PROC_DOMAIN_SUSPEND + ProcDomainSuspend = 34 + // ProcDomainUndefine is libvirt's REMOTE_PROC_DOMAIN_UNDEFINE + ProcDomainUndefine = 35 + // ProcConnectListDefinedNetworks is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_NETWORKS + ProcConnectListDefinedNetworks = 36 + // ProcConnectListDomains is libvirt's REMOTE_PROC_CONNECT_LIST_DOMAINS + ProcConnectListDomains = 37 + // ProcConnectListNetworks is libvirt's REMOTE_PROC_CONNECT_LIST_NETWORKS + ProcConnectListNetworks = 38 + // ProcNetworkCreate is libvirt's REMOTE_PROC_NETWORK_CREATE + ProcNetworkCreate = 39 + // ProcNetworkCreateXML is libvirt's REMOTE_PROC_NETWORK_CREATE_XML + ProcNetworkCreateXML = 40 + // ProcNetworkDefineXML is libvirt's REMOTE_PROC_NETWORK_DEFINE_XML + ProcNetworkDefineXML = 41 + // ProcNetworkDestroy is libvirt's REMOTE_PROC_NETWORK_DESTROY + ProcNetworkDestroy = 42 + // ProcNetworkGetXMLDesc is libvirt's REMOTE_PROC_NETWORK_GET_XML_DESC + ProcNetworkGetXMLDesc = 43 + // ProcNetworkGetAutostart is libvirt's REMOTE_PROC_NETWORK_GET_AUTOSTART + ProcNetworkGetAutostart = 44 + // ProcNetworkGetBridgeName is libvirt's REMOTE_PROC_NETWORK_GET_BRIDGE_NAME + ProcNetworkGetBridgeName = 45 + // ProcNetworkLookupByName is libvirt's REMOTE_PROC_NETWORK_LOOKUP_BY_NAME + ProcNetworkLookupByName = 46 + // ProcNetworkLookupByUUID is libvirt's REMOTE_PROC_NETWORK_LOOKUP_BY_UUID + ProcNetworkLookupByUUID = 47 + // ProcNetworkSetAutostart is libvirt's REMOTE_PROC_NETWORK_SET_AUTOSTART + ProcNetworkSetAutostart = 48 + // ProcNetworkUndefine is libvirt's REMOTE_PROC_NETWORK_UNDEFINE + ProcNetworkUndefine = 49 + // ProcConnectNumOfDefinedNetworks is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_NETWORKS + ProcConnectNumOfDefinedNetworks = 50 + // ProcConnectNumOfDomains is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DOMAINS + ProcConnectNumOfDomains = 51 + // ProcConnectNumOfNetworks is libvirt's REMOTE_PROC_CONNECT_NUM_OF_NETWORKS + ProcConnectNumOfNetworks = 52 + // ProcDomainCoreDump is libvirt's REMOTE_PROC_DOMAIN_CORE_DUMP + ProcDomainCoreDump = 53 + // ProcDomainRestore is libvirt's REMOTE_PROC_DOMAIN_RESTORE + ProcDomainRestore = 54 + // ProcDomainSave is libvirt's REMOTE_PROC_DOMAIN_SAVE + ProcDomainSave = 55 + // ProcDomainGetSchedulerType is libvirt's REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE + ProcDomainGetSchedulerType = 56 + // ProcDomainGetSchedulerParameters is libvirt's REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS + ProcDomainGetSchedulerParameters = 57 + // ProcDomainSetSchedulerParameters is libvirt's REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS + ProcDomainSetSchedulerParameters = 58 + // ProcConnectGetHostname is libvirt's REMOTE_PROC_CONNECT_GET_HOSTNAME + ProcConnectGetHostname = 59 + // ProcConnectSupportsFeature is libvirt's REMOTE_PROC_CONNECT_SUPPORTS_FEATURE + ProcConnectSupportsFeature = 60 + // ProcDomainMigratePrepare is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE + ProcDomainMigratePrepare = 61 + // ProcDomainMigratePerform is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PERFORM + ProcDomainMigratePerform = 62 + // ProcDomainMigrateFinish is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH + ProcDomainMigrateFinish = 63 + // ProcDomainBlockStats is libvirt's REMOTE_PROC_DOMAIN_BLOCK_STATS + ProcDomainBlockStats = 64 + // ProcDomainInterfaceStats is libvirt's REMOTE_PROC_DOMAIN_INTERFACE_STATS + ProcDomainInterfaceStats = 65 + // ProcAuthList is libvirt's REMOTE_PROC_AUTH_LIST + ProcAuthList = 66 + // ProcAuthSaslInit is libvirt's REMOTE_PROC_AUTH_SASL_INIT + ProcAuthSaslInit = 67 + // ProcAuthSaslStart is libvirt's REMOTE_PROC_AUTH_SASL_START + ProcAuthSaslStart = 68 + // ProcAuthSaslStep is libvirt's REMOTE_PROC_AUTH_SASL_STEP + ProcAuthSaslStep = 69 + // ProcAuthPolkit is libvirt's REMOTE_PROC_AUTH_POLKIT + ProcAuthPolkit = 70 + // ProcConnectNumOfStoragePools is libvirt's REMOTE_PROC_CONNECT_NUM_OF_STORAGE_POOLS + ProcConnectNumOfStoragePools = 71 + // ProcConnectListStoragePools is libvirt's REMOTE_PROC_CONNECT_LIST_STORAGE_POOLS + ProcConnectListStoragePools = 72 + // ProcConnectNumOfDefinedStoragePools is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_STORAGE_POOLS + ProcConnectNumOfDefinedStoragePools = 73 + // ProcConnectListDefinedStoragePools is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_STORAGE_POOLS + ProcConnectListDefinedStoragePools = 74 + // ProcConnectFindStoragePoolSources is libvirt's REMOTE_PROC_CONNECT_FIND_STORAGE_POOL_SOURCES + ProcConnectFindStoragePoolSources = 75 + // ProcStoragePoolCreateXML is libvirt's REMOTE_PROC_STORAGE_POOL_CREATE_XML + ProcStoragePoolCreateXML = 76 + // ProcStoragePoolDefineXML is libvirt's REMOTE_PROC_STORAGE_POOL_DEFINE_XML + ProcStoragePoolDefineXML = 77 + // ProcStoragePoolCreate is libvirt's REMOTE_PROC_STORAGE_POOL_CREATE + ProcStoragePoolCreate = 78 + // ProcStoragePoolBuild is libvirt's REMOTE_PROC_STORAGE_POOL_BUILD + ProcStoragePoolBuild = 79 + // ProcStoragePoolDestroy is libvirt's REMOTE_PROC_STORAGE_POOL_DESTROY + ProcStoragePoolDestroy = 80 + // ProcStoragePoolDelete is libvirt's REMOTE_PROC_STORAGE_POOL_DELETE + ProcStoragePoolDelete = 81 + // ProcStoragePoolUndefine is libvirt's REMOTE_PROC_STORAGE_POOL_UNDEFINE + ProcStoragePoolUndefine = 82 + // ProcStoragePoolRefresh is libvirt's REMOTE_PROC_STORAGE_POOL_REFRESH + ProcStoragePoolRefresh = 83 + // ProcStoragePoolLookupByName is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME + ProcStoragePoolLookupByName = 84 + // ProcStoragePoolLookupByUUID is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID + ProcStoragePoolLookupByUUID = 85 + // ProcStoragePoolLookupByVolume is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME + ProcStoragePoolLookupByVolume = 86 + // ProcStoragePoolGetInfo is libvirt's REMOTE_PROC_STORAGE_POOL_GET_INFO + ProcStoragePoolGetInfo = 87 + // ProcStoragePoolGetXMLDesc is libvirt's REMOTE_PROC_STORAGE_POOL_GET_XML_DESC + ProcStoragePoolGetXMLDesc = 88 + // ProcStoragePoolGetAutostart is libvirt's REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART + ProcStoragePoolGetAutostart = 89 + // ProcStoragePoolSetAutostart is libvirt's REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART + ProcStoragePoolSetAutostart = 90 + // ProcStoragePoolNumOfVolumes is libvirt's REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES + ProcStoragePoolNumOfVolumes = 91 + // ProcStoragePoolListVolumes is libvirt's REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES + ProcStoragePoolListVolumes = 92 + // ProcStorageVolCreateXML is libvirt's REMOTE_PROC_STORAGE_VOL_CREATE_XML + ProcStorageVolCreateXML = 93 + // ProcStorageVolDelete is libvirt's REMOTE_PROC_STORAGE_VOL_DELETE + ProcStorageVolDelete = 94 + // ProcStorageVolLookupByName is libvirt's REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME + ProcStorageVolLookupByName = 95 + // ProcStorageVolLookupByKey is libvirt's REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY + ProcStorageVolLookupByKey = 96 + // ProcStorageVolLookupByPath is libvirt's REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH + ProcStorageVolLookupByPath = 97 + // ProcStorageVolGetInfo is libvirt's REMOTE_PROC_STORAGE_VOL_GET_INFO + ProcStorageVolGetInfo = 98 + // ProcStorageVolGetXMLDesc is libvirt's REMOTE_PROC_STORAGE_VOL_GET_XML_DESC + ProcStorageVolGetXMLDesc = 99 + // ProcStorageVolGetPath is libvirt's REMOTE_PROC_STORAGE_VOL_GET_PATH + ProcStorageVolGetPath = 100 + // ProcNodeGetCellsFreeMemory is libvirt's REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY + ProcNodeGetCellsFreeMemory = 101 + // ProcNodeGetFreeMemory is libvirt's REMOTE_PROC_NODE_GET_FREE_MEMORY + ProcNodeGetFreeMemory = 102 + // ProcDomainBlockPeek is libvirt's REMOTE_PROC_DOMAIN_BLOCK_PEEK + ProcDomainBlockPeek = 103 + // ProcDomainMemoryPeek is libvirt's REMOTE_PROC_DOMAIN_MEMORY_PEEK + ProcDomainMemoryPeek = 104 + // ProcConnectDomainEventRegister is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER + ProcConnectDomainEventRegister = 105 + // ProcConnectDomainEventDeregister is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER + ProcConnectDomainEventDeregister = 106 + // ProcDomainEventLifecycle is libvirt's REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE + ProcDomainEventLifecycle = 107 + // ProcDomainMigratePrepare2 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2 + ProcDomainMigratePrepare2 = 108 + // ProcDomainMigrateFinish2 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH2 + ProcDomainMigrateFinish2 = 109 + // ProcConnectGetUri is libvirt's REMOTE_PROC_CONNECT_GET_URI + ProcConnectGetUri = 110 + // ProcNodeNumOfDevices is libvirt's REMOTE_PROC_NODE_NUM_OF_DEVICES + ProcNodeNumOfDevices = 111 + // ProcNodeListDevices is libvirt's REMOTE_PROC_NODE_LIST_DEVICES + ProcNodeListDevices = 112 + // ProcNodeDeviceLookupByName is libvirt's REMOTE_PROC_NODE_DEVICE_LOOKUP_BY_NAME + ProcNodeDeviceLookupByName = 113 + // ProcNodeDeviceGetXMLDesc is libvirt's REMOTE_PROC_NODE_DEVICE_GET_XML_DESC + ProcNodeDeviceGetXMLDesc = 114 + // ProcNodeDeviceGetParent is libvirt's REMOTE_PROC_NODE_DEVICE_GET_PARENT + ProcNodeDeviceGetParent = 115 + // ProcNodeDeviceNumOfCaps is libvirt's REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS + ProcNodeDeviceNumOfCaps = 116 + // ProcNodeDeviceListCaps is libvirt's REMOTE_PROC_NODE_DEVICE_LIST_CAPS + ProcNodeDeviceListCaps = 117 + // ProcNodeDeviceDettach is libvirt's REMOTE_PROC_NODE_DEVICE_DETTACH + ProcNodeDeviceDettach = 118 + // ProcNodeDeviceReAttach is libvirt's REMOTE_PROC_NODE_DEVICE_RE_ATTACH + ProcNodeDeviceReAttach = 119 + // ProcNodeDeviceReset is libvirt's REMOTE_PROC_NODE_DEVICE_RESET + ProcNodeDeviceReset = 120 + // ProcDomainGetSecurityLabel is libvirt's REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL + ProcDomainGetSecurityLabel = 121 + // ProcNodeGetSecurityModel is libvirt's REMOTE_PROC_NODE_GET_SECURITY_MODEL + ProcNodeGetSecurityModel = 122 + // ProcNodeDeviceCreateXML is libvirt's REMOTE_PROC_NODE_DEVICE_CREATE_XML + ProcNodeDeviceCreateXML = 123 + // ProcNodeDeviceDestroy is libvirt's REMOTE_PROC_NODE_DEVICE_DESTROY + ProcNodeDeviceDestroy = 124 + // ProcStorageVolCreateXMLFrom is libvirt's REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM + ProcStorageVolCreateXMLFrom = 125 + // ProcConnectNumOfInterfaces is libvirt's REMOTE_PROC_CONNECT_NUM_OF_INTERFACES + ProcConnectNumOfInterfaces = 126 + // ProcConnectListInterfaces is libvirt's REMOTE_PROC_CONNECT_LIST_INTERFACES + ProcConnectListInterfaces = 127 + // ProcInterfaceLookupByName is libvirt's REMOTE_PROC_INTERFACE_LOOKUP_BY_NAME + ProcInterfaceLookupByName = 128 + // ProcInterfaceLookupByMacString is libvirt's REMOTE_PROC_INTERFACE_LOOKUP_BY_MAC_STRING + ProcInterfaceLookupByMacString = 129 + // ProcInterfaceGetXMLDesc is libvirt's REMOTE_PROC_INTERFACE_GET_XML_DESC + ProcInterfaceGetXMLDesc = 130 + // ProcInterfaceDefineXML is libvirt's REMOTE_PROC_INTERFACE_DEFINE_XML + ProcInterfaceDefineXML = 131 + // ProcInterfaceUndefine is libvirt's REMOTE_PROC_INTERFACE_UNDEFINE + ProcInterfaceUndefine = 132 + // ProcInterfaceCreate is libvirt's REMOTE_PROC_INTERFACE_CREATE + ProcInterfaceCreate = 133 + // ProcInterfaceDestroy is libvirt's REMOTE_PROC_INTERFACE_DESTROY + ProcInterfaceDestroy = 134 + // ProcConnectDomainXMLFromNative is libvirt's REMOTE_PROC_CONNECT_DOMAIN_XML_FROM_NATIVE + ProcConnectDomainXMLFromNative = 135 + // ProcConnectDomainXMLToNative is libvirt's REMOTE_PROC_CONNECT_DOMAIN_XML_TO_NATIVE + ProcConnectDomainXMLToNative = 136 + // ProcConnectNumOfDefinedInterfaces is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_INTERFACES + ProcConnectNumOfDefinedInterfaces = 137 + // ProcConnectListDefinedInterfaces is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_INTERFACES + ProcConnectListDefinedInterfaces = 138 + // ProcConnectNumOfSecrets is libvirt's REMOTE_PROC_CONNECT_NUM_OF_SECRETS + ProcConnectNumOfSecrets = 139 + // ProcConnectListSecrets is libvirt's REMOTE_PROC_CONNECT_LIST_SECRETS + ProcConnectListSecrets = 140 + // ProcSecretLookupByUUID is libvirt's REMOTE_PROC_SECRET_LOOKUP_BY_UUID + ProcSecretLookupByUUID = 141 + // ProcSecretDefineXML is libvirt's REMOTE_PROC_SECRET_DEFINE_XML + ProcSecretDefineXML = 142 + // ProcSecretGetXMLDesc is libvirt's REMOTE_PROC_SECRET_GET_XML_DESC + ProcSecretGetXMLDesc = 143 + // ProcSecretSetValue is libvirt's REMOTE_PROC_SECRET_SET_VALUE + ProcSecretSetValue = 144 + // ProcSecretGetValue is libvirt's REMOTE_PROC_SECRET_GET_VALUE + ProcSecretGetValue = 145 + // ProcSecretUndefine is libvirt's REMOTE_PROC_SECRET_UNDEFINE + ProcSecretUndefine = 146 + // ProcSecretLookupByUsage is libvirt's REMOTE_PROC_SECRET_LOOKUP_BY_USAGE + ProcSecretLookupByUsage = 147 + // ProcDomainMigratePrepareTunnel is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL + ProcDomainMigratePrepareTunnel = 148 + // ProcConnectIsSecure is libvirt's REMOTE_PROC_CONNECT_IS_SECURE + ProcConnectIsSecure = 149 + // ProcDomainIsActive is libvirt's REMOTE_PROC_DOMAIN_IS_ACTIVE + ProcDomainIsActive = 150 + // ProcDomainIsPersistent is libvirt's REMOTE_PROC_DOMAIN_IS_PERSISTENT + ProcDomainIsPersistent = 151 + // ProcNetworkIsActive is libvirt's REMOTE_PROC_NETWORK_IS_ACTIVE + ProcNetworkIsActive = 152 + // ProcNetworkIsPersistent is libvirt's REMOTE_PROC_NETWORK_IS_PERSISTENT + ProcNetworkIsPersistent = 153 + // ProcStoragePoolIsActive is libvirt's REMOTE_PROC_STORAGE_POOL_IS_ACTIVE + ProcStoragePoolIsActive = 154 + // ProcStoragePoolIsPersistent is libvirt's REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT + ProcStoragePoolIsPersistent = 155 + // ProcInterfaceIsActive is libvirt's REMOTE_PROC_INTERFACE_IS_ACTIVE + ProcInterfaceIsActive = 156 + // ProcConnectGetLibVersion is libvirt's REMOTE_PROC_CONNECT_GET_LIB_VERSION + ProcConnectGetLibVersion = 157 + // ProcConnectCompareCPU is libvirt's REMOTE_PROC_CONNECT_COMPARE_CPU + ProcConnectCompareCPU = 158 + // ProcDomainMemoryStats is libvirt's REMOTE_PROC_DOMAIN_MEMORY_STATS + ProcDomainMemoryStats = 159 + // ProcDomainAttachDeviceFlags is libvirt's REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS + ProcDomainAttachDeviceFlags = 160 + // ProcDomainDetachDeviceFlags is libvirt's REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS + ProcDomainDetachDeviceFlags = 161 + // ProcConnectBaselineCPU is libvirt's REMOTE_PROC_CONNECT_BASELINE_CPU + ProcConnectBaselineCPU = 162 + // ProcDomainGetJobInfo is libvirt's REMOTE_PROC_DOMAIN_GET_JOB_INFO + ProcDomainGetJobInfo = 163 + // ProcDomainAbortJob is libvirt's REMOTE_PROC_DOMAIN_ABORT_JOB + ProcDomainAbortJob = 164 + // ProcStorageVolWipe is libvirt's REMOTE_PROC_STORAGE_VOL_WIPE + ProcStorageVolWipe = 165 + // ProcDomainMigrateSetMaxDowntime is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME + ProcDomainMigrateSetMaxDowntime = 166 + // ProcConnectDomainEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY + ProcConnectDomainEventRegisterAny = 167 + // ProcConnectDomainEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER_ANY + ProcConnectDomainEventDeregisterAny = 168 + // ProcDomainEventReboot is libvirt's REMOTE_PROC_DOMAIN_EVENT_REBOOT + ProcDomainEventReboot = 169 + // ProcDomainEventRtcChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE + ProcDomainEventRtcChange = 170 + // ProcDomainEventWatchdog is libvirt's REMOTE_PROC_DOMAIN_EVENT_WATCHDOG + ProcDomainEventWatchdog = 171 + // ProcDomainEventIOError is libvirt's REMOTE_PROC_DOMAIN_EVENT_IO_ERROR + ProcDomainEventIOError = 172 + // ProcDomainEventGraphics is libvirt's REMOTE_PROC_DOMAIN_EVENT_GRAPHICS + ProcDomainEventGraphics = 173 + // ProcDomainUpdateDeviceFlags is libvirt's REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS + ProcDomainUpdateDeviceFlags = 174 + // ProcNwfilterLookupByName is libvirt's REMOTE_PROC_NWFILTER_LOOKUP_BY_NAME + ProcNwfilterLookupByName = 175 + // ProcNwfilterLookupByUUID is libvirt's REMOTE_PROC_NWFILTER_LOOKUP_BY_UUID + ProcNwfilterLookupByUUID = 176 + // ProcNwfilterGetXMLDesc is libvirt's REMOTE_PROC_NWFILTER_GET_XML_DESC + ProcNwfilterGetXMLDesc = 177 + // ProcConnectNumOfNwfilters is libvirt's REMOTE_PROC_CONNECT_NUM_OF_NWFILTERS + ProcConnectNumOfNwfilters = 178 + // ProcConnectListNwfilters is libvirt's REMOTE_PROC_CONNECT_LIST_NWFILTERS + ProcConnectListNwfilters = 179 + // ProcNwfilterDefineXML is libvirt's REMOTE_PROC_NWFILTER_DEFINE_XML + ProcNwfilterDefineXML = 180 + // ProcNwfilterUndefine is libvirt's REMOTE_PROC_NWFILTER_UNDEFINE + ProcNwfilterUndefine = 181 + // ProcDomainManagedSave is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE + ProcDomainManagedSave = 182 + // ProcDomainHasManagedSaveImage is libvirt's REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE + ProcDomainHasManagedSaveImage = 183 + // ProcDomainManagedSaveRemove is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE + ProcDomainManagedSaveRemove = 184 + // ProcDomainSnapshotCreateXML is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML + ProcDomainSnapshotCreateXML = 185 + // ProcDomainSnapshotGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_GET_XML_DESC + ProcDomainSnapshotGetXMLDesc = 186 + // ProcDomainSnapshotNum is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_NUM + ProcDomainSnapshotNum = 187 + // ProcDomainSnapshotListNames is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_NAMES + ProcDomainSnapshotListNames = 188 + // ProcDomainSnapshotLookupByName is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LOOKUP_BY_NAME + ProcDomainSnapshotLookupByName = 189 + // ProcDomainHasCurrentSnapshot is libvirt's REMOTE_PROC_DOMAIN_HAS_CURRENT_SNAPSHOT + ProcDomainHasCurrentSnapshot = 190 + // ProcDomainSnapshotCurrent is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT + ProcDomainSnapshotCurrent = 191 + // ProcDomainRevertToSnapshot is libvirt's REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT + ProcDomainRevertToSnapshot = 192 + // ProcDomainSnapshotDelete is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE + ProcDomainSnapshotDelete = 193 + // ProcDomainGetBlockInfo is libvirt's REMOTE_PROC_DOMAIN_GET_BLOCK_INFO + ProcDomainGetBlockInfo = 194 + // ProcDomainEventIOErrorReason is libvirt's REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON + ProcDomainEventIOErrorReason = 195 + // ProcDomainCreateWithFlags is libvirt's REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS + ProcDomainCreateWithFlags = 196 + // ProcDomainSetMemoryParameters is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS + ProcDomainSetMemoryParameters = 197 + // ProcDomainGetMemoryParameters is libvirt's REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS + ProcDomainGetMemoryParameters = 198 + // ProcDomainSetVcpusFlags is libvirt's REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS + ProcDomainSetVcpusFlags = 199 + // ProcDomainGetVcpusFlags is libvirt's REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS + ProcDomainGetVcpusFlags = 200 + // ProcDomainOpenConsole is libvirt's REMOTE_PROC_DOMAIN_OPEN_CONSOLE + ProcDomainOpenConsole = 201 + // ProcDomainIsUpdated is libvirt's REMOTE_PROC_DOMAIN_IS_UPDATED + ProcDomainIsUpdated = 202 + // ProcConnectGetSysinfo is libvirt's REMOTE_PROC_CONNECT_GET_SYSINFO + ProcConnectGetSysinfo = 203 + // ProcDomainSetMemoryFlags is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS + ProcDomainSetMemoryFlags = 204 + // ProcDomainSetBlkioParameters is libvirt's REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS + ProcDomainSetBlkioParameters = 205 + // ProcDomainGetBlkioParameters is libvirt's REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS + ProcDomainGetBlkioParameters = 206 + // ProcDomainMigrateSetMaxSpeed is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED + ProcDomainMigrateSetMaxSpeed = 207 + // ProcStorageVolUpload is libvirt's REMOTE_PROC_STORAGE_VOL_UPLOAD + ProcStorageVolUpload = 208 + // ProcStorageVolDownload is libvirt's REMOTE_PROC_STORAGE_VOL_DOWNLOAD + ProcStorageVolDownload = 209 + // ProcDomainInjectNmi is libvirt's REMOTE_PROC_DOMAIN_INJECT_NMI + ProcDomainInjectNmi = 210 + // ProcDomainScreenshot is libvirt's REMOTE_PROC_DOMAIN_SCREENSHOT + ProcDomainScreenshot = 211 + // ProcDomainGetState is libvirt's REMOTE_PROC_DOMAIN_GET_STATE + ProcDomainGetState = 212 + // ProcDomainMigrateBegin3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3 + ProcDomainMigrateBegin3 = 213 + // ProcDomainMigratePrepare3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3 + ProcDomainMigratePrepare3 = 214 + // ProcDomainMigratePrepareTunnel3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3 + ProcDomainMigratePrepareTunnel3 = 215 + // ProcDomainMigratePerform3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3 + ProcDomainMigratePerform3 = 216 + // ProcDomainMigrateFinish3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH3 + ProcDomainMigrateFinish3 = 217 + // ProcDomainMigrateConfirm3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3 + ProcDomainMigrateConfirm3 = 218 + // ProcDomainSetSchedulerParametersFlags is libvirt's REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS + ProcDomainSetSchedulerParametersFlags = 219 + // ProcInterfaceChangeBegin is libvirt's REMOTE_PROC_INTERFACE_CHANGE_BEGIN + ProcInterfaceChangeBegin = 220 + // ProcInterfaceChangeCommit is libvirt's REMOTE_PROC_INTERFACE_CHANGE_COMMIT + ProcInterfaceChangeCommit = 221 + // ProcInterfaceChangeRollback is libvirt's REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK + ProcInterfaceChangeRollback = 222 + // ProcDomainGetSchedulerParametersFlags is libvirt's REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS + ProcDomainGetSchedulerParametersFlags = 223 + // ProcDomainEventControlError is libvirt's REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR + ProcDomainEventControlError = 224 + // ProcDomainPinVcpuFlags is libvirt's REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS + ProcDomainPinVcpuFlags = 225 + // ProcDomainSendKey is libvirt's REMOTE_PROC_DOMAIN_SEND_KEY + ProcDomainSendKey = 226 + // ProcNodeGetCPUStats is libvirt's REMOTE_PROC_NODE_GET_CPU_STATS + ProcNodeGetCPUStats = 227 + // ProcNodeGetMemoryStats is libvirt's REMOTE_PROC_NODE_GET_MEMORY_STATS + ProcNodeGetMemoryStats = 228 + // ProcDomainGetControlInfo is libvirt's REMOTE_PROC_DOMAIN_GET_CONTROL_INFO + ProcDomainGetControlInfo = 229 + // ProcDomainGetVcpuPinInfo is libvirt's REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO + ProcDomainGetVcpuPinInfo = 230 + // ProcDomainUndefineFlags is libvirt's REMOTE_PROC_DOMAIN_UNDEFINE_FLAGS + ProcDomainUndefineFlags = 231 + // ProcDomainSaveFlags is libvirt's REMOTE_PROC_DOMAIN_SAVE_FLAGS + ProcDomainSaveFlags = 232 + // ProcDomainRestoreFlags is libvirt's REMOTE_PROC_DOMAIN_RESTORE_FLAGS + ProcDomainRestoreFlags = 233 + // ProcDomainDestroyFlags is libvirt's REMOTE_PROC_DOMAIN_DESTROY_FLAGS + ProcDomainDestroyFlags = 234 + // ProcDomainSaveImageGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC + ProcDomainSaveImageGetXMLDesc = 235 + // ProcDomainSaveImageDefineXML is libvirt's REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML + ProcDomainSaveImageDefineXML = 236 + // ProcDomainBlockJobAbort is libvirt's REMOTE_PROC_DOMAIN_BLOCK_JOB_ABORT + ProcDomainBlockJobAbort = 237 + // ProcDomainGetBlockJobInfo is libvirt's REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO + ProcDomainGetBlockJobInfo = 238 + // ProcDomainBlockJobSetSpeed is libvirt's REMOTE_PROC_DOMAIN_BLOCK_JOB_SET_SPEED + ProcDomainBlockJobSetSpeed = 239 + // ProcDomainBlockPull is libvirt's REMOTE_PROC_DOMAIN_BLOCK_PULL + ProcDomainBlockPull = 240 + // ProcDomainEventBlockJob is libvirt's REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB + ProcDomainEventBlockJob = 241 + // ProcDomainMigrateGetMaxSpeed is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED + ProcDomainMigrateGetMaxSpeed = 242 + // ProcDomainBlockStatsFlags is libvirt's REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS + ProcDomainBlockStatsFlags = 243 + // ProcDomainSnapshotGetParent is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT + ProcDomainSnapshotGetParent = 244 + // ProcDomainReset is libvirt's REMOTE_PROC_DOMAIN_RESET + ProcDomainReset = 245 + // ProcDomainSnapshotNumChildren is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_NUM_CHILDREN + ProcDomainSnapshotNumChildren = 246 + // ProcDomainSnapshotListChildrenNames is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_CHILDREN_NAMES + ProcDomainSnapshotListChildrenNames = 247 + // ProcDomainEventDiskChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE + ProcDomainEventDiskChange = 248 + // ProcDomainOpenGraphics is libvirt's REMOTE_PROC_DOMAIN_OPEN_GRAPHICS + ProcDomainOpenGraphics = 249 + // ProcNodeSuspendForDuration is libvirt's REMOTE_PROC_NODE_SUSPEND_FOR_DURATION + ProcNodeSuspendForDuration = 250 + // ProcDomainBlockResize is libvirt's REMOTE_PROC_DOMAIN_BLOCK_RESIZE + ProcDomainBlockResize = 251 + // ProcDomainSetBlockIOTune is libvirt's REMOTE_PROC_DOMAIN_SET_BLOCK_IO_TUNE + ProcDomainSetBlockIOTune = 252 + // ProcDomainGetBlockIOTune is libvirt's REMOTE_PROC_DOMAIN_GET_BLOCK_IO_TUNE + ProcDomainGetBlockIOTune = 253 + // ProcDomainSetNumaParameters is libvirt's REMOTE_PROC_DOMAIN_SET_NUMA_PARAMETERS + ProcDomainSetNumaParameters = 254 + // ProcDomainGetNumaParameters is libvirt's REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS + ProcDomainGetNumaParameters = 255 + // ProcDomainSetInterfaceParameters is libvirt's REMOTE_PROC_DOMAIN_SET_INTERFACE_PARAMETERS + ProcDomainSetInterfaceParameters = 256 + // ProcDomainGetInterfaceParameters is libvirt's REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS + ProcDomainGetInterfaceParameters = 257 + // ProcDomainShutdownFlags is libvirt's REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS + ProcDomainShutdownFlags = 258 + // ProcStorageVolWipePattern is libvirt's REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN + ProcStorageVolWipePattern = 259 + // ProcStorageVolResize is libvirt's REMOTE_PROC_STORAGE_VOL_RESIZE + ProcStorageVolResize = 260 + // ProcDomainPmSuspendForDuration is libvirt's REMOTE_PROC_DOMAIN_PM_SUSPEND_FOR_DURATION + ProcDomainPmSuspendForDuration = 261 + // ProcDomainGetCPUStats is libvirt's REMOTE_PROC_DOMAIN_GET_CPU_STATS + ProcDomainGetCPUStats = 262 + // ProcDomainGetDiskErrors is libvirt's REMOTE_PROC_DOMAIN_GET_DISK_ERRORS + ProcDomainGetDiskErrors = 263 + // ProcDomainSetMetadata is libvirt's REMOTE_PROC_DOMAIN_SET_METADATA + ProcDomainSetMetadata = 264 + // ProcDomainGetMetadata is libvirt's REMOTE_PROC_DOMAIN_GET_METADATA + ProcDomainGetMetadata = 265 + // ProcDomainBlockRebase is libvirt's REMOTE_PROC_DOMAIN_BLOCK_REBASE + ProcDomainBlockRebase = 266 + // ProcDomainPmWakeup is libvirt's REMOTE_PROC_DOMAIN_PM_WAKEUP + ProcDomainPmWakeup = 267 + // ProcDomainEventTrayChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE + ProcDomainEventTrayChange = 268 + // ProcDomainEventPmwakeup is libvirt's REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP + ProcDomainEventPmwakeup = 269 + // ProcDomainEventPmsuspend is libvirt's REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND + ProcDomainEventPmsuspend = 270 + // ProcDomainSnapshotIsCurrent is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_IS_CURRENT + ProcDomainSnapshotIsCurrent = 271 + // ProcDomainSnapshotHasMetadata is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA + ProcDomainSnapshotHasMetadata = 272 + // ProcConnectListAllDomains is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS + ProcConnectListAllDomains = 273 + // ProcDomainListAllSnapshots is libvirt's REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS + ProcDomainListAllSnapshots = 274 + // ProcDomainSnapshotListAllChildren is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN + ProcDomainSnapshotListAllChildren = 275 + // ProcDomainEventBalloonChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE + ProcDomainEventBalloonChange = 276 + // ProcDomainGetHostname is libvirt's REMOTE_PROC_DOMAIN_GET_HOSTNAME + ProcDomainGetHostname = 277 + // ProcDomainGetSecurityLabelList is libvirt's REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST + ProcDomainGetSecurityLabelList = 278 + // ProcDomainPinEmulator is libvirt's REMOTE_PROC_DOMAIN_PIN_EMULATOR + ProcDomainPinEmulator = 279 + // ProcDomainGetEmulatorPinInfo is libvirt's REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO + ProcDomainGetEmulatorPinInfo = 280 + // ProcConnectListAllStoragePools is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS + ProcConnectListAllStoragePools = 281 + // ProcStoragePoolListAllVolumes is libvirt's REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES + ProcStoragePoolListAllVolumes = 282 + // ProcConnectListAllNetworks is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS + ProcConnectListAllNetworks = 283 + // ProcConnectListAllInterfaces is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES + ProcConnectListAllInterfaces = 284 + // ProcConnectListAllNodeDevices is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NODE_DEVICES + ProcConnectListAllNodeDevices = 285 + // ProcConnectListAllNwfilters is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NWFILTERS + ProcConnectListAllNwfilters = 286 + // ProcConnectListAllSecrets is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_SECRETS + ProcConnectListAllSecrets = 287 + // ProcNodeSetMemoryParameters is libvirt's REMOTE_PROC_NODE_SET_MEMORY_PARAMETERS + ProcNodeSetMemoryParameters = 288 + // ProcNodeGetMemoryParameters is libvirt's REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS + ProcNodeGetMemoryParameters = 289 + // ProcDomainBlockCommit is libvirt's REMOTE_PROC_DOMAIN_BLOCK_COMMIT + ProcDomainBlockCommit = 290 + // ProcNetworkUpdate is libvirt's REMOTE_PROC_NETWORK_UPDATE + ProcNetworkUpdate = 291 + // ProcDomainEventPmsuspendDisk is libvirt's REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_DISK + ProcDomainEventPmsuspendDisk = 292 + // ProcNodeGetCPUMap is libvirt's REMOTE_PROC_NODE_GET_CPU_MAP + ProcNodeGetCPUMap = 293 + // ProcDomainFstrim is libvirt's REMOTE_PROC_DOMAIN_FSTRIM + ProcDomainFstrim = 294 + // ProcDomainSendProcessSignal is libvirt's REMOTE_PROC_DOMAIN_SEND_PROCESS_SIGNAL + ProcDomainSendProcessSignal = 295 + // ProcDomainOpenChannel is libvirt's REMOTE_PROC_DOMAIN_OPEN_CHANNEL + ProcDomainOpenChannel = 296 + // ProcNodeDeviceLookupScsiHostByWwn is libvirt's REMOTE_PROC_NODE_DEVICE_LOOKUP_SCSI_HOST_BY_WWN + ProcNodeDeviceLookupScsiHostByWwn = 297 + // ProcDomainGetJobStats is libvirt's REMOTE_PROC_DOMAIN_GET_JOB_STATS + ProcDomainGetJobStats = 298 + // ProcDomainMigrateGetCompressionCache is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_GET_COMPRESSION_CACHE + ProcDomainMigrateGetCompressionCache = 299 + // ProcDomainMigrateSetCompressionCache is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_SET_COMPRESSION_CACHE + ProcDomainMigrateSetCompressionCache = 300 + // ProcNodeDeviceDetachFlags is libvirt's REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS + ProcNodeDeviceDetachFlags = 301 + // ProcDomainMigrateBegin3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3_PARAMS + ProcDomainMigrateBegin3Params = 302 + // ProcDomainMigratePrepare3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3_PARAMS + ProcDomainMigratePrepare3Params = 303 + // ProcDomainMigratePrepareTunnel3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS + ProcDomainMigratePrepareTunnel3Params = 304 + // ProcDomainMigratePerform3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3_PARAMS + ProcDomainMigratePerform3Params = 305 + // ProcDomainMigrateFinish3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH3_PARAMS + ProcDomainMigrateFinish3Params = 306 + // ProcDomainMigrateConfirm3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3_PARAMS + ProcDomainMigrateConfirm3Params = 307 + // ProcDomainSetMemoryStatsPeriod is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY_STATS_PERIOD + ProcDomainSetMemoryStatsPeriod = 308 + // ProcDomainCreateXMLWithFiles is libvirt's REMOTE_PROC_DOMAIN_CREATE_XML_WITH_FILES + ProcDomainCreateXMLWithFiles = 309 + // ProcDomainCreateWithFiles is libvirt's REMOTE_PROC_DOMAIN_CREATE_WITH_FILES + ProcDomainCreateWithFiles = 310 + // ProcDomainEventDeviceRemoved is libvirt's REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED + ProcDomainEventDeviceRemoved = 311 + // ProcConnectGetCPUModelNames is libvirt's REMOTE_PROC_CONNECT_GET_CPU_MODEL_NAMES + ProcConnectGetCPUModelNames = 312 + // ProcConnectNetworkEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_NETWORK_EVENT_REGISTER_ANY + ProcConnectNetworkEventRegisterAny = 313 + // ProcConnectNetworkEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_NETWORK_EVENT_DEREGISTER_ANY + ProcConnectNetworkEventDeregisterAny = 314 + // ProcNetworkEventLifecycle is libvirt's REMOTE_PROC_NETWORK_EVENT_LIFECYCLE + ProcNetworkEventLifecycle = 315 + // ProcConnectDomainEventCallbackRegisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY + ProcConnectDomainEventCallbackRegisterAny = 316 + // ProcConnectDomainEventCallbackDeregisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY + ProcConnectDomainEventCallbackDeregisterAny = 317 + // ProcDomainEventCallbackLifecycle is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE + ProcDomainEventCallbackLifecycle = 318 + // ProcDomainEventCallbackReboot is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT + ProcDomainEventCallbackReboot = 319 + // ProcDomainEventCallbackRtcChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE + ProcDomainEventCallbackRtcChange = 320 + // ProcDomainEventCallbackWatchdog is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG + ProcDomainEventCallbackWatchdog = 321 + // ProcDomainEventCallbackIOError is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR + ProcDomainEventCallbackIOError = 322 + // ProcDomainEventCallbackGraphics is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS + ProcDomainEventCallbackGraphics = 323 + // ProcDomainEventCallbackIOErrorReason is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON + ProcDomainEventCallbackIOErrorReason = 324 + // ProcDomainEventCallbackControlError is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR + ProcDomainEventCallbackControlError = 325 + // ProcDomainEventCallbackBlockJob is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB + ProcDomainEventCallbackBlockJob = 326 + // ProcDomainEventCallbackDiskChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE + ProcDomainEventCallbackDiskChange = 327 + // ProcDomainEventCallbackTrayChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE + ProcDomainEventCallbackTrayChange = 328 + // ProcDomainEventCallbackPmwakeup is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP + ProcDomainEventCallbackPmwakeup = 329 + // ProcDomainEventCallbackPmsuspend is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND + ProcDomainEventCallbackPmsuspend = 330 + // ProcDomainEventCallbackBalloonChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE + ProcDomainEventCallbackBalloonChange = 331 + // ProcDomainEventCallbackPmsuspendDisk is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK + ProcDomainEventCallbackPmsuspendDisk = 332 + // ProcDomainEventCallbackDeviceRemoved is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED + ProcDomainEventCallbackDeviceRemoved = 333 + // ProcDomainCoreDumpWithFormat is libvirt's REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT + ProcDomainCoreDumpWithFormat = 334 + // ProcDomainFsfreeze is libvirt's REMOTE_PROC_DOMAIN_FSFREEZE + ProcDomainFsfreeze = 335 + // ProcDomainFsthaw is libvirt's REMOTE_PROC_DOMAIN_FSTHAW + ProcDomainFsthaw = 336 + // ProcDomainGetTime is libvirt's REMOTE_PROC_DOMAIN_GET_TIME + ProcDomainGetTime = 337 + // ProcDomainSetTime is libvirt's REMOTE_PROC_DOMAIN_SET_TIME + ProcDomainSetTime = 338 + // ProcDomainEventBlockJob2 is libvirt's REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2 + ProcDomainEventBlockJob2 = 339 + // ProcNodeGetFreePages is libvirt's REMOTE_PROC_NODE_GET_FREE_PAGES + ProcNodeGetFreePages = 340 + // ProcNetworkGetDhcpLeases is libvirt's REMOTE_PROC_NETWORK_GET_DHCP_LEASES + ProcNetworkGetDhcpLeases = 341 + // ProcConnectGetDomainCapabilities is libvirt's REMOTE_PROC_CONNECT_GET_DOMAIN_CAPABILITIES + ProcConnectGetDomainCapabilities = 342 + // ProcDomainOpenGraphicsFd is libvirt's REMOTE_PROC_DOMAIN_OPEN_GRAPHICS_FD + ProcDomainOpenGraphicsFd = 343 + // ProcConnectGetAllDomainStats is libvirt's REMOTE_PROC_CONNECT_GET_ALL_DOMAIN_STATS + ProcConnectGetAllDomainStats = 344 + // ProcDomainBlockCopy is libvirt's REMOTE_PROC_DOMAIN_BLOCK_COPY + ProcDomainBlockCopy = 345 + // ProcDomainEventCallbackTunable is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABLE + ProcDomainEventCallbackTunable = 346 + // ProcNodeAllocPages is libvirt's REMOTE_PROC_NODE_ALLOC_PAGES + ProcNodeAllocPages = 347 + // ProcDomainEventCallbackAgentLifecycle is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_AGENT_LIFECYCLE + ProcDomainEventCallbackAgentLifecycle = 348 + // ProcDomainGetFsinfo is libvirt's REMOTE_PROC_DOMAIN_GET_FSINFO + ProcDomainGetFsinfo = 349 + // ProcDomainDefineXMLFlags is libvirt's REMOTE_PROC_DOMAIN_DEFINE_XML_FLAGS + ProcDomainDefineXMLFlags = 350 + // ProcDomainGetIothreadInfo is libvirt's REMOTE_PROC_DOMAIN_GET_IOTHREAD_INFO + ProcDomainGetIothreadInfo = 351 + // ProcDomainPinIothread is libvirt's REMOTE_PROC_DOMAIN_PIN_IOTHREAD + ProcDomainPinIothread = 352 + // ProcDomainInterfaceAddresses is libvirt's REMOTE_PROC_DOMAIN_INTERFACE_ADDRESSES + ProcDomainInterfaceAddresses = 353 + // ProcDomainEventCallbackDeviceAdded is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_ADDED + ProcDomainEventCallbackDeviceAdded = 354 + // ProcDomainAddIothread is libvirt's REMOTE_PROC_DOMAIN_ADD_IOTHREAD + ProcDomainAddIothread = 355 + // ProcDomainDelIothread is libvirt's REMOTE_PROC_DOMAIN_DEL_IOTHREAD + ProcDomainDelIothread = 356 + // ProcDomainSetUserPassword is libvirt's REMOTE_PROC_DOMAIN_SET_USER_PASSWORD + ProcDomainSetUserPassword = 357 + // ProcDomainRename is libvirt's REMOTE_PROC_DOMAIN_RENAME + ProcDomainRename = 358 + // ProcDomainEventCallbackMigrationIteration is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_MIGRATION_ITERATION + ProcDomainEventCallbackMigrationIteration = 359 + // ProcConnectRegisterCloseCallback is libvirt's REMOTE_PROC_CONNECT_REGISTER_CLOSE_CALLBACK + ProcConnectRegisterCloseCallback = 360 + // ProcConnectUnregisterCloseCallback is libvirt's REMOTE_PROC_CONNECT_UNREGISTER_CLOSE_CALLBACK + ProcConnectUnregisterCloseCallback = 361 + // ProcConnectEventConnectionClosed is libvirt's REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLOSED + ProcConnectEventConnectionClosed = 362 + // ProcDomainEventCallbackJobCompleted is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_COMPLETED + ProcDomainEventCallbackJobCompleted = 363 + // ProcDomainMigrateStartPostCopy is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_START_POST_COPY + ProcDomainMigrateStartPostCopy = 364 + // ProcDomainGetPerfEvents is libvirt's REMOTE_PROC_DOMAIN_GET_PERF_EVENTS + ProcDomainGetPerfEvents = 365 + // ProcDomainSetPerfEvents is libvirt's REMOTE_PROC_DOMAIN_SET_PERF_EVENTS + ProcDomainSetPerfEvents = 366 + // ProcDomainEventCallbackDeviceRemovalFailed is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVAL_FAILED + ProcDomainEventCallbackDeviceRemovalFailed = 367 + // ProcConnectStoragePoolEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_REGISTER_ANY + ProcConnectStoragePoolEventRegisterAny = 368 + // ProcConnectStoragePoolEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_DEREGISTER_ANY + ProcConnectStoragePoolEventDeregisterAny = 369 + // ProcStoragePoolEventLifecycle is libvirt's REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE + ProcStoragePoolEventLifecycle = 370 + // ProcDomainGetGuestVcpus is libvirt's REMOTE_PROC_DOMAIN_GET_GUEST_VCPUS + ProcDomainGetGuestVcpus = 371 + // ProcDomainSetGuestVcpus is libvirt's REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS + ProcDomainSetGuestVcpus = 372 + // ProcStoragePoolEventRefresh is libvirt's REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH + ProcStoragePoolEventRefresh = 373 + // ProcConnectNodeDeviceEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_REGISTER_ANY + ProcConnectNodeDeviceEventRegisterAny = 374 + // ProcConnectNodeDeviceEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_DEREGISTER_ANY + ProcConnectNodeDeviceEventDeregisterAny = 375 + // ProcNodeDeviceEventLifecycle is libvirt's REMOTE_PROC_NODE_DEVICE_EVENT_LIFECYCLE + ProcNodeDeviceEventLifecycle = 376 + // ProcNodeDeviceEventUpdate is libvirt's REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE + ProcNodeDeviceEventUpdate = 377 + // ProcStorageVolGetInfoFlags is libvirt's REMOTE_PROC_STORAGE_VOL_GET_INFO_FLAGS + ProcStorageVolGetInfoFlags = 378 + // ProcDomainEventCallbackMetadataChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE + ProcDomainEventCallbackMetadataChange = 379 + // ProcConnectSecretEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_SECRET_EVENT_REGISTER_ANY + ProcConnectSecretEventRegisterAny = 380 + // ProcConnectSecretEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_SECRET_EVENT_DEREGISTER_ANY + ProcConnectSecretEventDeregisterAny = 381 + // ProcSecretEventLifecycle is libvirt's REMOTE_PROC_SECRET_EVENT_LIFECYCLE + ProcSecretEventLifecycle = 382 + // ProcSecretEventValueChanged is libvirt's REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED + ProcSecretEventValueChanged = 383 + // ProcDomainSetVcpu is libvirt's REMOTE_PROC_DOMAIN_SET_VCPU + ProcDomainSetVcpu = 384 + // ProcDomainEventBlockThreshold is libvirt's REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD + ProcDomainEventBlockThreshold = 385 + // ProcDomainSetBlockThreshold is libvirt's REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD + ProcDomainSetBlockThreshold = 386 + // ProcDomainMigrateGetMaxDowntime is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME + ProcDomainMigrateGetMaxDowntime = 387 + // ProcDomainManagedSaveGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC + ProcDomainManagedSaveGetXMLDesc = 388 + // ProcDomainManagedSaveDefineXML is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML + ProcDomainManagedSaveDefineXML = 389 + // ProcDomainSetLifecycleAction is libvirt's REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION + ProcDomainSetLifecycleAction = 390 + // ProcStoragePoolLookupByTargetPath is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH + ProcStoragePoolLookupByTargetPath = 391 + // ProcDomainDetachDeviceAlias is libvirt's REMOTE_PROC_DOMAIN_DETACH_DEVICE_ALIAS + ProcDomainDetachDeviceAlias = 392 + // ProcConnectCompareHypervisorCPU is libvirt's REMOTE_PROC_CONNECT_COMPARE_HYPERVISOR_CPU + ProcConnectCompareHypervisorCPU = 393 + // ProcConnectBaselineHypervisorCPU is libvirt's REMOTE_PROC_CONNECT_BASELINE_HYPERVISOR_CPU + ProcConnectBaselineHypervisorCPU = 394 + // ProcNodeGetSevInfo is libvirt's REMOTE_PROC_NODE_GET_SEV_INFO + ProcNodeGetSevInfo = 395 + // ProcDomainGetLaunchSecurityInfo is libvirt's REMOTE_PROC_DOMAIN_GET_LAUNCH_SECURITY_INFO + ProcDomainGetLaunchSecurityInfo = 396 + // ProcNwfilterBindingLookupByPortDev is libvirt's REMOTE_PROC_NWFILTER_BINDING_LOOKUP_BY_PORT_DEV + ProcNwfilterBindingLookupByPortDev = 397 + // ProcNwfilterBindingGetXMLDesc is libvirt's REMOTE_PROC_NWFILTER_BINDING_GET_XML_DESC + ProcNwfilterBindingGetXMLDesc = 398 + // ProcNwfilterBindingCreateXML is libvirt's REMOTE_PROC_NWFILTER_BINDING_CREATE_XML + ProcNwfilterBindingCreateXML = 399 + // ProcNwfilterBindingDelete is libvirt's REMOTE_PROC_NWFILTER_BINDING_DELETE + ProcNwfilterBindingDelete = 400 + // ProcConnectListAllNwfilterBindings is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS + ProcConnectListAllNwfilterBindings = 401 + // ProcDomainSetIothreadParams is libvirt's REMOTE_PROC_DOMAIN_SET_IOTHREAD_PARAMS + ProcDomainSetIothreadParams = 402 + + + // From consts: + // StringMax is libvirt's REMOTE_STRING_MAX + StringMax = 4194304 + // DomainListMax is libvirt's REMOTE_DOMAIN_LIST_MAX + DomainListMax = 16384 + // CpumapMax is libvirt's REMOTE_CPUMAP_MAX + CpumapMax = 2048 + // VcpuinfoMax is libvirt's REMOTE_VCPUINFO_MAX + VcpuinfoMax = 16384 + // CpumapsMax is libvirt's REMOTE_CPUMAPS_MAX + CpumapsMax = 8388608 + // IothreadInfoMax is libvirt's REMOTE_IOTHREAD_INFO_MAX + IothreadInfoMax = 16384 + // MigrateCookieMax is libvirt's REMOTE_MIGRATE_COOKIE_MAX + MigrateCookieMax = 4194304 + // NetworkListMax is libvirt's REMOTE_NETWORK_LIST_MAX + NetworkListMax = 16384 + // InterfaceListMax is libvirt's REMOTE_INTERFACE_LIST_MAX + InterfaceListMax = 16384 + // StoragePoolListMax is libvirt's REMOTE_STORAGE_POOL_LIST_MAX + StoragePoolListMax = 16384 + // StorageVolListMax is libvirt's REMOTE_STORAGE_VOL_LIST_MAX + StorageVolListMax = 16384 + // NodeDeviceListMax is libvirt's REMOTE_NODE_DEVICE_LIST_MAX + NodeDeviceListMax = 65536 + // NodeDeviceCapsListMax is libvirt's REMOTE_NODE_DEVICE_CAPS_LIST_MAX + NodeDeviceCapsListMax = 65536 + // NwfilterListMax is libvirt's REMOTE_NWFILTER_LIST_MAX + NwfilterListMax = 16384 + // NwfilterBindingListMax is libvirt's REMOTE_NWFILTER_BINDING_LIST_MAX + NwfilterBindingListMax = 16384 + // DomainSchedulerParametersMax is libvirt's REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX + DomainSchedulerParametersMax = 16 + // DomainBlkioParametersMax is libvirt's REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX + DomainBlkioParametersMax = 16 + // DomainMemoryParametersMax is libvirt's REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX + DomainMemoryParametersMax = 16 + // DomainBlockIOTuneParametersMax is libvirt's REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX + DomainBlockIOTuneParametersMax = 32 + // DomainNumaParametersMax is libvirt's REMOTE_DOMAIN_NUMA_PARAMETERS_MAX + DomainNumaParametersMax = 16 + // DomainPerfEventsMax is libvirt's REMOTE_DOMAIN_PERF_EVENTS_MAX + DomainPerfEventsMax = 64 + // DomainBlockCopyParametersMax is libvirt's REMOTE_DOMAIN_BLOCK_COPY_PARAMETERS_MAX + DomainBlockCopyParametersMax = 16 + // NodeCPUStatsMax is libvirt's REMOTE_NODE_CPU_STATS_MAX + NodeCPUStatsMax = 16 + // NodeMemoryStatsMax is libvirt's REMOTE_NODE_MEMORY_STATS_MAX + NodeMemoryStatsMax = 16 + // DomainBlockStatsParametersMax is libvirt's REMOTE_DOMAIN_BLOCK_STATS_PARAMETERS_MAX + DomainBlockStatsParametersMax = 16 + // NodeMaxCells is libvirt's REMOTE_NODE_MAX_CELLS + NodeMaxCells = 1024 + // AuthSaslDataMax is libvirt's REMOTE_AUTH_SASL_DATA_MAX + AuthSaslDataMax = 65536 + // AuthTypeListMax is libvirt's REMOTE_AUTH_TYPE_LIST_MAX + AuthTypeListMax = 20 + // DomainMemoryStatsMax is libvirt's REMOTE_DOMAIN_MEMORY_STATS_MAX + DomainMemoryStatsMax = 1024 + // DomainSnapshotListMax is libvirt's REMOTE_DOMAIN_SNAPSHOT_LIST_MAX + DomainSnapshotListMax = 16384 + // DomainBlockPeekBufferMax is libvirt's REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX + DomainBlockPeekBufferMax = 4194304 + // DomainMemoryPeekBufferMax is libvirt's REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX + DomainMemoryPeekBufferMax = 4194304 + // SecurityLabelListMax is libvirt's REMOTE_SECURITY_LABEL_LIST_MAX + SecurityLabelListMax = 64 + // SecretValueMax is libvirt's REMOTE_SECRET_VALUE_MAX + SecretValueMax = 65536 + // SecretListMax is libvirt's REMOTE_SECRET_LIST_MAX + SecretListMax = 16384 + // CPUBaselineMax is libvirt's REMOTE_CPU_BASELINE_MAX + CPUBaselineMax = 256 + // DomainSendKeyMax is libvirt's REMOTE_DOMAIN_SEND_KEY_MAX + DomainSendKeyMax = 16 + // DomainInterfaceParametersMax is libvirt's REMOTE_DOMAIN_INTERFACE_PARAMETERS_MAX + DomainInterfaceParametersMax = 16 + // DomainGetCPUStatsNcpusMax is libvirt's REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX + DomainGetCPUStatsNcpusMax = 128 + // DomainGetCPUStatsMax is libvirt's REMOTE_DOMAIN_GET_CPU_STATS_MAX + DomainGetCPUStatsMax = 2048 + // DomainDiskErrorsMax is libvirt's REMOTE_DOMAIN_DISK_ERRORS_MAX + DomainDiskErrorsMax = 256 + // NodeMemoryParametersMax is libvirt's REMOTE_NODE_MEMORY_PARAMETERS_MAX + NodeMemoryParametersMax = 64 + // DomainMigrateParamListMax is libvirt's REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX + DomainMigrateParamListMax = 64 + // DomainJobStatsMax is libvirt's REMOTE_DOMAIN_JOB_STATS_MAX + DomainJobStatsMax = 64 + // ConnectCPUModelsMax is libvirt's REMOTE_CONNECT_CPU_MODELS_MAX + ConnectCPUModelsMax = 8192 + // DomainFsfreezeMountpointsMax is libvirt's REMOTE_DOMAIN_FSFREEZE_MOUNTPOINTS_MAX + DomainFsfreezeMountpointsMax = 256 + // NetworkDhcpLeasesMax is libvirt's REMOTE_NETWORK_DHCP_LEASES_MAX + NetworkDhcpLeasesMax = 65536 + // ConnectGetAllDomainStatsMax is libvirt's REMOTE_CONNECT_GET_ALL_DOMAIN_STATS_MAX + ConnectGetAllDomainStatsMax = 262144 + // DomainEventTunableMax is libvirt's REMOTE_DOMAIN_EVENT_TUNABLE_MAX + DomainEventTunableMax = 2048 + // DomainFsinfoMax is libvirt's REMOTE_DOMAIN_FSINFO_MAX + DomainFsinfoMax = 256 + // DomainFsinfoDisksMax is libvirt's REMOTE_DOMAIN_FSINFO_DISKS_MAX + DomainFsinfoDisksMax = 256 + // DomainInterfaceMax is libvirt's REMOTE_DOMAIN_INTERFACE_MAX + DomainInterfaceMax = 2048 + // DomainIPAddrMax is libvirt's REMOTE_DOMAIN_IP_ADDR_MAX + DomainIPAddrMax = 2048 + // DomainGuestVcpuParamsMax is libvirt's REMOTE_DOMAIN_GUEST_VCPU_PARAMS_MAX + DomainGuestVcpuParamsMax = 64 + // DomainIothreadParamsMax is libvirt's REMOTE_DOMAIN_IOTHREAD_PARAMS_MAX + DomainIothreadParamsMax = 64 + // NodeSevInfoMax is libvirt's REMOTE_NODE_SEV_INFO_MAX + NodeSevInfoMax = 64 + // DomainLaunchSecurityInfoParamsMax is libvirt's REMOTE_DOMAIN_LAUNCH_SECURITY_INFO_PARAMS_MAX + DomainLaunchSecurityInfoParamsMax = 64 + // DomainEventGraphicsIdentityMax is libvirt's REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX + DomainEventGraphicsIdentityMax = 20 + // Program is libvirt's REMOTE_PROGRAM + Program = 0x20008086 + // ProtocolVersion is libvirt's REMOTE_PROTOCOL_VERSION + ProtocolVersion = 1 +) diff --git a/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/LICENSE b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/LICENSE new file mode 100644 index 000000000..0cc3543ce --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2012-2014 Dave Collins + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/decode.go b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/decode.go new file mode 100644 index 000000000..7f33f7d32 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/decode.go @@ -0,0 +1,896 @@ +/* + * Copyright (c) 2012-2014 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package xdr + +import ( + "fmt" + "io" + "math" + "reflect" + "time" +) + +var ( + errMaxSlice = "data exceeds max slice limit" + errIODecode = "%s while decoding %d bytes" +) + +/* +Unmarshal parses XDR-encoded data into the value pointed to by v reading from +reader r and returning the total number of bytes read. An addressable pointer +must be provided since Unmarshal needs to both store the result of the decode as +well as obtain target type information. Unmarhsal traverses v recursively and +automatically indirects pointers through arbitrary depth, allocating them as +necessary, to decode the data into the underlying value pointed to. + +Unmarshal uses reflection to determine the type of the concrete value contained +by v and performs a mapping of underlying XDR types to Go types as follows: + + Go Type <- XDR Type + -------------------- + int8, int16, int32, int <- XDR Integer + uint8, uint16, uint32, uint <- XDR Unsigned Integer + int64 <- XDR Hyper Integer + uint64 <- XDR Unsigned Hyper Integer + bool <- XDR Boolean + float32 <- XDR Floating-Point + float64 <- XDR Double-Precision Floating-Point + string <- XDR String + byte <- XDR Integer + []byte <- XDR Variable-Length Opaque Data + [#]byte <- XDR Fixed-Length Opaque Data + [] <- XDR Variable-Length Array + [#] <- XDR Fixed-Length Array + struct <- XDR Structure + map <- XDR Variable-Length Array of two-element XDR Structures + time.Time <- XDR String encoded with RFC3339 nanosecond precision + +Notes and Limitations: + + * Automatic unmarshalling of variable and fixed-length arrays of uint8s + requires a special struct tag `xdropaque:"false"` since byte slices + and byte arrays are assumed to be opaque data and byte is a Go alias + for uint8 thus indistinguishable under reflection + * Cyclic data structures are not supported and will result in infinite + loops + +If any issues are encountered during the unmarshalling process, an +UnmarshalError is returned with a human readable description as well as +an ErrorCode value for further inspection from sophisticated callers. Some +potential issues are unsupported Go types, attempting to decode a value which is +too large to fit into a specified Go type, and exceeding max slice limitations. +*/ +func Unmarshal(r io.Reader, v interface{}) (int, error) { + d := Decoder{r: r} + return d.Decode(v) +} + +// UnmarshalLimited is identical to Unmarshal but it sets maxReadSize in order +// to cap reads. +func UnmarshalLimited(r io.Reader, v interface{}, maxSize uint) (int, error) { + d := Decoder{r: r, maxReadSize: maxSize} + return d.Decode(v) +} + +// TypeDecoder lets a caller provide a custom decode routine for a custom type. +type TypeDecoder interface { + Decode(*Decoder, reflect.Value) (int, error) +} + +// A Decoder wraps an io.Reader that is expected to provide an XDR-encoded byte +// stream and provides several exposed methods to manually decode various XDR +// primitives without relying on reflection. The NewDecoder function can be +// used to get a new Decoder directly. +// +// Typically, Unmarshal should be used instead of manual decoding. A Decoder +// is exposed so it is possible to perform manual decoding should it be +// necessary in complex scenarios where automatic reflection-based decoding +// won't work. +type Decoder struct { + r io.Reader + + // maxReadSize is the default maximum bytes an element can contain. 0 + // is unlimited and provides backwards compatability. Setting it to a + // non-zero value caps reads. + maxReadSize uint + + // customTypes is a map allowing the caller to provide decoder routines for + // custom types known only to itself. + customTypes map[string]TypeDecoder +} + +// DecodeInt treats the next 4 bytes as an XDR encoded integer and returns the +// result as an int32 along with the number of bytes actually read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining. +// +// Reference: +// RFC Section 4.1 - Integer +// 32-bit big-endian signed integer in range [-2147483648, 2147483647] +func (d *Decoder) DecodeInt() (int32, int, error) { + var buf [4]byte + n, err := io.ReadFull(d.r, buf[:]) + if err != nil { + msg := fmt.Sprintf(errIODecode, err.Error(), 4) + err := unmarshalError("DecodeInt", ErrIO, msg, buf[:n], err) + return 0, n, err + } + + rv := int32(buf[3]) | int32(buf[2])<<8 | + int32(buf[1])<<16 | int32(buf[0])<<24 + return rv, n, nil +} + +// DecodeUint treats the next 4 bytes as an XDR encoded unsigned integer and +// returns the result as a uint32 along with the number of bytes actually read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining. +// +// Reference: +// RFC Section 4.2 - Unsigned Integer +// 32-bit big-endian unsigned integer in range [0, 4294967295] +func (d *Decoder) DecodeUint() (uint32, int, error) { + var buf [4]byte + n, err := io.ReadFull(d.r, buf[:]) + if err != nil { + msg := fmt.Sprintf(errIODecode, err.Error(), 4) + err := unmarshalError("DecodeUint", ErrIO, msg, buf[:n], err) + return 0, n, err + } + + rv := uint32(buf[3]) | uint32(buf[2])<<8 | + uint32(buf[1])<<16 | uint32(buf[0])<<24 + return rv, n, nil +} + +// DecodeEnum treats the next 4 bytes as an XDR encoded enumeration value and +// returns the result as an int32 after verifying that the value is in the +// provided map of valid values. It also returns the number of bytes actually +// read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining or +// the parsed enumeration value is not one of the provided valid values. +// +// Reference: +// RFC Section 4.3 - Enumeration +// Represented as an XDR encoded signed integer +func (d *Decoder) DecodeEnum(validEnums map[int32]bool) (int32, int, error) { + val, n, err := d.DecodeInt() + if err != nil { + return 0, n, err + } + + if !validEnums[val] { + err := unmarshalError("DecodeEnum", ErrBadEnumValue, + "invalid enum", val, nil) + return 0, n, err + } + return val, n, nil +} + +// DecodeBool treats the next 4 bytes as an XDR encoded boolean value and +// returns the result as a bool along with the number of bytes actually read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining or +// the parsed value is not a 0 or 1. +// +// Reference: +// RFC Section 4.4 - Boolean +// Represented as an XDR encoded enumeration where 0 is false and 1 is true +func (d *Decoder) DecodeBool() (bool, int, error) { + val, n, err := d.DecodeInt() + if err != nil { + return false, n, err + } + switch val { + case 0: + return false, n, nil + case 1: + return true, n, nil + } + + err = unmarshalError("DecodeBool", ErrBadEnumValue, "bool not 0 or 1", + val, nil) + return false, n, err +} + +// DecodeHyper treats the next 8 bytes as an XDR encoded hyper value and +// returns the result as an int64 along with the number of bytes actually read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining. +// +// Reference: +// RFC Section 4.5 - Hyper Integer +// 64-bit big-endian signed integer in range [-9223372036854775808, 9223372036854775807] +func (d *Decoder) DecodeHyper() (int64, int, error) { + var buf [8]byte + n, err := io.ReadFull(d.r, buf[:]) + if err != nil { + msg := fmt.Sprintf(errIODecode, err.Error(), 8) + err := unmarshalError("DecodeHyper", ErrIO, msg, buf[:n], err) + return 0, n, err + } + + rv := int64(buf[7]) | int64(buf[6])<<8 | + int64(buf[5])<<16 | int64(buf[4])<<24 | + int64(buf[3])<<32 | int64(buf[2])<<40 | + int64(buf[1])<<48 | int64(buf[0])<<56 + return rv, n, err +} + +// DecodeUhyper treats the next 8 bytes as an XDR encoded unsigned hyper value +// and returns the result as a uint64 along with the number of bytes actually +// read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining. +// +// Reference: +// RFC Section 4.5 - Unsigned Hyper Integer +// 64-bit big-endian unsigned integer in range [0, 18446744073709551615] +func (d *Decoder) DecodeUhyper() (uint64, int, error) { + var buf [8]byte + n, err := io.ReadFull(d.r, buf[:]) + if err != nil { + msg := fmt.Sprintf(errIODecode, err.Error(), 8) + err := unmarshalError("DecodeUhyper", ErrIO, msg, buf[:n], err) + return 0, n, err + } + + rv := uint64(buf[7]) | uint64(buf[6])<<8 | + uint64(buf[5])<<16 | uint64(buf[4])<<24 | + uint64(buf[3])<<32 | uint64(buf[2])<<40 | + uint64(buf[1])<<48 | uint64(buf[0])<<56 + return rv, n, nil +} + +// DecodeFloat treats the next 4 bytes as an XDR encoded floating point and +// returns the result as a float32 along with the number of bytes actually read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining. +// +// Reference: +// RFC Section 4.6 - Floating Point +// 32-bit single-precision IEEE 754 floating point +func (d *Decoder) DecodeFloat() (float32, int, error) { + var buf [4]byte + n, err := io.ReadFull(d.r, buf[:]) + if err != nil { + msg := fmt.Sprintf(errIODecode, err.Error(), 4) + err := unmarshalError("DecodeFloat", ErrIO, msg, buf[:n], err) + return 0, n, err + } + + val := uint32(buf[3]) | uint32(buf[2])<<8 | + uint32(buf[1])<<16 | uint32(buf[0])<<24 + return math.Float32frombits(val), n, nil +} + +// DecodeDouble treats the next 8 bytes as an XDR encoded double-precision +// floating point and returns the result as a float64 along with the number of +// bytes actually read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining. +// +// Reference: +// RFC Section 4.7 - Double-Precision Floating Point +// 64-bit double-precision IEEE 754 floating point +func (d *Decoder) DecodeDouble() (float64, int, error) { + var buf [8]byte + n, err := io.ReadFull(d.r, buf[:]) + if err != nil { + msg := fmt.Sprintf(errIODecode, err.Error(), 8) + err := unmarshalError("DecodeDouble", ErrIO, msg, buf[:n], err) + return 0, n, err + } + + val := uint64(buf[7]) | uint64(buf[6])<<8 | + uint64(buf[5])<<16 | uint64(buf[4])<<24 | + uint64(buf[3])<<32 | uint64(buf[2])<<40 | + uint64(buf[1])<<48 | uint64(buf[0])<<56 + return math.Float64frombits(val), n, nil +} + +// RFC Section 4.8 - Quadruple-Precision Floating Point +// 128-bit quadruple-precision floating point +// Not Implemented + +// DecodeFixedOpaque treats the next 'size' bytes as XDR encoded opaque data and +// returns the result as a byte slice along with the number of bytes actually +// read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining to +// satisfy the passed size, including the necessary padding to make it a +// multiple of 4. +// +// Reference: +// RFC Section 4.9 - Fixed-Length Opaque Data +// Fixed-length uninterpreted data zero-padded to a multiple of four +func (d *Decoder) DecodeFixedOpaque(size int32) ([]byte, int, error) { + // Nothing to do if size is 0. + if size == 0 { + return nil, 0, nil + } + + pad := (4 - (size % 4)) % 4 + paddedSize := size + pad + if uint(paddedSize) > uint(math.MaxInt32) { + err := unmarshalError("DecodeFixedOpaque", ErrOverflow, + errMaxSlice, paddedSize, nil) + return nil, 0, err + } + + buf := make([]byte, paddedSize) + n, err := io.ReadFull(d.r, buf) + if err != nil { + msg := fmt.Sprintf(errIODecode, err.Error(), paddedSize) + err := unmarshalError("DecodeFixedOpaque", ErrIO, msg, buf[:n], + err) + return nil, n, err + } + return buf[0:size], n, nil +} + +// DecodeOpaque treats the next bytes as variable length XDR encoded opaque +// data and returns the result as a byte slice along with the number of bytes +// actually read. +// +// An UnmarshalError is returned if there are insufficient bytes remaining or +// the opaque data is larger than the max length of a Go slice. +// +// Reference: +// RFC Section 4.10 - Variable-Length Opaque Data +// Unsigned integer length followed by fixed opaque data of that length +func (d *Decoder) DecodeOpaque() ([]byte, int, error) { + dataLen, n, err := d.DecodeUint() + if err != nil { + return nil, n, err + } + if uint(dataLen) > uint(math.MaxInt32) || + (d.maxReadSize != 0 && uint(dataLen) > d.maxReadSize) { + err := unmarshalError("DecodeOpaque", ErrOverflow, errMaxSlice, + dataLen, nil) + return nil, n, err + } + + rv, n2, err := d.DecodeFixedOpaque(int32(dataLen)) + n += n2 + if err != nil { + return nil, n, err + } + return rv, n, nil +} + +// DecodeString treats the next bytes as a variable length XDR encoded string +// and returns the result as a string along with the number of bytes actually +// read. Character encoding is assumed to be UTF-8 and therefore ASCII +// compatible. If the underlying character encoding is not compatibile with +// this assumption, the data can instead be read as variable-length opaque data +// (DecodeOpaque) and manually converted as needed. +// +// An UnmarshalError is returned if there are insufficient bytes remaining or +// the string data is larger than the max length of a Go slice. +// +// Reference: +// RFC Section 4.11 - String +// Unsigned integer length followed by bytes zero-padded to a multiple of +// four +func (d *Decoder) DecodeString() (string, int, error) { + dataLen, n, err := d.DecodeUint() + if err != nil { + return "", n, err + } + if uint(dataLen) > uint(math.MaxInt32) || + (d.maxReadSize != 0 && uint(dataLen) > d.maxReadSize) { + err = unmarshalError("DecodeString", ErrOverflow, errMaxSlice, + dataLen, nil) + return "", n, err + } + + opaque, n2, err := d.DecodeFixedOpaque(int32(dataLen)) + n += n2 + if err != nil { + return "", n, err + } + return string(opaque), n, nil +} + +// decodeFixedArray treats the next bytes as a series of XDR encoded elements +// of the same type as the array represented by the reflection value and decodes +// each element into the passed array. The ignoreOpaque flag controls whether +// or not uint8 (byte) elements should be decoded individually or as a fixed +// sequence of opaque data. It returns the the number of bytes actually read. +// +// An UnmarshalError is returned if any issues are encountered while decoding +// the array elements. +// +// Reference: +// RFC Section 4.12 - Fixed-Length Array +// Individually XDR encoded array elements +func (d *Decoder) decodeFixedArray(v reflect.Value, ignoreOpaque bool) (int, error) { + // Treat [#]byte (byte is alias for uint8) as opaque data unless + // ignored. + if !ignoreOpaque && v.Type().Elem().Kind() == reflect.Uint8 { + data, n, err := d.DecodeFixedOpaque(int32(v.Len())) + if err != nil { + return n, err + } + reflect.Copy(v, reflect.ValueOf(data)) + return n, nil + } + + // Decode each array element. + var n int + for i := 0; i < v.Len(); i++ { + n2, err := d.decode(v.Index(i)) + n += n2 + if err != nil { + return n, err + } + } + return n, nil +} + +// decodeArray treats the next bytes as a variable length series of XDR encoded +// elements of the same type as the array represented by the reflection value. +// The number of elements is obtained by first decoding the unsigned integer +// element count. Then each element is decoded into the passed array. The +// ignoreOpaque flag controls whether or not uint8 (byte) elements should be +// decoded individually or as a variable sequence of opaque data. It returns +// the number of bytes actually read. +// +// An UnmarshalError is returned if any issues are encountered while decoding +// the array elements. +// +// Reference: +// RFC Section 4.13 - Variable-Length Array +// Unsigned integer length followed by individually XDR encoded array +// elements +func (d *Decoder) decodeArray(v reflect.Value, ignoreOpaque bool) (int, error) { + dataLen, n, err := d.DecodeUint() + if err != nil { + return n, err + } + if uint(dataLen) > uint(math.MaxInt32) || + (d.maxReadSize != 0 && uint(dataLen) > d.maxReadSize) { + err := unmarshalError("decodeArray", ErrOverflow, errMaxSlice, + dataLen, nil) + return n, err + } + + // Allocate storage for the slice elements (the underlying array) if + // existing slice does not have enough capacity. + sliceLen := int(dataLen) + if v.Cap() < sliceLen { + v.Set(reflect.MakeSlice(v.Type(), sliceLen, sliceLen)) + } + if v.Len() < sliceLen { + v.SetLen(sliceLen) + } + + // Treat []byte (byte is alias for uint8) as opaque data unless ignored. + if !ignoreOpaque && v.Type().Elem().Kind() == reflect.Uint8 { + data, n2, err := d.DecodeFixedOpaque(int32(sliceLen)) + n += n2 + if err != nil { + return n, err + } + v.SetBytes(data) + return n, nil + } + + // Decode each slice element. + for i := 0; i < sliceLen; i++ { + n2, err := d.decode(v.Index(i)) + n += n2 + if err != nil { + return n, err + } + } + return n, nil +} + +// decodeStruct treats the next bytes as a series of XDR encoded elements +// of the same type as the exported fields of the struct represented by the +// passed reflection value. Pointers are automatically indirected and +// allocated as necessary. It returns the the number of bytes actually read. +// +// An UnmarshalError is returned if any issues are encountered while decoding +// the elements. +// +// Reference: +// RFC Section 4.14 - Structure +// XDR encoded elements in the order of their declaration in the struct +func (d *Decoder) decodeStruct(v reflect.Value) (int, error) { + var n int + vt := v.Type() + for i := 0; i < v.NumField(); i++ { + // Skip unexported fields. + vtf := vt.Field(i) + if vtf.PkgPath != "" { + continue + } + + // Indirect through pointers allocating them as needed and + // ensure the field is settable. + vf := v.Field(i) + vf, err := d.indirect(vf) + if err != nil { + return n, err + } + if !vf.CanSet() { + msg := fmt.Sprintf("can't decode to unsettable '%v'", + vf.Type().String()) + err := unmarshalError("decodeStruct", ErrNotSettable, + msg, nil, nil) + return n, err + } + + // Handle non-opaque data to []uint8 and [#]uint8 based on + // struct tag. + tag := vtf.Tag.Get("xdropaque") + if tag == "false" { + switch vf.Kind() { + case reflect.Slice: + n2, err := d.decodeArray(vf, true) + n += n2 + if err != nil { + return n, err + } + continue + + case reflect.Array: + n2, err := d.decodeFixedArray(vf, true) + n += n2 + if err != nil { + return n, err + } + continue + } + } + + // Decode each struct field. + n2, err := d.decode(vf) + n += n2 + if err != nil { + return n, err + } + } + + return n, nil +} + +// RFC Section 4.15 - Discriminated Union +// RFC Section 4.16 - Void +// RFC Section 4.17 - Constant +// RFC Section 4.18 - Typedef +// RFC Section 4.19 - Optional data +// RFC Sections 4.15 though 4.19 only apply to the data specification language +// which is not implemented by this package. In the case of discriminated +// unions, struct tags are used to perform a similar function. + +// decodeMap treats the next bytes as an XDR encoded variable array of 2-element +// structures whose fields are of the same type as the map keys and elements +// represented by the passed reflection value. Pointers are automatically +// indirected and allocated as necessary. It returns the the number of bytes +// actually read. +// +// An UnmarshalError is returned if any issues are encountered while decoding +// the elements. +func (d *Decoder) decodeMap(v reflect.Value) (int, error) { + dataLen, n, err := d.DecodeUint() + if err != nil { + return n, err + } + + // Allocate storage for the underlying map if needed. + vt := v.Type() + if v.IsNil() { + v.Set(reflect.MakeMap(vt)) + } + + // Decode each key and value according to their type. + keyType := vt.Key() + elemType := vt.Elem() + for i := uint32(0); i < dataLen; i++ { + key := reflect.New(keyType).Elem() + n2, err := d.decode(key) + n += n2 + if err != nil { + return n, err + } + + val := reflect.New(elemType).Elem() + n2, err = d.decode(val) + n += n2 + if err != nil { + return n, err + } + v.SetMapIndex(key, val) + } + return n, nil +} + +// decodeInterface examines the interface represented by the passed reflection +// value to detect whether it is an interface that can be decoded into and +// if it is, extracts the underlying value to pass back into the decode function +// for decoding according to its type. It returns the the number of bytes +// actually read. +// +// An UnmarshalError is returned if any issues are encountered while decoding +// the interface. +func (d *Decoder) decodeInterface(v reflect.Value) (int, error) { + if v.IsNil() || !v.CanInterface() { + msg := fmt.Sprintf("can't decode to nil interface") + err := unmarshalError("decodeInterface", ErrNilInterface, msg, + nil, nil) + return 0, err + } + + // Extract underlying value from the interface and indirect through + // pointers allocating them as needed. + ve := reflect.ValueOf(v.Interface()) + ve, err := d.indirect(ve) + if err != nil { + return 0, err + } + if !ve.CanSet() { + msg := fmt.Sprintf("can't decode to unsettable '%v'", + ve.Type().String()) + err := unmarshalError("decodeInterface", ErrNotSettable, msg, + nil, nil) + return 0, err + } + return d.decode(ve) +} + +// decode is the main workhorse for unmarshalling via reflection. It uses +// the passed reflection value to choose the XDR primitives to decode from +// the encapsulated reader. It is a recursive function, +// so cyclic data structures are not supported and will result in an infinite +// loop. It returns the the number of bytes actually read. +func (d *Decoder) decode(v reflect.Value) (int, error) { + if !v.IsValid() { + msg := fmt.Sprintf("type '%s' is not valid", v.Kind().String()) + err := unmarshalError("decode", ErrUnsupportedType, msg, nil, nil) + return 0, err + } + + // Indirect through pointers allocating them as needed. + ve, err := d.indirect(v) + if err != nil { + return 0, err + } + + // Handle time.Time values by decoding them as an RFC3339 formatted + // string with nanosecond precision. Check the type string rather + // than doing a full blown conversion to interface and type assertion + // since checking a string is much quicker. + switch ve.Type().String() { + case "time.Time": + // Read the value as a string and parse it. + timeString, n, err := d.DecodeString() + if err != nil { + return n, err + } + ttv, err := time.Parse(time.RFC3339, timeString) + if err != nil { + err := unmarshalError("decode", ErrParseTime, + err.Error(), timeString, err) + return n, err + } + ve.Set(reflect.ValueOf(ttv)) + return n, nil + } + // If this type is in our custom types map, call the decode routine set up + // for it. + if dt, ok := d.customTypes[ve.Type().String()]; ok { + return dt.Decode(d, v) + } + + // Handle native Go types. + switch ve.Kind() { + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int: + i, n, err := d.DecodeInt() + if err != nil { + return n, err + } + if ve.OverflowInt(int64(i)) { + msg := fmt.Sprintf("signed integer too large to fit '%s'", + ve.Kind().String()) + err = unmarshalError("decode", ErrOverflow, msg, i, nil) + return n, err + } + ve.SetInt(int64(i)) + return n, nil + + case reflect.Int64: + i, n, err := d.DecodeHyper() + if err != nil { + return n, err + } + ve.SetInt(i) + return n, nil + + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint: + ui, n, err := d.DecodeUint() + if err != nil { + return n, err + } + if ve.OverflowUint(uint64(ui)) { + msg := fmt.Sprintf("unsigned integer too large to fit '%s'", + ve.Kind().String()) + err = unmarshalError("decode", ErrOverflow, msg, ui, nil) + return n, err + } + ve.SetUint(uint64(ui)) + return n, nil + + case reflect.Uint64: + ui, n, err := d.DecodeUhyper() + if err != nil { + return n, err + } + ve.SetUint(ui) + return n, nil + + case reflect.Bool: + b, n, err := d.DecodeBool() + if err != nil { + return n, err + } + ve.SetBool(b) + return n, nil + + case reflect.Float32: + f, n, err := d.DecodeFloat() + if err != nil { + return n, err + } + ve.SetFloat(float64(f)) + return n, nil + + case reflect.Float64: + f, n, err := d.DecodeDouble() + if err != nil { + return n, err + } + ve.SetFloat(f) + return n, nil + + case reflect.String: + s, n, err := d.DecodeString() + if err != nil { + return n, err + } + ve.SetString(s) + return n, nil + + case reflect.Array: + n, err := d.decodeFixedArray(ve, false) + if err != nil { + return n, err + } + return n, nil + + case reflect.Slice: + n, err := d.decodeArray(ve, false) + if err != nil { + return n, err + } + return n, nil + + case reflect.Struct: + n, err := d.decodeStruct(ve) + if err != nil { + return n, err + } + return n, nil + + case reflect.Map: + n, err := d.decodeMap(ve) + if err != nil { + return n, err + } + return n, nil + + case reflect.Interface: + n, err := d.decodeInterface(ve) + if err != nil { + return n, err + } + return n, nil + } + + // The only unhandled types left are unsupported. At the time of this + // writing the only remaining unsupported types that exist are + // reflect.Uintptr and reflect.UnsafePointer. + msg := fmt.Sprintf("unsupported Go type '%s'", ve.Kind().String()) + err = unmarshalError("decode", ErrUnsupportedType, msg, nil, nil) + return 0, err +} + +// indirect dereferences pointers allocating them as needed until it reaches +// a non-pointer. This allows transparent decoding through arbitrary levels +// of indirection. +func (d *Decoder) indirect(v reflect.Value) (reflect.Value, error) { + rv := v + for rv.Kind() == reflect.Ptr { + // Allocate pointer if needed. + isNil := rv.IsNil() + if isNil && !rv.CanSet() { + msg := fmt.Sprintf("unable to allocate pointer for '%v'", + rv.Type().String()) + err := unmarshalError("indirect", ErrNotSettable, msg, + nil, nil) + return rv, err + } + if isNil { + rv.Set(reflect.New(rv.Type().Elem())) + } + rv = rv.Elem() + } + return rv, nil +} + +// Decode operates identically to the Unmarshal function with the exception of +// using the reader associated with the Decoder as the source of XDR-encoded +// data instead of a user-supplied reader. See the Unmarhsal documentation for +// specifics. +func (d *Decoder) Decode(v interface{}) (int, error) { + if v == nil { + msg := "can't unmarshal to nil interface" + return 0, unmarshalError("Unmarshal", ErrNilInterface, msg, nil, + nil) + } + + vv := reflect.ValueOf(v) + if vv.Kind() != reflect.Ptr { + msg := fmt.Sprintf("can't unmarshal to non-pointer '%v' - use "+ + "& operator", vv.Type().String()) + err := unmarshalError("Unmarshal", ErrBadArguments, msg, nil, nil) + return 0, err + } + if vv.IsNil() && !vv.CanSet() { + msg := fmt.Sprintf("can't unmarshal to unsettable '%v' - use "+ + "& operator", vv.Type().String()) + err := unmarshalError("Unmarshal", ErrNotSettable, msg, nil, nil) + return 0, err + } + + return d.decode(vv) +} + +// NewDecoder returns a Decoder that can be used to manually decode XDR data +// from a provided reader. Typically, Unmarshal should be used instead of +// manually creating a Decoder. +func NewDecoder(r io.Reader) *Decoder { + return &Decoder{r: r} +} + +// NewDecoderLimited is identical to NewDecoder but it sets maxReadSize in +// order to cap reads. +func NewDecoderLimited(r io.Reader, maxSize uint) *Decoder { + return &Decoder{r: r, maxReadSize: maxSize} +} + +// NewDecoderCustomTypes returns a decoder with support for custom types known +// to the caller. The second parameter is a map of the type name to the decoder +// routine. When the decoder finds a type matching one of the entries in the map +// it will call the custom routine for that type. +func NewDecoderCustomTypes(r io.Reader, maxSize uint, ct map[string]TypeDecoder) *Decoder { + return &Decoder{r: r, maxReadSize: maxSize, customTypes: ct} +} diff --git a/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/doc.go b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/doc.go new file mode 100644 index 000000000..8823d62f3 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/doc.go @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2012-2014 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* +Package xdr implements the data representation portion of the External Data +Representation (XDR) standard protocol as specified in RFC 4506 (obsoletes +RFC 1832 and RFC 1014). + +The XDR RFC defines both a data specification language and a data +representation standard. This package implements methods to encode and decode +XDR data per the data representation standard with the exception of 128-bit +quadruple-precision floating points. It does not currently implement parsing of +the data specification language. In other words, the ability to automatically +generate Go code by parsing an XDR data specification file (typically .x +extension) is not supported. In practice, this limitation of the package is +fairly minor since it is largely unnecessary due to the reflection capabilities +of Go as described below. + +This package provides two approaches for encoding and decoding XDR data: + + 1) Marshal/Unmarshal functions which automatically map between XDR and Go types + 2) Individual Encoder/Decoder objects to manually work with XDR primitives + +For the Marshal/Unmarshal functions, Go reflection capabilities are used to +choose the type of the underlying XDR data based upon the Go type to encode or +the target Go type to decode into. A description of how each type is mapped is +provided below, however one important type worth reviewing is Go structs. In +the case of structs, each exported field (first letter capitalized) is reflected +and mapped in order. As a result, this means a Go struct with exported fields +of the appropriate types listed in the expected order can be used to +automatically encode / decode the XDR data thereby eliminating the need to write +a lot of boilerplate code to encode/decode and error check each piece of XDR +data as is typically required with C based XDR libraries. + +Go Type to XDR Type Mappings + +The following chart shows an overview of how Go types are mapped to XDR types +for automatic marshalling and unmarshalling. The documentation for the Marshal +and Unmarshal functions has specific details of how the mapping proceeds. + + Go Type <-> XDR Type + -------------------- + int8, int16, int32, int <-> XDR Integer + uint8, uint16, uint32, uint <-> XDR Unsigned Integer + int64 <-> XDR Hyper Integer + uint64 <-> XDR Unsigned Hyper Integer + bool <-> XDR Boolean + float32 <-> XDR Floating-Point + float64 <-> XDR Double-Precision Floating-Point + string <-> XDR String + byte <-> XDR Integer + []byte <-> XDR Variable-Length Opaque Data + [#]byte <-> XDR Fixed-Length Opaque Data + [] <-> XDR Variable-Length Array + [#] <-> XDR Fixed-Length Array + struct <-> XDR Structure + map <-> XDR Variable-Length Array of two-element XDR Structures + time.Time <-> XDR String encoded with RFC3339 nanosecond precision + +Notes and Limitations: + + * Automatic marshalling and unmarshalling of variable and fixed-length + arrays of uint8s require a special struct tag `xdropaque:"false"` + since byte slices and byte arrays are assumed to be opaque data and + byte is a Go alias for uint8 thus indistinguishable under reflection + * Channel, complex, and function types cannot be encoded + * Interfaces without a concrete value cannot be encoded + * Cyclic data structures are not supported and will result in infinite + loops + * Strings are marshalled and unmarshalled with UTF-8 character encoding + which differs from the XDR specification of ASCII, however UTF-8 is + backwards compatible with ASCII so this should rarely cause issues + + +Encoding + +To encode XDR data, use the Marshal function. + func Marshal(w io.Writer, v interface{}) (int, error) + +For example, given the following code snippet: + + type ImageHeader struct { + Signature [3]byte + Version uint32 + IsGrayscale bool + NumSections uint32 + } + h := ImageHeader{[3]byte{0xAB, 0xCD, 0xEF}, 2, true, 10} + + var w bytes.Buffer + bytesWritten, err := xdr.Marshal(&w, &h) + // Error check elided + +The result, encodedData, will then contain the following XDR encoded byte +sequence: + + 0xAB, 0xCD, 0xEF, 0x00, + 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x0A + + +In addition, while the automatic marshalling discussed above will work for the +vast majority of cases, an Encoder object is provided that can be used to +manually encode XDR primitives for complex scenarios where automatic +reflection-based encoding won't work. The included examples provide a sample of +manual usage via an Encoder. + + +Decoding + +To decode XDR data, use the Unmarshal function. + func Unmarshal(r io.Reader, v interface{}) (int, error) + +For example, given the following code snippet: + + type ImageHeader struct { + Signature [3]byte + Version uint32 + IsGrayscale bool + NumSections uint32 + } + + // Using output from the Encoding section above. + encodedData := []byte{ + 0xAB, 0xCD, 0xEF, 0x00, + 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x0A, + } + + var h ImageHeader + bytesRead, err := xdr.Unmarshal(bytes.NewReader(encodedData), &h) + // Error check elided + +The struct instance, h, will then contain the following values: + + h.Signature = [3]byte{0xAB, 0xCD, 0xEF} + h.Version = 2 + h.IsGrayscale = true + h.NumSections = 10 + +In addition, while the automatic unmarshalling discussed above will work for the +vast majority of cases, a Decoder object is provided that can be used to +manually decode XDR primitives for complex scenarios where automatic +reflection-based decoding won't work. The included examples provide a sample of +manual usage via a Decoder. + +Errors + +All errors are either of type UnmarshalError or MarshalError. Both provide +human-readable output as well as an ErrorCode field which can be inspected by +sophisticated callers if necessary. + +See the documentation of UnmarshalError, MarshalError, and ErrorCode for further +details. +*/ +package xdr diff --git a/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/encode.go b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/encode.go new file mode 100644 index 000000000..7bac2681d --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/encode.go @@ -0,0 +1,669 @@ +/* + * Copyright (c) 2012-2014 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package xdr + +import ( + "fmt" + "io" + "math" + "reflect" + "time" +) + +var errIOEncode = "%s while encoding %d bytes" + +/* +Marshal writes the XDR encoding of v to writer w and returns the number of bytes +written. It traverses v recursively and automatically indirects pointers +through arbitrary depth to encode the actual value pointed to. + +Marshal uses reflection to determine the type of the concrete value contained by +v and performs a mapping of Go types to the underlying XDR types as follows: + + Go Type -> XDR Type + -------------------- + int8, int16, int32, int -> XDR Integer + uint8, uint16, uint32, uint -> XDR Unsigned Integer + int64 -> XDR Hyper Integer + uint64 -> XDR Unsigned Hyper Integer + bool -> XDR Boolean + float32 -> XDR Floating-Point + float64 -> XDR Double-Precision Floating-Point + string -> XDR String + byte -> XDR Integer + []byte -> XDR Variable-Length Opaque Data + [#]byte -> XDR Fixed-Length Opaque Data + [] -> XDR Variable-Length Array + [#] -> XDR Fixed-Length Array + struct -> XDR Structure + map -> XDR Variable-Length Array of two-element XDR Structures + time.Time -> XDR String encoded with RFC3339 nanosecond precision + +Notes and Limitations: + + * Automatic marshalling of variable and fixed-length arrays of uint8s + requires a special struct tag `xdropaque:"false"` since byte slices and + byte arrays are assumed to be opaque data and byte is a Go alias for uint8 + thus indistinguishable under reflection + * Channel, complex, and function types cannot be encoded + * Interfaces without a concrete value cannot be encoded + * Cyclic data structures are not supported and will result in infinite loops + * Strings are marshalled with UTF-8 character encoding which differs from + the XDR specification of ASCII, however UTF-8 is backwards compatible with + ASCII so this should rarely cause issues + +If any issues are encountered during the marshalling process, a MarshalError is +returned with a human readable description as well as an ErrorCode value for +further inspection from sophisticated callers. Some potential issues are +unsupported Go types, attempting to encode more opaque data than can be +represented by a single opaque XDR entry, and exceeding max slice limitations. +*/ +func Marshal(w io.Writer, v interface{}) (int, error) { + enc := Encoder{w: w} + return enc.Encode(v) +} + +// An Encoder wraps an io.Writer that will receive the XDR encoded byte stream. +// See NewEncoder. +type Encoder struct { + w io.Writer +} + +// EncodeInt writes the XDR encoded representation of the passed 32-bit signed +// integer to the encapsulated writer and returns the number of bytes written. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.1 - Integer +// 32-bit big-endian signed integer in range [-2147483648, 2147483647] +func (enc *Encoder) EncodeInt(v int32) (int, error) { + var b [4]byte + b[0] = byte(v >> 24) + b[1] = byte(v >> 16) + b[2] = byte(v >> 8) + b[3] = byte(v) + + n, err := enc.w.Write(b[:]) + if err != nil { + msg := fmt.Sprintf(errIOEncode, err.Error(), 4) + err := marshalError("EncodeInt", ErrIO, msg, b[:n], err) + return n, err + } + + return n, nil +} + +// EncodeUint writes the XDR encoded representation of the passed 32-bit +// unsigned integer to the encapsulated writer and returns the number of bytes +// written. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.2 - Unsigned Integer +// 32-bit big-endian unsigned integer in range [0, 4294967295] +func (enc *Encoder) EncodeUint(v uint32) (int, error) { + var b [4]byte + b[0] = byte(v >> 24) + b[1] = byte(v >> 16) + b[2] = byte(v >> 8) + b[3] = byte(v) + + n, err := enc.w.Write(b[:]) + if err != nil { + msg := fmt.Sprintf(errIOEncode, err.Error(), 4) + err := marshalError("EncodeUint", ErrIO, msg, b[:n], err) + return n, err + } + + return n, nil +} + +// EncodeEnum treats the passed 32-bit signed integer as an enumeration value +// and, if it is in the list of passed valid enumeration values, writes the XDR +// encoded representation of it to the encapsulated writer. It returns the +// number of bytes written. +// +// A MarshalError is returned if the enumeration value is not one of the +// provided valid values or if writing the data fails. +// +// Reference: +// RFC Section 4.3 - Enumeration +// Represented as an XDR encoded signed integer +func (enc *Encoder) EncodeEnum(v int32, validEnums map[int32]bool) (int, error) { + if !validEnums[v] { + err := marshalError("EncodeEnum", ErrBadEnumValue, + "invalid enum", v, nil) + return 0, err + } + return enc.EncodeInt(v) +} + +// EncodeBool writes the XDR encoded representation of the passed boolean to the +// encapsulated writer and returns the number of bytes written. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.4 - Boolean +// Represented as an XDR encoded enumeration where 0 is false and 1 is true +func (enc *Encoder) EncodeBool(v bool) (int, error) { + i := int32(0) + if v == true { + i = 1 + } + return enc.EncodeInt(i) +} + +// EncodeHyper writes the XDR encoded representation of the passed 64-bit +// signed integer to the encapsulated writer and returns the number of bytes +// written. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.5 - Hyper Integer +// 64-bit big-endian signed integer in range [-9223372036854775808, 9223372036854775807] +func (enc *Encoder) EncodeHyper(v int64) (int, error) { + var b [8]byte + b[0] = byte(v >> 56) + b[1] = byte(v >> 48) + b[2] = byte(v >> 40) + b[3] = byte(v >> 32) + b[4] = byte(v >> 24) + b[5] = byte(v >> 16) + b[6] = byte(v >> 8) + b[7] = byte(v) + + n, err := enc.w.Write(b[:]) + if err != nil { + msg := fmt.Sprintf(errIOEncode, err.Error(), 8) + err := marshalError("EncodeHyper", ErrIO, msg, b[:n], err) + return n, err + } + + return n, nil +} + +// EncodeUhyper writes the XDR encoded representation of the passed 64-bit +// unsigned integer to the encapsulated writer and returns the number of bytes +// written. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.5 - Unsigned Hyper Integer +// 64-bit big-endian unsigned integer in range [0, 18446744073709551615] +func (enc *Encoder) EncodeUhyper(v uint64) (int, error) { + var b [8]byte + b[0] = byte(v >> 56) + b[1] = byte(v >> 48) + b[2] = byte(v >> 40) + b[3] = byte(v >> 32) + b[4] = byte(v >> 24) + b[5] = byte(v >> 16) + b[6] = byte(v >> 8) + b[7] = byte(v) + + n, err := enc.w.Write(b[:]) + if err != nil { + msg := fmt.Sprintf(errIOEncode, err.Error(), 8) + err := marshalError("EncodeUhyper", ErrIO, msg, b[:n], err) + return n, err + } + + return n, nil +} + +// EncodeFloat writes the XDR encoded representation of the passed 32-bit +// (single-precision) floating point to the encapsulated writer and returns the +// number of bytes written. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.6 - Floating Point +// 32-bit single-precision IEEE 754 floating point +func (enc *Encoder) EncodeFloat(v float32) (int, error) { + ui := math.Float32bits(v) + return enc.EncodeUint(ui) +} + +// EncodeDouble writes the XDR encoded representation of the passed 64-bit +// (double-precision) floating point to the encapsulated writer and returns the +// number of bytes written. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.7 - Double-Precision Floating Point +// 64-bit double-precision IEEE 754 floating point +func (enc *Encoder) EncodeDouble(v float64) (int, error) { + ui := math.Float64bits(v) + return enc.EncodeUhyper(ui) +} + +// RFC Section 4.8 - Quadruple-Precision Floating Point +// 128-bit quadruple-precision floating point +// Not Implemented + +// EncodeFixedOpaque treats the passed byte slice as opaque data of a fixed +// size and writes the XDR encoded representation of it to the encapsulated +// writer. It returns the number of bytes written. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.9 - Fixed-Length Opaque Data +// Fixed-length uninterpreted data zero-padded to a multiple of four +func (enc *Encoder) EncodeFixedOpaque(v []byte) (int, error) { + l := len(v) + pad := (4 - (l % 4)) % 4 + + // Write the actual bytes. + n, err := enc.w.Write(v) + if err != nil { + msg := fmt.Sprintf(errIOEncode, err.Error(), len(v)) + err := marshalError("EncodeFixedOpaque", ErrIO, msg, v[:n], err) + return n, err + } + + // Write any padding if needed. + if pad > 0 { + b := make([]byte, pad) + n2, err := enc.w.Write(b) + n += n2 + if err != nil { + written := make([]byte, l+n2) + copy(written, v) + copy(written[l:], b[:n2]) + msg := fmt.Sprintf(errIOEncode, err.Error(), l+pad) + err := marshalError("EncodeFixedOpaque", ErrIO, msg, + written, err) + return n, err + } + } + + return n, nil +} + +// EncodeOpaque treats the passed byte slice as opaque data of a variable +// size and writes the XDR encoded representation of it to the encapsulated +// writer. It returns the number of bytes written. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.10 - Variable-Length Opaque Data +// Unsigned integer length followed by fixed opaque data of that length +func (enc *Encoder) EncodeOpaque(v []byte) (int, error) { + // Length of opaque data. + n, err := enc.EncodeUint(uint32(len(v))) + if err != nil { + return n, err + } + + n2, err := enc.EncodeFixedOpaque(v) + n += n2 + return n, err +} + +// EncodeString writes the XDR encoded representation of the passed string +// to the encapsulated writer and returns the number of bytes written. +// Character encoding is assumed to be UTF-8 and therefore ASCII compatible. If +// the underlying character encoding is not compatible with this assumption, the +// data can instead be written as variable-length opaque data (EncodeOpaque) and +// manually converted as needed. +// +// A MarshalError with an error code of ErrIO is returned if writing the data +// fails. +// +// Reference: +// RFC Section 4.11 - String +// Unsigned integer length followed by bytes zero-padded to a multiple of four +func (enc *Encoder) EncodeString(v string) (int, error) { + // Length of string. + n, err := enc.EncodeUint(uint32(len(v))) + if err != nil { + return n, err + } + + n2, err := enc.EncodeFixedOpaque([]byte(v)) + n += n2 + return n, err +} + +// encodeFixedArray writes the XDR encoded representation of each element +// in the passed array represented by the reflection value to the encapsulated +// writer and returns the number of bytes written. The ignoreOpaque flag +// controls whether or not uint8 (byte) elements should be encoded individually +// or as a fixed sequence of opaque data. +// +// A MarshalError is returned if any issues are encountered while encoding +// the array elements. +// +// Reference: +// RFC Section 4.12 - Fixed-Length Array +// Individually XDR encoded array elements +func (enc *Encoder) encodeFixedArray(v reflect.Value, ignoreOpaque bool) (int, error) { + // Treat [#]byte (byte is alias for uint8) as opaque data unless ignored. + if !ignoreOpaque && v.Type().Elem().Kind() == reflect.Uint8 { + // Create a slice of the underlying array for better efficiency + // when possible. Can't create a slice of an unaddressable + // value. + if v.CanAddr() { + return enc.EncodeFixedOpaque(v.Slice(0, v.Len()).Bytes()) + } + + // When the underlying array isn't addressable fall back to + // copying the array into a new slice. This is rather ugly, but + // the inability to create a constant slice from an + // unaddressable array is a limitation of Go. + slice := make([]byte, v.Len(), v.Len()) + reflect.Copy(reflect.ValueOf(slice), v) + return enc.EncodeFixedOpaque(slice) + } + + // Encode each array element. + var n int + for i := 0; i < v.Len(); i++ { + n2, err := enc.encode(v.Index(i)) + n += n2 + if err != nil { + return n, err + } + } + + return n, nil +} + +// encodeArray writes an XDR encoded integer representing the number of +// elements in the passed slice represented by the reflection value followed by +// the XDR encoded representation of each element in slice to the encapsulated +// writer and returns the number of bytes written. The ignoreOpaque flag +// controls whether or not uint8 (byte) elements should be encoded individually +// or as a variable sequence of opaque data. +// +// A MarshalError is returned if any issues are encountered while encoding +// the array elements. +// +// Reference: +// RFC Section 4.13 - Variable-Length Array +// Unsigned integer length followed by individually XDR encoded array elements +func (enc *Encoder) encodeArray(v reflect.Value, ignoreOpaque bool) (int, error) { + numItems := uint32(v.Len()) + n, err := enc.EncodeUint(numItems) + if err != nil { + return n, err + } + + n2, err := enc.encodeFixedArray(v, ignoreOpaque) + n += n2 + return n, err +} + +// encodeStruct writes an XDR encoded representation of each value in the +// exported fields of the struct represented by the passed reflection value to +// the encapsulated writer and returns the number of bytes written. Pointers +// are automatically indirected through arbitrary depth to encode the actual +// value pointed to. +// +// A MarshalError is returned if any issues are encountered while encoding +// the elements. +// +// Reference: +// RFC Section 4.14 - Structure +// XDR encoded elements in the order of their declaration in the struct +func (enc *Encoder) encodeStruct(v reflect.Value) (int, error) { + var n int + vt := v.Type() + for i := 0; i < v.NumField(); i++ { + // Skip unexported fields and indirect through pointers. + vtf := vt.Field(i) + if vtf.PkgPath != "" { + continue + } + vf := v.Field(i) + vf = enc.indirect(vf) + + // Handle non-opaque data to []uint8 and [#]uint8 based on struct tag. + tag := vtf.Tag.Get("xdropaque") + if tag == "false" { + switch vf.Kind() { + case reflect.Slice: + n2, err := enc.encodeArray(vf, true) + n += n2 + if err != nil { + return n, err + } + continue + + case reflect.Array: + n2, err := enc.encodeFixedArray(vf, true) + n += n2 + if err != nil { + return n, err + } + continue + } + } + + // Encode each struct field. + n2, err := enc.encode(vf) + n += n2 + if err != nil { + return n, err + } + } + + return n, nil +} + +// RFC Section 4.15 - Discriminated Union +// RFC Section 4.16 - Void +// RFC Section 4.17 - Constant +// RFC Section 4.18 - Typedef +// RFC Section 4.19 - Optional data +// RFC Sections 4.15 though 4.19 only apply to the data specification language +// which is not implemented by this package. In the case of discriminated +// unions, struct tags are used to perform a similar function. + +// encodeMap treats the map represented by the passed reflection value as a +// variable-length array of 2-element structures whose fields are of the same +// type as the map keys and elements and writes its XDR encoded representation +// to the encapsulated writer. It returns the number of bytes written. +// +// A MarshalError is returned if any issues are encountered while encoding +// the elements. +func (enc *Encoder) encodeMap(v reflect.Value) (int, error) { + // Number of elements. + n, err := enc.EncodeUint(uint32(v.Len())) + if err != nil { + return n, err + } + + // Encode each key and value according to their type. + for _, key := range v.MapKeys() { + n2, err := enc.encode(key) + n += n2 + if err != nil { + return n, err + } + + n2, err = enc.encode(v.MapIndex(key)) + n += n2 + if err != nil { + return n, err + } + } + + return n, nil +} + +// encodeInterface examines the interface represented by the passed reflection +// value to detect whether it is an interface that can be encoded if it is, +// extracts the underlying value to pass back into the encode function for +// encoding according to its type. +// +// A MarshalError is returned if any issues are encountered while encoding +// the interface. +func (enc *Encoder) encodeInterface(v reflect.Value) (int, error) { + if v.IsNil() || !v.CanInterface() { + msg := fmt.Sprintf("can't encode nil interface") + err := marshalError("encodeInterface", ErrNilInterface, msg, + nil, nil) + return 0, err + } + + // Extract underlying value from the interface and indirect through pointers. + ve := reflect.ValueOf(v.Interface()) + ve = enc.indirect(ve) + return enc.encode(ve) +} + +// encode is the main workhorse for marshalling via reflection. It uses +// the passed reflection value to choose the XDR primitives to encode into +// the encapsulated writer and returns the number of bytes written. It is a +// recursive function, so cyclic data structures are not supported and will +// result in an infinite loop. +func (enc *Encoder) encode(v reflect.Value) (int, error) { + if !v.IsValid() { + msg := fmt.Sprintf("type '%s' is not valid", v.Kind().String()) + err := marshalError("encode", ErrUnsupportedType, msg, nil, nil) + return 0, err + } + + // Indirect through pointers to get at the concrete value. + ve := enc.indirect(v) + + // Handle time.Time values by encoding them as an RFC3339 formatted + // string with nanosecond precision. Check the type string before + // doing a full blown conversion to interface and type assertion since + // checking a string is much quicker. + if ve.Type().String() == "time.Time" && ve.CanInterface() { + viface := ve.Interface() + if tv, ok := viface.(time.Time); ok { + return enc.EncodeString(tv.Format(time.RFC3339Nano)) + } + } + + // Handle native Go types. + switch ve.Kind() { + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int: + return enc.EncodeInt(int32(ve.Int())) + + case reflect.Int64: + return enc.EncodeHyper(ve.Int()) + + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint: + return enc.EncodeUint(uint32(ve.Uint())) + + case reflect.Uint64: + return enc.EncodeUhyper(ve.Uint()) + + case reflect.Bool: + return enc.EncodeBool(ve.Bool()) + + case reflect.Float32: + return enc.EncodeFloat(float32(ve.Float())) + + case reflect.Float64: + return enc.EncodeDouble(ve.Float()) + + case reflect.String: + return enc.EncodeString(ve.String()) + + case reflect.Array: + return enc.encodeFixedArray(ve, false) + + case reflect.Slice: + return enc.encodeArray(ve, false) + + case reflect.Struct: + return enc.encodeStruct(ve) + + case reflect.Map: + return enc.encodeMap(ve) + + case reflect.Interface: + return enc.encodeInterface(ve) + } + + // The only unhandled types left are unsupported. At the time of this + // writing the only remaining unsupported types that exist are + // reflect.Uintptr and reflect.UnsafePointer. + msg := fmt.Sprintf("unsupported Go type '%s'", ve.Kind().String()) + err := marshalError("encode", ErrUnsupportedType, msg, nil, nil) + return 0, err +} + +// indirect dereferences pointers until it reaches a non-pointer. This allows +// transparent encoding through arbitrary levels of indirection. +func (enc *Encoder) indirect(v reflect.Value) reflect.Value { + rv := v + for rv.Kind() == reflect.Ptr { + rv = rv.Elem() + } + return rv +} + +// Encode operates identically to the Marshal function with the exception of +// using the writer associated with the Encoder for the destination of the +// XDR-encoded data instead of a user-supplied writer. See the Marshal +// documentation for specifics. +func (enc *Encoder) Encode(v interface{}) (int, error) { + if v == nil { + msg := "can't marshal nil interface" + err := marshalError("Marshal", ErrNilInterface, msg, nil, nil) + return 0, err + } + + vv := reflect.ValueOf(v) + vve := vv + for vve.Kind() == reflect.Ptr { + if vve.IsNil() { + msg := fmt.Sprintf("can't marshal nil pointer '%v'", + vv.Type().String()) + err := marshalError("Marshal", ErrBadArguments, msg, + nil, nil) + return 0, err + } + vve = vve.Elem() + } + + return enc.encode(vve) +} + +// NewEncoder returns an object that can be used to manually choose fields to +// XDR encode to the passed writer w. Typically, Marshal should be used instead +// of manually creating an Encoder. An Encoder, along with several of its +// methods to encode XDR primitives, is exposed so it is possible to perform +// manual encoding of data without relying on reflection should it be necessary +// in complex scenarios where automatic reflection-based encoding won't work. +func NewEncoder(w io.Writer) *Encoder { + return &Encoder{w: w} +} diff --git a/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/error.go b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/error.go new file mode 100644 index 000000000..42079ad35 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2/error.go @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2012-2014 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package xdr + +import "fmt" + +// ErrorCode identifies a kind of error. +type ErrorCode int + +const ( + // ErrBadArguments indicates arguments passed to the function are not + // what was expected. + ErrBadArguments ErrorCode = iota + + // ErrUnsupportedType indicates the Go type is not a supported type for + // marshalling and unmarshalling XDR data. + ErrUnsupportedType + + // ErrBadEnumValue indicates an enumeration value is not in the list of + // valid values. + ErrBadEnumValue + + // ErrNotSettable indicates an interface value cannot be written to. + // This usually means the interface value was not passed with the & + // operator, but it can also happen if automatic pointer allocation + // fails. + ErrNotSettable + + // ErrOverflow indicates that the data in question is too large to fit + // into the corresponding Go or XDR data type. For example, an integer + // decoded from XDR that is too large to fit into a target type of int8, + // or opaque data that exceeds the max length of a Go slice. + ErrOverflow + + // ErrNilInterface indicates an interface with no concrete type + // information was encountered. Type information is necessary to + // perform mapping between XDR and Go types. + ErrNilInterface + + // ErrIO indicates an error was encountered while reading or writing to + // an io.Reader or io.Writer, respectively. The actual underlying error + // will be available via the Err field of the MarshalError or + // UnmarshalError struct. + ErrIO + + // ErrParseTime indicates an error was encountered while parsing an + // RFC3339 formatted time value. The actual underlying error will be + // available via the Err field of the UnmarshalError struct. + ErrParseTime +) + +// Map of ErrorCode values back to their constant names for pretty printing. +var errorCodeStrings = map[ErrorCode]string{ + ErrBadArguments: "ErrBadArguments", + ErrUnsupportedType: "ErrUnsupportedType", + ErrBadEnumValue: "ErrBadEnumValue", + ErrNotSettable: "ErrNotSettable", + ErrOverflow: "ErrOverflow", + ErrNilInterface: "ErrNilInterface", + ErrIO: "ErrIO", + ErrParseTime: "ErrParseTime", +} + +// String returns the ErrorCode as a human-readable name. +func (e ErrorCode) String() string { + if s := errorCodeStrings[e]; s != "" { + return s + } + return fmt.Sprintf("Unknown ErrorCode (%d)", e) +} + +// UnmarshalError describes a problem encountered while unmarshaling data. +// Some potential issues are unsupported Go types, attempting to decode a value +// which is too large to fit into a specified Go type, and exceeding max slice +// limitations. +type UnmarshalError struct { + ErrorCode ErrorCode // Describes the kind of error + Func string // Function name + Value interface{} // Value actually parsed where appropriate + Description string // Human readable description of the issue + Err error // The underlying error for IO errors +} + +// Error satisfies the error interface and prints human-readable errors. +func (e *UnmarshalError) Error() string { + switch e.ErrorCode { + case ErrBadEnumValue, ErrOverflow, ErrIO, ErrParseTime: + return fmt.Sprintf("xdr:%s: %s - read: '%v'", e.Func, + e.Description, e.Value) + } + return fmt.Sprintf("xdr:%s: %s", e.Func, e.Description) +} + +// unmarshalError creates an error given a set of arguments and will copy byte +// slices into the Value field since they might otherwise be changed from from +// the original value. +func unmarshalError(f string, c ErrorCode, desc string, v interface{}, err error) *UnmarshalError { + e := &UnmarshalError{ErrorCode: c, Func: f, Description: desc, Err: err} + switch t := v.(type) { + case []byte: + slice := make([]byte, len(t)) + copy(slice, t) + e.Value = slice + default: + e.Value = v + } + + return e +} + +// IsIO returns a boolean indicating whether the error is known to report that +// the underlying reader or writer encountered an ErrIO. +func IsIO(err error) bool { + switch e := err.(type) { + case *UnmarshalError: + return e.ErrorCode == ErrIO + case *MarshalError: + return e.ErrorCode == ErrIO + } + return false +} + +// MarshalError describes a problem encountered while marshaling data. +// Some potential issues are unsupported Go types, attempting to encode more +// opaque data than can be represented by a single opaque XDR entry, and +// exceeding max slice limitations. +type MarshalError struct { + ErrorCode ErrorCode // Describes the kind of error + Func string // Function name + Value interface{} // Value actually parsed where appropriate + Description string // Human readable description of the issue + Err error // The underlying error for IO errors +} + +// Error satisfies the error interface and prints human-readable errors. +func (e *MarshalError) Error() string { + switch e.ErrorCode { + case ErrIO: + return fmt.Sprintf("xdr:%s: %s - wrote: '%v'", e.Func, + e.Description, e.Value) + case ErrBadEnumValue: + return fmt.Sprintf("xdr:%s: %s - value: '%v'", e.Func, + e.Description, e.Value) + } + return fmt.Sprintf("xdr:%s: %s", e.Func, e.Description) +} + +// marshalError creates an error given a set of arguments and will copy byte +// slices into the Value field since they might otherwise be changed from from +// the original value. +func marshalError(f string, c ErrorCode, desc string, v interface{}, err error) *MarshalError { + e := &MarshalError{ErrorCode: c, Func: f, Description: desc, Err: err} + switch t := v.(type) { + case []byte: + slice := make([]byte, len(t)) + copy(slice, t) + e.Value = slice + default: + e.Value = v + } + + return e +} diff --git a/vendor/github.com/digitalocean/go-libvirt/libvirt.gen.go b/vendor/github.com/digitalocean/go-libvirt/libvirt.gen.go new file mode 100644 index 000000000..eb51f2817 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/libvirt.gen.go @@ -0,0 +1,15538 @@ +// Copyright 2018 The go-libvirt Authors. +// +// 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 internal/lvgen/generate.go. DO NOT EDIT. +// +// To regenerate, run 'go generate' in internal/lvgen. +// + +package libvirt + +import ( + "bytes" + "fmt" + "io" + "reflect" + + "github.com/digitalocean/go-libvirt/internal/constants" + "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" +) + +const ( + VirUUIDBuflen = 16 +) + +type typedParamDecoder struct {} + +// Decode decodes a TypedParam. These are part of the libvirt spec, and not xdr +// proper. TypedParams contain a name, which is called Field for some reason, +// and a Value, which itself has a "discriminant" - an integer enum encoding the +// actual type, and a value, the length of which varies based on the actual +// type. +func (tpd typedParamDecoder) Decode(d *xdr.Decoder, v reflect.Value) (int, error) { + // Get the name of the typed param first + name, n, err := d.DecodeString() + if err != nil { + return n, err + } + val, n2, err := tpd.decodeTypedParamValue(d) + n += n2 + if err != nil { + return n, err + } + tp := &TypedParam{Field: name, Value: *val} + v.Set(reflect.ValueOf(*tp)) + + return n, nil +} + +// decodeTypedParamValue decodes the Value part of a TypedParam. +func (typedParamDecoder) decodeTypedParamValue(d *xdr.Decoder) (*TypedParamValue, int, error) { + // All TypedParamValues begin with a uint32 discriminant that tells us what + // type they are. + discriminant, n, err := d.DecodeUint() + if err != nil { + return nil, n, err + } + var n2 int + var tpv *TypedParamValue + switch discriminant { + case 1: + var val int32 + n2, err = d.Decode(&val) + tpv = &TypedParamValue{D: discriminant, I: val} + case 2: + var val uint32 + n2, err = d.Decode(&val) + tpv = &TypedParamValue{D: discriminant, I: val} + case 3: + var val int64 + n2, err = d.Decode(&val) + tpv = &TypedParamValue{D: discriminant, I: val} + case 4: + var val uint64 + n2, err = d.Decode(&val) + tpv = &TypedParamValue{D: discriminant, I: val} + case 5: + var val float64 + n2, err = d.Decode(&val) + tpv = &TypedParamValue{D: discriminant, I: val} + case 6: + var val int32 + n2, err = d.Decode(&val) + tpv = &TypedParamValue{D: discriminant, I: val} + case 7: + var val string + n2, err = d.Decode(&val) + tpv = &TypedParamValue{D: discriminant, I: val} + + default: + err = fmt.Errorf("invalid parameter type %v", discriminant) + } + n += n2 + + return tpv, n, err +} + +// +// Typedefs: +// +// OptString is libvirt's remote_string +type OptString []string +// UUID is libvirt's remote_uuid +type UUID [VirUUIDBuflen]byte +// OptDomain is libvirt's remote_domain +type OptDomain []Domain +// OptNetwork is libvirt's remote_network +type OptNetwork []Network +// OptNwfilter is libvirt's remote_nwfilter +type OptNwfilter []Nwfilter +// OptNwfilterBinding is libvirt's remote_nwfilter_binding +type OptNwfilterBinding []NwfilterBinding +// OptStoragePool is libvirt's remote_storage_pool +type OptStoragePool []StoragePool +// OptStorageVol is libvirt's remote_storage_vol +type OptStorageVol []StorageVol +// OptNodeDevice is libvirt's remote_node_device +type OptNodeDevice []NodeDevice +// OptSecret is libvirt's remote_secret +type OptSecret []Secret + +// +// Enums: +// +// AuthType is libvirt's remote_auth_type +type AuthType int32 +// Procedure is libvirt's remote_procedure +type Procedure int32 + +// +// Structs: +// +// Domain is libvirt's remote_nonnull_domain +type Domain struct { + Name string + UUID UUID + ID int32 +} + +// Network is libvirt's remote_nonnull_network +type Network struct { + Name string + UUID UUID +} + +// Nwfilter is libvirt's remote_nonnull_nwfilter +type Nwfilter struct { + Name string + UUID UUID +} + +// NwfilterBinding is libvirt's remote_nonnull_nwfilter_binding +type NwfilterBinding struct { + Portdev string + Filtername string +} + +// Interface is libvirt's remote_nonnull_interface +type Interface struct { + Name string + Mac string +} + +// StoragePool is libvirt's remote_nonnull_storage_pool +type StoragePool struct { + Name string + UUID UUID +} + +// StorageVol is libvirt's remote_nonnull_storage_vol +type StorageVol struct { + Pool string + Name string + Key string +} + +// NodeDevice is libvirt's remote_nonnull_node_device +type NodeDevice struct { + Name string +} + +// Secret is libvirt's remote_nonnull_secret +type Secret struct { + UUID UUID + UsageType int32 + UsageID string +} + +// DomainSnapshot is libvirt's remote_nonnull_domain_snapshot +type DomainSnapshot struct { + Name string + Dom Domain +} + +// Error is libvirt's remote_error +type Error struct { + Code int32 + OptDomain int32 + Message OptString + Level int32 + Dom OptDomain + Str1 OptString + Str2 OptString + Str3 OptString + Int1 int32 + Int2 int32 + Net OptNetwork +} + +// VcpuInfo is libvirt's remote_vcpu_info +type VcpuInfo struct { + Number uint32 + State int32 + CPUTime uint64 + CPU int32 +} + +// TypedParam is libvirt's remote_typed_param +type TypedParam struct { + Field string + Value TypedParamValue +} + +// NodeGetCPUStats is libvirt's remote_node_get_cpu_stats +type NodeGetCPUStats struct { + Field string + Value uint64 +} + +// NodeGetMemoryStats is libvirt's remote_node_get_memory_stats +type NodeGetMemoryStats struct { + Field string + Value uint64 +} + +// DomainDiskError is libvirt's remote_domain_disk_error +type DomainDiskError struct { + Disk string + Error int32 +} + +// ConnectOpenArgs is libvirt's remote_connect_open_args +type ConnectOpenArgs struct { + Name OptString + Flags ConnectFlags +} + +// ConnectSupportsFeatureArgs is libvirt's remote_connect_supports_feature_args +type ConnectSupportsFeatureArgs struct { + Feature int32 +} + +// ConnectSupportsFeatureRet is libvirt's remote_connect_supports_feature_ret +type ConnectSupportsFeatureRet struct { + Supported int32 +} + +// ConnectGetTypeRet is libvirt's remote_connect_get_type_ret +type ConnectGetTypeRet struct { + Type string +} + +// ConnectGetVersionRet is libvirt's remote_connect_get_version_ret +type ConnectGetVersionRet struct { + HvVer uint64 +} + +// ConnectGetLibVersionRet is libvirt's remote_connect_get_lib_version_ret +type ConnectGetLibVersionRet struct { + LibVer uint64 +} + +// ConnectGetHostnameRet is libvirt's remote_connect_get_hostname_ret +type ConnectGetHostnameRet struct { + Hostname string +} + +// ConnectGetSysinfoArgs is libvirt's remote_connect_get_sysinfo_args +type ConnectGetSysinfoArgs struct { + Flags uint32 +} + +// ConnectGetSysinfoRet is libvirt's remote_connect_get_sysinfo_ret +type ConnectGetSysinfoRet struct { + Sysinfo string +} + +// ConnectGetUriRet is libvirt's remote_connect_get_uri_ret +type ConnectGetUriRet struct { + Uri string +} + +// ConnectGetMaxVcpusArgs is libvirt's remote_connect_get_max_vcpus_args +type ConnectGetMaxVcpusArgs struct { + Type OptString +} + +// ConnectGetMaxVcpusRet is libvirt's remote_connect_get_max_vcpus_ret +type ConnectGetMaxVcpusRet struct { + MaxVcpus int32 +} + +// NodeGetInfoRet is libvirt's remote_node_get_info_ret +type NodeGetInfoRet struct { + Model [32]int8 + Memory uint64 + Cpus int32 + Mhz int32 + Nodes int32 + Sockets int32 + Cores int32 + Threads int32 +} + +// ConnectGetCapabilitiesRet is libvirt's remote_connect_get_capabilities_ret +type ConnectGetCapabilitiesRet struct { + Capabilities string +} + +// ConnectGetDomainCapabilitiesArgs is libvirt's remote_connect_get_domain_capabilities_args +type ConnectGetDomainCapabilitiesArgs struct { + Emulatorbin OptString + Arch OptString + Machine OptString + Virttype OptString + Flags uint32 +} + +// ConnectGetDomainCapabilitiesRet is libvirt's remote_connect_get_domain_capabilities_ret +type ConnectGetDomainCapabilitiesRet struct { + Capabilities string +} + +// NodeGetCPUStatsArgs is libvirt's remote_node_get_cpu_stats_args +type NodeGetCPUStatsArgs struct { + CPUNum int32 + Nparams int32 + Flags uint32 +} + +// NodeGetCPUStatsRet is libvirt's remote_node_get_cpu_stats_ret +type NodeGetCPUStatsRet struct { + Params []NodeGetCPUStats + Nparams int32 +} + +// NodeGetMemoryStatsArgs is libvirt's remote_node_get_memory_stats_args +type NodeGetMemoryStatsArgs struct { + Nparams int32 + CellNum int32 + Flags uint32 +} + +// NodeGetMemoryStatsRet is libvirt's remote_node_get_memory_stats_ret +type NodeGetMemoryStatsRet struct { + Params []NodeGetMemoryStats + Nparams int32 +} + +// NodeGetCellsFreeMemoryArgs is libvirt's remote_node_get_cells_free_memory_args +type NodeGetCellsFreeMemoryArgs struct { + StartCell int32 + Maxcells int32 +} + +// NodeGetCellsFreeMemoryRet is libvirt's remote_node_get_cells_free_memory_ret +type NodeGetCellsFreeMemoryRet struct { + Cells []uint64 +} + +// NodeGetFreeMemoryRet is libvirt's remote_node_get_free_memory_ret +type NodeGetFreeMemoryRet struct { + FreeMem uint64 +} + +// DomainGetSchedulerTypeArgs is libvirt's remote_domain_get_scheduler_type_args +type DomainGetSchedulerTypeArgs struct { + Dom Domain +} + +// DomainGetSchedulerTypeRet is libvirt's remote_domain_get_scheduler_type_ret +type DomainGetSchedulerTypeRet struct { + Type string + Nparams int32 +} + +// DomainGetSchedulerParametersArgs is libvirt's remote_domain_get_scheduler_parameters_args +type DomainGetSchedulerParametersArgs struct { + Dom Domain + Nparams int32 +} + +// DomainGetSchedulerParametersRet is libvirt's remote_domain_get_scheduler_parameters_ret +type DomainGetSchedulerParametersRet struct { + Params []TypedParam +} + +// DomainGetSchedulerParametersFlagsArgs is libvirt's remote_domain_get_scheduler_parameters_flags_args +type DomainGetSchedulerParametersFlagsArgs struct { + Dom Domain + Nparams int32 + Flags uint32 +} + +// DomainGetSchedulerParametersFlagsRet is libvirt's remote_domain_get_scheduler_parameters_flags_ret +type DomainGetSchedulerParametersFlagsRet struct { + Params []TypedParam +} + +// DomainSetSchedulerParametersArgs is libvirt's remote_domain_set_scheduler_parameters_args +type DomainSetSchedulerParametersArgs struct { + Dom Domain + Params []TypedParam +} + +// DomainSetSchedulerParametersFlagsArgs is libvirt's remote_domain_set_scheduler_parameters_flags_args +type DomainSetSchedulerParametersFlagsArgs struct { + Dom Domain + Params []TypedParam + Flags uint32 +} + +// DomainSetBlkioParametersArgs is libvirt's remote_domain_set_blkio_parameters_args +type DomainSetBlkioParametersArgs struct { + Dom Domain + Params []TypedParam + Flags uint32 +} + +// DomainGetBlkioParametersArgs is libvirt's remote_domain_get_blkio_parameters_args +type DomainGetBlkioParametersArgs struct { + Dom Domain + Nparams int32 + Flags uint32 +} + +// DomainGetBlkioParametersRet is libvirt's remote_domain_get_blkio_parameters_ret +type DomainGetBlkioParametersRet struct { + Params []TypedParam + Nparams int32 +} + +// DomainSetMemoryParametersArgs is libvirt's remote_domain_set_memory_parameters_args +type DomainSetMemoryParametersArgs struct { + Dom Domain + Params []TypedParam + Flags uint32 +} + +// DomainGetMemoryParametersArgs is libvirt's remote_domain_get_memory_parameters_args +type DomainGetMemoryParametersArgs struct { + Dom Domain + Nparams int32 + Flags uint32 +} + +// DomainGetMemoryParametersRet is libvirt's remote_domain_get_memory_parameters_ret +type DomainGetMemoryParametersRet struct { + Params []TypedParam + Nparams int32 +} + +// DomainBlockResizeArgs is libvirt's remote_domain_block_resize_args +type DomainBlockResizeArgs struct { + Dom Domain + Disk string + Size uint64 + Flags DomainBlockResizeFlags +} + +// DomainSetNumaParametersArgs is libvirt's remote_domain_set_numa_parameters_args +type DomainSetNumaParametersArgs struct { + Dom Domain + Params []TypedParam + Flags uint32 +} + +// DomainGetNumaParametersArgs is libvirt's remote_domain_get_numa_parameters_args +type DomainGetNumaParametersArgs struct { + Dom Domain + Nparams int32 + Flags uint32 +} + +// DomainGetNumaParametersRet is libvirt's remote_domain_get_numa_parameters_ret +type DomainGetNumaParametersRet struct { + Params []TypedParam + Nparams int32 +} + +// DomainSetPerfEventsArgs is libvirt's remote_domain_set_perf_events_args +type DomainSetPerfEventsArgs struct { + Dom Domain + Params []TypedParam + Flags DomainModificationImpact +} + +// DomainGetPerfEventsArgs is libvirt's remote_domain_get_perf_events_args +type DomainGetPerfEventsArgs struct { + Dom Domain + Flags DomainModificationImpact +} + +// DomainGetPerfEventsRet is libvirt's remote_domain_get_perf_events_ret +type DomainGetPerfEventsRet struct { + Params []TypedParam +} + +// DomainBlockStatsArgs is libvirt's remote_domain_block_stats_args +type DomainBlockStatsArgs struct { + Dom Domain + Path string +} + +// DomainBlockStatsRet is libvirt's remote_domain_block_stats_ret +type DomainBlockStatsRet struct { + RdReq int64 + RdBytes int64 + WrReq int64 + WrBytes int64 + Errs int64 +} + +// DomainBlockStatsFlagsArgs is libvirt's remote_domain_block_stats_flags_args +type DomainBlockStatsFlagsArgs struct { + Dom Domain + Path string + Nparams int32 + Flags uint32 +} + +// DomainBlockStatsFlagsRet is libvirt's remote_domain_block_stats_flags_ret +type DomainBlockStatsFlagsRet struct { + Params []TypedParam + Nparams int32 +} + +// DomainInterfaceStatsArgs is libvirt's remote_domain_interface_stats_args +type DomainInterfaceStatsArgs struct { + Dom Domain + Device string +} + +// DomainInterfaceStatsRet is libvirt's remote_domain_interface_stats_ret +type DomainInterfaceStatsRet struct { + RxBytes int64 + RxPackets int64 + RxErrs int64 + RxDrop int64 + TxBytes int64 + TxPackets int64 + TxErrs int64 + TxDrop int64 +} + +// DomainSetInterfaceParametersArgs is libvirt's remote_domain_set_interface_parameters_args +type DomainSetInterfaceParametersArgs struct { + Dom Domain + Device string + Params []TypedParam + Flags uint32 +} + +// DomainGetInterfaceParametersArgs is libvirt's remote_domain_get_interface_parameters_args +type DomainGetInterfaceParametersArgs struct { + Dom Domain + Device string + Nparams int32 + Flags DomainModificationImpact +} + +// DomainGetInterfaceParametersRet is libvirt's remote_domain_get_interface_parameters_ret +type DomainGetInterfaceParametersRet struct { + Params []TypedParam + Nparams int32 +} + +// DomainMemoryStatsArgs is libvirt's remote_domain_memory_stats_args +type DomainMemoryStatsArgs struct { + Dom Domain + MaxStats uint32 + Flags uint32 +} + +// DomainMemoryStat is libvirt's remote_domain_memory_stat +type DomainMemoryStat struct { + Tag int32 + Val uint64 +} + +// DomainMemoryStatsRet is libvirt's remote_domain_memory_stats_ret +type DomainMemoryStatsRet struct { + Stats []DomainMemoryStat +} + +// DomainBlockPeekArgs is libvirt's remote_domain_block_peek_args +type DomainBlockPeekArgs struct { + Dom Domain + Path string + Offset uint64 + Size uint32 + Flags uint32 +} + +// DomainBlockPeekRet is libvirt's remote_domain_block_peek_ret +type DomainBlockPeekRet struct { + Buffer []byte +} + +// DomainMemoryPeekArgs is libvirt's remote_domain_memory_peek_args +type DomainMemoryPeekArgs struct { + Dom Domain + Offset uint64 + Size uint32 + Flags DomainMemoryFlags +} + +// DomainMemoryPeekRet is libvirt's remote_domain_memory_peek_ret +type DomainMemoryPeekRet struct { + Buffer []byte +} + +// DomainGetBlockInfoArgs is libvirt's remote_domain_get_block_info_args +type DomainGetBlockInfoArgs struct { + Dom Domain + Path string + Flags uint32 +} + +// DomainGetBlockInfoRet is libvirt's remote_domain_get_block_info_ret +type DomainGetBlockInfoRet struct { + Allocation uint64 + Capacity uint64 + Physical uint64 +} + +// ConnectListDomainsArgs is libvirt's remote_connect_list_domains_args +type ConnectListDomainsArgs struct { + Maxids int32 +} + +// ConnectListDomainsRet is libvirt's remote_connect_list_domains_ret +type ConnectListDomainsRet struct { + Ids []int32 +} + +// ConnectNumOfDomainsRet is libvirt's remote_connect_num_of_domains_ret +type ConnectNumOfDomainsRet struct { + Num int32 +} + +// DomainCreateXMLArgs is libvirt's remote_domain_create_xml_args +type DomainCreateXMLArgs struct { + XMLDesc string + Flags DomainCreateFlags +} + +// DomainCreateXMLRet is libvirt's remote_domain_create_xml_ret +type DomainCreateXMLRet struct { + Dom Domain +} + +// DomainCreateXMLWithFilesArgs is libvirt's remote_domain_create_xml_with_files_args +type DomainCreateXMLWithFilesArgs struct { + XMLDesc string + Flags DomainCreateFlags +} + +// DomainCreateXMLWithFilesRet is libvirt's remote_domain_create_xml_with_files_ret +type DomainCreateXMLWithFilesRet struct { + Dom Domain +} + +// DomainLookupByIDArgs is libvirt's remote_domain_lookup_by_id_args +type DomainLookupByIDArgs struct { + ID int32 +} + +// DomainLookupByIDRet is libvirt's remote_domain_lookup_by_id_ret +type DomainLookupByIDRet struct { + Dom Domain +} + +// DomainLookupByUUIDArgs is libvirt's remote_domain_lookup_by_uuid_args +type DomainLookupByUUIDArgs struct { + UUID UUID +} + +// DomainLookupByUUIDRet is libvirt's remote_domain_lookup_by_uuid_ret +type DomainLookupByUUIDRet struct { + Dom Domain +} + +// DomainLookupByNameArgs is libvirt's remote_domain_lookup_by_name_args +type DomainLookupByNameArgs struct { + Name string +} + +// DomainLookupByNameRet is libvirt's remote_domain_lookup_by_name_ret +type DomainLookupByNameRet struct { + Dom Domain +} + +// DomainSuspendArgs is libvirt's remote_domain_suspend_args +type DomainSuspendArgs struct { + Dom Domain +} + +// DomainResumeArgs is libvirt's remote_domain_resume_args +type DomainResumeArgs struct { + Dom Domain +} + +// DomainPmSuspendForDurationArgs is libvirt's remote_domain_pm_suspend_for_duration_args +type DomainPmSuspendForDurationArgs struct { + Dom Domain + Target uint32 + Duration uint64 + Flags uint32 +} + +// DomainPmWakeupArgs is libvirt's remote_domain_pm_wakeup_args +type DomainPmWakeupArgs struct { + Dom Domain + Flags uint32 +} + +// DomainShutdownArgs is libvirt's remote_domain_shutdown_args +type DomainShutdownArgs struct { + Dom Domain +} + +// DomainRebootArgs is libvirt's remote_domain_reboot_args +type DomainRebootArgs struct { + Dom Domain + Flags DomainRebootFlagValues +} + +// DomainResetArgs is libvirt's remote_domain_reset_args +type DomainResetArgs struct { + Dom Domain + Flags uint32 +} + +// DomainDestroyArgs is libvirt's remote_domain_destroy_args +type DomainDestroyArgs struct { + Dom Domain +} + +// DomainDestroyFlagsArgs is libvirt's remote_domain_destroy_flags_args +type DomainDestroyFlagsArgs struct { + Dom Domain + Flags DomainDestroyFlagsValues +} + +// DomainGetOsTypeArgs is libvirt's remote_domain_get_os_type_args +type DomainGetOsTypeArgs struct { + Dom Domain +} + +// DomainGetOsTypeRet is libvirt's remote_domain_get_os_type_ret +type DomainGetOsTypeRet struct { + Type string +} + +// DomainGetMaxMemoryArgs is libvirt's remote_domain_get_max_memory_args +type DomainGetMaxMemoryArgs struct { + Dom Domain +} + +// DomainGetMaxMemoryRet is libvirt's remote_domain_get_max_memory_ret +type DomainGetMaxMemoryRet struct { + Memory uint64 +} + +// DomainSetMaxMemoryArgs is libvirt's remote_domain_set_max_memory_args +type DomainSetMaxMemoryArgs struct { + Dom Domain + Memory uint64 +} + +// DomainSetMemoryArgs is libvirt's remote_domain_set_memory_args +type DomainSetMemoryArgs struct { + Dom Domain + Memory uint64 +} + +// DomainSetMemoryFlagsArgs is libvirt's remote_domain_set_memory_flags_args +type DomainSetMemoryFlagsArgs struct { + Dom Domain + Memory uint64 + Flags uint32 +} + +// DomainSetMemoryStatsPeriodArgs is libvirt's remote_domain_set_memory_stats_period_args +type DomainSetMemoryStatsPeriodArgs struct { + Dom Domain + Period int32 + Flags DomainMemoryModFlags +} + +// DomainGetInfoArgs is libvirt's remote_domain_get_info_args +type DomainGetInfoArgs struct { + Dom Domain +} + +// DomainGetInfoRet is libvirt's remote_domain_get_info_ret +type DomainGetInfoRet struct { + State uint8 + MaxMem uint64 + Memory uint64 + NrVirtCPU uint16 + CPUTime uint64 +} + +// DomainSaveArgs is libvirt's remote_domain_save_args +type DomainSaveArgs struct { + Dom Domain + To string +} + +// DomainSaveFlagsArgs is libvirt's remote_domain_save_flags_args +type DomainSaveFlagsArgs struct { + Dom Domain + To string + Dxml OptString + Flags uint32 +} + +// DomainRestoreArgs is libvirt's remote_domain_restore_args +type DomainRestoreArgs struct { + From string +} + +// DomainRestoreFlagsArgs is libvirt's remote_domain_restore_flags_args +type DomainRestoreFlagsArgs struct { + From string + Dxml OptString + Flags uint32 +} + +// DomainSaveImageGetXMLDescArgs is libvirt's remote_domain_save_image_get_xml_desc_args +type DomainSaveImageGetXMLDescArgs struct { + File string + Flags uint32 +} + +// DomainSaveImageGetXMLDescRet is libvirt's remote_domain_save_image_get_xml_desc_ret +type DomainSaveImageGetXMLDescRet struct { + XML string +} + +// DomainSaveImageDefineXMLArgs is libvirt's remote_domain_save_image_define_xml_args +type DomainSaveImageDefineXMLArgs struct { + File string + Dxml string + Flags uint32 +} + +// DomainCoreDumpArgs is libvirt's remote_domain_core_dump_args +type DomainCoreDumpArgs struct { + Dom Domain + To string + Flags DomainCoreDumpFlags +} + +// DomainCoreDumpWithFormatArgs is libvirt's remote_domain_core_dump_with_format_args +type DomainCoreDumpWithFormatArgs struct { + Dom Domain + To string + Dumpformat uint32 + Flags DomainCoreDumpFlags +} + +// DomainScreenshotArgs is libvirt's remote_domain_screenshot_args +type DomainScreenshotArgs struct { + Dom Domain + Screen uint32 + Flags uint32 +} + +// DomainScreenshotRet is libvirt's remote_domain_screenshot_ret +type DomainScreenshotRet struct { + Mime OptString +} + +// DomainGetXMLDescArgs is libvirt's remote_domain_get_xml_desc_args +type DomainGetXMLDescArgs struct { + Dom Domain + Flags DomainXMLFlags +} + +// DomainGetXMLDescRet is libvirt's remote_domain_get_xml_desc_ret +type DomainGetXMLDescRet struct { + XML string +} + +// DomainMigratePrepareArgs is libvirt's remote_domain_migrate_prepare_args +type DomainMigratePrepareArgs struct { + UriIn OptString + Flags uint64 + Dname OptString + Resource uint64 +} + +// DomainMigratePrepareRet is libvirt's remote_domain_migrate_prepare_ret +type DomainMigratePrepareRet struct { + Cookie []byte + UriOut OptString +} + +// DomainMigratePerformArgs is libvirt's remote_domain_migrate_perform_args +type DomainMigratePerformArgs struct { + Dom Domain + Cookie []byte + Uri string + Flags uint64 + Dname OptString + Resource uint64 +} + +// DomainMigrateFinishArgs is libvirt's remote_domain_migrate_finish_args +type DomainMigrateFinishArgs struct { + Dname string + Cookie []byte + Uri string + Flags uint64 +} + +// DomainMigrateFinishRet is libvirt's remote_domain_migrate_finish_ret +type DomainMigrateFinishRet struct { + Ddom Domain +} + +// DomainMigratePrepare2Args is libvirt's remote_domain_migrate_prepare2_args +type DomainMigratePrepare2Args struct { + UriIn OptString + Flags uint64 + Dname OptString + Resource uint64 + DomXML string +} + +// DomainMigratePrepare2Ret is libvirt's remote_domain_migrate_prepare2_ret +type DomainMigratePrepare2Ret struct { + Cookie []byte + UriOut OptString +} + +// DomainMigrateFinish2Args is libvirt's remote_domain_migrate_finish2_args +type DomainMigrateFinish2Args struct { + Dname string + Cookie []byte + Uri string + Flags uint64 + Retcode int32 +} + +// DomainMigrateFinish2Ret is libvirt's remote_domain_migrate_finish2_ret +type DomainMigrateFinish2Ret struct { + Ddom Domain +} + +// ConnectListDefinedDomainsArgs is libvirt's remote_connect_list_defined_domains_args +type ConnectListDefinedDomainsArgs struct { + Maxnames int32 +} + +// ConnectListDefinedDomainsRet is libvirt's remote_connect_list_defined_domains_ret +type ConnectListDefinedDomainsRet struct { + Names []string +} + +// ConnectNumOfDefinedDomainsRet is libvirt's remote_connect_num_of_defined_domains_ret +type ConnectNumOfDefinedDomainsRet struct { + Num int32 +} + +// DomainCreateArgs is libvirt's remote_domain_create_args +type DomainCreateArgs struct { + Dom Domain +} + +// DomainCreateWithFlagsArgs is libvirt's remote_domain_create_with_flags_args +type DomainCreateWithFlagsArgs struct { + Dom Domain + Flags uint32 +} + +// DomainCreateWithFlagsRet is libvirt's remote_domain_create_with_flags_ret +type DomainCreateWithFlagsRet struct { + Dom Domain +} + +// DomainCreateWithFilesArgs is libvirt's remote_domain_create_with_files_args +type DomainCreateWithFilesArgs struct { + Dom Domain + Flags DomainCreateFlags +} + +// DomainCreateWithFilesRet is libvirt's remote_domain_create_with_files_ret +type DomainCreateWithFilesRet struct { + Dom Domain +} + +// DomainDefineXMLArgs is libvirt's remote_domain_define_xml_args +type DomainDefineXMLArgs struct { + XML string +} + +// DomainDefineXMLRet is libvirt's remote_domain_define_xml_ret +type DomainDefineXMLRet struct { + Dom Domain +} + +// DomainDefineXMLFlagsArgs is libvirt's remote_domain_define_xml_flags_args +type DomainDefineXMLFlagsArgs struct { + XML string + Flags DomainDefineFlags +} + +// DomainDefineXMLFlagsRet is libvirt's remote_domain_define_xml_flags_ret +type DomainDefineXMLFlagsRet struct { + Dom Domain +} + +// DomainUndefineArgs is libvirt's remote_domain_undefine_args +type DomainUndefineArgs struct { + Dom Domain +} + +// DomainUndefineFlagsArgs is libvirt's remote_domain_undefine_flags_args +type DomainUndefineFlagsArgs struct { + Dom Domain + Flags DomainUndefineFlagsValues +} + +// DomainInjectNmiArgs is libvirt's remote_domain_inject_nmi_args +type DomainInjectNmiArgs struct { + Dom Domain + Flags uint32 +} + +// DomainSendKeyArgs is libvirt's remote_domain_send_key_args +type DomainSendKeyArgs struct { + Dom Domain + Codeset uint32 + Holdtime uint32 + Keycodes []uint32 + Flags uint32 +} + +// DomainSendProcessSignalArgs is libvirt's remote_domain_send_process_signal_args +type DomainSendProcessSignalArgs struct { + Dom Domain + PidValue int64 + Signum uint32 + Flags uint32 +} + +// DomainSetVcpusArgs is libvirt's remote_domain_set_vcpus_args +type DomainSetVcpusArgs struct { + Dom Domain + Nvcpus uint32 +} + +// DomainSetVcpusFlagsArgs is libvirt's remote_domain_set_vcpus_flags_args +type DomainSetVcpusFlagsArgs struct { + Dom Domain + Nvcpus uint32 + Flags uint32 +} + +// DomainGetVcpusFlagsArgs is libvirt's remote_domain_get_vcpus_flags_args +type DomainGetVcpusFlagsArgs struct { + Dom Domain + Flags uint32 +} + +// DomainGetVcpusFlagsRet is libvirt's remote_domain_get_vcpus_flags_ret +type DomainGetVcpusFlagsRet struct { + Num int32 +} + +// DomainPinVcpuArgs is libvirt's remote_domain_pin_vcpu_args +type DomainPinVcpuArgs struct { + Dom Domain + Vcpu uint32 + Cpumap []byte +} + +// DomainPinVcpuFlagsArgs is libvirt's remote_domain_pin_vcpu_flags_args +type DomainPinVcpuFlagsArgs struct { + Dom Domain + Vcpu uint32 + Cpumap []byte + Flags uint32 +} + +// DomainGetVcpuPinInfoArgs is libvirt's remote_domain_get_vcpu_pin_info_args +type DomainGetVcpuPinInfoArgs struct { + Dom Domain + Ncpumaps int32 + Maplen int32 + Flags uint32 +} + +// DomainGetVcpuPinInfoRet is libvirt's remote_domain_get_vcpu_pin_info_ret +type DomainGetVcpuPinInfoRet struct { + Cpumaps []byte + Num int32 +} + +// DomainPinEmulatorArgs is libvirt's remote_domain_pin_emulator_args +type DomainPinEmulatorArgs struct { + Dom Domain + Cpumap []byte + Flags DomainModificationImpact +} + +// DomainGetEmulatorPinInfoArgs is libvirt's remote_domain_get_emulator_pin_info_args +type DomainGetEmulatorPinInfoArgs struct { + Dom Domain + Maplen int32 + Flags DomainModificationImpact +} + +// DomainGetEmulatorPinInfoRet is libvirt's remote_domain_get_emulator_pin_info_ret +type DomainGetEmulatorPinInfoRet struct { + Cpumaps []byte + Ret int32 +} + +// DomainGetVcpusArgs is libvirt's remote_domain_get_vcpus_args +type DomainGetVcpusArgs struct { + Dom Domain + Maxinfo int32 + Maplen int32 +} + +// DomainGetVcpusRet is libvirt's remote_domain_get_vcpus_ret +type DomainGetVcpusRet struct { + Info []VcpuInfo + Cpumaps []byte +} + +// DomainGetMaxVcpusArgs is libvirt's remote_domain_get_max_vcpus_args +type DomainGetMaxVcpusArgs struct { + Dom Domain +} + +// DomainGetMaxVcpusRet is libvirt's remote_domain_get_max_vcpus_ret +type DomainGetMaxVcpusRet struct { + Num int32 +} + +// DomainIothreadInfo is libvirt's remote_domain_iothread_info +type DomainIothreadInfo struct { + IothreadID uint32 + Cpumap []byte +} + +// DomainGetIothreadInfoArgs is libvirt's remote_domain_get_iothread_info_args +type DomainGetIothreadInfoArgs struct { + Dom Domain + Flags DomainModificationImpact +} + +// DomainGetIothreadInfoRet is libvirt's remote_domain_get_iothread_info_ret +type DomainGetIothreadInfoRet struct { + Info []DomainIothreadInfo + Ret uint32 +} + +// DomainPinIothreadArgs is libvirt's remote_domain_pin_iothread_args +type DomainPinIothreadArgs struct { + Dom Domain + IothreadsID uint32 + Cpumap []byte + Flags DomainModificationImpact +} + +// DomainAddIothreadArgs is libvirt's remote_domain_add_iothread_args +type DomainAddIothreadArgs struct { + Dom Domain + IothreadID uint32 + Flags DomainModificationImpact +} + +// DomainDelIothreadArgs is libvirt's remote_domain_del_iothread_args +type DomainDelIothreadArgs struct { + Dom Domain + IothreadID uint32 + Flags DomainModificationImpact +} + +// DomainSetIothreadParamsArgs is libvirt's remote_domain_set_iothread_params_args +type DomainSetIothreadParamsArgs struct { + Dom Domain + IothreadID uint32 + Params []TypedParam + Flags uint32 +} + +// DomainGetSecurityLabelArgs is libvirt's remote_domain_get_security_label_args +type DomainGetSecurityLabelArgs struct { + Dom Domain +} + +// DomainGetSecurityLabelRet is libvirt's remote_domain_get_security_label_ret +type DomainGetSecurityLabelRet struct { + Label []int8 + Enforcing int32 +} + +// DomainGetSecurityLabelListArgs is libvirt's remote_domain_get_security_label_list_args +type DomainGetSecurityLabelListArgs struct { + Dom Domain +} + +// DomainGetSecurityLabelListRet is libvirt's remote_domain_get_security_label_list_ret +type DomainGetSecurityLabelListRet struct { + Labels []DomainGetSecurityLabelRet + Ret int32 +} + +// NodeGetSecurityModelRet is libvirt's remote_node_get_security_model_ret +type NodeGetSecurityModelRet struct { + Model []int8 + Doi []int8 +} + +// DomainAttachDeviceArgs is libvirt's remote_domain_attach_device_args +type DomainAttachDeviceArgs struct { + Dom Domain + XML string +} + +// DomainAttachDeviceFlagsArgs is libvirt's remote_domain_attach_device_flags_args +type DomainAttachDeviceFlagsArgs struct { + Dom Domain + XML string + Flags uint32 +} + +// DomainDetachDeviceArgs is libvirt's remote_domain_detach_device_args +type DomainDetachDeviceArgs struct { + Dom Domain + XML string +} + +// DomainDetachDeviceFlagsArgs is libvirt's remote_domain_detach_device_flags_args +type DomainDetachDeviceFlagsArgs struct { + Dom Domain + XML string + Flags uint32 +} + +// DomainUpdateDeviceFlagsArgs is libvirt's remote_domain_update_device_flags_args +type DomainUpdateDeviceFlagsArgs struct { + Dom Domain + XML string + Flags DomainDeviceModifyFlags +} + +// DomainDetachDeviceAliasArgs is libvirt's remote_domain_detach_device_alias_args +type DomainDetachDeviceAliasArgs struct { + Dom Domain + Alias string + Flags uint32 +} + +// DomainGetAutostartArgs is libvirt's remote_domain_get_autostart_args +type DomainGetAutostartArgs struct { + Dom Domain +} + +// DomainGetAutostartRet is libvirt's remote_domain_get_autostart_ret +type DomainGetAutostartRet struct { + Autostart int32 +} + +// DomainSetAutostartArgs is libvirt's remote_domain_set_autostart_args +type DomainSetAutostartArgs struct { + Dom Domain + Autostart int32 +} + +// DomainSetMetadataArgs is libvirt's remote_domain_set_metadata_args +type DomainSetMetadataArgs struct { + Dom Domain + Type int32 + Metadata OptString + Key OptString + Uri OptString + Flags DomainModificationImpact +} + +// DomainGetMetadataArgs is libvirt's remote_domain_get_metadata_args +type DomainGetMetadataArgs struct { + Dom Domain + Type int32 + Uri OptString + Flags DomainModificationImpact +} + +// DomainGetMetadataRet is libvirt's remote_domain_get_metadata_ret +type DomainGetMetadataRet struct { + Metadata string +} + +// DomainBlockJobAbortArgs is libvirt's remote_domain_block_job_abort_args +type DomainBlockJobAbortArgs struct { + Dom Domain + Path string + Flags DomainBlockJobAbortFlags +} + +// DomainGetBlockJobInfoArgs is libvirt's remote_domain_get_block_job_info_args +type DomainGetBlockJobInfoArgs struct { + Dom Domain + Path string + Flags uint32 +} + +// DomainGetBlockJobInfoRet is libvirt's remote_domain_get_block_job_info_ret +type DomainGetBlockJobInfoRet struct { + Found int32 + Type int32 + Bandwidth uint64 + Cur uint64 + End uint64 +} + +// DomainBlockJobSetSpeedArgs is libvirt's remote_domain_block_job_set_speed_args +type DomainBlockJobSetSpeedArgs struct { + Dom Domain + Path string + Bandwidth uint64 + Flags DomainBlockJobSetSpeedFlags +} + +// DomainBlockPullArgs is libvirt's remote_domain_block_pull_args +type DomainBlockPullArgs struct { + Dom Domain + Path string + Bandwidth uint64 + Flags DomainBlockPullFlags +} + +// DomainBlockRebaseArgs is libvirt's remote_domain_block_rebase_args +type DomainBlockRebaseArgs struct { + Dom Domain + Path string + Base OptString + Bandwidth uint64 + Flags DomainBlockRebaseFlags +} + +// DomainBlockCopyArgs is libvirt's remote_domain_block_copy_args +type DomainBlockCopyArgs struct { + Dom Domain + Path string + Destxml string + Params []TypedParam + Flags DomainBlockCopyFlags +} + +// DomainBlockCommitArgs is libvirt's remote_domain_block_commit_args +type DomainBlockCommitArgs struct { + Dom Domain + Disk string + Base OptString + Top OptString + Bandwidth uint64 + Flags DomainBlockCommitFlags +} + +// DomainSetBlockIOTuneArgs is libvirt's remote_domain_set_block_io_tune_args +type DomainSetBlockIOTuneArgs struct { + Dom Domain + Disk string + Params []TypedParam + Flags uint32 +} + +// DomainGetBlockIOTuneArgs is libvirt's remote_domain_get_block_io_tune_args +type DomainGetBlockIOTuneArgs struct { + Dom Domain + Disk OptString + Nparams int32 + Flags uint32 +} + +// DomainGetBlockIOTuneRet is libvirt's remote_domain_get_block_io_tune_ret +type DomainGetBlockIOTuneRet struct { + Params []TypedParam + Nparams int32 +} + +// DomainGetCPUStatsArgs is libvirt's remote_domain_get_cpu_stats_args +type DomainGetCPUStatsArgs struct { + Dom Domain + Nparams uint32 + StartCPU int32 + Ncpus uint32 + Flags TypedParameterFlags +} + +// DomainGetCPUStatsRet is libvirt's remote_domain_get_cpu_stats_ret +type DomainGetCPUStatsRet struct { + Params []TypedParam + Nparams int32 +} + +// DomainGetHostnameArgs is libvirt's remote_domain_get_hostname_args +type DomainGetHostnameArgs struct { + Dom Domain + Flags uint32 +} + +// DomainGetHostnameRet is libvirt's remote_domain_get_hostname_ret +type DomainGetHostnameRet struct { + Hostname string +} + +// ConnectNumOfNetworksRet is libvirt's remote_connect_num_of_networks_ret +type ConnectNumOfNetworksRet struct { + Num int32 +} + +// ConnectListNetworksArgs is libvirt's remote_connect_list_networks_args +type ConnectListNetworksArgs struct { + Maxnames int32 +} + +// ConnectListNetworksRet is libvirt's remote_connect_list_networks_ret +type ConnectListNetworksRet struct { + Names []string +} + +// ConnectNumOfDefinedNetworksRet is libvirt's remote_connect_num_of_defined_networks_ret +type ConnectNumOfDefinedNetworksRet struct { + Num int32 +} + +// ConnectListDefinedNetworksArgs is libvirt's remote_connect_list_defined_networks_args +type ConnectListDefinedNetworksArgs struct { + Maxnames int32 +} + +// ConnectListDefinedNetworksRet is libvirt's remote_connect_list_defined_networks_ret +type ConnectListDefinedNetworksRet struct { + Names []string +} + +// NetworkLookupByUUIDArgs is libvirt's remote_network_lookup_by_uuid_args +type NetworkLookupByUUIDArgs struct { + UUID UUID +} + +// NetworkLookupByUUIDRet is libvirt's remote_network_lookup_by_uuid_ret +type NetworkLookupByUUIDRet struct { + Net Network +} + +// NetworkLookupByNameArgs is libvirt's remote_network_lookup_by_name_args +type NetworkLookupByNameArgs struct { + Name string +} + +// NetworkLookupByNameRet is libvirt's remote_network_lookup_by_name_ret +type NetworkLookupByNameRet struct { + Net Network +} + +// NetworkCreateXMLArgs is libvirt's remote_network_create_xml_args +type NetworkCreateXMLArgs struct { + XML string +} + +// NetworkCreateXMLRet is libvirt's remote_network_create_xml_ret +type NetworkCreateXMLRet struct { + Net Network +} + +// NetworkDefineXMLArgs is libvirt's remote_network_define_xml_args +type NetworkDefineXMLArgs struct { + XML string +} + +// NetworkDefineXMLRet is libvirt's remote_network_define_xml_ret +type NetworkDefineXMLRet struct { + Net Network +} + +// NetworkUndefineArgs is libvirt's remote_network_undefine_args +type NetworkUndefineArgs struct { + Net Network +} + +// NetworkUpdateArgs is libvirt's remote_network_update_args +type NetworkUpdateArgs struct { + Net Network + Command uint32 + Section uint32 + ParentIndex int32 + XML string + Flags NetworkUpdateFlags +} + +// NetworkCreateArgs is libvirt's remote_network_create_args +type NetworkCreateArgs struct { + Net Network +} + +// NetworkDestroyArgs is libvirt's remote_network_destroy_args +type NetworkDestroyArgs struct { + Net Network +} + +// NetworkGetXMLDescArgs is libvirt's remote_network_get_xml_desc_args +type NetworkGetXMLDescArgs struct { + Net Network + Flags uint32 +} + +// NetworkGetXMLDescRet is libvirt's remote_network_get_xml_desc_ret +type NetworkGetXMLDescRet struct { + XML string +} + +// NetworkGetBridgeNameArgs is libvirt's remote_network_get_bridge_name_args +type NetworkGetBridgeNameArgs struct { + Net Network +} + +// NetworkGetBridgeNameRet is libvirt's remote_network_get_bridge_name_ret +type NetworkGetBridgeNameRet struct { + Name string +} + +// NetworkGetAutostartArgs is libvirt's remote_network_get_autostart_args +type NetworkGetAutostartArgs struct { + Net Network +} + +// NetworkGetAutostartRet is libvirt's remote_network_get_autostart_ret +type NetworkGetAutostartRet struct { + Autostart int32 +} + +// NetworkSetAutostartArgs is libvirt's remote_network_set_autostart_args +type NetworkSetAutostartArgs struct { + Net Network + Autostart int32 +} + +// ConnectNumOfNwfiltersRet is libvirt's remote_connect_num_of_nwfilters_ret +type ConnectNumOfNwfiltersRet struct { + Num int32 +} + +// ConnectListNwfiltersArgs is libvirt's remote_connect_list_nwfilters_args +type ConnectListNwfiltersArgs struct { + Maxnames int32 +} + +// ConnectListNwfiltersRet is libvirt's remote_connect_list_nwfilters_ret +type ConnectListNwfiltersRet struct { + Names []string +} + +// NwfilterLookupByUUIDArgs is libvirt's remote_nwfilter_lookup_by_uuid_args +type NwfilterLookupByUUIDArgs struct { + UUID UUID +} + +// NwfilterLookupByUUIDRet is libvirt's remote_nwfilter_lookup_by_uuid_ret +type NwfilterLookupByUUIDRet struct { + OptNwfilter Nwfilter +} + +// NwfilterLookupByNameArgs is libvirt's remote_nwfilter_lookup_by_name_args +type NwfilterLookupByNameArgs struct { + Name string +} + +// NwfilterLookupByNameRet is libvirt's remote_nwfilter_lookup_by_name_ret +type NwfilterLookupByNameRet struct { + OptNwfilter Nwfilter +} + +// NwfilterDefineXMLArgs is libvirt's remote_nwfilter_define_xml_args +type NwfilterDefineXMLArgs struct { + XML string +} + +// NwfilterDefineXMLRet is libvirt's remote_nwfilter_define_xml_ret +type NwfilterDefineXMLRet struct { + OptNwfilter Nwfilter +} + +// NwfilterUndefineArgs is libvirt's remote_nwfilter_undefine_args +type NwfilterUndefineArgs struct { + OptNwfilter Nwfilter +} + +// NwfilterGetXMLDescArgs is libvirt's remote_nwfilter_get_xml_desc_args +type NwfilterGetXMLDescArgs struct { + OptNwfilter Nwfilter + Flags uint32 +} + +// NwfilterGetXMLDescRet is libvirt's remote_nwfilter_get_xml_desc_ret +type NwfilterGetXMLDescRet struct { + XML string +} + +// ConnectNumOfInterfacesRet is libvirt's remote_connect_num_of_interfaces_ret +type ConnectNumOfInterfacesRet struct { + Num int32 +} + +// ConnectListInterfacesArgs is libvirt's remote_connect_list_interfaces_args +type ConnectListInterfacesArgs struct { + Maxnames int32 +} + +// ConnectListInterfacesRet is libvirt's remote_connect_list_interfaces_ret +type ConnectListInterfacesRet struct { + Names []string +} + +// ConnectNumOfDefinedInterfacesRet is libvirt's remote_connect_num_of_defined_interfaces_ret +type ConnectNumOfDefinedInterfacesRet struct { + Num int32 +} + +// ConnectListDefinedInterfacesArgs is libvirt's remote_connect_list_defined_interfaces_args +type ConnectListDefinedInterfacesArgs struct { + Maxnames int32 +} + +// ConnectListDefinedInterfacesRet is libvirt's remote_connect_list_defined_interfaces_ret +type ConnectListDefinedInterfacesRet struct { + Names []string +} + +// InterfaceLookupByNameArgs is libvirt's remote_interface_lookup_by_name_args +type InterfaceLookupByNameArgs struct { + Name string +} + +// InterfaceLookupByNameRet is libvirt's remote_interface_lookup_by_name_ret +type InterfaceLookupByNameRet struct { + Iface Interface +} + +// InterfaceLookupByMacStringArgs is libvirt's remote_interface_lookup_by_mac_string_args +type InterfaceLookupByMacStringArgs struct { + Mac string +} + +// InterfaceLookupByMacStringRet is libvirt's remote_interface_lookup_by_mac_string_ret +type InterfaceLookupByMacStringRet struct { + Iface Interface +} + +// InterfaceGetXMLDescArgs is libvirt's remote_interface_get_xml_desc_args +type InterfaceGetXMLDescArgs struct { + Iface Interface + Flags uint32 +} + +// InterfaceGetXMLDescRet is libvirt's remote_interface_get_xml_desc_ret +type InterfaceGetXMLDescRet struct { + XML string +} + +// InterfaceDefineXMLArgs is libvirt's remote_interface_define_xml_args +type InterfaceDefineXMLArgs struct { + XML string + Flags uint32 +} + +// InterfaceDefineXMLRet is libvirt's remote_interface_define_xml_ret +type InterfaceDefineXMLRet struct { + Iface Interface +} + +// InterfaceUndefineArgs is libvirt's remote_interface_undefine_args +type InterfaceUndefineArgs struct { + Iface Interface +} + +// InterfaceCreateArgs is libvirt's remote_interface_create_args +type InterfaceCreateArgs struct { + Iface Interface + Flags uint32 +} + +// InterfaceDestroyArgs is libvirt's remote_interface_destroy_args +type InterfaceDestroyArgs struct { + Iface Interface + Flags uint32 +} + +// InterfaceChangeBeginArgs is libvirt's remote_interface_change_begin_args +type InterfaceChangeBeginArgs struct { + Flags uint32 +} + +// InterfaceChangeCommitArgs is libvirt's remote_interface_change_commit_args +type InterfaceChangeCommitArgs struct { + Flags uint32 +} + +// InterfaceChangeRollbackArgs is libvirt's remote_interface_change_rollback_args +type InterfaceChangeRollbackArgs struct { + Flags uint32 +} + +// AuthListRet is libvirt's remote_auth_list_ret +type AuthListRet struct { + Types []AuthType +} + +// AuthSaslInitRet is libvirt's remote_auth_sasl_init_ret +type AuthSaslInitRet struct { + Mechlist string +} + +// AuthSaslStartArgs is libvirt's remote_auth_sasl_start_args +type AuthSaslStartArgs struct { + Mech string + Nil int32 + Data []int8 +} + +// AuthSaslStartRet is libvirt's remote_auth_sasl_start_ret +type AuthSaslStartRet struct { + Complete int32 + Nil int32 + Data []int8 +} + +// AuthSaslStepArgs is libvirt's remote_auth_sasl_step_args +type AuthSaslStepArgs struct { + Nil int32 + Data []int8 +} + +// AuthSaslStepRet is libvirt's remote_auth_sasl_step_ret +type AuthSaslStepRet struct { + Complete int32 + Nil int32 + Data []int8 +} + +// AuthPolkitRet is libvirt's remote_auth_polkit_ret +type AuthPolkitRet struct { + Complete int32 +} + +// ConnectNumOfStoragePoolsRet is libvirt's remote_connect_num_of_storage_pools_ret +type ConnectNumOfStoragePoolsRet struct { + Num int32 +} + +// ConnectListStoragePoolsArgs is libvirt's remote_connect_list_storage_pools_args +type ConnectListStoragePoolsArgs struct { + Maxnames int32 +} + +// ConnectListStoragePoolsRet is libvirt's remote_connect_list_storage_pools_ret +type ConnectListStoragePoolsRet struct { + Names []string +} + +// ConnectNumOfDefinedStoragePoolsRet is libvirt's remote_connect_num_of_defined_storage_pools_ret +type ConnectNumOfDefinedStoragePoolsRet struct { + Num int32 +} + +// ConnectListDefinedStoragePoolsArgs is libvirt's remote_connect_list_defined_storage_pools_args +type ConnectListDefinedStoragePoolsArgs struct { + Maxnames int32 +} + +// ConnectListDefinedStoragePoolsRet is libvirt's remote_connect_list_defined_storage_pools_ret +type ConnectListDefinedStoragePoolsRet struct { + Names []string +} + +// ConnectFindStoragePoolSourcesArgs is libvirt's remote_connect_find_storage_pool_sources_args +type ConnectFindStoragePoolSourcesArgs struct { + Type string + SrcSpec OptString + Flags uint32 +} + +// ConnectFindStoragePoolSourcesRet is libvirt's remote_connect_find_storage_pool_sources_ret +type ConnectFindStoragePoolSourcesRet struct { + XML string +} + +// StoragePoolLookupByUUIDArgs is libvirt's remote_storage_pool_lookup_by_uuid_args +type StoragePoolLookupByUUIDArgs struct { + UUID UUID +} + +// StoragePoolLookupByUUIDRet is libvirt's remote_storage_pool_lookup_by_uuid_ret +type StoragePoolLookupByUUIDRet struct { + Pool StoragePool +} + +// StoragePoolLookupByNameArgs is libvirt's remote_storage_pool_lookup_by_name_args +type StoragePoolLookupByNameArgs struct { + Name string +} + +// StoragePoolLookupByNameRet is libvirt's remote_storage_pool_lookup_by_name_ret +type StoragePoolLookupByNameRet struct { + Pool StoragePool +} + +// StoragePoolLookupByVolumeArgs is libvirt's remote_storage_pool_lookup_by_volume_args +type StoragePoolLookupByVolumeArgs struct { + Vol StorageVol +} + +// StoragePoolLookupByVolumeRet is libvirt's remote_storage_pool_lookup_by_volume_ret +type StoragePoolLookupByVolumeRet struct { + Pool StoragePool +} + +// StoragePoolLookupByTargetPathArgs is libvirt's remote_storage_pool_lookup_by_target_path_args +type StoragePoolLookupByTargetPathArgs struct { + Path string +} + +// StoragePoolLookupByTargetPathRet is libvirt's remote_storage_pool_lookup_by_target_path_ret +type StoragePoolLookupByTargetPathRet struct { + Pool StoragePool +} + +// StoragePoolCreateXMLArgs is libvirt's remote_storage_pool_create_xml_args +type StoragePoolCreateXMLArgs struct { + XML string + Flags StoragePoolCreateFlags +} + +// StoragePoolCreateXMLRet is libvirt's remote_storage_pool_create_xml_ret +type StoragePoolCreateXMLRet struct { + Pool StoragePool +} + +// StoragePoolDefineXMLArgs is libvirt's remote_storage_pool_define_xml_args +type StoragePoolDefineXMLArgs struct { + XML string + Flags uint32 +} + +// StoragePoolDefineXMLRet is libvirt's remote_storage_pool_define_xml_ret +type StoragePoolDefineXMLRet struct { + Pool StoragePool +} + +// StoragePoolBuildArgs is libvirt's remote_storage_pool_build_args +type StoragePoolBuildArgs struct { + Pool StoragePool + Flags StoragePoolBuildFlags +} + +// StoragePoolUndefineArgs is libvirt's remote_storage_pool_undefine_args +type StoragePoolUndefineArgs struct { + Pool StoragePool +} + +// StoragePoolCreateArgs is libvirt's remote_storage_pool_create_args +type StoragePoolCreateArgs struct { + Pool StoragePool + Flags StoragePoolCreateFlags +} + +// StoragePoolDestroyArgs is libvirt's remote_storage_pool_destroy_args +type StoragePoolDestroyArgs struct { + Pool StoragePool +} + +// StoragePoolDeleteArgs is libvirt's remote_storage_pool_delete_args +type StoragePoolDeleteArgs struct { + Pool StoragePool + Flags StoragePoolDeleteFlags +} + +// StoragePoolRefreshArgs is libvirt's remote_storage_pool_refresh_args +type StoragePoolRefreshArgs struct { + Pool StoragePool + Flags uint32 +} + +// StoragePoolGetXMLDescArgs is libvirt's remote_storage_pool_get_xml_desc_args +type StoragePoolGetXMLDescArgs struct { + Pool StoragePool + Flags StorageXMLFlags +} + +// StoragePoolGetXMLDescRet is libvirt's remote_storage_pool_get_xml_desc_ret +type StoragePoolGetXMLDescRet struct { + XML string +} + +// StoragePoolGetInfoArgs is libvirt's remote_storage_pool_get_info_args +type StoragePoolGetInfoArgs struct { + Pool StoragePool +} + +// StoragePoolGetInfoRet is libvirt's remote_storage_pool_get_info_ret +type StoragePoolGetInfoRet struct { + State uint8 + Capacity uint64 + Allocation uint64 + Available uint64 +} + +// StoragePoolGetAutostartArgs is libvirt's remote_storage_pool_get_autostart_args +type StoragePoolGetAutostartArgs struct { + Pool StoragePool +} + +// StoragePoolGetAutostartRet is libvirt's remote_storage_pool_get_autostart_ret +type StoragePoolGetAutostartRet struct { + Autostart int32 +} + +// StoragePoolSetAutostartArgs is libvirt's remote_storage_pool_set_autostart_args +type StoragePoolSetAutostartArgs struct { + Pool StoragePool + Autostart int32 +} + +// StoragePoolNumOfVolumesArgs is libvirt's remote_storage_pool_num_of_volumes_args +type StoragePoolNumOfVolumesArgs struct { + Pool StoragePool +} + +// StoragePoolNumOfVolumesRet is libvirt's remote_storage_pool_num_of_volumes_ret +type StoragePoolNumOfVolumesRet struct { + Num int32 +} + +// StoragePoolListVolumesArgs is libvirt's remote_storage_pool_list_volumes_args +type StoragePoolListVolumesArgs struct { + Pool StoragePool + Maxnames int32 +} + +// StoragePoolListVolumesRet is libvirt's remote_storage_pool_list_volumes_ret +type StoragePoolListVolumesRet struct { + Names []string +} + +// StorageVolLookupByNameArgs is libvirt's remote_storage_vol_lookup_by_name_args +type StorageVolLookupByNameArgs struct { + Pool StoragePool + Name string +} + +// StorageVolLookupByNameRet is libvirt's remote_storage_vol_lookup_by_name_ret +type StorageVolLookupByNameRet struct { + Vol StorageVol +} + +// StorageVolLookupByKeyArgs is libvirt's remote_storage_vol_lookup_by_key_args +type StorageVolLookupByKeyArgs struct { + Key string +} + +// StorageVolLookupByKeyRet is libvirt's remote_storage_vol_lookup_by_key_ret +type StorageVolLookupByKeyRet struct { + Vol StorageVol +} + +// StorageVolLookupByPathArgs is libvirt's remote_storage_vol_lookup_by_path_args +type StorageVolLookupByPathArgs struct { + Path string +} + +// StorageVolLookupByPathRet is libvirt's remote_storage_vol_lookup_by_path_ret +type StorageVolLookupByPathRet struct { + Vol StorageVol +} + +// StorageVolCreateXMLArgs is libvirt's remote_storage_vol_create_xml_args +type StorageVolCreateXMLArgs struct { + Pool StoragePool + XML string + Flags StorageVolCreateFlags +} + +// StorageVolCreateXMLRet is libvirt's remote_storage_vol_create_xml_ret +type StorageVolCreateXMLRet struct { + Vol StorageVol +} + +// StorageVolCreateXMLFromArgs is libvirt's remote_storage_vol_create_xml_from_args +type StorageVolCreateXMLFromArgs struct { + Pool StoragePool + XML string + Clonevol StorageVol + Flags StorageVolCreateFlags +} + +// StorageVolCreateXMLFromRet is libvirt's remote_storage_vol_create_xml_from_ret +type StorageVolCreateXMLFromRet struct { + Vol StorageVol +} + +// StorageVolDeleteArgs is libvirt's remote_storage_vol_delete_args +type StorageVolDeleteArgs struct { + Vol StorageVol + Flags StorageVolDeleteFlags +} + +// StorageVolWipeArgs is libvirt's remote_storage_vol_wipe_args +type StorageVolWipeArgs struct { + Vol StorageVol + Flags uint32 +} + +// StorageVolWipePatternArgs is libvirt's remote_storage_vol_wipe_pattern_args +type StorageVolWipePatternArgs struct { + Vol StorageVol + Algorithm uint32 + Flags uint32 +} + +// StorageVolGetXMLDescArgs is libvirt's remote_storage_vol_get_xml_desc_args +type StorageVolGetXMLDescArgs struct { + Vol StorageVol + Flags uint32 +} + +// StorageVolGetXMLDescRet is libvirt's remote_storage_vol_get_xml_desc_ret +type StorageVolGetXMLDescRet struct { + XML string +} + +// StorageVolGetInfoArgs is libvirt's remote_storage_vol_get_info_args +type StorageVolGetInfoArgs struct { + Vol StorageVol +} + +// StorageVolGetInfoRet is libvirt's remote_storage_vol_get_info_ret +type StorageVolGetInfoRet struct { + Type int8 + Capacity uint64 + Allocation uint64 +} + +// StorageVolGetInfoFlagsArgs is libvirt's remote_storage_vol_get_info_flags_args +type StorageVolGetInfoFlagsArgs struct { + Vol StorageVol + Flags uint32 +} + +// StorageVolGetInfoFlagsRet is libvirt's remote_storage_vol_get_info_flags_ret +type StorageVolGetInfoFlagsRet struct { + Type int8 + Capacity uint64 + Allocation uint64 +} + +// StorageVolGetPathArgs is libvirt's remote_storage_vol_get_path_args +type StorageVolGetPathArgs struct { + Vol StorageVol +} + +// StorageVolGetPathRet is libvirt's remote_storage_vol_get_path_ret +type StorageVolGetPathRet struct { + Name string +} + +// StorageVolResizeArgs is libvirt's remote_storage_vol_resize_args +type StorageVolResizeArgs struct { + Vol StorageVol + Capacity uint64 + Flags StorageVolResizeFlags +} + +// NodeNumOfDevicesArgs is libvirt's remote_node_num_of_devices_args +type NodeNumOfDevicesArgs struct { + Cap OptString + Flags uint32 +} + +// NodeNumOfDevicesRet is libvirt's remote_node_num_of_devices_ret +type NodeNumOfDevicesRet struct { + Num int32 +} + +// NodeListDevicesArgs is libvirt's remote_node_list_devices_args +type NodeListDevicesArgs struct { + Cap OptString + Maxnames int32 + Flags uint32 +} + +// NodeListDevicesRet is libvirt's remote_node_list_devices_ret +type NodeListDevicesRet struct { + Names []string +} + +// NodeDeviceLookupByNameArgs is libvirt's remote_node_device_lookup_by_name_args +type NodeDeviceLookupByNameArgs struct { + Name string +} + +// NodeDeviceLookupByNameRet is libvirt's remote_node_device_lookup_by_name_ret +type NodeDeviceLookupByNameRet struct { + Dev NodeDevice +} + +// NodeDeviceLookupScsiHostByWwnArgs is libvirt's remote_node_device_lookup_scsi_host_by_wwn_args +type NodeDeviceLookupScsiHostByWwnArgs struct { + Wwnn string + Wwpn string + Flags uint32 +} + +// NodeDeviceLookupScsiHostByWwnRet is libvirt's remote_node_device_lookup_scsi_host_by_wwn_ret +type NodeDeviceLookupScsiHostByWwnRet struct { + Dev NodeDevice +} + +// NodeDeviceGetXMLDescArgs is libvirt's remote_node_device_get_xml_desc_args +type NodeDeviceGetXMLDescArgs struct { + Name string + Flags uint32 +} + +// NodeDeviceGetXMLDescRet is libvirt's remote_node_device_get_xml_desc_ret +type NodeDeviceGetXMLDescRet struct { + XML string +} + +// NodeDeviceGetParentArgs is libvirt's remote_node_device_get_parent_args +type NodeDeviceGetParentArgs struct { + Name string +} + +// NodeDeviceGetParentRet is libvirt's remote_node_device_get_parent_ret +type NodeDeviceGetParentRet struct { + ParentName OptString +} + +// NodeDeviceNumOfCapsArgs is libvirt's remote_node_device_num_of_caps_args +type NodeDeviceNumOfCapsArgs struct { + Name string +} + +// NodeDeviceNumOfCapsRet is libvirt's remote_node_device_num_of_caps_ret +type NodeDeviceNumOfCapsRet struct { + Num int32 +} + +// NodeDeviceListCapsArgs is libvirt's remote_node_device_list_caps_args +type NodeDeviceListCapsArgs struct { + Name string + Maxnames int32 +} + +// NodeDeviceListCapsRet is libvirt's remote_node_device_list_caps_ret +type NodeDeviceListCapsRet struct { + Names []string +} + +// NodeDeviceDettachArgs is libvirt's remote_node_device_dettach_args +type NodeDeviceDettachArgs struct { + Name string +} + +// NodeDeviceDetachFlagsArgs is libvirt's remote_node_device_detach_flags_args +type NodeDeviceDetachFlagsArgs struct { + Name string + DriverName OptString + Flags uint32 +} + +// NodeDeviceReAttachArgs is libvirt's remote_node_device_re_attach_args +type NodeDeviceReAttachArgs struct { + Name string +} + +// NodeDeviceResetArgs is libvirt's remote_node_device_reset_args +type NodeDeviceResetArgs struct { + Name string +} + +// NodeDeviceCreateXMLArgs is libvirt's remote_node_device_create_xml_args +type NodeDeviceCreateXMLArgs struct { + XMLDesc string + Flags uint32 +} + +// NodeDeviceCreateXMLRet is libvirt's remote_node_device_create_xml_ret +type NodeDeviceCreateXMLRet struct { + Dev NodeDevice +} + +// NodeDeviceDestroyArgs is libvirt's remote_node_device_destroy_args +type NodeDeviceDestroyArgs struct { + Name string +} + +// ConnectDomainEventRegisterRet is libvirt's remote_connect_domain_event_register_ret +type ConnectDomainEventRegisterRet struct { + CbRegistered int32 +} + +// ConnectDomainEventDeregisterRet is libvirt's remote_connect_domain_event_deregister_ret +type ConnectDomainEventDeregisterRet struct { + CbRegistered int32 +} + +// DomainEventLifecycleMsg is libvirt's remote_domain_event_lifecycle_msg +type DomainEventLifecycleMsg struct { + Dom Domain + Event int32 + Detail int32 +} + +// DomainEventCallbackLifecycleMsg is libvirt's remote_domain_event_callback_lifecycle_msg +type DomainEventCallbackLifecycleMsg struct { + CallbackID int32 + Msg DomainEventLifecycleMsg +} + +// ConnectDomainXMLFromNativeArgs is libvirt's remote_connect_domain_xml_from_native_args +type ConnectDomainXMLFromNativeArgs struct { + NativeFormat string + NativeConfig string + Flags uint32 +} + +// ConnectDomainXMLFromNativeRet is libvirt's remote_connect_domain_xml_from_native_ret +type ConnectDomainXMLFromNativeRet struct { + DomainXML string +} + +// ConnectDomainXMLToNativeArgs is libvirt's remote_connect_domain_xml_to_native_args +type ConnectDomainXMLToNativeArgs struct { + NativeFormat string + DomainXML string + Flags uint32 +} + +// ConnectDomainXMLToNativeRet is libvirt's remote_connect_domain_xml_to_native_ret +type ConnectDomainXMLToNativeRet struct { + NativeConfig string +} + +// ConnectNumOfSecretsRet is libvirt's remote_connect_num_of_secrets_ret +type ConnectNumOfSecretsRet struct { + Num int32 +} + +// ConnectListSecretsArgs is libvirt's remote_connect_list_secrets_args +type ConnectListSecretsArgs struct { + Maxuuids int32 +} + +// ConnectListSecretsRet is libvirt's remote_connect_list_secrets_ret +type ConnectListSecretsRet struct { + Uuids []string +} + +// SecretLookupByUUIDArgs is libvirt's remote_secret_lookup_by_uuid_args +type SecretLookupByUUIDArgs struct { + UUID UUID +} + +// SecretLookupByUUIDRet is libvirt's remote_secret_lookup_by_uuid_ret +type SecretLookupByUUIDRet struct { + OptSecret Secret +} + +// SecretDefineXMLArgs is libvirt's remote_secret_define_xml_args +type SecretDefineXMLArgs struct { + XML string + Flags uint32 +} + +// SecretDefineXMLRet is libvirt's remote_secret_define_xml_ret +type SecretDefineXMLRet struct { + OptSecret Secret +} + +// SecretGetXMLDescArgs is libvirt's remote_secret_get_xml_desc_args +type SecretGetXMLDescArgs struct { + OptSecret Secret + Flags uint32 +} + +// SecretGetXMLDescRet is libvirt's remote_secret_get_xml_desc_ret +type SecretGetXMLDescRet struct { + XML string +} + +// SecretSetValueArgs is libvirt's remote_secret_set_value_args +type SecretSetValueArgs struct { + OptSecret Secret + Value []byte + Flags uint32 +} + +// SecretGetValueArgs is libvirt's remote_secret_get_value_args +type SecretGetValueArgs struct { + OptSecret Secret + Flags uint32 +} + +// SecretGetValueRet is libvirt's remote_secret_get_value_ret +type SecretGetValueRet struct { + Value []byte +} + +// SecretUndefineArgs is libvirt's remote_secret_undefine_args +type SecretUndefineArgs struct { + OptSecret Secret +} + +// SecretLookupByUsageArgs is libvirt's remote_secret_lookup_by_usage_args +type SecretLookupByUsageArgs struct { + UsageType int32 + UsageID string +} + +// SecretLookupByUsageRet is libvirt's remote_secret_lookup_by_usage_ret +type SecretLookupByUsageRet struct { + OptSecret Secret +} + +// DomainMigratePrepareTunnelArgs is libvirt's remote_domain_migrate_prepare_tunnel_args +type DomainMigratePrepareTunnelArgs struct { + Flags uint64 + Dname OptString + Resource uint64 + DomXML string +} + +// ConnectIsSecureRet is libvirt's remote_connect_is_secure_ret +type ConnectIsSecureRet struct { + Secure int32 +} + +// DomainIsActiveArgs is libvirt's remote_domain_is_active_args +type DomainIsActiveArgs struct { + Dom Domain +} + +// DomainIsActiveRet is libvirt's remote_domain_is_active_ret +type DomainIsActiveRet struct { + Active int32 +} + +// DomainIsPersistentArgs is libvirt's remote_domain_is_persistent_args +type DomainIsPersistentArgs struct { + Dom Domain +} + +// DomainIsPersistentRet is libvirt's remote_domain_is_persistent_ret +type DomainIsPersistentRet struct { + Persistent int32 +} + +// DomainIsUpdatedArgs is libvirt's remote_domain_is_updated_args +type DomainIsUpdatedArgs struct { + Dom Domain +} + +// DomainIsUpdatedRet is libvirt's remote_domain_is_updated_ret +type DomainIsUpdatedRet struct { + Updated int32 +} + +// NetworkIsActiveArgs is libvirt's remote_network_is_active_args +type NetworkIsActiveArgs struct { + Net Network +} + +// NetworkIsActiveRet is libvirt's remote_network_is_active_ret +type NetworkIsActiveRet struct { + Active int32 +} + +// NetworkIsPersistentArgs is libvirt's remote_network_is_persistent_args +type NetworkIsPersistentArgs struct { + Net Network +} + +// NetworkIsPersistentRet is libvirt's remote_network_is_persistent_ret +type NetworkIsPersistentRet struct { + Persistent int32 +} + +// StoragePoolIsActiveArgs is libvirt's remote_storage_pool_is_active_args +type StoragePoolIsActiveArgs struct { + Pool StoragePool +} + +// StoragePoolIsActiveRet is libvirt's remote_storage_pool_is_active_ret +type StoragePoolIsActiveRet struct { + Active int32 +} + +// StoragePoolIsPersistentArgs is libvirt's remote_storage_pool_is_persistent_args +type StoragePoolIsPersistentArgs struct { + Pool StoragePool +} + +// StoragePoolIsPersistentRet is libvirt's remote_storage_pool_is_persistent_ret +type StoragePoolIsPersistentRet struct { + Persistent int32 +} + +// InterfaceIsActiveArgs is libvirt's remote_interface_is_active_args +type InterfaceIsActiveArgs struct { + Iface Interface +} + +// InterfaceIsActiveRet is libvirt's remote_interface_is_active_ret +type InterfaceIsActiveRet struct { + Active int32 +} + +// ConnectCompareCPUArgs is libvirt's remote_connect_compare_cpu_args +type ConnectCompareCPUArgs struct { + XML string + Flags ConnectCompareCPUFlags +} + +// ConnectCompareCPURet is libvirt's remote_connect_compare_cpu_ret +type ConnectCompareCPURet struct { + Result int32 +} + +// ConnectBaselineCPUArgs is libvirt's remote_connect_baseline_cpu_args +type ConnectBaselineCPUArgs struct { + XMLCPUs []string + Flags ConnectBaselineCPUFlags +} + +// ConnectBaselineCPURet is libvirt's remote_connect_baseline_cpu_ret +type ConnectBaselineCPURet struct { + CPU string +} + +// DomainGetJobInfoArgs is libvirt's remote_domain_get_job_info_args +type DomainGetJobInfoArgs struct { + Dom Domain +} + +// DomainGetJobInfoRet is libvirt's remote_domain_get_job_info_ret +type DomainGetJobInfoRet struct { + Type int32 + TimeElapsed uint64 + TimeRemaining uint64 + DataTotal uint64 + DataProcessed uint64 + DataRemaining uint64 + MemTotal uint64 + MemProcessed uint64 + MemRemaining uint64 + FileTotal uint64 + FileProcessed uint64 + FileRemaining uint64 +} + +// DomainGetJobStatsArgs is libvirt's remote_domain_get_job_stats_args +type DomainGetJobStatsArgs struct { + Dom Domain + Flags DomainGetJobStatsFlags +} + +// DomainGetJobStatsRet is libvirt's remote_domain_get_job_stats_ret +type DomainGetJobStatsRet struct { + Type int32 + Params []TypedParam +} + +// DomainAbortJobArgs is libvirt's remote_domain_abort_job_args +type DomainAbortJobArgs struct { + Dom Domain +} + +// DomainMigrateGetMaxDowntimeArgs is libvirt's remote_domain_migrate_get_max_downtime_args +type DomainMigrateGetMaxDowntimeArgs struct { + Dom Domain + Flags uint32 +} + +// DomainMigrateGetMaxDowntimeRet is libvirt's remote_domain_migrate_get_max_downtime_ret +type DomainMigrateGetMaxDowntimeRet struct { + Downtime uint64 +} + +// DomainMigrateSetMaxDowntimeArgs is libvirt's remote_domain_migrate_set_max_downtime_args +type DomainMigrateSetMaxDowntimeArgs struct { + Dom Domain + Downtime uint64 + Flags uint32 +} + +// DomainMigrateGetCompressionCacheArgs is libvirt's remote_domain_migrate_get_compression_cache_args +type DomainMigrateGetCompressionCacheArgs struct { + Dom Domain + Flags uint32 +} + +// DomainMigrateGetCompressionCacheRet is libvirt's remote_domain_migrate_get_compression_cache_ret +type DomainMigrateGetCompressionCacheRet struct { + CacheSize uint64 +} + +// DomainMigrateSetCompressionCacheArgs is libvirt's remote_domain_migrate_set_compression_cache_args +type DomainMigrateSetCompressionCacheArgs struct { + Dom Domain + CacheSize uint64 + Flags uint32 +} + +// DomainMigrateSetMaxSpeedArgs is libvirt's remote_domain_migrate_set_max_speed_args +type DomainMigrateSetMaxSpeedArgs struct { + Dom Domain + Bandwidth uint64 + Flags uint32 +} + +// DomainMigrateGetMaxSpeedArgs is libvirt's remote_domain_migrate_get_max_speed_args +type DomainMigrateGetMaxSpeedArgs struct { + Dom Domain + Flags uint32 +} + +// DomainMigrateGetMaxSpeedRet is libvirt's remote_domain_migrate_get_max_speed_ret +type DomainMigrateGetMaxSpeedRet struct { + Bandwidth uint64 +} + +// ConnectDomainEventRegisterAnyArgs is libvirt's remote_connect_domain_event_register_any_args +type ConnectDomainEventRegisterAnyArgs struct { + EventID int32 +} + +// ConnectDomainEventDeregisterAnyArgs is libvirt's remote_connect_domain_event_deregister_any_args +type ConnectDomainEventDeregisterAnyArgs struct { + EventID int32 +} + +// ConnectDomainEventCallbackRegisterAnyArgs is libvirt's remote_connect_domain_event_callback_register_any_args +type ConnectDomainEventCallbackRegisterAnyArgs struct { + EventID int32 + Dom OptDomain +} + +// ConnectDomainEventCallbackRegisterAnyRet is libvirt's remote_connect_domain_event_callback_register_any_ret +type ConnectDomainEventCallbackRegisterAnyRet struct { + CallbackID int32 +} + +// ConnectDomainEventCallbackDeregisterAnyArgs is libvirt's remote_connect_domain_event_callback_deregister_any_args +type ConnectDomainEventCallbackDeregisterAnyArgs struct { + CallbackID int32 +} + +// DomainEventRebootMsg is libvirt's remote_domain_event_reboot_msg +type DomainEventRebootMsg struct { + Dom Domain +} + +// DomainEventCallbackRebootMsg is libvirt's remote_domain_event_callback_reboot_msg +type DomainEventCallbackRebootMsg struct { + CallbackID int32 + Msg DomainEventRebootMsg +} + +// DomainEventRtcChangeMsg is libvirt's remote_domain_event_rtc_change_msg +type DomainEventRtcChangeMsg struct { + Dom Domain + Offset int64 +} + +// DomainEventCallbackRtcChangeMsg is libvirt's remote_domain_event_callback_rtc_change_msg +type DomainEventCallbackRtcChangeMsg struct { + CallbackID int32 + Msg DomainEventRtcChangeMsg +} + +// DomainEventWatchdogMsg is libvirt's remote_domain_event_watchdog_msg +type DomainEventWatchdogMsg struct { + Dom Domain + Action int32 +} + +// DomainEventCallbackWatchdogMsg is libvirt's remote_domain_event_callback_watchdog_msg +type DomainEventCallbackWatchdogMsg struct { + CallbackID int32 + Msg DomainEventWatchdogMsg +} + +// DomainEventIOErrorMsg is libvirt's remote_domain_event_io_error_msg +type DomainEventIOErrorMsg struct { + Dom Domain + SrcPath string + DevAlias string + Action int32 +} + +// DomainEventCallbackIOErrorMsg is libvirt's remote_domain_event_callback_io_error_msg +type DomainEventCallbackIOErrorMsg struct { + CallbackID int32 + Msg DomainEventIOErrorMsg +} + +// DomainEventIOErrorReasonMsg is libvirt's remote_domain_event_io_error_reason_msg +type DomainEventIOErrorReasonMsg struct { + Dom Domain + SrcPath string + DevAlias string + Action int32 + Reason string +} + +// DomainEventCallbackIOErrorReasonMsg is libvirt's remote_domain_event_callback_io_error_reason_msg +type DomainEventCallbackIOErrorReasonMsg struct { + CallbackID int32 + Msg DomainEventIOErrorReasonMsg +} + +// DomainEventGraphicsAddress is libvirt's remote_domain_event_graphics_address +type DomainEventGraphicsAddress struct { + Family int32 + Node string + Service string +} + +// DomainEventGraphicsIdentity is libvirt's remote_domain_event_graphics_identity +type DomainEventGraphicsIdentity struct { + Type string + Name string +} + +// DomainEventGraphicsMsg is libvirt's remote_domain_event_graphics_msg +type DomainEventGraphicsMsg struct { + Dom Domain + Phase int32 + Local DomainEventGraphicsAddress + Remote DomainEventGraphicsAddress + AuthScheme string + Subject []DomainEventGraphicsIdentity +} + +// DomainEventCallbackGraphicsMsg is libvirt's remote_domain_event_callback_graphics_msg +type DomainEventCallbackGraphicsMsg struct { + CallbackID int32 + Msg DomainEventGraphicsMsg +} + +// DomainEventBlockJobMsg is libvirt's remote_domain_event_block_job_msg +type DomainEventBlockJobMsg struct { + Dom Domain + Path string + Type int32 + Status int32 +} + +// DomainEventCallbackBlockJobMsg is libvirt's remote_domain_event_callback_block_job_msg +type DomainEventCallbackBlockJobMsg struct { + CallbackID int32 + Msg DomainEventBlockJobMsg +} + +// DomainEventDiskChangeMsg is libvirt's remote_domain_event_disk_change_msg +type DomainEventDiskChangeMsg struct { + Dom Domain + OldSrcPath OptString + NewSrcPath OptString + DevAlias string + Reason int32 +} + +// DomainEventCallbackDiskChangeMsg is libvirt's remote_domain_event_callback_disk_change_msg +type DomainEventCallbackDiskChangeMsg struct { + CallbackID int32 + Msg DomainEventDiskChangeMsg +} + +// DomainEventTrayChangeMsg is libvirt's remote_domain_event_tray_change_msg +type DomainEventTrayChangeMsg struct { + Dom Domain + DevAlias string + Reason int32 +} + +// DomainEventCallbackTrayChangeMsg is libvirt's remote_domain_event_callback_tray_change_msg +type DomainEventCallbackTrayChangeMsg struct { + CallbackID int32 + Msg DomainEventTrayChangeMsg +} + +// DomainEventPmwakeupMsg is libvirt's remote_domain_event_pmwakeup_msg +type DomainEventPmwakeupMsg struct { + Dom Domain +} + +// DomainEventCallbackPmwakeupMsg is libvirt's remote_domain_event_callback_pmwakeup_msg +type DomainEventCallbackPmwakeupMsg struct { + CallbackID int32 + Reason int32 + Msg DomainEventPmwakeupMsg +} + +// DomainEventPmsuspendMsg is libvirt's remote_domain_event_pmsuspend_msg +type DomainEventPmsuspendMsg struct { + Dom Domain +} + +// DomainEventCallbackPmsuspendMsg is libvirt's remote_domain_event_callback_pmsuspend_msg +type DomainEventCallbackPmsuspendMsg struct { + CallbackID int32 + Reason int32 + Msg DomainEventPmsuspendMsg +} + +// DomainEventBalloonChangeMsg is libvirt's remote_domain_event_balloon_change_msg +type DomainEventBalloonChangeMsg struct { + Dom Domain + Actual uint64 +} + +// DomainEventCallbackBalloonChangeMsg is libvirt's remote_domain_event_callback_balloon_change_msg +type DomainEventCallbackBalloonChangeMsg struct { + CallbackID int32 + Msg DomainEventBalloonChangeMsg +} + +// DomainEventPmsuspendDiskMsg is libvirt's remote_domain_event_pmsuspend_disk_msg +type DomainEventPmsuspendDiskMsg struct { + Dom Domain +} + +// DomainEventCallbackPmsuspendDiskMsg is libvirt's remote_domain_event_callback_pmsuspend_disk_msg +type DomainEventCallbackPmsuspendDiskMsg struct { + CallbackID int32 + Reason int32 + Msg DomainEventPmsuspendDiskMsg +} + +// DomainManagedSaveArgs is libvirt's remote_domain_managed_save_args +type DomainManagedSaveArgs struct { + Dom Domain + Flags uint32 +} + +// DomainHasManagedSaveImageArgs is libvirt's remote_domain_has_managed_save_image_args +type DomainHasManagedSaveImageArgs struct { + Dom Domain + Flags uint32 +} + +// DomainHasManagedSaveImageRet is libvirt's remote_domain_has_managed_save_image_ret +type DomainHasManagedSaveImageRet struct { + Result int32 +} + +// DomainManagedSaveRemoveArgs is libvirt's remote_domain_managed_save_remove_args +type DomainManagedSaveRemoveArgs struct { + Dom Domain + Flags uint32 +} + +// DomainManagedSaveGetXMLDescArgs is libvirt's remote_domain_managed_save_get_xml_desc_args +type DomainManagedSaveGetXMLDescArgs struct { + Dom Domain + Flags DomainXMLFlags +} + +// DomainManagedSaveGetXMLDescRet is libvirt's remote_domain_managed_save_get_xml_desc_ret +type DomainManagedSaveGetXMLDescRet struct { + XML string +} + +// DomainManagedSaveDefineXMLArgs is libvirt's remote_domain_managed_save_define_xml_args +type DomainManagedSaveDefineXMLArgs struct { + Dom Domain + Dxml OptString + Flags DomainSaveRestoreFlags +} + +// DomainSnapshotCreateXMLArgs is libvirt's remote_domain_snapshot_create_xml_args +type DomainSnapshotCreateXMLArgs struct { + Dom Domain + XMLDesc string + Flags uint32 +} + +// DomainSnapshotCreateXMLRet is libvirt's remote_domain_snapshot_create_xml_ret +type DomainSnapshotCreateXMLRet struct { + Snap DomainSnapshot +} + +// DomainSnapshotGetXMLDescArgs is libvirt's remote_domain_snapshot_get_xml_desc_args +type DomainSnapshotGetXMLDescArgs struct { + Snap DomainSnapshot + Flags uint32 +} + +// DomainSnapshotGetXMLDescRet is libvirt's remote_domain_snapshot_get_xml_desc_ret +type DomainSnapshotGetXMLDescRet struct { + XML string +} + +// DomainSnapshotNumArgs is libvirt's remote_domain_snapshot_num_args +type DomainSnapshotNumArgs struct { + Dom Domain + Flags uint32 +} + +// DomainSnapshotNumRet is libvirt's remote_domain_snapshot_num_ret +type DomainSnapshotNumRet struct { + Num int32 +} + +// DomainSnapshotListNamesArgs is libvirt's remote_domain_snapshot_list_names_args +type DomainSnapshotListNamesArgs struct { + Dom Domain + Maxnames int32 + Flags uint32 +} + +// DomainSnapshotListNamesRet is libvirt's remote_domain_snapshot_list_names_ret +type DomainSnapshotListNamesRet struct { + Names []string +} + +// DomainListAllSnapshotsArgs is libvirt's remote_domain_list_all_snapshots_args +type DomainListAllSnapshotsArgs struct { + Dom Domain + NeedResults int32 + Flags uint32 +} + +// DomainListAllSnapshotsRet is libvirt's remote_domain_list_all_snapshots_ret +type DomainListAllSnapshotsRet struct { + Snapshots []DomainSnapshot + Ret int32 +} + +// DomainSnapshotNumChildrenArgs is libvirt's remote_domain_snapshot_num_children_args +type DomainSnapshotNumChildrenArgs struct { + Snap DomainSnapshot + Flags uint32 +} + +// DomainSnapshotNumChildrenRet is libvirt's remote_domain_snapshot_num_children_ret +type DomainSnapshotNumChildrenRet struct { + Num int32 +} + +// DomainSnapshotListChildrenNamesArgs is libvirt's remote_domain_snapshot_list_children_names_args +type DomainSnapshotListChildrenNamesArgs struct { + Snap DomainSnapshot + Maxnames int32 + Flags uint32 +} + +// DomainSnapshotListChildrenNamesRet is libvirt's remote_domain_snapshot_list_children_names_ret +type DomainSnapshotListChildrenNamesRet struct { + Names []string +} + +// DomainSnapshotListAllChildrenArgs is libvirt's remote_domain_snapshot_list_all_children_args +type DomainSnapshotListAllChildrenArgs struct { + Snapshot DomainSnapshot + NeedResults int32 + Flags uint32 +} + +// DomainSnapshotListAllChildrenRet is libvirt's remote_domain_snapshot_list_all_children_ret +type DomainSnapshotListAllChildrenRet struct { + Snapshots []DomainSnapshot + Ret int32 +} + +// DomainSnapshotLookupByNameArgs is libvirt's remote_domain_snapshot_lookup_by_name_args +type DomainSnapshotLookupByNameArgs struct { + Dom Domain + Name string + Flags uint32 +} + +// DomainSnapshotLookupByNameRet is libvirt's remote_domain_snapshot_lookup_by_name_ret +type DomainSnapshotLookupByNameRet struct { + Snap DomainSnapshot +} + +// DomainHasCurrentSnapshotArgs is libvirt's remote_domain_has_current_snapshot_args +type DomainHasCurrentSnapshotArgs struct { + Dom Domain + Flags uint32 +} + +// DomainHasCurrentSnapshotRet is libvirt's remote_domain_has_current_snapshot_ret +type DomainHasCurrentSnapshotRet struct { + Result int32 +} + +// DomainSnapshotGetParentArgs is libvirt's remote_domain_snapshot_get_parent_args +type DomainSnapshotGetParentArgs struct { + Snap DomainSnapshot + Flags uint32 +} + +// DomainSnapshotGetParentRet is libvirt's remote_domain_snapshot_get_parent_ret +type DomainSnapshotGetParentRet struct { + Snap DomainSnapshot +} + +// DomainSnapshotCurrentArgs is libvirt's remote_domain_snapshot_current_args +type DomainSnapshotCurrentArgs struct { + Dom Domain + Flags uint32 +} + +// DomainSnapshotCurrentRet is libvirt's remote_domain_snapshot_current_ret +type DomainSnapshotCurrentRet struct { + Snap DomainSnapshot +} + +// DomainSnapshotIsCurrentArgs is libvirt's remote_domain_snapshot_is_current_args +type DomainSnapshotIsCurrentArgs struct { + Snap DomainSnapshot + Flags uint32 +} + +// DomainSnapshotIsCurrentRet is libvirt's remote_domain_snapshot_is_current_ret +type DomainSnapshotIsCurrentRet struct { + Current int32 +} + +// DomainSnapshotHasMetadataArgs is libvirt's remote_domain_snapshot_has_metadata_args +type DomainSnapshotHasMetadataArgs struct { + Snap DomainSnapshot + Flags uint32 +} + +// DomainSnapshotHasMetadataRet is libvirt's remote_domain_snapshot_has_metadata_ret +type DomainSnapshotHasMetadataRet struct { + Metadata int32 +} + +// DomainRevertToSnapshotArgs is libvirt's remote_domain_revert_to_snapshot_args +type DomainRevertToSnapshotArgs struct { + Snap DomainSnapshot + Flags uint32 +} + +// DomainSnapshotDeleteArgs is libvirt's remote_domain_snapshot_delete_args +type DomainSnapshotDeleteArgs struct { + Snap DomainSnapshot + Flags DomainSnapshotDeleteFlags +} + +// DomainOpenConsoleArgs is libvirt's remote_domain_open_console_args +type DomainOpenConsoleArgs struct { + Dom Domain + DevName OptString + Flags uint32 +} + +// DomainOpenChannelArgs is libvirt's remote_domain_open_channel_args +type DomainOpenChannelArgs struct { + Dom Domain + Name OptString + Flags DomainChannelFlags +} + +// StorageVolUploadArgs is libvirt's remote_storage_vol_upload_args +type StorageVolUploadArgs struct { + Vol StorageVol + Offset uint64 + Length uint64 + Flags StorageVolUploadFlags +} + +// StorageVolDownloadArgs is libvirt's remote_storage_vol_download_args +type StorageVolDownloadArgs struct { + Vol StorageVol + Offset uint64 + Length uint64 + Flags StorageVolDownloadFlags +} + +// DomainGetStateArgs is libvirt's remote_domain_get_state_args +type DomainGetStateArgs struct { + Dom Domain + Flags uint32 +} + +// DomainGetStateRet is libvirt's remote_domain_get_state_ret +type DomainGetStateRet struct { + State int32 + Reason int32 +} + +// DomainMigrateBegin3Args is libvirt's remote_domain_migrate_begin3_args +type DomainMigrateBegin3Args struct { + Dom Domain + Xmlin OptString + Flags uint64 + Dname OptString + Resource uint64 +} + +// DomainMigrateBegin3Ret is libvirt's remote_domain_migrate_begin3_ret +type DomainMigrateBegin3Ret struct { + CookieOut []byte + XML string +} + +// DomainMigratePrepare3Args is libvirt's remote_domain_migrate_prepare3_args +type DomainMigratePrepare3Args struct { + CookieIn []byte + UriIn OptString + Flags uint64 + Dname OptString + Resource uint64 + DomXML string +} + +// DomainMigratePrepare3Ret is libvirt's remote_domain_migrate_prepare3_ret +type DomainMigratePrepare3Ret struct { + CookieOut []byte + UriOut OptString +} + +// DomainMigratePrepareTunnel3Args is libvirt's remote_domain_migrate_prepare_tunnel3_args +type DomainMigratePrepareTunnel3Args struct { + CookieIn []byte + Flags uint64 + Dname OptString + Resource uint64 + DomXML string +} + +// DomainMigratePrepareTunnel3Ret is libvirt's remote_domain_migrate_prepare_tunnel3_ret +type DomainMigratePrepareTunnel3Ret struct { + CookieOut []byte +} + +// DomainMigratePerform3Args is libvirt's remote_domain_migrate_perform3_args +type DomainMigratePerform3Args struct { + Dom Domain + Xmlin OptString + CookieIn []byte + Dconnuri OptString + Uri OptString + Flags uint64 + Dname OptString + Resource uint64 +} + +// DomainMigratePerform3Ret is libvirt's remote_domain_migrate_perform3_ret +type DomainMigratePerform3Ret struct { + CookieOut []byte +} + +// DomainMigrateFinish3Args is libvirt's remote_domain_migrate_finish3_args +type DomainMigrateFinish3Args struct { + Dname string + CookieIn []byte + Dconnuri OptString + Uri OptString + Flags uint64 + Cancelled int32 +} + +// DomainMigrateFinish3Ret is libvirt's remote_domain_migrate_finish3_ret +type DomainMigrateFinish3Ret struct { + Dom Domain + CookieOut []byte +} + +// DomainMigrateConfirm3Args is libvirt's remote_domain_migrate_confirm3_args +type DomainMigrateConfirm3Args struct { + Dom Domain + CookieIn []byte + Flags uint64 + Cancelled int32 +} + +// DomainEventControlErrorMsg is libvirt's remote_domain_event_control_error_msg +type DomainEventControlErrorMsg struct { + Dom Domain +} + +// DomainEventCallbackControlErrorMsg is libvirt's remote_domain_event_callback_control_error_msg +type DomainEventCallbackControlErrorMsg struct { + CallbackID int32 + Msg DomainEventControlErrorMsg +} + +// DomainGetControlInfoArgs is libvirt's remote_domain_get_control_info_args +type DomainGetControlInfoArgs struct { + Dom Domain + Flags uint32 +} + +// DomainGetControlInfoRet is libvirt's remote_domain_get_control_info_ret +type DomainGetControlInfoRet struct { + State uint32 + Details uint32 + StateTime uint64 +} + +// DomainOpenGraphicsArgs is libvirt's remote_domain_open_graphics_args +type DomainOpenGraphicsArgs struct { + Dom Domain + Idx uint32 + Flags DomainOpenGraphicsFlags +} + +// DomainOpenGraphicsFdArgs is libvirt's remote_domain_open_graphics_fd_args +type DomainOpenGraphicsFdArgs struct { + Dom Domain + Idx uint32 + Flags DomainOpenGraphicsFlags +} + +// NodeSuspendForDurationArgs is libvirt's remote_node_suspend_for_duration_args +type NodeSuspendForDurationArgs struct { + Target uint32 + Duration uint64 + Flags uint32 +} + +// DomainShutdownFlagsArgs is libvirt's remote_domain_shutdown_flags_args +type DomainShutdownFlagsArgs struct { + Dom Domain + Flags DomainShutdownFlagValues +} + +// DomainGetDiskErrorsArgs is libvirt's remote_domain_get_disk_errors_args +type DomainGetDiskErrorsArgs struct { + Dom Domain + Maxerrors uint32 + Flags uint32 +} + +// DomainGetDiskErrorsRet is libvirt's remote_domain_get_disk_errors_ret +type DomainGetDiskErrorsRet struct { + Errors []DomainDiskError + Nerrors int32 +} + +// ConnectListAllDomainsArgs is libvirt's remote_connect_list_all_domains_args +type ConnectListAllDomainsArgs struct { + NeedResults int32 + Flags ConnectListAllDomainsFlags +} + +// ConnectListAllDomainsRet is libvirt's remote_connect_list_all_domains_ret +type ConnectListAllDomainsRet struct { + Domains []Domain + Ret uint32 +} + +// ConnectListAllStoragePoolsArgs is libvirt's remote_connect_list_all_storage_pools_args +type ConnectListAllStoragePoolsArgs struct { + NeedResults int32 + Flags ConnectListAllStoragePoolsFlags +} + +// ConnectListAllStoragePoolsRet is libvirt's remote_connect_list_all_storage_pools_ret +type ConnectListAllStoragePoolsRet struct { + Pools []StoragePool + Ret uint32 +} + +// StoragePoolListAllVolumesArgs is libvirt's remote_storage_pool_list_all_volumes_args +type StoragePoolListAllVolumesArgs struct { + Pool StoragePool + NeedResults int32 + Flags uint32 +} + +// StoragePoolListAllVolumesRet is libvirt's remote_storage_pool_list_all_volumes_ret +type StoragePoolListAllVolumesRet struct { + Vols []StorageVol + Ret uint32 +} + +// ConnectListAllNetworksArgs is libvirt's remote_connect_list_all_networks_args +type ConnectListAllNetworksArgs struct { + NeedResults int32 + Flags ConnectListAllNetworksFlags +} + +// ConnectListAllNetworksRet is libvirt's remote_connect_list_all_networks_ret +type ConnectListAllNetworksRet struct { + Nets []Network + Ret uint32 +} + +// ConnectListAllInterfacesArgs is libvirt's remote_connect_list_all_interfaces_args +type ConnectListAllInterfacesArgs struct { + NeedResults int32 + Flags ConnectListAllInterfacesFlags +} + +// ConnectListAllInterfacesRet is libvirt's remote_connect_list_all_interfaces_ret +type ConnectListAllInterfacesRet struct { + Ifaces []Interface + Ret uint32 +} + +// ConnectListAllNodeDevicesArgs is libvirt's remote_connect_list_all_node_devices_args +type ConnectListAllNodeDevicesArgs struct { + NeedResults int32 + Flags uint32 +} + +// ConnectListAllNodeDevicesRet is libvirt's remote_connect_list_all_node_devices_ret +type ConnectListAllNodeDevicesRet struct { + Devices []NodeDevice + Ret uint32 +} + +// ConnectListAllNwfiltersArgs is libvirt's remote_connect_list_all_nwfilters_args +type ConnectListAllNwfiltersArgs struct { + NeedResults int32 + Flags uint32 +} + +// ConnectListAllNwfiltersRet is libvirt's remote_connect_list_all_nwfilters_ret +type ConnectListAllNwfiltersRet struct { + Filters []Nwfilter + Ret uint32 +} + +// ConnectListAllSecretsArgs is libvirt's remote_connect_list_all_secrets_args +type ConnectListAllSecretsArgs struct { + NeedResults int32 + Flags ConnectListAllSecretsFlags +} + +// ConnectListAllSecretsRet is libvirt's remote_connect_list_all_secrets_ret +type ConnectListAllSecretsRet struct { + Secrets []Secret + Ret uint32 +} + +// NodeSetMemoryParametersArgs is libvirt's remote_node_set_memory_parameters_args +type NodeSetMemoryParametersArgs struct { + Params []TypedParam + Flags uint32 +} + +// NodeGetMemoryParametersArgs is libvirt's remote_node_get_memory_parameters_args +type NodeGetMemoryParametersArgs struct { + Nparams int32 + Flags uint32 +} + +// NodeGetMemoryParametersRet is libvirt's remote_node_get_memory_parameters_ret +type NodeGetMemoryParametersRet struct { + Params []TypedParam + Nparams int32 +} + +// NodeGetCPUMapArgs is libvirt's remote_node_get_cpu_map_args +type NodeGetCPUMapArgs struct { + NeedMap int32 + NeedOnline int32 + Flags uint32 +} + +// NodeGetCPUMapRet is libvirt's remote_node_get_cpu_map_ret +type NodeGetCPUMapRet struct { + Cpumap []byte + Online uint32 + Ret int32 +} + +// DomainFstrimArgs is libvirt's remote_domain_fstrim_args +type DomainFstrimArgs struct { + Dom Domain + MountPoint OptString + Minimum uint64 + Flags uint32 +} + +// DomainGetTimeArgs is libvirt's remote_domain_get_time_args +type DomainGetTimeArgs struct { + Dom Domain + Flags uint32 +} + +// DomainGetTimeRet is libvirt's remote_domain_get_time_ret +type DomainGetTimeRet struct { + Seconds int64 + Nseconds uint32 +} + +// DomainSetTimeArgs is libvirt's remote_domain_set_time_args +type DomainSetTimeArgs struct { + Dom Domain + Seconds int64 + Nseconds uint32 + Flags DomainSetTimeFlags +} + +// DomainMigrateBegin3ParamsArgs is libvirt's remote_domain_migrate_begin3_params_args +type DomainMigrateBegin3ParamsArgs struct { + Dom Domain + Params []TypedParam + Flags uint32 +} + +// DomainMigrateBegin3ParamsRet is libvirt's remote_domain_migrate_begin3_params_ret +type DomainMigrateBegin3ParamsRet struct { + CookieOut []byte + XML string +} + +// DomainMigratePrepare3ParamsArgs is libvirt's remote_domain_migrate_prepare3_params_args +type DomainMigratePrepare3ParamsArgs struct { + Params []TypedParam + CookieIn []byte + Flags uint32 +} + +// DomainMigratePrepare3ParamsRet is libvirt's remote_domain_migrate_prepare3_params_ret +type DomainMigratePrepare3ParamsRet struct { + CookieOut []byte + UriOut OptString +} + +// DomainMigratePrepareTunnel3ParamsArgs is libvirt's remote_domain_migrate_prepare_tunnel3_params_args +type DomainMigratePrepareTunnel3ParamsArgs struct { + Params []TypedParam + CookieIn []byte + Flags uint32 +} + +// DomainMigratePrepareTunnel3ParamsRet is libvirt's remote_domain_migrate_prepare_tunnel3_params_ret +type DomainMigratePrepareTunnel3ParamsRet struct { + CookieOut []byte +} + +// DomainMigratePerform3ParamsArgs is libvirt's remote_domain_migrate_perform3_params_args +type DomainMigratePerform3ParamsArgs struct { + Dom Domain + Dconnuri OptString + Params []TypedParam + CookieIn []byte + Flags DomainMigrateFlags +} + +// DomainMigratePerform3ParamsRet is libvirt's remote_domain_migrate_perform3_params_ret +type DomainMigratePerform3ParamsRet struct { + CookieOut []byte +} + +// DomainMigrateFinish3ParamsArgs is libvirt's remote_domain_migrate_finish3_params_args +type DomainMigrateFinish3ParamsArgs struct { + Params []TypedParam + CookieIn []byte + Flags uint32 + Cancelled int32 +} + +// DomainMigrateFinish3ParamsRet is libvirt's remote_domain_migrate_finish3_params_ret +type DomainMigrateFinish3ParamsRet struct { + Dom Domain + CookieOut []byte +} + +// DomainMigrateConfirm3ParamsArgs is libvirt's remote_domain_migrate_confirm3_params_args +type DomainMigrateConfirm3ParamsArgs struct { + Dom Domain + Params []TypedParam + CookieIn []byte + Flags uint32 + Cancelled int32 +} + +// DomainEventDeviceRemovedMsg is libvirt's remote_domain_event_device_removed_msg +type DomainEventDeviceRemovedMsg struct { + Dom Domain + DevAlias string +} + +// DomainEventCallbackDeviceRemovedMsg is libvirt's remote_domain_event_callback_device_removed_msg +type DomainEventCallbackDeviceRemovedMsg struct { + CallbackID int32 + Msg DomainEventDeviceRemovedMsg +} + +// DomainEventBlockJob2Msg is libvirt's remote_domain_event_block_job_2_msg +type DomainEventBlockJob2Msg struct { + CallbackID int32 + Dom Domain + Dst string + Type int32 + Status int32 +} + +// DomainEventBlockThresholdMsg is libvirt's remote_domain_event_block_threshold_msg +type DomainEventBlockThresholdMsg struct { + CallbackID int32 + Dom Domain + Dev string + Path OptString + Threshold uint64 + Excess uint64 +} + +// DomainEventCallbackTunableMsg is libvirt's remote_domain_event_callback_tunable_msg +type DomainEventCallbackTunableMsg struct { + CallbackID int32 + Dom Domain + Params []TypedParam +} + +// DomainEventCallbackDeviceAddedMsg is libvirt's remote_domain_event_callback_device_added_msg +type DomainEventCallbackDeviceAddedMsg struct { + CallbackID int32 + Dom Domain + DevAlias string +} + +// ConnectEventConnectionClosedMsg is libvirt's remote_connect_event_connection_closed_msg +type ConnectEventConnectionClosedMsg struct { + Reason int32 +} + +// ConnectGetCPUModelNamesArgs is libvirt's remote_connect_get_cpu_model_names_args +type ConnectGetCPUModelNamesArgs struct { + Arch string + NeedResults int32 + Flags uint32 +} + +// ConnectGetCPUModelNamesRet is libvirt's remote_connect_get_cpu_model_names_ret +type ConnectGetCPUModelNamesRet struct { + Models []string + Ret int32 +} + +// ConnectNetworkEventRegisterAnyArgs is libvirt's remote_connect_network_event_register_any_args +type ConnectNetworkEventRegisterAnyArgs struct { + EventID int32 + Net OptNetwork +} + +// ConnectNetworkEventRegisterAnyRet is libvirt's remote_connect_network_event_register_any_ret +type ConnectNetworkEventRegisterAnyRet struct { + CallbackID int32 +} + +// ConnectNetworkEventDeregisterAnyArgs is libvirt's remote_connect_network_event_deregister_any_args +type ConnectNetworkEventDeregisterAnyArgs struct { + CallbackID int32 +} + +// NetworkEventLifecycleMsg is libvirt's remote_network_event_lifecycle_msg +type NetworkEventLifecycleMsg struct { + CallbackID int32 + Net Network + Event int32 + Detail int32 +} + +// ConnectStoragePoolEventRegisterAnyArgs is libvirt's remote_connect_storage_pool_event_register_any_args +type ConnectStoragePoolEventRegisterAnyArgs struct { + EventID int32 + Pool OptStoragePool +} + +// ConnectStoragePoolEventRegisterAnyRet is libvirt's remote_connect_storage_pool_event_register_any_ret +type ConnectStoragePoolEventRegisterAnyRet struct { + CallbackID int32 +} + +// ConnectStoragePoolEventDeregisterAnyArgs is libvirt's remote_connect_storage_pool_event_deregister_any_args +type ConnectStoragePoolEventDeregisterAnyArgs struct { + CallbackID int32 +} + +// StoragePoolEventLifecycleMsg is libvirt's remote_storage_pool_event_lifecycle_msg +type StoragePoolEventLifecycleMsg struct { + CallbackID int32 + Pool StoragePool + Event int32 + Detail int32 +} + +// StoragePoolEventRefreshMsg is libvirt's remote_storage_pool_event_refresh_msg +type StoragePoolEventRefreshMsg struct { + CallbackID int32 + Pool StoragePool +} + +// ConnectNodeDeviceEventRegisterAnyArgs is libvirt's remote_connect_node_device_event_register_any_args +type ConnectNodeDeviceEventRegisterAnyArgs struct { + EventID int32 + Dev OptNodeDevice +} + +// ConnectNodeDeviceEventRegisterAnyRet is libvirt's remote_connect_node_device_event_register_any_ret +type ConnectNodeDeviceEventRegisterAnyRet struct { + CallbackID int32 +} + +// ConnectNodeDeviceEventDeregisterAnyArgs is libvirt's remote_connect_node_device_event_deregister_any_args +type ConnectNodeDeviceEventDeregisterAnyArgs struct { + CallbackID int32 +} + +// NodeDeviceEventLifecycleMsg is libvirt's remote_node_device_event_lifecycle_msg +type NodeDeviceEventLifecycleMsg struct { + CallbackID int32 + Dev NodeDevice + Event int32 + Detail int32 +} + +// NodeDeviceEventUpdateMsg is libvirt's remote_node_device_event_update_msg +type NodeDeviceEventUpdateMsg struct { + CallbackID int32 + Dev NodeDevice +} + +// DomainFsfreezeArgs is libvirt's remote_domain_fsfreeze_args +type DomainFsfreezeArgs struct { + Dom Domain + Mountpoints []string + Flags uint32 +} + +// DomainFsfreezeRet is libvirt's remote_domain_fsfreeze_ret +type DomainFsfreezeRet struct { + Filesystems int32 +} + +// DomainFsthawArgs is libvirt's remote_domain_fsthaw_args +type DomainFsthawArgs struct { + Dom Domain + Mountpoints []string + Flags uint32 +} + +// DomainFsthawRet is libvirt's remote_domain_fsthaw_ret +type DomainFsthawRet struct { + Filesystems int32 +} + +// NodeGetFreePagesArgs is libvirt's remote_node_get_free_pages_args +type NodeGetFreePagesArgs struct { + Pages []uint32 + StartCell int32 + CellCount uint32 + Flags uint32 +} + +// NodeGetFreePagesRet is libvirt's remote_node_get_free_pages_ret +type NodeGetFreePagesRet struct { + Counts []uint64 +} + +// NodeAllocPagesArgs is libvirt's remote_node_alloc_pages_args +type NodeAllocPagesArgs struct { + PageSizes []uint32 + PageCounts []uint64 + StartCell int32 + CellCount uint32 + Flags NodeAllocPagesFlags +} + +// NodeAllocPagesRet is libvirt's remote_node_alloc_pages_ret +type NodeAllocPagesRet struct { + Ret int32 +} + +// NetworkDhcpLease is libvirt's remote_network_dhcp_lease +type NetworkDhcpLease struct { + Iface string + Expirytime int64 + Type int32 + Mac OptString + Iaid OptString + Ipaddr string + Prefix uint32 + Hostname OptString + Clientid OptString +} + +// NetworkGetDhcpLeasesArgs is libvirt's remote_network_get_dhcp_leases_args +type NetworkGetDhcpLeasesArgs struct { + Net Network + Mac OptString + NeedResults int32 + Flags uint32 +} + +// NetworkGetDhcpLeasesRet is libvirt's remote_network_get_dhcp_leases_ret +type NetworkGetDhcpLeasesRet struct { + Leases []NetworkDhcpLease + Ret uint32 +} + +// DomainStatsRecord is libvirt's remote_domain_stats_record +type DomainStatsRecord struct { + Dom Domain + Params []TypedParam +} + +// ConnectGetAllDomainStatsArgs is libvirt's remote_connect_get_all_domain_stats_args +type ConnectGetAllDomainStatsArgs struct { + Doms []Domain + Stats uint32 + Flags ConnectGetAllDomainStatsFlags +} + +// DomainEventCallbackAgentLifecycleMsg is libvirt's remote_domain_event_callback_agent_lifecycle_msg +type DomainEventCallbackAgentLifecycleMsg struct { + CallbackID int32 + Dom Domain + State int32 + Reason int32 +} + +// ConnectGetAllDomainStatsRet is libvirt's remote_connect_get_all_domain_stats_ret +type ConnectGetAllDomainStatsRet struct { + RetStats []DomainStatsRecord +} + +// DomainFsinfo is libvirt's remote_domain_fsinfo +type DomainFsinfo struct { + Mountpoint string + Name string + Fstype string + DevAliases []string +} + +// DomainGetFsinfoArgs is libvirt's remote_domain_get_fsinfo_args +type DomainGetFsinfoArgs struct { + Dom Domain + Flags uint32 +} + +// DomainGetFsinfoRet is libvirt's remote_domain_get_fsinfo_ret +type DomainGetFsinfoRet struct { + Info []DomainFsinfo + Ret uint32 +} + +// DomainIPAddr is libvirt's remote_domain_ip_addr +type DomainIPAddr struct { + Type int32 + Addr string + Prefix uint32 +} + +// DomainInterface is libvirt's remote_domain_interface +type DomainInterface struct { + Name string + Hwaddr OptString + Addrs []DomainIPAddr +} + +// DomainInterfaceAddressesArgs is libvirt's remote_domain_interface_addresses_args +type DomainInterfaceAddressesArgs struct { + Dom Domain + Source uint32 + Flags uint32 +} + +// DomainInterfaceAddressesRet is libvirt's remote_domain_interface_addresses_ret +type DomainInterfaceAddressesRet struct { + Ifaces []DomainInterface +} + +// DomainSetUserPasswordArgs is libvirt's remote_domain_set_user_password_args +type DomainSetUserPasswordArgs struct { + Dom Domain + User OptString + Password OptString + Flags DomainSetUserPasswordFlags +} + +// DomainRenameArgs is libvirt's remote_domain_rename_args +type DomainRenameArgs struct { + Dom Domain + NewName OptString + Flags uint32 +} + +// DomainRenameRet is libvirt's remote_domain_rename_ret +type DomainRenameRet struct { + Retcode int32 +} + +// DomainEventCallbackMigrationIterationMsg is libvirt's remote_domain_event_callback_migration_iteration_msg +type DomainEventCallbackMigrationIterationMsg struct { + CallbackID int32 + Dom Domain + Iteration int32 +} + +// DomainEventCallbackJobCompletedMsg is libvirt's remote_domain_event_callback_job_completed_msg +type DomainEventCallbackJobCompletedMsg struct { + CallbackID int32 + Dom Domain + Params []TypedParam +} + +// DomainMigrateStartPostCopyArgs is libvirt's remote_domain_migrate_start_post_copy_args +type DomainMigrateStartPostCopyArgs struct { + Dom Domain + Flags uint32 +} + +// DomainEventCallbackDeviceRemovalFailedMsg is libvirt's remote_domain_event_callback_device_removal_failed_msg +type DomainEventCallbackDeviceRemovalFailedMsg struct { + CallbackID int32 + Dom Domain + DevAlias string +} + +// DomainGetGuestVcpusArgs is libvirt's remote_domain_get_guest_vcpus_args +type DomainGetGuestVcpusArgs struct { + Dom Domain + Flags uint32 +} + +// DomainGetGuestVcpusRet is libvirt's remote_domain_get_guest_vcpus_ret +type DomainGetGuestVcpusRet struct { + Params []TypedParam +} + +// DomainSetGuestVcpusArgs is libvirt's remote_domain_set_guest_vcpus_args +type DomainSetGuestVcpusArgs struct { + Dom Domain + Cpumap string + State int32 + Flags uint32 +} + +// DomainSetVcpuArgs is libvirt's remote_domain_set_vcpu_args +type DomainSetVcpuArgs struct { + Dom Domain + Cpumap string + State int32 + Flags DomainModificationImpact +} + +// DomainEventCallbackMetadataChangeMsg is libvirt's remote_domain_event_callback_metadata_change_msg +type DomainEventCallbackMetadataChangeMsg struct { + CallbackID int32 + Dom Domain + Type int32 + Nsuri OptString +} + +// ConnectSecretEventRegisterAnyArgs is libvirt's remote_connect_secret_event_register_any_args +type ConnectSecretEventRegisterAnyArgs struct { + EventID int32 + OptSecret OptSecret +} + +// ConnectSecretEventRegisterAnyRet is libvirt's remote_connect_secret_event_register_any_ret +type ConnectSecretEventRegisterAnyRet struct { + CallbackID int32 +} + +// ConnectSecretEventDeregisterAnyArgs is libvirt's remote_connect_secret_event_deregister_any_args +type ConnectSecretEventDeregisterAnyArgs struct { + CallbackID int32 +} + +// SecretEventLifecycleMsg is libvirt's remote_secret_event_lifecycle_msg +type SecretEventLifecycleMsg struct { + CallbackID int32 + OptSecret Secret + Event int32 + Detail int32 +} + +// SecretEventValueChangedMsg is libvirt's remote_secret_event_value_changed_msg +type SecretEventValueChangedMsg struct { + CallbackID int32 + OptSecret Secret +} + +// DomainSetBlockThresholdArgs is libvirt's remote_domain_set_block_threshold_args +type DomainSetBlockThresholdArgs struct { + Dom Domain + Dev string + Threshold uint64 + Flags uint32 +} + +// DomainSetLifecycleActionArgs is libvirt's remote_domain_set_lifecycle_action_args +type DomainSetLifecycleActionArgs struct { + Dom Domain + Type uint32 + Action uint32 + Flags DomainModificationImpact +} + +// ConnectCompareHypervisorCPUArgs is libvirt's remote_connect_compare_hypervisor_cpu_args +type ConnectCompareHypervisorCPUArgs struct { + Emulator OptString + Arch OptString + Machine OptString + Virttype OptString + XMLCPU string + Flags uint32 +} + +// ConnectCompareHypervisorCPURet is libvirt's remote_connect_compare_hypervisor_cpu_ret +type ConnectCompareHypervisorCPURet struct { + Result int32 +} + +// ConnectBaselineHypervisorCPUArgs is libvirt's remote_connect_baseline_hypervisor_cpu_args +type ConnectBaselineHypervisorCPUArgs struct { + Emulator OptString + Arch OptString + Machine OptString + Virttype OptString + XMLCPUs []string + Flags uint32 +} + +// ConnectBaselineHypervisorCPURet is libvirt's remote_connect_baseline_hypervisor_cpu_ret +type ConnectBaselineHypervisorCPURet struct { + CPU string +} + +// NodeGetSevInfoArgs is libvirt's remote_node_get_sev_info_args +type NodeGetSevInfoArgs struct { + Nparams int32 + Flags uint32 +} + +// NodeGetSevInfoRet is libvirt's remote_node_get_sev_info_ret +type NodeGetSevInfoRet struct { + Params []TypedParam + Nparams int32 +} + +// DomainGetLaunchSecurityInfoArgs is libvirt's remote_domain_get_launch_security_info_args +type DomainGetLaunchSecurityInfoArgs struct { + Dom Domain + Flags uint32 +} + +// DomainGetLaunchSecurityInfoRet is libvirt's remote_domain_get_launch_security_info_ret +type DomainGetLaunchSecurityInfoRet struct { + Params []TypedParam +} + +// NwfilterBindingLookupByPortDevArgs is libvirt's remote_nwfilter_binding_lookup_by_port_dev_args +type NwfilterBindingLookupByPortDevArgs struct { + Name string +} + +// NwfilterBindingLookupByPortDevRet is libvirt's remote_nwfilter_binding_lookup_by_port_dev_ret +type NwfilterBindingLookupByPortDevRet struct { + OptNwfilter NwfilterBinding +} + +// NwfilterBindingCreateXMLArgs is libvirt's remote_nwfilter_binding_create_xml_args +type NwfilterBindingCreateXMLArgs struct { + XML string + Flags uint32 +} + +// NwfilterBindingCreateXMLRet is libvirt's remote_nwfilter_binding_create_xml_ret +type NwfilterBindingCreateXMLRet struct { + OptNwfilter NwfilterBinding +} + +// NwfilterBindingDeleteArgs is libvirt's remote_nwfilter_binding_delete_args +type NwfilterBindingDeleteArgs struct { + OptNwfilter NwfilterBinding +} + +// NwfilterBindingGetXMLDescArgs is libvirt's remote_nwfilter_binding_get_xml_desc_args +type NwfilterBindingGetXMLDescArgs struct { + OptNwfilter NwfilterBinding + Flags uint32 +} + +// NwfilterBindingGetXMLDescRet is libvirt's remote_nwfilter_binding_get_xml_desc_ret +type NwfilterBindingGetXMLDescRet struct { + XML string +} + +// ConnectListAllNwfilterBindingsArgs is libvirt's remote_connect_list_all_nwfilter_bindings_args +type ConnectListAllNwfilterBindingsArgs struct { + NeedResults int32 + Flags uint32 +} + +// ConnectListAllNwfilterBindingsRet is libvirt's remote_connect_list_all_nwfilter_bindings_ret +type ConnectListAllNwfilterBindingsRet struct { + Bindings []NwfilterBinding + Ret uint32 +} + + + +// TypedParamValue is a discriminated union. +type TypedParamValue struct { + D uint32 + I interface{} +} + +// NewTypedParamValueInt creates a discriminated union value satisfying +// the TypedParamValue interface. +func NewTypedParamValueInt(v int32) *TypedParamValue { + return &TypedParamValue{D: 1, I: v} +} + +// NewTypedParamValueUint creates a discriminated union value satisfying +// the TypedParamValue interface. +func NewTypedParamValueUint(v uint32) *TypedParamValue { + return &TypedParamValue{D: 2, I: v} +} + +// NewTypedParamValueLlong creates a discriminated union value satisfying +// the TypedParamValue interface. +func NewTypedParamValueLlong(v int64) *TypedParamValue { + return &TypedParamValue{D: 3, I: v} +} + +// NewTypedParamValueUllong creates a discriminated union value satisfying +// the TypedParamValue interface. +func NewTypedParamValueUllong(v uint64) *TypedParamValue { + return &TypedParamValue{D: 4, I: v} +} + +// NewTypedParamValueDouble creates a discriminated union value satisfying +// the TypedParamValue interface. +func NewTypedParamValueDouble(v float64) *TypedParamValue { + return &TypedParamValue{D: 5, I: v} +} + +// NewTypedParamValueBoolean creates a discriminated union value satisfying +// the TypedParamValue interface. +func NewTypedParamValueBoolean(v int32) *TypedParamValue { + return &TypedParamValue{D: 6, I: v} +} + +// NewTypedParamValueString creates a discriminated union value satisfying +// the TypedParamValue interface. +func NewTypedParamValueString(v string) *TypedParamValue { + return &TypedParamValue{D: 7, I: v} +} + + +// ConnectOpen is the go wrapper for REMOTE_PROC_CONNECT_OPEN. +func (l *Libvirt) ConnectOpen(Name OptString, Flags ConnectFlags) (err error) { + var buf []byte + + args := ConnectOpenArgs { + Name: Name, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(1, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectClose is the go wrapper for REMOTE_PROC_CONNECT_CLOSE. +func (l *Libvirt) ConnectClose() (err error) { + var buf []byte + + + _, err = l.requestStream(2, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectGetType is the go wrapper for REMOTE_PROC_CONNECT_GET_TYPE. +func (l *Libvirt) ConnectGetType() (rType string, err error) { + var buf []byte + + var r response + r, err = l.requestStream(3, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Type: string + _, err = dec.Decode(&rType) + if err != nil { + return + } + + return +} + +// ConnectGetVersion is the go wrapper for REMOTE_PROC_CONNECT_GET_VERSION. +func (l *Libvirt) ConnectGetVersion() (rHvVer uint64, err error) { + var buf []byte + + var r response + r, err = l.requestStream(4, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // HvVer: uint64 + _, err = dec.Decode(&rHvVer) + if err != nil { + return + } + + return +} + +// ConnectGetMaxVcpus is the go wrapper for REMOTE_PROC_CONNECT_GET_MAX_VCPUS. +func (l *Libvirt) ConnectGetMaxVcpus(Type OptString) (rMaxVcpus int32, err error) { + var buf []byte + + args := ConnectGetMaxVcpusArgs { + Type: Type, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(5, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // MaxVcpus: int32 + _, err = dec.Decode(&rMaxVcpus) + if err != nil { + return + } + + return +} + +// NodeGetInfo is the go wrapper for REMOTE_PROC_NODE_GET_INFO. +func (l *Libvirt) NodeGetInfo() (rModel [32]int8, rMemory uint64, rCpus int32, rMhz int32, rNodes int32, rSockets int32, rCores int32, rThreads int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(6, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Model: [32]int8 + _, err = dec.Decode(&rModel) + if err != nil { + return + } + // Memory: uint64 + _, err = dec.Decode(&rMemory) + if err != nil { + return + } + // Cpus: int32 + _, err = dec.Decode(&rCpus) + if err != nil { + return + } + // Mhz: int32 + _, err = dec.Decode(&rMhz) + if err != nil { + return + } + // Nodes: int32 + _, err = dec.Decode(&rNodes) + if err != nil { + return + } + // Sockets: int32 + _, err = dec.Decode(&rSockets) + if err != nil { + return + } + // Cores: int32 + _, err = dec.Decode(&rCores) + if err != nil { + return + } + // Threads: int32 + _, err = dec.Decode(&rThreads) + if err != nil { + return + } + + return +} + +// ConnectGetCapabilities is the go wrapper for REMOTE_PROC_CONNECT_GET_CAPABILITIES. +func (l *Libvirt) ConnectGetCapabilities() (rCapabilities string, err error) { + var buf []byte + + var r response + r, err = l.requestStream(7, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Capabilities: string + _, err = dec.Decode(&rCapabilities) + if err != nil { + return + } + + return +} + +// DomainAttachDevice is the go wrapper for REMOTE_PROC_DOMAIN_ATTACH_DEVICE. +func (l *Libvirt) DomainAttachDevice(Dom Domain, XML string) (err error) { + var buf []byte + + args := DomainAttachDeviceArgs { + Dom: Dom, + XML: XML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(8, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainCreate is the go wrapper for REMOTE_PROC_DOMAIN_CREATE. +func (l *Libvirt) DomainCreate(Dom Domain) (err error) { + var buf []byte + + args := DomainCreateArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(9, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainCreateXML is the go wrapper for REMOTE_PROC_DOMAIN_CREATE_XML. +func (l *Libvirt) DomainCreateXML(XMLDesc string, Flags DomainCreateFlags) (rDom Domain, err error) { + var buf []byte + + args := DomainCreateXMLArgs { + XMLDesc: XMLDesc, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(10, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + + return +} + +// DomainDefineXML is the go wrapper for REMOTE_PROC_DOMAIN_DEFINE_XML. +func (l *Libvirt) DomainDefineXML(XML string) (rDom Domain, err error) { + var buf []byte + + args := DomainDefineXMLArgs { + XML: XML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(11, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + + return +} + +// DomainDestroy is the go wrapper for REMOTE_PROC_DOMAIN_DESTROY. +func (l *Libvirt) DomainDestroy(Dom Domain) (err error) { + var buf []byte + + args := DomainDestroyArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(12, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainDetachDevice is the go wrapper for REMOTE_PROC_DOMAIN_DETACH_DEVICE. +func (l *Libvirt) DomainDetachDevice(Dom Domain, XML string) (err error) { + var buf []byte + + args := DomainDetachDeviceArgs { + Dom: Dom, + XML: XML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(13, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_GET_XML_DESC. +func (l *Libvirt) DomainGetXMLDesc(Dom Domain, Flags DomainXMLFlags) (rXML string, err error) { + var buf []byte + + args := DomainGetXMLDescArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(14, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// DomainGetAutostart is the go wrapper for REMOTE_PROC_DOMAIN_GET_AUTOSTART. +func (l *Libvirt) DomainGetAutostart(Dom Domain) (rAutostart int32, err error) { + var buf []byte + + args := DomainGetAutostartArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(15, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Autostart: int32 + _, err = dec.Decode(&rAutostart) + if err != nil { + return + } + + return +} + +// DomainGetInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_INFO. +func (l *Libvirt) DomainGetInfo(Dom Domain) (rState uint8, rMaxMem uint64, rMemory uint64, rNrVirtCPU uint16, rCPUTime uint64, err error) { + var buf []byte + + args := DomainGetInfoArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(16, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // State: uint8 + _, err = dec.Decode(&rState) + if err != nil { + return + } + // MaxMem: uint64 + _, err = dec.Decode(&rMaxMem) + if err != nil { + return + } + // Memory: uint64 + _, err = dec.Decode(&rMemory) + if err != nil { + return + } + // NrVirtCPU: uint16 + _, err = dec.Decode(&rNrVirtCPU) + if err != nil { + return + } + // CPUTime: uint64 + _, err = dec.Decode(&rCPUTime) + if err != nil { + return + } + + return +} + +// DomainGetMaxMemory is the go wrapper for REMOTE_PROC_DOMAIN_GET_MAX_MEMORY. +func (l *Libvirt) DomainGetMaxMemory(Dom Domain) (rMemory uint64, err error) { + var buf []byte + + args := DomainGetMaxMemoryArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(17, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Memory: uint64 + _, err = dec.Decode(&rMemory) + if err != nil { + return + } + + return +} + +// DomainGetMaxVcpus is the go wrapper for REMOTE_PROC_DOMAIN_GET_MAX_VCPUS. +func (l *Libvirt) DomainGetMaxVcpus(Dom Domain) (rNum int32, err error) { + var buf []byte + + args := DomainGetMaxVcpusArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(18, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// DomainGetOsType is the go wrapper for REMOTE_PROC_DOMAIN_GET_OS_TYPE. +func (l *Libvirt) DomainGetOsType(Dom Domain) (rType string, err error) { + var buf []byte + + args := DomainGetOsTypeArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(19, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Type: string + _, err = dec.Decode(&rType) + if err != nil { + return + } + + return +} + +// DomainGetVcpus is the go wrapper for REMOTE_PROC_DOMAIN_GET_VCPUS. +func (l *Libvirt) DomainGetVcpus(Dom Domain, Maxinfo int32, Maplen int32) (rInfo []VcpuInfo, rCpumaps []byte, err error) { + var buf []byte + + args := DomainGetVcpusArgs { + Dom: Dom, + Maxinfo: Maxinfo, + Maplen: Maplen, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(20, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Info: []VcpuInfo + _, err = dec.Decode(&rInfo) + if err != nil { + return + } + // Cpumaps: []byte + _, err = dec.Decode(&rCpumaps) + if err != nil { + return + } + + return +} + +// ConnectListDefinedDomains is the go wrapper for REMOTE_PROC_CONNECT_LIST_DEFINED_DOMAINS. +func (l *Libvirt) ConnectListDefinedDomains(Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := ConnectListDefinedDomainsArgs { + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(21, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// DomainLookupByID is the go wrapper for REMOTE_PROC_DOMAIN_LOOKUP_BY_ID. +func (l *Libvirt) DomainLookupByID(ID int32) (rDom Domain, err error) { + var buf []byte + + args := DomainLookupByIDArgs { + ID: ID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(22, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + + return +} + +// DomainLookupByName is the go wrapper for REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME. +func (l *Libvirt) DomainLookupByName(Name string) (rDom Domain, err error) { + var buf []byte + + args := DomainLookupByNameArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(23, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + + return +} + +// DomainLookupByUUID is the go wrapper for REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID. +func (l *Libvirt) DomainLookupByUUID(UUID UUID) (rDom Domain, err error) { + var buf []byte + + args := DomainLookupByUUIDArgs { + UUID: UUID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(24, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + + return +} + +// ConnectNumOfDefinedDomains is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DEFINED_DOMAINS. +func (l *Libvirt) ConnectNumOfDefinedDomains() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(25, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// DomainPinVcpu is the go wrapper for REMOTE_PROC_DOMAIN_PIN_VCPU. +func (l *Libvirt) DomainPinVcpu(Dom Domain, Vcpu uint32, Cpumap []byte) (err error) { + var buf []byte + + args := DomainPinVcpuArgs { + Dom: Dom, + Vcpu: Vcpu, + Cpumap: Cpumap, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(26, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainReboot is the go wrapper for REMOTE_PROC_DOMAIN_REBOOT. +func (l *Libvirt) DomainReboot(Dom Domain, Flags DomainRebootFlagValues) (err error) { + var buf []byte + + args := DomainRebootArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(27, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainResume is the go wrapper for REMOTE_PROC_DOMAIN_RESUME. +func (l *Libvirt) DomainResume(Dom Domain) (err error) { + var buf []byte + + args := DomainResumeArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(28, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetAutostart is the go wrapper for REMOTE_PROC_DOMAIN_SET_AUTOSTART. +func (l *Libvirt) DomainSetAutostart(Dom Domain, Autostart int32) (err error) { + var buf []byte + + args := DomainSetAutostartArgs { + Dom: Dom, + Autostart: Autostart, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(29, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetMaxMemory is the go wrapper for REMOTE_PROC_DOMAIN_SET_MAX_MEMORY. +func (l *Libvirt) DomainSetMaxMemory(Dom Domain, Memory uint64) (err error) { + var buf []byte + + args := DomainSetMaxMemoryArgs { + Dom: Dom, + Memory: Memory, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(30, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetMemory is the go wrapper for REMOTE_PROC_DOMAIN_SET_MEMORY. +func (l *Libvirt) DomainSetMemory(Dom Domain, Memory uint64) (err error) { + var buf []byte + + args := DomainSetMemoryArgs { + Dom: Dom, + Memory: Memory, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(31, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetVcpus is the go wrapper for REMOTE_PROC_DOMAIN_SET_VCPUS. +func (l *Libvirt) DomainSetVcpus(Dom Domain, Nvcpus uint32) (err error) { + var buf []byte + + args := DomainSetVcpusArgs { + Dom: Dom, + Nvcpus: Nvcpus, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(32, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainShutdown is the go wrapper for REMOTE_PROC_DOMAIN_SHUTDOWN. +func (l *Libvirt) DomainShutdown(Dom Domain) (err error) { + var buf []byte + + args := DomainShutdownArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(33, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSuspend is the go wrapper for REMOTE_PROC_DOMAIN_SUSPEND. +func (l *Libvirt) DomainSuspend(Dom Domain) (err error) { + var buf []byte + + args := DomainSuspendArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(34, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainUndefine is the go wrapper for REMOTE_PROC_DOMAIN_UNDEFINE. +func (l *Libvirt) DomainUndefine(Dom Domain) (err error) { + var buf []byte + + args := DomainUndefineArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(35, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectListDefinedNetworks is the go wrapper for REMOTE_PROC_CONNECT_LIST_DEFINED_NETWORKS. +func (l *Libvirt) ConnectListDefinedNetworks(Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := ConnectListDefinedNetworksArgs { + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(36, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// ConnectListDomains is the go wrapper for REMOTE_PROC_CONNECT_LIST_DOMAINS. +func (l *Libvirt) ConnectListDomains(Maxids int32) (rIds []int32, err error) { + var buf []byte + + args := ConnectListDomainsArgs { + Maxids: Maxids, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(37, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Ids: []int32 + _, err = dec.Decode(&rIds) + if err != nil { + return + } + + return +} + +// ConnectListNetworks is the go wrapper for REMOTE_PROC_CONNECT_LIST_NETWORKS. +func (l *Libvirt) ConnectListNetworks(Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := ConnectListNetworksArgs { + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(38, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// NetworkCreate is the go wrapper for REMOTE_PROC_NETWORK_CREATE. +func (l *Libvirt) NetworkCreate(Net Network) (err error) { + var buf []byte + + args := NetworkCreateArgs { + Net: Net, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(39, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NetworkCreateXML is the go wrapper for REMOTE_PROC_NETWORK_CREATE_XML. +func (l *Libvirt) NetworkCreateXML(XML string) (rNet Network, err error) { + var buf []byte + + args := NetworkCreateXMLArgs { + XML: XML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(40, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Net: Network + _, err = dec.Decode(&rNet) + if err != nil { + return + } + + return +} + +// NetworkDefineXML is the go wrapper for REMOTE_PROC_NETWORK_DEFINE_XML. +func (l *Libvirt) NetworkDefineXML(XML string) (rNet Network, err error) { + var buf []byte + + args := NetworkDefineXMLArgs { + XML: XML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(41, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Net: Network + _, err = dec.Decode(&rNet) + if err != nil { + return + } + + return +} + +// NetworkDestroy is the go wrapper for REMOTE_PROC_NETWORK_DESTROY. +func (l *Libvirt) NetworkDestroy(Net Network) (err error) { + var buf []byte + + args := NetworkDestroyArgs { + Net: Net, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(42, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NetworkGetXMLDesc is the go wrapper for REMOTE_PROC_NETWORK_GET_XML_DESC. +func (l *Libvirt) NetworkGetXMLDesc(Net Network, Flags uint32) (rXML string, err error) { + var buf []byte + + args := NetworkGetXMLDescArgs { + Net: Net, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(43, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// NetworkGetAutostart is the go wrapper for REMOTE_PROC_NETWORK_GET_AUTOSTART. +func (l *Libvirt) NetworkGetAutostart(Net Network) (rAutostart int32, err error) { + var buf []byte + + args := NetworkGetAutostartArgs { + Net: Net, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(44, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Autostart: int32 + _, err = dec.Decode(&rAutostart) + if err != nil { + return + } + + return +} + +// NetworkGetBridgeName is the go wrapper for REMOTE_PROC_NETWORK_GET_BRIDGE_NAME. +func (l *Libvirt) NetworkGetBridgeName(Net Network) (rName string, err error) { + var buf []byte + + args := NetworkGetBridgeNameArgs { + Net: Net, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(45, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Name: string + _, err = dec.Decode(&rName) + if err != nil { + return + } + + return +} + +// NetworkLookupByName is the go wrapper for REMOTE_PROC_NETWORK_LOOKUP_BY_NAME. +func (l *Libvirt) NetworkLookupByName(Name string) (rNet Network, err error) { + var buf []byte + + args := NetworkLookupByNameArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(46, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Net: Network + _, err = dec.Decode(&rNet) + if err != nil { + return + } + + return +} + +// NetworkLookupByUUID is the go wrapper for REMOTE_PROC_NETWORK_LOOKUP_BY_UUID. +func (l *Libvirt) NetworkLookupByUUID(UUID UUID) (rNet Network, err error) { + var buf []byte + + args := NetworkLookupByUUIDArgs { + UUID: UUID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(47, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Net: Network + _, err = dec.Decode(&rNet) + if err != nil { + return + } + + return +} + +// NetworkSetAutostart is the go wrapper for REMOTE_PROC_NETWORK_SET_AUTOSTART. +func (l *Libvirt) NetworkSetAutostart(Net Network, Autostart int32) (err error) { + var buf []byte + + args := NetworkSetAutostartArgs { + Net: Net, + Autostart: Autostart, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(48, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NetworkUndefine is the go wrapper for REMOTE_PROC_NETWORK_UNDEFINE. +func (l *Libvirt) NetworkUndefine(Net Network) (err error) { + var buf []byte + + args := NetworkUndefineArgs { + Net: Net, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(49, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectNumOfDefinedNetworks is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DEFINED_NETWORKS. +func (l *Libvirt) ConnectNumOfDefinedNetworks() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(50, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// ConnectNumOfDomains is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DOMAINS. +func (l *Libvirt) ConnectNumOfDomains() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(51, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// ConnectNumOfNetworks is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_NETWORKS. +func (l *Libvirt) ConnectNumOfNetworks() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(52, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// DomainCoreDump is the go wrapper for REMOTE_PROC_DOMAIN_CORE_DUMP. +func (l *Libvirt) DomainCoreDump(Dom Domain, To string, Flags DomainCoreDumpFlags) (err error) { + var buf []byte + + args := DomainCoreDumpArgs { + Dom: Dom, + To: To, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(53, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainRestore is the go wrapper for REMOTE_PROC_DOMAIN_RESTORE. +func (l *Libvirt) DomainRestore(From string) (err error) { + var buf []byte + + args := DomainRestoreArgs { + From: From, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(54, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSave is the go wrapper for REMOTE_PROC_DOMAIN_SAVE. +func (l *Libvirt) DomainSave(Dom Domain, To string) (err error) { + var buf []byte + + args := DomainSaveArgs { + Dom: Dom, + To: To, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(55, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetSchedulerType is the go wrapper for REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE. +func (l *Libvirt) DomainGetSchedulerType(Dom Domain) (rType string, rNparams int32, err error) { + var buf []byte + + args := DomainGetSchedulerTypeArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(56, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Type: string + _, err = dec.Decode(&rType) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainGetSchedulerParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS. +func (l *Libvirt) DomainGetSchedulerParameters(Dom Domain, Nparams int32) (rParams []TypedParam, err error) { + var buf []byte + + args := DomainGetSchedulerParametersArgs { + Dom: Dom, + Nparams: Nparams, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(57, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + + return +} + +// DomainSetSchedulerParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS. +func (l *Libvirt) DomainSetSchedulerParameters(Dom Domain, Params []TypedParam) (err error) { + var buf []byte + + args := DomainSetSchedulerParametersArgs { + Dom: Dom, + Params: Params, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(58, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectGetHostname is the go wrapper for REMOTE_PROC_CONNECT_GET_HOSTNAME. +func (l *Libvirt) ConnectGetHostname() (rHostname string, err error) { + var buf []byte + + var r response + r, err = l.requestStream(59, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Hostname: string + _, err = dec.Decode(&rHostname) + if err != nil { + return + } + + return +} + +// ConnectSupportsFeature is the go wrapper for REMOTE_PROC_CONNECT_SUPPORTS_FEATURE. +func (l *Libvirt) ConnectSupportsFeature(Feature int32) (rSupported int32, err error) { + var buf []byte + + args := ConnectSupportsFeatureArgs { + Feature: Feature, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(60, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Supported: int32 + _, err = dec.Decode(&rSupported) + if err != nil { + return + } + + return +} + +// DomainMigratePrepare is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE. +func (l *Libvirt) DomainMigratePrepare(UriIn OptString, Flags uint64, Dname OptString, Resource uint64) (rCookie []byte, rUriOut OptString, err error) { + var buf []byte + + args := DomainMigratePrepareArgs { + UriIn: UriIn, + Flags: Flags, + Dname: Dname, + Resource: Resource, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(61, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Cookie: []byte + _, err = dec.Decode(&rCookie) + if err != nil { + return + } + // UriOut: OptString + _, err = dec.Decode(&rUriOut) + if err != nil { + return + } + + return +} + +// DomainMigratePerform is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PERFORM. +func (l *Libvirt) DomainMigratePerform(Dom Domain, Cookie []byte, Uri string, Flags uint64, Dname OptString, Resource uint64) (err error) { + var buf []byte + + args := DomainMigratePerformArgs { + Dom: Dom, + Cookie: Cookie, + Uri: Uri, + Flags: Flags, + Dname: Dname, + Resource: Resource, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(62, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainMigrateFinish is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_FINISH. +func (l *Libvirt) DomainMigrateFinish(Dname string, Cookie []byte, Uri string, Flags uint64) (rDdom Domain, err error) { + var buf []byte + + args := DomainMigrateFinishArgs { + Dname: Dname, + Cookie: Cookie, + Uri: Uri, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(63, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Ddom: Domain + _, err = dec.Decode(&rDdom) + if err != nil { + return + } + + return +} + +// DomainBlockStats is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_STATS. +func (l *Libvirt) DomainBlockStats(Dom Domain, Path string) (rRdReq int64, rRdBytes int64, rWrReq int64, rWrBytes int64, rErrs int64, err error) { + var buf []byte + + args := DomainBlockStatsArgs { + Dom: Dom, + Path: Path, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(64, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // RdReq: int64 + _, err = dec.Decode(&rRdReq) + if err != nil { + return + } + // RdBytes: int64 + _, err = dec.Decode(&rRdBytes) + if err != nil { + return + } + // WrReq: int64 + _, err = dec.Decode(&rWrReq) + if err != nil { + return + } + // WrBytes: int64 + _, err = dec.Decode(&rWrBytes) + if err != nil { + return + } + // Errs: int64 + _, err = dec.Decode(&rErrs) + if err != nil { + return + } + + return +} + +// DomainInterfaceStats is the go wrapper for REMOTE_PROC_DOMAIN_INTERFACE_STATS. +func (l *Libvirt) DomainInterfaceStats(Dom Domain, Device string) (rRxBytes int64, rRxPackets int64, rRxErrs int64, rRxDrop int64, rTxBytes int64, rTxPackets int64, rTxErrs int64, rTxDrop int64, err error) { + var buf []byte + + args := DomainInterfaceStatsArgs { + Dom: Dom, + Device: Device, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(65, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // RxBytes: int64 + _, err = dec.Decode(&rRxBytes) + if err != nil { + return + } + // RxPackets: int64 + _, err = dec.Decode(&rRxPackets) + if err != nil { + return + } + // RxErrs: int64 + _, err = dec.Decode(&rRxErrs) + if err != nil { + return + } + // RxDrop: int64 + _, err = dec.Decode(&rRxDrop) + if err != nil { + return + } + // TxBytes: int64 + _, err = dec.Decode(&rTxBytes) + if err != nil { + return + } + // TxPackets: int64 + _, err = dec.Decode(&rTxPackets) + if err != nil { + return + } + // TxErrs: int64 + _, err = dec.Decode(&rTxErrs) + if err != nil { + return + } + // TxDrop: int64 + _, err = dec.Decode(&rTxDrop) + if err != nil { + return + } + + return +} + +// AuthList is the go wrapper for REMOTE_PROC_AUTH_LIST. +func (l *Libvirt) AuthList() (rTypes []AuthType, err error) { + var buf []byte + + var r response + r, err = l.requestStream(66, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Types: []AuthType + _, err = dec.Decode(&rTypes) + if err != nil { + return + } + + return +} + +// AuthSaslInit is the go wrapper for REMOTE_PROC_AUTH_SASL_INIT. +func (l *Libvirt) AuthSaslInit() (rMechlist string, err error) { + var buf []byte + + var r response + r, err = l.requestStream(67, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Mechlist: string + _, err = dec.Decode(&rMechlist) + if err != nil { + return + } + + return +} + +// AuthSaslStart is the go wrapper for REMOTE_PROC_AUTH_SASL_START. +func (l *Libvirt) AuthSaslStart(Mech string, Nil int32, Data []int8) (rComplete int32, rNil int32, rData []int8, err error) { + var buf []byte + + args := AuthSaslStartArgs { + Mech: Mech, + Nil: Nil, + Data: Data, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(68, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Complete: int32 + _, err = dec.Decode(&rComplete) + if err != nil { + return + } + // Nil: int32 + _, err = dec.Decode(&rNil) + if err != nil { + return + } + // Data: []int8 + _, err = dec.Decode(&rData) + if err != nil { + return + } + + return +} + +// AuthSaslStep is the go wrapper for REMOTE_PROC_AUTH_SASL_STEP. +func (l *Libvirt) AuthSaslStep(Nil int32, Data []int8) (rComplete int32, rNil int32, rData []int8, err error) { + var buf []byte + + args := AuthSaslStepArgs { + Nil: Nil, + Data: Data, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(69, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Complete: int32 + _, err = dec.Decode(&rComplete) + if err != nil { + return + } + // Nil: int32 + _, err = dec.Decode(&rNil) + if err != nil { + return + } + // Data: []int8 + _, err = dec.Decode(&rData) + if err != nil { + return + } + + return +} + +// AuthPolkit is the go wrapper for REMOTE_PROC_AUTH_POLKIT. +func (l *Libvirt) AuthPolkit() (rComplete int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(70, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Complete: int32 + _, err = dec.Decode(&rComplete) + if err != nil { + return + } + + return +} + +// ConnectNumOfStoragePools is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_STORAGE_POOLS. +func (l *Libvirt) ConnectNumOfStoragePools() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(71, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// ConnectListStoragePools is the go wrapper for REMOTE_PROC_CONNECT_LIST_STORAGE_POOLS. +func (l *Libvirt) ConnectListStoragePools(Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := ConnectListStoragePoolsArgs { + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(72, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// ConnectNumOfDefinedStoragePools is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DEFINED_STORAGE_POOLS. +func (l *Libvirt) ConnectNumOfDefinedStoragePools() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(73, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// ConnectListDefinedStoragePools is the go wrapper for REMOTE_PROC_CONNECT_LIST_DEFINED_STORAGE_POOLS. +func (l *Libvirt) ConnectListDefinedStoragePools(Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := ConnectListDefinedStoragePoolsArgs { + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(74, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// ConnectFindStoragePoolSources is the go wrapper for REMOTE_PROC_CONNECT_FIND_STORAGE_POOL_SOURCES. +func (l *Libvirt) ConnectFindStoragePoolSources(Type string, SrcSpec OptString, Flags uint32) (rXML string, err error) { + var buf []byte + + args := ConnectFindStoragePoolSourcesArgs { + Type: Type, + SrcSpec: SrcSpec, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(75, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// StoragePoolCreateXML is the go wrapper for REMOTE_PROC_STORAGE_POOL_CREATE_XML. +func (l *Libvirt) StoragePoolCreateXML(XML string, Flags StoragePoolCreateFlags) (rPool StoragePool, err error) { + var buf []byte + + args := StoragePoolCreateXMLArgs { + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(76, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Pool: StoragePool + _, err = dec.Decode(&rPool) + if err != nil { + return + } + + return +} + +// StoragePoolDefineXML is the go wrapper for REMOTE_PROC_STORAGE_POOL_DEFINE_XML. +func (l *Libvirt) StoragePoolDefineXML(XML string, Flags uint32) (rPool StoragePool, err error) { + var buf []byte + + args := StoragePoolDefineXMLArgs { + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(77, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Pool: StoragePool + _, err = dec.Decode(&rPool) + if err != nil { + return + } + + return +} + +// StoragePoolCreate is the go wrapper for REMOTE_PROC_STORAGE_POOL_CREATE. +func (l *Libvirt) StoragePoolCreate(Pool StoragePool, Flags StoragePoolCreateFlags) (err error) { + var buf []byte + + args := StoragePoolCreateArgs { + Pool: Pool, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(78, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolBuild is the go wrapper for REMOTE_PROC_STORAGE_POOL_BUILD. +func (l *Libvirt) StoragePoolBuild(Pool StoragePool, Flags StoragePoolBuildFlags) (err error) { + var buf []byte + + args := StoragePoolBuildArgs { + Pool: Pool, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(79, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolDestroy is the go wrapper for REMOTE_PROC_STORAGE_POOL_DESTROY. +func (l *Libvirt) StoragePoolDestroy(Pool StoragePool) (err error) { + var buf []byte + + args := StoragePoolDestroyArgs { + Pool: Pool, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(80, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolDelete is the go wrapper for REMOTE_PROC_STORAGE_POOL_DELETE. +func (l *Libvirt) StoragePoolDelete(Pool StoragePool, Flags StoragePoolDeleteFlags) (err error) { + var buf []byte + + args := StoragePoolDeleteArgs { + Pool: Pool, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(81, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolUndefine is the go wrapper for REMOTE_PROC_STORAGE_POOL_UNDEFINE. +func (l *Libvirt) StoragePoolUndefine(Pool StoragePool) (err error) { + var buf []byte + + args := StoragePoolUndefineArgs { + Pool: Pool, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(82, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolRefresh is the go wrapper for REMOTE_PROC_STORAGE_POOL_REFRESH. +func (l *Libvirt) StoragePoolRefresh(Pool StoragePool, Flags uint32) (err error) { + var buf []byte + + args := StoragePoolRefreshArgs { + Pool: Pool, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(83, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolLookupByName is the go wrapper for REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME. +func (l *Libvirt) StoragePoolLookupByName(Name string) (rPool StoragePool, err error) { + var buf []byte + + args := StoragePoolLookupByNameArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(84, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Pool: StoragePool + _, err = dec.Decode(&rPool) + if err != nil { + return + } + + return +} + +// StoragePoolLookupByUUID is the go wrapper for REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID. +func (l *Libvirt) StoragePoolLookupByUUID(UUID UUID) (rPool StoragePool, err error) { + var buf []byte + + args := StoragePoolLookupByUUIDArgs { + UUID: UUID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(85, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Pool: StoragePool + _, err = dec.Decode(&rPool) + if err != nil { + return + } + + return +} + +// StoragePoolLookupByVolume is the go wrapper for REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME. +func (l *Libvirt) StoragePoolLookupByVolume(Vol StorageVol) (rPool StoragePool, err error) { + var buf []byte + + args := StoragePoolLookupByVolumeArgs { + Vol: Vol, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(86, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Pool: StoragePool + _, err = dec.Decode(&rPool) + if err != nil { + return + } + + return +} + +// StoragePoolGetInfo is the go wrapper for REMOTE_PROC_STORAGE_POOL_GET_INFO. +func (l *Libvirt) StoragePoolGetInfo(Pool StoragePool) (rState uint8, rCapacity uint64, rAllocation uint64, rAvailable uint64, err error) { + var buf []byte + + args := StoragePoolGetInfoArgs { + Pool: Pool, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(87, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // State: uint8 + _, err = dec.Decode(&rState) + if err != nil { + return + } + // Capacity: uint64 + _, err = dec.Decode(&rCapacity) + if err != nil { + return + } + // Allocation: uint64 + _, err = dec.Decode(&rAllocation) + if err != nil { + return + } + // Available: uint64 + _, err = dec.Decode(&rAvailable) + if err != nil { + return + } + + return +} + +// StoragePoolGetXMLDesc is the go wrapper for REMOTE_PROC_STORAGE_POOL_GET_XML_DESC. +func (l *Libvirt) StoragePoolGetXMLDesc(Pool StoragePool, Flags StorageXMLFlags) (rXML string, err error) { + var buf []byte + + args := StoragePoolGetXMLDescArgs { + Pool: Pool, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(88, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// StoragePoolGetAutostart is the go wrapper for REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART. +func (l *Libvirt) StoragePoolGetAutostart(Pool StoragePool) (rAutostart int32, err error) { + var buf []byte + + args := StoragePoolGetAutostartArgs { + Pool: Pool, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(89, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Autostart: int32 + _, err = dec.Decode(&rAutostart) + if err != nil { + return + } + + return +} + +// StoragePoolSetAutostart is the go wrapper for REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART. +func (l *Libvirt) StoragePoolSetAutostart(Pool StoragePool, Autostart int32) (err error) { + var buf []byte + + args := StoragePoolSetAutostartArgs { + Pool: Pool, + Autostart: Autostart, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(90, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolNumOfVolumes is the go wrapper for REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES. +func (l *Libvirt) StoragePoolNumOfVolumes(Pool StoragePool) (rNum int32, err error) { + var buf []byte + + args := StoragePoolNumOfVolumesArgs { + Pool: Pool, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(91, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// StoragePoolListVolumes is the go wrapper for REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES. +func (l *Libvirt) StoragePoolListVolumes(Pool StoragePool, Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := StoragePoolListVolumesArgs { + Pool: Pool, + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(92, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// StorageVolCreateXML is the go wrapper for REMOTE_PROC_STORAGE_VOL_CREATE_XML. +func (l *Libvirt) StorageVolCreateXML(Pool StoragePool, XML string, Flags StorageVolCreateFlags) (rVol StorageVol, err error) { + var buf []byte + + args := StorageVolCreateXMLArgs { + Pool: Pool, + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(93, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Vol: StorageVol + _, err = dec.Decode(&rVol) + if err != nil { + return + } + + return +} + +// StorageVolDelete is the go wrapper for REMOTE_PROC_STORAGE_VOL_DELETE. +func (l *Libvirt) StorageVolDelete(Vol StorageVol, Flags StorageVolDeleteFlags) (err error) { + var buf []byte + + args := StorageVolDeleteArgs { + Vol: Vol, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(94, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StorageVolLookupByName is the go wrapper for REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME. +func (l *Libvirt) StorageVolLookupByName(Pool StoragePool, Name string) (rVol StorageVol, err error) { + var buf []byte + + args := StorageVolLookupByNameArgs { + Pool: Pool, + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(95, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Vol: StorageVol + _, err = dec.Decode(&rVol) + if err != nil { + return + } + + return +} + +// StorageVolLookupByKey is the go wrapper for REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY. +func (l *Libvirt) StorageVolLookupByKey(Key string) (rVol StorageVol, err error) { + var buf []byte + + args := StorageVolLookupByKeyArgs { + Key: Key, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(96, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Vol: StorageVol + _, err = dec.Decode(&rVol) + if err != nil { + return + } + + return +} + +// StorageVolLookupByPath is the go wrapper for REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH. +func (l *Libvirt) StorageVolLookupByPath(Path string) (rVol StorageVol, err error) { + var buf []byte + + args := StorageVolLookupByPathArgs { + Path: Path, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(97, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Vol: StorageVol + _, err = dec.Decode(&rVol) + if err != nil { + return + } + + return +} + +// StorageVolGetInfo is the go wrapper for REMOTE_PROC_STORAGE_VOL_GET_INFO. +func (l *Libvirt) StorageVolGetInfo(Vol StorageVol) (rType int8, rCapacity uint64, rAllocation uint64, err error) { + var buf []byte + + args := StorageVolGetInfoArgs { + Vol: Vol, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(98, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Type: int8 + _, err = dec.Decode(&rType) + if err != nil { + return + } + // Capacity: uint64 + _, err = dec.Decode(&rCapacity) + if err != nil { + return + } + // Allocation: uint64 + _, err = dec.Decode(&rAllocation) + if err != nil { + return + } + + return +} + +// StorageVolGetXMLDesc is the go wrapper for REMOTE_PROC_STORAGE_VOL_GET_XML_DESC. +func (l *Libvirt) StorageVolGetXMLDesc(Vol StorageVol, Flags uint32) (rXML string, err error) { + var buf []byte + + args := StorageVolGetXMLDescArgs { + Vol: Vol, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(99, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// StorageVolGetPath is the go wrapper for REMOTE_PROC_STORAGE_VOL_GET_PATH. +func (l *Libvirt) StorageVolGetPath(Vol StorageVol) (rName string, err error) { + var buf []byte + + args := StorageVolGetPathArgs { + Vol: Vol, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(100, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Name: string + _, err = dec.Decode(&rName) + if err != nil { + return + } + + return +} + +// NodeGetCellsFreeMemory is the go wrapper for REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY. +func (l *Libvirt) NodeGetCellsFreeMemory(StartCell int32, Maxcells int32) (rCells []uint64, err error) { + var buf []byte + + args := NodeGetCellsFreeMemoryArgs { + StartCell: StartCell, + Maxcells: Maxcells, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(101, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Cells: []uint64 + _, err = dec.Decode(&rCells) + if err != nil { + return + } + + return +} + +// NodeGetFreeMemory is the go wrapper for REMOTE_PROC_NODE_GET_FREE_MEMORY. +func (l *Libvirt) NodeGetFreeMemory() (rFreeMem uint64, err error) { + var buf []byte + + var r response + r, err = l.requestStream(102, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // FreeMem: uint64 + _, err = dec.Decode(&rFreeMem) + if err != nil { + return + } + + return +} + +// DomainBlockPeek is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_PEEK. +func (l *Libvirt) DomainBlockPeek(Dom Domain, Path string, Offset uint64, Size uint32, Flags uint32) (rBuffer []byte, err error) { + var buf []byte + + args := DomainBlockPeekArgs { + Dom: Dom, + Path: Path, + Offset: Offset, + Size: Size, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(103, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Buffer: []byte + _, err = dec.Decode(&rBuffer) + if err != nil { + return + } + + return +} + +// DomainMemoryPeek is the go wrapper for REMOTE_PROC_DOMAIN_MEMORY_PEEK. +func (l *Libvirt) DomainMemoryPeek(Dom Domain, Offset uint64, Size uint32, Flags DomainMemoryFlags) (rBuffer []byte, err error) { + var buf []byte + + args := DomainMemoryPeekArgs { + Dom: Dom, + Offset: Offset, + Size: Size, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(104, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Buffer: []byte + _, err = dec.Decode(&rBuffer) + if err != nil { + return + } + + return +} + +// ConnectDomainEventRegister is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER. +func (l *Libvirt) ConnectDomainEventRegister() (rCbRegistered int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(105, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CbRegistered: int32 + _, err = dec.Decode(&rCbRegistered) + if err != nil { + return + } + + return +} + +// ConnectDomainEventDeregister is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER. +func (l *Libvirt) ConnectDomainEventDeregister() (rCbRegistered int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(106, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CbRegistered: int32 + _, err = dec.Decode(&rCbRegistered) + if err != nil { + return + } + + return +} + +// DomainEventLifecycle is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE. +func (l *Libvirt) DomainEventLifecycle() (err error) { + var buf []byte + + + _, err = l.requestStream(107, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainMigratePrepare2 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2. +func (l *Libvirt) DomainMigratePrepare2(UriIn OptString, Flags uint64, Dname OptString, Resource uint64, DomXML string) (rCookie []byte, rUriOut OptString, err error) { + var buf []byte + + args := DomainMigratePrepare2Args { + UriIn: UriIn, + Flags: Flags, + Dname: Dname, + Resource: Resource, + DomXML: DomXML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(108, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Cookie: []byte + _, err = dec.Decode(&rCookie) + if err != nil { + return + } + // UriOut: OptString + _, err = dec.Decode(&rUriOut) + if err != nil { + return + } + + return +} + +// DomainMigrateFinish2 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_FINISH2. +func (l *Libvirt) DomainMigrateFinish2(Dname string, Cookie []byte, Uri string, Flags uint64, Retcode int32) (rDdom Domain, err error) { + var buf []byte + + args := DomainMigrateFinish2Args { + Dname: Dname, + Cookie: Cookie, + Uri: Uri, + Flags: Flags, + Retcode: Retcode, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(109, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Ddom: Domain + _, err = dec.Decode(&rDdom) + if err != nil { + return + } + + return +} + +// ConnectGetUri is the go wrapper for REMOTE_PROC_CONNECT_GET_URI. +func (l *Libvirt) ConnectGetUri() (rUri string, err error) { + var buf []byte + + var r response + r, err = l.requestStream(110, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Uri: string + _, err = dec.Decode(&rUri) + if err != nil { + return + } + + return +} + +// NodeNumOfDevices is the go wrapper for REMOTE_PROC_NODE_NUM_OF_DEVICES. +func (l *Libvirt) NodeNumOfDevices(Cap OptString, Flags uint32) (rNum int32, err error) { + var buf []byte + + args := NodeNumOfDevicesArgs { + Cap: Cap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(111, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// NodeListDevices is the go wrapper for REMOTE_PROC_NODE_LIST_DEVICES. +func (l *Libvirt) NodeListDevices(Cap OptString, Maxnames int32, Flags uint32) (rNames []string, err error) { + var buf []byte + + args := NodeListDevicesArgs { + Cap: Cap, + Maxnames: Maxnames, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(112, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// NodeDeviceLookupByName is the go wrapper for REMOTE_PROC_NODE_DEVICE_LOOKUP_BY_NAME. +func (l *Libvirt) NodeDeviceLookupByName(Name string) (rDev NodeDevice, err error) { + var buf []byte + + args := NodeDeviceLookupByNameArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(113, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dev: NodeDevice + _, err = dec.Decode(&rDev) + if err != nil { + return + } + + return +} + +// NodeDeviceGetXMLDesc is the go wrapper for REMOTE_PROC_NODE_DEVICE_GET_XML_DESC. +func (l *Libvirt) NodeDeviceGetXMLDesc(Name string, Flags uint32) (rXML string, err error) { + var buf []byte + + args := NodeDeviceGetXMLDescArgs { + Name: Name, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(114, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// NodeDeviceGetParent is the go wrapper for REMOTE_PROC_NODE_DEVICE_GET_PARENT. +func (l *Libvirt) NodeDeviceGetParent(Name string) (rParentName OptString, err error) { + var buf []byte + + args := NodeDeviceGetParentArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(115, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // ParentName: OptString + _, err = dec.Decode(&rParentName) + if err != nil { + return + } + + return +} + +// NodeDeviceNumOfCaps is the go wrapper for REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS. +func (l *Libvirt) NodeDeviceNumOfCaps(Name string) (rNum int32, err error) { + var buf []byte + + args := NodeDeviceNumOfCapsArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(116, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// NodeDeviceListCaps is the go wrapper for REMOTE_PROC_NODE_DEVICE_LIST_CAPS. +func (l *Libvirt) NodeDeviceListCaps(Name string, Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := NodeDeviceListCapsArgs { + Name: Name, + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(117, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// NodeDeviceDettach is the go wrapper for REMOTE_PROC_NODE_DEVICE_DETTACH. +func (l *Libvirt) NodeDeviceDettach(Name string) (err error) { + var buf []byte + + args := NodeDeviceDettachArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(118, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeDeviceReAttach is the go wrapper for REMOTE_PROC_NODE_DEVICE_RE_ATTACH. +func (l *Libvirt) NodeDeviceReAttach(Name string) (err error) { + var buf []byte + + args := NodeDeviceReAttachArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(119, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeDeviceReset is the go wrapper for REMOTE_PROC_NODE_DEVICE_RESET. +func (l *Libvirt) NodeDeviceReset(Name string) (err error) { + var buf []byte + + args := NodeDeviceResetArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(120, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetSecurityLabel is the go wrapper for REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL. +func (l *Libvirt) DomainGetSecurityLabel(Dom Domain) (rLabel []int8, rEnforcing int32, err error) { + var buf []byte + + args := DomainGetSecurityLabelArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(121, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Label: []int8 + _, err = dec.Decode(&rLabel) + if err != nil { + return + } + // Enforcing: int32 + _, err = dec.Decode(&rEnforcing) + if err != nil { + return + } + + return +} + +// NodeGetSecurityModel is the go wrapper for REMOTE_PROC_NODE_GET_SECURITY_MODEL. +func (l *Libvirt) NodeGetSecurityModel() (rModel []int8, rDoi []int8, err error) { + var buf []byte + + var r response + r, err = l.requestStream(122, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Model: []int8 + _, err = dec.Decode(&rModel) + if err != nil { + return + } + // Doi: []int8 + _, err = dec.Decode(&rDoi) + if err != nil { + return + } + + return +} + +// NodeDeviceCreateXML is the go wrapper for REMOTE_PROC_NODE_DEVICE_CREATE_XML. +func (l *Libvirt) NodeDeviceCreateXML(XMLDesc string, Flags uint32) (rDev NodeDevice, err error) { + var buf []byte + + args := NodeDeviceCreateXMLArgs { + XMLDesc: XMLDesc, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(123, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dev: NodeDevice + _, err = dec.Decode(&rDev) + if err != nil { + return + } + + return +} + +// NodeDeviceDestroy is the go wrapper for REMOTE_PROC_NODE_DEVICE_DESTROY. +func (l *Libvirt) NodeDeviceDestroy(Name string) (err error) { + var buf []byte + + args := NodeDeviceDestroyArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(124, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StorageVolCreateXMLFrom is the go wrapper for REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM. +func (l *Libvirt) StorageVolCreateXMLFrom(Pool StoragePool, XML string, Clonevol StorageVol, Flags StorageVolCreateFlags) (rVol StorageVol, err error) { + var buf []byte + + args := StorageVolCreateXMLFromArgs { + Pool: Pool, + XML: XML, + Clonevol: Clonevol, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(125, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Vol: StorageVol + _, err = dec.Decode(&rVol) + if err != nil { + return + } + + return +} + +// ConnectNumOfInterfaces is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_INTERFACES. +func (l *Libvirt) ConnectNumOfInterfaces() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(126, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// ConnectListInterfaces is the go wrapper for REMOTE_PROC_CONNECT_LIST_INTERFACES. +func (l *Libvirt) ConnectListInterfaces(Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := ConnectListInterfacesArgs { + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(127, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// InterfaceLookupByName is the go wrapper for REMOTE_PROC_INTERFACE_LOOKUP_BY_NAME. +func (l *Libvirt) InterfaceLookupByName(Name string) (rIface Interface, err error) { + var buf []byte + + args := InterfaceLookupByNameArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(128, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Iface: Interface + _, err = dec.Decode(&rIface) + if err != nil { + return + } + + return +} + +// InterfaceLookupByMacString is the go wrapper for REMOTE_PROC_INTERFACE_LOOKUP_BY_MAC_STRING. +func (l *Libvirt) InterfaceLookupByMacString(Mac string) (rIface Interface, err error) { + var buf []byte + + args := InterfaceLookupByMacStringArgs { + Mac: Mac, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(129, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Iface: Interface + _, err = dec.Decode(&rIface) + if err != nil { + return + } + + return +} + +// InterfaceGetXMLDesc is the go wrapper for REMOTE_PROC_INTERFACE_GET_XML_DESC. +func (l *Libvirt) InterfaceGetXMLDesc(Iface Interface, Flags uint32) (rXML string, err error) { + var buf []byte + + args := InterfaceGetXMLDescArgs { + Iface: Iface, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(130, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// InterfaceDefineXML is the go wrapper for REMOTE_PROC_INTERFACE_DEFINE_XML. +func (l *Libvirt) InterfaceDefineXML(XML string, Flags uint32) (rIface Interface, err error) { + var buf []byte + + args := InterfaceDefineXMLArgs { + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(131, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Iface: Interface + _, err = dec.Decode(&rIface) + if err != nil { + return + } + + return +} + +// InterfaceUndefine is the go wrapper for REMOTE_PROC_INTERFACE_UNDEFINE. +func (l *Libvirt) InterfaceUndefine(Iface Interface) (err error) { + var buf []byte + + args := InterfaceUndefineArgs { + Iface: Iface, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(132, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// InterfaceCreate is the go wrapper for REMOTE_PROC_INTERFACE_CREATE. +func (l *Libvirt) InterfaceCreate(Iface Interface, Flags uint32) (err error) { + var buf []byte + + args := InterfaceCreateArgs { + Iface: Iface, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(133, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// InterfaceDestroy is the go wrapper for REMOTE_PROC_INTERFACE_DESTROY. +func (l *Libvirt) InterfaceDestroy(Iface Interface, Flags uint32) (err error) { + var buf []byte + + args := InterfaceDestroyArgs { + Iface: Iface, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(134, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectDomainXMLFromNative is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_XML_FROM_NATIVE. +func (l *Libvirt) ConnectDomainXMLFromNative(NativeFormat string, NativeConfig string, Flags uint32) (rDomainXML string, err error) { + var buf []byte + + args := ConnectDomainXMLFromNativeArgs { + NativeFormat: NativeFormat, + NativeConfig: NativeConfig, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(135, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // DomainXML: string + _, err = dec.Decode(&rDomainXML) + if err != nil { + return + } + + return +} + +// ConnectDomainXMLToNative is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_XML_TO_NATIVE. +func (l *Libvirt) ConnectDomainXMLToNative(NativeFormat string, DomainXML string, Flags uint32) (rNativeConfig string, err error) { + var buf []byte + + args := ConnectDomainXMLToNativeArgs { + NativeFormat: NativeFormat, + DomainXML: DomainXML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(136, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // NativeConfig: string + _, err = dec.Decode(&rNativeConfig) + if err != nil { + return + } + + return +} + +// ConnectNumOfDefinedInterfaces is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DEFINED_INTERFACES. +func (l *Libvirt) ConnectNumOfDefinedInterfaces() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(137, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// ConnectListDefinedInterfaces is the go wrapper for REMOTE_PROC_CONNECT_LIST_DEFINED_INTERFACES. +func (l *Libvirt) ConnectListDefinedInterfaces(Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := ConnectListDefinedInterfacesArgs { + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(138, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// ConnectNumOfSecrets is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_SECRETS. +func (l *Libvirt) ConnectNumOfSecrets() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(139, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// ConnectListSecrets is the go wrapper for REMOTE_PROC_CONNECT_LIST_SECRETS. +func (l *Libvirt) ConnectListSecrets(Maxuuids int32) (rUuids []string, err error) { + var buf []byte + + args := ConnectListSecretsArgs { + Maxuuids: Maxuuids, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(140, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Uuids: []string + _, err = dec.Decode(&rUuids) + if err != nil { + return + } + + return +} + +// SecretLookupByUUID is the go wrapper for REMOTE_PROC_SECRET_LOOKUP_BY_UUID. +func (l *Libvirt) SecretLookupByUUID(UUID UUID) (rOptSecret Secret, err error) { + var buf []byte + + args := SecretLookupByUUIDArgs { + UUID: UUID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(141, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // OptSecret: Secret + _, err = dec.Decode(&rOptSecret) + if err != nil { + return + } + + return +} + +// SecretDefineXML is the go wrapper for REMOTE_PROC_SECRET_DEFINE_XML. +func (l *Libvirt) SecretDefineXML(XML string, Flags uint32) (rOptSecret Secret, err error) { + var buf []byte + + args := SecretDefineXMLArgs { + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(142, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // OptSecret: Secret + _, err = dec.Decode(&rOptSecret) + if err != nil { + return + } + + return +} + +// SecretGetXMLDesc is the go wrapper for REMOTE_PROC_SECRET_GET_XML_DESC. +func (l *Libvirt) SecretGetXMLDesc(OptSecret Secret, Flags uint32) (rXML string, err error) { + var buf []byte + + args := SecretGetXMLDescArgs { + OptSecret: OptSecret, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(143, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// SecretSetValue is the go wrapper for REMOTE_PROC_SECRET_SET_VALUE. +func (l *Libvirt) SecretSetValue(OptSecret Secret, Value []byte, Flags uint32) (err error) { + var buf []byte + + args := SecretSetValueArgs { + OptSecret: OptSecret, + Value: Value, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(144, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// SecretGetValue is the go wrapper for REMOTE_PROC_SECRET_GET_VALUE. +func (l *Libvirt) SecretGetValue(OptSecret Secret, Flags uint32) (rValue []byte, err error) { + var buf []byte + + args := SecretGetValueArgs { + OptSecret: OptSecret, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(145, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Value: []byte + _, err = dec.Decode(&rValue) + if err != nil { + return + } + + return +} + +// SecretUndefine is the go wrapper for REMOTE_PROC_SECRET_UNDEFINE. +func (l *Libvirt) SecretUndefine(OptSecret Secret) (err error) { + var buf []byte + + args := SecretUndefineArgs { + OptSecret: OptSecret, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(146, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// SecretLookupByUsage is the go wrapper for REMOTE_PROC_SECRET_LOOKUP_BY_USAGE. +func (l *Libvirt) SecretLookupByUsage(UsageType int32, UsageID string) (rOptSecret Secret, err error) { + var buf []byte + + args := SecretLookupByUsageArgs { + UsageType: UsageType, + UsageID: UsageID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(147, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // OptSecret: Secret + _, err = dec.Decode(&rOptSecret) + if err != nil { + return + } + + return +} + +// DomainMigratePrepareTunnel is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL. +func (l *Libvirt) DomainMigratePrepareTunnel(Flags uint64, outStream io.Reader, Dname OptString, Resource uint64, DomXML string) (err error) { + var buf []byte + + args := DomainMigratePrepareTunnelArgs { + Flags: Flags, + Dname: Dname, + Resource: Resource, + DomXML: DomXML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(148, constants.Program, buf, outStream, nil) + if err != nil { + return + } + + return +} + +// ConnectIsSecure is the go wrapper for REMOTE_PROC_CONNECT_IS_SECURE. +func (l *Libvirt) ConnectIsSecure() (rSecure int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(149, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Secure: int32 + _, err = dec.Decode(&rSecure) + if err != nil { + return + } + + return +} + +// DomainIsActive is the go wrapper for REMOTE_PROC_DOMAIN_IS_ACTIVE. +func (l *Libvirt) DomainIsActive(Dom Domain) (rActive int32, err error) { + var buf []byte + + args := DomainIsActiveArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(150, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Active: int32 + _, err = dec.Decode(&rActive) + if err != nil { + return + } + + return +} + +// DomainIsPersistent is the go wrapper for REMOTE_PROC_DOMAIN_IS_PERSISTENT. +func (l *Libvirt) DomainIsPersistent(Dom Domain) (rPersistent int32, err error) { + var buf []byte + + args := DomainIsPersistentArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(151, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Persistent: int32 + _, err = dec.Decode(&rPersistent) + if err != nil { + return + } + + return +} + +// NetworkIsActive is the go wrapper for REMOTE_PROC_NETWORK_IS_ACTIVE. +func (l *Libvirt) NetworkIsActive(Net Network) (rActive int32, err error) { + var buf []byte + + args := NetworkIsActiveArgs { + Net: Net, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(152, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Active: int32 + _, err = dec.Decode(&rActive) + if err != nil { + return + } + + return +} + +// NetworkIsPersistent is the go wrapper for REMOTE_PROC_NETWORK_IS_PERSISTENT. +func (l *Libvirt) NetworkIsPersistent(Net Network) (rPersistent int32, err error) { + var buf []byte + + args := NetworkIsPersistentArgs { + Net: Net, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(153, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Persistent: int32 + _, err = dec.Decode(&rPersistent) + if err != nil { + return + } + + return +} + +// StoragePoolIsActive is the go wrapper for REMOTE_PROC_STORAGE_POOL_IS_ACTIVE. +func (l *Libvirt) StoragePoolIsActive(Pool StoragePool) (rActive int32, err error) { + var buf []byte + + args := StoragePoolIsActiveArgs { + Pool: Pool, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(154, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Active: int32 + _, err = dec.Decode(&rActive) + if err != nil { + return + } + + return +} + +// StoragePoolIsPersistent is the go wrapper for REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT. +func (l *Libvirt) StoragePoolIsPersistent(Pool StoragePool) (rPersistent int32, err error) { + var buf []byte + + args := StoragePoolIsPersistentArgs { + Pool: Pool, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(155, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Persistent: int32 + _, err = dec.Decode(&rPersistent) + if err != nil { + return + } + + return +} + +// InterfaceIsActive is the go wrapper for REMOTE_PROC_INTERFACE_IS_ACTIVE. +func (l *Libvirt) InterfaceIsActive(Iface Interface) (rActive int32, err error) { + var buf []byte + + args := InterfaceIsActiveArgs { + Iface: Iface, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(156, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Active: int32 + _, err = dec.Decode(&rActive) + if err != nil { + return + } + + return +} + +// ConnectGetLibVersion is the go wrapper for REMOTE_PROC_CONNECT_GET_LIB_VERSION. +func (l *Libvirt) ConnectGetLibVersion() (rLibVer uint64, err error) { + var buf []byte + + var r response + r, err = l.requestStream(157, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // LibVer: uint64 + _, err = dec.Decode(&rLibVer) + if err != nil { + return + } + + return +} + +// ConnectCompareCPU is the go wrapper for REMOTE_PROC_CONNECT_COMPARE_CPU. +func (l *Libvirt) ConnectCompareCPU(XML string, Flags ConnectCompareCPUFlags) (rResult int32, err error) { + var buf []byte + + args := ConnectCompareCPUArgs { + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(158, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Result: int32 + _, err = dec.Decode(&rResult) + if err != nil { + return + } + + return +} + +// DomainMemoryStats is the go wrapper for REMOTE_PROC_DOMAIN_MEMORY_STATS. +func (l *Libvirt) DomainMemoryStats(Dom Domain, MaxStats uint32, Flags uint32) (rStats []DomainMemoryStat, err error) { + var buf []byte + + args := DomainMemoryStatsArgs { + Dom: Dom, + MaxStats: MaxStats, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(159, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Stats: []DomainMemoryStat + _, err = dec.Decode(&rStats) + if err != nil { + return + } + + return +} + +// DomainAttachDeviceFlags is the go wrapper for REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS. +func (l *Libvirt) DomainAttachDeviceFlags(Dom Domain, XML string, Flags uint32) (err error) { + var buf []byte + + args := DomainAttachDeviceFlagsArgs { + Dom: Dom, + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(160, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainDetachDeviceFlags is the go wrapper for REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS. +func (l *Libvirt) DomainDetachDeviceFlags(Dom Domain, XML string, Flags uint32) (err error) { + var buf []byte + + args := DomainDetachDeviceFlagsArgs { + Dom: Dom, + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(161, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectBaselineCPU is the go wrapper for REMOTE_PROC_CONNECT_BASELINE_CPU. +func (l *Libvirt) ConnectBaselineCPU(XMLCPUs []string, Flags ConnectBaselineCPUFlags) (rCPU string, err error) { + var buf []byte + + args := ConnectBaselineCPUArgs { + XMLCPUs: XMLCPUs, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(162, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CPU: string + _, err = dec.Decode(&rCPU) + if err != nil { + return + } + + return +} + +// DomainGetJobInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_JOB_INFO. +func (l *Libvirt) DomainGetJobInfo(Dom Domain) (rType int32, rTimeElapsed uint64, rTimeRemaining uint64, rDataTotal uint64, rDataProcessed uint64, rDataRemaining uint64, rMemTotal uint64, rMemProcessed uint64, rMemRemaining uint64, rFileTotal uint64, rFileProcessed uint64, rFileRemaining uint64, err error) { + var buf []byte + + args := DomainGetJobInfoArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(163, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Type: int32 + _, err = dec.Decode(&rType) + if err != nil { + return + } + // TimeElapsed: uint64 + _, err = dec.Decode(&rTimeElapsed) + if err != nil { + return + } + // TimeRemaining: uint64 + _, err = dec.Decode(&rTimeRemaining) + if err != nil { + return + } + // DataTotal: uint64 + _, err = dec.Decode(&rDataTotal) + if err != nil { + return + } + // DataProcessed: uint64 + _, err = dec.Decode(&rDataProcessed) + if err != nil { + return + } + // DataRemaining: uint64 + _, err = dec.Decode(&rDataRemaining) + if err != nil { + return + } + // MemTotal: uint64 + _, err = dec.Decode(&rMemTotal) + if err != nil { + return + } + // MemProcessed: uint64 + _, err = dec.Decode(&rMemProcessed) + if err != nil { + return + } + // MemRemaining: uint64 + _, err = dec.Decode(&rMemRemaining) + if err != nil { + return + } + // FileTotal: uint64 + _, err = dec.Decode(&rFileTotal) + if err != nil { + return + } + // FileProcessed: uint64 + _, err = dec.Decode(&rFileProcessed) + if err != nil { + return + } + // FileRemaining: uint64 + _, err = dec.Decode(&rFileRemaining) + if err != nil { + return + } + + return +} + +// DomainAbortJob is the go wrapper for REMOTE_PROC_DOMAIN_ABORT_JOB. +func (l *Libvirt) DomainAbortJob(Dom Domain) (err error) { + var buf []byte + + args := DomainAbortJobArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(164, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StorageVolWipe is the go wrapper for REMOTE_PROC_STORAGE_VOL_WIPE. +func (l *Libvirt) StorageVolWipe(Vol StorageVol, Flags uint32) (err error) { + var buf []byte + + args := StorageVolWipeArgs { + Vol: Vol, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(165, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainMigrateSetMaxDowntime is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME. +func (l *Libvirt) DomainMigrateSetMaxDowntime(Dom Domain, Downtime uint64, Flags uint32) (err error) { + var buf []byte + + args := DomainMigrateSetMaxDowntimeArgs { + Dom: Dom, + Downtime: Downtime, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(166, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectDomainEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY. +func (l *Libvirt) ConnectDomainEventRegisterAny(EventID int32) (err error) { + var buf []byte + + args := ConnectDomainEventRegisterAnyArgs { + EventID: EventID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(167, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectDomainEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER_ANY. +func (l *Libvirt) ConnectDomainEventDeregisterAny(EventID int32) (err error) { + var buf []byte + + args := ConnectDomainEventDeregisterAnyArgs { + EventID: EventID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(168, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventReboot is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_REBOOT. +func (l *Libvirt) DomainEventReboot() (err error) { + var buf []byte + + + _, err = l.requestStream(169, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventRtcChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE. +func (l *Libvirt) DomainEventRtcChange() (err error) { + var buf []byte + + + _, err = l.requestStream(170, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventWatchdog is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_WATCHDOG. +func (l *Libvirt) DomainEventWatchdog() (err error) { + var buf []byte + + + _, err = l.requestStream(171, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventIOError is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_IO_ERROR. +func (l *Libvirt) DomainEventIOError() (err error) { + var buf []byte + + + _, err = l.requestStream(172, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventGraphics is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_GRAPHICS. +func (l *Libvirt) DomainEventGraphics() (err error) { + var buf []byte + + + _, err = l.requestStream(173, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainUpdateDeviceFlags is the go wrapper for REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS. +func (l *Libvirt) DomainUpdateDeviceFlags(Dom Domain, XML string, Flags DomainDeviceModifyFlags) (err error) { + var buf []byte + + args := DomainUpdateDeviceFlagsArgs { + Dom: Dom, + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(174, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NwfilterLookupByName is the go wrapper for REMOTE_PROC_NWFILTER_LOOKUP_BY_NAME. +func (l *Libvirt) NwfilterLookupByName(Name string) (rOptNwfilter Nwfilter, err error) { + var buf []byte + + args := NwfilterLookupByNameArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(175, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // OptNwfilter: Nwfilter + _, err = dec.Decode(&rOptNwfilter) + if err != nil { + return + } + + return +} + +// NwfilterLookupByUUID is the go wrapper for REMOTE_PROC_NWFILTER_LOOKUP_BY_UUID. +func (l *Libvirt) NwfilterLookupByUUID(UUID UUID) (rOptNwfilter Nwfilter, err error) { + var buf []byte + + args := NwfilterLookupByUUIDArgs { + UUID: UUID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(176, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // OptNwfilter: Nwfilter + _, err = dec.Decode(&rOptNwfilter) + if err != nil { + return + } + + return +} + +// NwfilterGetXMLDesc is the go wrapper for REMOTE_PROC_NWFILTER_GET_XML_DESC. +func (l *Libvirt) NwfilterGetXMLDesc(OptNwfilter Nwfilter, Flags uint32) (rXML string, err error) { + var buf []byte + + args := NwfilterGetXMLDescArgs { + OptNwfilter: OptNwfilter, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(177, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// ConnectNumOfNwfilters is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_NWFILTERS. +func (l *Libvirt) ConnectNumOfNwfilters() (rNum int32, err error) { + var buf []byte + + var r response + r, err = l.requestStream(178, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// ConnectListNwfilters is the go wrapper for REMOTE_PROC_CONNECT_LIST_NWFILTERS. +func (l *Libvirt) ConnectListNwfilters(Maxnames int32) (rNames []string, err error) { + var buf []byte + + args := ConnectListNwfiltersArgs { + Maxnames: Maxnames, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(179, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// NwfilterDefineXML is the go wrapper for REMOTE_PROC_NWFILTER_DEFINE_XML. +func (l *Libvirt) NwfilterDefineXML(XML string) (rOptNwfilter Nwfilter, err error) { + var buf []byte + + args := NwfilterDefineXMLArgs { + XML: XML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(180, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // OptNwfilter: Nwfilter + _, err = dec.Decode(&rOptNwfilter) + if err != nil { + return + } + + return +} + +// NwfilterUndefine is the go wrapper for REMOTE_PROC_NWFILTER_UNDEFINE. +func (l *Libvirt) NwfilterUndefine(OptNwfilter Nwfilter) (err error) { + var buf []byte + + args := NwfilterUndefineArgs { + OptNwfilter: OptNwfilter, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(181, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainManagedSave is the go wrapper for REMOTE_PROC_DOMAIN_MANAGED_SAVE. +func (l *Libvirt) DomainManagedSave(Dom Domain, Flags uint32) (err error) { + var buf []byte + + args := DomainManagedSaveArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(182, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainHasManagedSaveImage is the go wrapper for REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE. +func (l *Libvirt) DomainHasManagedSaveImage(Dom Domain, Flags uint32) (rResult int32, err error) { + var buf []byte + + args := DomainHasManagedSaveImageArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(183, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Result: int32 + _, err = dec.Decode(&rResult) + if err != nil { + return + } + + return +} + +// DomainManagedSaveRemove is the go wrapper for REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE. +func (l *Libvirt) DomainManagedSaveRemove(Dom Domain, Flags uint32) (err error) { + var buf []byte + + args := DomainManagedSaveRemoveArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(184, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSnapshotCreateXML is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML. +func (l *Libvirt) DomainSnapshotCreateXML(Dom Domain, XMLDesc string, Flags uint32) (rSnap DomainSnapshot, err error) { + var buf []byte + + args := DomainSnapshotCreateXMLArgs { + Dom: Dom, + XMLDesc: XMLDesc, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(185, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Snap: DomainSnapshot + _, err = dec.Decode(&rSnap) + if err != nil { + return + } + + return +} + +// DomainSnapshotGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_GET_XML_DESC. +func (l *Libvirt) DomainSnapshotGetXMLDesc(Snap DomainSnapshot, Flags uint32) (rXML string, err error) { + var buf []byte + + args := DomainSnapshotGetXMLDescArgs { + Snap: Snap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(186, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// DomainSnapshotNum is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_NUM. +func (l *Libvirt) DomainSnapshotNum(Dom Domain, Flags uint32) (rNum int32, err error) { + var buf []byte + + args := DomainSnapshotNumArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(187, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// DomainSnapshotListNames is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_NAMES. +func (l *Libvirt) DomainSnapshotListNames(Dom Domain, Maxnames int32, Flags uint32) (rNames []string, err error) { + var buf []byte + + args := DomainSnapshotListNamesArgs { + Dom: Dom, + Maxnames: Maxnames, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(188, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// DomainSnapshotLookupByName is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_LOOKUP_BY_NAME. +func (l *Libvirt) DomainSnapshotLookupByName(Dom Domain, Name string, Flags uint32) (rSnap DomainSnapshot, err error) { + var buf []byte + + args := DomainSnapshotLookupByNameArgs { + Dom: Dom, + Name: Name, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(189, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Snap: DomainSnapshot + _, err = dec.Decode(&rSnap) + if err != nil { + return + } + + return +} + +// DomainHasCurrentSnapshot is the go wrapper for REMOTE_PROC_DOMAIN_HAS_CURRENT_SNAPSHOT. +func (l *Libvirt) DomainHasCurrentSnapshot(Dom Domain, Flags uint32) (rResult int32, err error) { + var buf []byte + + args := DomainHasCurrentSnapshotArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(190, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Result: int32 + _, err = dec.Decode(&rResult) + if err != nil { + return + } + + return +} + +// DomainSnapshotCurrent is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT. +func (l *Libvirt) DomainSnapshotCurrent(Dom Domain, Flags uint32) (rSnap DomainSnapshot, err error) { + var buf []byte + + args := DomainSnapshotCurrentArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(191, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Snap: DomainSnapshot + _, err = dec.Decode(&rSnap) + if err != nil { + return + } + + return +} + +// DomainRevertToSnapshot is the go wrapper for REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT. +func (l *Libvirt) DomainRevertToSnapshot(Snap DomainSnapshot, Flags uint32) (err error) { + var buf []byte + + args := DomainRevertToSnapshotArgs { + Snap: Snap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(192, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSnapshotDelete is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE. +func (l *Libvirt) DomainSnapshotDelete(Snap DomainSnapshot, Flags DomainSnapshotDeleteFlags) (err error) { + var buf []byte + + args := DomainSnapshotDeleteArgs { + Snap: Snap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(193, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetBlockInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_BLOCK_INFO. +func (l *Libvirt) DomainGetBlockInfo(Dom Domain, Path string, Flags uint32) (rAllocation uint64, rCapacity uint64, rPhysical uint64, err error) { + var buf []byte + + args := DomainGetBlockInfoArgs { + Dom: Dom, + Path: Path, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(194, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Allocation: uint64 + _, err = dec.Decode(&rAllocation) + if err != nil { + return + } + // Capacity: uint64 + _, err = dec.Decode(&rCapacity) + if err != nil { + return + } + // Physical: uint64 + _, err = dec.Decode(&rPhysical) + if err != nil { + return + } + + return +} + +// DomainEventIOErrorReason is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON. +func (l *Libvirt) DomainEventIOErrorReason() (err error) { + var buf []byte + + + _, err = l.requestStream(195, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainCreateWithFlags is the go wrapper for REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS. +func (l *Libvirt) DomainCreateWithFlags(Dom Domain, Flags uint32) (rDom Domain, err error) { + var buf []byte + + args := DomainCreateWithFlagsArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(196, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + + return +} + +// DomainSetMemoryParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS. +func (l *Libvirt) DomainSetMemoryParameters(Dom Domain, Params []TypedParam, Flags uint32) (err error) { + var buf []byte + + args := DomainSetMemoryParametersArgs { + Dom: Dom, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(197, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetMemoryParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS. +func (l *Libvirt) DomainGetMemoryParameters(Dom Domain, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { + var buf []byte + + args := DomainGetMemoryParametersArgs { + Dom: Dom, + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(198, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainSetVcpusFlags is the go wrapper for REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS. +func (l *Libvirt) DomainSetVcpusFlags(Dom Domain, Nvcpus uint32, Flags uint32) (err error) { + var buf []byte + + args := DomainSetVcpusFlagsArgs { + Dom: Dom, + Nvcpus: Nvcpus, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(199, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetVcpusFlags is the go wrapper for REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS. +func (l *Libvirt) DomainGetVcpusFlags(Dom Domain, Flags uint32) (rNum int32, err error) { + var buf []byte + + args := DomainGetVcpusFlagsArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(200, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// DomainOpenConsole is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_CONSOLE. +func (l *Libvirt) DomainOpenConsole(Dom Domain, DevName OptString, inStream io.Writer, Flags uint32) (err error) { + var buf []byte + + args := DomainOpenConsoleArgs { + Dom: Dom, + DevName: DevName, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(201, constants.Program, buf, nil, inStream) + if err != nil { + return + } + + return +} + +// DomainIsUpdated is the go wrapper for REMOTE_PROC_DOMAIN_IS_UPDATED. +func (l *Libvirt) DomainIsUpdated(Dom Domain) (rUpdated int32, err error) { + var buf []byte + + args := DomainIsUpdatedArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(202, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Updated: int32 + _, err = dec.Decode(&rUpdated) + if err != nil { + return + } + + return +} + +// ConnectGetSysinfo is the go wrapper for REMOTE_PROC_CONNECT_GET_SYSINFO. +func (l *Libvirt) ConnectGetSysinfo(Flags uint32) (rSysinfo string, err error) { + var buf []byte + + args := ConnectGetSysinfoArgs { + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(203, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Sysinfo: string + _, err = dec.Decode(&rSysinfo) + if err != nil { + return + } + + return +} + +// DomainSetMemoryFlags is the go wrapper for REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS. +func (l *Libvirt) DomainSetMemoryFlags(Dom Domain, Memory uint64, Flags uint32) (err error) { + var buf []byte + + args := DomainSetMemoryFlagsArgs { + Dom: Dom, + Memory: Memory, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(204, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetBlkioParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS. +func (l *Libvirt) DomainSetBlkioParameters(Dom Domain, Params []TypedParam, Flags uint32) (err error) { + var buf []byte + + args := DomainSetBlkioParametersArgs { + Dom: Dom, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(205, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetBlkioParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS. +func (l *Libvirt) DomainGetBlkioParameters(Dom Domain, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { + var buf []byte + + args := DomainGetBlkioParametersArgs { + Dom: Dom, + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(206, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainMigrateSetMaxSpeed is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED. +func (l *Libvirt) DomainMigrateSetMaxSpeed(Dom Domain, Bandwidth uint64, Flags uint32) (err error) { + var buf []byte + + args := DomainMigrateSetMaxSpeedArgs { + Dom: Dom, + Bandwidth: Bandwidth, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(207, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StorageVolUpload is the go wrapper for REMOTE_PROC_STORAGE_VOL_UPLOAD. +func (l *Libvirt) StorageVolUpload(Vol StorageVol, outStream io.Reader, Offset uint64, Length uint64, Flags StorageVolUploadFlags) (err error) { + var buf []byte + + args := StorageVolUploadArgs { + Vol: Vol, + Offset: Offset, + Length: Length, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(208, constants.Program, buf, outStream, nil) + if err != nil { + return + } + + return +} + +// StorageVolDownload is the go wrapper for REMOTE_PROC_STORAGE_VOL_DOWNLOAD. +func (l *Libvirt) StorageVolDownload(Vol StorageVol, inStream io.Writer, Offset uint64, Length uint64, Flags StorageVolDownloadFlags) (err error) { + var buf []byte + + args := StorageVolDownloadArgs { + Vol: Vol, + Offset: Offset, + Length: Length, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(209, constants.Program, buf, nil, inStream) + if err != nil { + return + } + + return +} + +// DomainInjectNmi is the go wrapper for REMOTE_PROC_DOMAIN_INJECT_NMI. +func (l *Libvirt) DomainInjectNmi(Dom Domain, Flags uint32) (err error) { + var buf []byte + + args := DomainInjectNmiArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(210, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainScreenshot is the go wrapper for REMOTE_PROC_DOMAIN_SCREENSHOT. +func (l *Libvirt) DomainScreenshot(Dom Domain, inStream io.Writer, Screen uint32, Flags uint32) (rMime OptString, err error) { + var buf []byte + + args := DomainScreenshotArgs { + Dom: Dom, + Screen: Screen, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(211, constants.Program, buf, nil, inStream) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Mime: OptString + _, err = dec.Decode(&rMime) + if err != nil { + return + } + + return +} + +// DomainGetState is the go wrapper for REMOTE_PROC_DOMAIN_GET_STATE. +func (l *Libvirt) DomainGetState(Dom Domain, Flags uint32) (rState int32, rReason int32, err error) { + var buf []byte + + args := DomainGetStateArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(212, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // State: int32 + _, err = dec.Decode(&rState) + if err != nil { + return + } + // Reason: int32 + _, err = dec.Decode(&rReason) + if err != nil { + return + } + + return +} + +// DomainMigrateBegin3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3. +func (l *Libvirt) DomainMigrateBegin3(Dom Domain, Xmlin OptString, Flags uint64, Dname OptString, Resource uint64) (rCookieOut []byte, rXML string, err error) { + var buf []byte + + args := DomainMigrateBegin3Args { + Dom: Dom, + Xmlin: Xmlin, + Flags: Flags, + Dname: Dname, + Resource: Resource, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(213, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// DomainMigratePrepare3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3. +func (l *Libvirt) DomainMigratePrepare3(CookieIn []byte, UriIn OptString, Flags uint64, Dname OptString, Resource uint64, DomXML string) (rCookieOut []byte, rUriOut OptString, err error) { + var buf []byte + + args := DomainMigratePrepare3Args { + CookieIn: CookieIn, + UriIn: UriIn, + Flags: Flags, + Dname: Dname, + Resource: Resource, + DomXML: DomXML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(214, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + // UriOut: OptString + _, err = dec.Decode(&rUriOut) + if err != nil { + return + } + + return +} + +// DomainMigratePrepareTunnel3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3. +func (l *Libvirt) DomainMigratePrepareTunnel3(CookieIn []byte, outStream io.Reader, Flags uint64, Dname OptString, Resource uint64, DomXML string) (rCookieOut []byte, err error) { + var buf []byte + + args := DomainMigratePrepareTunnel3Args { + CookieIn: CookieIn, + Flags: Flags, + Dname: Dname, + Resource: Resource, + DomXML: DomXML, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(215, constants.Program, buf, outStream, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + + return +} + +// DomainMigratePerform3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3. +func (l *Libvirt) DomainMigratePerform3(Dom Domain, Xmlin OptString, CookieIn []byte, Dconnuri OptString, Uri OptString, Flags uint64, Dname OptString, Resource uint64) (rCookieOut []byte, err error) { + var buf []byte + + args := DomainMigratePerform3Args { + Dom: Dom, + Xmlin: Xmlin, + CookieIn: CookieIn, + Dconnuri: Dconnuri, + Uri: Uri, + Flags: Flags, + Dname: Dname, + Resource: Resource, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(216, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + + return +} + +// DomainMigrateFinish3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_FINISH3. +func (l *Libvirt) DomainMigrateFinish3(Dname string, CookieIn []byte, Dconnuri OptString, Uri OptString, Flags uint64, Cancelled int32) (rDom Domain, rCookieOut []byte, err error) { + var buf []byte + + args := DomainMigrateFinish3Args { + Dname: Dname, + CookieIn: CookieIn, + Dconnuri: Dconnuri, + Uri: Uri, + Flags: Flags, + Cancelled: Cancelled, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(217, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + + return +} + +// DomainMigrateConfirm3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3. +func (l *Libvirt) DomainMigrateConfirm3(Dom Domain, CookieIn []byte, Flags uint64, Cancelled int32) (err error) { + var buf []byte + + args := DomainMigrateConfirm3Args { + Dom: Dom, + CookieIn: CookieIn, + Flags: Flags, + Cancelled: Cancelled, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(218, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetSchedulerParametersFlags is the go wrapper for REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS. +func (l *Libvirt) DomainSetSchedulerParametersFlags(Dom Domain, Params []TypedParam, Flags uint32) (err error) { + var buf []byte + + args := DomainSetSchedulerParametersFlagsArgs { + Dom: Dom, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(219, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// InterfaceChangeBegin is the go wrapper for REMOTE_PROC_INTERFACE_CHANGE_BEGIN. +func (l *Libvirt) InterfaceChangeBegin(Flags uint32) (err error) { + var buf []byte + + args := InterfaceChangeBeginArgs { + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(220, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// InterfaceChangeCommit is the go wrapper for REMOTE_PROC_INTERFACE_CHANGE_COMMIT. +func (l *Libvirt) InterfaceChangeCommit(Flags uint32) (err error) { + var buf []byte + + args := InterfaceChangeCommitArgs { + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(221, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// InterfaceChangeRollback is the go wrapper for REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK. +func (l *Libvirt) InterfaceChangeRollback(Flags uint32) (err error) { + var buf []byte + + args := InterfaceChangeRollbackArgs { + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(222, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetSchedulerParametersFlags is the go wrapper for REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS. +func (l *Libvirt) DomainGetSchedulerParametersFlags(Dom Domain, Nparams int32, Flags uint32) (rParams []TypedParam, err error) { + var buf []byte + + args := DomainGetSchedulerParametersFlagsArgs { + Dom: Dom, + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(223, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + + return +} + +// DomainEventControlError is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR. +func (l *Libvirt) DomainEventControlError() (err error) { + var buf []byte + + + _, err = l.requestStream(224, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainPinVcpuFlags is the go wrapper for REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS. +func (l *Libvirt) DomainPinVcpuFlags(Dom Domain, Vcpu uint32, Cpumap []byte, Flags uint32) (err error) { + var buf []byte + + args := DomainPinVcpuFlagsArgs { + Dom: Dom, + Vcpu: Vcpu, + Cpumap: Cpumap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(225, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSendKey is the go wrapper for REMOTE_PROC_DOMAIN_SEND_KEY. +func (l *Libvirt) DomainSendKey(Dom Domain, Codeset uint32, Holdtime uint32, Keycodes []uint32, Flags uint32) (err error) { + var buf []byte + + args := DomainSendKeyArgs { + Dom: Dom, + Codeset: Codeset, + Holdtime: Holdtime, + Keycodes: Keycodes, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(226, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeGetCPUStats is the go wrapper for REMOTE_PROC_NODE_GET_CPU_STATS. +func (l *Libvirt) NodeGetCPUStats(CPUNum int32, Nparams int32, Flags uint32) (rParams []NodeGetCPUStats, rNparams int32, err error) { + var buf []byte + + args := NodeGetCPUStatsArgs { + CPUNum: CPUNum, + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(227, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []NodeGetCPUStats + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// NodeGetMemoryStats is the go wrapper for REMOTE_PROC_NODE_GET_MEMORY_STATS. +func (l *Libvirt) NodeGetMemoryStats(Nparams int32, CellNum int32, Flags uint32) (rParams []NodeGetMemoryStats, rNparams int32, err error) { + var buf []byte + + args := NodeGetMemoryStatsArgs { + Nparams: Nparams, + CellNum: CellNum, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(228, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []NodeGetMemoryStats + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainGetControlInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_CONTROL_INFO. +func (l *Libvirt) DomainGetControlInfo(Dom Domain, Flags uint32) (rState uint32, rDetails uint32, rStateTime uint64, err error) { + var buf []byte + + args := DomainGetControlInfoArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(229, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // State: uint32 + _, err = dec.Decode(&rState) + if err != nil { + return + } + // Details: uint32 + _, err = dec.Decode(&rDetails) + if err != nil { + return + } + // StateTime: uint64 + _, err = dec.Decode(&rStateTime) + if err != nil { + return + } + + return +} + +// DomainGetVcpuPinInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO. +func (l *Libvirt) DomainGetVcpuPinInfo(Dom Domain, Ncpumaps int32, Maplen int32, Flags uint32) (rCpumaps []byte, rNum int32, err error) { + var buf []byte + + args := DomainGetVcpuPinInfoArgs { + Dom: Dom, + Ncpumaps: Ncpumaps, + Maplen: Maplen, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(230, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Cpumaps: []byte + _, err = dec.Decode(&rCpumaps) + if err != nil { + return + } + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// DomainUndefineFlags is the go wrapper for REMOTE_PROC_DOMAIN_UNDEFINE_FLAGS. +func (l *Libvirt) DomainUndefineFlags(Dom Domain, Flags DomainUndefineFlagsValues) (err error) { + var buf []byte + + args := DomainUndefineFlagsArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(231, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSaveFlags is the go wrapper for REMOTE_PROC_DOMAIN_SAVE_FLAGS. +func (l *Libvirt) DomainSaveFlags(Dom Domain, To string, Dxml OptString, Flags uint32) (err error) { + var buf []byte + + args := DomainSaveFlagsArgs { + Dom: Dom, + To: To, + Dxml: Dxml, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(232, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainRestoreFlags is the go wrapper for REMOTE_PROC_DOMAIN_RESTORE_FLAGS. +func (l *Libvirt) DomainRestoreFlags(From string, Dxml OptString, Flags uint32) (err error) { + var buf []byte + + args := DomainRestoreFlagsArgs { + From: From, + Dxml: Dxml, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(233, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainDestroyFlags is the go wrapper for REMOTE_PROC_DOMAIN_DESTROY_FLAGS. +func (l *Libvirt) DomainDestroyFlags(Dom Domain, Flags DomainDestroyFlagsValues) (err error) { + var buf []byte + + args := DomainDestroyFlagsArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(234, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSaveImageGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC. +func (l *Libvirt) DomainSaveImageGetXMLDesc(File string, Flags uint32) (rXML string, err error) { + var buf []byte + + args := DomainSaveImageGetXMLDescArgs { + File: File, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(235, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// DomainSaveImageDefineXML is the go wrapper for REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML. +func (l *Libvirt) DomainSaveImageDefineXML(File string, Dxml string, Flags uint32) (err error) { + var buf []byte + + args := DomainSaveImageDefineXMLArgs { + File: File, + Dxml: Dxml, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(236, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainBlockJobAbort is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_JOB_ABORT. +func (l *Libvirt) DomainBlockJobAbort(Dom Domain, Path string, Flags DomainBlockJobAbortFlags) (err error) { + var buf []byte + + args := DomainBlockJobAbortArgs { + Dom: Dom, + Path: Path, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(237, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetBlockJobInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO. +func (l *Libvirt) DomainGetBlockJobInfo(Dom Domain, Path string, Flags uint32) (rFound int32, rType int32, rBandwidth uint64, rCur uint64, rEnd uint64, err error) { + var buf []byte + + args := DomainGetBlockJobInfoArgs { + Dom: Dom, + Path: Path, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(238, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Found: int32 + _, err = dec.Decode(&rFound) + if err != nil { + return + } + // Type: int32 + _, err = dec.Decode(&rType) + if err != nil { + return + } + // Bandwidth: uint64 + _, err = dec.Decode(&rBandwidth) + if err != nil { + return + } + // Cur: uint64 + _, err = dec.Decode(&rCur) + if err != nil { + return + } + // End: uint64 + _, err = dec.Decode(&rEnd) + if err != nil { + return + } + + return +} + +// DomainBlockJobSetSpeed is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_JOB_SET_SPEED. +func (l *Libvirt) DomainBlockJobSetSpeed(Dom Domain, Path string, Bandwidth uint64, Flags DomainBlockJobSetSpeedFlags) (err error) { + var buf []byte + + args := DomainBlockJobSetSpeedArgs { + Dom: Dom, + Path: Path, + Bandwidth: Bandwidth, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(239, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainBlockPull is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_PULL. +func (l *Libvirt) DomainBlockPull(Dom Domain, Path string, Bandwidth uint64, Flags DomainBlockPullFlags) (err error) { + var buf []byte + + args := DomainBlockPullArgs { + Dom: Dom, + Path: Path, + Bandwidth: Bandwidth, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(240, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventBlockJob is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB. +func (l *Libvirt) DomainEventBlockJob() (err error) { + var buf []byte + + + _, err = l.requestStream(241, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainMigrateGetMaxSpeed is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED. +func (l *Libvirt) DomainMigrateGetMaxSpeed(Dom Domain, Flags uint32) (rBandwidth uint64, err error) { + var buf []byte + + args := DomainMigrateGetMaxSpeedArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(242, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Bandwidth: uint64 + _, err = dec.Decode(&rBandwidth) + if err != nil { + return + } + + return +} + +// DomainBlockStatsFlags is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS. +func (l *Libvirt) DomainBlockStatsFlags(Dom Domain, Path string, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { + var buf []byte + + args := DomainBlockStatsFlagsArgs { + Dom: Dom, + Path: Path, + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(243, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainSnapshotGetParent is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT. +func (l *Libvirt) DomainSnapshotGetParent(Snap DomainSnapshot, Flags uint32) (rSnap DomainSnapshot, err error) { + var buf []byte + + args := DomainSnapshotGetParentArgs { + Snap: Snap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(244, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Snap: DomainSnapshot + _, err = dec.Decode(&rSnap) + if err != nil { + return + } + + return +} + +// DomainReset is the go wrapper for REMOTE_PROC_DOMAIN_RESET. +func (l *Libvirt) DomainReset(Dom Domain, Flags uint32) (err error) { + var buf []byte + + args := DomainResetArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(245, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSnapshotNumChildren is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_NUM_CHILDREN. +func (l *Libvirt) DomainSnapshotNumChildren(Snap DomainSnapshot, Flags uint32) (rNum int32, err error) { + var buf []byte + + args := DomainSnapshotNumChildrenArgs { + Snap: Snap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(246, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Num: int32 + _, err = dec.Decode(&rNum) + if err != nil { + return + } + + return +} + +// DomainSnapshotListChildrenNames is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_CHILDREN_NAMES. +func (l *Libvirt) DomainSnapshotListChildrenNames(Snap DomainSnapshot, Maxnames int32, Flags uint32) (rNames []string, err error) { + var buf []byte + + args := DomainSnapshotListChildrenNamesArgs { + Snap: Snap, + Maxnames: Maxnames, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(247, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Names: []string + _, err = dec.Decode(&rNames) + if err != nil { + return + } + + return +} + +// DomainEventDiskChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE. +func (l *Libvirt) DomainEventDiskChange() (err error) { + var buf []byte + + + _, err = l.requestStream(248, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainOpenGraphics is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_GRAPHICS. +func (l *Libvirt) DomainOpenGraphics(Dom Domain, Idx uint32, Flags DomainOpenGraphicsFlags) (err error) { + var buf []byte + + args := DomainOpenGraphicsArgs { + Dom: Dom, + Idx: Idx, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(249, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeSuspendForDuration is the go wrapper for REMOTE_PROC_NODE_SUSPEND_FOR_DURATION. +func (l *Libvirt) NodeSuspendForDuration(Target uint32, Duration uint64, Flags uint32) (err error) { + var buf []byte + + args := NodeSuspendForDurationArgs { + Target: Target, + Duration: Duration, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(250, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainBlockResize is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_RESIZE. +func (l *Libvirt) DomainBlockResize(Dom Domain, Disk string, Size uint64, Flags DomainBlockResizeFlags) (err error) { + var buf []byte + + args := DomainBlockResizeArgs { + Dom: Dom, + Disk: Disk, + Size: Size, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(251, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetBlockIOTune is the go wrapper for REMOTE_PROC_DOMAIN_SET_BLOCK_IO_TUNE. +func (l *Libvirt) DomainSetBlockIOTune(Dom Domain, Disk string, Params []TypedParam, Flags uint32) (err error) { + var buf []byte + + args := DomainSetBlockIOTuneArgs { + Dom: Dom, + Disk: Disk, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(252, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetBlockIOTune is the go wrapper for REMOTE_PROC_DOMAIN_GET_BLOCK_IO_TUNE. +func (l *Libvirt) DomainGetBlockIOTune(Dom Domain, Disk OptString, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { + var buf []byte + + args := DomainGetBlockIOTuneArgs { + Dom: Dom, + Disk: Disk, + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(253, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainSetNumaParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_NUMA_PARAMETERS. +func (l *Libvirt) DomainSetNumaParameters(Dom Domain, Params []TypedParam, Flags uint32) (err error) { + var buf []byte + + args := DomainSetNumaParametersArgs { + Dom: Dom, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(254, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetNumaParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS. +func (l *Libvirt) DomainGetNumaParameters(Dom Domain, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { + var buf []byte + + args := DomainGetNumaParametersArgs { + Dom: Dom, + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(255, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainSetInterfaceParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_INTERFACE_PARAMETERS. +func (l *Libvirt) DomainSetInterfaceParameters(Dom Domain, Device string, Params []TypedParam, Flags uint32) (err error) { + var buf []byte + + args := DomainSetInterfaceParametersArgs { + Dom: Dom, + Device: Device, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(256, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetInterfaceParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS. +func (l *Libvirt) DomainGetInterfaceParameters(Dom Domain, Device string, Nparams int32, Flags DomainModificationImpact) (rParams []TypedParam, rNparams int32, err error) { + var buf []byte + + args := DomainGetInterfaceParametersArgs { + Dom: Dom, + Device: Device, + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(257, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainShutdownFlags is the go wrapper for REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS. +func (l *Libvirt) DomainShutdownFlags(Dom Domain, Flags DomainShutdownFlagValues) (err error) { + var buf []byte + + args := DomainShutdownFlagsArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(258, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StorageVolWipePattern is the go wrapper for REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN. +func (l *Libvirt) StorageVolWipePattern(Vol StorageVol, Algorithm uint32, Flags uint32) (err error) { + var buf []byte + + args := StorageVolWipePatternArgs { + Vol: Vol, + Algorithm: Algorithm, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(259, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StorageVolResize is the go wrapper for REMOTE_PROC_STORAGE_VOL_RESIZE. +func (l *Libvirt) StorageVolResize(Vol StorageVol, Capacity uint64, Flags StorageVolResizeFlags) (err error) { + var buf []byte + + args := StorageVolResizeArgs { + Vol: Vol, + Capacity: Capacity, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(260, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainPmSuspendForDuration is the go wrapper for REMOTE_PROC_DOMAIN_PM_SUSPEND_FOR_DURATION. +func (l *Libvirt) DomainPmSuspendForDuration(Dom Domain, Target uint32, Duration uint64, Flags uint32) (err error) { + var buf []byte + + args := DomainPmSuspendForDurationArgs { + Dom: Dom, + Target: Target, + Duration: Duration, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(261, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetCPUStats is the go wrapper for REMOTE_PROC_DOMAIN_GET_CPU_STATS. +func (l *Libvirt) DomainGetCPUStats(Dom Domain, Nparams uint32, StartCPU int32, Ncpus uint32, Flags TypedParameterFlags) (rParams []TypedParam, rNparams int32, err error) { + var buf []byte + + args := DomainGetCPUStatsArgs { + Dom: Dom, + Nparams: Nparams, + StartCPU: StartCPU, + Ncpus: Ncpus, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(262, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainGetDiskErrors is the go wrapper for REMOTE_PROC_DOMAIN_GET_DISK_ERRORS. +func (l *Libvirt) DomainGetDiskErrors(Dom Domain, Maxerrors uint32, Flags uint32) (rErrors []DomainDiskError, rNerrors int32, err error) { + var buf []byte + + args := DomainGetDiskErrorsArgs { + Dom: Dom, + Maxerrors: Maxerrors, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(263, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Errors: []DomainDiskError + _, err = dec.Decode(&rErrors) + if err != nil { + return + } + // Nerrors: int32 + _, err = dec.Decode(&rNerrors) + if err != nil { + return + } + + return +} + +// DomainSetMetadata is the go wrapper for REMOTE_PROC_DOMAIN_SET_METADATA. +func (l *Libvirt) DomainSetMetadata(Dom Domain, Type int32, Metadata OptString, Key OptString, Uri OptString, Flags DomainModificationImpact) (err error) { + var buf []byte + + args := DomainSetMetadataArgs { + Dom: Dom, + Type: Type, + Metadata: Metadata, + Key: Key, + Uri: Uri, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(264, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetMetadata is the go wrapper for REMOTE_PROC_DOMAIN_GET_METADATA. +func (l *Libvirt) DomainGetMetadata(Dom Domain, Type int32, Uri OptString, Flags DomainModificationImpact) (rMetadata string, err error) { + var buf []byte + + args := DomainGetMetadataArgs { + Dom: Dom, + Type: Type, + Uri: Uri, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(265, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Metadata: string + _, err = dec.Decode(&rMetadata) + if err != nil { + return + } + + return +} + +// DomainBlockRebase is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_REBASE. +func (l *Libvirt) DomainBlockRebase(Dom Domain, Path string, Base OptString, Bandwidth uint64, Flags DomainBlockRebaseFlags) (err error) { + var buf []byte + + args := DomainBlockRebaseArgs { + Dom: Dom, + Path: Path, + Base: Base, + Bandwidth: Bandwidth, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(266, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainPmWakeup is the go wrapper for REMOTE_PROC_DOMAIN_PM_WAKEUP. +func (l *Libvirt) DomainPmWakeup(Dom Domain, Flags uint32) (err error) { + var buf []byte + + args := DomainPmWakeupArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(267, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventTrayChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE. +func (l *Libvirt) DomainEventTrayChange() (err error) { + var buf []byte + + + _, err = l.requestStream(268, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventPmwakeup is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP. +func (l *Libvirt) DomainEventPmwakeup() (err error) { + var buf []byte + + + _, err = l.requestStream(269, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventPmsuspend is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND. +func (l *Libvirt) DomainEventPmsuspend() (err error) { + var buf []byte + + + _, err = l.requestStream(270, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSnapshotIsCurrent is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_IS_CURRENT. +func (l *Libvirt) DomainSnapshotIsCurrent(Snap DomainSnapshot, Flags uint32) (rCurrent int32, err error) { + var buf []byte + + args := DomainSnapshotIsCurrentArgs { + Snap: Snap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(271, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Current: int32 + _, err = dec.Decode(&rCurrent) + if err != nil { + return + } + + return +} + +// DomainSnapshotHasMetadata is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA. +func (l *Libvirt) DomainSnapshotHasMetadata(Snap DomainSnapshot, Flags uint32) (rMetadata int32, err error) { + var buf []byte + + args := DomainSnapshotHasMetadataArgs { + Snap: Snap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(272, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Metadata: int32 + _, err = dec.Decode(&rMetadata) + if err != nil { + return + } + + return +} + +// ConnectListAllDomains is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS. +func (l *Libvirt) ConnectListAllDomains(NeedResults int32, Flags ConnectListAllDomainsFlags) (rDomains []Domain, rRet uint32, err error) { + var buf []byte + + args := ConnectListAllDomainsArgs { + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(273, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Domains: []Domain + _, err = dec.Decode(&rDomains) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// DomainListAllSnapshots is the go wrapper for REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS. +func (l *Libvirt) DomainListAllSnapshots(Dom Domain, NeedResults int32, Flags uint32) (rSnapshots []DomainSnapshot, rRet int32, err error) { + var buf []byte + + args := DomainListAllSnapshotsArgs { + Dom: Dom, + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(274, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Snapshots: []DomainSnapshot + _, err = dec.Decode(&rSnapshots) + if err != nil { + return + } + // Ret: int32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// DomainSnapshotListAllChildren is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN. +func (l *Libvirt) DomainSnapshotListAllChildren(Snapshot DomainSnapshot, NeedResults int32, Flags uint32) (rSnapshots []DomainSnapshot, rRet int32, err error) { + var buf []byte + + args := DomainSnapshotListAllChildrenArgs { + Snapshot: Snapshot, + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(275, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Snapshots: []DomainSnapshot + _, err = dec.Decode(&rSnapshots) + if err != nil { + return + } + // Ret: int32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// DomainEventBalloonChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE. +func (l *Libvirt) DomainEventBalloonChange() (err error) { + var buf []byte + + + _, err = l.requestStream(276, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetHostname is the go wrapper for REMOTE_PROC_DOMAIN_GET_HOSTNAME. +func (l *Libvirt) DomainGetHostname(Dom Domain, Flags uint32) (rHostname string, err error) { + var buf []byte + + args := DomainGetHostnameArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(277, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Hostname: string + _, err = dec.Decode(&rHostname) + if err != nil { + return + } + + return +} + +// DomainGetSecurityLabelList is the go wrapper for REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST. +func (l *Libvirt) DomainGetSecurityLabelList(Dom Domain) (rLabels []DomainGetSecurityLabelRet, rRet int32, err error) { + var buf []byte + + args := DomainGetSecurityLabelListArgs { + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(278, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Labels: []DomainGetSecurityLabelRet + _, err = dec.Decode(&rLabels) + if err != nil { + return + } + // Ret: int32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// DomainPinEmulator is the go wrapper for REMOTE_PROC_DOMAIN_PIN_EMULATOR. +func (l *Libvirt) DomainPinEmulator(Dom Domain, Cpumap []byte, Flags DomainModificationImpact) (err error) { + var buf []byte + + args := DomainPinEmulatorArgs { + Dom: Dom, + Cpumap: Cpumap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(279, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetEmulatorPinInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO. +func (l *Libvirt) DomainGetEmulatorPinInfo(Dom Domain, Maplen int32, Flags DomainModificationImpact) (rCpumaps []byte, rRet int32, err error) { + var buf []byte + + args := DomainGetEmulatorPinInfoArgs { + Dom: Dom, + Maplen: Maplen, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(280, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Cpumaps: []byte + _, err = dec.Decode(&rCpumaps) + if err != nil { + return + } + // Ret: int32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// ConnectListAllStoragePools is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS. +func (l *Libvirt) ConnectListAllStoragePools(NeedResults int32, Flags ConnectListAllStoragePoolsFlags) (rPools []StoragePool, rRet uint32, err error) { + var buf []byte + + args := ConnectListAllStoragePoolsArgs { + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(281, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Pools: []StoragePool + _, err = dec.Decode(&rPools) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// StoragePoolListAllVolumes is the go wrapper for REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES. +func (l *Libvirt) StoragePoolListAllVolumes(Pool StoragePool, NeedResults int32, Flags uint32) (rVols []StorageVol, rRet uint32, err error) { + var buf []byte + + args := StoragePoolListAllVolumesArgs { + Pool: Pool, + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(282, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Vols: []StorageVol + _, err = dec.Decode(&rVols) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// ConnectListAllNetworks is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS. +func (l *Libvirt) ConnectListAllNetworks(NeedResults int32, Flags ConnectListAllNetworksFlags) (rNets []Network, rRet uint32, err error) { + var buf []byte + + args := ConnectListAllNetworksArgs { + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(283, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Nets: []Network + _, err = dec.Decode(&rNets) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// ConnectListAllInterfaces is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES. +func (l *Libvirt) ConnectListAllInterfaces(NeedResults int32, Flags ConnectListAllInterfacesFlags) (rIfaces []Interface, rRet uint32, err error) { + var buf []byte + + args := ConnectListAllInterfacesArgs { + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(284, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Ifaces: []Interface + _, err = dec.Decode(&rIfaces) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// ConnectListAllNodeDevices is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_NODE_DEVICES. +func (l *Libvirt) ConnectListAllNodeDevices(NeedResults int32, Flags uint32) (rDevices []NodeDevice, rRet uint32, err error) { + var buf []byte + + args := ConnectListAllNodeDevicesArgs { + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(285, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Devices: []NodeDevice + _, err = dec.Decode(&rDevices) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// ConnectListAllNwfilters is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_NWFILTERS. +func (l *Libvirt) ConnectListAllNwfilters(NeedResults int32, Flags uint32) (rFilters []Nwfilter, rRet uint32, err error) { + var buf []byte + + args := ConnectListAllNwfiltersArgs { + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(286, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Filters: []Nwfilter + _, err = dec.Decode(&rFilters) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// ConnectListAllSecrets is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_SECRETS. +func (l *Libvirt) ConnectListAllSecrets(NeedResults int32, Flags ConnectListAllSecretsFlags) (rSecrets []Secret, rRet uint32, err error) { + var buf []byte + + args := ConnectListAllSecretsArgs { + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(287, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Secrets: []Secret + _, err = dec.Decode(&rSecrets) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// NodeSetMemoryParameters is the go wrapper for REMOTE_PROC_NODE_SET_MEMORY_PARAMETERS. +func (l *Libvirt) NodeSetMemoryParameters(Params []TypedParam, Flags uint32) (err error) { + var buf []byte + + args := NodeSetMemoryParametersArgs { + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(288, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeGetMemoryParameters is the go wrapper for REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS. +func (l *Libvirt) NodeGetMemoryParameters(Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { + var buf []byte + + args := NodeGetMemoryParametersArgs { + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(289, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainBlockCommit is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_COMMIT. +func (l *Libvirt) DomainBlockCommit(Dom Domain, Disk string, Base OptString, Top OptString, Bandwidth uint64, Flags DomainBlockCommitFlags) (err error) { + var buf []byte + + args := DomainBlockCommitArgs { + Dom: Dom, + Disk: Disk, + Base: Base, + Top: Top, + Bandwidth: Bandwidth, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(290, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NetworkUpdate is the go wrapper for REMOTE_PROC_NETWORK_UPDATE. +func (l *Libvirt) NetworkUpdate(Net Network, Command uint32, Section uint32, ParentIndex int32, XML string, Flags NetworkUpdateFlags) (err error) { + var buf []byte + + args := NetworkUpdateArgs { + Net: Net, + Command: Command, + Section: Section, + ParentIndex: ParentIndex, + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(291, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventPmsuspendDisk is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_DISK. +func (l *Libvirt) DomainEventPmsuspendDisk() (err error) { + var buf []byte + + + _, err = l.requestStream(292, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeGetCPUMap is the go wrapper for REMOTE_PROC_NODE_GET_CPU_MAP. +func (l *Libvirt) NodeGetCPUMap(NeedMap int32, NeedOnline int32, Flags uint32) (rCpumap []byte, rOnline uint32, rRet int32, err error) { + var buf []byte + + args := NodeGetCPUMapArgs { + NeedMap: NeedMap, + NeedOnline: NeedOnline, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(293, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Cpumap: []byte + _, err = dec.Decode(&rCpumap) + if err != nil { + return + } + // Online: uint32 + _, err = dec.Decode(&rOnline) + if err != nil { + return + } + // Ret: int32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// DomainFstrim is the go wrapper for REMOTE_PROC_DOMAIN_FSTRIM. +func (l *Libvirt) DomainFstrim(Dom Domain, MountPoint OptString, Minimum uint64, Flags uint32) (err error) { + var buf []byte + + args := DomainFstrimArgs { + Dom: Dom, + MountPoint: MountPoint, + Minimum: Minimum, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(294, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSendProcessSignal is the go wrapper for REMOTE_PROC_DOMAIN_SEND_PROCESS_SIGNAL. +func (l *Libvirt) DomainSendProcessSignal(Dom Domain, PidValue int64, Signum uint32, Flags uint32) (err error) { + var buf []byte + + args := DomainSendProcessSignalArgs { + Dom: Dom, + PidValue: PidValue, + Signum: Signum, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(295, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainOpenChannel is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_CHANNEL. +func (l *Libvirt) DomainOpenChannel(Dom Domain, Name OptString, inStream io.Writer, Flags DomainChannelFlags) (err error) { + var buf []byte + + args := DomainOpenChannelArgs { + Dom: Dom, + Name: Name, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(296, constants.Program, buf, nil, inStream) + if err != nil { + return + } + + return +} + +// NodeDeviceLookupScsiHostByWwn is the go wrapper for REMOTE_PROC_NODE_DEVICE_LOOKUP_SCSI_HOST_BY_WWN. +func (l *Libvirt) NodeDeviceLookupScsiHostByWwn(Wwnn string, Wwpn string, Flags uint32) (rDev NodeDevice, err error) { + var buf []byte + + args := NodeDeviceLookupScsiHostByWwnArgs { + Wwnn: Wwnn, + Wwpn: Wwpn, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(297, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dev: NodeDevice + _, err = dec.Decode(&rDev) + if err != nil { + return + } + + return +} + +// DomainGetJobStats is the go wrapper for REMOTE_PROC_DOMAIN_GET_JOB_STATS. +func (l *Libvirt) DomainGetJobStats(Dom Domain, Flags DomainGetJobStatsFlags) (rType int32, rParams []TypedParam, err error) { + var buf []byte + + args := DomainGetJobStatsArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(298, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Type: int32 + _, err = dec.Decode(&rType) + if err != nil { + return + } + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + + return +} + +// DomainMigrateGetCompressionCache is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_GET_COMPRESSION_CACHE. +func (l *Libvirt) DomainMigrateGetCompressionCache(Dom Domain, Flags uint32) (rCacheSize uint64, err error) { + var buf []byte + + args := DomainMigrateGetCompressionCacheArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(299, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CacheSize: uint64 + _, err = dec.Decode(&rCacheSize) + if err != nil { + return + } + + return +} + +// DomainMigrateSetCompressionCache is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_SET_COMPRESSION_CACHE. +func (l *Libvirt) DomainMigrateSetCompressionCache(Dom Domain, CacheSize uint64, Flags uint32) (err error) { + var buf []byte + + args := DomainMigrateSetCompressionCacheArgs { + Dom: Dom, + CacheSize: CacheSize, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(300, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeDeviceDetachFlags is the go wrapper for REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS. +func (l *Libvirt) NodeDeviceDetachFlags(Name string, DriverName OptString, Flags uint32) (err error) { + var buf []byte + + args := NodeDeviceDetachFlagsArgs { + Name: Name, + DriverName: DriverName, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(301, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainMigrateBegin3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3_PARAMS. +func (l *Libvirt) DomainMigrateBegin3Params(Dom Domain, Params []TypedParam, Flags uint32) (rCookieOut []byte, rXML string, err error) { + var buf []byte + + args := DomainMigrateBegin3ParamsArgs { + Dom: Dom, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(302, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// DomainMigratePrepare3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3_PARAMS. +func (l *Libvirt) DomainMigratePrepare3Params(Params []TypedParam, CookieIn []byte, Flags uint32) (rCookieOut []byte, rUriOut OptString, err error) { + var buf []byte + + args := DomainMigratePrepare3ParamsArgs { + Params: Params, + CookieIn: CookieIn, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(303, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + // UriOut: OptString + _, err = dec.Decode(&rUriOut) + if err != nil { + return + } + + return +} + +// DomainMigratePrepareTunnel3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS. +func (l *Libvirt) DomainMigratePrepareTunnel3Params(Params []TypedParam, CookieIn []byte, Flags uint32) (rCookieOut []byte, err error) { + var buf []byte + + args := DomainMigratePrepareTunnel3ParamsArgs { + Params: Params, + CookieIn: CookieIn, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(304, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + + return +} + +// DomainMigratePerform3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3_PARAMS. +func (l *Libvirt) DomainMigratePerform3Params(Dom Domain, Dconnuri OptString, Params []TypedParam, CookieIn []byte, Flags DomainMigrateFlags) (rCookieOut []byte, err error) { + var buf []byte + + args := DomainMigratePerform3ParamsArgs { + Dom: Dom, + Dconnuri: Dconnuri, + Params: Params, + CookieIn: CookieIn, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(305, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + + return +} + +// DomainMigrateFinish3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_FINISH3_PARAMS. +func (l *Libvirt) DomainMigrateFinish3Params(Params []TypedParam, CookieIn []byte, Flags uint32, Cancelled int32) (rDom Domain, rCookieOut []byte, err error) { + var buf []byte + + args := DomainMigrateFinish3ParamsArgs { + Params: Params, + CookieIn: CookieIn, + Flags: Flags, + Cancelled: Cancelled, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(306, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + // CookieOut: []byte + _, err = dec.Decode(&rCookieOut) + if err != nil { + return + } + + return +} + +// DomainMigrateConfirm3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3_PARAMS. +func (l *Libvirt) DomainMigrateConfirm3Params(Dom Domain, Params []TypedParam, CookieIn []byte, Flags uint32, Cancelled int32) (err error) { + var buf []byte + + args := DomainMigrateConfirm3ParamsArgs { + Dom: Dom, + Params: Params, + CookieIn: CookieIn, + Flags: Flags, + Cancelled: Cancelled, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(307, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetMemoryStatsPeriod is the go wrapper for REMOTE_PROC_DOMAIN_SET_MEMORY_STATS_PERIOD. +func (l *Libvirt) DomainSetMemoryStatsPeriod(Dom Domain, Period int32, Flags DomainMemoryModFlags) (err error) { + var buf []byte + + args := DomainSetMemoryStatsPeriodArgs { + Dom: Dom, + Period: Period, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(308, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainCreateXMLWithFiles is the go wrapper for REMOTE_PROC_DOMAIN_CREATE_XML_WITH_FILES. +func (l *Libvirt) DomainCreateXMLWithFiles(XMLDesc string, Flags DomainCreateFlags) (rDom Domain, err error) { + var buf []byte + + args := DomainCreateXMLWithFilesArgs { + XMLDesc: XMLDesc, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(309, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + + return +} + +// DomainCreateWithFiles is the go wrapper for REMOTE_PROC_DOMAIN_CREATE_WITH_FILES. +func (l *Libvirt) DomainCreateWithFiles(Dom Domain, Flags DomainCreateFlags) (rDom Domain, err error) { + var buf []byte + + args := DomainCreateWithFilesArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(310, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + + return +} + +// DomainEventDeviceRemoved is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED. +func (l *Libvirt) DomainEventDeviceRemoved() (err error) { + var buf []byte + + + _, err = l.requestStream(311, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectGetCPUModelNames is the go wrapper for REMOTE_PROC_CONNECT_GET_CPU_MODEL_NAMES. +func (l *Libvirt) ConnectGetCPUModelNames(Arch string, NeedResults int32, Flags uint32) (rModels []string, rRet int32, err error) { + var buf []byte + + args := ConnectGetCPUModelNamesArgs { + Arch: Arch, + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(312, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Models: []string + _, err = dec.Decode(&rModels) + if err != nil { + return + } + // Ret: int32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// ConnectNetworkEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_NETWORK_EVENT_REGISTER_ANY. +func (l *Libvirt) ConnectNetworkEventRegisterAny(EventID int32, Net OptNetwork) (rCallbackID int32, err error) { + var buf []byte + + args := ConnectNetworkEventRegisterAnyArgs { + EventID: EventID, + Net: Net, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(313, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CallbackID: int32 + _, err = dec.Decode(&rCallbackID) + if err != nil { + return + } + + return +} + +// ConnectNetworkEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_NETWORK_EVENT_DEREGISTER_ANY. +func (l *Libvirt) ConnectNetworkEventDeregisterAny(CallbackID int32) (err error) { + var buf []byte + + args := ConnectNetworkEventDeregisterAnyArgs { + CallbackID: CallbackID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(314, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NetworkEventLifecycle is the go wrapper for REMOTE_PROC_NETWORK_EVENT_LIFECYCLE. +func (l *Libvirt) NetworkEventLifecycle() (err error) { + var buf []byte + + + _, err = l.requestStream(315, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectDomainEventCallbackRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY. +func (l *Libvirt) ConnectDomainEventCallbackRegisterAny(EventID int32, Dom OptDomain) (rCallbackID int32, err error) { + var buf []byte + + args := ConnectDomainEventCallbackRegisterAnyArgs { + EventID: EventID, + Dom: Dom, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(316, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CallbackID: int32 + _, err = dec.Decode(&rCallbackID) + if err != nil { + return + } + + return +} + +// ConnectDomainEventCallbackDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY. +func (l *Libvirt) ConnectDomainEventCallbackDeregisterAny(CallbackID int32) (err error) { + var buf []byte + + args := ConnectDomainEventCallbackDeregisterAnyArgs { + CallbackID: CallbackID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(317, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackLifecycle is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE. +func (l *Libvirt) DomainEventCallbackLifecycle() (err error) { + var buf []byte + + + _, err = l.requestStream(318, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackReboot is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT. +func (l *Libvirt) DomainEventCallbackReboot() (err error) { + var buf []byte + + + _, err = l.requestStream(319, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackRtcChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE. +func (l *Libvirt) DomainEventCallbackRtcChange() (err error) { + var buf []byte + + + _, err = l.requestStream(320, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackWatchdog is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG. +func (l *Libvirt) DomainEventCallbackWatchdog() (err error) { + var buf []byte + + + _, err = l.requestStream(321, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackIOError is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR. +func (l *Libvirt) DomainEventCallbackIOError() (err error) { + var buf []byte + + + _, err = l.requestStream(322, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackGraphics is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS. +func (l *Libvirt) DomainEventCallbackGraphics() (err error) { + var buf []byte + + + _, err = l.requestStream(323, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackIOErrorReason is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON. +func (l *Libvirt) DomainEventCallbackIOErrorReason() (err error) { + var buf []byte + + + _, err = l.requestStream(324, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackControlError is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR. +func (l *Libvirt) DomainEventCallbackControlError() (err error) { + var buf []byte + + + _, err = l.requestStream(325, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackBlockJob is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB. +func (l *Libvirt) DomainEventCallbackBlockJob() (err error) { + var buf []byte + + + _, err = l.requestStream(326, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackDiskChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE. +func (l *Libvirt) DomainEventCallbackDiskChange() (err error) { + var buf []byte + + + _, err = l.requestStream(327, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackTrayChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE. +func (l *Libvirt) DomainEventCallbackTrayChange() (err error) { + var buf []byte + + + _, err = l.requestStream(328, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackPmwakeup is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP. +func (l *Libvirt) DomainEventCallbackPmwakeup() (err error) { + var buf []byte + + + _, err = l.requestStream(329, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackPmsuspend is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND. +func (l *Libvirt) DomainEventCallbackPmsuspend() (err error) { + var buf []byte + + + _, err = l.requestStream(330, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackBalloonChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE. +func (l *Libvirt) DomainEventCallbackBalloonChange() (err error) { + var buf []byte + + + _, err = l.requestStream(331, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackPmsuspendDisk is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK. +func (l *Libvirt) DomainEventCallbackPmsuspendDisk() (err error) { + var buf []byte + + + _, err = l.requestStream(332, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackDeviceRemoved is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED. +func (l *Libvirt) DomainEventCallbackDeviceRemoved() (err error) { + var buf []byte + + + _, err = l.requestStream(333, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainCoreDumpWithFormat is the go wrapper for REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT. +func (l *Libvirt) DomainCoreDumpWithFormat(Dom Domain, To string, Dumpformat uint32, Flags DomainCoreDumpFlags) (err error) { + var buf []byte + + args := DomainCoreDumpWithFormatArgs { + Dom: Dom, + To: To, + Dumpformat: Dumpformat, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(334, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainFsfreeze is the go wrapper for REMOTE_PROC_DOMAIN_FSFREEZE. +func (l *Libvirt) DomainFsfreeze(Dom Domain, Mountpoints []string, Flags uint32) (rFilesystems int32, err error) { + var buf []byte + + args := DomainFsfreezeArgs { + Dom: Dom, + Mountpoints: Mountpoints, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(335, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Filesystems: int32 + _, err = dec.Decode(&rFilesystems) + if err != nil { + return + } + + return +} + +// DomainFsthaw is the go wrapper for REMOTE_PROC_DOMAIN_FSTHAW. +func (l *Libvirt) DomainFsthaw(Dom Domain, Mountpoints []string, Flags uint32) (rFilesystems int32, err error) { + var buf []byte + + args := DomainFsthawArgs { + Dom: Dom, + Mountpoints: Mountpoints, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(336, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Filesystems: int32 + _, err = dec.Decode(&rFilesystems) + if err != nil { + return + } + + return +} + +// DomainGetTime is the go wrapper for REMOTE_PROC_DOMAIN_GET_TIME. +func (l *Libvirt) DomainGetTime(Dom Domain, Flags uint32) (rSeconds int64, rNseconds uint32, err error) { + var buf []byte + + args := DomainGetTimeArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(337, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Seconds: int64 + _, err = dec.Decode(&rSeconds) + if err != nil { + return + } + // Nseconds: uint32 + _, err = dec.Decode(&rNseconds) + if err != nil { + return + } + + return +} + +// DomainSetTime is the go wrapper for REMOTE_PROC_DOMAIN_SET_TIME. +func (l *Libvirt) DomainSetTime(Dom Domain, Seconds int64, Nseconds uint32, Flags DomainSetTimeFlags) (err error) { + var buf []byte + + args := DomainSetTimeArgs { + Dom: Dom, + Seconds: Seconds, + Nseconds: Nseconds, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(338, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventBlockJob2 is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2. +func (l *Libvirt) DomainEventBlockJob2() (err error) { + var buf []byte + + + _, err = l.requestStream(339, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeGetFreePages is the go wrapper for REMOTE_PROC_NODE_GET_FREE_PAGES. +func (l *Libvirt) NodeGetFreePages(Pages []uint32, StartCell int32, CellCount uint32, Flags uint32) (rCounts []uint64, err error) { + var buf []byte + + args := NodeGetFreePagesArgs { + Pages: Pages, + StartCell: StartCell, + CellCount: CellCount, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(340, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Counts: []uint64 + _, err = dec.Decode(&rCounts) + if err != nil { + return + } + + return +} + +// NetworkGetDhcpLeases is the go wrapper for REMOTE_PROC_NETWORK_GET_DHCP_LEASES. +func (l *Libvirt) NetworkGetDhcpLeases(Net Network, Mac OptString, NeedResults int32, Flags uint32) (rLeases []NetworkDhcpLease, rRet uint32, err error) { + var buf []byte + + args := NetworkGetDhcpLeasesArgs { + Net: Net, + Mac: Mac, + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(341, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Leases: []NetworkDhcpLease + _, err = dec.Decode(&rLeases) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// ConnectGetDomainCapabilities is the go wrapper for REMOTE_PROC_CONNECT_GET_DOMAIN_CAPABILITIES. +func (l *Libvirt) ConnectGetDomainCapabilities(Emulatorbin OptString, Arch OptString, Machine OptString, Virttype OptString, Flags uint32) (rCapabilities string, err error) { + var buf []byte + + args := ConnectGetDomainCapabilitiesArgs { + Emulatorbin: Emulatorbin, + Arch: Arch, + Machine: Machine, + Virttype: Virttype, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(342, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Capabilities: string + _, err = dec.Decode(&rCapabilities) + if err != nil { + return + } + + return +} + +// DomainOpenGraphicsFd is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_GRAPHICS_FD. +func (l *Libvirt) DomainOpenGraphicsFd(Dom Domain, Idx uint32, Flags DomainOpenGraphicsFlags) (err error) { + var buf []byte + + args := DomainOpenGraphicsFdArgs { + Dom: Dom, + Idx: Idx, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(343, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectGetAllDomainStats is the go wrapper for REMOTE_PROC_CONNECT_GET_ALL_DOMAIN_STATS. +func (l *Libvirt) ConnectGetAllDomainStats(Doms []Domain, Stats uint32, Flags ConnectGetAllDomainStatsFlags) (rRetStats []DomainStatsRecord, err error) { + var buf []byte + + args := ConnectGetAllDomainStatsArgs { + Doms: Doms, + Stats: Stats, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(344, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // RetStats: []DomainStatsRecord + _, err = dec.Decode(&rRetStats) + if err != nil { + return + } + + return +} + +// DomainBlockCopy is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_COPY. +func (l *Libvirt) DomainBlockCopy(Dom Domain, Path string, Destxml string, Params []TypedParam, Flags DomainBlockCopyFlags) (err error) { + var buf []byte + + args := DomainBlockCopyArgs { + Dom: Dom, + Path: Path, + Destxml: Destxml, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(345, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackTunable is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABLE. +func (l *Libvirt) DomainEventCallbackTunable() (err error) { + var buf []byte + + + _, err = l.requestStream(346, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeAllocPages is the go wrapper for REMOTE_PROC_NODE_ALLOC_PAGES. +func (l *Libvirt) NodeAllocPages(PageSizes []uint32, PageCounts []uint64, StartCell int32, CellCount uint32, Flags NodeAllocPagesFlags) (rRet int32, err error) { + var buf []byte + + args := NodeAllocPagesArgs { + PageSizes: PageSizes, + PageCounts: PageCounts, + StartCell: StartCell, + CellCount: CellCount, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(347, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Ret: int32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// DomainEventCallbackAgentLifecycle is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_AGENT_LIFECYCLE. +func (l *Libvirt) DomainEventCallbackAgentLifecycle() (err error) { + var buf []byte + + + _, err = l.requestStream(348, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetFsinfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_FSINFO. +func (l *Libvirt) DomainGetFsinfo(Dom Domain, Flags uint32) (rInfo []DomainFsinfo, rRet uint32, err error) { + var buf []byte + + args := DomainGetFsinfoArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(349, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Info: []DomainFsinfo + _, err = dec.Decode(&rInfo) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// DomainDefineXMLFlags is the go wrapper for REMOTE_PROC_DOMAIN_DEFINE_XML_FLAGS. +func (l *Libvirt) DomainDefineXMLFlags(XML string, Flags DomainDefineFlags) (rDom Domain, err error) { + var buf []byte + + args := DomainDefineXMLFlagsArgs { + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(350, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Dom: Domain + _, err = dec.Decode(&rDom) + if err != nil { + return + } + + return +} + +// DomainGetIothreadInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_IOTHREAD_INFO. +func (l *Libvirt) DomainGetIothreadInfo(Dom Domain, Flags DomainModificationImpact) (rInfo []DomainIothreadInfo, rRet uint32, err error) { + var buf []byte + + args := DomainGetIothreadInfoArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(351, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Info: []DomainIothreadInfo + _, err = dec.Decode(&rInfo) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// DomainPinIothread is the go wrapper for REMOTE_PROC_DOMAIN_PIN_IOTHREAD. +func (l *Libvirt) DomainPinIothread(Dom Domain, IothreadsID uint32, Cpumap []byte, Flags DomainModificationImpact) (err error) { + var buf []byte + + args := DomainPinIothreadArgs { + Dom: Dom, + IothreadsID: IothreadsID, + Cpumap: Cpumap, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(352, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainInterfaceAddresses is the go wrapper for REMOTE_PROC_DOMAIN_INTERFACE_ADDRESSES. +func (l *Libvirt) DomainInterfaceAddresses(Dom Domain, Source uint32, Flags uint32) (rIfaces []DomainInterface, err error) { + var buf []byte + + args := DomainInterfaceAddressesArgs { + Dom: Dom, + Source: Source, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(353, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Ifaces: []DomainInterface + _, err = dec.Decode(&rIfaces) + if err != nil { + return + } + + return +} + +// DomainEventCallbackDeviceAdded is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_ADDED. +func (l *Libvirt) DomainEventCallbackDeviceAdded() (err error) { + var buf []byte + + + _, err = l.requestStream(354, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainAddIothread is the go wrapper for REMOTE_PROC_DOMAIN_ADD_IOTHREAD. +func (l *Libvirt) DomainAddIothread(Dom Domain, IothreadID uint32, Flags DomainModificationImpact) (err error) { + var buf []byte + + args := DomainAddIothreadArgs { + Dom: Dom, + IothreadID: IothreadID, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(355, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainDelIothread is the go wrapper for REMOTE_PROC_DOMAIN_DEL_IOTHREAD. +func (l *Libvirt) DomainDelIothread(Dom Domain, IothreadID uint32, Flags DomainModificationImpact) (err error) { + var buf []byte + + args := DomainDelIothreadArgs { + Dom: Dom, + IothreadID: IothreadID, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(356, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetUserPassword is the go wrapper for REMOTE_PROC_DOMAIN_SET_USER_PASSWORD. +func (l *Libvirt) DomainSetUserPassword(Dom Domain, User OptString, Password OptString, Flags DomainSetUserPasswordFlags) (err error) { + var buf []byte + + args := DomainSetUserPasswordArgs { + Dom: Dom, + User: User, + Password: Password, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(357, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainRename is the go wrapper for REMOTE_PROC_DOMAIN_RENAME. +func (l *Libvirt) DomainRename(Dom Domain, NewName OptString, Flags uint32) (rRetcode int32, err error) { + var buf []byte + + args := DomainRenameArgs { + Dom: Dom, + NewName: NewName, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(358, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Retcode: int32 + _, err = dec.Decode(&rRetcode) + if err != nil { + return + } + + return +} + +// DomainEventCallbackMigrationIteration is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_MIGRATION_ITERATION. +func (l *Libvirt) DomainEventCallbackMigrationIteration() (err error) { + var buf []byte + + + _, err = l.requestStream(359, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectRegisterCloseCallback is the go wrapper for REMOTE_PROC_CONNECT_REGISTER_CLOSE_CALLBACK. +func (l *Libvirt) ConnectRegisterCloseCallback() (err error) { + var buf []byte + + + _, err = l.requestStream(360, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectUnregisterCloseCallback is the go wrapper for REMOTE_PROC_CONNECT_UNREGISTER_CLOSE_CALLBACK. +func (l *Libvirt) ConnectUnregisterCloseCallback() (err error) { + var buf []byte + + + _, err = l.requestStream(361, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectEventConnectionClosed is the go wrapper for REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLOSED. +func (l *Libvirt) ConnectEventConnectionClosed() (err error) { + var buf []byte + + + _, err = l.requestStream(362, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackJobCompleted is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_COMPLETED. +func (l *Libvirt) DomainEventCallbackJobCompleted() (err error) { + var buf []byte + + + _, err = l.requestStream(363, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainMigrateStartPostCopy is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_START_POST_COPY. +func (l *Libvirt) DomainMigrateStartPostCopy(Dom Domain, Flags uint32) (err error) { + var buf []byte + + args := DomainMigrateStartPostCopyArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(364, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetPerfEvents is the go wrapper for REMOTE_PROC_DOMAIN_GET_PERF_EVENTS. +func (l *Libvirt) DomainGetPerfEvents(Dom Domain, Flags DomainModificationImpact) (rParams []TypedParam, err error) { + var buf []byte + + args := DomainGetPerfEventsArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(365, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + + return +} + +// DomainSetPerfEvents is the go wrapper for REMOTE_PROC_DOMAIN_SET_PERF_EVENTS. +func (l *Libvirt) DomainSetPerfEvents(Dom Domain, Params []TypedParam, Flags DomainModificationImpact) (err error) { + var buf []byte + + args := DomainSetPerfEventsArgs { + Dom: Dom, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(366, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventCallbackDeviceRemovalFailed is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVAL_FAILED. +func (l *Libvirt) DomainEventCallbackDeviceRemovalFailed() (err error) { + var buf []byte + + + _, err = l.requestStream(367, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectStoragePoolEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_REGISTER_ANY. +func (l *Libvirt) ConnectStoragePoolEventRegisterAny(EventID int32, Pool OptStoragePool) (rCallbackID int32, err error) { + var buf []byte + + args := ConnectStoragePoolEventRegisterAnyArgs { + EventID: EventID, + Pool: Pool, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(368, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CallbackID: int32 + _, err = dec.Decode(&rCallbackID) + if err != nil { + return + } + + return +} + +// ConnectStoragePoolEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_DEREGISTER_ANY. +func (l *Libvirt) ConnectStoragePoolEventDeregisterAny(CallbackID int32) (err error) { + var buf []byte + + args := ConnectStoragePoolEventDeregisterAnyArgs { + CallbackID: CallbackID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(369, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolEventLifecycle is the go wrapper for REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE. +func (l *Libvirt) StoragePoolEventLifecycle() (err error) { + var buf []byte + + + _, err = l.requestStream(370, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainGetGuestVcpus is the go wrapper for REMOTE_PROC_DOMAIN_GET_GUEST_VCPUS. +func (l *Libvirt) DomainGetGuestVcpus(Dom Domain, Flags uint32) (rParams []TypedParam, err error) { + var buf []byte + + args := DomainGetGuestVcpusArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(371, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + + return +} + +// DomainSetGuestVcpus is the go wrapper for REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS. +func (l *Libvirt) DomainSetGuestVcpus(Dom Domain, Cpumap string, State int32, Flags uint32) (err error) { + var buf []byte + + args := DomainSetGuestVcpusArgs { + Dom: Dom, + Cpumap: Cpumap, + State: State, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(372, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolEventRefresh is the go wrapper for REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH. +func (l *Libvirt) StoragePoolEventRefresh() (err error) { + var buf []byte + + + _, err = l.requestStream(373, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectNodeDeviceEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_REGISTER_ANY. +func (l *Libvirt) ConnectNodeDeviceEventRegisterAny(EventID int32, Dev OptNodeDevice) (rCallbackID int32, err error) { + var buf []byte + + args := ConnectNodeDeviceEventRegisterAnyArgs { + EventID: EventID, + Dev: Dev, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(374, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CallbackID: int32 + _, err = dec.Decode(&rCallbackID) + if err != nil { + return + } + + return +} + +// ConnectNodeDeviceEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_DEREGISTER_ANY. +func (l *Libvirt) ConnectNodeDeviceEventDeregisterAny(CallbackID int32) (err error) { + var buf []byte + + args := ConnectNodeDeviceEventDeregisterAnyArgs { + CallbackID: CallbackID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(375, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeDeviceEventLifecycle is the go wrapper for REMOTE_PROC_NODE_DEVICE_EVENT_LIFECYCLE. +func (l *Libvirt) NodeDeviceEventLifecycle() (err error) { + var buf []byte + + + _, err = l.requestStream(376, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// NodeDeviceEventUpdate is the go wrapper for REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE. +func (l *Libvirt) NodeDeviceEventUpdate() (err error) { + var buf []byte + + + _, err = l.requestStream(377, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StorageVolGetInfoFlags is the go wrapper for REMOTE_PROC_STORAGE_VOL_GET_INFO_FLAGS. +func (l *Libvirt) StorageVolGetInfoFlags(Vol StorageVol, Flags uint32) (rType int8, rCapacity uint64, rAllocation uint64, err error) { + var buf []byte + + args := StorageVolGetInfoFlagsArgs { + Vol: Vol, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(378, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Type: int8 + _, err = dec.Decode(&rType) + if err != nil { + return + } + // Capacity: uint64 + _, err = dec.Decode(&rCapacity) + if err != nil { + return + } + // Allocation: uint64 + _, err = dec.Decode(&rAllocation) + if err != nil { + return + } + + return +} + +// DomainEventCallbackMetadataChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE. +func (l *Libvirt) DomainEventCallbackMetadataChange() (err error) { + var buf []byte + + + _, err = l.requestStream(379, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectSecretEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_SECRET_EVENT_REGISTER_ANY. +func (l *Libvirt) ConnectSecretEventRegisterAny(EventID int32, OptSecret OptSecret) (rCallbackID int32, err error) { + var buf []byte + + args := ConnectSecretEventRegisterAnyArgs { + EventID: EventID, + OptSecret: OptSecret, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(380, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CallbackID: int32 + _, err = dec.Decode(&rCallbackID) + if err != nil { + return + } + + return +} + +// ConnectSecretEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_SECRET_EVENT_DEREGISTER_ANY. +func (l *Libvirt) ConnectSecretEventDeregisterAny(CallbackID int32) (err error) { + var buf []byte + + args := ConnectSecretEventDeregisterAnyArgs { + CallbackID: CallbackID, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(381, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// SecretEventLifecycle is the go wrapper for REMOTE_PROC_SECRET_EVENT_LIFECYCLE. +func (l *Libvirt) SecretEventLifecycle() (err error) { + var buf []byte + + + _, err = l.requestStream(382, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// SecretEventValueChanged is the go wrapper for REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED. +func (l *Libvirt) SecretEventValueChanged() (err error) { + var buf []byte + + + _, err = l.requestStream(383, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetVcpu is the go wrapper for REMOTE_PROC_DOMAIN_SET_VCPU. +func (l *Libvirt) DomainSetVcpu(Dom Domain, Cpumap string, State int32, Flags DomainModificationImpact) (err error) { + var buf []byte + + args := DomainSetVcpuArgs { + Dom: Dom, + Cpumap: Cpumap, + State: State, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(384, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainEventBlockThreshold is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD. +func (l *Libvirt) DomainEventBlockThreshold() (err error) { + var buf []byte + + + _, err = l.requestStream(385, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetBlockThreshold is the go wrapper for REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD. +func (l *Libvirt) DomainSetBlockThreshold(Dom Domain, Dev string, Threshold uint64, Flags uint32) (err error) { + var buf []byte + + args := DomainSetBlockThresholdArgs { + Dom: Dom, + Dev: Dev, + Threshold: Threshold, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(386, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainMigrateGetMaxDowntime is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME. +func (l *Libvirt) DomainMigrateGetMaxDowntime(Dom Domain, Flags uint32) (rDowntime uint64, err error) { + var buf []byte + + args := DomainMigrateGetMaxDowntimeArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(387, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Downtime: uint64 + _, err = dec.Decode(&rDowntime) + if err != nil { + return + } + + return +} + +// DomainManagedSaveGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC. +func (l *Libvirt) DomainManagedSaveGetXMLDesc(Dom Domain, Flags DomainXMLFlags) (rXML string, err error) { + var buf []byte + + args := DomainManagedSaveGetXMLDescArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(388, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// DomainManagedSaveDefineXML is the go wrapper for REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML. +func (l *Libvirt) DomainManagedSaveDefineXML(Dom Domain, Dxml OptString, Flags DomainSaveRestoreFlags) (err error) { + var buf []byte + + args := DomainManagedSaveDefineXMLArgs { + Dom: Dom, + Dxml: Dxml, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(389, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// DomainSetLifecycleAction is the go wrapper for REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION. +func (l *Libvirt) DomainSetLifecycleAction(Dom Domain, Type uint32, Action uint32, Flags DomainModificationImpact) (err error) { + var buf []byte + + args := DomainSetLifecycleActionArgs { + Dom: Dom, + Type: Type, + Action: Action, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(390, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// StoragePoolLookupByTargetPath is the go wrapper for REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH. +func (l *Libvirt) StoragePoolLookupByTargetPath(Path string) (rPool StoragePool, err error) { + var buf []byte + + args := StoragePoolLookupByTargetPathArgs { + Path: Path, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(391, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Pool: StoragePool + _, err = dec.Decode(&rPool) + if err != nil { + return + } + + return +} + +// DomainDetachDeviceAlias is the go wrapper for REMOTE_PROC_DOMAIN_DETACH_DEVICE_ALIAS. +func (l *Libvirt) DomainDetachDeviceAlias(Dom Domain, Alias string, Flags uint32) (err error) { + var buf []byte + + args := DomainDetachDeviceAliasArgs { + Dom: Dom, + Alias: Alias, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(392, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectCompareHypervisorCPU is the go wrapper for REMOTE_PROC_CONNECT_COMPARE_HYPERVISOR_CPU. +func (l *Libvirt) ConnectCompareHypervisorCPU(Emulator OptString, Arch OptString, Machine OptString, Virttype OptString, XMLCPU string, Flags uint32) (rResult int32, err error) { + var buf []byte + + args := ConnectCompareHypervisorCPUArgs { + Emulator: Emulator, + Arch: Arch, + Machine: Machine, + Virttype: Virttype, + XMLCPU: XMLCPU, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(393, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Result: int32 + _, err = dec.Decode(&rResult) + if err != nil { + return + } + + return +} + +// ConnectBaselineHypervisorCPU is the go wrapper for REMOTE_PROC_CONNECT_BASELINE_HYPERVISOR_CPU. +func (l *Libvirt) ConnectBaselineHypervisorCPU(Emulator OptString, Arch OptString, Machine OptString, Virttype OptString, XMLCPUs []string, Flags uint32) (rCPU string, err error) { + var buf []byte + + args := ConnectBaselineHypervisorCPUArgs { + Emulator: Emulator, + Arch: Arch, + Machine: Machine, + Virttype: Virttype, + XMLCPUs: XMLCPUs, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(394, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // CPU: string + _, err = dec.Decode(&rCPU) + if err != nil { + return + } + + return +} + +// NodeGetSevInfo is the go wrapper for REMOTE_PROC_NODE_GET_SEV_INFO. +func (l *Libvirt) NodeGetSevInfo(Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { + var buf []byte + + args := NodeGetSevInfoArgs { + Nparams: Nparams, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(395, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + // Nparams: int32 + _, err = dec.Decode(&rNparams) + if err != nil { + return + } + + return +} + +// DomainGetLaunchSecurityInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_LAUNCH_SECURITY_INFO. +func (l *Libvirt) DomainGetLaunchSecurityInfo(Dom Domain, Flags uint32) (rParams []TypedParam, err error) { + var buf []byte + + args := DomainGetLaunchSecurityInfoArgs { + Dom: Dom, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(396, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Params: []TypedParam + _, err = dec.Decode(&rParams) + if err != nil { + return + } + + return +} + +// NwfilterBindingLookupByPortDev is the go wrapper for REMOTE_PROC_NWFILTER_BINDING_LOOKUP_BY_PORT_DEV. +func (l *Libvirt) NwfilterBindingLookupByPortDev(Name string) (rOptNwfilter NwfilterBinding, err error) { + var buf []byte + + args := NwfilterBindingLookupByPortDevArgs { + Name: Name, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(397, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // OptNwfilter: NwfilterBinding + _, err = dec.Decode(&rOptNwfilter) + if err != nil { + return + } + + return +} + +// NwfilterBindingGetXMLDesc is the go wrapper for REMOTE_PROC_NWFILTER_BINDING_GET_XML_DESC. +func (l *Libvirt) NwfilterBindingGetXMLDesc(OptNwfilter NwfilterBinding, Flags uint32) (rXML string, err error) { + var buf []byte + + args := NwfilterBindingGetXMLDescArgs { + OptNwfilter: OptNwfilter, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(398, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // XML: string + _, err = dec.Decode(&rXML) + if err != nil { + return + } + + return +} + +// NwfilterBindingCreateXML is the go wrapper for REMOTE_PROC_NWFILTER_BINDING_CREATE_XML. +func (l *Libvirt) NwfilterBindingCreateXML(XML string, Flags uint32) (rOptNwfilter NwfilterBinding, err error) { + var buf []byte + + args := NwfilterBindingCreateXMLArgs { + XML: XML, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(399, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // OptNwfilter: NwfilterBinding + _, err = dec.Decode(&rOptNwfilter) + if err != nil { + return + } + + return +} + +// NwfilterBindingDelete is the go wrapper for REMOTE_PROC_NWFILTER_BINDING_DELETE. +func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) { + var buf []byte + + args := NwfilterBindingDeleteArgs { + OptNwfilter: OptNwfilter, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(400, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + +// ConnectListAllNwfilterBindings is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS. +func (l *Libvirt) ConnectListAllNwfilterBindings(NeedResults int32, Flags uint32) (rBindings []NwfilterBinding, rRet uint32, err error) { + var buf []byte + + args := ConnectListAllNwfilterBindingsArgs { + NeedResults: NeedResults, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + var r response + r, err = l.requestStream(401, constants.Program, buf, nil, nil) + if err != nil { + return + } + + // Return value unmarshaling + tpd := typedParamDecoder{} + ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} + rdr := bytes.NewReader(r.Payload) + dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) + // Bindings: []NwfilterBinding + _, err = dec.Decode(&rBindings) + if err != nil { + return + } + // Ret: uint32 + _, err = dec.Decode(&rRet) + if err != nil { + return + } + + return +} + +// DomainSetIothreadParams is the go wrapper for REMOTE_PROC_DOMAIN_SET_IOTHREAD_PARAMS. +func (l *Libvirt) DomainSetIothreadParams(Dom Domain, IothreadID uint32, Params []TypedParam, Flags uint32) (err error) { + var buf []byte + + args := DomainSetIothreadParamsArgs { + Dom: Dom, + IothreadID: IothreadID, + Params: Params, + Flags: Flags, + } + + buf, err = encode(&args) + if err != nil { + return + } + + + _, err = l.requestStream(402, constants.Program, buf, nil, nil) + if err != nil { + return + } + + return +} + diff --git a/vendor/github.com/digitalocean/go-libvirt/libvirt.go b/vendor/github.com/digitalocean/go-libvirt/libvirt.go new file mode 100644 index 000000000..e2461e55c --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/libvirt.go @@ -0,0 +1,552 @@ +// Copyright 2018 The go-libvirt Authors. +// +// 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 libvirt is a pure Go implementation of the libvirt RPC protocol. +// For more information on the protocol, see https://libvirt.org/internals/l.html +package libvirt + +// We'll use c-for-go to extract the consts and typedefs from the libvirt +// sources so we don't have to duplicate them here. +//go:generate scripts/gen-consts.sh + +import ( + "bufio" + "bytes" + "encoding/json" + "errors" + "fmt" + "net" + "sync" + + "github.com/digitalocean/go-libvirt/internal/constants" + xdr "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" +) + +// ErrEventsNotSupported is returned by Events() if event streams +// are unsupported by either QEMU or libvirt. +var ErrEventsNotSupported = errors.New("event monitor is not supported") + +// internal event +type event interface { + GetCallbackID() uint32 +} + +// Libvirt implements libvirt's remote procedure call protocol. +type Libvirt struct { + conn net.Conn + r *bufio.Reader + w *bufio.Writer + mu *sync.Mutex + + // method callbacks + cm sync.Mutex + callbacks map[uint32]chan response + + // event listeners + em sync.Mutex + events map[uint32]eventStream + + // next request serial number + s uint32 +} + +// DomainEvent represents a libvirt domain event. +type DomainEvent struct { + CallbackID uint32 + Domain Domain + Event string + Seconds uint64 + Microseconds uint32 + Padding uint8 + Details []byte +} + +// GetCallbackID returns the callback id of a qemu domain event +func (de DomainEvent) GetCallbackID() uint32 { + return de.CallbackID +} + +// GetCallbackID returns the callback id of a libvirt lifecycle event +func (m DomainEventCallbackLifecycleMsg) GetCallbackID() uint32 { + return uint32(m.CallbackID) +} + +// qemuError represents a QEMU process error. +type qemuError struct { + Error struct { + Class string `json:"class"` + Description string `json:"desc"` + } `json:"error"` +} + +// Capabilities returns an XML document describing the host's capabilties. +func (l *Libvirt) Capabilities() ([]byte, error) { + caps, err := l.ConnectGetCapabilities() + return []byte(caps), err +} + +// Connect establishes communication with the libvirt server. +// The underlying libvirt socket connection must be previously established. +func (l *Libvirt) Connect() error { + payload := struct { + Padding [3]byte + Name string + Flags uint32 + }{ + Padding: [3]byte{0x1, 0x0, 0x0}, + Name: "qemu:///system", + Flags: 0, + } + + buf, err := encode(&payload) + if err != nil { + return err + } + + // libvirt requires that we call auth-list prior to connecting, + // event when no authentication is used. + _, err = l.request(constants.ProcAuthList, constants.Program, buf) + if err != nil { + return err + } + + _, err = l.request(constants.ProcConnectOpen, constants.Program, buf) + if err != nil { + return err + } + + return nil +} + +// Disconnect shuts down communication with the libvirt server and closes the +// underlying net.Conn. +func (l *Libvirt) Disconnect() error { + // close event streams + for id := range l.events { + if err := l.removeStream(id); err != nil { + return err + } + } + + // Deregister all the callbacks so that clients with outstanding requests + // will unblock. + l.deregisterAll() + + _, err := l.request(constants.ProcConnectClose, constants.Program, nil) + if err != nil { + return err + } + + return l.conn.Close() +} + +// Domains returns a list of all domains managed by libvirt. +// +// Deprecated: use ConnectListAllDomains instead. +func (l *Libvirt) Domains() ([]Domain, error) { + // these are the flags as passed by `virsh` for `virsh list --all` + flags := ConnectListDomainsActive | ConnectListDomainsInactive + domains, _, err := l.ConnectListAllDomains(1, flags) + return domains, err +} + +// DomainState returns state of the domain managed by libvirt. +// +// Deprecated: use DomainGetState instead. +func (l *Libvirt) DomainState(dom string) (DomainState, error) { + d, err := l.lookup(dom) + if err != nil { + return DomainNostate, err + } + + state, _, err := l.DomainGetState(d, 0) + return DomainState(state), err +} + +// Events streams domain events. +// If a problem is encountered setting up the event monitor connection +// an error will be returned. Errors encountered during streaming will +// cause the returned event channel to be closed. +func (l *Libvirt) Events(dom string) (<-chan DomainEvent, error) { + d, err := l.lookup(dom) + if err != nil { + return nil, err + } + + payload := struct { + Padding [4]byte + Domain Domain + Event [2]byte + Flags [2]byte + }{ + Padding: [4]byte{0x0, 0x0, 0x1, 0x0}, + Domain: d, + Event: [2]byte{0x0, 0x0}, + Flags: [2]byte{0x0, 0x0}, + } + + buf, err := encode(&payload) + if err != nil { + return nil, err + } + + res, err := l.request(constants.QEMUConnectDomainMonitorEventRegister, constants.ProgramQEMU, buf) + if err != nil { + if err == ErrUnsupported { + return nil, ErrEventsNotSupported + } + return nil, err + } + + dec := xdr.NewDecoder(bytes.NewReader(res.Payload)) + + cbID, _, err := dec.DecodeUint() + if err != nil { + return nil, err + } + + stream := newEventStream(constants.QEMUConnectDomainMonitorEventDeregister, constants.ProgramQEMU) + l.addStream(cbID, stream) + c := make(chan DomainEvent) + go func() { + // process events + for e := range stream.Events { + c <- *e.(*DomainEvent) + } + }() + + return c, nil +} + +// LifecycleEvents streams lifecycle events. +// If a problem is encountered setting up the event monitor connection +// an error will be returned. Errors encountered during streaming will +// cause the returned event channel to be closed. +func (l *Libvirt) LifecycleEvents() (<-chan DomainEventLifecycleMsg, error) { + callbackID, err := l.ConnectDomainEventCallbackRegisterAny(int32(DomainEventIDLifecycle), nil) + if err != nil { + return nil, err + } + + stream := newEventStream(constants.ProcConnectDomainEventCallbackDeregisterAny, constants.Program) + l.addStream(uint32(callbackID), stream) + + c := make(chan DomainEventLifecycleMsg) + go func() { + // process events + for e := range stream.Events { + c <- e.(*DomainEventCallbackLifecycleMsg).Msg + } + }() + + return c, nil +} + +// Run executes the given QAPI command against a domain's QEMU instance. +// For a list of available QAPI commands, see: +// http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD +func (l *Libvirt) Run(dom string, cmd []byte) ([]byte, error) { + d, err := l.lookup(dom) + if err != nil { + return nil, err + } + + payload := struct { + Domain Domain + Command []byte + Flags uint32 + }{ + Domain: d, + Command: cmd, + Flags: 0, + } + + buf, err := encode(&payload) + if err != nil { + return nil, err + } + + res, err := l.request(constants.QEMUDomainMonitor, constants.ProgramQEMU, buf) + if err != nil { + return nil, err + } + + // check for QEMU process errors + if err = getQEMUError(res); err != nil { + return nil, err + } + + r := bytes.NewReader(res.Payload) + dec := xdr.NewDecoder(r) + data, _, err := dec.DecodeFixedOpaque(int32(r.Len())) + if err != nil { + return nil, err + } + + // drop QMP control characters from start of line, and drop + // any trailing NULL characters from the end + return bytes.TrimRight(data[4:], "\x00"), nil +} + +// Secrets returns all secrets managed by the libvirt daemon. +// +// Deprecated: use ConnectListAllSecrets instead. +func (l *Libvirt) Secrets() ([]Secret, error) { + secrets, _, err := l.ConnectListAllSecrets(1, 0) + return secrets, err +} + +// StoragePool returns the storage pool associated with the provided name. +// An error is returned if the requested storage pool is not found. +// +// Deprecated: use StoragePoolLookupByName instead. +func (l *Libvirt) StoragePool(name string) (StoragePool, error) { + return l.StoragePoolLookupByName(name) +} + +// StoragePools returns a list of defined storage pools. Pools are filtered by +// the provided flags. See StoragePools*. +// +// Deprecated: use ConnectListAllStoragePools instead. +func (l *Libvirt) StoragePools(flags ConnectListAllStoragePoolsFlags) ([]StoragePool, error) { + pools, _, err := l.ConnectListAllStoragePools(1, flags) + return pools, err +} + +// Undefine undefines the domain specified by dom, e.g., 'prod-lb-01'. +// The flags argument allows additional options to be specified such as +// cleaning up snapshot metadata. For more information on available +// flags, see DomainUndefine*. +// +// Deprecated: use DomainUndefineFlags instead. +func (l *Libvirt) Undefine(dom string, flags DomainUndefineFlagsValues) error { + d, err := l.lookup(dom) + if err != nil { + return err + } + + return l.DomainUndefineFlags(d, flags) +} + +// Destroy destroys the domain specified by dom, e.g., 'prod-lb-01'. +// The flags argument allows additional options to be specified such as +// allowing a graceful shutdown with SIGTERM than SIGKILL. +// For more information on available flags, see DomainDestroy*. +// +// Deprecated: use DomainDestroyFlags instead. +func (l *Libvirt) Destroy(dom string, flags DomainDestroyFlagsValues) error { + d, err := l.lookup(dom) + if err != nil { + return err + } + + return l.DomainDestroyFlags(d, flags) +} + +// XML returns a domain's raw XML definition, akin to `virsh dumpxml `. +// See DomainXMLFlag* for optional flags. +// +// Deprecated: use DomainGetXMLDesc instead. +func (l *Libvirt) XML(dom string, flags DomainXMLFlags) ([]byte, error) { + d, err := l.lookup(dom) + if err != nil { + return nil, err + } + + xml, err := l.DomainGetXMLDesc(d, flags) + return []byte(xml), err +} + +// DefineXML defines a domain, but does not start it. +// +// Deprecated: use DomainDefineXMLFlags instead. +func (l *Libvirt) DefineXML(x []byte, flags DomainDefineFlags) error { + _, err := l.DomainDefineXMLFlags(string(x), flags) + return err +} + +// Version returns the version of the libvirt daemon. +// +// Deprecated: use ConnectGetLibVersion instead. +func (l *Libvirt) Version() (string, error) { + ver, err := l.ConnectGetLibVersion() + if err != nil { + return "", err + } + + // The version is provided as an int following this formula: + // version * 1,000,000 + minor * 1000 + micro + // See src/libvirt-host.c # virConnectGetLibVersion + major := ver / 1000000 + ver %= 1000000 + minor := ver / 1000 + ver %= 1000 + micro := ver + + versionString := fmt.Sprintf("%d.%d.%d", major, minor, micro) + return versionString, nil +} + +// Shutdown shuts down a domain. Note that the guest OS may ignore the request. +// If flags is set to 0 then the hypervisor will choose the method of shutdown it considers best. +// +// Deprecated: use DomainShutdownFlags instead. +func (l *Libvirt) Shutdown(dom string, flags DomainShutdownFlagValues) error { + d, err := l.lookup(dom) + if err != nil { + return err + } + + return l.DomainShutdownFlags(d, flags) +} + +// Reboot reboots the domain. Note that the guest OS may ignore the request. +// If flags is set to zero, then the hypervisor will choose the method of shutdown it considers best. +// +// Deprecated: use DomainReboot instead. +func (l *Libvirt) Reboot(dom string, flags DomainRebootFlagValues) error { + d, err := l.lookup(dom) + if err != nil { + return err + } + + return l.DomainReboot(d, flags) +} + +// Reset resets domain immediately without any guest OS shutdown +// +// Deprecated: use DomainReset instead. +func (l *Libvirt) Reset(dom string) error { + d, err := l.lookup(dom) + if err != nil { + return err + } + + return l.DomainReset(d, 0) +} + +// BlockLimit contains a name and value pair for a Get/SetBlockIOTune limit. The +// Name field is the name of the limit (to see a list of the limits that can be +// applied, execute the 'blkdeviotune' command on a VM in virsh). Callers can +// use the QEMUBlockIO... constants below for the Name value. The Value field is +// the limit to apply. +type BlockLimit struct { + Name string + Value uint64 +} + +// SetBlockIOTune changes the per-device block I/O tunables within a guest. +// Parameters are the name of the VM, the name of the disk device to which the +// limits should be applied, and 1 or more BlockLimit structs containing the +// actual limits. +// +// The limits which can be applied here are enumerated in the QEMUBlockIO... +// constants above, and you can also see the full list by executing the +// 'blkdeviotune' command on a VM in virsh. +// +// Example usage: +// SetBlockIOTune("vm-name", "vda", BlockLimit{libvirt.QEMUBlockIOWriteBytesSec, 1000000}) +// +// Deprecated: use DomainSetBlockIOTune instead. +func (l *Libvirt) SetBlockIOTune(dom string, disk string, limits ...BlockLimit) error { + d, err := l.lookup(dom) + if err != nil { + return err + } + + params := make([]TypedParam, len(limits)) + for ix, limit := range limits { + tpval := NewTypedParamValueUllong(limit.Value) + params[ix] = TypedParam{Field: limit.Name, Value: *tpval} + } + + return l.DomainSetBlockIOTune(d, disk, params, uint32(DomainAffectLive)) +} + +// GetBlockIOTune returns a slice containing the current block I/O tunables for +// a disk. +// +// Deprecated: use DomainGetBlockIOTune instead. +func (l *Libvirt) GetBlockIOTune(dom string, disk string) ([]BlockLimit, error) { + d, err := l.lookup(dom) + if err != nil { + return nil, err + } + + lims, _, err := l.DomainGetBlockIOTune(d, []string{disk}, 32, uint32(TypedParamStringOkay)) + if err != nil { + return nil, err + } + + var limits []BlockLimit + + // now decode each of the returned TypedParams. To do this we read the field + // name and type, then use the type information to decode the value. + for _, lim := range lims { + var l BlockLimit + name := lim.Field + switch lim.Value.I.(type) { + case uint64: + l = BlockLimit{Name: name, Value: lim.Value.I.(uint64)} + } + limits = append(limits, l) + } + + return limits, nil +} + +// lookup returns a domain as seen by libvirt. +func (l *Libvirt) lookup(name string) (Domain, error) { + return l.DomainLookupByName(name) +} + +// getQEMUError checks the provided response for QEMU process errors. +// If an error is found, it is extracted an returned, otherwise nil. +func getQEMUError(r response) error { + pl := bytes.NewReader(r.Payload) + dec := xdr.NewDecoder(pl) + + s, _, err := dec.DecodeString() + if err != nil { + return err + } + + var e qemuError + if err = json.Unmarshal([]byte(s), &e); err != nil { + return err + } + + if e.Error.Description != "" { + return errors.New(e.Error.Description) + } + + return nil +} + +// New configures a new Libvirt RPC connection. +func New(conn net.Conn) *Libvirt { + l := &Libvirt{ + conn: conn, + s: 0, + r: bufio.NewReader(conn), + w: bufio.NewWriter(conn), + mu: &sync.Mutex{}, + callbacks: make(map[uint32]chan response), + events: make(map[uint32]eventStream), + } + + go l.listen() + + return l +} diff --git a/vendor/github.com/digitalocean/go-libvirt/libvirt.yml b/vendor/github.com/digitalocean/go-libvirt/libvirt.yml new file mode 100644 index 000000000..4d6cc2d50 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/libvirt.yml @@ -0,0 +1,64 @@ +# Configuration file for c-for-go, which go-libvirt uses to translate the const +# and type definitions from the C-language sources in the libvirt project into +# Go. This file is used by the c-for-go binary (github.com/xlab/c-for-go), which +# is called when 'go generate' is run. See libvirt.go for the command line used. +--- +GENERATOR: + PackageName: libvirt + PackageLicense: | + Copyright 2018 The go-libvirt Authors. + + 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. + Includes: [] + +PARSER: + # We can't use environment variables here, but we don't want to process the + # libvirt version installed in the system folders (if any). Instead we'll + # rely on our caller to link the libvirt source directory to lv_source/, and + # run on that code. This isn't ideal, but changes to c-for-go are needed to + # fix it. + IncludePaths: [./lv_source/include] + SourcesPaths: + - libvirt/libvirt.h + - libvirt/virterror.h + +TRANSLATOR: + ConstRules: + defines: eval + Rules: + global: + - {action: accept, from: "^vir"} + post-global: + - {action: replace, from: "^vir"} + - {load: snakecase} + # Follow golint's capitalization conventions. + - {action: replace, from: "Api([A-Z]|$)", to: "API$1"} + - {action: replace, from: "Cpu([A-Z]|$)", to: "CPU$1"} + - {action: replace, from: "Dns([A-Z]|$)", to: "DNS$1"} + - {action: replace, from: "Eof([A-Z]|$)", to: "EOF$1"} + - {action: replace, from: "Id([A-Z]|$)", to: "ID$1"} + - {action: replace, from: "Ip([A-Z]|$)", to: "IP$1"} + - {action: replace, from: "Tls([A-Z]|$)", to: "TLS$1"} + - {action: replace, from: "Uuid([A-Z]|$)", to: "UUID$1"} + - {action: replace, from: "Uri([A-Z]|$)", to: "URI$1"} + - {action: replace, from: "Vcpu([A-Z]|$)", to: "VCPU$1"} + - {action: replace, from: "Xml([A-Z]|$)", to: "XML$1"} + - {action: replace, from: "Rpc([A-Z]|$)", to: "RPC$1"} + - {action: replace, from: "Ssh([A-Z]|$)", to: "SSH$1"} + - {action: replace, from: "Http([A-Z]|$)", to: "HTTP$1"} + - {transform: unexport, from: "^(Err|From|War)"} + const: + - {action: accept, from: "^VIR_"} + # Special case to prevent a collision with a type: + - {action: replace, from: "^VIR_DOMAIN_JOB_OPERATION", to: "VIR_DOMAIN_JOB_OPERATION_STR"} + - {transform: lower} diff --git a/vendor/github.com/digitalocean/go-libvirt/libvirtd.conf b/vendor/github.com/digitalocean/go-libvirt/libvirtd.conf new file mode 100644 index 000000000..d416d7ba3 --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/libvirtd.conf @@ -0,0 +1,7 @@ +# libvirtd configuration for travis-ci +listen_tls = 0 +listen_tcp = 1 +tcp_port = "16509" +listen_addr = "127.0.0.1" +auth_unix_rw = "none" +auth_tcp = "none" diff --git a/vendor/github.com/digitalocean/go-libvirt/rpc.go b/vendor/github.com/digitalocean/go-libvirt/rpc.go new file mode 100644 index 000000000..fbf2da17b --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/rpc.go @@ -0,0 +1,557 @@ +// Copyright 2018 The go-libvirt Authors. +// +// 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 libvirt + +import ( + "bytes" + "encoding/binary" + "errors" + "io" + "strings" + "sync/atomic" + + "github.com/digitalocean/go-libvirt/internal/constants" + xdr "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" +) + +// ErrUnsupported is returned if a procedure is not supported by libvirt +var ErrUnsupported = errors.New("unsupported procedure requested") + +// request and response types +const ( + // Call is used when making calls to the remote server. + Call = iota + + // Reply indicates a server reply. + Reply + + // Message is an asynchronous notification. + Message + + // Stream represents a stream data packet. + Stream + + // CallWithFDs is used by a client to indicate the request has + // arguments with file descriptors. + CallWithFDs + + // ReplyWithFDs is used by a server to indicate the request has + // arguments with file descriptors. + ReplyWithFDs +) + +// request and response statuses +const ( + // StatusOK is always set for method calls or events. + // For replies it indicates successful completion of the method. + // For streams it indicates confirmation of the end of file on the stream. + StatusOK = iota + + // StatusError for replies indicates that the method call failed + // and error information is being returned. For streams this indicates + // that not all data was sent and the stream has aborted. + StatusError + + // StatusContinue is only used for streams. + // This indicates that further data packets will be following. + StatusContinue +) + +// header is a libvirt rpc packet header +type header struct { + // Program identifier + Program uint32 + + // Program version + Version uint32 + + // Remote procedure identifier + Procedure uint32 + + // Call type, e.g., Reply + Type uint32 + + // Call serial number + Serial uint32 + + // Request status, e.g., StatusOK + Status uint32 +} + +// packet represents a RPC request or response. +type packet struct { + // Size of packet, in bytes, including length. + // Len + Header + Payload + Len uint32 + Header header +} + +// internal rpc response +type response struct { + Payload []byte + Status uint32 +} + +// event stream associated with a program and a procedure +type eventStream struct { + // Channel of events sent by libvirt + Events chan event + + // Remote procedure identifier used to unregister callback + DeregisterProc uint32 + + // Program identifier + Program uint32 +} + +// helper to create an event stream +func newEventStream(deregisterProc, program uint32) eventStream { + return eventStream{Events: make(chan event), DeregisterProc: deregisterProc, Program: program} +} + +// libvirt error response +type libvirtError struct { + Code uint32 + DomainID uint32 + Padding uint8 + Message string + Level uint32 +} + +func (e libvirtError) Error() string { + return e.Message +} + +// checkError is used to check whether an error is a libvirtError, and if it is, +// whether its error code matches the one passed in. It will return false if +// these conditions are not met. +func checkError(err error, expectedError errorNumber) bool { + e, ok := err.(libvirtError) + if ok { + return e.Code == uint32(expectedError) + } + return false +} + +// IsNotFound detects libvirt's ERR_NO_DOMAIN. +func IsNotFound(err error) bool { + return checkError(err, errNoDomain) +} + +// listen processes incoming data and routes +// responses to their respective callback handler. +func (l *Libvirt) listen() { + for { + // response packet length + length, err := pktlen(l.r) + if err != nil { + // When the underlying connection EOFs or is closed, stop + // this goroutine + if err == io.EOF || strings.Contains(err.Error(), "use of closed network connection") { + return + } + + // invalid packet + continue + } + + // response header + h, err := extractHeader(l.r) + if err != nil { + // invalid packet + continue + } + + // payload: packet length minus what was previously read + size := int(length) - (constants.PacketLengthSize + constants.HeaderSize) + buf := make([]byte, size) + _, err = io.ReadFull(l.r, buf) + if err != nil { + // invalid packet + continue + } + + // route response to caller + l.route(h, buf) + } +} + +// callback sends rpc responses to their respective caller. +func (l *Libvirt) callback(id uint32, res response) { + l.cm.Lock() + c, ok := l.callbacks[id] + l.cm.Unlock() + if ok { + // we close the channel in deregister() so that we don't block here + // forever without a receiver. If that happens, this write will panic. + defer func() { + recover() + }() + c <- res + } +} + +// route sends incoming packets to their listeners. +func (l *Libvirt) route(h *header, buf []byte) { + // route events to their respective listener + var streamEvent event + switch { + case h.Program == constants.ProgramQEMU && h.Procedure == constants.QEMUDomainMonitorEvent: + streamEvent = &DomainEvent{} + case h.Program == constants.Program && h.Procedure == constants.ProcDomainEventCallbackLifecycle: + streamEvent = &DomainEventCallbackLifecycleMsg{} + } + + if streamEvent != nil { + err := eventDecoder(buf, streamEvent) + if err != nil { // event was malformed, drop. + return + } + l.stream(streamEvent) + return + } + + // send responses to caller + res := response{ + Payload: buf, + Status: h.Status, + } + l.callback(h.Serial, res) +} + +// serial provides atomic access to the next sequential request serial number. +func (l *Libvirt) serial() uint32 { + return atomic.AddUint32(&l.s, 1) +} + +// stream decodes domain events and sends them +// to the respective event listener. +func (l *Libvirt) stream(e event) error { + // send to event listener + l.em.Lock() + c, ok := l.events[e.GetCallbackID()] + l.em.Unlock() + + if ok { + // we close the channel in deregister() so that we don't block here + // forever without a receiver. If that happens, this write will panic. + defer func() { + recover() + }() + c.Events <- e + } + return nil +} + +// addStream configures the routing for an event stream. +func (l *Libvirt) addStream(id uint32, s eventStream) { + l.em.Lock() + l.events[id] = s + l.em.Unlock() +} + +// removeStream notifies the libvirt server to stop sending events +// for the provided callback id. Upon successful de-registration the +// callback handler is destroyed. +func (l *Libvirt) removeStream(id uint32) error { + stream := l.events[id] + close(stream.Events) + + payload := struct { + CallbackID uint32 + }{ + CallbackID: id, + } + + buf, err := encode(&payload) + if err != nil { + return err + } + + _, err = l.request(stream.DeregisterProc, stream.Program, buf) + if err != nil { + return err + } + + l.em.Lock() + delete(l.events, id) + l.em.Unlock() + + return nil +} + +// register configures a method response callback +func (l *Libvirt) register(id uint32, c chan response) { + l.cm.Lock() + l.callbacks[id] = c + l.cm.Unlock() +} + +// deregister destroys a method response callback +func (l *Libvirt) deregister(id uint32) { + l.cm.Lock() + if _, ok := l.callbacks[id]; ok { + close(l.callbacks[id]) + delete(l.callbacks, id) + } + l.cm.Unlock() +} + +// deregisterAll closes all the waiting callback channels. This is used to clean +// up if the connection to libvirt is lost. Callers waiting for responses will +// return an error when the response channel is closed, rather than just +// hanging. +func (l *Libvirt) deregisterAll() { + l.cm.Lock() + for id := range l.callbacks { + // can't call deregister() here because we're already holding the lock. + close(l.callbacks[id]) + delete(l.callbacks, id) + } + l.cm.Unlock() +} + +// request performs a libvirt RPC request. +// returns response returned by server. +// if response is not OK, decodes error from it and returns it. +func (l *Libvirt) request(proc uint32, program uint32, payload []byte) (response, error) { + return l.requestStream(proc, program, payload, nil, nil) +} + +func (l *Libvirt) processIncomingStream(c chan response, inStream io.Writer) (response, error) { + for { + resp, err := l.getResponse(c) + if err != nil { + return resp, err + } + // StatusOK here means end of stream + if resp.Status == StatusOK { + return resp, nil + } + // StatusError is handled in getResponse, so this is StatusContinue + // StatusContinue is valid here only for stream packets + // libvirtd breaks protocol and returns StatusContinue with empty Payload when stream finishes + if len(resp.Payload) == 0 { + return resp, nil + } + if inStream != nil { + _, err = inStream.Write(resp.Payload) + if err != nil { + return response{}, err + } + } + } +} + +// requestStream performs a libvirt RPC request. The outStream and inStream +// parameters are optional, and should be nil for RPC endpoints that don't +// return a stream. +func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, + outStream io.Reader, inStream io.Writer) (response, error) { + serial := l.serial() + c := make(chan response) + + l.register(serial, c) + defer l.deregister(serial) + + err := l.sendPacket(serial, proc, program, payload, Call, StatusOK) + if err != nil { + return response{}, err + } + + resp, err := l.getResponse(c) + if err != nil { + return resp, err + } + + if outStream != nil { + abortOutStream := make(chan bool) + outStreamErr := make(chan error) + go func() { + outStreamErr <- l.sendStream(serial, proc, program, outStream, abortOutStream) + }() + + // Even without incoming stream server sends confirmation once all data is received + resp, err = l.processIncomingStream(c, inStream) + if err != nil { + abortOutStream <- true + return resp, err + } + + err = <-outStreamErr + if err != nil { + return response{}, err + } + } else if inStream != nil { + return l.processIncomingStream(c, inStream) + } + + return resp, nil +} + +func (l *Libvirt) sendStream(serial uint32, proc uint32, program uint32, stream io.Reader, abort chan bool) error { + // Keep total packet length under 4 MiB to follow possible limitation in libvirt server code + buf := make([]byte, 4*MiB-constants.HeaderSize) + for { + select { + case <-abort: + return l.sendPacket(serial, proc, program, nil, Stream, StatusError) + default: + } + n, err := stream.Read(buf) + if n > 0 { + err2 := l.sendPacket(serial, proc, program, buf[:n], Stream, StatusContinue) + if err2 != nil { + return err2 + } + } + if err != nil { + if err == io.EOF { + return l.sendPacket(serial, proc, program, nil, Stream, StatusOK) + } + // keep original error + err2 := l.sendPacket(serial, proc, program, nil, Stream, StatusError) + if err2 != nil { + return err2 + } + return err + } + } +} + +func (l *Libvirt) sendPacket(serial uint32, proc uint32, program uint32, payload []byte, typ uint32, status uint32) error { + size := constants.PacketLengthSize + constants.HeaderSize + if payload != nil { + size += len(payload) + } + + p := packet{ + Len: uint32(size), + Header: header{ + Program: program, + Version: constants.ProtocolVersion, + Procedure: proc, + Type: typ, + Serial: serial, + Status: status, + }, + } + + // write header + l.mu.Lock() + defer l.mu.Unlock() + err := binary.Write(l.w, binary.BigEndian, p) + if err != nil { + return err + } + + // write payload + if payload != nil { + err = binary.Write(l.w, binary.BigEndian, payload) + if err != nil { + return err + } + } + + return l.w.Flush() +} + +func (l *Libvirt) getResponse(c chan response) (response, error) { + resp := <-c + if resp.Status == StatusError { + return resp, decodeError(resp.Payload) + } + + return resp, nil +} + +// encode XDR encodes the provided data. +func encode(data interface{}) ([]byte, error) { + var buf bytes.Buffer + _, err := xdr.Marshal(&buf, data) + + return buf.Bytes(), err +} + +// decodeError extracts an error message from the provider buffer. +func decodeError(buf []byte) error { + var e libvirtError + + dec := xdr.NewDecoder(bytes.NewReader(buf)) + _, err := dec.Decode(&e) + if err != nil { + return err + } + + if strings.Contains(e.Message, "unknown procedure") { + return ErrUnsupported + } + // if libvirt returns ERR_OK, ignore the error + if checkError(e, errOk) { + return nil + } + + return e +} + +// eventDecoder decoder an event from a xdr buffer. +func eventDecoder(buf []byte, e interface{}) error { + dec := xdr.NewDecoder(bytes.NewReader(buf)) + _, err := dec.Decode(e) + return err +} + +// pktlen determines the length of an incoming rpc response. +// If an error is encountered reading the provided Reader, the +// error is returned and response length will be 0. +func pktlen(r io.Reader) (uint32, error) { + buf := make([]byte, constants.PacketLengthSize) + + for n := 0; n < cap(buf); { + nn, err := r.Read(buf) + if err != nil { + return 0, err + } + + n += nn + } + + return binary.BigEndian.Uint32(buf), nil +} + +// extractHeader returns the decoded header from an incoming response. +func extractHeader(r io.Reader) (*header, error) { + buf := make([]byte, constants.HeaderSize) + + for n := 0; n < cap(buf); { + nn, err := r.Read(buf) + if err != nil { + return nil, err + } + + n += nn + } + + h := &header{ + Program: binary.BigEndian.Uint32(buf[0:4]), + Version: binary.BigEndian.Uint32(buf[4:8]), + Procedure: binary.BigEndian.Uint32(buf[8:12]), + Type: binary.BigEndian.Uint32(buf[12:16]), + Serial: binary.BigEndian.Uint32(buf[16:20]), + Status: binary.BigEndian.Uint32(buf[20:24]), + } + + return h, nil +} diff --git a/vendor/github.com/digitalocean/go-libvirt/units.go b/vendor/github.com/digitalocean/go-libvirt/units.go new file mode 100644 index 000000000..03686507f --- /dev/null +++ b/vendor/github.com/digitalocean/go-libvirt/units.go @@ -0,0 +1,27 @@ +// Copyright 2016 The go-libvirt Authors. +// +// 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. + +// This module provides different units of measurement to make other +// code more readable. + +package libvirt + +const ( + // B - byte + B = 1 + // KiB - kibibyte + KiB = 1024 * B + // MiB - mebibyte + MiB = 1024 * KiB +) diff --git a/vendor/github.com/digitalocean/go-qemu/AUTHORS b/vendor/github.com/digitalocean/go-qemu/AUTHORS new file mode 100644 index 000000000..e2836c3c7 --- /dev/null +++ b/vendor/github.com/digitalocean/go-qemu/AUTHORS @@ -0,0 +1,17 @@ +Maintainer +---------- +DigitalOcean, Inc + +Original Authors +---------------- +Ben LeMasurier +Matt Layher + +Contributors +------------ +David Anderson +Justin Kim +Luis Sagastume +Nedim Dedic +Roberto J Rojas +Marko Mudrinic diff --git a/vendor/github.com/digitalocean/go-qemu/LICENSE.md b/vendor/github.com/digitalocean/go-qemu/LICENSE.md new file mode 100644 index 000000000..f5f4b8b5e --- /dev/null +++ b/vendor/github.com/digitalocean/go-qemu/LICENSE.md @@ -0,0 +1,195 @@ +Apache License +============== + +_Version 2.0, January 2004_ +_<>_ + +### Terms and Conditions for use, reproduction, and distribution + +#### 1. Definitions + +“License” shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +“Licensor” shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +“Legal Entity” shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, “control” means **(i)** the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the +outstanding shares, or **(iii)** beneficial ownership of such entity. + +“You” (or “Your”) shall mean an individual or Legal Entity exercising +permissions granted by this License. + +“Source” form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +“Object” form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +“Work” shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +“Derivative Works” shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +“Contribution” shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +“submitted” means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as “Not a Contribution.” + +“Contributor” shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +#### 2. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +#### 3. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +#### 4. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* **(a)** You must give any other recipients of the Work or Derivative Works a copy of +this License; and +* **(b)** You must cause any modified files to carry prominent notices stating that You +changed the files; and +* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +#### 5. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +#### 6. Trademarks + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +#### 7. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +#### 8. Limitation of Liability + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +#### 9. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +_END OF TERMS AND CONDITIONS_ + +### APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets `[]` replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same “printed page” as the copyright notice for easier identification within +third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + diff --git a/vendor/github.com/digitalocean/go-qemu/qmp/README.md b/vendor/github.com/digitalocean/go-qemu/qmp/README.md new file mode 100644 index 000000000..729280b31 --- /dev/null +++ b/vendor/github.com/digitalocean/go-qemu/qmp/README.md @@ -0,0 +1,104 @@ +QMP +=== + +Package `qmp` enables interaction with QEMU instances via the QEMU Machine Protocol (QMP). + +## Available Drivers + +### Libvirt + +If your environment is managed by Libvirt, QMP interaction must be proxied through the Libvirt daemon. This can be be done through two available drivers: + +#### RPC + +The RPC driver provides a pure Go implementation of Libvirt's RPC protocol. + +```go +//conn, err := net.DialTimeout("unix", "/var/run/libvirt/libvirt-sock", 2*time.Second) +conn, err := net.DialTimeout("tcp", "192.168.1.1:16509", 2*time.Second) +monitor := libvirtrpc.New("stage-lb-1", conn) +``` + +#### virsh + +A connection to the monitor socket is provided by proxing requests through the `virsh` executable. + +```go +monitor, err := qmp.NewLibvirtMonitor("qemu:///system", "stage-lb-1") +``` + +### Socket + +If your QEMU instances are not managed by libvirt, direct communication over its UNIX socket is available. + +```go +monitor, err := qmp.NewSocketMonitor("unix", "/var/lib/qemu/example.monitor", 2*time.Second) +``` + +## Examples + +Using the above to establish a new `qmp.Monitor`, the following examples provide a brief overview of QMP usage. + +_error checking omitted for the sake of brevity._ + +### Command Execution +```go +type StatusResult struct { + ID string `json:"id"` + Return struct { + Running bool `json:"running"` + Singlestep bool `json:"singlestep"` + Status string `json:"status"` + } `json:"return"` +} + +monitor.Connect() +defer monitor.Disconnect() + +cmd := []byte(`{ "execute": "query-status" }`) +raw, _ := monitor.Run(cmd) + +var result StatusResult +json.Unmarshal(raw, &result) + +fmt.Println(result.Return.Status) +``` + +``` +running +``` + +### Event Monitor + +```go +monitor.Connect() +defer monitor.Disconnect() + +stream, _ := monitor.Events() +for e := range stream { + log.Printf("EVENT: %s", e.Event) +} + +``` + +``` +$ virsh reboot example +Domain example is being rebooted +``` + +``` +EVENT: POWERDOWN +EVENT: SHUTDOWN +EVENT: STOP +EVENT: RESET +EVENT: RESUME +EVENT: RESET +... +``` + +## More information + +* [QEMU QMP Wiki](http://wiki.qemu.org/QMP) +* [QEMU QMP Intro](http://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/qmp-intro.txt;hb=HEAD) +* [QEMU QMP Events](http://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/qmp-events.txt;hb=HEAD) +* [QEMU QMP Spec](http://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/qmp-spec.txt;hb=HEAD) diff --git a/vendor/github.com/digitalocean/go-qemu/qmp/qmp.go b/vendor/github.com/digitalocean/go-qemu/qmp/qmp.go new file mode 100644 index 000000000..ba1911180 --- /dev/null +++ b/vendor/github.com/digitalocean/go-qemu/qmp/qmp.go @@ -0,0 +1,93 @@ +// Copyright 2016 The go-qemu Authors. +// +// 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 qmp enables interaction with QEMU instances +// via the QEMU Machine Protocol (QMP). +package qmp + +import ( + "errors" + "fmt" +) + +// ErrEventsNotSupported is returned by Events() if event streams +// are unsupported by either QEMU or libvirt. +var ErrEventsNotSupported = errors.New("event monitor is not supported") + +// Monitor represents a QEMU Machine Protocol socket. +// See: http://wiki.qemu.org/QMP +type Monitor interface { + Connect() error + Disconnect() error + Run(command []byte) (out []byte, err error) + Events() (events <-chan Event, err error) +} + +// Command represents a QMP command. +type Command struct { + // Name of the command to run + Execute string `json:"execute"` + + // Optional arguments for the above command. + Args interface{} `json:"arguments,omitempty"` +} + +type response struct { + ID string `json:"id"` + Return interface{} `json:"return,omitempty"` + Error struct { + Class string `json:"class"` + Desc string `json:"desc"` + } `json:"error,omitempty"` +} + +func (r *response) Err() error { + if r.Error.Desc == "" { + return nil + } + + return errors.New(r.Error.Desc) +} + +// Event represents a QEMU QMP event. +// See http://wiki.qemu.org/QMP +type Event struct { + // Event name, e.g., BLOCK_JOB_COMPLETE + Event string `json:"event"` + + // Arbitrary event data + Data map[string]interface{} `json:"data"` + + // Event timestamp, provided by QEMU. + Timestamp struct { + Seconds int64 `json:"seconds"` + Microseconds int64 `json:"microseconds"` + } `json:"timestamp"` +} + +// Version is the QEMU version structure returned when a QMP connection is +// initiated. +type Version struct { + Package string `json:"package"` + QEMU struct { + Major int `json:"major"` + Micro int `json:"micro"` + Minor int `json:"minor"` + } `json:"qemu"` +} + +func (v Version) String() string { + q := v.QEMU + return fmt.Sprintf("%d.%d.%d", q.Major, q.Minor, q.Micro) +} diff --git a/vendor/github.com/digitalocean/go-qemu/qmp/rpc.go b/vendor/github.com/digitalocean/go-qemu/qmp/rpc.go new file mode 100644 index 000000000..598dbb559 --- /dev/null +++ b/vendor/github.com/digitalocean/go-qemu/qmp/rpc.go @@ -0,0 +1,106 @@ +// Copyright 2016 The go-qemu Authors. +// +// 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 qmp + +import ( + "encoding/json" + "net" + + "github.com/digitalocean/go-libvirt" +) + +var _ Monitor = &LibvirtRPCMonitor{} + +// A LibvirtRPCMonitor implements LibVirt's remote procedure call protocol. +type LibvirtRPCMonitor struct { + l *libvirt.Libvirt + // Domain name as seen by libvirt, e.g., stage-lb-1 + Domain string +} + +// NewLibvirtRPCMonitor configures a new Libvirt RPC Monitor connection. +// The provided domain should be the name of the domain as seen +// by libvirt, e.g., stage-lb-1. +func NewLibvirtRPCMonitor(domain string, conn net.Conn) *LibvirtRPCMonitor { + l := libvirt.New(conn) + + return &LibvirtRPCMonitor{ + l: l, + Domain: domain, + } +} + +// Connect establishes communication with the libvirt server. +// The underlying libvirt socket connection must be previously established. +func (rpc *LibvirtRPCMonitor) Connect() error { + return rpc.l.Connect() +} + +// Disconnect shuts down communication with the libvirt server +// and closes the underlying net.Conn. +func (rpc *LibvirtRPCMonitor) Disconnect() error { + return rpc.l.Disconnect() +} + +// Events streams QEMU QMP Events. +// If a problem is encountered setting up the event monitor connection +// an error will be returned. Errors encountered during streaming will +// cause the returned event channel to be closed. +func (rpc *LibvirtRPCMonitor) Events() (<-chan Event, error) { + events, err := rpc.l.Events(rpc.Domain) + if err != nil { + return nil, err + } + + c := make(chan Event) + go func() { + // process events + for e := range events { + qe, err := qmpEvent(&e) + if err != nil { + close(c) + break + } + + c <- *qe + } + }() + + return c, nil +} + +// Run executes the given QAPI command against a domain's QEMU instance. +// For a list of available QAPI commands, see: +// http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD +func (rpc *LibvirtRPCMonitor) Run(cmd []byte) ([]byte, error) { + return rpc.l.Run(rpc.Domain, cmd) +} + +// qmpEvent takes a libvirt DomainEvent and returns the QMP equivalent. +func qmpEvent(e *libvirt.DomainEvent) (*Event, error) { + var qe Event + + if e.Details != nil { + if err := json.Unmarshal(e.Details, &qe.Data); err != nil { + return nil, err + } + } + + qe.Event = e.Event + qe.Timestamp.Seconds = int64(e.Seconds) + qe.Timestamp.Microseconds = int64(e.Microseconds) + + return &qe, nil +} diff --git a/vendor/github.com/digitalocean/go-qemu/qmp/socket.go b/vendor/github.com/digitalocean/go-qemu/qmp/socket.go new file mode 100644 index 000000000..4dd052944 --- /dev/null +++ b/vendor/github.com/digitalocean/go-qemu/qmp/socket.go @@ -0,0 +1,234 @@ +// Copyright 2016 The go-qemu Authors. +// +// 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 qmp + +import ( + "bufio" + "encoding/json" + "io" + "net" + "sync" + "sync/atomic" + "time" +) + +// A SocketMonitor is a Monitor which speaks directly to a QEMU Machine Protocol +// (QMP) socket. Communication is performed directly using a QEMU monitor socket, +// typically using a UNIX socket or TCP connection. Multiple connections to the +// same domain are not permitted, and will result in the monitor blocking until +// the existing connection is closed. +type SocketMonitor struct { + // QEMU version reported by a connected monitor socket. + Version *Version + + // Underlying connection + c net.Conn + + // Serialize running command against domain + mu sync.Mutex + + // Send command responses and errors + stream <-chan streamResponse + + // Send domain events to listeners when available + listeners *int32 + events <-chan Event +} + +// NewSocketMonitor configures a connection to the provided QEMU monitor socket. +// An error is returned if the socket cannot be successfully dialed, or the +// dial attempt times out. +// +// NewSocketMonitor may dial the QEMU socket using a variety of connection types: +// NewSocketMonitor("unix", "/var/lib/qemu/example.monitor", 2 * time.Second) +// NewSocketMonitor("tcp", "8.8.8.8:4444", 2 * time.Second) +func NewSocketMonitor(network, addr string, timeout time.Duration) (*SocketMonitor, error) { + c, err := net.DialTimeout(network, addr, timeout) + if err != nil { + return nil, err + } + + mon := &SocketMonitor{ + c: c, + listeners: new(int32), + } + + return mon, nil +} + +// Listen creates a new SocketMonitor listening for a single connection to the provided socket file or address. +// An error is returned if unable to listen at the specified file path or port. +// +// Listen will wait for a QEMU socket connection using a variety connection types: +// Listen("unix", "/var/lib/qemu/example.monitor") +// Listen("tcp", "0.0.0.0:4444") +func Listen(network, addr string) (*SocketMonitor, error) { + l, err := net.Listen(network, addr) + if err != nil { + return nil, err + } + c, err := l.Accept() + defer l.Close() + if err != nil { + return nil, err + } + + mon := &SocketMonitor{ + c: c, + listeners: new(int32), + } + + return mon, nil +} + +// Disconnect closes the QEMU monitor socket connection. +func (mon *SocketMonitor) Disconnect() error { + atomic.StoreInt32(mon.listeners, 0) + err := mon.c.Close() + + return err +} + +// qmpCapabilities is the command which must be executed to perform the +// QEMU QMP handshake. +const qmpCapabilities = "qmp_capabilities" + +// Connect sets up a QEMU QMP connection by connecting directly to the QEMU +// monitor socket. An error is returned if the capabilities handshake does +// not succeed. +func (mon *SocketMonitor) Connect() error { + enc := json.NewEncoder(mon.c) + dec := json.NewDecoder(mon.c) + + // Check for banner on startup + var ban banner + if err := dec.Decode(&ban); err != nil { + return err + } + mon.Version = &ban.QMP.Version + + // Issue capabilities handshake + cmd := Command{Execute: qmpCapabilities} + if err := enc.Encode(cmd); err != nil { + return err + } + + // Check for no error on return + var r response + if err := dec.Decode(&r); err != nil { + return err + } + if err := r.Err(); err != nil { + return err + } + + // Initialize socket listener for command responses and asynchronous + // events + events := make(chan Event) + stream := make(chan streamResponse) + go mon.listen(mon.c, events, stream) + + mon.events = events + mon.stream = stream + + return nil +} + +// Events streams QEMU QMP Events. +// Events should only be called once per Socket. If used with a qemu.Domain, +// qemu.Domain.Events should be called to retrieve events instead. +func (mon *SocketMonitor) Events() (<-chan Event, error) { + atomic.AddInt32(mon.listeners, 1) + return mon.events, nil +} + +// listen listens for incoming data from a QEMU monitor socket. It determines +// if the data is an asynchronous event or a response to a command, and returns +// the data on the appropriate channel. +func (mon *SocketMonitor) listen(r io.Reader, events chan<- Event, stream chan<- streamResponse) { + defer close(events) + defer close(stream) + + scanner := bufio.NewScanner(r) + for scanner.Scan() { + var e Event + + b := scanner.Bytes() + if err := json.Unmarshal(b, &e); err != nil { + continue + } + + // If data does not have an event type, it must be in response to a command. + if e.Event == "" { + stream <- streamResponse{buf: b} + continue + } + + // If nobody is listening for events, do not bother sending them. + if atomic.LoadInt32(mon.listeners) == 0 { + continue + } + + events <- e + } + + if err := scanner.Err(); err != nil { + stream <- streamResponse{err: err} + } +} + +// Run executes the given QAPI command against a domain's QEMU instance. +// For a list of available QAPI commands, see: +// http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD +func (mon *SocketMonitor) Run(command []byte) ([]byte, error) { + // Only allow a single command to be run at a time to ensure that responses + // to a command cannot be mixed with responses from another command + mon.mu.Lock() + defer mon.mu.Unlock() + + if _, err := mon.c.Write(command); err != nil { + return nil, err + } + + // Wait for a response or error to our command + res := <-mon.stream + if res.err != nil { + return nil, res.err + } + + // Check for QEMU errors + var r response + if err := json.Unmarshal(res.buf, &r); err != nil { + return nil, err + } + if err := r.Err(); err != nil { + return nil, err + } + + return res.buf, nil +} + +// banner is a wrapper type around a Version. +type banner struct { + QMP struct { + Version Version `json:"version"` + } `json:"QMP"` +} + +// streamResponse is a struct sent over a channel in response to a command. +type streamResponse struct { + buf []byte + err error +} diff --git a/vendor/github.com/exoscale/egoscale/.codeclimate.yml b/vendor/github.com/exoscale/egoscale/.codeclimate.yml new file mode 100644 index 000000000..dc2b688a4 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/.codeclimate.yml @@ -0,0 +1,31 @@ +version: "2" + +checks: + argument-count: + enabled: false + complex-logic: + enabled: false + file-lines: + enabled: false + method-complexity: + enabled: false + method-count: + enabled: false + method-lines: + enabled: false + nested-control-flow: + enabled: false + return-statements: + enabled: false + similar-code: + enabled: false + identical-code: + enabled: false + +plugins: + gofmt: + enabled: true + golint: + enabled: true + govet: + enabled: true diff --git a/vendor/github.com/exoscale/egoscale/.gitignore b/vendor/github.com/exoscale/egoscale/.gitignore new file mode 100644 index 000000000..800fe1da7 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/.gitignore @@ -0,0 +1,5 @@ +.token +dist +ops.asc +vendor +listApis.json \ No newline at end of file diff --git a/vendor/github.com/exoscale/egoscale/.golangci.yml b/vendor/github.com/exoscale/egoscale/.golangci.yml new file mode 100644 index 000000000..da5e91dff --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/.golangci.yml @@ -0,0 +1,27 @@ +linters-settings: + golint: + min-confidence: 0.3 + gocyclo: + min-complexity: 28 + goimports: + local-prefixes: github.com + +linters: + enable: + - deadcode + - dupl + - errcheck + - gocyclo + - goimports + - golint + - gosimple + - govet + - ineffassign + - megacheck + - nakedret + - scopelint + - staticcheck + - structcheck + - unused + - varcheck + disable-all: true diff --git a/vendor/github.com/exoscale/egoscale/.gometalinter.json b/vendor/github.com/exoscale/egoscale/.gometalinter.json new file mode 100644 index 000000000..c685c4603 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/.gometalinter.json @@ -0,0 +1,25 @@ +{ + "Test": false, + "Enable": [ + "deadcode", + "errcheck", + "golint", + "gosimple", + "gotype", + "ineffassign", + "interfacer", + "misspell", + "structcheck", + "unconvert", + "varcheck", + "vet", + "vetshadow" + ], + "Disable": [ + "goconst", + "gocyclo", + "gosec", + "maligned" + ], + "Skip": ["vendor"] +} diff --git a/vendor/github.com/exoscale/egoscale/.travis.yml b/vendor/github.com/exoscale/egoscale/.travis.yml new file mode 100644 index 000000000..94b2f19c8 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/.travis.yml @@ -0,0 +1,49 @@ +language: go + +dist: xenial +sudo: required + +go: +- "1.7.x" +- "1.8.x" +- "1.9.x" +- "1.10.x" +- "1.11.x" +- "1.12.x" +- tip + +env: + - GOLANGCI_LINT_VERSION=1.15.0 GO111MODULES=on + +cache: apt + +addons: + apt: + update: true + packages: + - rpm + +install: + - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v${GOLANGCI_LINT_VERSION} + - npm i codeclimate-test-reporter + - '[ "$(echo "$TRAVIS_GO_VERSION" | perl -pe "s/\\.[x\\d]+$//")" = "1.11" ] && go mod vendor || go get -u github.com/gofrs/uuid' + +before_script: + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - chmod +x ./cc-test-reporter + - ./cc-test-reporter before-build + +script: + - go test -race -coverprofile=c.out -covermode=atomic . + +after_script: + - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT + +jobs: + include: + - stage: golangci-lint + go: 1.10.x + if: type = pull_request + script: + - go get -u github.com/gofrs/uuid + - golangci-lint run . diff --git a/vendor/github.com/exoscale/egoscale/AUTHORS b/vendor/github.com/exoscale/egoscale/AUTHORS new file mode 100644 index 000000000..5c12a2a17 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/AUTHORS @@ -0,0 +1,9 @@ +Pierre-Yves Ritschard +Vincent Bernat +Chris Baumbauer +Marc-Aurèle Brothier +Sebastien Goasguen +Yoan Blanc +Stefano Marengo +Pierre-Emmanuel Jacquier +Fabrizio Steiner diff --git a/vendor/github.com/exoscale/egoscale/CHANGELOG.md b/vendor/github.com/exoscale/egoscale/CHANGELOG.md new file mode 100644 index 000000000..c222673c6 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/CHANGELOG.md @@ -0,0 +1,457 @@ +Changelog +========= + +0.18.1 +------ + +- change: make the "User-Agent" HTTP request header more informative and exposed + +0.18.0 +------ + +- feature: add method `DeepCopy` on type `AsyncJobResult` (#403) + +0.17.2 +------ + +- remove: remove the `IsFeatured` parameter from call `RegisterCustomTemplate` (#402) + +0.17.1 +------ + +- feature: add parameter `RescueProfile` to call `StartVirtualMachine` (#401) + +0.17.0 +------ + +- feature: add new call `RegisterCustomTemplate` (#400) +- feature: add new call `DeleteTemplate` (#399) + +0.16.0 +------ + +- feature: Add `Healthcheck*` parameters to call `UpdateIPAddress` +- change: Replace satori/go.uuid by gofrs/uuid + +0.15.0 +------ + +- change: prefix the healthcheck-related params with `Healthcheck` on call `AssociateIPAddress` +- EIP: the healthcheck should be a pointer +- ip addresses: Add the Healthcheck parameters +- readme: point to new lego org (#395) +- dns: user_id is not sent back (#394) + +0.14.3 +------ + +- fix: `AffinityGroup` lists virtual machines with `UUID` rather than string + +0.14.2 +------ + +- fix: `ListVirtualMachines` by `IDs` to accept `UUID` rather than string + +0.14.1 +------ + +- fix: `GetRunstatusPage` to always contain the subresources +- fix: `ListRunstatus*` to fetch all the subresources +- feature: `PaginateRunstatus*` used by list + +0.14.0 +------ + +- change: all DNS calls require a context +- fix: `CreateAffinityGroup` allows empty `name` + +0.13.3 +------ + +- fix: runstatus unmarshalling errors +- feature: `UUID` implements DeepCopy, DeepCopyInto +- change: export `BooleanResponse` + +0.13.2 +------ + +- feat: initial Runstatus API support +- feat: `admin` namespace containing `ListVirtualMachines` for admin usage + +0.13.1 +------ + +- feat: `Iso` support `ListIsos`, `AttachIso`, and `DetachIso` + +0.13.0 +------ + +- change: `Paginate` to accept `Listable` +- change: `ListCommand` is also `Listable` +- change: `client.Get` doesn't modify the given resource, returns a new one +- change: `Command` and `AsyncCommand` are fully public, thus extensible +- remove: `Gettable` + +0.12.5 +------ + +- fix: `AuthorizeSecurityGroupEgress` could return `authorizeSecurityGroupIngress` as name + +0.12.4 +------ + +- feat: `Snapshot` is `Listable` + +0.12.3 +------ + +- change: replace dep by Go modules +- change: remove domainid,domain,regionid,listall,isrecursive,... fields +- remove: `MigrateVirtualMachine`, `CreateUser`, `EnableAccount`, and other admin calls + +0.12.2 +------ + +- fix: `ListNics` has no virtualmachineid limitations anymore +- fix: `PCIDevice` ids are not UUIDs + +0.12.1 +------ + +- fix: `UpdateVMNicIP` is async + +0.12.0 +------ + +- feat: new VM state `Moving` +- feat: `UpdateNetwork` with `startip`, `endip`, `netmask` +- feat: `NetworkOffering` is `Listable` +- feat: when it fails parsing the body, it shows it +- fix: `Snapshot.State` is a string, rather than an scalar +- change: signature are now using the v3 version with expires by default + +0.11.6 +------ + +- fix: `Network.ListRequest` accepts a `Name` argument +- change: `SecurityGroup` and the rules aren't `Taggable` anymore + +0.11.5 +------ + +- feat: addition of `UpdateVMNicIP` +- fix: `UpdateVMAffinityGroup` expected response + +0.11.4 +------ + +*no changes in the core library* + +0.11.3 +------ + +*no changes in the core library* + +0.11.2 +------ + +- fix: empty list responses + +0.11.1 +------ + +- fix: `client.Sign` handles correctly the brackets (kudos to @stffabi) +- change: `client.Payload` returns a `url.Values` + +0.11.0 +------ + +- feat: `listOSCategories` and `OSCategory` type +- feat: `listApis` supports recursive response structures +- feat: `GetRecordsWithFilters` to list records with name or record_type filters +- fix: better `DNSErrorResponse` +- fix: `ListResourceLimits` type +- change: use UUID everywhere + +0.10.5 +------ + +- feat: `Client.Logger` to plug in any `*log.Logger` +- feat: `Client.TraceOn`/`ClientTraceOff` to toggle the HTTP tracing + +0.10.4 +------ + +- feat: `CIDR` to replace string string +- fix: prevent panic on nil + +0.10.3 +------ + +- feat: `Account` is Listable +- feat: `MACAddress` to replace string type +- fix: Go 1.7 support + +0.10.2 +------ + +- fix: ActivateIP6 response + +0.10.1 +------ + +- feat: expose `SyncRequest` and `SyncRequestWithContext` +- feat: addition of reverse DNS calls +- feat: addition of `SecurityGroup.UserSecurityGroup` + +0.10.0 +------ + +- global: cloudstack documentation links are moved into cs +- global: removal of all the `...Response` types +- feat: `Network` is `Listable` +- feat: addition of `deleteUser` +- feat: addition of `listHosts` +- feat: addition of `updateHost` +- feat: exo cmd (kudos to @pierre-emmanuelJ) +- change: refactor `Gettable` to use `ListRequest` + +0.9.31 +------ + +- fix: `IPAddress`.`ListRequest` with boolean fields +- fix: `Network`.`ListRequest` with boolean fields +- fix: `ServiceOffering`.`ListRequest` with boolean fields + +0.9.30 +------ + +- fix: `VirtualMachine` `PCIDevice` representation was incomplete + +0.9.29 +------ + +- change: `DNSErrorResponse` is a proper `error` + +0.9.28 +------ + +- feat: addition of `GetDomains` +- fix: `UpdateDomain` may contain more empty fields than `CreateDomain` + +0.9.27 +------ + +- fix: expects body to be `application/json` + +0.9.26 +------ + +- change: async timeout strategy wait two seconds and not fib(n) seconds + +0.9.25 +------ + +- fix: `GetVirtualUserData` response with `Decode` method handling base64 and gzip + +0.9.24 +------ + +- feat: `Template` is `Gettable` +- feat: `ServiceOffering` is `Gettable` +- feat: addition of `GetAPILimit` +- feat: addition of `CreateTemplate`, `PrepareTemplate`, `CopyTemplate`, `UpdateTemplate`, `RegisterTemplate` +- feat: addition of `MigrateVirtualMachine` +- feat: cmd cli +- change: remove useless fields related to Project and VPC + +0.9.23 +------ + +- feat: `booleanResponse` supports true booleans: https://github.com/apache/cloudstack/pull/2428 + +0.9.22 +------ + +- feat: `ListUsers`, `CreateUser`, `UpdateUser` +- feat: `ListResourceDetails` +- feat: `SecurityGroup` helper `RuleByID` +- feat: `Sign` signs the payload +- feat: `UpdateNetworkOffering` +- feat: `GetVirtualMachineUserData` +- feat: `EnableAccount` and `DisableAccount` (admin stuff) +- feat: `AsyncRequest` and `AsyncRequestWithContext` to examine the polling +- fix: `AuthorizeSecurityGroupIngress` support for ICMPv6 +- change: move `APIName()` into the `Client`, nice godoc +- change: `Payload` doesn't sign the request anymore +- change: `Client` exposes more of its underlying data +- change: requests are sent as GET unless it body size is too big + +0.9.21 +------ + +- feat: `Network` is `Listable` +- feat: `Zone` is `Gettable` +- feat: `Client.Payload` to help preview the HTTP parameters +- feat: generate command utility +- fix: `CreateSnapshot` was missing the `Name` attribute +- fix: `ListSnapshots` was missing the `IDs` attribute +- fix: `ListZones` was missing the `NetworkType` attribute +- fix: `ListAsyncJobs` was missing the `ListAll` attribute +- change: ICMP Type/Code are uint8 and TCP/UDP port are uint16 + +0.9.20 +------ + +- feat: `Template` is `Listable` +- feat: `IPAddress` is `Listable` +- change: `List` and `Paginate` return pointers +- fix: `Template` was missing `tags` + +0.9.19 +------ + +- feat: `SSHKeyPair` is `Listable` + +0.9.18 +------ + +- feat: `VirtualMachine` is `Listable` +- feat: new `Client.Paginate` and `Client.PaginateWithContext` +- change: the inner logic of `Listable` +- remove: not working `Client.AsyncList` + +0.9.17 +------ + +- fix: `AuthorizeSecurityGroup(In|E)gress` startport may be zero + +0.9.16 +------ + +- feat: new `Listable` interface +- feat: `Nic` is `Listable` +- feat: `Volume` is `Listable` +- feat: `Zone` is `Listable` +- feat: `AffinityGroup` is `Listable` +- remove: deprecated methods `ListNics`, `AddIPToNic`, and `RemoveIPFromNic` +- remove: deprecated method `GetRootVolumeForVirtualMachine` + +0.9.15 +------ + +- feat: `IPAddress` is `Gettable` and `Deletable` +- fix: serialization of *bool + +0.9.14 +------ + +- fix: `GetVMPassword` response +- remove: deprecated `GetTopology`, `GetImages`, and al + +0.9.13 +------ + +- feat: IP4 and IP6 flags to DeployVirtualMachine +- feat: add ActivateIP6 +- fix: error message was gobbled on 40x + +0.9.12 +------ + +- feat: add `BooleanRequestWithContext` +- feat: add `client.Get`, `client.GetWithContext` to fetch a resource +- feat: add `cleint.Delete`, `client.DeleteWithContext` to delete a resource +- feat: `SSHKeyPair` is `Gettable` and `Deletable` +- feat: `VirtualMachine` is `Gettable` and `Deletable` +- feat: `AffinityGroup` is `Gettable` and `Deletable` +- feat: `SecurityGroup` is `Gettable` and `Deletable` +- remove: deprecated methods `CreateAffinityGroup`, `DeleteAffinityGroup` +- remove: deprecated methods `CreateKeypair`, `DeleteKeypair`, `RegisterKeypair` +- remove: deprecated method `GetSecurityGroupID` + +0.9.11 +------ + +- feat: CloudStack API name is now public `APIName()` +- feat: enforce the mutual exclusivity of some fields +- feat: add `context.Context` to `RequestWithContext` +- change: `AsyncRequest` and `BooleanAsyncRequest` are gone, use `Request` and `BooleanRequest` instead. +- change: `AsyncInfo` is no more + +0.9.10 +------ + +- fix: typo made ListAll required in ListPublicIPAddresses +- fix: all bool are now *bool, respecting CS default value +- feat: (*VM).DefaultNic() to obtain the main Nic + +0.9.9 +----- + +- fix: affinity groups virtualmachineIds attribute +- fix: uuidList is not a list of strings + +0.9.8 +----- + +- feat: add RootDiskSize to RestoreVirtualMachine +- fix: monotonic polling using Context + +0.9.7 +----- + +- feat: add Taggable interface to expose ResourceType +- feat: add (Create|Update|Delete|List)InstanceGroup(s) +- feat: add RegisterUserKeys +- feat: add ListResourceLimits +- feat: add ListAccounts + +0.9.6 +----- + +- fix: update UpdateVirtualMachine userdata +- fix: Network's name/displaytext might be empty + +0.9.5 +----- + +- fix: serialization of slice + +0.9.4 +----- + +- fix: constants + +0.9.3 +----- + +- change: userdata expects a string +- change: no pointer in sub-struct's + +0.9.2 +----- + +- bug: createNetwork is a sync call +- bug: typo in listVirtualMachines' domainid +- bug: serialization of map[string], e.g. UpdateVirtualMachine +- change: IPAddress's use net.IP type +- feat: helpers VM.NicsByType, VM.NicByNetworkID, VM.NicByID +- feat: addition of CloudStack ApiErrorCode constants + +0.9.1 +----- + +- bug: sync calls returns succes as a string rather than a bool +- change: unexport BooleanResponse types +- feat: original CloudStack error response can be obtained + +0.9.0 +----- + +Big refactoring, addition of the documentation, compliance to golint. + +0.1.0 +----- + +Initial library diff --git a/vendor/github.com/exoscale/egoscale/LICENSE b/vendor/github.com/exoscale/egoscale/LICENSE new file mode 100644 index 000000000..327ecb823 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014 exoscale(tm) + + 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. diff --git a/vendor/github.com/exoscale/egoscale/README.md b/vendor/github.com/exoscale/egoscale/README.md new file mode 100644 index 000000000..bc40ec6b0 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/README.md @@ -0,0 +1,27 @@ +--- +title: Egoscale +description: the Go library for Exoscale +--- + + + +[![Build Status](https://travis-ci.org/exoscale/egoscale.svg?branch=master)](https://travis-ci.org/exoscale/egoscale) [![Maintainability](https://api.codeclimate.com/v1/badges/fcab3b624b7d3ca96a9d/maintainability)](https://codeclimate.com/github/exoscale/egoscale/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/fcab3b624b7d3ca96a9d/test_coverage)](https://codeclimate.com/github/exoscale/egoscale/test_coverage) [![GoDoc](https://godoc.org/github.com/exoscale/egoscale?status.svg)](https://godoc.org/github.com/exoscale/egoscale) [![Go Report Card](https://goreportcard.com/badge/github.com/exoscale/egoscale)](https://goreportcard.com/report/github.com/exoscale/egoscale) + +A wrapper for the [Exoscale public cloud](https://www.exoscale.com) API. + +## Known users + +- [Exoscale CLI](https://github.com/exoscale/cli) +- [Exoscale Terraform provider](https://github.com/exoscale/terraform-provider-exoscale) +- [ExoIP](https://github.com/exoscale/exoip): IP Watchdog +- [Lego](https://github.com/go-acme/lego): Let's Encrypt and ACME library +- Kubernetes Incubator: [External DNS](https://github.com/kubernetes-incubator/external-dns) +- [Docker machine](https://docs.docker.com/machine/drivers/exoscale/) +- [etc.](https://godoc.org/github.com/exoscale/egoscale?importers) + +## License + +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 diff --git a/vendor/github.com/exoscale/egoscale/accounts.go b/vendor/github.com/exoscale/egoscale/accounts.go new file mode 100644 index 000000000..9bcdec608 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/accounts.go @@ -0,0 +1,80 @@ +package egoscale + +// Account provides the detailed account information +type Account struct { + AccountDetails map[string]string `json:"accountdetails,omitempty" doc:"details for the account"` + CPUAvailable string `json:"cpuavailable,omitempty" doc:"the total number of cpu cores available to be created for this account"` + CPULimit string `json:"cpulimit,omitempty" doc:"the total number of cpu cores the account can own"` + CPUTotal int64 `json:"cputotal,omitempty" doc:"the total number of cpu cores owned by account"` + DefaultZoneID *UUID `json:"defaultzoneid,omitempty" doc:"the default zone of the account"` + EipLimit string `json:"eiplimit,omitempty" doc:"the total number of public elastic ip addresses this account can acquire"` + Groups []string `json:"groups,omitempty" doc:"the list of acl groups that account belongs to"` + ID *UUID `json:"id,omitempty" doc:"the id of the account"` + IPAvailable string `json:"ipavailable,omitempty" doc:"the total number of public ip addresses available for this account to acquire"` + IPLimit string `json:"iplimit,omitempty" doc:"the total number of public ip addresses this account can acquire"` + IPTotal int64 `json:"iptotal,omitempty" doc:"the total number of public ip addresses allocated for this account"` + IsCleanupRequired bool `json:"iscleanuprequired,omitempty" doc:"true if the account requires cleanup"` + IsDefault bool `json:"isdefault,omitempty" doc:"true if account is default, false otherwise"` + MemoryAvailable string `json:"memoryavailable,omitempty" doc:"the total memory (in MB) available to be created for this account"` + MemoryLimit string `json:"memorylimit,omitempty" doc:"the total memory (in MB) the account can own"` + MemoryTotal int64 `json:"memorytotal,omitempty" doc:"the total memory (in MB) owned by account"` + Name string `json:"name,omitempty" doc:"the name of the account"` + NetworkAvailable string `json:"networkavailable,omitempty" doc:"the total number of networks available to be created for this account"` + NetworkDomain string `json:"networkdomain,omitempty" doc:"the network domain"` + NetworkLimit string `json:"networklimit,omitempty" doc:"the total number of networks the account can own"` + NetworkTotal int64 `json:"networktotal,omitempty" doc:"the total number of networks owned by account"` + PrimaryStorageAvailable string `json:"primarystorageavailable,omitempty" doc:"the total primary storage space (in GiB) available to be used for this account"` + PrimaryStorageLimit string `json:"primarystoragelimit,omitempty" doc:"the total primary storage space (in GiB) the account can own"` + PrimaryStorageTotal int64 `json:"primarystoragetotal,omitempty" doc:"the total primary storage space (in GiB) owned by account"` + ProjectAvailable string `json:"projectavailable,omitempty" doc:"the total number of projects available for administration by this account"` + ProjectLimit string `json:"projectlimit,omitempty" doc:"the total number of projects the account can own"` + ProjectTotal int64 `json:"projecttotal,omitempty" doc:"the total number of projects being administrated by this account"` + SecondaryStorageAvailable string `json:"secondarystorageavailable,omitempty" doc:"the total secondary storage space (in GiB) available to be used for this account"` + SecondaryStorageLimit string `json:"secondarystoragelimit,omitempty" doc:"the total secondary storage space (in GiB) the account can own"` + SecondaryStorageTotal int64 `json:"secondarystoragetotal,omitempty" doc:"the total secondary storage space (in GiB) owned by account"` + SMTP bool `json:"smtp,omitempty" doc:"if SMTP outbound is allowed"` + SnapshotAvailable string `json:"snapshotavailable,omitempty" doc:"the total number of snapshots available for this account"` + SnapshotLimit string `json:"snapshotlimit,omitempty" doc:"the total number of snapshots which can be stored by this account"` + SnapshotTotal int64 `json:"snapshottotal,omitempty" doc:"the total number of snapshots stored by this account"` + State string `json:"state,omitempty" doc:"the state of the account"` + TemplateAvailable string `json:"templateavailable,omitempty" doc:"the total number of templates available to be created by this account"` + TemplateLimit string `json:"templatelimit,omitempty" doc:"the total number of templates which can be created by this account"` + TemplateTotal int64 `json:"templatetotal,omitempty" doc:"the total number of templates which have been created by this account"` + User []User `json:"user,omitempty" doc:"the list of users associated with account"` + VMAvailable string `json:"vmavailable,omitempty" doc:"the total number of virtual machines available for this account to acquire"` + VMLimit string `json:"vmlimit,omitempty" doc:"the total number of virtual machines that can be deployed by this account"` + VMRunning int `json:"vmrunning,omitempty" doc:"the total number of virtual machines running for this account"` + VMStopped int `json:"vmstopped,omitempty" doc:"the total number of virtual machines stopped for this account"` + VMTotal int64 `json:"vmtotal,omitempty" doc:"the total number of virtual machines deployed by this account"` + VolumeAvailable string `json:"volumeavailable,omitempty" doc:"the total volume available for this account"` + VolumeLimit string `json:"volumelimit,omitempty" doc:"the total volume which can be used by this account"` + VolumeTotal int64 `json:"volumetotal,omitempty" doc:"the total volume being used by this account"` +} + +// ListRequest builds the ListAccountsGroups request +func (a Account) ListRequest() (ListCommand, error) { + return &ListAccounts{ + ID: a.ID, + State: a.State, + }, nil +} + +//go:generate go run generate/main.go -interface=Listable ListAccounts + +// ListAccounts represents a query to display the accounts +type ListAccounts struct { + ID *UUID `json:"id,omitempty" doc:"List account by account ID"` + IsCleanUpRequired *bool `json:"iscleanuprequired,omitempty" doc:"list accounts by cleanuprequired attribute (values are true or false)"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"List account by account name"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + State string `json:"state,omitempty" doc:"List accounts by state. Valid states are enabled, disabled, and locked."` + _ bool `name:"listAccounts" description:"Lists accounts and provides detailed account information for listed accounts"` +} + +// ListAccountsResponse represents a list of accounts +type ListAccountsResponse struct { + Count int `json:"count"` + Account []Account `json:"account"` +} diff --git a/vendor/github.com/exoscale/egoscale/accounts_response.go b/vendor/github.com/exoscale/egoscale/accounts_response.go new file mode 100644 index 000000000..106daca32 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/accounts_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListAccounts) Response() interface{} { + return new(ListAccountsResponse) +} + +// ListRequest returns itself +func (ls *ListAccounts) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListAccounts) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListAccounts) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListAccounts) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListAccountsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListAccountsResponse was expected, got %T", resp)) + return + } + + for i := range items.Account { + if !callback(&items.Account[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/addresses.go b/vendor/github.com/exoscale/egoscale/addresses.go new file mode 100644 index 000000000..d828f52e0 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/addresses.go @@ -0,0 +1,179 @@ +package egoscale + +import ( + "context" + "fmt" + "net" +) + +// Healthcheck represents an Healthcheck attached to an IP +type Healthcheck struct { + Interval int64 `json:"interval,omitempty" doc:"healthcheck definition: time in seconds to wait for each check. Default: 10, minimum: 5"` + Mode string `json:"mode,omitempty" doc:"healthcheck definition: healthcheck mode can be either 'tcp' or 'http'"` + Path string `json:"path,omitempty" doc:"healthcheck definition: the path against which the 'http' healthcheck will be performed. Required if mode is 'http', ignored otherwise."` + Port int64 `json:"port,omitempty" doc:"healthcheck definition: the port against which the healthcheck will be performed. Required if a 'mode' is provided."` + StrikesFail int64 `json:"strikes-fail,omitempty" doc:"healthcheck definition: number of times to retry before declaring the healthcheck 'dead'. Default: 3"` + StrikesOk int64 `json:"strikes-ok,omitempty" doc:"healthcheck definition: number of times to retry before declaring the healthcheck 'alive'. Default: 2"` + Timeout int64 `json:"timeout,omitempty" doc:"healthcheck definition: time in seconds to wait for each check. Default: 2, cannot be greater than interval."` +} + +// IPAddress represents an IP Address +type IPAddress struct { + Allocated string `json:"allocated,omitempty" doc:"date the public IP address was acquired"` + Associated string `json:"associated,omitempty" doc:"date the public IP address was associated"` + AssociatedNetworkID *UUID `json:"associatednetworkid,omitempty" doc:"the ID of the Network associated with the IP address"` + AssociatedNetworkName string `json:"associatednetworkname,omitempty" doc:"the name of the Network associated with the IP address"` + ForVirtualNetwork bool `json:"forvirtualnetwork,omitempty" doc:"the virtual network for the IP address"` + Healthcheck *Healthcheck `json:"healthcheck,omitempty" doc:"The IP healthcheck configuration"` + ID *UUID `json:"id,omitempty" doc:"public IP address id"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"public IP address"` + IsElastic bool `json:"iselastic,omitempty" doc:"is an elastic ip"` + IsPortable bool `json:"isportable,omitempty" doc:"is public IP portable across the zones"` + IsSourceNat bool `json:"issourcenat,omitempty" doc:"true if the IP address is a source nat address, false otherwise"` + IsStaticNat *bool `json:"isstaticnat,omitempty" doc:"true if this ip is for static nat, false otherwise"` + IsSystem bool `json:"issystem,omitempty" doc:"true if this ip is system ip (was allocated as a part of deployVm or createLbRule)"` + NetworkID *UUID `json:"networkid,omitempty" doc:"the ID of the Network where ip belongs to"` + PhysicalNetworkID *UUID `json:"physicalnetworkid,omitempty" doc:"the physical network this belongs to"` + Purpose string `json:"purpose,omitempty" doc:"purpose of the IP address. In Acton this value is not null for Ips with isSystem=true, and can have either StaticNat or LB value"` + ReverseDNS []ReverseDNS `json:"reversedns,omitempty" doc:"the list of PTR record(s) associated with the ip address"` + State string `json:"state,omitempty" doc:"State of the ip address. Can be: Allocatin, Allocated and Releasing"` + Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with ip address"` + VirtualMachineDisplayName string `json:"virtualmachinedisplayname,omitempty" doc:"virtual machine display name the ip address is assigned to (not null only for static nat Ip)"` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"virtual machine id the ip address is assigned to (not null only for static nat Ip)"` + VirtualMachineName string `json:"virtualmachinename,omitempty" doc:"virtual machine name the ip address is assigned to (not null only for static nat Ip)"` + VlanID *UUID `json:"vlanid,omitempty" doc:"the ID of the VLAN associated with the IP address. This parameter is visible to ROOT admins only"` + VlanName string `json:"vlanname,omitempty" doc:"the VLAN associated with the IP address"` + VMIPAddress net.IP `json:"vmipaddress,omitempty" doc:"virtual machine (dnat) ip address (not null only for static nat Ip)"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"the ID of the zone the public IP address belongs to"` + ZoneName string `json:"zonename,omitempty" doc:"the name of the zone the public IP address belongs to"` +} + +// ResourceType returns the type of the resource +func (IPAddress) ResourceType() string { + return "PublicIpAddress" +} + +// ListRequest builds the ListAdresses request +func (ipaddress IPAddress) ListRequest() (ListCommand, error) { + req := &ListPublicIPAddresses{ + AssociatedNetworkID: ipaddress.AssociatedNetworkID, + ID: ipaddress.ID, + IPAddress: ipaddress.IPAddress, + PhysicalNetworkID: ipaddress.PhysicalNetworkID, + VlanID: ipaddress.VlanID, + ZoneID: ipaddress.ZoneID, + } + if ipaddress.IsElastic { + req.IsElastic = &ipaddress.IsElastic + } + if ipaddress.IsSourceNat { + req.IsSourceNat = &ipaddress.IsSourceNat + } + if ipaddress.ForVirtualNetwork { + req.ForVirtualNetwork = &ipaddress.ForVirtualNetwork + } + + return req, nil +} + +// Delete removes the resource +func (ipaddress IPAddress) Delete(ctx context.Context, client *Client) error { + if ipaddress.ID == nil { + return fmt.Errorf("an IPAddress may only be deleted using ID") + } + + return client.BooleanRequestWithContext(ctx, &DisassociateIPAddress{ + ID: ipaddress.ID, + }) +} + +// AssociateIPAddress (Async) represents the IP creation +type AssociateIPAddress struct { + HealthcheckInterval int64 `json:"interval,omitempty" doc:"healthcheck definition: time in seconds to wait for each check. Default: 10, minimum: 5"` + HealthcheckMode string `json:"mode,omitempty" doc:"healthcheck definition: healthcheck mode can be either 'tcp' or 'http'"` + HealthcheckPath string `json:"path,omitempty" doc:"healthcheck definition: the path against which the 'http' healthcheck will be performed. Required if mode is 'http', ignored otherwise."` + HealthcheckPort int64 `json:"port,omitempty" doc:"healthcheck definition: the port against which the healthcheck will be performed. Required if a 'mode' is provided."` + HealthcheckStrikesFail int64 `json:"strikes-fail,omitempty" doc:"healthcheck definition: number of times to retry before declaring the healthcheck 'dead'. Default: 3"` + HealthcheckStrikesOk int64 `json:"strikes-ok,omitempty" doc:"healthcheck definition: number of times to retry before declaring the healthcheck 'alive'. Default: 2"` + HealthcheckTimeout int64 `json:"timeout,omitempty" doc:"healthcheck definition: time in seconds to wait for each check. Default: 2, cannot be greater than interval."` + ZoneID *UUID `json:"zoneid,omitempty" doc:"the ID of the availability zone you want to acquire a public IP address from"` + _ bool `name:"associateIpAddress" description:"Acquires and associates a public IP to an account."` +} + +// Response returns the struct to unmarshal +func (AssociateIPAddress) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (AssociateIPAddress) AsyncResponse() interface{} { + return new(IPAddress) +} + +// DisassociateIPAddress (Async) represents the IP deletion +type DisassociateIPAddress struct { + ID *UUID `json:"id" doc:"the id of the public ip address to disassociate"` + _ bool `name:"disassociateIpAddress" description:"Disassociates an ip address from the account."` +} + +// Response returns the struct to unmarshal +func (DisassociateIPAddress) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (DisassociateIPAddress) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +// UpdateIPAddress (Async) represents the IP modification +type UpdateIPAddress struct { + HealthcheckInterval int64 `json:"interval,omitempty" doc:"healthcheck definition: time in seconds to wait for each check. Default: 10, minimum: 5"` + HealthcheckMode string `json:"mode,omitempty" doc:"healthcheck definition: healthcheck mode can be either 'tcp' or 'http'"` + HealthcheckPath string `json:"path,omitempty" doc:"healthcheck definition: the path against which the 'http' healthcheck will be performed. Required if mode is 'http', ignored otherwise."` + HealthcheckPort int64 `json:"port,omitempty" doc:"healthcheck definition: the port against which the healthcheck will be performed. Required if a 'mode' is provided."` + HealthcheckStrikesFail int64 `json:"strikes-fail,omitempty" doc:"healthcheck definition: number of times to retry before declaring the healthcheck 'dead'. Default: 3"` + HealthcheckStrikesOk int64 `json:"strikes-ok,omitempty" doc:"healthcheck definition: number of times to retry before declaring the healthcheck 'alive'. Default: 2"` + HealthcheckTimeout int64 `json:"timeout,omitempty" doc:"healthcheck definition: time in seconds to wait for each check. Default: 2, cannot be greater than interval."` + ID *UUID `json:"id" doc:"the id of the public IP address to update"` + _ bool `name:"updateIpAddress" description:"Updates an IP address"` +} + +// Response returns the struct to unmarshal +func (UpdateIPAddress) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (UpdateIPAddress) AsyncResponse() interface{} { + return new(IPAddress) +} + +//go:generate go run generate/main.go -interface=Listable ListPublicIPAddresses + +// ListPublicIPAddresses represents a search for public IP addresses +type ListPublicIPAddresses struct { + AllocatedOnly *bool `json:"allocatedonly,omitempty" doc:"limits search results to allocated public IP addresses"` + AssociatedNetworkID *UUID `json:"associatednetworkid,omitempty" doc:"lists all public IP addresses associated to the network specified"` + ForLoadBalancing *bool `json:"forloadbalancing,omitempty" doc:"list only ips used for load balancing"` + ForVirtualNetwork *bool `json:"forvirtualnetwork,omitempty" doc:"the virtual network for the IP address"` + ID *UUID `json:"id,omitempty" doc:"lists ip address by id"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"lists the specified IP address"` + IsElastic *bool `json:"iselastic,omitempty" doc:"list only elastic ip addresses"` + IsSourceNat *bool `json:"issourcenat,omitempty" doc:"list only source nat ip addresses"` + IsStaticNat *bool `json:"isstaticnat,omitempty" doc:"list only static nat ip addresses"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + PhysicalNetworkID *UUID `json:"physicalnetworkid,omitempty" doc:"lists all public IP addresses by physical network id"` + Tags []ResourceTag `json:"tags,omitempty" doc:"List resources by tags (key/value pairs)"` + VlanID *UUID `json:"vlanid,omitempty" doc:"lists all public IP addresses by VLAN ID"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"lists all public IP addresses by Zone ID"` + _ bool `name:"listPublicIpAddresses" description:"Lists all public ip addresses"` +} + +// ListPublicIPAddressesResponse represents a list of public IP addresses +type ListPublicIPAddressesResponse struct { + Count int `json:"count"` + PublicIPAddress []IPAddress `json:"publicipaddress"` +} diff --git a/vendor/github.com/exoscale/egoscale/affinity_groups.go b/vendor/github.com/exoscale/egoscale/affinity_groups.go new file mode 100644 index 000000000..61b979a28 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/affinity_groups.go @@ -0,0 +1,158 @@ +package egoscale + +import ( + "context" + "fmt" + "net/url" +) + +// AffinityGroup represents an (anti-)affinity group +// +// Affinity and Anti-Affinity groups provide a way to influence where VMs should run. +// See: http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/stable/virtual_machines.html#affinity-groups +type AffinityGroup struct { + Account string `json:"account,omitempty" doc:"the account owning the affinity group"` + Description string `json:"description,omitempty" doc:"the description of the affinity group"` + ID *UUID `json:"id,omitempty" doc:"the ID of the affinity group"` + Name string `json:"name,omitempty" doc:"the name of the affinity group"` + Type string `json:"type,omitempty" doc:"the type of the affinity group"` + VirtualMachineIDs []UUID `json:"virtualmachineIds,omitempty" doc:"virtual machine Ids associated with this affinity group"` +} + +// ListRequest builds the ListAffinityGroups request +func (ag AffinityGroup) ListRequest() (ListCommand, error) { + return &ListAffinityGroups{ + ID: ag.ID, + Name: ag.Name, + }, nil +} + +// Delete removes the given Affinity Group +func (ag AffinityGroup) Delete(ctx context.Context, client *Client) error { + if ag.ID == nil && ag.Name == "" { + return fmt.Errorf("an Affinity Group may only be deleted using ID or Name") + } + + req := &DeleteAffinityGroup{} + + if ag.ID != nil { + req.ID = ag.ID + } else { + req.Name = ag.Name + } + + return client.BooleanRequestWithContext(ctx, req) +} + +// AffinityGroupType represent an affinity group type +type AffinityGroupType struct { + Type string `json:"type,omitempty" doc:"the type of the affinity group"` +} + +// CreateAffinityGroup (Async) represents a new (anti-)affinity group +type CreateAffinityGroup struct { + Description string `json:"description,omitempty" doc:"Optional description of the affinity group"` + Name string `json:"name,omitempty" doc:"Name of the affinity group"` + Type string `json:"type" doc:"Type of the affinity group from the available affinity/anti-affinity group types"` + _ bool `name:"createAffinityGroup" description:"Creates an affinity/anti-affinity group"` +} + +func (req CreateAffinityGroup) onBeforeSend(params url.Values) error { + // Name must be set, but can be empty + if req.Name == "" { + params.Set("name", "") + } + return nil +} + +// Response returns the struct to unmarshal +func (CreateAffinityGroup) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (CreateAffinityGroup) AsyncResponse() interface{} { + return new(AffinityGroup) +} + +// UpdateVMAffinityGroup (Async) represents a modification of a (anti-)affinity group +type UpdateVMAffinityGroup struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + AffinityGroupIDs []UUID `json:"affinitygroupids,omitempty" doc:"comma separated list of affinity groups id that are going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter"` + AffinityGroupNames []string `json:"affinitygroupnames,omitempty" doc:"comma separated list of affinity groups names that are going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter"` + _ bool `name:"updateVMAffinityGroup" description:"Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect."` +} + +func (req UpdateVMAffinityGroup) onBeforeSend(params url.Values) error { + // Either AffinityGroupIDs or AffinityGroupNames must be set + if len(req.AffinityGroupIDs) == 0 && len(req.AffinityGroupNames) == 0 { + params.Set("affinitygroupids", "") + } + return nil +} + +// Response returns the struct to unmarshal +func (UpdateVMAffinityGroup) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (UpdateVMAffinityGroup) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// DeleteAffinityGroup (Async) represents an (anti-)affinity group to be deleted +type DeleteAffinityGroup struct { + ID *UUID `json:"id,omitempty" doc:"The ID of the affinity group. Mutually exclusive with name parameter"` + Name string `json:"name,omitempty" doc:"The name of the affinity group. Mutually exclusive with ID parameter"` + _ bool `name:"deleteAffinityGroup" description:"Deletes affinity group"` +} + +// Response returns the struct to unmarshal +func (DeleteAffinityGroup) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (DeleteAffinityGroup) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +//go:generate go run generate/main.go -interface=Listable ListAffinityGroups + +// ListAffinityGroups represents an (anti-)affinity groups search +type ListAffinityGroups struct { + ID *UUID `json:"id,omitempty" doc:"List the affinity group by the ID provided"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"Lists affinity groups by name"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + Type string `json:"type,omitempty" doc:"Lists affinity groups by type"` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"Lists affinity groups by virtual machine ID"` + _ bool `name:"listAffinityGroups" description:"Lists affinity groups"` +} + +// ListAffinityGroupsResponse represents a list of (anti-)affinity groups +type ListAffinityGroupsResponse struct { + Count int `json:"count"` + AffinityGroup []AffinityGroup `json:"affinitygroup"` +} + +// ListAffinityGroupTypes represents an (anti-)affinity groups search +type ListAffinityGroupTypes struct { + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + _ bool `name:"listAffinityGroupTypes" description:"Lists affinity group types available"` +} + +// Response returns the struct to unmarshal +func (ListAffinityGroupTypes) Response() interface{} { + return new(ListAffinityGroupTypesResponse) +} + +// ListAffinityGroupTypesResponse represents a list of (anti-)affinity group types +type ListAffinityGroupTypesResponse struct { + Count int `json:"count"` + AffinityGroupType []AffinityGroupType `json:"affinitygrouptype"` +} diff --git a/vendor/github.com/exoscale/egoscale/affinitygroups_response.go b/vendor/github.com/exoscale/egoscale/affinitygroups_response.go new file mode 100644 index 000000000..12c5bd747 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/affinitygroups_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListAffinityGroups) Response() interface{} { + return new(ListAffinityGroupsResponse) +} + +// ListRequest returns itself +func (ls *ListAffinityGroups) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListAffinityGroups) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListAffinityGroups) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListAffinityGroups) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListAffinityGroupsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListAffinityGroupsResponse was expected, got %T", resp)) + return + } + + for i := range items.AffinityGroup { + if !callback(&items.AffinityGroup[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/apis.go b/vendor/github.com/exoscale/egoscale/apis.go new file mode 100644 index 000000000..098a03761 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/apis.go @@ -0,0 +1,48 @@ +package egoscale + +// API represents an API service +type API struct { + Description string `json:"description,omitempty" doc:"description of the api"` + IsAsync bool `json:"isasync" doc:"true if api is asynchronous"` + Name string `json:"name,omitempty" doc:"the name of the api command"` + Related string `json:"related,omitempty" doc:"comma separated related apis"` + Since string `json:"since,omitempty" doc:"version of CloudStack the api was introduced in"` + Type string `json:"type,omitempty" doc:"response field type"` + Params []APIParam `json:"params,omitempty" doc:"the list params the api accepts"` + Response []APIField `json:"response,omitempty" doc:"api response fields"` +} + +// APIParam represents an API parameter field +type APIParam struct { + Description string `json:"description"` + Length int64 `json:"length"` + Name string `json:"name"` + Required bool `json:"required"` + Since string `json:"since,omitempty"` + Type string `json:"type"` +} + +// APIField represents an API response field +type APIField struct { + Description string `json:"description"` + Name string `json:"name"` + Response []APIField `json:"response,omitempty"` + Type string `json:"type"` +} + +// ListAPIs represents a query to list the api +type ListAPIs struct { + Name string `json:"name,omitempty" doc:"API name"` + _ bool `name:"listApis" description:"lists all available apis on the server"` +} + +// ListAPIsResponse represents a list of API +type ListAPIsResponse struct { + Count int `json:"count"` + API []API `json:"api"` +} + +// Response returns the struct to unmarshal +func (*ListAPIs) Response() interface{} { + return new(ListAPIsResponse) +} diff --git a/vendor/github.com/exoscale/egoscale/async_jobs.go b/vendor/github.com/exoscale/egoscale/async_jobs.go new file mode 100644 index 000000000..ab4b52cff --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/async_jobs.go @@ -0,0 +1,138 @@ +package egoscale + +import ( + "encoding/json" + "errors" +) + +// AsyncJobResult represents an asynchronous job result +type AsyncJobResult struct { + AccountID *UUID `json:"accountid,omitempty" doc:"the account that executed the async command"` + Cmd string `json:"cmd,omitempty" doc:"the async command executed"` + Created string `json:"created,omitempty" doc:"the created date of the job"` + JobID *UUID `json:"jobid" doc:"extra field for the initial async call"` + JobInstanceID *UUID `json:"jobinstanceid,omitempty" doc:"the unique ID of the instance/entity object related to the job"` + JobInstanceType string `json:"jobinstancetype,omitempty" doc:"the instance/entity object related to the job"` + JobProcStatus int `json:"jobprocstatus,omitempty" doc:"the progress information of the PENDING job"` + JobResult *json.RawMessage `json:"jobresult,omitempty" doc:"the result reason"` + JobResultCode int `json:"jobresultcode,omitempty" doc:"the result code for the job"` + JobResultType string `json:"jobresulttype,omitempty" doc:"the result type"` + JobStatus JobStatusType `json:"jobstatus,omitempty" doc:"the current job status-should be 0 for PENDING"` + UserID *UUID `json:"userid,omitempty" doc:"the user that executed the async command"` +} + +// DeepCopy create a true copy of the receiver. +func (a *AsyncJobResult) DeepCopy() *AsyncJobResult { + if a == nil { + return nil + } + + return &AsyncJobResult{ + AccountID: a.AccountID.DeepCopy(), + Cmd: a.Cmd, + Created: a.Created, + JobID: a.JobID.DeepCopy(), + JobInstanceID: a.JobInstanceID.DeepCopy(), + JobInstanceType: a.JobInstanceType, + JobProcStatus: a.JobProcStatus, + JobResult: a.JobResult, + JobResultCode: a.JobResultCode, + JobResultType: a.JobResultType, + JobStatus: a.JobStatus, + UserID: a.UserID.DeepCopy(), + } +} + +// DeepCopyInto copies the receiver into out. +// +// In (a) must be non nil. out must be non nil +func (a *AsyncJobResult) DeepCopyInto(out *AsyncJobResult) { + *out = AsyncJobResult{ + AccountID: a.AccountID.DeepCopy(), + Cmd: a.Cmd, + Created: a.Created, + JobID: a.JobID.DeepCopy(), + JobInstanceID: a.JobInstanceID.DeepCopy(), + JobInstanceType: a.JobInstanceType, + JobProcStatus: a.JobProcStatus, + JobResult: a.JobResult, + JobResultCode: a.JobResultCode, + JobResultType: a.JobResultType, + JobStatus: a.JobStatus, + UserID: a.UserID.DeepCopy(), + } +} + +// ListRequest buils the (empty) ListAsyncJobs request +func (a AsyncJobResult) ListRequest() (ListCommand, error) { + req := &ListAsyncJobs{ + StartDate: a.Created, + } + + return req, nil +} + +// Error builds an error message from the result +func (a AsyncJobResult) Error() error { + r := new(ErrorResponse) + if e := json.Unmarshal(*a.JobResult, r); e != nil { + return e + } + return r +} + +// QueryAsyncJobResult represents a query to fetch the status of async job +type QueryAsyncJobResult struct { + JobID *UUID `json:"jobid" doc:"the ID of the asynchronous job"` + _ bool `name:"queryAsyncJobResult" description:"Retrieves the current status of asynchronous job."` +} + +// Response returns the struct to unmarshal +func (QueryAsyncJobResult) Response() interface{} { + return new(AsyncJobResult) +} + +//go:generate go run generate/main.go -interface=Listable ListAsyncJobs + +// ListAsyncJobs list the asynchronous jobs +type ListAsyncJobs struct { + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + StartDate string `json:"startdate,omitempty" doc:"the start date of the async job"` + _ bool `name:"listAsyncJobs" description:"Lists all pending asynchronous jobs for the account."` +} + +// ListAsyncJobsResponse represents a list of job results +type ListAsyncJobsResponse struct { + Count int `json:"count"` + AsyncJob []AsyncJobResult `json:"asyncjobs"` +} + +// Result unmarshals the result of an AsyncJobResult into the given interface +func (a AsyncJobResult) Result(i interface{}) error { + if a.JobStatus == Failure { + return a.Error() + } + + if a.JobStatus == Success { + m := map[string]json.RawMessage{} + err := json.Unmarshal(*(a.JobResult), &m) + + if err == nil { + if len(m) >= 1 { + if _, ok := m["success"]; ok { + return json.Unmarshal(*(a.JobResult), i) + } + + // otherwise, pick the first key + for k := range m { + return json.Unmarshal(m[k], i) + } + } + return errors.New("empty response") + } + } + + return nil +} diff --git a/vendor/github.com/exoscale/egoscale/asyncjobs_response.go b/vendor/github.com/exoscale/egoscale/asyncjobs_response.go new file mode 100644 index 000000000..e4744e8bd --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/asyncjobs_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListAsyncJobs) Response() interface{} { + return new(ListAsyncJobsResponse) +} + +// ListRequest returns itself +func (ls *ListAsyncJobs) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListAsyncJobs) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListAsyncJobs) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListAsyncJobs) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListAsyncJobsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListAsyncJobsResponse was expected, got %T", resp)) + return + } + + for i := range items.AsyncJob { + if !callback(&items.AsyncJob[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/cidr.go b/vendor/github.com/exoscale/egoscale/cidr.go new file mode 100644 index 000000000..74c054b71 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/cidr.go @@ -0,0 +1,62 @@ +package egoscale + +import ( + "bytes" + "encoding/json" + "fmt" + "net" +) + +// CIDR represents a nicely JSON serializable net.IPNet +type CIDR struct { + net.IPNet +} + +// UnmarshalJSON unmarshals the raw JSON into the MAC address +func (cidr *CIDR) UnmarshalJSON(b []byte) error { + var s string + if err := json.Unmarshal(b, &s); err != nil { + return err + } + c, err := ParseCIDR(s) + if err != nil { + return err + } + *cidr = CIDR{c.IPNet} + + return nil +} + +// MarshalJSON converts the CIDR to a string representation +func (cidr CIDR) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", cidr)), nil +} + +// String returns the string representation of a CIDR +func (cidr CIDR) String() string { + return cidr.IPNet.String() +} + +// ParseCIDR parses a CIDR from a string +func ParseCIDR(s string) (*CIDR, error) { + _, net, err := net.ParseCIDR(s) + if err != nil { + return nil, err + } + return &CIDR{*net}, nil +} + +// MustParseCIDR forces parseCIDR or panics +func MustParseCIDR(s string) *CIDR { + cidr, err := ParseCIDR(s) + if err != nil { + panic(err) + } + + return cidr +} + +// Equal compare two CIDR +func (cidr CIDR) Equal(c CIDR) bool { + return (cidr.IPNet.IP.Equal(c.IPNet.IP) && bytes.Equal(cidr.IPNet.Mask, c.IPNet.Mask)) +} diff --git a/vendor/github.com/exoscale/egoscale/client.go b/vendor/github.com/exoscale/egoscale/client.go new file mode 100644 index 000000000..81c5f07b6 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/client.go @@ -0,0 +1,418 @@ +package egoscale + +import ( + "context" + "fmt" + "io/ioutil" + "log" + "net/http" + "net/http/httputil" + "os" + "reflect" + "runtime" + "strings" + "time" +) + +// UserAgent is the "User-Agent" HTTP request header added to outgoing HTTP requests. +var UserAgent = fmt.Sprintf("egoscale/%s (%s; %s/%s)", + Version, + runtime.Version(), + runtime.GOOS, + runtime.GOARCH) + +// Taggable represents a resource to which tags can be attached +// +// This is a helper to fill the resourcetype of a CreateTags call +type Taggable interface { + // ResourceType is the name of the Taggable type + ResourceType() string +} + +// Deletable represents an Interface that can be "Delete" by the client +type Deletable interface { + // Delete removes the given resource(s) or throws + Delete(context context.Context, client *Client) error +} + +// Listable represents an Interface that can be "List" by the client +type Listable interface { + // ListRequest builds the list command + ListRequest() (ListCommand, error) +} + +// Client represents the API client +type Client struct { + // HTTPClient holds the HTTP client + HTTPClient *http.Client + // Endpoint is the HTTP URL + Endpoint string + // APIKey is the API identifier + APIKey string + // apisecret is the API secret, hence non exposed + apiSecret string + // PageSize represents the default size for a paginated result + PageSize int + // Timeout represents the default timeout for the async requests + Timeout time.Duration + // Expiration representation how long a signed payload may be used + Expiration time.Duration + // RetryStrategy represents the waiting strategy for polling the async requests + RetryStrategy RetryStrategyFunc + // Logger contains any log, plug your own + Logger *log.Logger +} + +// RetryStrategyFunc represents a how much time to wait between two calls to the API +type RetryStrategyFunc func(int64) time.Duration + +// IterateItemFunc represents the callback to iterate a list of results, if false stops +type IterateItemFunc func(interface{}, error) bool + +// WaitAsyncJobResultFunc represents the callback to wait a results of an async request, if false stops +type WaitAsyncJobResultFunc func(*AsyncJobResult, error) bool + +// NewClient creates an API client with default timeout (60) +// +// Timeout is set to both the HTTP client and the client itself. +func NewClient(endpoint, apiKey, apiSecret string) *Client { + timeout := 60 * time.Second + expiration := 10 * time.Minute + + httpClient := &http.Client{ + Transport: http.DefaultTransport, + } + + client := &Client{ + HTTPClient: httpClient, + Endpoint: endpoint, + APIKey: apiKey, + apiSecret: apiSecret, + PageSize: 50, + Timeout: timeout, + Expiration: expiration, + RetryStrategy: MonotonicRetryStrategyFunc(2), + Logger: log.New(ioutil.Discard, "", 0), + } + + if prefix, ok := os.LookupEnv("EXOSCALE_TRACE"); ok { + client.Logger = log.New(os.Stderr, prefix, log.LstdFlags) + client.TraceOn() + } + + return client +} + +// Get populates the given resource or fails +func (client *Client) Get(ls Listable) (interface{}, error) { + ctx, cancel := context.WithTimeout(context.Background(), client.Timeout) + defer cancel() + + return client.GetWithContext(ctx, ls) +} + +// GetWithContext populates the given resource or fails +func (client *Client) GetWithContext(ctx context.Context, ls Listable) (interface{}, error) { + gs, err := client.ListWithContext(ctx, ls) + if err != nil { + return nil, err + } + + count := len(gs) + if count != 1 { + req, err := ls.ListRequest() + if err != nil { + return nil, err + } + params, err := client.Payload(req) + if err != nil { + return nil, err + } + + // removing sensitive/useless informations + params.Del("expires") + params.Del("response") + params.Del("signature") + params.Del("signatureversion") + + // formatting the query string nicely + payload := params.Encode() + payload = strings.Replace(payload, "&", ", ", -1) + + if count == 0 { + return nil, &ErrorResponse{ + CSErrorCode: ServerAPIException, + ErrorCode: ParamError, + ErrorText: fmt.Sprintf("not found, query: %s", payload), + } + } + return nil, fmt.Errorf("more than one element found: %s", payload) + } + + return gs[0], nil +} + +// Delete removes the given resource of fails +func (client *Client) Delete(g Deletable) error { + ctx, cancel := context.WithTimeout(context.Background(), client.Timeout) + defer cancel() + + return client.DeleteWithContext(ctx, g) +} + +// DeleteWithContext removes the given resource of fails +func (client *Client) DeleteWithContext(ctx context.Context, g Deletable) error { + return g.Delete(ctx, client) +} + +// List lists the given resource (and paginate till the end) +func (client *Client) List(g Listable) ([]interface{}, error) { + ctx, cancel := context.WithTimeout(context.Background(), client.Timeout) + defer cancel() + + return client.ListWithContext(ctx, g) +} + +// ListWithContext lists the given resources (and paginate till the end) +func (client *Client) ListWithContext(ctx context.Context, g Listable) (s []interface{}, err error) { + s = make([]interface{}, 0) + + defer func() { + if e := recover(); e != nil { + if g == nil || reflect.ValueOf(g).IsNil() { + err = fmt.Errorf("g Listable shouldn't be nil, got %#v", g) + return + } + + panic(e) + } + }() + + req, e := g.ListRequest() + if e != nil { + err = e + return + } + client.PaginateWithContext(ctx, req, func(item interface{}, e error) bool { + if item != nil { + s = append(s, item) + return true + } + err = e + return false + }) + + return +} + +// AsyncListWithContext lists the given resources (and paginate till the end) +// +// +// // NB: goroutine may leak if not read until the end. Create a proper context! +// ctx, cancel := context.WithCancel(context.Background()) +// defer cancel() +// +// outChan, errChan := client.AsyncListWithContext(ctx, new(egoscale.VirtualMachine)) +// +// for { +// select { +// case i, ok := <- outChan: +// if ok { +// vm := i.(egoscale.VirtualMachine) +// // ... +// } else { +// outChan = nil +// } +// case err, ok := <- errChan: +// if ok { +// // do something +// } +// // Once an error has been received, you can expect the channels to be closed. +// errChan = nil +// } +// if errChan == nil && outChan == nil { +// break +// } +// } +// +func (client *Client) AsyncListWithContext(ctx context.Context, g Listable) (<-chan interface{}, <-chan error) { + outChan := make(chan interface{}, client.PageSize) + errChan := make(chan error) + + go func() { + defer close(outChan) + defer close(errChan) + + req, err := g.ListRequest() + if err != nil { + errChan <- err + return + } + client.PaginateWithContext(ctx, req, func(item interface{}, e error) bool { + if item != nil { + outChan <- item + return true + } + errChan <- e + return false + }) + }() + + return outChan, errChan +} + +// Paginate runs the ListCommand and paginates +func (client *Client) Paginate(g Listable, callback IterateItemFunc) { + ctx, cancel := context.WithTimeout(context.Background(), client.Timeout) + defer cancel() + + client.PaginateWithContext(ctx, g, callback) +} + +// PaginateWithContext runs the ListCommand as long as the ctx is valid +func (client *Client) PaginateWithContext(ctx context.Context, g Listable, callback IterateItemFunc) { + req, err := g.ListRequest() + if err != nil { + callback(nil, err) + return + } + + pageSize := client.PageSize + + page := 1 + + for { + req.SetPage(page) + req.SetPageSize(pageSize) + resp, err := client.RequestWithContext(ctx, req) + if err != nil { + // in case of 431, the response is knowingly empty + if errResponse, ok := err.(*ErrorResponse); ok && page == 1 && errResponse.ErrorCode == ParamError { + break + } + + callback(nil, err) + break + } + + size := 0 + didErr := false + req.Each(resp, func(element interface{}, err error) bool { + // If the context was cancelled, kill it in flight + if e := ctx.Err(); e != nil { + element = nil + err = e + } + + if callback(element, err) { + size++ + return true + } + + didErr = true + return false + }) + + if size < pageSize || didErr { + break + } + + page++ + } +} + +// APIName returns the name of the given command +func (client *Client) APIName(command Command) string { + // This is due to a limitation of Go<=1.7 + _, ok := command.(*AuthorizeSecurityGroupEgress) + _, okPtr := command.(AuthorizeSecurityGroupEgress) + if ok || okPtr { + return "authorizeSecurityGroupEgress" + } + + info, err := info(command) + if err != nil { + panic(err) + } + return info.Name +} + +// APIDescription returns the description of the given command +func (client *Client) APIDescription(command Command) string { + info, err := info(command) + if err != nil { + return "*missing description*" + } + return info.Description +} + +// Response returns the response structure of the given command +func (client *Client) Response(command Command) interface{} { + switch c := command.(type) { + case AsyncCommand: + return c.AsyncResponse() + default: + return command.Response() + } +} + +// TraceOn activates the HTTP tracer +func (client *Client) TraceOn() { + if _, ok := client.HTTPClient.Transport.(*traceTransport); !ok { + client.HTTPClient.Transport = &traceTransport{ + transport: client.HTTPClient.Transport, + logger: client.Logger, + } + } +} + +// TraceOff deactivates the HTTP tracer +func (client *Client) TraceOff() { + if rt, ok := client.HTTPClient.Transport.(*traceTransport); ok { + client.HTTPClient.Transport = rt.transport + } +} + +// traceTransport contains the original HTTP transport to enable it to be reverted +type traceTransport struct { + transport http.RoundTripper + logger *log.Logger +} + +// RoundTrip executes a single HTTP transaction +func (t *traceTransport) RoundTrip(req *http.Request) (*http.Response, error) { + if dump, err := httputil.DumpRequest(req, true); err == nil { + t.logger.Printf("%s", dump) + } + + resp, err := t.transport.RoundTrip(req) + if err != nil { + return nil, err + } + + if dump, err := httputil.DumpResponse(resp, true); err == nil { + t.logger.Printf("%s", dump) + } + + return resp, nil +} + +// MonotonicRetryStrategyFunc returns a function that waits for n seconds for each iteration +func MonotonicRetryStrategyFunc(seconds int) RetryStrategyFunc { + return func(iteration int64) time.Duration { + return time.Duration(seconds) * time.Second + } +} + +// FibonacciRetryStrategy waits for an increasing amount of time following the Fibonacci sequence +func FibonacciRetryStrategy(iteration int64) time.Duration { + var a, b, i, tmp int64 + a = 0 + b = 1 + for i = 0; i < iteration; i++ { + tmp = a + b + a = b + b = tmp + } + return time.Duration(a) * time.Second +} diff --git a/vendor/github.com/exoscale/egoscale/cserrorcode_string.go b/vendor/github.com/exoscale/egoscale/cserrorcode_string.go new file mode 100644 index 000000000..4711d5425 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/cserrorcode_string.go @@ -0,0 +1,47 @@ +// Code generated by "stringer -type CSErrorCode"; DO NOT EDIT. + +package egoscale + +import "strconv" + +const _CSErrorCode_name = "CloudRuntimeExceptionExecutionExceptionHypervisorVersionChangedExceptionCloudExceptionAccountLimitExceptionAgentUnavailableExceptionCloudAuthenticationExceptionConcurrentOperationExceptionConflictingNetworkSettingsExceptionDiscoveredWithErrorExceptionHAStateExceptionInsufficientAddressCapacityExceptionInsufficientCapacityExceptionInsufficientNetworkCapacityExceptionInsufficientServerCapacityExceptionInsufficientStorageCapacityExceptionInternalErrorExceptionInvalidParameterValueExceptionManagementServerExceptionNetworkRuleConflictExceptionPermissionDeniedExceptionResourceAllocationExceptionResourceInUseExceptionResourceUnavailableExceptionStorageUnavailableExceptionUnsupportedServiceExceptionVirtualMachineMigrationExceptionAsyncCommandQueuedRequestLimitExceptionServerAPIException" + +var _CSErrorCode_map = map[CSErrorCode]string{ + 4250: _CSErrorCode_name[0:21], + 4260: _CSErrorCode_name[21:39], + 4265: _CSErrorCode_name[39:72], + 4275: _CSErrorCode_name[72:86], + 4280: _CSErrorCode_name[86:107], + 4285: _CSErrorCode_name[107:132], + 4290: _CSErrorCode_name[132:160], + 4300: _CSErrorCode_name[160:188], + 4305: _CSErrorCode_name[188:223], + 4310: _CSErrorCode_name[223:251], + 4315: _CSErrorCode_name[251:267], + 4320: _CSErrorCode_name[267:303], + 4325: _CSErrorCode_name[303:332], + 4330: _CSErrorCode_name[332:368], + 4335: _CSErrorCode_name[368:403], + 4340: _CSErrorCode_name[403:439], + 4345: _CSErrorCode_name[439:461], + 4350: _CSErrorCode_name[461:491], + 4355: _CSErrorCode_name[491:516], + 4360: _CSErrorCode_name[516:544], + 4365: _CSErrorCode_name[544:569], + 4370: _CSErrorCode_name[569:596], + 4375: _CSErrorCode_name[596:618], + 4380: _CSErrorCode_name[618:646], + 4385: _CSErrorCode_name[646:673], + 4390: _CSErrorCode_name[673:700], + 4395: _CSErrorCode_name[700:732], + 4540: _CSErrorCode_name[732:750], + 4545: _CSErrorCode_name[750:771], + 9999: _CSErrorCode_name[771:789], +} + +func (i CSErrorCode) String() string { + if str, ok := _CSErrorCode_map[i]; ok { + return str + } + return "CSErrorCode(" + strconv.FormatInt(int64(i), 10) + ")" +} diff --git a/vendor/github.com/exoscale/egoscale/dns.go b/vendor/github.com/exoscale/egoscale/dns.go new file mode 100644 index 000000000..3d3af4078 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/dns.go @@ -0,0 +1,364 @@ +package egoscale + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strconv" + "strings" +) + +// DNSDomain represents a domain +type DNSDomain struct { + ID int64 `json:"id"` + Name string `json:"name"` + UnicodeName string `json:"unicode_name"` + Token string `json:"token"` + State string `json:"state"` + Language string `json:"language,omitempty"` + Lockable bool `json:"lockable"` + AutoRenew bool `json:"auto_renew"` + WhoisProtected bool `json:"whois_protected"` + RecordCount int64 `json:"record_count"` + ServiceCount int64 `json:"service_count"` + ExpiresOn string `json:"expires_on,omitempty"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` +} + +// DNSDomainResponse represents a domain creation response +type DNSDomainResponse struct { + Domain *DNSDomain `json:"domain"` +} + +// DNSRecord represents a DNS record +type DNSRecord struct { + ID int64 `json:"id,omitempty"` + DomainID int64 `json:"domain_id,omitempty"` + Name string `json:"name"` + TTL int `json:"ttl,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Content string `json:"content"` + RecordType string `json:"record_type"` + Prio int `json:"prio,omitempty"` +} + +// DNSRecordResponse represents the creation of a DNS record +type DNSRecordResponse struct { + Record DNSRecord `json:"record"` +} + +// UpdateDNSRecord represents a DNS record +type UpdateDNSRecord struct { + ID int64 `json:"id,omitempty"` + DomainID int64 `json:"domain_id,omitempty"` + Name string `json:"name,omitempty"` + TTL int `json:"ttl,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Content string `json:"content,omitempty"` + RecordType string `json:"record_type,omitempty"` + Prio int `json:"prio,omitempty"` +} + +// UpdateDNSRecordResponse represents the creation of a DNS record +type UpdateDNSRecordResponse struct { + Record UpdateDNSRecord `json:"record"` +} + +// DNSErrorResponse represents an error in the API +type DNSErrorResponse struct { + Message string `json:"message,omitempty"` + Errors map[string][]string `json:"errors"` +} + +// Record represent record type +type Record int + +//go:generate stringer -type=Record +const ( + // A record type + A Record = iota + // AAAA record type + AAAA + // ALIAS record type + ALIAS + // CNAME record type + CNAME + // HINFO record type + HINFO + // MX record type + MX + // NAPTR record type + NAPTR + // NS record type + NS + // POOL record type + POOL + // SPF record type + SPF + // SRV record type + SRV + // SSHFP record type + SSHFP + // TXT record type + TXT + // URL record type + URL +) + +// Error formats the DNSerror into a string +func (req *DNSErrorResponse) Error() string { + if len(req.Errors) > 0 { + errs := []string{} + for name, ss := range req.Errors { + if len(ss) > 0 { + errs = append(errs, fmt.Sprintf("%s: %s", name, strings.Join(ss, ", "))) + } + } + return fmt.Sprintf("dns error: %s (%s)", req.Message, strings.Join(errs, "; ")) + } + return fmt.Sprintf("dns error: %s", req.Message) +} + +// CreateDomain creates a DNS domain +func (client *Client) CreateDomain(ctx context.Context, name string) (*DNSDomain, error) { + m, err := json.Marshal(DNSDomainResponse{ + Domain: &DNSDomain{ + Name: name, + }, + }) + if err != nil { + return nil, err + } + + resp, err := client.dnsRequest(ctx, "/v1/domains", nil, string(m), "POST") + if err != nil { + return nil, err + } + + var d *DNSDomainResponse + if err := json.Unmarshal(resp, &d); err != nil { + return nil, err + } + + return d.Domain, nil +} + +// GetDomain gets a DNS domain +func (client *Client) GetDomain(ctx context.Context, name string) (*DNSDomain, error) { + resp, err := client.dnsRequest(ctx, "/v1/domains/"+name, nil, "", "GET") + if err != nil { + return nil, err + } + + var d *DNSDomainResponse + if err := json.Unmarshal(resp, &d); err != nil { + return nil, err + } + + return d.Domain, nil +} + +// GetDomains gets DNS domains +func (client *Client) GetDomains(ctx context.Context) ([]DNSDomain, error) { + resp, err := client.dnsRequest(ctx, "/v1/domains", nil, "", "GET") + if err != nil { + return nil, err + } + + var d []DNSDomainResponse + if err := json.Unmarshal(resp, &d); err != nil { + return nil, err + } + + domains := make([]DNSDomain, len(d)) + for i := range d { + domains[i] = *d[i].Domain + } + return domains, nil +} + +// DeleteDomain delets a DNS domain +func (client *Client) DeleteDomain(ctx context.Context, name string) error { + _, err := client.dnsRequest(ctx, "/v1/domains/"+name, nil, "", "DELETE") + return err +} + +// GetRecord returns a DNS record +func (client *Client) GetRecord(ctx context.Context, domain string, recordID int64) (*DNSRecord, error) { + id := strconv.FormatInt(recordID, 10) + resp, err := client.dnsRequest(ctx, "/v1/domains/"+domain+"/records/"+id, nil, "", "GET") + if err != nil { + return nil, err + } + + var r DNSRecordResponse + if err = json.Unmarshal(resp, &r); err != nil { + return nil, err + } + + return &(r.Record), nil +} + +// GetRecords returns the DNS records +func (client *Client) GetRecords(ctx context.Context, domain string) ([]DNSRecord, error) { + resp, err := client.dnsRequest(ctx, "/v1/domains/"+domain+"/records", nil, "", "GET") + if err != nil { + return nil, err + } + + var r []DNSRecordResponse + if err = json.Unmarshal(resp, &r); err != nil { + return nil, err + } + + records := make([]DNSRecord, 0, len(r)) + for _, rec := range r { + records = append(records, rec.Record) + } + + return records, nil +} + +// GetRecordsWithFilters returns the DNS records (filters can be empty) +func (client *Client) GetRecordsWithFilters(ctx context.Context, domain, name, recordType string) ([]DNSRecord, error) { + + filters := url.Values{} + if name != "" { + filters.Add("name", name) + } + if recordType != "" { + filters.Add("record_type", recordType) + } + + resp, err := client.dnsRequest(ctx, "/v1/domains/"+domain+"/records", filters, "", "GET") + if err != nil { + return nil, err + } + + var r []DNSRecordResponse + if err = json.Unmarshal(resp, &r); err != nil { + return nil, err + } + + records := make([]DNSRecord, 0, len(r)) + for _, rec := range r { + records = append(records, rec.Record) + } + + return records, nil +} + +// CreateRecord creates a DNS record +func (client *Client) CreateRecord(ctx context.Context, name string, rec DNSRecord) (*DNSRecord, error) { + body, err := json.Marshal(DNSRecordResponse{ + Record: rec, + }) + if err != nil { + return nil, err + } + + resp, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/records", nil, string(body), "POST") + if err != nil { + return nil, err + } + + var r DNSRecordResponse + if err = json.Unmarshal(resp, &r); err != nil { + return nil, err + } + + return &(r.Record), nil +} + +// UpdateRecord updates a DNS record +func (client *Client) UpdateRecord(ctx context.Context, name string, rec UpdateDNSRecord) (*DNSRecord, error) { + body, err := json.Marshal(UpdateDNSRecordResponse{ + Record: rec, + }) + if err != nil { + return nil, err + } + + id := strconv.FormatInt(rec.ID, 10) + resp, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/records/"+id, nil, string(body), "PUT") + if err != nil { + return nil, err + } + + var r DNSRecordResponse + if err = json.Unmarshal(resp, &r); err != nil { + return nil, err + } + + return &(r.Record), nil +} + +// DeleteRecord deletes a record +func (client *Client) DeleteRecord(ctx context.Context, name string, recordID int64) error { + id := strconv.FormatInt(recordID, 10) + _, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/records/"+id, nil, "", "DELETE") + + return err +} + +func (client *Client) dnsRequest(ctx context.Context, uri string, urlValues url.Values, params, method string) (json.RawMessage, error) { + rawURL := client.Endpoint + uri + url, err := url.Parse(rawURL) + if err != nil { + return nil, err + } + + q := url.Query() + for k, vs := range urlValues { + for _, v := range vs { + q.Add(k, v) + } + } + url.RawQuery = q.Encode() + + req, err := http.NewRequest(method, url.String(), strings.NewReader(params)) + if err != nil { + return nil, err + } + + var hdr = make(http.Header) + hdr.Add("X-DNS-TOKEN", client.APIKey+":"+client.apiSecret) + hdr.Add("User-Agent", UserAgent) + hdr.Add("Accept", "application/json") + if params != "" { + hdr.Add("Content-Type", "application/json") + } + req.Header = hdr + + resp, err := client.HTTPClient.Do(req.WithContext(ctx)) + if err != nil { + return nil, err + } + defer resp.Body.Close() // nolint: errcheck + + contentType := resp.Header.Get("content-type") + if !strings.Contains(contentType, "application/json") { + return nil, fmt.Errorf(`response content-type expected to be "application/json", got %q`, contentType) + } + + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + if resp.StatusCode >= 400 { + e := new(DNSErrorResponse) + if err := json.Unmarshal(b, e); err != nil { + return nil, err + } + return nil, e + } + + return b, nil +} diff --git a/vendor/github.com/exoscale/egoscale/doc.go b/vendor/github.com/exoscale/egoscale/doc.go new file mode 100644 index 000000000..0d9997efa --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/doc.go @@ -0,0 +1,180 @@ +/* + +Package egoscale is a mapping for the Exoscale API (https://community.exoscale.com/api/compute/). + +Requests and Responses + +To build a request, construct the adequate struct. This library expects a pointer for efficiency reasons only. The response is a struct corresponding to the data at stake. E.g. DeployVirtualMachine gives a VirtualMachine, as a pointer as well to avoid big copies. + +Then everything within the struct is not a pointer. Find below some examples of how egoscale may be used. If anything feels odd or unclear, please let us know: https://github.com/exoscale/egoscale/issues + + req := &egoscale.DeployVirtualMachine{ + Size: 10, + ServiceOfferingID: egoscale.MustParseUUID("..."), + TemplateID: egoscale.MustParseUUID("..."), + ZoneID: egoscale.MastParseUUID("..."), + } + + fmt.Println("Deployment started") + resp, err := cs.Request(req) + if err != nil { + panic(err) + } + + vm := resp.(*egoscale.VirtualMachine) + fmt.Printf("Virtual Machine ID: %s\n", vm.ID) + +This example deploys a virtual machine while controlling the job status as it goes. It enables a finer control over errors, e.g. HTTP timeout, and eventually a way to kill it of (from the client side). + + req := &egoscale.DeployVirtualMachine{ + Size: 10, + ServiceOfferingID: egoscale.MustParseUUID("..."), + TemplateID: egoscale.MustParseUUID("..."), + ZoneID: egoscale.MustParseUUID("..."), + } + vm := &egoscale.VirtualMachine{} + + fmt.Println("Deployment started") + cs.AsyncRequest(req, func(jobResult *egoscale.AsyncJobResult, err error) bool { + if err != nil { + // any kind of error + panic(err) + } + + // Keep waiting + if jobResult.JobStatus == egoscale.Pending { + fmt.Println("wait...") + return true + } + + // Unmarshal the response into the response struct + if err := jobResult.Response(vm); err != nil { + // JSON unmarshaling error + panic(err) + } + + // Stop waiting + return false + }) + + fmt.Printf("Virtual Machine ID: %s\n", vm.ID) + +Debugging and traces + +As this library is mostly an HTTP client, you can reuse all the existing tools around it. + + cs := egoscale.NewClient("https://api.exoscale.com/compute", "EXO...", "...") + // sets a logger on stderr + cs.Logger = log.New(os.Stderr, "prefix", log.LstdFlags) + // activates the HTTP traces + cs.TraceOn() + +Nota bene: when running the tests or the egoscale library via another tool, e.g. the exo cli, the environment variable EXOSCALE_TRACE=prefix does the above configuration for you. As a developer using egoscale as a library, you'll find it more convenient to plug your favorite io.Writer as it's a Logger. + + +APIs + +All the available APIs on the server and provided by the API Discovery plugin. + + cs := egoscale.NewClient("https://api.exoscale.com/compute", "EXO...", "...") + + resp, err := cs.Request(&egoscale.ListAPIs{}) + if err != nil { + panic(err) + } + + for _, api := range resp.(*egoscale.ListAPIsResponse).API { + fmt.Printf("%s %s\n", api.Name, api.Description) + } + // Output: + // listNetworks Lists all available networks + // ... + +Security Groups + +Security Groups provide a way to isolate traffic to VMs. Rules are added via the two Authorization commands. + + resp, err := cs.Request(&egoscale.CreateSecurityGroup{ + Name: "Load balancer", + Description: "Open HTTP/HTTPS ports from the outside world", + }) + securityGroup := resp.(*egoscale.SecurityGroup) + + resp, err = cs.Request(&egoscale.AuthorizeSecurityGroupIngress{ + Description: "SSH traffic", + SecurityGroupID: securityGroup.ID, + CidrList: []CIDR{ + *egoscale.MustParseCIDR("0.0.0.0/0"), + *egoscale.MustParseCIDR("::/0"), + }, + Protocol: "tcp", + StartPort: 22, + EndPort: 22, + }) + // The modified SecurityGroup is returned + securityGroup := resp.(*egoscale.SecurityGroup) + + // ... + err = client.BooleanRequest(&egoscale.DeleteSecurityGroup{ + ID: securityGroup.ID, + }) + // ... + +Security Group also implement the generic List, Get and Delete interfaces (Listable and Deletable). + + // List all Security Groups + sgs, _ := cs.List(&egoscale.SecurityGroup{}) + for _, s := range sgs { + sg := s.(egoscale.SecurityGroup) + // ... + } + + // Get a Security Group + sgQuery := &egoscale.SecurityGroup{Name: "Load balancer"} + resp, err := cs.Get(sgQuery); err != nil { + ... + } + sg := resp.(*egoscale.SecurityGroup) + + if err := cs.Delete(sg); err != nil { + ... + } + // The SecurityGroup has been deleted + +See: https://community.exoscale.com/documentation/compute/security-groups/ + +Zones + +A Zone corresponds to a Data Center. You may list them. Zone implements the Listable interface, which let you perform a list in two different ways. The first exposes the underlying request while the second one hide them and you only manipulate the structs of your interest. + + // Using ListZones request + req := &egoscale.ListZones{} + resp, err := client.Request(req) + if err != nil { + panic(err) + } + + for _, zone := range resp.(*egoscale.ListZonesResponse) { + ... + } + + // Using client.List + zone := &egoscale.Zone{} + zones, err := client.List(zone) + if err != nil { + panic(err) + } + + for _, z := range zones { + zone := z.(egoscale.Zone) + ... + } + +Elastic IPs + +An Elastic IP is a way to attach an IP address to many Virtual Machines. The API side of the story configures the external environment, like the routing. Some work is required within the machine to properly configure the interfaces. + +See: https://community.exoscale.com/documentation/compute/eip/ + +*/ +package egoscale diff --git a/vendor/github.com/exoscale/egoscale/errorcode_string.go b/vendor/github.com/exoscale/egoscale/errorcode_string.go new file mode 100644 index 000000000..19711257e --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/errorcode_string.go @@ -0,0 +1,37 @@ +// Code generated by "stringer -type ErrorCode"; DO NOT EDIT. + +package egoscale + +import "strconv" + +const ( + _ErrorCode_name_0 = "Unauthorized" + _ErrorCode_name_1 = "MethodNotAllowed" + _ErrorCode_name_2 = "UnsupportedActionError" + _ErrorCode_name_3 = "APILimitExceededMalformedParameterErrorParamError" + _ErrorCode_name_4 = "InternalErrorAccountErrorAccountResourceLimitErrorInsufficientCapacityErrorResourceUnavailableErrorResourceAllocationErrorResourceInUseErrorNetworkRuleConflictError" +) + +var ( + _ErrorCode_index_3 = [...]uint8{0, 16, 39, 49} + _ErrorCode_index_4 = [...]uint8{0, 13, 25, 50, 75, 99, 122, 140, 164} +) + +func (i ErrorCode) String() string { + switch { + case i == 401: + return _ErrorCode_name_0 + case i == 405: + return _ErrorCode_name_1 + case i == 422: + return _ErrorCode_name_2 + case 429 <= i && i <= 431: + i -= 429 + return _ErrorCode_name_3[_ErrorCode_index_3[i]:_ErrorCode_index_3[i+1]] + case 530 <= i && i <= 537: + i -= 530 + return _ErrorCode_name_4[_ErrorCode_index_4[i]:_ErrorCode_index_4[i+1]] + default: + return "ErrorCode(" + strconv.FormatInt(int64(i), 10) + ")" + } +} diff --git a/vendor/github.com/exoscale/egoscale/events.go b/vendor/github.com/exoscale/egoscale/events.go new file mode 100644 index 000000000..c6adbfd69 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/events.go @@ -0,0 +1,76 @@ +package egoscale + +// Event represents an event in the system +type Event struct { + Account string `json:"account,omitempty" doc:"the account name for the account that owns the object being acted on in the event (e.g. the owner of the virtual machine, ip address, or security group)"` + Created string `json:"created,omitempty" doc:"the date the event was created"` + Description string `json:"description,omitempty" doc:"a brief description of the event"` + ID *UUID `json:"id" doc:"the ID of the event"` + Level string `json:"level,omitempty" doc:"the event level (INFO, WARN, ERROR)"` + ParentID *UUID `json:"parentid,omitempty" doc:"whether the event is parented"` + State string `json:"state,omitempty" doc:"the state of the event"` + Type string `json:"type,omitempty" doc:"the type of the event (see event types)"` + UserName string `json:"username,omitempty" doc:"the name of the user who performed the action (can be different from the account if an admin is performing an action for a user, e.g. starting/stopping a user's virtual machine)"` +} + +// ListRequest builds the ListEvents request +func (event Event) ListRequest() (ListCommand, error) { + req := &ListEvents{ + ID: event.ID, + Level: event.Level, + Type: event.Type, + } + + return req, nil +} + +// EventType represent a type of event +type EventType struct { + Name string `json:"name,omitempty" doc:"Event Type"` +} + +// ListRequest builds the ListEventTypes request +func (EventType) ListRequest() (ListCommand, error) { + req := &ListEventTypes{} + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListEvents + +// ListEvents list the events +type ListEvents struct { + Duration int `json:"duration,omitempty" doc:"the duration of the event"` + EndDate string `json:"enddate,omitempty" doc:"the end date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")"` + EntryTime int `json:"entrytime,omitempty" doc:"the time the event was entered"` + ID *UUID `json:"id,omitempty" doc:"the ID of the event"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Level string `json:"level,omitempty" doc:"the event level (INFO, WARN, ERROR)"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + StartDate string `json:"startdate,omitempty" doc:"the start date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")"` + Type string `json:"type,omitempty" doc:"the event type (see event types)"` + _ bool `name:"listEvents" description:"A command to list events."` +} + +// ListEventsResponse represents a response of a list query +type ListEventsResponse struct { + Count int `json:"count"` + Event []Event `json:"event"` +} + +//go:generate go run generate/main.go -interface=Listable ListEventTypes + +// ListEventTypes list the event types +type ListEventTypes struct { + Page int `json:"page,omitempty"` // fake + PageSize int `json:"pagesize,omitempty"` // fake + _ bool `name:"listEventTypes" description:"List Event Types"` +} + +// ListEventTypesResponse represents a response of a list query +type ListEventTypesResponse struct { + Count int `json:"count"` + EventType []EventType `json:"eventtype"` + _ bool `name:"listEventTypes" description:"List Event Types"` +} diff --git a/vendor/github.com/exoscale/egoscale/events_response.go b/vendor/github.com/exoscale/egoscale/events_response.go new file mode 100644 index 000000000..2af10cf45 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/events_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListEvents) Response() interface{} { + return new(ListEventsResponse) +} + +// ListRequest returns itself +func (ls *ListEvents) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListEvents) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListEvents) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListEvents) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListEventsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListEventsResponse was expected, got %T", resp)) + return + } + + for i := range items.Event { + if !callback(&items.Event[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/eventtypes_response.go b/vendor/github.com/exoscale/egoscale/eventtypes_response.go new file mode 100644 index 000000000..073d9648f --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/eventtypes_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListEventTypes) Response() interface{} { + return new(ListEventTypesResponse) +} + +// ListRequest returns itself +func (ls *ListEventTypes) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListEventTypes) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListEventTypes) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListEventTypes) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListEventTypesResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListEventTypesResponse was expected, got %T", resp)) + return + } + + for i := range items.EventType { + if !callback(&items.EventType[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/go.mod b/vendor/github.com/exoscale/egoscale/go.mod new file mode 100644 index 000000000..c31a038a2 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/go.mod @@ -0,0 +1,3 @@ +module github.com/exoscale/egoscale + +require github.com/gofrs/uuid v3.2.0+incompatible diff --git a/vendor/github.com/exoscale/egoscale/go.sum b/vendor/github.com/exoscale/egoscale/go.sum new file mode 100644 index 000000000..f27a0746d --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/go.sum @@ -0,0 +1,2 @@ +github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= +github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= diff --git a/vendor/github.com/exoscale/egoscale/gopher.png b/vendor/github.com/exoscale/egoscale/gopher.png new file mode 100644 index 000000000..16420a618 Binary files /dev/null and b/vendor/github.com/exoscale/egoscale/gopher.png differ diff --git a/vendor/github.com/exoscale/egoscale/instance_groups.go b/vendor/github.com/exoscale/egoscale/instance_groups.go new file mode 100644 index 000000000..52bffba9a --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/instance_groups.go @@ -0,0 +1,71 @@ +package egoscale + +// InstanceGroup represents a group of VM +type InstanceGroup struct { + Account string `json:"account,omitempty" doc:"the account owning the instance group"` + Created string `json:"created,omitempty" doc:"time and date the instance group was created"` + ID *UUID `json:"id,omitempty" doc:"the id of the instance group"` + Name string `json:"name,omitempty" doc:"the name of the instance group"` +} + +// ListRequest builds the ListInstanceGroups request +func (ig InstanceGroup) ListRequest() (ListCommand, error) { + req := &ListInstanceGroups{ + ID: ig.ID, + Name: ig.Name, + } + + return req, nil +} + +// CreateInstanceGroup creates a VM group +type CreateInstanceGroup struct { + Name string `json:"name" doc:"the name of the instance group"` + _ bool `name:"createInstanceGroup" description:"Creates a vm group"` +} + +// Response returns the struct to unmarshal +func (CreateInstanceGroup) Response() interface{} { + return new(InstanceGroup) +} + +// UpdateInstanceGroup updates a VM group +type UpdateInstanceGroup struct { + ID *UUID `json:"id" doc:"Instance group ID"` + Name string `json:"name,omitempty" doc:"new instance group name"` + _ bool `name:"updateInstanceGroup" description:"Updates a vm group"` +} + +// Response returns the struct to unmarshal +func (UpdateInstanceGroup) Response() interface{} { + return new(InstanceGroup) +} + +// DeleteInstanceGroup deletes a VM group +type DeleteInstanceGroup struct { + ID *UUID `json:"id" doc:"the ID of the instance group"` + _ bool `name:"deleteInstanceGroup" description:"Deletes a vm group"` +} + +// Response returns the struct to unmarshal +func (DeleteInstanceGroup) Response() interface{} { + return new(BooleanResponse) +} + +//go:generate go run generate/main.go -interface=Listable ListInstanceGroups + +// ListInstanceGroups lists VM groups +type ListInstanceGroups struct { + ID *UUID `json:"id,omitempty" doc:"List instance groups by ID"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"List instance groups by name"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + _ bool `name:"listInstanceGroups" description:"Lists vm groups"` +} + +// ListInstanceGroupsResponse represents a list of instance groups +type ListInstanceGroupsResponse struct { + Count int `json:"count"` + InstanceGroup []InstanceGroup `json:"instancegroup"` +} diff --git a/vendor/github.com/exoscale/egoscale/instancegroups_response.go b/vendor/github.com/exoscale/egoscale/instancegroups_response.go new file mode 100644 index 000000000..90fc1dbac --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/instancegroups_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListInstanceGroups) Response() interface{} { + return new(ListInstanceGroupsResponse) +} + +// ListRequest returns itself +func (ls *ListInstanceGroups) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListInstanceGroups) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListInstanceGroups) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListInstanceGroups) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListInstanceGroupsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListInstanceGroupsResponse was expected, got %T", resp)) + return + } + + for i := range items.InstanceGroup { + if !callback(&items.InstanceGroup[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/isos.go b/vendor/github.com/exoscale/egoscale/isos.go new file mode 100644 index 000000000..d9a0ace82 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/isos.go @@ -0,0 +1,94 @@ +package egoscale + +// ISO represents an attachable ISO disc +type ISO Template + +// ResourceType returns the type of the resource +func (ISO) ResourceType() string { + return "ISO" +} + +// ListRequest produces the ListIsos command. +func (iso ISO) ListRequest() (ListCommand, error) { + req := &ListISOs{ + ID: iso.ID, + Name: iso.Name, + ZoneID: iso.ZoneID, + } + if iso.Bootable { + *req.Bootable = true + } + if iso.IsFeatured { + req.IsoFilter = "featured" + } + if iso.IsPublic { + *req.IsPublic = true + } + if iso.IsReady { + *req.IsReady = true + } + + for i := range iso.Tags { + req.Tags = append(req.Tags, iso.Tags[i]) + } + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListISOs + +// ListISOs represents the list all available ISO files request +type ListISOs struct { + _ bool `name:"listIsos" description:"Lists all available ISO files."` + Bootable *bool `json:"bootable,omitempty" doc:"True if the ISO is bootable, false otherwise"` + ID *UUID `json:"id,omitempty" doc:"List ISO by id"` + IsoFilter string `json:"isofilter,omitempty" doc:"Possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins)."` + IsPublic *bool `json:"ispublic,omitempty" doc:"True if the ISO is publicly available to all users, false otherwise."` + IsReady *bool `json:"isready,omitempty" doc:"True if this ISO is ready to be deployed"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"List all isos by name"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + ShowRemoved *bool `json:"showremoved,omitempty" doc:"Show removed ISOs as well"` + Tags []ResourceTag `json:"tags,omitempty" doc:"List resources by tags (key/value pairs)"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"The ID of the zone"` +} + +// ListISOsResponse represents a list of ISO files +type ListISOsResponse struct { + Count int `json:"count"` + ISO []ISO `json:"iso"` +} + +// AttachISO represents the request to attach an ISO to a virtual machine. +type AttachISO struct { + _ bool `name:"attachIso" description:"Attaches an ISO to a virtual machine."` + ID *UUID `json:"id" doc:"the ID of the ISO file"` + VirtualMachineID *UUID `json:"virtualmachineid" doc:"the ID of the virtual machine"` +} + +// Response returns the struct to unmarshal +func (AttachISO) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (AttachISO) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// DetachISO represents the request to detach an ISO to a virtual machine. +type DetachISO struct { + _ bool `name:"detachIso" description:"Detaches any ISO file (if any) currently attached to a virtual machine."` + VirtualMachineID *UUID `json:"virtualmachineid" doc:"The ID of the virtual machine"` +} + +// Response returns the struct to unmarshal +func (DetachISO) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (DetachISO) AsyncResponse() interface{} { + return new(VirtualMachine) +} diff --git a/vendor/github.com/exoscale/egoscale/isos_response.go b/vendor/github.com/exoscale/egoscale/isos_response.go new file mode 100644 index 000000000..2faa45a88 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/isos_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListISOs) Response() interface{} { + return new(ListISOsResponse) +} + +// ListRequest returns itself +func (ls *ListISOs) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListISOs) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListISOs) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListISOs) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListISOsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListISOsResponse was expected, got %T", resp)) + return + } + + for i := range items.ISO { + if !callback(&items.ISO[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/jobstatustype_string.go b/vendor/github.com/exoscale/egoscale/jobstatustype_string.go new file mode 100644 index 000000000..298561608 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/jobstatustype_string.go @@ -0,0 +1,16 @@ +// Code generated by "stringer -type JobStatusType"; DO NOT EDIT. + +package egoscale + +import "strconv" + +const _JobStatusType_name = "PendingSuccessFailure" + +var _JobStatusType_index = [...]uint8{0, 7, 14, 21} + +func (i JobStatusType) String() string { + if i < 0 || i >= JobStatusType(len(_JobStatusType_index)-1) { + return "JobStatusType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _JobStatusType_name[_JobStatusType_index[i]:_JobStatusType_index[i+1]] +} diff --git a/vendor/github.com/exoscale/egoscale/macaddress.go b/vendor/github.com/exoscale/egoscale/macaddress.go new file mode 100644 index 000000000..3c1dcaea4 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/macaddress.go @@ -0,0 +1,63 @@ +package egoscale + +import ( + "encoding/json" + "fmt" + "net" +) + +// MACAddress is a nicely JSON serializable net.HardwareAddr +type MACAddress net.HardwareAddr + +// String returns the MAC address in standard format +func (mac MACAddress) String() string { + return (net.HardwareAddr)(mac).String() +} + +// MAC48 builds a MAC-48 MACAddress +func MAC48(a, b, c, d, e, f byte) MACAddress { + m := make(MACAddress, 6) + m[0] = a + m[1] = b + m[2] = c + m[3] = d + m[4] = e + m[5] = f + return m +} + +// UnmarshalJSON unmarshals the raw JSON into the MAC address +func (mac *MACAddress) UnmarshalJSON(b []byte) error { + var addr string + if err := json.Unmarshal(b, &addr); err != nil { + return err + } + hw, err := ParseMAC(addr) + if err != nil { + return err + } + + *mac = make(MACAddress, 6) + copy(*mac, hw) + return nil +} + +// MarshalJSON converts the MAC Address to a string representation +func (mac MACAddress) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", mac.String())), nil +} + +// ParseMAC converts a string into a MACAddress +func ParseMAC(s string) (MACAddress, error) { + hw, err := net.ParseMAC(s) + return (MACAddress)(hw), err +} + +// MustParseMAC acts like ParseMAC but panics if in case of an error +func MustParseMAC(s string) MACAddress { + mac, err := ParseMAC(s) + if err != nil { + panic(err) + } + return mac +} diff --git a/vendor/github.com/exoscale/egoscale/network_offerings.go b/vendor/github.com/exoscale/egoscale/network_offerings.go new file mode 100644 index 000000000..989d5871f --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/network_offerings.go @@ -0,0 +1,91 @@ +package egoscale + +// NetworkOffering corresponds to the Compute Offerings +type NetworkOffering struct { + Availability string `json:"availability,omitempty" doc:"availability of the network offering"` + ConserveMode bool `json:"conservemode,omitempty" doc:"true if network offering is ip conserve mode enabled"` + Created string `json:"created,omitempty" doc:"the date this network offering was created"` + Details map[string]string `json:"details,omitempty" doc:"additional key/value details tied with network offering"` + DisplayText string `json:"displaytext,omitempty" doc:"an alternate display text of the network offering."` + EgressDefaultPolicy bool `json:"egressdefaultpolicy,omitempty" doc:"true if guest network default egress policy is allow; false if default egress policy is deny"` + GuestIPType string `json:"guestiptype,omitempty" doc:"guest type of the network offering, can be Shared or Isolated"` + ID *UUID `json:"id,omitempty" doc:"the id of the network offering"` + IsDefault bool `json:"isdefault,omitempty" doc:"true if network offering is default, false otherwise"` + IsPersistent bool `json:"ispersistent,omitempty" doc:"true if network offering supports persistent networks, false otherwise"` + MaxConnections int `json:"maxconnections,omitempty" doc:"maximum number of concurrents connections to be handled by lb"` + Name string `json:"name,omitempty" doc:"the name of the network offering"` + NetworkRate int `json:"networkrate,omitempty" doc:"data transfer rate in megabits per second allowed."` + Service []Service `json:"service,omitempty" doc:"the list of supported services"` + ServiceOfferingID *UUID `json:"serviceofferingid,omitempty" doc:"the ID of the service offering used by virtual router provider"` + SpecifyIPRanges bool `json:"specifyipranges,omitempty" doc:"true if network offering supports specifying ip ranges, false otherwise"` + SpecifyVlan bool `json:"specifyvlan,omitempty" doc:"true if network offering supports vlans, false otherwise"` + State string `json:"state,omitempty" doc:"state of the network offering. Can be Disabled/Enabled/Inactive"` + SupportsStrechedL2Subnet bool `json:"supportsstrechedl2subnet,omitempty" doc:"true if network offering supports network that span multiple zones"` + Tags string `json:"tags,omitempty" doc:"the tags for the network offering"` + TrafficType string `json:"traffictype,omitempty" doc:"the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage."` +} + +// ListRequest builds the ListNetworkOfferings request +// +// This doesn't take into account the IsDefault flag as the default value is true. +func (no NetworkOffering) ListRequest() (ListCommand, error) { + req := &ListNetworkOfferings{ + Availability: no.Availability, + ID: no.ID, + Name: no.Name, + State: no.State, + TrafficType: no.TrafficType, + } + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListNetworkOfferings + +// ListNetworkOfferings represents a query for network offerings +type ListNetworkOfferings struct { + Availability string `json:"availability,omitempty" doc:"the availability of network offering. Default value is Required"` + DisplayText string `json:"displaytext,omitempty" doc:"list network offerings by display text"` + GuestIPType string `json:"guestiptype,omitempty" doc:"list network offerings by guest type: Shared or Isolated"` + ID *UUID `json:"id,omitempty" doc:"list network offerings by id"` + IsDefault *bool `json:"isdefault,omitempty" doc:"true if need to list only default network offerings. Default value is false"` + IsTagged *bool `json:"istagged,omitempty" doc:"true if offering has tags specified"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"list network offerings by name"` + NetworkID *UUID `json:"networkid,omitempty" doc:"the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to."` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + SourceNATSupported *bool `json:"sourcenatsupported,omitempty" doc:"true if need to list only netwok offerings where source nat is supported, false otherwise"` + SpecifyIPRanges *bool `json:"specifyipranges,omitempty" doc:"true if need to list only network offerings which support specifying ip ranges"` + SpecifyVlan *bool `json:"specifyvlan,omitempty" doc:"the tags for the network offering."` + State string `json:"state,omitempty" doc:"list network offerings by state"` + SupportedServices []Service `json:"supportedservices,omitempty" doc:"list network offerings supporting certain services"` + Tags string `json:"tags,omitempty" doc:"list network offerings by tags"` + TrafficType string `json:"traffictype,omitempty" doc:"list by traffic type"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"list network offerings available for network creation in specific zone"` + _ bool `name:"listNetworkOfferings" description:"Lists all available network offerings."` +} + +// ListNetworkOfferingsResponse represents a list of service offerings +type ListNetworkOfferingsResponse struct { + Count int `json:"count"` + NetworkOffering []NetworkOffering `json:"networkoffering"` +} + +// UpdateNetworkOffering represents a modification of a network offering +type UpdateNetworkOffering struct { + Availability string `json:"availability,omitempty" doc:"the availability of network offering. Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering"` + DisplayText string `json:"displaytext,omitempty" doc:"the display text of the network offering"` + ID *UUID `json:"id,omitempty" doc:"the id of the network offering"` + KeepAliveEnabled *bool `json:"keepaliveenabled,omitempty" doc:"if true keepalive will be turned on in the loadbalancer. At the time of writing this has only an effect on haproxy; the mode http and httpclose options are unset in the haproxy conf file."` + MaxConnections int `json:"maxconnections,omitempty" doc:"maximum number of concurrent connections supported by the network offering"` + Name string `json:"name,omitempty" doc:"the name of the network offering"` + SortKey int `json:"sortkey,omitempty" doc:"sort key of the network offering, integer"` + State string `json:"state,omitempty" doc:"update state for the network offering"` + _ bool `name:"updateNetworkOffering" description:"Updates a network offering."` +} + +// Response returns the struct to unmarshal +func (UpdateNetworkOffering) Response() interface{} { + return new(NetworkOffering) +} diff --git a/vendor/github.com/exoscale/egoscale/networkofferings_response.go b/vendor/github.com/exoscale/egoscale/networkofferings_response.go new file mode 100644 index 000000000..656de7253 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/networkofferings_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListNetworkOfferings) Response() interface{} { + return new(ListNetworkOfferingsResponse) +} + +// ListRequest returns itself +func (ls *ListNetworkOfferings) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListNetworkOfferings) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListNetworkOfferings) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListNetworkOfferings) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListNetworkOfferingsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListNetworkOfferingsResponse was expected, got %T", resp)) + return + } + + for i := range items.NetworkOffering { + if !callback(&items.NetworkOffering[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/networks.go b/vendor/github.com/exoscale/egoscale/networks.go new file mode 100644 index 000000000..4d6ce12e3 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/networks.go @@ -0,0 +1,229 @@ +package egoscale + +import ( + "net" + "net/url" +) + +// Network represents a network +// +// See: http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/latest/networking_and_traffic.html +type Network struct { + Account string `json:"account,omitempty" doc:"the owner of the network"` + AccountID *UUID `json:"accountid,omitempty" doc:"the owner ID of the network"` + BroadcastDomainType string `json:"broadcastdomaintype,omitempty" doc:"Broadcast domain type of the network"` + BroadcastURI string `json:"broadcasturi,omitempty" doc:"broadcast uri of the network."` + CanUseForDeploy bool `json:"canusefordeploy,omitempty" doc:"list networks available for vm deployment"` + CIDR *CIDR `json:"cidr,omitempty" doc:"Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR"` + DisplayText string `json:"displaytext,omitempty" doc:"the displaytext of the network"` + DNS1 net.IP `json:"dns1,omitempty" doc:"the first DNS for the network"` + DNS2 net.IP `json:"dns2,omitempty" doc:"the second DNS for the network"` + EndIP net.IP `json:"endip,omitempty" doc:"the ending IP address in the network IP range. Required for managed networks."` + Gateway net.IP `json:"gateway,omitempty" doc:"the network's gateway"` + ID *UUID `json:"id,omitempty" doc:"the id of the network"` + IP6CIDR *CIDR `json:"ip6cidr,omitempty" doc:"the cidr of IPv6 network"` + IP6Gateway net.IP `json:"ip6gateway,omitempty" doc:"the gateway of IPv6 network"` + IsDefault bool `json:"isdefault,omitempty" doc:"true if network is default, false otherwise"` + IsPersistent bool `json:"ispersistent,omitempty" doc:"list networks that are persistent"` + IsSystem bool `json:"issystem,omitempty" doc:"true if network is system, false otherwise"` + Name string `json:"name,omitempty" doc:"the name of the network"` + Netmask net.IP `json:"netmask,omitempty" doc:"the network's netmask"` + NetworkCIDR *CIDR `json:"networkcidr,omitempty" doc:"the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE"` + NetworkDomain string `json:"networkdomain,omitempty" doc:"the network domain"` + NetworkOfferingAvailability string `json:"networkofferingavailability,omitempty" doc:"availability of the network offering the network is created from"` + NetworkOfferingConserveMode bool `json:"networkofferingconservemode,omitempty" doc:"true if network offering is ip conserve mode enabled"` + NetworkOfferingDisplayText string `json:"networkofferingdisplaytext,omitempty" doc:"display text of the network offering the network is created from"` + NetworkOfferingID *UUID `json:"networkofferingid,omitempty" doc:"network offering id the network is created from"` + NetworkOfferingName string `json:"networkofferingname,omitempty" doc:"name of the network offering the network is created from"` + PhysicalNetworkID *UUID `json:"physicalnetworkid,omitempty" doc:"the physical network id"` + Related string `json:"related,omitempty" doc:"related to what other network configuration"` + ReservedIPRange string `json:"reservediprange,omitempty" doc:"the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes"` + RestartRequired bool `json:"restartrequired,omitempty" doc:"true network requires restart"` + Service []Service `json:"service,omitempty" doc:"the list of services"` + SpecifyIPRanges bool `json:"specifyipranges,omitempty" doc:"true if network supports specifying ip ranges, false otherwise"` + StartIP net.IP `json:"startip,omitempty" doc:"the beginning IP address in the network IP range. Required for managed networks."` + State string `json:"state,omitempty" doc:"state of the network"` + StrechedL2Subnet bool `json:"strechedl2subnet,omitempty" doc:"true if network can span multiple zones"` + SubdomainAccess bool `json:"subdomainaccess,omitempty" doc:"true if users from subdomains can access the domain level network"` + Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with network"` + TrafficType string `json:"traffictype,omitempty" doc:"the traffic type of the network"` + Type string `json:"type,omitempty" doc:"the type of the network"` + Vlan string `json:"vlan,omitemtpy" doc:"The vlan of the network. This parameter is visible to ROOT admins only"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"zone id of the network"` + ZoneName string `json:"zonename,omitempty" doc:"the name of the zone the network belongs to"` + ZonesNetworkSpans []Zone `json:"zonesnetworkspans,omitempty" doc:"If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans"` +} + +// ListRequest builds the ListNetworks request +func (network Network) ListRequest() (ListCommand, error) { + //TODO add tags support + req := &ListNetworks{ + ID: network.ID, + Keyword: network.Name, // this is a hack as listNetworks doesn't support to search by name. + PhysicalNetworkID: network.PhysicalNetworkID, + TrafficType: network.TrafficType, + Type: network.Type, + ZoneID: network.ZoneID, + } + + if network.CanUseForDeploy { + req.CanUseForDeploy = &network.CanUseForDeploy + } + if network.RestartRequired { + req.RestartRequired = &network.RestartRequired + } + + return req, nil +} + +// ResourceType returns the type of the resource +func (Network) ResourceType() string { + return "Network" +} + +// Service is a feature of a network +type Service struct { + Capability []ServiceCapability `json:"capability,omitempty"` + Name string `json:"name"` + Provider []ServiceProvider `json:"provider,omitempty"` +} + +// ServiceCapability represents optional capability of a service +type ServiceCapability struct { + CanChooseServiceCapability bool `json:"canchooseservicecapability"` + Name string `json:"name"` + Value string `json:"value"` +} + +// ServiceProvider represents the provider of the service +type ServiceProvider struct { + CanEnableIndividualService bool `json:"canenableindividualservice"` + DestinationPhysicalNetworkID *UUID `json:"destinationphysicalnetworkid"` + ID *UUID `json:"id"` + Name string `json:"name"` + PhysicalNetworkID *UUID `json:"physicalnetworkid"` + ServiceList []string `json:"servicelist,omitempty"` +} + +// CreateNetwork creates a network +type CreateNetwork struct { + DisplayText string `json:"displaytext,omitempty" doc:"the display text of the network"` // This field is required but might be empty + EndIP net.IP `json:"endip,omitempty" doc:"the ending IP address in the network IP range. Required for managed networks."` + EndIpv6 net.IP `json:"endipv6,omitempty" doc:"the ending IPv6 address in the IPv6 network range"` + Gateway net.IP `json:"gateway,omitempty" doc:"the gateway of the network. Required for Shared networks and Isolated networks when it belongs to VPC"` + IP6CIDR *CIDR `json:"ip6cidr,omitempty" doc:"the CIDR of IPv6 network, must be at least /64"` + IP6Gateway net.IP `json:"ip6gateway,omitempty" doc:"the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC"` + IsolatedPVlan string `json:"isolatedpvlan,omitempty" doc:"the isolated private vlan for this network"` + Name string `json:"name,omitempty" doc:"the name of the network"` // This field is required but might be empty + Netmask net.IP `json:"netmask,omitempty" doc:"the netmask of the network. Required for managed networks."` + NetworkDomain string `json:"networkdomain,omitempty" doc:"network domain"` + NetworkOfferingID *UUID `json:"networkofferingid" doc:"the network offering id"` + PhysicalNetworkID *UUID `json:"physicalnetworkid,omitempty" doc:"the Physical Network ID the network belongs to"` + StartIP net.IP `json:"startip,omitempty" doc:"the beginning IP address in the network IP range. Required for managed networks."` + StartIpv6 net.IP `json:"startipv6,omitempty" doc:"the beginning IPv6 address in the IPv6 network range"` + Vlan string `json:"vlan,omitempty" doc:"the ID or VID of the network"` + ZoneID *UUID `json:"zoneid" doc:"the Zone ID for the network"` + _ bool `name:"createNetwork" description:"Creates a network"` +} + +// Response returns the struct to unmarshal +func (CreateNetwork) Response() interface{} { + return new(Network) +} + +func (req CreateNetwork) onBeforeSend(params url.Values) error { + // Those fields are required but might be empty + if req.Name == "" { + params.Set("name", "") + } + if req.DisplayText == "" { + params.Set("displaytext", "") + } + return nil +} + +// UpdateNetwork (Async) updates a network +type UpdateNetwork struct { + _ bool `name:"updateNetwork" description:"Updates a network"` + ChangeCIDR *bool `json:"changecidr,omitempty" doc:"Force update even if cidr type is different"` + DisplayText string `json:"displaytext,omitempty" doc:"the new display text for the network"` + EndIP net.IP `json:"endip,omitempty" doc:"the ending IP address in the network IP range. Required for managed networks."` + GuestVMCIDR *CIDR `json:"guestvmcidr,omitempty" doc:"CIDR for Guest VMs,Cloudstack allocates IPs to Guest VMs only from this CIDR"` + ID *UUID `json:"id" doc:"the ID of the network"` + Name string `json:"name,omitempty" doc:"the new name for the network"` + Netmask net.IP `json:"netmask,omitempty" doc:"the netmask of the network. Required for managed networks."` + NetworkDomain string `json:"networkdomain,omitempty" doc:"network domain"` + NetworkOfferingID *UUID `json:"networkofferingid,omitempty" doc:"network offering ID"` + StartIP net.IP `json:"startip,omitempty" doc:"the beginning IP address in the network IP range. Required for managed networks."` +} + +// Response returns the struct to unmarshal +func (UpdateNetwork) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (UpdateNetwork) AsyncResponse() interface{} { + return new(Network) +} + +// RestartNetwork (Async) updates a network +type RestartNetwork struct { + ID *UUID `json:"id" doc:"The id of the network to restart."` + Cleanup *bool `json:"cleanup,omitempty" doc:"If cleanup old network elements"` + _ bool `name:"restartNetwork" description:"Restarts the network; includes 1) restarting network elements - virtual routers, dhcp servers 2) reapplying all public ips 3) reapplying loadBalancing/portForwarding rules"` +} + +// Response returns the struct to unmarshal +func (RestartNetwork) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (RestartNetwork) AsyncResponse() interface{} { + return new(Network) +} + +// DeleteNetwork deletes a network +type DeleteNetwork struct { + ID *UUID `json:"id" doc:"the ID of the network"` + Forced *bool `json:"forced,omitempty" doc:"Force delete a network. Network will be marked as 'Destroy' even when commands to shutdown and cleanup to the backend fails."` + _ bool `name:"deleteNetwork" description:"Deletes a network"` +} + +// Response returns the struct to unmarshal +func (DeleteNetwork) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (DeleteNetwork) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +//go:generate go run generate/main.go -interface=Listable ListNetworks + +// ListNetworks represents a query to a network +type ListNetworks struct { + CanUseForDeploy *bool `json:"canusefordeploy,omitempty" doc:"List networks available for vm deployment"` + ID *UUID `json:"id,omitempty" doc:"List networks by id"` + IsSystem *bool `json:"issystem,omitempty" doc:"true If network is system, false otherwise"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + PhysicalNetworkID *UUID `json:"physicalnetworkid,omitempty" doc:"List networks by physical network id"` + RestartRequired *bool `json:"restartrequired,omitempty" doc:"List networks by restartRequired"` + SpecifyIPRanges *bool `json:"specifyipranges,omitempty" doc:"True if need to list only networks which support specifying ip ranges"` + SupportedServices []Service `json:"supportedservices,omitempty" doc:"List networks supporting certain services"` + Tags []ResourceTag `json:"tags,omitempty" doc:"List resources by tags (key/value pairs)"` + TrafficType string `json:"traffictype,omitempty" doc:"Type of the traffic"` + Type string `json:"type,omitempty" doc:"The type of the network. Supported values are: Isolated and Shared"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"The Zone ID of the network"` + _ bool `name:"listNetworks" description:"Lists all available networks."` +} + +// ListNetworksResponse represents the list of networks +type ListNetworksResponse struct { + Count int `json:"count"` + Network []Network `json:"network"` +} diff --git a/vendor/github.com/exoscale/egoscale/networks_response.go b/vendor/github.com/exoscale/egoscale/networks_response.go new file mode 100644 index 000000000..058890624 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/networks_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListNetworks) Response() interface{} { + return new(ListNetworksResponse) +} + +// ListRequest returns itself +func (ls *ListNetworks) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListNetworks) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListNetworks) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListNetworks) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListNetworksResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListNetworksResponse was expected, got %T", resp)) + return + } + + for i := range items.Network { + if !callback(&items.Network[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/nics.go b/vendor/github.com/exoscale/egoscale/nics.go new file mode 100644 index 000000000..10863113f --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/nics.go @@ -0,0 +1,120 @@ +package egoscale + +import ( + "net" +) + +// Nic represents a Network Interface Controller (NIC) +// +// See: http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/latest/networking_and_traffic.html#configuring-multiple-ip-addresses-on-a-single-nic +type Nic struct { + BroadcastURI string `json:"broadcasturi,omitempty" doc:"the broadcast uri of the nic"` + DeviceID *UUID `json:"deviceid,omitempty" doc:"device id for the network when plugged into the virtual machine"` + Gateway net.IP `json:"gateway,omitempty" doc:"the gateway of the nic"` + ID *UUID `json:"id,omitempty" doc:"the ID of the nic"` + IP6Address net.IP `json:"ip6address,omitempty" doc:"the IPv6 address of network"` + IP6CIDR *CIDR `json:"ip6cidr,omitempty" doc:"the cidr of IPv6 network"` + IP6Gateway net.IP `json:"ip6gateway,omitempty" doc:"the gateway of IPv6 network"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"the ip address of the nic"` + IsDefault bool `json:"isdefault,omitempty" doc:"true if nic is default, false otherwise"` + IsolationURI string `json:"isolationuri,omitempty" doc:"the isolation uri of the nic"` + MACAddress MACAddress `json:"macaddress,omitempty" doc:"true if nic is default, false otherwise"` + Netmask net.IP `json:"netmask,omitempty" doc:"the netmask of the nic"` + NetworkID *UUID `json:"networkid,omitempty" doc:"the ID of the corresponding network"` + NetworkName string `json:"networkname,omitempty" doc:"the name of the corresponding network"` + ReverseDNS []ReverseDNS `json:"reversedns,omitempty" doc:"the list of PTR record(s) associated with the virtual machine"` + SecondaryIP []NicSecondaryIP `json:"secondaryip,omitempty" doc:"the Secondary ipv4 addr of nic"` + TrafficType string `json:"traffictype,omitempty" doc:"the traffic type of the nic"` + Type string `json:"type,omitempty" doc:"the type of the nic"` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"Id of the vm to which the nic belongs"` +} + +// ListRequest build a ListNics request from the given Nic +func (nic Nic) ListRequest() (ListCommand, error) { + req := &ListNics{ + VirtualMachineID: nic.VirtualMachineID, + NicID: nic.ID, + NetworkID: nic.NetworkID, + } + + return req, nil +} + +// NicSecondaryIP represents a link between NicID and IPAddress +type NicSecondaryIP struct { + ID *UUID `json:"id,omitempty" doc:"the ID of the secondary private IP addr"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"Secondary IP address"` + NetworkID *UUID `json:"networkid,omitempty" doc:"the ID of the network"` + NicID *UUID `json:"nicid,omitempty" doc:"the ID of the nic"` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"the ID of the vm"` +} + +//go:generate go run generate/main.go -interface=Listable ListNics + +// ListNics represents the NIC search +type ListNics struct { + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + NetworkID *UUID `json:"networkid,omitempty" doc:"list nic of the specific vm's network"` + NicID *UUID `json:"nicid,omitempty" doc:"the ID of the nic to to list IPs"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"the ID of the vm"` + _ bool `name:"listNics" description:"list the vm nics IP to NIC"` +} + +// ListNicsResponse represents a list of templates +type ListNicsResponse struct { + Count int `json:"count"` + Nic []Nic `json:"nic"` +} + +// AddIPToNic (Async) represents the assignation of a secondary IP +type AddIPToNic struct { + NicID *UUID `json:"nicid" doc:"the ID of the nic to which you want to assign private IP"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"Secondary IP Address"` + _ bool `name:"addIpToNic" description:"Assigns secondary IP to NIC"` +} + +// Response returns the struct to unmarshal +func (AddIPToNic) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (AddIPToNic) AsyncResponse() interface{} { + return new(NicSecondaryIP) +} + +// RemoveIPFromNic (Async) represents a deletion request +type RemoveIPFromNic struct { + ID *UUID `json:"id" doc:"the ID of the secondary ip address to nic"` + _ bool `name:"removeIpFromNic" description:"Removes secondary IP from the NIC."` +} + +// Response returns the struct to unmarshal +func (RemoveIPFromNic) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (RemoveIPFromNic) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +// ActivateIP6 (Async) activates the IP6 on the given NIC +// +// Exoscale specific API: https://community.exoscale.ch/api/compute/#activateip6_GET +type ActivateIP6 struct { + NicID *UUID `json:"nicid" doc:"the ID of the nic to which you want to assign the IPv6"` + _ bool `name:"activateIp6" description:"Activate the IPv6 on the VM's nic"` +} + +// Response returns the struct to unmarshal +func (ActivateIP6) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (ActivateIP6) AsyncResponse() interface{} { + return new(Nic) +} diff --git a/vendor/github.com/exoscale/egoscale/nics_response.go b/vendor/github.com/exoscale/egoscale/nics_response.go new file mode 100644 index 000000000..dcf960915 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/nics_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListNics) Response() interface{} { + return new(ListNicsResponse) +} + +// ListRequest returns itself +func (ls *ListNics) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListNics) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListNics) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListNics) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListNicsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListNicsResponse was expected, got %T", resp)) + return + } + + for i := range items.Nic { + if !callback(&items.Nic[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/oscategories_response.go b/vendor/github.com/exoscale/egoscale/oscategories_response.go new file mode 100644 index 000000000..985f875df --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/oscategories_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListOSCategories) Response() interface{} { + return new(ListOSCategoriesResponse) +} + +// ListRequest returns itself +func (ls *ListOSCategories) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListOSCategories) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListOSCategories) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListOSCategories) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListOSCategoriesResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListOSCategoriesResponse was expected, got %T", resp)) + return + } + + for i := range items.OSCategory { + if !callback(&items.OSCategory[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/publicipaddresses_response.go b/vendor/github.com/exoscale/egoscale/publicipaddresses_response.go new file mode 100644 index 000000000..2ee92bd7a --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/publicipaddresses_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListPublicIPAddresses) Response() interface{} { + return new(ListPublicIPAddressesResponse) +} + +// ListRequest returns itself +func (ls *ListPublicIPAddresses) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListPublicIPAddresses) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListPublicIPAddresses) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListPublicIPAddresses) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListPublicIPAddressesResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListPublicIPAddressesResponse was expected, got %T", resp)) + return + } + + for i := range items.PublicIPAddress { + if !callback(&items.PublicIPAddress[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/record_string.go b/vendor/github.com/exoscale/egoscale/record_string.go new file mode 100644 index 000000000..b84303bb7 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/record_string.go @@ -0,0 +1,16 @@ +// Code generated by "stringer -type=Record"; DO NOT EDIT. + +package egoscale + +import "strconv" + +const _Record_name = "AAAAAALIASCNAMEHINFOMXNAPTRNSPOOLSPFSRVSSHFPTXTURL" + +var _Record_index = [...]uint8{0, 1, 5, 10, 15, 20, 22, 27, 29, 33, 36, 39, 44, 47, 50} + +func (i Record) String() string { + if i < 0 || i >= Record(len(_Record_index)-1) { + return "Record(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Record_name[_Record_index[i]:_Record_index[i+1]] +} diff --git a/vendor/github.com/exoscale/egoscale/request.go b/vendor/github.com/exoscale/egoscale/request.go new file mode 100644 index 000000000..079c626c0 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/request.go @@ -0,0 +1,405 @@ +package egoscale + +import ( + "bytes" + "context" + "crypto/hmac" + "crypto/sha1" + "encoding/base64" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "sort" + "strconv" + "strings" + "time" +) + +// Error formats a CloudStack error into a standard error +func (e ErrorResponse) Error() string { + return fmt.Sprintf("API error %s %d (%s %d): %s", e.ErrorCode, e.ErrorCode, e.CSErrorCode, e.CSErrorCode, e.ErrorText) +} + +// Error formats a CloudStack job response into a standard error +func (e BooleanResponse) Error() error { + if !e.Success { + return fmt.Errorf("API error: %s", e.DisplayText) + } + + return nil +} + +func responseKey(key string) (string, bool) { + // XXX: addIpToNic, activateIp6, restorevmresponse are kind of special + var responseKeys = map[string]string{ + "addiptonicresponse": "addiptovmnicresponse", + "activateip6response": "activateip6nicresponse", + "restorevirtualmachineresponse": "restorevmresponse", + "updatevmaffinitygroupresponse": "updatevirtualmachineresponse", + } + + k, ok := responseKeys[key] + return k, ok +} + +func (client *Client) parseResponse(resp *http.Response, apiName string) (json.RawMessage, error) { + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + m := map[string]json.RawMessage{} + if err := json.Unmarshal(b, &m); err != nil { + return nil, err + } + + key := fmt.Sprintf("%sresponse", strings.ToLower(apiName)) + response, ok := m[key] + if !ok { + if resp.StatusCode >= 400 { + response, ok = m["errorresponse"] + } + + if !ok { + // try again with the special keys + value, ok := responseKey(key) + if ok { + key = value + } + + response, ok = m[key] + + if !ok { + return nil, fmt.Errorf("malformed JSON response %d, %q was expected.\n%s", resp.StatusCode, key, b) + } + } + } + + if resp.StatusCode >= 400 { + errorResponse := new(ErrorResponse) + if e := json.Unmarshal(response, errorResponse); e != nil && errorResponse.ErrorCode <= 0 { + return nil, fmt.Errorf("%d %s", resp.StatusCode, b) + } + return nil, errorResponse + } + + n := map[string]json.RawMessage{} + if err := json.Unmarshal(response, &n); err != nil { + return nil, err + } + + // list response may contain only one key + if len(n) > 1 || strings.HasPrefix(key, "list") { + return response, nil + } + + if len(n) == 1 { + for k := range n { + // boolean response and asyncjob result may also contain + // only one key + if k == "success" || k == "jobid" { + return response, nil + } + return n[k], nil + } + } + + return response, nil +} + +// asyncRequest perform an asynchronous job with a context +func (client *Client) asyncRequest(ctx context.Context, asyncCommand AsyncCommand) (interface{}, error) { + var err error + + resp := asyncCommand.AsyncResponse() + client.AsyncRequestWithContext( + ctx, + asyncCommand, + func(j *AsyncJobResult, e error) bool { + if e != nil { + err = e + return false + } + if j.JobStatus != Pending { + if r := j.Result(resp); r != nil { + err = r + } + return false + } + return true + }, + ) + return resp, err +} + +// SyncRequestWithContext performs a sync request with a context +func (client *Client) SyncRequestWithContext(ctx context.Context, command Command) (interface{}, error) { + body, err := client.request(ctx, command) + if err != nil { + return nil, err + } + + response := command.Response() + b, ok := response.(*BooleanResponse) + if ok { + m := make(map[string]interface{}) + if errUnmarshal := json.Unmarshal(body, &m); errUnmarshal != nil { + return nil, errUnmarshal + } + + b.DisplayText, _ = m["displaytext"].(string) + + if success, okSuccess := m["success"].(string); okSuccess { + b.Success = success == "true" + } + + if success, okSuccess := m["success"].(bool); okSuccess { + b.Success = success + } + + return b, nil + } + + if err := json.Unmarshal(body, response); err != nil { + errResponse := new(ErrorResponse) + if e := json.Unmarshal(body, errResponse); e == nil && errResponse.ErrorCode > 0 { + return errResponse, nil + } + return nil, err + } + + return response, nil +} + +// BooleanRequest performs the given boolean command +func (client *Client) BooleanRequest(command Command) error { + resp, err := client.Request(command) + if err != nil { + return err + } + + if b, ok := resp.(*BooleanResponse); ok { + return b.Error() + } + + panic(fmt.Errorf("command %q is not a proper boolean response. %#v", client.APIName(command), resp)) +} + +// BooleanRequestWithContext performs the given boolean command +func (client *Client) BooleanRequestWithContext(ctx context.Context, command Command) error { + resp, err := client.RequestWithContext(ctx, command) + if err != nil { + return err + } + + if b, ok := resp.(*BooleanResponse); ok { + return b.Error() + } + + panic(fmt.Errorf("command %q is not a proper boolean response. %#v", client.APIName(command), resp)) +} + +// Request performs the given command +func (client *Client) Request(command Command) (interface{}, error) { + ctx, cancel := context.WithTimeout(context.Background(), client.Timeout) + defer cancel() + + return client.RequestWithContext(ctx, command) +} + +// RequestWithContext preforms a command with a context +func (client *Client) RequestWithContext(ctx context.Context, command Command) (interface{}, error) { + switch c := command.(type) { + case AsyncCommand: + return client.asyncRequest(ctx, c) + default: + return client.SyncRequestWithContext(ctx, command) + } +} + +// SyncRequest performs the command as is +func (client *Client) SyncRequest(command Command) (interface{}, error) { + ctx, cancel := context.WithTimeout(context.Background(), client.Timeout) + defer cancel() + + return client.SyncRequestWithContext(ctx, command) +} + +// AsyncRequest performs the given command +func (client *Client) AsyncRequest(asyncCommand AsyncCommand, callback WaitAsyncJobResultFunc) { + ctx, cancel := context.WithTimeout(context.Background(), client.Timeout) + defer cancel() + + client.AsyncRequestWithContext(ctx, asyncCommand, callback) +} + +// AsyncRequestWithContext preforms a request with a context +func (client *Client) AsyncRequestWithContext(ctx context.Context, asyncCommand AsyncCommand, callback WaitAsyncJobResultFunc) { + result, err := client.SyncRequestWithContext(ctx, asyncCommand) + if err != nil { + if !callback(nil, err) { + return + } + } + + jobResult, ok := result.(*AsyncJobResult) + if !ok { + callback(nil, fmt.Errorf("wrong type, AsyncJobResult was expected instead of %T", result)) + } + + // Successful response + if jobResult.JobID == nil || jobResult.JobStatus != Pending { + callback(jobResult, nil) + // without a JobID, the next requests will only fail + return + } + + for iteration := 0; ; iteration++ { + time.Sleep(client.RetryStrategy(int64(iteration))) + + req := &QueryAsyncJobResult{JobID: jobResult.JobID} + resp, err := client.SyncRequestWithContext(ctx, req) + if err != nil && !callback(nil, err) { + return + } + + result, ok := resp.(*AsyncJobResult) + if !ok { + if !callback(nil, fmt.Errorf("wrong type. AsyncJobResult expected, got %T", resp)) { + return + } + } + + if !callback(result, nil) { + return + } + } +} + +// Payload builds the HTTP request params from the given command +func (client *Client) Payload(command Command) (url.Values, error) { + params, err := prepareValues("", command) + if err != nil { + return nil, err + } + if hookReq, ok := command.(onBeforeHook); ok { + if err := hookReq.onBeforeSend(params); err != nil { + return params, err + } + } + params.Set("apikey", client.APIKey) + params.Set("command", client.APIName(command)) + params.Set("response", "json") + + if params.Get("expires") == "" && client.Expiration >= 0 { + params.Set("signatureversion", "3") + params.Set("expires", time.Now().Add(client.Expiration).Local().Format("2006-01-02T15:04:05-0700")) + } + + return params, nil +} + +// Sign signs the HTTP request and returns the signature as as base64 encoding +func (client *Client) Sign(params url.Values) (string, error) { + query := encodeValues(params) + query = strings.ToLower(query) + mac := hmac.New(sha1.New, []byte(client.apiSecret)) + _, err := mac.Write([]byte(query)) + if err != nil { + return "", err + } + + signature := base64.StdEncoding.EncodeToString(mac.Sum(nil)) + return signature, nil +} + +// request makes a Request while being close to the metal +func (client *Client) request(ctx context.Context, command Command) (json.RawMessage, error) { + params, err := client.Payload(command) + if err != nil { + return nil, err + } + signature, err := client.Sign(params) + if err != nil { + return nil, err + } + params.Add("signature", signature) + + method := "GET" + query := params.Encode() + url := fmt.Sprintf("%s?%s", client.Endpoint, query) + + var body io.Reader + // respect Internet Explorer limit of 2048 + if len(url) > 2048 { + url = client.Endpoint + method = "POST" + body = strings.NewReader(query) + } + + request, err := http.NewRequest(method, url, body) + if err != nil { + return nil, err + } + request = request.WithContext(ctx) + request.Header.Add("User-Agent", UserAgent) + + if method == "POST" { + request.Header.Add("Content-Type", "application/x-www-form-urlencoded") + request.Header.Add("Content-Length", strconv.Itoa(len(query))) + } + + resp, err := client.HTTPClient.Do(request) + if err != nil { + return nil, err + } + defer resp.Body.Close() // nolint: errcheck + + contentType := resp.Header.Get("content-type") + + if !strings.Contains(contentType, "application/json") { + return nil, fmt.Errorf(`body content-type response expected "application/json", got %q`, contentType) + } + + text, err := client.parseResponse(resp, client.APIName(command)) + if err != nil { + return nil, err + } + + return text, nil +} + +func encodeValues(params url.Values) string { + // This code is borrowed from net/url/url.go + // The way it's encoded by net/url doesn't match + // how CloudStack works to determine the signature. + // + // CloudStack only encodes the values of the query parameters + // and furthermore doesn't use '+' for whitespaces. Therefore + // after encoding the values all '+' are replaced with '%20'. + if params == nil { + return "" + } + + var buf bytes.Buffer + keys := make([]string, 0, len(params)) + for k := range params { + keys = append(keys, k) + } + + sort.Strings(keys) + for _, k := range keys { + prefix := k + "=" + for _, v := range params[k] { + if buf.Len() > 0 { + buf.WriteByte('&') + } + buf.WriteString(prefix) + buf.WriteString(csEncode(v)) + } + } + return buf.String() +} diff --git a/vendor/github.com/exoscale/egoscale/request_type.go b/vendor/github.com/exoscale/egoscale/request_type.go new file mode 100644 index 000000000..7394e1ad3 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/request_type.go @@ -0,0 +1,184 @@ +package egoscale + +import ( + "net/url" +) + +// Command represents a generic request +type Command interface { + Response() interface{} +} + +// AsyncCommand represents a async request +type AsyncCommand interface { + Command + AsyncResponse() interface{} +} + +// ListCommand represents a listing request +type ListCommand interface { + Listable + Command + // SetPage defines the current pages + SetPage(int) + // SetPageSize defines the size of the page + SetPageSize(int) + // Each reads the data from the response and feeds channels, and returns true if we are on the last page + Each(interface{}, IterateItemFunc) +} + +// onBeforeHook represents an action to be done on the params before sending them +// +// This little took helps with issue of relying on JSON serialization logic only. +// `omitempty` may make sense in some cases but not all the time. +type onBeforeHook interface { + onBeforeSend(params url.Values) error +} + +// CommandInfo represents the meta data related to a Command +type CommandInfo struct { + Name string + Description string + RootOnly bool +} + +// JobStatusType represents the status of a Job +type JobStatusType int + +//go:generate stringer -type JobStatusType +const ( + // Pending represents a job in progress + Pending JobStatusType = iota + // Success represents a successfully completed job + Success + // Failure represents a job that has failed to complete + Failure +) + +// ErrorCode represents the CloudStack ApiErrorCode enum +// +// See: https://github.com/apache/cloudstack/blob/master/api/src/main/java/org/apache/cloudstack/api/ApiErrorCode.java +type ErrorCode int + +//go:generate stringer -type ErrorCode +const ( + // Unauthorized represents ... (TODO) + Unauthorized ErrorCode = 401 + // MethodNotAllowed represents ... (TODO) + MethodNotAllowed ErrorCode = 405 + // UnsupportedActionError represents ... (TODO) + UnsupportedActionError ErrorCode = 422 + // APILimitExceeded represents ... (TODO) + APILimitExceeded ErrorCode = 429 + // MalformedParameterError represents ... (TODO) + MalformedParameterError ErrorCode = 430 + // ParamError represents ... (TODO) + ParamError ErrorCode = 431 + + // InternalError represents a server error + InternalError ErrorCode = 530 + // AccountError represents ... (TODO) + AccountError ErrorCode = 531 + // AccountResourceLimitError represents ... (TODO) + AccountResourceLimitError ErrorCode = 532 + // InsufficientCapacityError represents ... (TODO) + InsufficientCapacityError ErrorCode = 533 + // ResourceUnavailableError represents ... (TODO) + ResourceUnavailableError ErrorCode = 534 + // ResourceAllocationError represents ... (TODO) + ResourceAllocationError ErrorCode = 535 + // ResourceInUseError represents ... (TODO) + ResourceInUseError ErrorCode = 536 + // NetworkRuleConflictError represents ... (TODO) + NetworkRuleConflictError ErrorCode = 537 +) + +// CSErrorCode represents the CloudStack CSExceptionErrorCode enum +// +// See: https://github.com/apache/cloudstack/blob/master/utils/src/main/java/com/cloud/utils/exception/CSExceptionErrorCode.java +type CSErrorCode int + +//go:generate stringer -type CSErrorCode +const ( + // CloudRuntimeException ... (TODO) + CloudRuntimeException CSErrorCode = 4250 + // ExecutionException ... (TODO) + ExecutionException CSErrorCode = 4260 + // HypervisorVersionChangedException ... (TODO) + HypervisorVersionChangedException CSErrorCode = 4265 + // CloudException ... (TODO) + CloudException CSErrorCode = 4275 + // AccountLimitException ... (TODO) + AccountLimitException CSErrorCode = 4280 + // AgentUnavailableException ... (TODO) + AgentUnavailableException CSErrorCode = 4285 + // CloudAuthenticationException ... (TODO) + CloudAuthenticationException CSErrorCode = 4290 + // ConcurrentOperationException ... (TODO) + ConcurrentOperationException CSErrorCode = 4300 + // ConflictingNetworksException ... (TODO) + ConflictingNetworkSettingsException CSErrorCode = 4305 + // DiscoveredWithErrorException ... (TODO) + DiscoveredWithErrorException CSErrorCode = 4310 + // HAStateException ... (TODO) + HAStateException CSErrorCode = 4315 + // InsufficientAddressCapacityException ... (TODO) + InsufficientAddressCapacityException CSErrorCode = 4320 + // InsufficientCapacityException ... (TODO) + InsufficientCapacityException CSErrorCode = 4325 + // InsufficientNetworkCapacityException ... (TODO) + InsufficientNetworkCapacityException CSErrorCode = 4330 + // InsufficientServerCapaticyException ... (TODO) + InsufficientServerCapacityException CSErrorCode = 4335 + // InsufficientStorageCapacityException ... (TODO) + InsufficientStorageCapacityException CSErrorCode = 4340 + // InternalErrorException ... (TODO) + InternalErrorException CSErrorCode = 4345 + // InvalidParameterValueException ... (TODO) + InvalidParameterValueException CSErrorCode = 4350 + // ManagementServerException ... (TODO) + ManagementServerException CSErrorCode = 4355 + // NetworkRuleConflictException ... (TODO) + NetworkRuleConflictException CSErrorCode = 4360 + // PermissionDeniedException ... (TODO) + PermissionDeniedException CSErrorCode = 4365 + // ResourceAllocationException ... (TODO) + ResourceAllocationException CSErrorCode = 4370 + // ResourceInUseException ... (TODO) + ResourceInUseException CSErrorCode = 4375 + // ResourceUnavailableException ... (TODO) + ResourceUnavailableException CSErrorCode = 4380 + // StorageUnavailableException ... (TODO) + StorageUnavailableException CSErrorCode = 4385 + // UnsupportedServiceException ... (TODO) + UnsupportedServiceException CSErrorCode = 4390 + // VirtualMachineMigrationException ... (TODO) + VirtualMachineMigrationException CSErrorCode = 4395 + // AsyncCommandQueued ... (TODO) + AsyncCommandQueued CSErrorCode = 4540 + // RequestLimitException ... (TODO) + RequestLimitException CSErrorCode = 4545 + // ServerAPIException ... (TODO) + ServerAPIException CSErrorCode = 9999 +) + +// ErrorResponse represents the standard error response +type ErrorResponse struct { + CSErrorCode CSErrorCode `json:"cserrorcode"` + ErrorCode ErrorCode `json:"errorcode"` + ErrorText string `json:"errortext"` + UUIDList []UUIDItem `json:"uuidList,omitempty"` // uuid*L*ist is not a typo +} + +// UUIDItem represents an item of the UUIDList part of an ErrorResponse +type UUIDItem struct { + Description string `json:"description,omitempty"` + SerialVersionUID int64 `json:"serialVersionUID,omitempty"` + UUID string `json:"uuid"` +} + +// BooleanResponse represents a boolean response (usually after a deletion) +type BooleanResponse struct { + DisplayText string `json:"displaytext,omitempty"` + Success bool `json:"success"` +} diff --git a/vendor/github.com/exoscale/egoscale/resource_limits.go b/vendor/github.com/exoscale/egoscale/resource_limits.go new file mode 100644 index 000000000..56011dc66 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/resource_limits.go @@ -0,0 +1,100 @@ +package egoscale + +// https://github.com/apache/cloudstack/blob/master/api/src/main/java/com/cloud/configuration/Resource.java + +// ResourceTypeName represents the name of a resource type (for limits) +type ResourceTypeName string + +const ( + // VirtualMachineTypeName is the resource type name of a VM + VirtualMachineTypeName ResourceTypeName = "user_vm" + // IPAddressTypeName is the resource type name of an IP address + IPAddressTypeName ResourceTypeName = "public_ip" + // VolumeTypeName is the resource type name of a volume + VolumeTypeName ResourceTypeName = "volume" + // SnapshotTypeName is the resource type name of a snapshot + SnapshotTypeName ResourceTypeName = "snapshot" + // TemplateTypeName is the resource type name of a template + TemplateTypeName ResourceTypeName = "template" + // ProjectTypeName is the resource type name of a project + ProjectTypeName ResourceTypeName = "project" + // NetworkTypeName is the resource type name of a network + NetworkTypeName ResourceTypeName = "network" + // VPCTypeName is the resource type name of a VPC + VPCTypeName ResourceTypeName = "vpc" + // CPUTypeName is the resource type name of a CPU + CPUTypeName ResourceTypeName = "cpu" + // MemoryTypeName is the resource type name of Memory + MemoryTypeName ResourceTypeName = "memory" + // PrimaryStorageTypeName is the resource type name of primary storage + PrimaryStorageTypeName ResourceTypeName = "primary_storage" + // SecondaryStorageTypeName is the resource type name of secondary storage + SecondaryStorageTypeName ResourceTypeName = "secondary_storage" +) + +// ResourceType represents the ID of a resource type (for limits) +type ResourceType string + +const ( + // VirtualMachineType is the resource type ID of a VM + VirtualMachineType ResourceType = "0" + // IPAddressType is the resource type ID of an IP address + IPAddressType ResourceType = "1" + // VolumeType is the resource type ID of a volume + VolumeType ResourceType = "2" + // SnapshotType is the resource type ID of a snapshot + SnapshotType ResourceType = "3" + // TemplateType is the resource type ID of a template + TemplateType ResourceType = "4" + // ProjectType is the resource type ID of a project + ProjectType ResourceType = "5" + // NetworkType is the resource type ID of a network + NetworkType ResourceType = "6" + // VPCType is the resource type ID of a VPC + VPCType ResourceType = "7" + // CPUType is the resource type ID of a CPU + CPUType ResourceType = "8" + // MemoryType is the resource type ID of Memory + MemoryType ResourceType = "9" + // PrimaryStorageType is the resource type ID of primary storage + PrimaryStorageType ResourceType = "10" + // SecondaryStorageType is the resource type ID of secondary storage + SecondaryStorageType ResourceType = "11" +) + +// ResourceLimit represents the limit on a particular resource +type ResourceLimit struct { + Max int64 `json:"max,omitempty" doc:"the maximum number of the resource. A -1 means the resource currently has no limit."` + ResourceType ResourceType `json:"resourcetype,omitempty" doc:"resource type. Values include 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values."` + ResourceTypeName string `json:"resourcetypename,omitempty" doc:"resource type name. Values include user_vm, public_ip, volume, snapshot, template, network, cpu, memory, primary_storage, secondary_storage."` +} + +// ListRequest builds the ListResourceLimits request +func (limit ResourceLimit) ListRequest() (ListCommand, error) { + req := &ListResourceLimits{ + ResourceType: limit.ResourceType, + ResourceTypeName: limit.ResourceTypeName, + } + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListResourceLimits + +// ListResourceLimits lists the resource limits +type ListResourceLimits struct { + ID int64 `json:"id,omitempty" doc:"Lists resource limits by ID."` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + ResourceType ResourceType `json:"resourcetype,omitempty" doc:"Type of resource. Values are 0, 1, 2, 3, 4, 6, 8, 9, 10, 11, 12, and 13. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses an account can own. 2 - Volume. Number of disk volumes an account can own. 3 - Snapshot. Number of snapshots an account can own. 4 - Template. Number of templates an account can register/create. 6 - Network. Number of networks an account can own. 8 - CPU. Number of CPU an account can allocate for his resources. 9 - Memory. Amount of RAM an account can allocate for his resources. 10 - PrimaryStorage. Total primary storage space (in GiB) a user can use. 11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. 12 - Elastic IP. Number of public elastic IP addresses an account can own. 13 - SMTP. If the account is allowed SMTP outbound traffic."` + ResourceTypeName string `json:"resourcetypename,omitempty" doc:"Type of resource (wins over resourceType if both are provided). Values are: user_vm - Instance. Number of instances a user can create. public_ip - IP. Number of public IP addresses an account can own. volume - Volume. Number of disk volumes an account can own. snapshot - Snapshot. Number of snapshots an account can own. template - Template. Number of templates an account can register/create. network - Network. Number of networks an account can own. cpu - CPU. Number of CPU an account can allocate for his resources. memory - Memory. Amount of RAM an account can allocate for his resources. primary_storage - PrimaryStorage. Total primary storage space (in GiB) a user can use. secondary_storage - SecondaryStorage. Total secondary storage space (in GiB) a user can use. public_elastic_ip - IP. Number of public elastic IP addresses an account can own. smtp - SG. If the account is allowed SMTP outbound traffic."` + + _ bool `name:"listResourceLimits" description:"Lists resource limits."` +} + +// ListResourceLimitsResponse represents a list of resource limits +type ListResourceLimitsResponse struct { + Count int `json:"count"` + ResourceLimit []ResourceLimit `json:"resourcelimit"` +} diff --git a/vendor/github.com/exoscale/egoscale/resource_metadata.go b/vendor/github.com/exoscale/egoscale/resource_metadata.go new file mode 100644 index 000000000..52c5ee8b0 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/resource_metadata.go @@ -0,0 +1,41 @@ +package egoscale + +import "fmt" + +// ResourceDetail represents extra details +type ResourceDetail ResourceTag + +// ListRequest builds the ListResourceDetails request +func (detail ResourceDetail) ListRequest() (ListCommand, error) { + if detail.ResourceType == "" { + return nil, fmt.Errorf("the resourcetype parameter is required") + } + + req := &ListResourceDetails{ + ResourceType: detail.ResourceType, + ResourceID: detail.ResourceID, + } + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListResourceDetails + +// ListResourceDetails lists the resource tag(s) (but different from listTags...) +type ListResourceDetails struct { + ResourceType string `json:"resourcetype" doc:"list by resource type"` + ForDisplay bool `json:"fordisplay,omitempty" doc:"if set to true, only details marked with display=true, are returned. False by default"` + Key string `json:"key,omitempty" doc:"list by key"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + ResourceID *UUID `json:"resourceid,omitempty" doc:"list by resource id"` + Value string `json:"value,omitempty" doc:"list by key, value. Needs to be passed only along with key"` + _ bool `name:"listResourceDetails" description:"List resource detail(s)"` +} + +// ListResourceDetailsResponse represents a list of resource details +type ListResourceDetailsResponse struct { + Count int `json:"count"` + ResourceDetail []ResourceTag `json:"resourcedetail"` +} diff --git a/vendor/github.com/exoscale/egoscale/resourcedetails_response.go b/vendor/github.com/exoscale/egoscale/resourcedetails_response.go new file mode 100644 index 000000000..2a08cd825 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/resourcedetails_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListResourceDetails) Response() interface{} { + return new(ListResourceDetailsResponse) +} + +// ListRequest returns itself +func (ls *ListResourceDetails) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListResourceDetails) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListResourceDetails) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListResourceDetails) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListResourceDetailsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListResourceDetailsResponse was expected, got %T", resp)) + return + } + + for i := range items.ResourceDetail { + if !callback(&items.ResourceDetail[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/resourcelimits_response.go b/vendor/github.com/exoscale/egoscale/resourcelimits_response.go new file mode 100644 index 000000000..656febfc9 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/resourcelimits_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListResourceLimits) Response() interface{} { + return new(ListResourceLimitsResponse) +} + +// ListRequest returns itself +func (ls *ListResourceLimits) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListResourceLimits) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListResourceLimits) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListResourceLimits) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListResourceLimitsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListResourceLimitsResponse was expected, got %T", resp)) + return + } + + for i := range items.ResourceLimit { + if !callback(&items.ResourceLimit[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/reversedns.go b/vendor/github.com/exoscale/egoscale/reversedns.go new file mode 100644 index 000000000..e8bd124ce --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/reversedns.go @@ -0,0 +1,83 @@ +package egoscale + +import ( + "net" +) + +// ReverseDNS represents the PTR record linked with an IPAddress or IP6Address belonging to a Virtual Machine or a Public IP Address (Elastic IP) instance +type ReverseDNS struct { + DomainName string `json:"domainname,omitempty" doc:"the domain name of the PTR record"` + IP6Address net.IP `json:"ip6address,omitempty" doc:"the IPv6 address linked with the PTR record (mutually exclusive with ipaddress)"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"the IPv4 address linked with the PTR record (mutually exclusive with ip6address)"` + NicID *UUID `json:"nicid,omitempty" doc:"the virtual machine default NIC ID"` + PublicIPID *UUID `json:"publicipid,omitempty" doc:"the public IP address ID"` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"the virtual machine ID"` +} + +// DeleteReverseDNSFromPublicIPAddress is a command to create/delete the PTR record of a public IP address +type DeleteReverseDNSFromPublicIPAddress struct { + ID *UUID `json:"id,omitempty" doc:"the ID of the public IP address"` + _ bool `name:"deleteReverseDnsFromPublicIpAddress" description:"delete the PTR DNS record from the public IP address"` +} + +// Response returns the struct to unmarshal +func (*DeleteReverseDNSFromPublicIPAddress) Response() interface{} { + return new(BooleanResponse) +} + +// DeleteReverseDNSFromVirtualMachine is a command to create/delete the PTR record(s) of a virtual machine +type DeleteReverseDNSFromVirtualMachine struct { + ID *UUID `json:"id,omitempty" doc:"the ID of the virtual machine"` + _ bool `name:"deleteReverseDnsFromVirtualMachine" description:"Delete the PTR DNS record(s) from the virtual machine"` +} + +// Response returns the struct to unmarshal +func (*DeleteReverseDNSFromVirtualMachine) Response() interface{} { + return new(BooleanResponse) +} + +// QueryReverseDNSForPublicIPAddress is a command to create/query the PTR record of a public IP address +type QueryReverseDNSForPublicIPAddress struct { + ID *UUID `json:"id,omitempty" doc:"the ID of the public IP address"` + _ bool `name:"queryReverseDnsForPublicIpAddress" description:"Query the PTR DNS record for the public IP address"` +} + +// Response returns the struct to unmarshal +func (*QueryReverseDNSForPublicIPAddress) Response() interface{} { + return new(IPAddress) +} + +// QueryReverseDNSForVirtualMachine is a command to create/query the PTR record(s) of a virtual machine +type QueryReverseDNSForVirtualMachine struct { + ID *UUID `json:"id,omitempty" doc:"the ID of the virtual machine"` + _ bool `name:"queryReverseDnsForVirtualMachine" description:"Query the PTR DNS record(s) for the virtual machine"` +} + +// Response returns the struct to unmarshal +func (*QueryReverseDNSForVirtualMachine) Response() interface{} { + return new(VirtualMachine) +} + +// UpdateReverseDNSForPublicIPAddress is a command to create/update the PTR record of a public IP address +type UpdateReverseDNSForPublicIPAddress struct { + DomainName string `json:"domainname,omitempty" doc:"the domain name for the PTR record. It must have a valid TLD"` + ID *UUID `json:"id,omitempty" doc:"the ID of the public IP address"` + _ bool `name:"updateReverseDnsForPublicIpAddress" description:"Update/create the PTR DNS record for the public IP address"` +} + +// Response returns the struct to unmarshal +func (*UpdateReverseDNSForPublicIPAddress) Response() interface{} { + return new(IPAddress) +} + +// UpdateReverseDNSForVirtualMachine is a command to create/update the PTR record(s) of a virtual machine +type UpdateReverseDNSForVirtualMachine struct { + DomainName string `json:"domainname,omitempty" doc:"the domain name for the PTR record(s). It must have a valid TLD"` + ID *UUID `json:"id,omitempty" doc:"the ID of the virtual machine"` + _ bool `name:"updateReverseDnsForVirtualMachine" description:"Update/create the PTR DNS record(s) for the virtual machine"` +} + +// Response returns the struct to unmarshal +func (*UpdateReverseDNSForVirtualMachine) Response() interface{} { + return new(VirtualMachine) +} diff --git a/vendor/github.com/exoscale/egoscale/runstatus.go b/vendor/github.com/exoscale/egoscale/runstatus.go new file mode 100644 index 000000000..48905962e --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/runstatus.go @@ -0,0 +1,131 @@ +package egoscale + +import ( + "context" + "crypto/hmac" + "crypto/sha256" + "encoding/hex" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + "time" +) + +// RunstatusValidationErrorResponse represents an error in the API +type RunstatusValidationErrorResponse map[string][]string + +// RunstatusErrorResponse represents the default errors +type RunstatusErrorResponse struct { + Detail string `json:"detail"` +} + +// runstatusPagesURL is the only URL that cannot be guessed +const runstatusPagesURL = "/pages" + +// Error formats the DNSerror into a string +func (req RunstatusErrorResponse) Error() string { + return fmt.Sprintf("Runstatus error: %s", req.Detail) +} + +// Error formats the DNSerror into a string +func (req RunstatusValidationErrorResponse) Error() string { + if len(req) > 0 { + errs := []string{} + for name, ss := range req { + if len(ss) > 0 { + errs = append(errs, fmt.Sprintf("%s: %s", name, strings.Join(ss, ", "))) + } + } + return fmt.Sprintf("Runstatus error: %s", strings.Join(errs, "; ")) + } + return fmt.Sprintf("Runstatus error") +} + +func (client *Client) runstatusRequest(ctx context.Context, uri string, structParam interface{}, method string) (json.RawMessage, error) { + reqURL, err := url.Parse(uri) + if err != nil { + return nil, err + } + if reqURL.Scheme == "" { + return nil, fmt.Errorf("only absolute URI are considered valid, got %q", uri) + } + + var params string + if structParam != nil { + m, err := json.Marshal(structParam) + if err != nil { + return nil, err + } + params = string(m) + } + + req, err := http.NewRequest(method, reqURL.String(), strings.NewReader(params)) + if err != nil { + return nil, err + } + + time := time.Now().Local().Format("2006-01-02T15:04:05-0700") + + payload := fmt.Sprintf("%s%s%s", req.URL.String(), time, params) + + mac := hmac.New(sha256.New, []byte(client.apiSecret)) + _, err = mac.Write([]byte(payload)) + if err != nil { + return nil, err + } + signature := hex.EncodeToString(mac.Sum(nil)) + + var hdr = make(http.Header) + + hdr.Add("Authorization", fmt.Sprintf("Exoscale-HMAC-SHA256 %s:%s", client.APIKey, signature)) + hdr.Add("Exoscale-Date", time) + hdr.Add("User-Agent", UserAgent) + hdr.Add("Accept", "application/json") + if params != "" { + hdr.Add("Content-Type", "application/json") + } + req.Header = hdr + + req = req.WithContext(ctx) + + resp, err := client.HTTPClient.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() // nolint: errcheck + + if resp.StatusCode == 204 { + if method != "DELETE" { + return nil, fmt.Errorf("only DELETE is expected to produce 204, was %q", method) + } + return nil, nil + } + + contentType := resp.Header.Get("content-type") + if !strings.Contains(contentType, "application/json") { + return nil, fmt.Errorf(`response %d content-type expected to be "application/json", got %q`, resp.StatusCode, contentType) + } + + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + if resp.StatusCode >= 400 { + rerr := new(RunstatusValidationErrorResponse) + if err := json.Unmarshal(b, rerr); err == nil { + return nil, rerr + } + rverr := new(RunstatusErrorResponse) + if err := json.Unmarshal(b, rverr); err != nil { + return nil, err + } + + return nil, rverr + } + + return b, nil +} diff --git a/vendor/github.com/exoscale/egoscale/runstatus_event.go b/vendor/github.com/exoscale/egoscale/runstatus_event.go new file mode 100644 index 000000000..2c698788b --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/runstatus_event.go @@ -0,0 +1,37 @@ +package egoscale + +import ( + "context" + "fmt" + "time" +) + +//RunstatusEvent is a runstatus event +type RunstatusEvent struct { + Created *time.Time `json:"created,omitempty"` + State string `json:"state,omitempty"` + Status string `json:"status"` + Text string `json:"text"` +} + +// UpdateRunstatusIncident create runstatus incident event +// Events can be updates or final message with status completed. +func (client *Client) UpdateRunstatusIncident(ctx context.Context, incident RunstatusIncident, event RunstatusEvent) error { + if incident.EventsURL == "" { + return fmt.Errorf("empty Events URL for %#v", incident) + } + + _, err := client.runstatusRequest(ctx, incident.EventsURL, event, "POST") + return err +} + +// UpdateRunstatusMaintenance adds a event to a maintenance. +// Events can be updates or final message with status completed. +func (client *Client) UpdateRunstatusMaintenance(ctx context.Context, maintenance RunstatusMaintenance, event RunstatusEvent) error { + if maintenance.EventsURL == "" { + return fmt.Errorf("empty Events URL for %#v", maintenance) + } + + _, err := client.runstatusRequest(ctx, maintenance.EventsURL, event, "POST") + return err +} diff --git a/vendor/github.com/exoscale/egoscale/runstatus_incident.go b/vendor/github.com/exoscale/egoscale/runstatus_incident.go new file mode 100644 index 000000000..57d20c81b --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/runstatus_incident.go @@ -0,0 +1,175 @@ +package egoscale + +import ( + "context" + "encoding/json" + "fmt" + "time" +) + +//RunstatusIncident is a runstatus incident +type RunstatusIncident struct { + EndDate *time.Time `json:"end_date,omitempty"` + Events []RunstatusEvent `json:"events,omitempty"` + EventsURL string `json:"events_url,omitempty"` + ID int `json:"id,omitempty"` + PageURL string `json:"page_url,omitempty"` // fake field + PostMortem string `json:"post_mortem,omitempty"` + RealTime bool `json:"real_time,omitempty"` + Services []string `json:"services"` + StartDate *time.Time `json:"start_date,omitempty"` + State string `json:"state"` + Status string `json:"status"` + StatusText string `json:"status_text"` + Title string `json:"title"` + URL string `json:"url,omitempty"` +} + +// Match returns true if the other incident has got similarities with itself +func (incident RunstatusIncident) Match(other RunstatusIncident) bool { + if other.Title != "" && incident.Title == other.Title { + return true + } + + if other.ID > 0 && incident.ID == other.ID { + return true + } + + return false +} + +//RunstatusIncidentList is a list of incident +type RunstatusIncidentList struct { + Next string `json:"next"` + Previous string `json:"previous"` + Incidents []RunstatusIncident `json:"results"` +} + +// GetRunstatusIncident retrieves the details of a specific incident. +func (client *Client) GetRunstatusIncident(ctx context.Context, incident RunstatusIncident) (*RunstatusIncident, error) { + if incident.URL != "" { + return client.getRunstatusIncident(ctx, incident.URL) + } + + if incident.PageURL == "" { + return nil, fmt.Errorf("empty Page URL for %#v", incident) + } + + page, err := client.getRunstatusPage(ctx, incident.PageURL) + if err != nil { + return nil, err + } + + for i := range page.Incidents { + j := &page.Incidents[i] + if j.Match(incident) { + return j, nil + } + } + + return nil, fmt.Errorf("%#v not found", incident) +} + +func (client *Client) getRunstatusIncident(ctx context.Context, incidentURL string) (*RunstatusIncident, error) { + resp, err := client.runstatusRequest(ctx, incidentURL, nil, "GET") + if err != nil { + return nil, err + } + + i := new(RunstatusIncident) + if err := json.Unmarshal(resp, i); err != nil { + return nil, err + } + return i, nil +} + +// ListRunstatusIncidents lists the incidents for a specific page. +func (client *Client) ListRunstatusIncidents(ctx context.Context, page RunstatusPage) ([]RunstatusIncident, error) { + if page.IncidentsURL == "" { + return nil, fmt.Errorf("empty Incidents URL for %#v", page) + } + + results := make([]RunstatusIncident, 0) + + var err error + client.PaginateRunstatusIncidents(ctx, page, func(incident *RunstatusIncident, e error) bool { + if e != nil { + err = e + return false + } + + results = append(results, *incident) + return true + }) + + return results, err +} + +// PaginateRunstatusIncidents paginate Incidents +func (client *Client) PaginateRunstatusIncidents(ctx context.Context, page RunstatusPage, callback func(*RunstatusIncident, error) bool) { + if page.IncidentsURL == "" { + callback(nil, fmt.Errorf("empty Incidents URL for %#v", page)) + return + } + + incidentsURL := page.IncidentsURL + for incidentsURL != "" { + resp, err := client.runstatusRequest(ctx, incidentsURL, nil, "GET") + if err != nil { + callback(nil, err) + return + } + + var is *RunstatusIncidentList + if err := json.Unmarshal(resp, &is); err != nil { + callback(nil, err) + return + } + + for i := range is.Incidents { + if cont := callback(&is.Incidents[i], nil); !cont { + return + } + } + + incidentsURL = is.Next + } +} + +// CreateRunstatusIncident create runstatus incident +func (client *Client) CreateRunstatusIncident(ctx context.Context, incident RunstatusIncident) (*RunstatusIncident, error) { + if incident.PageURL == "" { + return nil, fmt.Errorf("empty Page URL for %#v", incident) + } + + page, err := client.getRunstatusPage(ctx, incident.PageURL) + if err != nil { + return nil, err + } + + if page.IncidentsURL == "" { + return nil, fmt.Errorf("empty Incidents URL for %#v", page) + } + + resp, err := client.runstatusRequest(ctx, page.IncidentsURL, incident, "POST") + if err != nil { + return nil, err + } + + i := &RunstatusIncident{} + if err := json.Unmarshal(resp, &i); err != nil { + return nil, err + } + + return i, nil +} + +// DeleteRunstatusIncident delete runstatus incident +func (client *Client) DeleteRunstatusIncident(ctx context.Context, incident RunstatusIncident) error { + if incident.URL == "" { + return fmt.Errorf("empty URL for %#v", incident) + } + + _, err := client.runstatusRequest(ctx, incident.URL, nil, "DELETE") + return err +} diff --git a/vendor/github.com/exoscale/egoscale/runstatus_maintenance.go b/vendor/github.com/exoscale/egoscale/runstatus_maintenance.go new file mode 100644 index 000000000..44501f9b7 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/runstatus_maintenance.go @@ -0,0 +1,208 @@ +package egoscale + +import ( + "context" + "encoding/json" + "fmt" + "log" + "net/url" + "path" + "strconv" + "time" +) + +// RunstatusMaintenance is a runstatus maintenance +type RunstatusMaintenance struct { + Created *time.Time `json:"created,omitempty"` + Description string `json:"description,omitempty"` + EndDate *time.Time `json:"end_date"` + Events []RunstatusEvent `json:"events,omitempty"` + EventsURL string `json:"events_url,omitempty"` + ID int `json:"id,omitempty"` // missing field + PageURL string `json:"page_url,omitempty"` // fake field + RealTime bool `json:"real_time,omitempty"` + Services []string `json:"services"` + StartDate *time.Time `json:"start_date"` + Status string `json:"status"` + Title string `json:"title"` + URL string `json:"url,omitempty"` +} + +// Match returns true if the other maintenance has got similarities with itself +func (maintenance RunstatusMaintenance) Match(other RunstatusMaintenance) bool { + if other.Title != "" && maintenance.Title == other.Title { + return true + } + + if other.ID > 0 && maintenance.ID == other.ID { + return true + } + + return false +} + +// FakeID fills up the ID field as it's currently missing +func (maintenance *RunstatusMaintenance) FakeID() error { + if maintenance.ID > 0 { + return nil + } + + if maintenance.URL == "" { + return fmt.Errorf("empty URL for %#v", maintenance) + } + + u, err := url.Parse(maintenance.URL) + if err != nil { + return err + } + + s := path.Base(u.Path) + id, err := strconv.Atoi(s) + if err != nil { + return err + } + maintenance.ID = id + return nil +} + +// RunstatusMaintenanceList is a list of incident +type RunstatusMaintenanceList struct { + Next string `json:"next"` + Previous string `json:"previous"` + Maintenances []RunstatusMaintenance `json:"results"` +} + +// GetRunstatusMaintenance retrieves the details of a specific maintenance. +func (client *Client) GetRunstatusMaintenance(ctx context.Context, maintenance RunstatusMaintenance) (*RunstatusMaintenance, error) { + if maintenance.URL != "" { + return client.getRunstatusMaintenance(ctx, maintenance.URL) + } + + if maintenance.PageURL == "" { + return nil, fmt.Errorf("empty Page URL for %#v", maintenance) + } + + page, err := client.getRunstatusPage(ctx, maintenance.PageURL) + if err != nil { + return nil, err + } + + for i := range page.Maintenances { + m := &page.Maintenances[i] + if m.Match(maintenance) { + if err := m.FakeID(); err != nil { + log.Printf("bad fake ID for %#v, %s", m, err) + } + return m, nil + } + } + + return nil, fmt.Errorf("%#v not found", maintenance) +} + +func (client *Client) getRunstatusMaintenance(ctx context.Context, maintenanceURL string) (*RunstatusMaintenance, error) { + resp, err := client.runstatusRequest(ctx, maintenanceURL, nil, "GET") + if err != nil { + return nil, err + } + + m := new(RunstatusMaintenance) + if err := json.Unmarshal(resp, m); err != nil { + return nil, err + } + return m, nil +} + +// ListRunstatusMaintenances returns the list of maintenances for the page. +func (client *Client) ListRunstatusMaintenances(ctx context.Context, page RunstatusPage) ([]RunstatusMaintenance, error) { + if page.MaintenancesURL == "" { + return nil, fmt.Errorf("empty Maintenances URL for %#v", page) + } + + results := make([]RunstatusMaintenance, 0) + + var err error + client.PaginateRunstatusMaintenances(ctx, page, func(maintenance *RunstatusMaintenance, e error) bool { + if e != nil { + err = e + return false + } + + results = append(results, *maintenance) + return true + }) + + return results, err +} + +// PaginateRunstatusMaintenances paginate Maintenances +func (client *Client) PaginateRunstatusMaintenances(ctx context.Context, page RunstatusPage, callback func(*RunstatusMaintenance, error) bool) { // nolint: dupl + if page.MaintenancesURL == "" { + callback(nil, fmt.Errorf("empty Maintenances URL for %#v", page)) + return + } + + maintenancesURL := page.MaintenancesURL + for maintenancesURL != "" { + resp, err := client.runstatusRequest(ctx, maintenancesURL, nil, "GET") + if err != nil { + callback(nil, err) + return + } + + var ms *RunstatusMaintenanceList + if err := json.Unmarshal(resp, &ms); err != nil { + callback(nil, err) + return + } + + for i := range ms.Maintenances { + if err := ms.Maintenances[i].FakeID(); err != nil { + log.Printf("bad fake ID for %#v, %s", ms.Maintenances[i], err) + } + if cont := callback(&ms.Maintenances[i], nil); !cont { + return + } + } + + maintenancesURL = ms.Next + } +} + +// CreateRunstatusMaintenance create runstatus Maintenance +func (client *Client) CreateRunstatusMaintenance(ctx context.Context, maintenance RunstatusMaintenance) (*RunstatusMaintenance, error) { + if maintenance.PageURL == "" { + return nil, fmt.Errorf("empty Page URL for %#v", maintenance) + } + + page, err := client.getRunstatusPage(ctx, maintenance.PageURL) + if err != nil { + return nil, err + } + + resp, err := client.runstatusRequest(ctx, page.MaintenancesURL, maintenance, "POST") + if err != nil { + return nil, err + } + + m := &RunstatusMaintenance{} + if err := json.Unmarshal(resp, &m); err != nil { + return nil, err + } + + if err := m.FakeID(); err != nil { + log.Printf("bad fake ID for %#v, %s", m, err) + } + + return m, nil +} + +// DeleteRunstatusMaintenance delete runstatus Maintenance +func (client *Client) DeleteRunstatusMaintenance(ctx context.Context, maintenance RunstatusMaintenance) error { + if maintenance.URL == "" { + return fmt.Errorf("empty URL for %#v", maintenance) + } + + _, err := client.runstatusRequest(ctx, maintenance.URL, nil, "DELETE") + return err +} diff --git a/vendor/github.com/exoscale/egoscale/runstatus_page.go b/vendor/github.com/exoscale/egoscale/runstatus_page.go new file mode 100644 index 000000000..01b6b8c77 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/runstatus_page.go @@ -0,0 +1,168 @@ +package egoscale + +import ( + "context" + "encoding/json" + "fmt" + "log" + "time" +) + +// RunstatusPage runstatus page +type RunstatusPage struct { + Created *time.Time `json:"created,omitempty"` + DarkTheme bool `json:"dark_theme,omitempty"` + Domain string `json:"domain,omitempty"` + GradientEnd string `json:"gradient_end,omitempty"` + GradientStart string `json:"gradient_start,omitempty"` + HeaderBackground string `json:"header_background,omitempty"` + ID int `json:"id,omitempty"` + Incidents []RunstatusIncident `json:"incidents,omitempty"` + IncidentsURL string `json:"incidents_url,omitempty"` + Logo string `json:"logo,omitempty"` + Maintenances []RunstatusMaintenance `json:"maintenances,omitempty"` + MaintenancesURL string `json:"maintenances_url,omitempty"` + Name string `json:"name"` //fake field (used to post a new runstatus page) + OkText string `json:"ok_text,omitempty"` + Plan string `json:"plan,omitempty"` + PublicURL string `json:"public_url,omitempty"` + Services []RunstatusService `json:"services,omitempty"` + ServicesURL string `json:"services_url,omitempty"` + State string `json:"state,omitempty"` + Subdomain string `json:"subdomain"` + SupportEmail string `json:"support_email,omitempty"` + TimeZone string `json:"time_zone,omitempty"` + Title string `json:"title,omitempty"` + TitleColor string `json:"title_color,omitempty"` + TwitterUsername string `json:"twitter_username,omitempty"` + URL string `json:"url,omitempty"` +} + +// Match returns true if the other page has got similarities with itself +func (page RunstatusPage) Match(other RunstatusPage) bool { + if other.Subdomain != "" && page.Subdomain == other.Subdomain { + return true + } + + if other.ID > 0 && page.ID == other.ID { + return true + } + + return false +} + +// RunstatusPageList runstatus page list +type RunstatusPageList struct { + Next string `json:"next"` + Previous string `json:"previous"` + Pages []RunstatusPage `json:"results"` +} + +// CreateRunstatusPage create runstatus page +func (client *Client) CreateRunstatusPage(ctx context.Context, page RunstatusPage) (*RunstatusPage, error) { + resp, err := client.runstatusRequest(ctx, client.Endpoint+runstatusPagesURL, page, "POST") + if err != nil { + return nil, err + } + + var p *RunstatusPage + if err := json.Unmarshal(resp, &p); err != nil { + return nil, err + } + + return p, nil +} + +// DeleteRunstatusPage delete runstatus page +func (client *Client) DeleteRunstatusPage(ctx context.Context, page RunstatusPage) error { + if page.URL == "" { + return fmt.Errorf("empty URL for %#v", page) + } + _, err := client.runstatusRequest(ctx, page.URL, nil, "DELETE") + return err +} + +// GetRunstatusPage fetches the runstatus page +func (client *Client) GetRunstatusPage(ctx context.Context, page RunstatusPage) (*RunstatusPage, error) { + if page.URL != "" { + return client.getRunstatusPage(ctx, page.URL) + } + + ps, err := client.ListRunstatusPages(ctx) + if err != nil { + return nil, err + } + + for i := range ps { + if ps[i].Match(page) { + return client.getRunstatusPage(ctx, ps[i].URL) + } + } + + return nil, fmt.Errorf("%#v not found", page) +} + +func (client *Client) getRunstatusPage(ctx context.Context, pageURL string) (*RunstatusPage, error) { + resp, err := client.runstatusRequest(ctx, pageURL, nil, "GET") + if err != nil { + return nil, err + } + + p := new(RunstatusPage) + if err := json.Unmarshal(resp, p); err != nil { + return nil, err + } + + // NOTE: fix the missing IDs + for i := range p.Maintenances { + if err := p.Maintenances[i].FakeID(); err != nil { + log.Printf("bad fake ID for %#v, %s", p.Maintenances[i], err) + } + } + for i := range p.Services { + if err := p.Services[i].FakeID(); err != nil { + log.Printf("bad fake ID for %#v, %s", p.Services[i], err) + } + } + + return p, nil +} + +// ListRunstatusPages list all the runstatus pages +func (client *Client) ListRunstatusPages(ctx context.Context) ([]RunstatusPage, error) { + resp, err := client.runstatusRequest(ctx, client.Endpoint+runstatusPagesURL, nil, "GET") + if err != nil { + return nil, err + } + + var p *RunstatusPageList + if err := json.Unmarshal(resp, &p); err != nil { + return nil, err + } + + return p.Pages, nil +} + +//PaginateRunstatusPages paginate on runstatus pages +func (client *Client) PaginateRunstatusPages(ctx context.Context, callback func(pages []RunstatusPage, e error) bool) { + pageURL := client.Endpoint + runstatusPagesURL + for pageURL != "" { + resp, err := client.runstatusRequest(ctx, pageURL, nil, "GET") + if err != nil { + callback(nil, err) + return + } + + var p *RunstatusPageList + if err := json.Unmarshal(resp, &p); err != nil { + callback(nil, err) + return + } + + if ok := callback(p.Pages, nil); ok { + return + } + + pageURL = p.Next + } +} diff --git a/vendor/github.com/exoscale/egoscale/runstatus_service.go b/vendor/github.com/exoscale/egoscale/runstatus_service.go new file mode 100644 index 000000000..456d92fcf --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/runstatus_service.go @@ -0,0 +1,201 @@ +package egoscale + +import ( + "context" + "encoding/json" + "fmt" + "log" + "net/url" + "path" + "strconv" +) + +// RunstatusService is a runstatus service +type RunstatusService struct { + ID int `json:"id"` // missing field + Name string `json:"name"` + PageURL string `json:"page_url,omitempty"` // fake field + State string `json:"state,omitempty"` + URL string `json:"url,omitempty"` +} + +// FakeID fills up the ID field as it's currently missing +func (service *RunstatusService) FakeID() error { + if service.ID > 0 { + return nil + } + + if service.URL == "" { + return fmt.Errorf("empty URL for %#v", service) + } + + u, err := url.Parse(service.URL) + if err != nil { + return err + } + + s := path.Base(u.Path) + id, err := strconv.Atoi(s) + if err != nil { + return err + } + service.ID = id + return nil +} + +// Match returns true if the other service has got similarities with itself +func (service RunstatusService) Match(other RunstatusService) bool { + if other.Name != "" && service.Name == other.Name { + return true + } + + if other.ID > 0 && service.ID == other.ID { + return true + } + + return false +} + +// RunstatusServiceList service list +type RunstatusServiceList struct { + Next string `json:"next"` + Previous string `json:"previous"` + Services []RunstatusService `json:"results"` +} + +// DeleteRunstatusService delete runstatus service +func (client *Client) DeleteRunstatusService(ctx context.Context, service RunstatusService) error { + if service.URL == "" { + return fmt.Errorf("empty URL for %#v", service) + } + + _, err := client.runstatusRequest(ctx, service.URL, nil, "DELETE") + return err +} + +// CreateRunstatusService create runstatus service +func (client *Client) CreateRunstatusService(ctx context.Context, service RunstatusService) (*RunstatusService, error) { + if service.PageURL == "" { + return nil, fmt.Errorf("empty Page URL for %#v", service) + } + + page, err := client.GetRunstatusPage(ctx, RunstatusPage{URL: service.PageURL}) + if err != nil { + return nil, err + } + + resp, err := client.runstatusRequest(ctx, page.ServicesURL, service, "POST") + if err != nil { + return nil, err + } + + s := &RunstatusService{} + if err := json.Unmarshal(resp, s); err != nil { + return nil, err + } + + return s, nil +} + +// GetRunstatusService displays service detail. +func (client *Client) GetRunstatusService(ctx context.Context, service RunstatusService) (*RunstatusService, error) { + if service.URL != "" { + return client.getRunstatusService(ctx, service.URL) + } + + if service.PageURL == "" { + return nil, fmt.Errorf("empty Page URL in %#v", service) + } + + page, err := client.getRunstatusPage(ctx, service.PageURL) + if err != nil { + return nil, err + } + + for i := range page.Services { + s := &page.Services[i] + if s.Match(service) { + if err := s.FakeID(); err != nil { + log.Printf("bad fake ID for %#v, %s", s, err) + } + return s, nil + } + } + + return nil, fmt.Errorf("%#v not found", service) +} + +func (client *Client) getRunstatusService(ctx context.Context, serviceURL string) (*RunstatusService, error) { + resp, err := client.runstatusRequest(ctx, serviceURL, nil, "GET") + if err != nil { + return nil, err + } + + s := &RunstatusService{} + if err := json.Unmarshal(resp, &s); err != nil { + return nil, err + } + + if err := s.FakeID(); err != nil { + log.Printf("bad fake ID for %#v, %s", s, err) + } + + return s, nil +} + +// ListRunstatusServices displays the list of services. +func (client *Client) ListRunstatusServices(ctx context.Context, page RunstatusPage) ([]RunstatusService, error) { + if page.ServicesURL == "" { + return nil, fmt.Errorf("empty Services URL for %#v", page) + } + + results := make([]RunstatusService, 0) + + var err error + client.PaginateRunstatusServices(ctx, page, func(service *RunstatusService, e error) bool { + if e != nil { + err = e + return false + } + + results = append(results, *service) + return true + }) + + return results, err +} + +// PaginateRunstatusServices paginates Services +func (client *Client) PaginateRunstatusServices(ctx context.Context, page RunstatusPage, callback func(*RunstatusService, error) bool) { // nolint: dupl + if page.ServicesURL == "" { + callback(nil, fmt.Errorf("empty Services URL for %#v", page)) + return + } + + servicesURL := page.ServicesURL + for servicesURL != "" { + resp, err := client.runstatusRequest(ctx, servicesURL, nil, "GET") + if err != nil { + callback(nil, err) + return + } + + var ss *RunstatusServiceList + if err := json.Unmarshal(resp, &ss); err != nil { + callback(nil, err) + return + } + + for i := range ss.Services { + if err := ss.Services[i].FakeID(); err != nil { + log.Printf("bad fake ID for %#v, %s", ss.Services[i], err) + } + + if cont := callback(&ss.Services[i], nil); !cont { + return + } + } + + servicesURL = ss.Next + } +} diff --git a/vendor/github.com/exoscale/egoscale/security_groups.go b/vendor/github.com/exoscale/egoscale/security_groups.go new file mode 100644 index 000000000..a11e53a4f --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/security_groups.go @@ -0,0 +1,226 @@ +package egoscale + +import ( + "context" + "fmt" + "net/url" + "strconv" + "strings" +) + +// SecurityGroup represent a firewalling set of rules +type SecurityGroup struct { + Account string `json:"account,omitempty" doc:"the account owning the security group"` + Description string `json:"description,omitempty" doc:"the description of the security group"` + EgressRule []EgressRule `json:"egressrule,omitempty" doc:"the list of egress rules associated with the security group"` + ID *UUID `json:"id" doc:"the ID of the security group"` + IngressRule []IngressRule `json:"ingressrule,omitempty" doc:"the list of ingress rules associated with the security group"` + Name string `json:"name,omitempty" doc:"the name of the security group"` +} + +// UserSecurityGroup converts a SecurityGroup to a UserSecurityGroup +func (sg SecurityGroup) UserSecurityGroup() UserSecurityGroup { + return UserSecurityGroup{ + Group: sg.Name, + } +} + +// ListRequest builds the ListSecurityGroups request +func (sg SecurityGroup) ListRequest() (ListCommand, error) { + req := &ListSecurityGroups{ + ID: sg.ID, + SecurityGroupName: sg.Name, + } + + return req, nil +} + +// Delete deletes the given Security Group +func (sg SecurityGroup) Delete(ctx context.Context, client *Client) error { + if sg.ID == nil && sg.Name == "" { + return fmt.Errorf("a SecurityGroup may only be deleted using ID or Name") + } + + req := &DeleteSecurityGroup{} + + if sg.ID != nil { + req.ID = sg.ID + } else { + req.Name = sg.Name + } + + return client.BooleanRequestWithContext(ctx, req) +} + +// RuleByID returns IngressRule or EgressRule by a rule ID +func (sg SecurityGroup) RuleByID(ruleID UUID) (*IngressRule, *EgressRule) { + for i, in := range sg.IngressRule { + if in.RuleID.Equal(ruleID) { + return &sg.IngressRule[i], nil + } + } + + for i, out := range sg.EgressRule { + if out.RuleID.Equal(ruleID) { + return nil, &sg.EgressRule[i] + } + } + + return nil, nil +} + +// IngressRule represents the ingress rule +type IngressRule struct { + CIDR *CIDR `json:"cidr,omitempty" doc:"the CIDR notation for the base IP address of the security group rule"` + Description string `json:"description,omitempty" doc:"description of the security group rule"` + EndPort uint16 `json:"endport,omitempty" doc:"the ending port of the security group rule "` + IcmpCode uint8 `json:"icmpcode,omitempty" doc:"the code for the ICMP message response"` + IcmpType uint8 `json:"icmptype,omitempty" doc:"the type of the ICMP message response"` + Protocol string `json:"protocol,omitempty" doc:"the protocol of the security group rule"` + RuleID *UUID `json:"ruleid" doc:"the id of the security group rule"` + SecurityGroupName string `json:"securitygroupname,omitempty" doc:"security group name"` + StartPort uint16 `json:"startport,omitempty" doc:"the starting port of the security group rule"` +} + +// EgressRule represents the ingress rule +type EgressRule IngressRule + +// UserSecurityGroup represents the traffic of another security group +type UserSecurityGroup struct { + Group string `json:"group,omitempty"` +} + +// String gives the UserSecurityGroup name +func (usg UserSecurityGroup) String() string { + return usg.Group +} + +// CreateSecurityGroup represents a security group creation +type CreateSecurityGroup struct { + Name string `json:"name" doc:"name of the security group"` + Description string `json:"description,omitempty" doc:"the description of the security group"` + _ bool `name:"createSecurityGroup" description:"Creates a security group"` +} + +// Response returns the struct to unmarshal +func (CreateSecurityGroup) Response() interface{} { + return new(SecurityGroup) +} + +// DeleteSecurityGroup represents a security group deletion +type DeleteSecurityGroup struct { + ID *UUID `json:"id,omitempty" doc:"The ID of the security group. Mutually exclusive with name parameter"` + Name string `json:"name,omitempty" doc:"The ID of the security group. Mutually exclusive with id parameter"` + _ bool `name:"deleteSecurityGroup" description:"Deletes security group"` +} + +// Response returns the struct to unmarshal +func (DeleteSecurityGroup) Response() interface{} { + return new(BooleanResponse) +} + +// AuthorizeSecurityGroupIngress (Async) represents the ingress rule creation +type AuthorizeSecurityGroupIngress struct { + CIDRList []CIDR `json:"cidrlist,omitempty" doc:"the cidr list associated"` + Description string `json:"description,omitempty" doc:"the description of the ingress/egress rule"` + EndPort uint16 `json:"endport,omitempty" doc:"end port for this ingress/egress rule"` + IcmpCode uint8 `json:"icmpcode,omitempty" doc:"error code for this icmp message"` + IcmpType uint8 `json:"icmptype,omitempty" doc:"type of the icmp message being sent"` + Protocol string `json:"protocol,omitempty" doc:"TCP is default. UDP, ICMP, ICMPv6, AH, ESP, GRE, IPIP are the other supported protocols"` + SecurityGroupID *UUID `json:"securitygroupid,omitempty" doc:"The ID of the security group. Mutually exclusive with securitygroupname parameter"` + SecurityGroupName string `json:"securitygroupname,omitempty" doc:"The name of the security group. Mutually exclusive with securitygroupid parameter"` + StartPort uint16 `json:"startport,omitempty" doc:"start port for this ingress/egress rule"` + UserSecurityGroupList []UserSecurityGroup `json:"usersecuritygrouplist,omitempty" doc:"user to security group mapping"` + _ bool `name:"authorizeSecurityGroupIngress" description:"Authorize a particular ingress/egress rule for this security group"` +} + +// Response returns the struct to unmarshal +func (AuthorizeSecurityGroupIngress) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (AuthorizeSecurityGroupIngress) AsyncResponse() interface{} { + return new(SecurityGroup) +} + +func (req AuthorizeSecurityGroupIngress) onBeforeSend(params url.Values) error { + // ICMP code and type may be zero but can also be omitted... + if strings.HasPrefix(strings.ToLower(req.Protocol), "icmp") { + params.Set("icmpcode", strconv.FormatInt(int64(req.IcmpCode), 10)) + params.Set("icmptype", strconv.FormatInt(int64(req.IcmpType), 10)) + } + // StartPort may be zero but can also be omitted... + if req.EndPort != 0 && req.StartPort == 0 { + params.Set("startport", "0") + } + return nil +} + +// AuthorizeSecurityGroupEgress (Async) represents the egress rule creation +type AuthorizeSecurityGroupEgress AuthorizeSecurityGroupIngress + +// Response returns the struct to unmarshal +func (AuthorizeSecurityGroupEgress) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (AuthorizeSecurityGroupEgress) AsyncResponse() interface{} { + return new(SecurityGroup) +} + +func (req AuthorizeSecurityGroupEgress) onBeforeSend(params url.Values) error { + return (AuthorizeSecurityGroupIngress)(req).onBeforeSend(params) +} + +// RevokeSecurityGroupIngress (Async) represents the ingress/egress rule deletion +type RevokeSecurityGroupIngress struct { + ID *UUID `json:"id" doc:"The ID of the ingress rule"` + _ bool `name:"revokeSecurityGroupIngress" description:"Deletes a particular ingress rule from this security group"` +} + +// Response returns the struct to unmarshal +func (RevokeSecurityGroupIngress) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (RevokeSecurityGroupIngress) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +// RevokeSecurityGroupEgress (Async) represents the ingress/egress rule deletion +type RevokeSecurityGroupEgress struct { + ID *UUID `json:"id" doc:"The ID of the egress rule"` + _ bool `name:"revokeSecurityGroupEgress" description:"Deletes a particular egress rule from this security group"` +} + +// Response returns the struct to unmarshal +func (RevokeSecurityGroupEgress) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (RevokeSecurityGroupEgress) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +//go:generate go run generate/main.go -interface=Listable ListSecurityGroups + +// ListSecurityGroups represents a search for security groups +type ListSecurityGroups struct { + ID *UUID `json:"id,omitempty" doc:"list the security group by the id provided"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + SecurityGroupName string `json:"securitygroupname,omitempty" doc:"lists security groups by name"` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"lists security groups by virtual machine id"` + _ bool `name:"listSecurityGroups" description:"Lists security groups"` +} + +// ListSecurityGroupsResponse represents a list of security groups +type ListSecurityGroupsResponse struct { + Count int `json:"count"` + SecurityGroup []SecurityGroup `json:"securitygroup"` +} diff --git a/vendor/github.com/exoscale/egoscale/securitygroups_response.go b/vendor/github.com/exoscale/egoscale/securitygroups_response.go new file mode 100644 index 000000000..ff08f333c --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/securitygroups_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListSecurityGroups) Response() interface{} { + return new(ListSecurityGroupsResponse) +} + +// ListRequest returns itself +func (ls *ListSecurityGroups) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListSecurityGroups) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListSecurityGroups) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListSecurityGroups) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListSecurityGroupsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListSecurityGroupsResponse was expected, got %T", resp)) + return + } + + for i := range items.SecurityGroup { + if !callback(&items.SecurityGroup[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/serialization.go b/vendor/github.com/exoscale/egoscale/serialization.go new file mode 100644 index 000000000..24a0c123f --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/serialization.go @@ -0,0 +1,402 @@ +package egoscale + +import ( + "encoding/base64" + "fmt" + "log" + "net" + "net/url" + "reflect" + "strconv" + "strings" +) + +func csQuotePlus(s string) string { + s = strings.Replace(s, "+", "%20", -1) + return s +} + +func csEncode(s string) string { + return csQuotePlus(url.QueryEscape(s)) +} + +// info returns the meta info of a command +// +// command is not a Command so it's easier to Test +func info(command interface{}) (*CommandInfo, error) { + typeof := reflect.TypeOf(command) + + // Going up the pointer chain to find the underlying struct + for typeof.Kind() == reflect.Ptr { + typeof = typeof.Elem() + } + + field, ok := typeof.FieldByName("_") + if !ok { + return nil, fmt.Errorf(`missing meta ("_") field in %#v`, command) + } + + name, nameOk := field.Tag.Lookup("name") + description, _ := field.Tag.Lookup("description") + + if !nameOk { + return nil, fmt.Errorf(`missing "name" key in the tag string of %#v`, command) + } + + info := &CommandInfo{ + Name: name, + Description: description, + } + + return info, nil +} + +// prepareValues uses a command to build a POST request +// +// command is not a Command so it's easier to Test +func prepareValues(prefix string, command interface{}) (url.Values, error) { + params := url.Values{} + + value := reflect.ValueOf(command) + typeof := reflect.TypeOf(command) + + // Going up the pointer chain to find the underlying struct + for typeof.Kind() == reflect.Ptr { + typeof = typeof.Elem() + value = value.Elem() + } + + // Checking for nil commands + if !value.IsValid() { + return nil, fmt.Errorf("cannot serialize the invalid value %#v", command) + } + + for i := 0; i < typeof.NumField(); i++ { + field := typeof.Field(i) + if field.Name == "_" { + continue + } + + val := value.Field(i) + tag := field.Tag + + var err error + var name string + var value interface{} + + if json, ok := tag.Lookup("json"); ok { + n, required := ExtractJSONTag(field.Name, json) + name = prefix + n + + switch val.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + value, err = prepareInt(val.Int(), required) + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + value, err = prepareUint(val.Uint(), required) + + case reflect.Float32, reflect.Float64: + value, err = prepareFloat(val.Float(), required) + + case reflect.String: + value, err = prepareString(val.String(), required) + + case reflect.Bool: + value, err = prepareBool(val.Bool(), required) + + case reflect.Map: + if val.Len() == 0 { + if required { + err = fmt.Errorf("field is required, got empty map") + } + } else { + value, err = prepareMap(name, val.Interface()) + } + + case reflect.Ptr: + value, err = preparePtr(field.Type.Elem().Kind(), val, required) + + case reflect.Slice: + value, err = prepareSlice(name, field.Type, val, required) + + case reflect.Struct: + value, err = prepareStruct(val.Interface(), required) + + default: + if required { + err = fmt.Errorf("unsupported type") + } + } + } else { + switch val.Kind() { + case reflect.Struct: + value, err = prepareEmbedStruct(val.Interface()) + default: + log.Printf("[SKIP] %s.%s no json label found", typeof.Name(), field.Name) + } + } + + if err != nil { + return nil, fmt.Errorf("%s.%s (%v) %s", typeof.Name(), field.Name, val.Kind(), err) + } + + switch v := value.(type) { + case *string: + if name != "" && v != nil { + params.Set(name, *v) + } + case url.Values: + for k, xs := range v { + for _, x := range xs { + params.Add(k, x) + } + } + } + } + + return params, nil +} + +func prepareInt(v int64, required bool) (*string, error) { + if v == 0 { + if required { + return nil, fmt.Errorf("field is required, got %d", v) + } + return nil, nil + } + value := strconv.FormatInt(v, 10) + return &value, nil +} + +func prepareUint(v uint64, required bool) (*string, error) { + if v == 0 { + if required { + return nil, fmt.Errorf("field is required, got %d", v) + } + return nil, nil + } + + value := strconv.FormatUint(v, 10) + return &value, nil +} + +func prepareFloat(v float64, required bool) (*string, error) { + if v == 0 { + if required { + return nil, fmt.Errorf("field is required, got %f", v) + } + return nil, nil + } + value := strconv.FormatFloat(v, 'f', -1, 64) + return &value, nil +} + +func prepareString(v string, required bool) (*string, error) { + if v == "" { + if required { + return nil, fmt.Errorf("field is required, got %q", v) + } + return nil, nil + } + return &v, nil +} + +func prepareBool(v bool, required bool) (*string, error) { + value := strconv.FormatBool(v) + if !v { + if required { + return &value, nil + } + return nil, nil + } + + return &value, nil +} + +func prepareList(prefix string, slice interface{}) (url.Values, error) { + params := url.Values{} + value := reflect.ValueOf(slice) + + for i := 0; i < value.Len(); i++ { + ps, err := prepareValues(fmt.Sprintf("%s[%d].", prefix, i), value.Index(i).Interface()) + if err != nil { + return nil, err + } + + for k, xs := range ps { + for _, x := range xs { + params.Add(k, x) + } + } + } + + return params, nil +} + +func prepareMap(prefix string, m interface{}) (url.Values, error) { + value := url.Values{} + v := reflect.ValueOf(m) + + for i, key := range v.MapKeys() { + var keyName string + var keyValue string + + switch key.Kind() { + case reflect.String: + keyName = key.String() + default: + return value, fmt.Errorf("only map[string]string are supported (XXX)") + } + + val := v.MapIndex(key) + switch val.Kind() { + case reflect.String: + keyValue = val.String() + default: + return value, fmt.Errorf("only map[string]string are supported (XXX)") + } + + value.Set(fmt.Sprintf("%s[%d].%s", prefix, i, keyName), keyValue) + } + + return value, nil +} + +func preparePtr(kind reflect.Kind, val reflect.Value, required bool) (*string, error) { + if val.IsNil() { + if required { + return nil, fmt.Errorf("field is required, got empty ptr") + } + return nil, nil + } + + switch kind { + case reflect.Bool: + return prepareBool(val.Elem().Bool(), true) + case reflect.Struct: + return prepareStruct(val.Interface(), required) + default: + return nil, fmt.Errorf("kind %v is not supported as a ptr", kind) + } +} + +func prepareSlice(name string, fieldType reflect.Type, val reflect.Value, required bool) (interface{}, error) { + switch fieldType.Elem().Kind() { + case reflect.Uint8: + switch fieldType { + case reflect.TypeOf(net.IPv4zero): + ip := (net.IP)(val.Bytes()) + if ip == nil || ip.Equal(net.IP{}) { + if required { + return nil, fmt.Errorf("field is required, got zero IPv4 address") + } + } else { + value := ip.String() + return &value, nil + } + + case reflect.TypeOf(MAC48(0, 0, 0, 0, 0, 0)): + mac := val.Interface().(MACAddress) + s := mac.String() + if s == "" { + if required { + return nil, fmt.Errorf("field is required, got empty MAC address") + } + } else { + return &s, nil + } + default: + if val.Len() == 0 { + if required { + return nil, fmt.Errorf("field is required, got empty slice") + } + } else { + value := base64.StdEncoding.EncodeToString(val.Bytes()) + return &value, nil + } + } + case reflect.String: + if val.Len() == 0 { + if required { + return nil, fmt.Errorf("field is required, got empty slice") + } + } else { + elems := make([]string, 0, val.Len()) + for i := 0; i < val.Len(); i++ { + // XXX what if the value contains a comma? Double encode? + s := val.Index(i).String() + elems = append(elems, s) + } + value := strings.Join(elems, ",") + return &value, nil + } + default: + switch fieldType.Elem() { + case reflect.TypeOf(CIDR{}), reflect.TypeOf(UUID{}): + if val.Len() == 0 { + if required { + return nil, fmt.Errorf("field is required, got empty slice") + } + } else { + v := reflect.ValueOf(val.Interface()) + ss := make([]string, val.Len()) + for i := 0; i < v.Len(); i++ { + e := v.Index(i).Interface() + s, ok := e.(fmt.Stringer) + if !ok { + return nil, fmt.Errorf("not a String, %T", e) + } + ss[i] = s.String() + } + value := strings.Join(ss, ",") + return &value, nil + } + default: + if val.Len() == 0 { + if required { + return nil, fmt.Errorf("field is required, got empty slice") + } + } else { + return prepareList(name, val.Interface()) + } + } + } + + return nil, nil +} + +func prepareStruct(i interface{}, required bool) (*string, error) { + s, ok := i.(fmt.Stringer) + if !ok { + return nil, fmt.Errorf("struct field not a Stringer") + } + + if s == nil { + if required { + return nil, fmt.Errorf("field is required, got %#v", s) + } + } + + return prepareString(s.String(), required) +} + +func prepareEmbedStruct(i interface{}) (url.Values, error) { + return prepareValues("", i) +} + +// ExtractJSONTag returns the variable name or defaultName as well as if the field is required (!omitempty) +func ExtractJSONTag(defaultName, jsonTag string) (string, bool) { + tags := strings.Split(jsonTag, ",") + name := tags[0] + required := true + for _, tag := range tags { + if tag == "omitempty" { + required = false + } + } + + if name == "" || name == "omitempty" { + name = defaultName + } + return name, required +} diff --git a/vendor/github.com/exoscale/egoscale/service_offerings.go b/vendor/github.com/exoscale/egoscale/service_offerings.go new file mode 100644 index 000000000..8d3551467 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/service_offerings.go @@ -0,0 +1,77 @@ +package egoscale + +// ServiceOffering corresponds to the Compute Offerings +// +// A service offering correspond to some hardware features (CPU, RAM). +// +// See: http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/latest/service_offerings.html +type ServiceOffering struct { + Authorized bool `json:"authorized,omitempty" doc:"is the account/domain authorized to use this service offering"` + CPUNumber int `json:"cpunumber,omitempty" doc:"the number of CPU"` + CPUSpeed int `json:"cpuspeed,omitempty" doc:"the clock rate CPU speed in Mhz"` + Created string `json:"created,omitempty" doc:"the date this service offering was created"` + DefaultUse bool `json:"defaultuse,omitempty" doc:"is this a default system vm offering"` + DeploymentPlanner string `json:"deploymentplanner,omitempty" doc:"deployment strategy used to deploy VM."` + DiskBytesReadRate int64 `json:"diskBytesReadRate,omitempty" doc:"bytes read rate of the service offering"` + DiskBytesWriteRate int64 `json:"diskBytesWriteRate,omitempty" doc:"bytes write rate of the service offering"` + DiskIopsReadRate int64 `json:"diskIopsReadRate,omitempty" doc:"io requests read rate of the service offering"` + DiskIopsWriteRate int64 `json:"diskIopsWriteRate,omitempty" doc:"io requests write rate of the service offering"` + Displaytext string `json:"displaytext,omitempty" doc:"an alternate display text of the service offering."` + HostTags string `json:"hosttags,omitempty" doc:"the host tag for the service offering"` + HypervisorSnapshotReserve int `json:"hypervisorsnapshotreserve,omitempty" doc:"Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)"` + ID *UUID `json:"id" doc:"the id of the service offering"` + IsCustomized bool `json:"iscustomized,omitempty" doc:"is true if the offering is customized"` + IsCustomizedIops bool `json:"iscustomizediops,omitempty" doc:"true if disk offering uses custom iops, false otherwise"` + IsSystem bool `json:"issystem,omitempty" doc:"is this a system vm offering"` + IsVolatile bool `json:"isvolatile,omitempty" doc:"true if the vm needs to be volatile, i.e., on every reboot of vm from API root disk is discarded and creates a new root disk"` + LimitCPUUse bool `json:"limitcpuuse,omitempty" doc:"restrict the CPU usage to committed service offering"` + MaxIops int64 `json:"maxiops,omitempty" doc:"the max iops of the disk offering"` + Memory int `json:"memory,omitempty" doc:"the memory in MB"` + MinIops int64 `json:"miniops,omitempty" doc:"the min iops of the disk offering"` + Name string `json:"name,omitempty" doc:"the name of the service offering"` + NetworkRate int `json:"networkrate,omitempty" doc:"data transfer rate in megabits per second allowed."` + OfferHA bool `json:"offerha,omitempty" doc:"the ha support in the service offering"` + Restricted bool `json:"restricted,omitempty" doc:"is this offering restricted"` + ServiceOfferingDetails map[string]string `json:"serviceofferingdetails,omitempty" doc:"additional key/value details tied with this service offering"` + StorageType string `json:"storagetype,omitempty" doc:"the storage type for this service offering"` + SystemVMType string `json:"systemvmtype,omitempty" doc:"is this a the systemvm type for system vm offering"` + Tags string `json:"tags,omitempty" doc:"the tags for the service offering"` +} + +// ListRequest builds the ListSecurityGroups request +func (so ServiceOffering) ListRequest() (ListCommand, error) { + // Restricted cannot be applied here because it really has three states + req := &ListServiceOfferings{ + ID: so.ID, + Name: so.Name, + SystemVMType: so.SystemVMType, + } + + if so.IsSystem { + req.IsSystem = &so.IsSystem + } + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListServiceOfferings + +// ListServiceOfferings represents a query for service offerings +type ListServiceOfferings struct { + ID *UUID `json:"id,omitempty" doc:"ID of the service offering"` + IsSystem *bool `json:"issystem,omitempty" doc:"is this a system vm offering"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"name of the service offering"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + Restricted *bool `json:"restricted,omitempty" doc:"filter by the restriction flag: true to list only the restricted service offerings, false to list non-restricted service offerings, or nothing for all."` + SystemVMType string `json:"systemvmtype,omitempty" doc:"the system VM type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\"."` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to."` + _ bool `name:"listServiceOfferings" description:"Lists all available service offerings."` +} + +// ListServiceOfferingsResponse represents a list of service offerings +type ListServiceOfferingsResponse struct { + Count int `json:"count"` + ServiceOffering []ServiceOffering `json:"serviceoffering"` +} diff --git a/vendor/github.com/exoscale/egoscale/serviceofferings_response.go b/vendor/github.com/exoscale/egoscale/serviceofferings_response.go new file mode 100644 index 000000000..a01d4aaf4 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/serviceofferings_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListServiceOfferings) Response() interface{} { + return new(ListServiceOfferingsResponse) +} + +// ListRequest returns itself +func (ls *ListServiceOfferings) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListServiceOfferings) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListServiceOfferings) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListServiceOfferings) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListServiceOfferingsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListServiceOfferingsResponse was expected, got %T", resp)) + return + } + + for i := range items.ServiceOffering { + if !callback(&items.ServiceOffering[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/snapshots.go b/vendor/github.com/exoscale/egoscale/snapshots.go new file mode 100644 index 000000000..191f4a0f7 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/snapshots.go @@ -0,0 +1,139 @@ +package egoscale + +// SnapshotState represents the Snapshot.State enum +// +// See: https://github.com/apache/cloudstack/blob/master/api/src/main/java/com/cloud/storage/Snapshot.java +type SnapshotState string + +const ( + // Allocated ... (TODO) + Allocated SnapshotState = "Allocated" + // Creating ... (TODO) + Creating SnapshotState = "Creating" + // CreatedOnPrimary ... (TODO) + CreatedOnPrimary SnapshotState = "CreatedOnPrimary" + // BackingUp ... (TODO) + BackingUp SnapshotState = "BackingUp" + // BackedUp ... (TODO) + BackedUp SnapshotState = "BackedUp" + // Copying ... (TODO) + Copying SnapshotState = "Copying" + // Destroying ... (TODO) + Destroying SnapshotState = "Destroying" + // Destroyed ... (TODO) + Destroyed SnapshotState = "Destroyed" + // Error is a state where the user can't see the snapshot while the snapshot may still exist on the storage + Error SnapshotState = "Error" +) + +// Snapshot represents a volume snapshot +type Snapshot struct { + Account string `json:"account,omitempty" doc:"the account associated with the snapshot"` + AccountID *UUID `json:"accountid,omitempty" doc:"the account ID associated with the snapshot"` + Created string `json:"created,omitempty" doc:"the date the snapshot was created"` + ID *UUID `json:"id,omitempty" doc:"ID of the snapshot"` + IntervalType string `json:"intervaltype,omitempty" doc:"valid types are hourly, daily, weekly, monthy, template, and none."` + Name string `json:"name,omitempty" doc:"name of the snapshot"` + PhysicalSize int64 `json:"physicalsize,omitempty" doc:"physical size of the snapshot on image store"` + Revertable *bool `json:"revertable,omitempty" doc:"indicates whether the underlying storage supports reverting the volume to this snapshot"` + Size int64 `json:"size,omitempty" doc:"the size of original volume"` + SnapshotType string `json:"snapshottype,omitempty" doc:"the type of the snapshot"` + State string `json:"state,omitempty" doc:"the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage"` + Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with snapshot"` + VolumeID *UUID `json:"volumeid,omitempty" doc:"ID of the disk volume"` + VolumeName string `json:"volumename,omitempty" doc:"name of the disk volume"` + VolumeType string `json:"volumetype,omitempty" doc:"type of the disk volume"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"id of the availability zone"` +} + +// ResourceType returns the type of the resource +func (Snapshot) ResourceType() string { + return "Snapshot" +} + +// CreateSnapshot (Async) creates an instant snapshot of a volume +type CreateSnapshot struct { + VolumeID *UUID `json:"volumeid" doc:"The ID of the disk volume"` + QuiesceVM *bool `json:"quiescevm,omitempty" doc:"quiesce vm if true"` + _ bool `name:"createSnapshot" description:"Creates an instant snapshot of a volume."` +} + +// Response returns the struct to unmarshal +func (CreateSnapshot) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (CreateSnapshot) AsyncResponse() interface{} { + return new(Snapshot) +} + +// ListRequest builds the ListSnapshot request +func (ss Snapshot) ListRequest() (ListCommand, error) { + // Restricted cannot be applied here because it really has three states + req := &ListSnapshots{ + ID: ss.ID, + Name: ss.Name, + VolumeID: ss.VolumeID, + SnapshotType: ss.SnapshotType, + ZoneID: ss.ZoneID, + // TODO: tags + } + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListSnapshots + +// ListSnapshots lists the volume snapshots +type ListSnapshots struct { + ID *UUID `json:"id,omitempty" doc:"lists snapshot by snapshot ID"` + IntervalType string `json:"intervaltype,omitempty" doc:"valid values are HOURLY, DAILY, WEEKLY, and MONTHLY."` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"lists snapshot by snapshot name"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + SnapshotType string `json:"snapshottype,omitempty" doc:"valid values are MANUAL or RECURRING."` + Tags []ResourceTag `json:"tags,omitempty" doc:"List resources by tags (key/value pairs)"` + VolumeID *UUID `json:"volumeid,omitempty" doc:"the ID of the disk volume"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"list snapshots by zone id"` + _ bool `name:"listSnapshots" description:"Lists all available snapshots for the account."` +} + +// ListSnapshotsResponse represents a list of volume snapshots +type ListSnapshotsResponse struct { + Count int `json:"count"` + Snapshot []Snapshot `json:"snapshot"` +} + +// DeleteSnapshot (Async) deletes a snapshot of a disk volume +type DeleteSnapshot struct { + ID *UUID `json:"id" doc:"The ID of the snapshot"` + _ bool `name:"deleteSnapshot" description:"Deletes a snapshot of a disk volume."` +} + +// Response returns the struct to unmarshal +func (DeleteSnapshot) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (DeleteSnapshot) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +// RevertSnapshot (Async) reverts a volume snapshot +type RevertSnapshot struct { + ID *UUID `json:"id" doc:"The ID of the snapshot"` + _ bool `name:"revertSnapshot" description:"revert a volume snapshot."` +} + +// Response returns the struct to unmarshal +func (RevertSnapshot) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (RevertSnapshot) AsyncResponse() interface{} { + return new(BooleanResponse) +} diff --git a/vendor/github.com/exoscale/egoscale/snapshots_response.go b/vendor/github.com/exoscale/egoscale/snapshots_response.go new file mode 100644 index 000000000..2ca9cff5a --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/snapshots_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListSnapshots) Response() interface{} { + return new(ListSnapshotsResponse) +} + +// ListRequest returns itself +func (ls *ListSnapshots) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListSnapshots) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListSnapshots) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListSnapshots) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListSnapshotsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListSnapshotsResponse was expected, got %T", resp)) + return + } + + for i := range items.Snapshot { + if !callback(&items.Snapshot[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/ssh_keypairs.go b/vendor/github.com/exoscale/egoscale/ssh_keypairs.go new file mode 100644 index 000000000..9f2bedca0 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/ssh_keypairs.go @@ -0,0 +1,105 @@ +package egoscale + +import ( + "context" + "fmt" +) + +// SSHKeyPair represents an SSH key pair +// +// See: http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/stable/virtual_machines.html#creating-the-ssh-keypair +type SSHKeyPair struct { + Fingerprint string `json:"fingerprint,omitempty" doc:"Fingerprint of the public key"` + Name string `json:"name,omitempty" doc:"Name of the keypair"` + PrivateKey string `json:"privatekey,omitempty" doc:"Private key"` +} + +// Delete removes the given SSH key, by Name +func (ssh SSHKeyPair) Delete(ctx context.Context, client *Client) error { + if ssh.Name == "" { + return fmt.Errorf("an SSH Key Pair may only be deleted using Name") + } + + return client.BooleanRequestWithContext(ctx, &DeleteSSHKeyPair{ + Name: ssh.Name, + }) +} + +// ListRequest builds the ListSSHKeyPairs request +func (ssh SSHKeyPair) ListRequest() (ListCommand, error) { + req := &ListSSHKeyPairs{ + Fingerprint: ssh.Fingerprint, + Name: ssh.Name, + } + + return req, nil +} + +// CreateSSHKeyPair represents a new keypair to be created +type CreateSSHKeyPair struct { + Name string `json:"name" doc:"Name of the keypair"` + _ bool `name:"createSSHKeyPair" description:"Create a new keypair and returns the private key"` +} + +// Response returns the struct to unmarshal +func (CreateSSHKeyPair) Response() interface{} { + return new(SSHKeyPair) +} + +// DeleteSSHKeyPair represents a new keypair to be created +type DeleteSSHKeyPair struct { + Name string `json:"name" doc:"Name of the keypair"` + _ bool `name:"deleteSSHKeyPair" description:"Deletes a keypair by name"` +} + +// Response returns the struct to unmarshal +func (DeleteSSHKeyPair) Response() interface{} { + return new(BooleanResponse) +} + +// RegisterSSHKeyPair represents a new registration of a public key in a keypair +type RegisterSSHKeyPair struct { + Name string `json:"name" doc:"Name of the keypair"` + PublicKey string `json:"publickey" doc:"Public key material of the keypair"` + _ bool `name:"registerSSHKeyPair" description:"Register a public key in a keypair under a certain name"` +} + +// Response returns the struct to unmarshal +func (RegisterSSHKeyPair) Response() interface{} { + return new(SSHKeyPair) +} + +//go:generate go run generate/main.go -interface=Listable ListSSHKeyPairs + +// ListSSHKeyPairs represents a query for a list of SSH KeyPairs +type ListSSHKeyPairs struct { + Fingerprint string `json:"fingerprint,omitempty" doc:"A public key fingerprint to look for"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"A key pair name to look for"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + _ bool `name:"listSSHKeyPairs" description:"List registered keypairs"` +} + +// ListSSHKeyPairsResponse represents a list of SSH key pairs +type ListSSHKeyPairsResponse struct { + Count int `json:"count"` + SSHKeyPair []SSHKeyPair `json:"sshkeypair"` +} + +// ResetSSHKeyForVirtualMachine (Async) represents a change for the key pairs +type ResetSSHKeyForVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + KeyPair string `json:"keypair" doc:"Name of the ssh key pair used to login to the virtual machine"` + _ bool `name:"resetSSHKeyForVirtualMachine" description:"Resets the SSH Key for virtual machine. The virtual machine must be in a \"Stopped\" state."` +} + +// Response returns the struct to unmarshal +func (ResetSSHKeyForVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (ResetSSHKeyForVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} diff --git a/vendor/github.com/exoscale/egoscale/sshkeypairs_response.go b/vendor/github.com/exoscale/egoscale/sshkeypairs_response.go new file mode 100644 index 000000000..31c471df2 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/sshkeypairs_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListSSHKeyPairs) Response() interface{} { + return new(ListSSHKeyPairsResponse) +} + +// ListRequest returns itself +func (ls *ListSSHKeyPairs) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListSSHKeyPairs) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListSSHKeyPairs) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListSSHKeyPairs) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListSSHKeyPairsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListSSHKeyPairsResponse was expected, got %T", resp)) + return + } + + for i := range items.SSHKeyPair { + if !callback(&items.SSHKeyPair[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/tags.go b/vendor/github.com/exoscale/egoscale/tags.go new file mode 100644 index 000000000..56e014850 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/tags.go @@ -0,0 +1,84 @@ +package egoscale + +// ResourceTag is a tag associated with a resource +// +// https://community.exoscale.com/documentation/compute/instance-tags/ +type ResourceTag struct { + Account string `json:"account,omitempty" doc:"the account associated with the tag"` + Customer string `json:"customer,omitempty" doc:"customer associated with the tag"` + Key string `json:"key,omitempty" doc:"tag key name"` + ResourceID *UUID `json:"resourceid,omitempty" doc:"id of the resource"` + ResourceType string `json:"resourcetype,omitempty" doc:"resource type"` + Value string `json:"value,omitempty" doc:"tag value"` +} + +// ListRequest builds the ListZones request +func (tag ResourceTag) ListRequest() (ListCommand, error) { + req := &ListTags{ + Customer: tag.Customer, + Key: tag.Key, + ResourceID: tag.ResourceID, + ResourceType: tag.ResourceType, + Value: tag.Value, + } + + return req, nil +} + +// CreateTags (Async) creates resource tag(s) +type CreateTags struct { + ResourceIDs []UUID `json:"resourceids" doc:"list of resources to create the tags for"` + ResourceType string `json:"resourcetype" doc:"type of the resource"` + Tags []ResourceTag `json:"tags" doc:"Map of tags (key/value pairs)"` + Customer string `json:"customer,omitempty" doc:"identifies client specific tag. When the value is not null, the tag can't be used by cloudStack code internally"` + _ bool `name:"createTags" description:"Creates resource tag(s)"` +} + +// Response returns the struct to unmarshal +func (CreateTags) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (CreateTags) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +// DeleteTags (Async) deletes the resource tag(s) +type DeleteTags struct { + ResourceIDs []UUID `json:"resourceids" doc:"Delete tags for resource id(s)"` + ResourceType string `json:"resourcetype" doc:"Delete tag by resource type"` + Tags []ResourceTag `json:"tags,omitempty" doc:"Delete tags matching key/value pairs"` + _ bool `name:"deleteTags" description:"Deleting resource tag(s)"` +} + +// Response returns the struct to unmarshal +func (DeleteTags) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (DeleteTags) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +//go:generate go run generate/main.go -interface=Listable ListTags + +// ListTags list resource tag(s) +type ListTags struct { + Customer string `json:"customer,omitempty" doc:"list by customer name"` + Key string `json:"key,omitempty" doc:"list by key"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + ResourceID *UUID `json:"resourceid,omitempty" doc:"list by resource id"` + ResourceType string `json:"resourcetype,omitempty" doc:"list by resource type"` + Value string `json:"value,omitempty" doc:"list by value"` + _ bool `name:"listTags" description:"List resource tag(s)"` +} + +// ListTagsResponse represents a list of resource tags +type ListTagsResponse struct { + Count int `json:"count"` + Tag []ResourceTag `json:"tag"` +} diff --git a/vendor/github.com/exoscale/egoscale/tags_response.go b/vendor/github.com/exoscale/egoscale/tags_response.go new file mode 100644 index 000000000..870ef49a8 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/tags_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListTags) Response() interface{} { + return new(ListTagsResponse) +} + +// ListRequest returns itself +func (ls *ListTags) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListTags) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListTags) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListTags) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListTagsResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListTagsResponse was expected, got %T", resp)) + return + } + + for i := range items.Tag { + if !callback(&items.Tag[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/templates.go b/vendor/github.com/exoscale/egoscale/templates.go new file mode 100644 index 000000000..9f49369d2 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/templates.go @@ -0,0 +1,163 @@ +package egoscale + +// Template represents a machine to be deployed. +type Template struct { + Account string `json:"account,omitempty" doc:"the account name to which the template belongs"` + AccountID *UUID `json:"accountid,omitempty" doc:"the account id to which the template belongs"` + Bootable bool `json:"bootable,omitempty" doc:"true if the ISO is bootable, false otherwise"` + Checksum string `json:"checksum,omitempty" doc:"checksum of the template"` + Created string `json:"created,omitempty" doc:"the date this template was created"` + CrossZones bool `json:"crossZones,omitempty" doc:"true if the template is managed across all Zones, false otherwise"` + Details map[string]string `json:"details,omitempty" doc:"additional key/value details tied with template"` + DisplayText string `json:"displaytext,omitempty" doc:"the template display text"` + Format string `json:"format,omitempty" doc:"the format of the template."` + HostID *UUID `json:"hostid,omitempty" doc:"the ID of the secondary storage host for the template"` + HostName string `json:"hostname,omitempty" doc:"the name of the secondary storage host for the template"` + Hypervisor string `json:"hypervisor,omitempty" doc:"the target hypervisor for the template"` + ID *UUID `json:"id,omitempty" doc:"the template ID"` + IsDynamicallyScalable bool `json:"isdynamicallyscalable,omitempty" doc:"true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory"` + IsExtractable bool `json:"isextractable,omitempty" doc:"true if the template is extractable, false otherwise"` + IsFeatured bool `json:"isfeatured,omitempty" doc:"true if this template is a featured template, false otherwise"` + IsPublic bool `json:"ispublic,omitempty" doc:"true if this template is a public template, false otherwise"` + IsReady bool `json:"isready,omitempty" doc:"true if the template is ready to be deployed from, false otherwise."` + Name string `json:"name,omitempty" doc:"the template name"` + OsCategoryID *UUID `json:"oscategoryid,omitempty" doc:"the ID of the OS category for this template"` + OsCategoryName string `json:"oscategoryname,omitempty" doc:"the name of the OS category for this template"` + OsTypeID *UUID `json:"ostypeid,omitempty" doc:"the ID of the OS type for this template"` + OsTypeName string `json:"ostypename,omitempty" doc:"the name of the OS type for this template"` + PasswordEnabled bool `json:"passwordenabled,omitempty" doc:"true if the reset password feature is enabled, false otherwise"` + Removed string `json:"removed,omitempty" doc:"the date this template was removed"` + Size int64 `json:"size,omitempty" doc:"the size of the template"` + SourceTemplateID *UUID `json:"sourcetemplateid,omitempty" doc:"the template ID of the parent template if present"` + SSHKeyEnabled bool `json:"sshkeyenabled,omitempty" doc:"true if template is sshkey enabled, false otherwise"` + Status string `json:"status,omitempty" doc:"the status of the template"` + Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with tempate"` + TemplateDirectory string `json:"templatedirectory,omitempty" doc:"Template directory"` + TemplateTag string `json:"templatetag,omitempty" doc:"the tag of this template"` + TemplateType string `json:"templatetype,omitempty" doc:"the type of the template"` + URL string `json:"url,omitempty" doc:"Original URL of the template where it was downloaded"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"the ID of the zone for this template"` + ZoneName string `json:"zonename,omitempty" doc:"the name of the zone for this template"` +} + +// ResourceType returns the type of the resource +func (Template) ResourceType() string { + return "Template" +} + +// ListRequest builds the ListTemplates request +func (template Template) ListRequest() (ListCommand, error) { + req := &ListTemplates{ + ID: template.ID, + Name: template.Name, + ZoneID: template.ZoneID, + } + if template.IsFeatured { + req.TemplateFilter = "featured" + } + if template.Removed != "" { + *req.ShowRemoved = true + } + + for i := range template.Tags { + req.Tags = append(req.Tags, template.Tags[i]) + } + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListTemplates + +// ListTemplates represents a template query filter +type ListTemplates struct { + TemplateFilter string `json:"templatefilter" doc:"Possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured."` + ID *UUID `json:"id,omitempty" doc:"the template ID"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"the template name"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + ShowRemoved *bool `json:"showremoved,omitempty" doc:"Show removed templates as well"` + Tags []ResourceTag `json:"tags,omitempty" doc:"List resources by tags (key/value pairs)"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"list templates by zoneid"` + _ bool `name:"listTemplates" description:"List all public, private, and privileged templates."` +} + +// ListTemplatesResponse represents a list of templates +type ListTemplatesResponse struct { + Count int `json:"count"` + Template []Template `json:"template"` +} + +// OSCategory represents an OS category +type OSCategory struct { + ID *UUID `json:"id,omitempty" doc:"the ID of the OS category"` + Name string `json:"name,omitempty" doc:"the name of the OS category"` +} + +// ListRequest builds the ListOSCategories request +func (osCat OSCategory) ListRequest() (ListCommand, error) { + req := &ListOSCategories{ + Name: osCat.Name, + ID: osCat.ID, + } + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListOSCategories + +// ListOSCategories lists the OS categories +type ListOSCategories struct { + ID *UUID `json:"id,omitempty" doc:"list Os category by id"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"list os category by name"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + _ bool `name:"listOsCategories" description:"Lists all supported OS categories for this cloud."` +} + +// ListOSCategoriesResponse represents a list of OS categories +type ListOSCategoriesResponse struct { + Count int `json:"count"` + OSCategory []OSCategory `json:"oscategory"` +} + +// DeleteTemplate deletes a template by ID +type DeleteTemplate struct { + _ bool `name:"deleteTemplate" description:"Deletes a template"` + ID *UUID `json:"id" doc:"the ID of the template"` +} + +// Response returns the struct to unmarshal +func (DeleteTemplate) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (DeleteTemplate) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +// RegisterCustomTemplate registers a new template +type RegisterCustomTemplate struct { + _ bool `name:"registerCustomTemplate" description:"Register a new template."` + Checksum string `json:"checksum" doc:"the MD5 checksum value of this template"` + Details map[string]string `json:"details,omitempty" doc:"Template details in key/value pairs"` + Displaytext string `json:"displaytext" doc:"the display text of the template"` + Name string `json:"name" doc:"the name of the template"` + PasswordEnabled *bool `json:"passwordenabled,omitempty" doc:"true if the template supports the password reset feature; default is false"` + SSHKeyEnabled *bool `json:"sshkeyenabled,omitempty" doc:"true if the template supports the sshkey upload feature; default is false"` + TemplateTag string `json:"templatetag,omitempty" doc:"the tag for this template"` + URL string `json:"url" doc:"the URL of where the template is hosted"` + ZoneID *UUID `json:"zoneid" doc:"the ID of the zone the template is to be hosted on"` +} + +// Response returns the struct to unmarshal +func (RegisterCustomTemplate) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (RegisterCustomTemplate) AsyncResponse() interface{} { + return new([]Template) +} diff --git a/vendor/github.com/exoscale/egoscale/templates_response.go b/vendor/github.com/exoscale/egoscale/templates_response.go new file mode 100644 index 000000000..b9d61b546 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/templates_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListTemplates) Response() interface{} { + return new(ListTemplatesResponse) +} + +// ListRequest returns itself +func (ls *ListTemplates) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListTemplates) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListTemplates) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListTemplates) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListTemplatesResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListTemplatesResponse was expected, got %T", resp)) + return + } + + for i := range items.Template { + if !callback(&items.Template[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/users.go b/vendor/github.com/exoscale/egoscale/users.go new file mode 100644 index 000000000..71078a97b --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/users.go @@ -0,0 +1,63 @@ +package egoscale + +// User represents a User +type User struct { + APIKey string `json:"apikey,omitempty" doc:"the api key of the user"` + Account string `json:"account,omitempty" doc:"the account name of the user"` + AccountID *UUID `json:"accountid,omitempty" doc:"the account ID of the user"` + Created string `json:"created,omitempty" doc:"the date and time the user account was created"` + Email string `json:"email,omitempty" doc:"the user email address"` + FirstName string `json:"firstname,omitempty" doc:"the user firstname"` + ID *UUID `json:"id,omitempty" doc:"the user ID"` + IsDefault bool `json:"isdefault,omitempty" doc:"true if user is default, false otherwise"` + LastName string `json:"lastname,omitempty" doc:"the user lastname"` + RoleID *UUID `json:"roleid,omitempty" doc:"the ID of the role"` + RoleName string `json:"rolename,omitempty" doc:"the name of the role"` + RoleType string `json:"roletype,omitempty" doc:"the type of the role"` + SecretKey string `json:"secretkey,omitempty" doc:"the secret key of the user"` + State string `json:"state,omitempty" doc:"the user state"` + Timezone string `json:"timezone,omitempty" doc:"the timezone user was created in"` + UserName string `json:"username,omitempty" doc:"the user name"` +} + +// ListRequest builds the ListUsers request +func (user User) ListRequest() (ListCommand, error) { + req := &ListUsers{ + ID: user.ID, + UserName: user.UserName, + } + + return req, nil +} + +// RegisterUserKeys registers a new set of key of the given user +// +// NB: only the APIKey and SecretKey will be filled +type RegisterUserKeys struct { + ID *UUID `json:"id" doc:"User id"` + _ bool `name:"registerUserKeys" description:"This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user"` +} + +// Response returns the struct to unmarshal +func (RegisterUserKeys) Response() interface{} { + return new(User) +} + +//go:generate go run generate/main.go -interface=Listable ListUsers + +// ListUsers represents the search for Users +type ListUsers struct { + ID *UUID `json:"id,omitempty" doc:"List user by ID."` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + State string `json:"state,omitempty" doc:"List users by state of the user account."` + UserName string `json:"username,omitempty" doc:"List user by the username"` + _ bool `name:"listUsers" description:"Lists user accounts"` +} + +// ListUsersResponse represents a list of users +type ListUsersResponse struct { + Count int `json:"count"` + User []User `json:"user"` +} diff --git a/vendor/github.com/exoscale/egoscale/users_response.go b/vendor/github.com/exoscale/egoscale/users_response.go new file mode 100644 index 000000000..4bd4bf473 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/users_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListUsers) Response() interface{} { + return new(ListUsersResponse) +} + +// ListRequest returns itself +func (ls *ListUsers) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListUsers) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListUsers) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListUsers) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListUsersResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListUsersResponse was expected, got %T", resp)) + return + } + + for i := range items.User { + if !callback(&items.User[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/uuid.go b/vendor/github.com/exoscale/egoscale/uuid.go new file mode 100644 index 000000000..dd8be1557 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/uuid.go @@ -0,0 +1,79 @@ +package egoscale + +import ( + "encoding/json" + "fmt" + + uuid "github.com/gofrs/uuid" +) + +// UUID holds a UUID v4 +type UUID struct { + uuid.UUID +} + +// DeepCopy create a true copy of the receiver. +func (u *UUID) DeepCopy() *UUID { + if u == nil { + return nil + } + + out := [uuid.Size]byte{} + copy(out[:], u.Bytes()) + + return &UUID{ + (uuid.UUID)(out), + } +} + +// DeepCopyInto copies the receiver into out. +// +// In must be non nil. +func (u *UUID) DeepCopyInto(out *UUID) { + o := [uuid.Size]byte{} + copy(o[:], u.Bytes()) + + out.UUID = (uuid.UUID)(o) +} + +// Equal returns true if itself is equal to other. +func (u UUID) Equal(other UUID) bool { + return u == other +} + +// UnmarshalJSON unmarshals the raw JSON into the UUID. +func (u *UUID) UnmarshalJSON(b []byte) error { + var s string + if err := json.Unmarshal(b, &s); err != nil { + return err + } + + new, err := ParseUUID(s) + if err == nil { + u.UUID = new.UUID + } + return err +} + +// MarshalJSON converts the UUID to a string representation. +func (u UUID) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", u.String())), nil +} + +// ParseUUID parses a string into a UUID. +func ParseUUID(s string) (*UUID, error) { + u, err := uuid.FromString(s) + if err != nil { + return nil, err + } + return &UUID{u}, nil +} + +// MustParseUUID acts like ParseUUID but panic in case of a failure. +func MustParseUUID(s string) *UUID { + u, e := ParseUUID(s) + if e != nil { + panic(e) + } + return u +} diff --git a/vendor/github.com/exoscale/egoscale/version.go b/vendor/github.com/exoscale/egoscale/version.go new file mode 100644 index 000000000..d96946140 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/version.go @@ -0,0 +1,4 @@ +package egoscale + +// Version of the library +const Version = "0.18.1" diff --git a/vendor/github.com/exoscale/egoscale/virtual_machines.go b/vendor/github.com/exoscale/egoscale/virtual_machines.go new file mode 100644 index 000000000..da6ce65c5 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/virtual_machines.go @@ -0,0 +1,613 @@ +package egoscale + +import ( + "bytes" + "compress/gzip" + "context" + "encoding/base64" + "fmt" + "io/ioutil" + "net" + "net/url" +) + +// VirtualMachineState holds the state of the instance +// +// https://github.com/apache/cloudstack/blob/master/api/src/main/java/com/cloud/vm/VirtualMachine.java +type VirtualMachineState string + +const ( + // VirtualMachineStarting VM is being started. At this state, you should find host id filled which means it's being started on that host + VirtualMachineStarting VirtualMachineState = "Starting" + // VirtualMachineRunning VM is running. host id has the host that it is running on + VirtualMachineRunning VirtualMachineState = "Running" + // VirtualMachineStopping VM is being stopped. host id has the host that it is being stopped on + VirtualMachineStopping VirtualMachineState = "Stopping" + // VirtualMachineStopped VM is stopped. host id should be null + VirtualMachineStopped VirtualMachineState = "Stopped" + // VirtualMachineDestroyed VM is marked for destroy + VirtualMachineDestroyed VirtualMachineState = "Destroyed" + // VirtualMachineExpunging "VM is being expunged + VirtualMachineExpunging VirtualMachineState = "Expunging" + // VirtualMachineMigrating VM is being live migrated. host id holds destination host, last host id holds source host + VirtualMachineMigrating VirtualMachineState = "Migrating" + // VirtualMachineMoving VM is being migrated offline (volume is being moved). + VirtualMachineMoving VirtualMachineState = "Moving" + // VirtualMachineError VM is in error + VirtualMachineError VirtualMachineState = "Error" + // VirtualMachineUnknown VM state is unknown + VirtualMachineUnknown VirtualMachineState = "Unknown" + // VirtualMachineShutdowned VM is shutdowned from inside + VirtualMachineShutdowned VirtualMachineState = "Shutdowned" +) + +// VirtualMachine represents a virtual machine +// +// See: http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/stable/virtual_machines.html +type VirtualMachine struct { + Account string `json:"account,omitempty" doc:"the account associated with the virtual machine"` + AccountID *UUID `json:"accountid,omitempty" doc:"the account ID associated with the virtual machine"` + AffinityGroup []AffinityGroup `json:"affinitygroup,omitempty" doc:"list of affinity groups associated with the virtual machine"` + ClusterID *UUID `json:"clusterid,omitempty" doc:"the ID of the vm's cluster"` + ClusterName string `json:"clustername,omitempty" doc:"the name of the vm's cluster"` + CPUNumber int `json:"cpunumber,omitempty" doc:"the number of cpu this virtual machine is running with"` + CPUSpeed int `json:"cpuspeed,omitempty" doc:"the speed of each cpu"` + CPUUsed string `json:"cpuused,omitempty" doc:"the amount of the vm's CPU currently used"` + Created string `json:"created,omitempty" doc:"the date when this virtual machine was created"` + Details map[string]string `json:"details,omitempty" doc:"Vm details in key/value pairs."` + DiskIoRead int64 `json:"diskioread,omitempty" doc:"the read (io) of disk on the vm"` + DiskIoWrite int64 `json:"diskiowrite,omitempty" doc:"the write (io) of disk on the vm"` + DiskKbsRead int64 `json:"diskkbsread,omitempty" doc:"the read (bytes) of disk on the vm"` + DiskKbsWrite int64 `json:"diskkbswrite,omitempty" doc:"the write (bytes) of disk on the vm"` + DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"the ID of the disk offering of the virtual machine"` + DiskOfferingName string `json:"diskofferingname,omitempty" doc:"the name of the disk offering of the virtual machine"` + DisplayName string `json:"displayname,omitempty" doc:"user generated name. The name of the virtual machine is returned if no displayname exists."` + ForVirtualNetwork bool `json:"forvirtualnetwork,omitempty" doc:"the virtual network for the service offering"` + Group string `json:"group,omitempty" doc:"the group name of the virtual machine"` + GroupID *UUID `json:"groupid,omitempty" doc:"the group ID of the virtual machine"` + HAEnable bool `json:"haenable,omitempty" doc:"true if high-availability is enabled, false otherwise"` + HostName string `json:"hostname,omitempty" doc:"the name of the host for the virtual machine"` + ID *UUID `json:"id,omitempty" doc:"the ID of the virtual machine"` + InstanceName string `json:"instancename,omitempty" doc:"instance name of the user vm; this parameter is returned to the ROOT admin only"` + IsoDisplayText string `json:"isodisplaytext,omitempty" doc:"an alternate display text of the ISO attached to the virtual machine"` + IsoID *UUID `json:"isoid,omitempty" doc:"the ID of the ISO attached to the virtual machine"` + IsoName string `json:"isoname,omitempty" doc:"the name of the ISO attached to the virtual machine"` + KeyPair string `json:"keypair,omitempty" doc:"ssh key-pair"` + Memory int `json:"memory,omitempty" doc:"the memory allocated for the virtual machine"` + Name string `json:"name,omitempty" doc:"the name of the virtual machine"` + NetworkKbsRead int64 `json:"networkkbsread,omitempty" doc:"the incoming network traffic on the vm"` + NetworkKbsWrite int64 `json:"networkkbswrite,omitempty" doc:"the outgoing network traffic on the host"` + Nic []Nic `json:"nic,omitempty" doc:"the list of nics associated with vm"` + OSCategoryID *UUID `json:"oscategoryid,omitempty" doc:"Os category ID of the virtual machine"` + OSCategoryName string `json:"oscategoryname,omitempty" doc:"Os category name of the virtual machine"` + OSTypeID *UUID `json:"ostypeid,omitempty" doc:"OS type id of the vm"` + Password string `json:"password,omitempty" doc:"the password (if exists) of the virtual machine"` + PasswordEnabled bool `json:"passwordenabled,omitempty" doc:"true if the password rest feature is enabled, false otherwise"` + PCIDevices []PCIDevice `json:"pcidevices,omitempty" doc:"list of PCI devices"` + PodID *UUID `json:"podid,omitempty" doc:"the ID of the vm's pod"` + PodName string `json:"podname,omitempty" doc:"the name of the vm's pod"` + PublicIP string `json:"publicip,omitempty" doc:"public IP address id associated with vm via Static nat rule"` + PublicIPID *UUID `json:"publicipid,omitempty" doc:"public IP address id associated with vm via Static nat rule"` + RootDeviceID int64 `json:"rootdeviceid,omitempty" doc:"device ID of the root volume"` + RootDeviceType string `json:"rootdevicetype,omitempty" doc:"device type of the root volume"` + SecurityGroup []SecurityGroup `json:"securitygroup,omitempty" doc:"list of security groups associated with the virtual machine"` + ServiceOfferingID *UUID `json:"serviceofferingid,omitempty" doc:"the ID of the service offering of the virtual machine"` + ServiceOfferingName string `json:"serviceofferingname,omitempty" doc:"the name of the service offering of the virtual machine"` + ServiceState string `json:"servicestate,omitempty" doc:"State of the Service from LB rule"` + State string `json:"state,omitempty" doc:"the state of the virtual machine"` + Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with vm"` + TemplateDisplayText string `json:"templatedisplaytext,omitempty" doc:"an alternate display text of the template for the virtual machine"` + TemplateID *UUID `json:"templateid,omitempty" doc:"the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file."` + TemplateName string `json:"templatename,omitempty" doc:"the name of the template for the virtual machine"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"the ID of the availablility zone for the virtual machine"` + ZoneName string `json:"zonename,omitempty" doc:"the name of the availability zone for the virtual machine"` +} + +// ResourceType returns the type of the resource +func (VirtualMachine) ResourceType() string { + return "UserVM" +} + +// Delete destroys the VM +func (vm VirtualMachine) Delete(ctx context.Context, client *Client) error { + _, err := client.RequestWithContext(ctx, &DestroyVirtualMachine{ + ID: vm.ID, + }) + + return err +} + +// ListRequest builds the ListVirtualMachines request +func (vm VirtualMachine) ListRequest() (ListCommand, error) { + // XXX: AffinityGroupID, SecurityGroupID + + req := &ListVirtualMachines{ + GroupID: vm.GroupID, + ID: vm.ID, + Name: vm.Name, + State: vm.State, + TemplateID: vm.TemplateID, + ZoneID: vm.ZoneID, + } + + nic := vm.DefaultNic() + if nic != nil { + req.IPAddress = nic.IPAddress + } + + for i := range vm.Tags { + req.Tags = append(req.Tags, vm.Tags[i]) + } + + return req, nil +} + +// DefaultNic returns the default nic +func (vm VirtualMachine) DefaultNic() *Nic { + for i, nic := range vm.Nic { + if nic.IsDefault { + return &vm.Nic[i] + } + } + + return nil +} + +// IP returns the default nic IP address +func (vm VirtualMachine) IP() *net.IP { + nic := vm.DefaultNic() + if nic != nil { + ip := nic.IPAddress + return &ip + } + + return nil +} + +// NicsByType returns the corresponding interfaces base on the given type +func (vm VirtualMachine) NicsByType(nicType string) []Nic { + nics := make([]Nic, 0) + for _, nic := range vm.Nic { + if nic.Type == nicType { + // XXX The API forgets to specify it + n := nic + n.VirtualMachineID = vm.ID + nics = append(nics, n) + } + } + return nics +} + +// NicByNetworkID returns the corresponding interface based on the given NetworkID +// +// A VM cannot be connected twice to a same network. +func (vm VirtualMachine) NicByNetworkID(networkID UUID) *Nic { + for _, nic := range vm.Nic { + if nic.NetworkID.Equal(networkID) { + n := nic + n.VirtualMachineID = vm.ID + return &n + } + } + return nil +} + +// NicByID returns the corresponding interface base on its ID +func (vm VirtualMachine) NicByID(nicID UUID) *Nic { + for _, nic := range vm.Nic { + if nic.ID.Equal(nicID) { + n := nic + n.VirtualMachineID = vm.ID + return &n + } + } + + return nil +} + +// IPToNetwork represents a mapping between ip and networks +type IPToNetwork struct { + IP net.IP `json:"ip,omitempty"` + Ipv6 net.IP `json:"ipv6,omitempty"` + NetworkID *UUID `json:"networkid,omitempty"` +} + +// PCIDevice represents a PCI card present in the host +type PCIDevice struct { + PCIVendorName string `json:"pcivendorname,omitempty" doc:"Device vendor name of pci card"` + DeviceID string `json:"deviceid,omitempty" doc:"Device model ID of pci card"` + RemainingCapacity int `json:"remainingcapacity,omitempty" doc:"Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type"` + MaxCapacity int `json:"maxcapacity,omitempty" doc:"Maximum vgpu can be created with this vgpu type on the given pci group"` + PCIVendorID string `json:"pcivendorid,omitempty" doc:"Device vendor ID of pci card"` + PCIDeviceName string `json:"pcidevicename,omitempty" doc:"Device model name of pci card"` +} + +// Password represents an encrypted password +// +// TODO: method to decrypt it, https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=34014652 +type Password struct { + EncryptedPassword string `json:"encryptedpassword"` +} + +// VirtualMachineUserData represents the base64 encoded user-data +type VirtualMachineUserData struct { + UserData string `json:"userdata" doc:"Base 64 encoded VM user data"` + VirtualMachineID *UUID `json:"virtualmachineid" doc:"the ID of the virtual machine"` +} + +// Decode decodes as a readable string the content of the user-data (base64 · gzip) +func (userdata VirtualMachineUserData) Decode() (string, error) { + data, err := base64.StdEncoding.DecodeString(userdata.UserData) + if err != nil { + return "", err + } + // 0x1f8b is the magic number for gzip + if len(data) < 2 || data[0] != 0x1f || data[1] != 0x8b { + return string(data), nil + } + gr, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return "", err + } + defer gr.Close() // nolint: errcheck + + str, err := ioutil.ReadAll(gr) + if err != nil { + return "", err + } + return string(str), nil +} + +// DeployVirtualMachine (Async) represents the machine creation +// +// Regarding the UserData field, the client is responsible to base64 (and probably gzip) it. Doing it within this library would make the integration with other tools, e.g. Terraform harder. +type DeployVirtualMachine struct { + AffinityGroupIDs []UUID `json:"affinitygroupids,omitempty" doc:"comma separated list of affinity groups id that are going to be applied to the virtual machine. Mutually exclusive with affinitygroupnames parameter"` + AffinityGroupNames []string `json:"affinitygroupnames,omitempty" doc:"comma separated list of affinity groups names that are going to be applied to the virtual machine.Mutually exclusive with affinitygroupids parameter"` + Details map[string]string `json:"details,omitempty" doc:"used to specify the custom parameters."` + DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskofferingid is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume. If the templateid parameter passed is from a Template object, the diskofferingid refers to a DATA Disk Volume created. If the templateid parameter passed is from an ISO object, the diskofferingid refers to a ROOT Disk Volume created."` + DisplayName string `json:"displayname,omitempty" doc:"an optional user generated name for the virtual machine"` + Group string `json:"group,omitempty" doc:"an optional group for the virtual machine"` + IP4 *bool `json:"ip4,omitempty" doc:"True to set an IPv4 to the default interface"` + IP6 *bool `json:"ip6,omitempty" doc:"True to set an IPv6 to the default interface"` + IP6Address net.IP `json:"ip6address,omitempty" doc:"the ipv6 address for default vm's network"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"the ip address for default vm's network"` + Keyboard string `json:"keyboard,omitempty" doc:"an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us"` + KeyPair string `json:"keypair,omitempty" doc:"name of the ssh key pair used to login to the virtual machine"` + Name string `json:"name,omitempty" doc:"host name for the virtual machine"` + NetworkIDs []UUID `json:"networkids,omitempty" doc:"list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter"` + RootDiskSize int64 `json:"rootdisksize,omitempty" doc:"Optional field to resize root disk on deploy. Value is in GB. Only applies to template-based deployments. Analogous to details[0].rootdisksize, which takes precedence over this parameter if both are provided"` + SecurityGroupIDs []UUID `json:"securitygroupids,omitempty" doc:"comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter"` + SecurityGroupNames []string `json:"securitygroupnames,omitempty" doc:"comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter"` + ServiceOfferingID *UUID `json:"serviceofferingid" doc:"the ID of the service offering for the virtual machine"` + Size int64 `json:"size,omitempty" doc:"the arbitrary size for the DATADISK volume. Mutually exclusive with diskofferingid"` + StartVM *bool `json:"startvm,omitempty" doc:"true if start vm after creating. Default value is true"` + TemplateID *UUID `json:"templateid" doc:"the ID of the template for the virtual machine"` + UserData string `json:"userdata,omitempty" doc:"an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding."` + ZoneID *UUID `json:"zoneid" doc:"availability zone for the virtual machine"` + _ bool `name:"deployVirtualMachine" description:"Creates and automatically starts a virtual machine based on a service offering, disk offering, and template."` +} + +func (req DeployVirtualMachine) onBeforeSend(_ url.Values) error { + // Either AffinityGroupIDs or AffinityGroupNames must be set + if len(req.AffinityGroupIDs) > 0 && len(req.AffinityGroupNames) > 0 { + return fmt.Errorf("either AffinityGroupIDs or AffinityGroupNames must be set") + } + + // Either SecurityGroupIDs or SecurityGroupNames must be set + if len(req.SecurityGroupIDs) > 0 && len(req.SecurityGroupNames) > 0 { + return fmt.Errorf("either SecurityGroupIDs or SecurityGroupNames must be set") + } + + return nil +} + +// Response returns the struct to unmarshal +func (DeployVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (DeployVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// StartVirtualMachine (Async) represents the creation of the virtual machine +type StartVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + RescueProfile string `json:"rescueprofile,omitempty" doc:"An optional rescue profile to use when booting"` + _ bool `name:"startVirtualMachine" description:"Starts a virtual machine."` +} + +// Response returns the struct to unmarshal +func (StartVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (StartVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// StopVirtualMachine (Async) represents the stopping of the virtual machine +type StopVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + Forced *bool `json:"forced,omitempty" doc:"Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend). The caller knows the VM is stopped."` + _ bool `name:"stopVirtualMachine" description:"Stops a virtual machine."` +} + +// Response returns the struct to unmarshal +func (StopVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (StopVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// RebootVirtualMachine (Async) represents the rebooting of the virtual machine +type RebootVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + _ bool `name:"rebootVirtualMachine" description:"Reboots a virtual machine."` +} + +// Response returns the struct to unmarshal +func (RebootVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (RebootVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// RestoreVirtualMachine (Async) represents the restoration of the virtual machine +type RestoreVirtualMachine struct { + VirtualMachineID *UUID `json:"virtualmachineid" doc:"Virtual Machine ID"` + TemplateID *UUID `json:"templateid,omitempty" doc:"an optional template Id to restore vm from the new template. This can be an ISO id in case of restore vm deployed using ISO"` + RootDiskSize int64 `json:"rootdisksize,omitempty" doc:"Optional field to resize root disk on restore. Value is in GB. Only applies to template-based deployments."` + _ bool `name:"restoreVirtualMachine" description:"Restore a VM to original template/ISO or new template/ISO"` +} + +// Response returns the struct to unmarshal +func (RestoreVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (RestoreVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// RecoverVirtualMachine represents the restoration of the virtual machine +type RecoverVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + _ bool `name:"recoverVirtualMachine" description:"Recovers a virtual machine."` +} + +// Response returns the struct to unmarshal +func (RecoverVirtualMachine) Response() interface{} { + return new(VirtualMachine) +} + +// DestroyVirtualMachine (Async) represents the destruction of the virtual machine +type DestroyVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + _ bool `name:"destroyVirtualMachine" description:"Destroys a virtual machine."` +} + +// Response returns the struct to unmarshal +func (DestroyVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (DestroyVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// UpdateVirtualMachine represents the update of the virtual machine +type UpdateVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + Details map[string]string `json:"details,omitempty" doc:"Details in key/value pairs."` + DisplayName string `json:"displayname,omitempty" doc:"user generated name"` + Group string `json:"group,omitempty" doc:"group of the virtual machine"` + Name string `json:"name,omitempty" doc:"new host name of the vm. The VM has to be stopped/started for this update to take affect"` + SecurityGroupIDs []UUID `json:"securitygroupids,omitempty" doc:"list of security group ids to be applied on the virtual machine."` + UserData string `json:"userdata,omitempty" doc:"an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding."` + _ bool `name:"updateVirtualMachine" description:"Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call."` +} + +// Response returns the struct to unmarshal +func (UpdateVirtualMachine) Response() interface{} { + return new(VirtualMachine) +} + +// ExpungeVirtualMachine represents the annihilation of a VM +type ExpungeVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + _ bool `name:"expungeVirtualMachine" description:"Expunge a virtual machine. Once expunged, it cannot be recoverd."` +} + +// Response returns the struct to unmarshal +func (ExpungeVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (ExpungeVirtualMachine) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +// ScaleVirtualMachine (Async) scales the virtual machine to a new service offering. +// +// ChangeServiceForVirtualMachine does the same thing but returns the +// new Virtual Machine which is more consistent with the rest of the API. +type ScaleVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + ServiceOfferingID *UUID `json:"serviceofferingid" doc:"the ID of the service offering for the virtual machine"` + Details map[string]string `json:"details,omitempty" doc:"name value pairs of custom parameters for cpu,memory and cpunumber. example details[i].name=value"` + _ bool `name:"scaleVirtualMachine" description:"Scales the virtual machine to a new service offering."` +} + +// Response returns the struct to unmarshal +func (ScaleVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (ScaleVirtualMachine) AsyncResponse() interface{} { + return new(BooleanResponse) +} + +// ChangeServiceForVirtualMachine changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect. +type ChangeServiceForVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + ServiceOfferingID *UUID `json:"serviceofferingid" doc:"the service offering ID to apply to the virtual machine"` + Details map[string]string `json:"details,omitempty" doc:"name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value"` + _ bool `name:"changeServiceForVirtualMachine" description:"Changes the service offering for a virtual machine. The virtual machine must be in a \"Stopped\" state for this command to take effect."` +} + +// Response returns the struct to unmarshal +func (ChangeServiceForVirtualMachine) Response() interface{} { + return new(VirtualMachine) +} + +// ResetPasswordForVirtualMachine resets the password for virtual machine. The virtual machine must be in a "Stopped" state... +type ResetPasswordForVirtualMachine struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + _ bool `name:"resetPasswordForVirtualMachine" description:"Resets the password for virtual machine. The virtual machine must be in a \"Stopped\" state and the template must already support this feature for this command to take effect."` +} + +// Response returns the struct to unmarshal +func (ResetPasswordForVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (ResetPasswordForVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// GetVMPassword asks for an encrypted password +type GetVMPassword struct { + ID *UUID `json:"id" doc:"The ID of the virtual machine"` + _ bool `name:"getVMPassword" description:"Returns an encrypted password for the VM"` +} + +// Response returns the struct to unmarshal +func (GetVMPassword) Response() interface{} { + return new(Password) +} + +//go:generate go run generate/main.go -interface=Listable ListVirtualMachines + +// ListVirtualMachines represents a search for a VM +type ListVirtualMachines struct { + AffinityGroupID *UUID `json:"affinitygroupid,omitempty" doc:"list vms by affinity group"` + Details []string `json:"details,omitempty" doc:"comma separated list of host details requested, value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, diskoff, iso, volume, min, affgrp]. If no parameter is passed in, the details will be defaulted to all"` + ForVirtualNetwork *bool `json:"forvirtualnetwork,omitempty" doc:"list by network type; true if need to list vms using Virtual Network, false otherwise"` + GroupID *UUID `json:"groupid,omitempty" doc:"the group ID"` + ID *UUID `json:"id,omitempty" doc:"the ID of the virtual machine"` + IDs []UUID `json:"ids,omitempty" doc:"the IDs of the virtual machines, mutually exclusive with id"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"an IP address to filter the result"` + IsoID *UUID `json:"isoid,omitempty" doc:"list vms by iso"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"name of the virtual machine"` + NetworkID *UUID `json:"networkid,omitempty" doc:"list by network id"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + ServiceOfferindID *UUID `json:"serviceofferingid,omitempty" doc:"list by the service offering"` + State string `json:"state,omitempty" doc:"state of the virtual machine"` + Tags []ResourceTag `json:"tags,omitempty" doc:"List resources by tags (key/value pairs)"` + TemplateID *UUID `json:"templateid,omitempty" doc:"list vms by template"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"the availability zone ID"` + _ bool `name:"listVirtualMachines" description:"List the virtual machines owned by the account."` +} + +// ListVirtualMachinesResponse represents a list of virtual machines +type ListVirtualMachinesResponse struct { + Count int `json:"count"` + VirtualMachine []VirtualMachine `json:"virtualmachine"` +} + +// AddNicToVirtualMachine (Async) adds a NIC to a VM +type AddNicToVirtualMachine struct { + NetworkID *UUID `json:"networkid" doc:"Network ID"` + VirtualMachineID *UUID `json:"virtualmachineid" doc:"Virtual Machine ID"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"Static IP address lease for the corresponding NIC and network which should be in the range defined in the network"` + _ bool `name:"addNicToVirtualMachine" description:"Adds VM to specified network by creating a NIC"` +} + +// Response returns the struct to unmarshal +func (AddNicToVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (AddNicToVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// RemoveNicFromVirtualMachine (Async) removes a NIC from a VM +type RemoveNicFromVirtualMachine struct { + NicID *UUID `json:"nicid" doc:"NIC ID"` + VirtualMachineID *UUID `json:"virtualmachineid" doc:"Virtual Machine ID"` + _ bool `name:"removeNicFromVirtualMachine" description:"Removes VM from specified network by deleting a NIC"` +} + +// Response returns the struct to unmarshal +func (RemoveNicFromVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (RemoveNicFromVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// UpdateDefaultNicForVirtualMachine (Async) adds a NIC to a VM +type UpdateDefaultNicForVirtualMachine struct { + NicID *UUID `json:"nicid" doc:"NIC ID"` + VirtualMachineID *UUID `json:"virtualmachineid" doc:"Virtual Machine ID"` + _ bool `name:"updateDefaultNicForVirtualMachine" description:"Changes the default NIC on a VM"` +} + +// Response returns the struct to unmarshal +func (UpdateDefaultNicForVirtualMachine) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (UpdateDefaultNicForVirtualMachine) AsyncResponse() interface{} { + return new(VirtualMachine) +} + +// GetVirtualMachineUserData returns the user-data of the given VM +type GetVirtualMachineUserData struct { + VirtualMachineID *UUID `json:"virtualmachineid" doc:"The ID of the virtual machine"` + _ bool `name:"getVirtualMachineUserData" description:"Returns user data associated with the VM"` +} + +// Response returns the struct to unmarshal +func (GetVirtualMachineUserData) Response() interface{} { + return new(VirtualMachineUserData) +} + +// UpdateVMNicIP updates the default IP address of a VM Nic +type UpdateVMNicIP struct { + _ bool `name:"updateVmNicIp" description:"Update the default Ip of a VM Nic"` + IPAddress net.IP `json:"ipaddress,omitempty" doc:"Static IP address lease for the corresponding NIC and network which should be in the range defined in the network. If absent, the call removes the lease associated with the nic."` + NicID *UUID `json:"nicid" doc:"the ID of the nic."` +} + +// Response returns the struct to unmarshal +func (UpdateVMNicIP) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (UpdateVMNicIP) AsyncResponse() interface{} { + return new(VirtualMachine) +} diff --git a/vendor/github.com/exoscale/egoscale/virtualmachines_response.go b/vendor/github.com/exoscale/egoscale/virtualmachines_response.go new file mode 100644 index 000000000..9aafb01a3 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/virtualmachines_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListVirtualMachines) Response() interface{} { + return new(ListVirtualMachinesResponse) +} + +// ListRequest returns itself +func (ls *ListVirtualMachines) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListVirtualMachines) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListVirtualMachines) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListVirtualMachines) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListVirtualMachinesResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListVirtualMachinesResponse was expected, got %T", resp)) + return + } + + for i := range items.VirtualMachine { + if !callback(&items.VirtualMachine[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/volumes.go b/vendor/github.com/exoscale/egoscale/volumes.go new file mode 100644 index 000000000..f942890a4 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/volumes.go @@ -0,0 +1,113 @@ +package egoscale + +// Volume represents a volume linked to a VM +type Volume struct { + Account string `json:"account,omitempty" doc:"the account associated with the disk volume"` + Attached string `json:"attached,omitempty" doc:"the date the volume was attached to a VM instance"` + ChainInfo string `json:"chaininfo,omitempty" doc:"the chain info of the volume"` + ClusterID *UUID `json:"clusterid,omitempty" doc:"ID of the cluster"` + ClusterName string `json:"clustername,omitempty" doc:"name of the cluster"` + Created string `json:"created,omitempty" doc:"the date the disk volume was created"` + Destroyed bool `json:"destroyed,omitempty" doc:"the boolean state of whether the volume is destroyed or not"` + DeviceID int64 `json:"deviceid,omitempty" doc:"the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached."` + DiskBytesReadRate int64 `json:"diskBytesReadRate,omitempty" doc:"bytes read rate of the disk volume"` + DiskBytesWriteRate int64 `json:"diskBytesWriteRate,omitempty" doc:"bytes write rate of the disk volume"` + DiskIopsReadRate int64 `json:"diskIopsReadRate,omitempty" doc:"io requests read rate of the disk volume"` + DiskIopsWriteRate int64 `json:"diskIopsWriteRate,omitempty" doc:"io requests write rate of the disk volume"` + DiskOfferingDisplayText string `json:"diskofferingdisplaytext,omitempty" doc:"the display text of the disk offering"` + DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"ID of the disk offering"` + DiskOfferingName string `json:"diskofferingname,omitempty" doc:"name of the disk offering"` + DisplayVolume bool `json:"displayvolume,omitempty" doc:"an optional field whether to the display the volume to the end user or not."` + Hypervisor string `json:"hypervisor,omitempty" doc:"Hypervisor the volume belongs to"` + ID *UUID `json:"id,omitempty" doc:"ID of the disk volume"` + IsExtractable *bool `json:"isextractable,omitempty" doc:"true if the volume is extractable, false otherwise"` + IsoDisplayText string `json:"isodisplaytext,omitempty" doc:"an alternate display text of the ISO attached to the virtual machine"` + IsoID *UUID `json:"isoid,omitempty" doc:"the ID of the ISO attached to the virtual machine"` + IsoName string `json:"isoname,omitempty" doc:"the name of the ISO attached to the virtual machine"` + MaxIops int64 `json:"maxiops,omitempty" doc:"max iops of the disk volume"` + MinIops int64 `json:"miniops,omitempty" doc:"min iops of the disk volume"` + Name string `json:"name,omitempty" doc:"name of the disk volume"` + Path string `json:"path,omitempty" doc:"the path of the volume"` + PodID *UUID `json:"podid,omitempty" doc:"ID of the pod"` + PodName string `json:"podname,omitempty" doc:"name of the pod"` + QuiesceVM bool `json:"quiescevm,omitempty" doc:"need quiesce vm or not when taking snapshot"` + ServiceOfferingDisplayText string `json:"serviceofferingdisplaytext,omitempty" doc:"the display text of the service offering for root disk"` + ServiceOfferingID *UUID `json:"serviceofferingid,omitempty" doc:"ID of the service offering for root disk"` + ServiceOfferingName string `json:"serviceofferingname,omitempty" doc:"name of the service offering for root disk"` + Size uint64 `json:"size,omitempty" doc:"size of the disk volume"` + SnapshotID *UUID `json:"snapshotid,omitempty" doc:"ID of the snapshot from which this volume was created"` + State string `json:"state,omitempty" doc:"the state of the disk volume"` + Status string `json:"status,omitempty" doc:"the status of the volume"` + Storage string `json:"storage,omitempty" doc:"name of the primary storage hosting the disk volume"` + StorageID *UUID `json:"storageid,omitempty" doc:"id of the primary storage hosting the disk volume; returned to admin user only"` + StorageType string `json:"storagetype,omitempty" doc:"shared or local storage"` + Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with volume"` + TemplateDisplayText string `json:"templatedisplaytext,omitempty" doc:"an alternate display text of the template for the virtual machine"` + TemplateID *UUID `json:"templateid,omitempty" doc:"the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file."` // no *UUID because of the -1 thingy... + TemplateName string `json:"templatename,omitempty" doc:"the name of the template for the virtual machine"` + Type string `json:"type,omitempty" doc:"type of the disk volume (ROOT or DATADISK)"` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"id of the virtual machine"` + VMDisplayName string `json:"vmdisplayname,omitempty" doc:"display name of the virtual machine"` + VMName string `json:"vmname,omitempty" doc:"name of the virtual machine"` + VMState string `json:"vmstate,omitempty" doc:"state of the virtual machine"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"ID of the availability zone"` + ZoneName string `json:"zonename,omitempty" doc:"name of the availability zone"` +} + +// ResourceType returns the type of the resource +func (Volume) ResourceType() string { + return "Volume" +} + +// ListRequest builds the ListVolumes request +func (vol Volume) ListRequest() (ListCommand, error) { + req := &ListVolumes{ + Name: vol.Name, + Type: vol.Type, + VirtualMachineID: vol.VirtualMachineID, + ZoneID: vol.ZoneID, + } + + return req, nil +} + +// ResizeVolume (Async) resizes a volume +type ResizeVolume struct { + ID *UUID `json:"id" doc:"the ID of the disk volume"` + DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"new disk offering id"` + Size int64 `json:"size,omitempty" doc:"New volume size in G (must be larger than current size since shrinking the disk is not supported)"` + _ bool `name:"resizeVolume" description:"Resizes a volume"` +} + +// Response returns the struct to unmarshal +func (ResizeVolume) Response() interface{} { + return new(AsyncJobResult) +} + +// AsyncResponse returns the struct to unmarshal the async job +func (ResizeVolume) AsyncResponse() interface{} { + return new(Volume) +} + +//go:generate go run generate/main.go -interface=Listable ListVolumes + +// ListVolumes represents a query listing volumes +type ListVolumes struct { + DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"List volumes by disk offering"` + ID *UUID `json:"id,omitempty" doc:"The ID of the disk volume"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"The name of the disk volume"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + Tags []ResourceTag `json:"tags,omitempty" doc:"List resources by tags (key/value pairs)"` + Type string `json:"type,omitempty" doc:"The type of disk volume"` + VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"The ID of the virtual machine"` + ZoneID *UUID `json:"zoneid,omitempty" doc:"The ID of the availability zone"` + _ bool `name:"listVolumes" description:"Lists all volumes."` +} + +// ListVolumesResponse represents a list of volumes +type ListVolumesResponse struct { + Count int `json:"count"` + Volume []Volume `json:"volume"` +} diff --git a/vendor/github.com/exoscale/egoscale/volumes_response.go b/vendor/github.com/exoscale/egoscale/volumes_response.go new file mode 100644 index 000000000..c7486bc1e --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/volumes_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListVolumes) Response() interface{} { + return new(ListVolumesResponse) +} + +// ListRequest returns itself +func (ls *ListVolumes) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListVolumes) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListVolumes) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListVolumes) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListVolumesResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListVolumesResponse was expected, got %T", resp)) + return + } + + for i := range items.Volume { + if !callback(&items.Volume[i], nil) { + break + } + } +} diff --git a/vendor/github.com/exoscale/egoscale/zones.go b/vendor/github.com/exoscale/egoscale/zones.go new file mode 100644 index 000000000..763246033 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/zones.go @@ -0,0 +1,62 @@ +package egoscale + +import ( + "net" +) + +// Zone represents a data center +// +// TODO: represent correctly the capacity field. +type Zone struct { + AllocationState string `json:"allocationstate,omitempty" doc:"the allocation state of the cluster"` + Description string `json:"description,omitempty" doc:"Zone description"` + DhcpProvider string `json:"dhcpprovider,omitempty" doc:"the dhcp Provider for the Zone"` + DisplayText string `json:"displaytext,omitempty" doc:"the display text of the zone"` + DNS1 net.IP `json:"dns1,omitempty" doc:"the first DNS for the Zone"` + DNS2 net.IP `json:"dns2,omitempty" doc:"the second DNS for the Zone"` + GuestCIDRAddress *CIDR `json:"guestcidraddress,omitempty" doc:"the guest CIDR address for the Zone"` + ID *UUID `json:"id,omitempty" doc:"Zone id"` + InternalDNS1 net.IP `json:"internaldns1,omitempty" doc:"the first internal DNS for the Zone"` + InternalDNS2 net.IP `json:"internaldns2,omitempty" doc:"the second internal DNS for the Zone"` + IP6DNS1 net.IP `json:"ip6dns1,omitempty" doc:"the first IPv6 DNS for the Zone"` + IP6DNS2 net.IP `json:"ip6dns2,omitempty" doc:"the second IPv6 DNS for the Zone"` + LocalStorageEnabled *bool `json:"localstorageenabled,omitempty" doc:"true if local storage offering enabled, false otherwise"` + Name string `json:"name,omitempty" doc:"Zone name"` + NetworkType string `json:"networktype,omitempty" doc:"the network type of the zone; can be Basic or Advanced"` + ResourceDetails map[string]string `json:"resourcedetails,omitempty" doc:"Meta data associated with the zone (key/value pairs)"` + SecurityGroupsEnabled *bool `json:"securitygroupsenabled,omitempty" doc:"true if security groups support is enabled, false otherwise"` + Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with zone."` + Vlan string `json:"vlan,omitempty" doc:"the vlan range of the zone"` + ZoneToken string `json:"zonetoken,omitempty" doc:"Zone Token"` +} + +// ListRequest builds the ListZones request +func (zone Zone) ListRequest() (ListCommand, error) { + req := &ListZones{ + ID: zone.ID, + Name: zone.Name, + } + + return req, nil +} + +//go:generate go run generate/main.go -interface=Listable ListZones + +// ListZones represents a query for zones +type ListZones struct { + Available *bool `json:"available,omitempty" doc:"true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false."` + ID *UUID `json:"id,omitempty" doc:"the ID of the zone"` + Keyword string `json:"keyword,omitempty" doc:"List by keyword"` + Name string `json:"name,omitempty" doc:"the name of the zone"` + Page int `json:"page,omitempty"` + PageSize int `json:"pagesize,omitempty"` + ShowCapacities *bool `json:"showcapacities,omitempty" doc:"flag to display the capacity of the zones"` + Tags []ResourceTag `json:"tags,omitempty" doc:"List zones by resource tags (key/value pairs)"` + _ bool `name:"listZones" description:"Lists zones"` +} + +// ListZonesResponse represents a list of zones +type ListZonesResponse struct { + Count int `json:"count"` + Zone []Zone `json:"zone"` +} diff --git a/vendor/github.com/exoscale/egoscale/zones_response.go b/vendor/github.com/exoscale/egoscale/zones_response.go new file mode 100644 index 000000000..0fe7d06d7 --- /dev/null +++ b/vendor/github.com/exoscale/egoscale/zones_response.go @@ -0,0 +1,43 @@ +// code generated; DO NOT EDIT. + +package egoscale + +import "fmt" + +// Response returns the struct to unmarshal +func (ListZones) Response() interface{} { + return new(ListZonesResponse) +} + +// ListRequest returns itself +func (ls *ListZones) ListRequest() (ListCommand, error) { + if ls == nil { + return nil, fmt.Errorf("%T cannot be nil", ls) + } + return ls, nil +} + +// SetPage sets the current apge +func (ls *ListZones) SetPage(page int) { + ls.Page = page +} + +// SetPageSize sets the page size +func (ls *ListZones) SetPageSize(pageSize int) { + ls.PageSize = pageSize +} + +// Each triggers the callback for each, valid answer or any non 404 issue +func (ListZones) Each(resp interface{}, callback IterateItemFunc) { + items, ok := resp.(*ListZonesResponse) + if !ok { + callback(nil, fmt.Errorf("wrong type, ListZonesResponse was expected, got %T", resp)) + return + } + + for i := range items.Zone { + if !callback(&items.Zone[i], nil) { + break + } + } +} diff --git a/vendor/github.com/gofrs/uuid/.gitignore b/vendor/github.com/gofrs/uuid/.gitignore new file mode 100644 index 000000000..666dbbb5b --- /dev/null +++ b/vendor/github.com/gofrs/uuid/.gitignore @@ -0,0 +1,15 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# binary bundle generated by go-fuzz +uuid-fuzz.zip diff --git a/vendor/github.com/gofrs/uuid/.travis.yml b/vendor/github.com/gofrs/uuid/.travis.yml new file mode 100644 index 000000000..ee1e4fa00 --- /dev/null +++ b/vendor/github.com/gofrs/uuid/.travis.yml @@ -0,0 +1,23 @@ +language: go +sudo: false +go: + - 1.7.x + - 1.8.x + - 1.9.x + - 1.10.x + - 1.11.x + - tip +matrix: + allow_failures: + - go: tip + fast_finish: true +env: + - GO111MODULE=on +before_install: + - go get golang.org/x/tools/cmd/cover +script: + - go test ./... -race -coverprofile=coverage.txt -covermode=atomic +after_success: + - bash <(curl -s https://codecov.io/bash) +notifications: + email: false diff --git a/vendor/github.com/gofrs/uuid/LICENSE b/vendor/github.com/gofrs/uuid/LICENSE new file mode 100644 index 000000000..926d54987 --- /dev/null +++ b/vendor/github.com/gofrs/uuid/LICENSE @@ -0,0 +1,20 @@ +Copyright (C) 2013-2018 by Maxim Bublis + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/gofrs/uuid/README.md b/vendor/github.com/gofrs/uuid/README.md new file mode 100644 index 000000000..efc3204fc --- /dev/null +++ b/vendor/github.com/gofrs/uuid/README.md @@ -0,0 +1,109 @@ +# UUID + +[![License](https://img.shields.io/github/license/gofrs/uuid.svg)](https://github.com/gofrs/uuid/blob/master/LICENSE) +[![Build Status](https://travis-ci.org/gofrs/uuid.svg?branch=master)](https://travis-ci.org/gofrs/uuid) +[![GoDoc](http://godoc.org/github.com/gofrs/uuid?status.svg)](http://godoc.org/github.com/gofrs/uuid) +[![Coverage Status](https://codecov.io/gh/gofrs/uuid/branch/master/graphs/badge.svg?branch=master)](https://codecov.io/gh/gofrs/uuid/) +[![Go Report Card](https://goreportcard.com/badge/github.com/gofrs/uuid)](https://goreportcard.com/report/github.com/gofrs/uuid) + +Package uuid provides a pure Go implementation of Universally Unique Identifiers +(UUID) variant as defined in RFC-4122. This package supports both the creation +and parsing of UUIDs in different formats. + +This package supports the following UUID versions: +* Version 1, based on timestamp and MAC address (RFC-4122) +* Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) +* Version 3, based on MD5 hashing of a named value (RFC-4122) +* Version 4, based on random numbers (RFC-4122) +* Version 5, based on SHA-1 hashing of a named value (RFC-4122) + +## Project History + +This project was originally forked from the +[github.com/satori/go.uuid](https://github.com/satori/go.uuid) repository after +it appeared to be no longer maintained, while exhibiting [critical +flaws](https://github.com/satori/go.uuid/issues/73). We have decided to take +over this project to ensure it receives regular maintenance for the benefit of +the larger Go community. + +We'd like to thank Maxim Bublis for his hard work on the original iteration of +the package. + +## License + +This source code of this package is released under the MIT License. Please see +the [LICENSE](https://github.com/gofrs/uuid/blob/master/LICENSE) for the full +content of the license. + +## Recommended Package Version + +We recommend using v2.0.0+ of this package, as versions prior to 2.0.0 were +created before our fork of the original package and have some known +deficiencies. + +## Installation + +It is recommended to use a package manager like `dep` that understands tagged +releases of a package, as well as semantic versioning. + +If you are unable to make use of a dependency manager with your project, you can +use the `go get` command to download it directly: + +```Shell +$ go get github.com/gofrs/uuid +``` + +## Requirements + +Due to subtests not being supported in older versions of Go, this package is +only regularly tested against Go 1.7+. This package may work perfectly fine with +Go 1.2+, but support for these older versions is not actively maintained. + +## Go 1.11 Modules + +As of v3.2.0, this repository no longer adopts Go modules, and v3.2.0 no longer has a `go.mod` file. As a result, v3.2.0 also drops support for the `github.com/gofrs/uuid/v3` import path. Only module-based consumers are impacted. With the v3.2.0 release, _all_ gofrs/uuid consumers should use the `github.com/gofrs/uuid` import path. + +An existing module-based consumer will continue to be able to build using the `github.com/gofrs/uuid/v3` import path using any valid consumer `go.mod` that worked prior to the publishing of v3.2.0, but any module-based consumer should start using the `github.com/gofrs/uuid` import path when possible and _must_ use the `github.com/gofrs/uuid` import path prior to upgrading to v3.2.0. + +Please refer to [Issue #61](https://github.com/gofrs/uuid/issues/61) and [Issue #66](https://github.com/gofrs/uuid/issues/66) for more details. + +## Usage + +Here is a quick overview of how to use this package. For more detailed +documentation, please see the [GoDoc Page](http://godoc.org/github.com/gofrs/uuid). + +```go +package main + +import ( + "log" + + "github.com/gofrs/uuid" +) + +// Create a Version 4 UUID, panicking on error. +// Use this form to initialize package-level variables. +var u1 = uuid.Must(uuid.NewV4()) + +func main() { + // Create a Version 4 UUID. + u2, err := uuid.NewV4() + if err != nil { + log.Fatalf("failed to generate UUID: %v", err) + } + log.Printf("generated Version 4 UUID %v", u2) + + // Parse a UUID from a string. + s := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + u3, err := uuid.FromString(s) + if err != nil { + log.Fatalf("failed to parse UUID %q: %v", s, err) + } + log.Printf("successfully parsed UUID %v", u3) +} +``` + +## References + +* [RFC-4122](https://tools.ietf.org/html/rfc4122) +* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) diff --git a/vendor/github.com/gofrs/uuid/codec.go b/vendor/github.com/gofrs/uuid/codec.go new file mode 100644 index 000000000..e3d8cfb4d --- /dev/null +++ b/vendor/github.com/gofrs/uuid/codec.go @@ -0,0 +1,212 @@ +// Copyright (C) 2013-2018 by Maxim Bublis +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +package uuid + +import ( + "bytes" + "encoding/hex" + "fmt" +) + +// FromBytes returns a UUID generated from the raw byte slice input. +// It will return an error if the slice isn't 16 bytes long. +func FromBytes(input []byte) (UUID, error) { + u := UUID{} + err := u.UnmarshalBinary(input) + return u, err +} + +// FromBytesOrNil returns a UUID generated from the raw byte slice input. +// Same behavior as FromBytes(), but returns uuid.Nil instead of an error. +func FromBytesOrNil(input []byte) UUID { + uuid, err := FromBytes(input) + if err != nil { + return Nil + } + return uuid +} + +// FromString returns a UUID parsed from the input string. +// Input is expected in a form accepted by UnmarshalText. +func FromString(input string) (UUID, error) { + u := UUID{} + err := u.UnmarshalText([]byte(input)) + return u, err +} + +// FromStringOrNil returns a UUID parsed from the input string. +// Same behavior as FromString(), but returns uuid.Nil instead of an error. +func FromStringOrNil(input string) UUID { + uuid, err := FromString(input) + if err != nil { + return Nil + } + return uuid +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The encoding is the same as returned by the String() method. +func (u UUID) MarshalText() ([]byte, error) { + return []byte(u.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// Following formats are supported: +// +// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", +// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", +// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" +// "6ba7b8109dad11d180b400c04fd430c8" +// "{6ba7b8109dad11d180b400c04fd430c8}", +// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8" +// +// ABNF for supported UUID text representation follows: +// +// URN := 'urn' +// UUID-NID := 'uuid' +// +// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | +// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | +// 'A' | 'B' | 'C' | 'D' | 'E' | 'F' +// +// hexoct := hexdig hexdig +// 2hexoct := hexoct hexoct +// 4hexoct := 2hexoct 2hexoct +// 6hexoct := 4hexoct 2hexoct +// 12hexoct := 6hexoct 6hexoct +// +// hashlike := 12hexoct +// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct +// +// plain := canonical | hashlike +// uuid := canonical | hashlike | braced | urn +// +// braced := '{' plain '}' | '{' hashlike '}' +// urn := URN ':' UUID-NID ':' plain +// +func (u *UUID) UnmarshalText(text []byte) error { + switch len(text) { + case 32: + return u.decodeHashLike(text) + case 34, 38: + return u.decodeBraced(text) + case 36: + return u.decodeCanonical(text) + case 41, 45: + return u.decodeURN(text) + default: + return fmt.Errorf("uuid: incorrect UUID length: %s", text) + } +} + +// decodeCanonical decodes UUID strings that are formatted as defined in RFC-4122 (section 3): +// "6ba7b810-9dad-11d1-80b4-00c04fd430c8". +func (u *UUID) decodeCanonical(t []byte) error { + if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' { + return fmt.Errorf("uuid: incorrect UUID format %s", t) + } + + src := t + dst := u[:] + + for i, byteGroup := range byteGroups { + if i > 0 { + src = src[1:] // skip dash + } + _, err := hex.Decode(dst[:byteGroup/2], src[:byteGroup]) + if err != nil { + return err + } + src = src[byteGroup:] + dst = dst[byteGroup/2:] + } + + return nil +} + +// decodeHashLike decodes UUID strings that are using the following format: +// "6ba7b8109dad11d180b400c04fd430c8". +func (u *UUID) decodeHashLike(t []byte) error { + src := t[:] + dst := u[:] + + _, err := hex.Decode(dst, src) + return err +} + +// decodeBraced decodes UUID strings that are using the following formats: +// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" +// "{6ba7b8109dad11d180b400c04fd430c8}". +func (u *UUID) decodeBraced(t []byte) error { + l := len(t) + + if t[0] != '{' || t[l-1] != '}' { + return fmt.Errorf("uuid: incorrect UUID format %s", t) + } + + return u.decodePlain(t[1 : l-1]) +} + +// decodeURN decodes UUID strings that are using the following formats: +// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" +// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8". +func (u *UUID) decodeURN(t []byte) error { + total := len(t) + + urnUUIDPrefix := t[:9] + + if !bytes.Equal(urnUUIDPrefix, urnPrefix) { + return fmt.Errorf("uuid: incorrect UUID format: %s", t) + } + + return u.decodePlain(t[9:total]) +} + +// decodePlain decodes UUID strings that are using the following formats: +// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format +// "6ba7b8109dad11d180b400c04fd430c8". +func (u *UUID) decodePlain(t []byte) error { + switch len(t) { + case 32: + return u.decodeHashLike(t) + case 36: + return u.decodeCanonical(t) + default: + return fmt.Errorf("uuid: incorrect UUID length: %s", t) + } +} + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (u UUID) MarshalBinary() ([]byte, error) { + return u.Bytes(), nil +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +// It will return an error if the slice isn't 16 bytes long. +func (u *UUID) UnmarshalBinary(data []byte) error { + if len(data) != Size { + return fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) + } + copy(u[:], data) + + return nil +} diff --git a/vendor/github.com/gofrs/uuid/fuzz.go b/vendor/github.com/gofrs/uuid/fuzz.go new file mode 100644 index 000000000..afaefbc8e --- /dev/null +++ b/vendor/github.com/gofrs/uuid/fuzz.go @@ -0,0 +1,47 @@ +// Copyright (c) 2018 Andrei Tudor Călin +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +// +build gofuzz + +package uuid + +// Fuzz implements a simple fuzz test for FromString / UnmarshalText. +// +// To run: +// +// $ go get github.com/dvyukov/go-fuzz/... +// $ cd $GOPATH/src/github.com/gofrs/uuid +// $ go-fuzz-build github.com/gofrs/uuid +// $ go-fuzz -bin=uuid-fuzz.zip -workdir=./testdata +// +// If you make significant changes to FromString / UnmarshalText and add +// new cases to fromStringTests (in codec_test.go), please run +// +// $ go test -seed_fuzz_corpus +// +// to seed the corpus with the new interesting inputs, then run the fuzzer. +func Fuzz(data []byte) int { + _, err := FromString(string(data)) + if err != nil { + return 0 + } + return 1 +} diff --git a/vendor/github.com/gofrs/uuid/generator.go b/vendor/github.com/gofrs/uuid/generator.go new file mode 100644 index 000000000..4257761f1 --- /dev/null +++ b/vendor/github.com/gofrs/uuid/generator.go @@ -0,0 +1,299 @@ +// Copyright (C) 2013-2018 by Maxim Bublis +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +package uuid + +import ( + "crypto/md5" + "crypto/rand" + "crypto/sha1" + "encoding/binary" + "fmt" + "hash" + "io" + "net" + "os" + "sync" + "time" +) + +// Difference in 100-nanosecond intervals between +// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). +const epochStart = 122192928000000000 + +type epochFunc func() time.Time + +// HWAddrFunc is the function type used to provide hardware (MAC) addresses. +type HWAddrFunc func() (net.HardwareAddr, error) + +// DefaultGenerator is the default UUID Generator used by this package. +var DefaultGenerator Generator = NewGen() + +var ( + posixUID = uint32(os.Getuid()) + posixGID = uint32(os.Getgid()) +) + +// NewV1 returns a UUID based on the current timestamp and MAC address. +func NewV1() (UUID, error) { + return DefaultGenerator.NewV1() +} + +// NewV2 returns a DCE Security UUID based on the POSIX UID/GID. +func NewV2(domain byte) (UUID, error) { + return DefaultGenerator.NewV2(domain) +} + +// NewV3 returns a UUID based on the MD5 hash of the namespace UUID and name. +func NewV3(ns UUID, name string) UUID { + return DefaultGenerator.NewV3(ns, name) +} + +// NewV4 returns a randomly generated UUID. +func NewV4() (UUID, error) { + return DefaultGenerator.NewV4() +} + +// NewV5 returns a UUID based on SHA-1 hash of the namespace UUID and name. +func NewV5(ns UUID, name string) UUID { + return DefaultGenerator.NewV5(ns, name) +} + +// Generator provides an interface for generating UUIDs. +type Generator interface { + NewV1() (UUID, error) + NewV2(domain byte) (UUID, error) + NewV3(ns UUID, name string) UUID + NewV4() (UUID, error) + NewV5(ns UUID, name string) UUID +} + +// Gen is a reference UUID generator based on the specifications laid out in +// RFC-4122 and DCE 1.1: Authentication and Security Services. This type +// satisfies the Generator interface as defined in this package. +// +// For consumers who are generating V1 UUIDs, but don't want to expose the MAC +// address of the node generating the UUIDs, the NewGenWithHWAF() function has been +// provided as a convenience. See the function's documentation for more info. +// +// The authors of this package do not feel that the majority of users will need +// to obfuscate their MAC address, and so we recommend using NewGen() to create +// a new generator. +type Gen struct { + clockSequenceOnce sync.Once + hardwareAddrOnce sync.Once + storageMutex sync.Mutex + + rand io.Reader + + epochFunc epochFunc + hwAddrFunc HWAddrFunc + lastTime uint64 + clockSequence uint16 + hardwareAddr [6]byte +} + +// interface check -- build will fail if *Gen doesn't satisfy Generator +var _ Generator = (*Gen)(nil) + +// NewGen returns a new instance of Gen with some default values set. Most +// people should use this. +func NewGen() *Gen { + return NewGenWithHWAF(defaultHWAddrFunc) +} + +// NewGenWithHWAF builds a new UUID generator with the HWAddrFunc provided. Most +// consumers should use NewGen() instead. +// +// This is used so that consumers can generate their own MAC addresses, for use +// in the generated UUIDs, if there is some concern about exposing the physical +// address of the machine generating the UUID. +// +// The Gen generator will only invoke the HWAddrFunc once, and cache that MAC +// address for all the future UUIDs generated by it. If you'd like to switch the +// MAC address being used, you'll need to create a new generator using this +// function. +func NewGenWithHWAF(hwaf HWAddrFunc) *Gen { + return &Gen{ + epochFunc: time.Now, + hwAddrFunc: hwaf, + rand: rand.Reader, + } +} + +// NewV1 returns a UUID based on the current timestamp and MAC address. +func (g *Gen) NewV1() (UUID, error) { + u := UUID{} + + timeNow, clockSeq, err := g.getClockSequence() + if err != nil { + return Nil, err + } + binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) + binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) + binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) + binary.BigEndian.PutUint16(u[8:], clockSeq) + + hardwareAddr, err := g.getHardwareAddr() + if err != nil { + return Nil, err + } + copy(u[10:], hardwareAddr) + + u.SetVersion(V1) + u.SetVariant(VariantRFC4122) + + return u, nil +} + +// NewV2 returns a DCE Security UUID based on the POSIX UID/GID. +func (g *Gen) NewV2(domain byte) (UUID, error) { + u, err := g.NewV1() + if err != nil { + return Nil, err + } + + switch domain { + case DomainPerson: + binary.BigEndian.PutUint32(u[:], posixUID) + case DomainGroup: + binary.BigEndian.PutUint32(u[:], posixGID) + } + + u[9] = domain + + u.SetVersion(V2) + u.SetVariant(VariantRFC4122) + + return u, nil +} + +// NewV3 returns a UUID based on the MD5 hash of the namespace UUID and name. +func (g *Gen) NewV3(ns UUID, name string) UUID { + u := newFromHash(md5.New(), ns, name) + u.SetVersion(V3) + u.SetVariant(VariantRFC4122) + + return u +} + +// NewV4 returns a randomly generated UUID. +func (g *Gen) NewV4() (UUID, error) { + u := UUID{} + if _, err := io.ReadFull(g.rand, u[:]); err != nil { + return Nil, err + } + u.SetVersion(V4) + u.SetVariant(VariantRFC4122) + + return u, nil +} + +// NewV5 returns a UUID based on SHA-1 hash of the namespace UUID and name. +func (g *Gen) NewV5(ns UUID, name string) UUID { + u := newFromHash(sha1.New(), ns, name) + u.SetVersion(V5) + u.SetVariant(VariantRFC4122) + + return u +} + +// Returns the epoch and clock sequence. +func (g *Gen) getClockSequence() (uint64, uint16, error) { + var err error + g.clockSequenceOnce.Do(func() { + buf := make([]byte, 2) + if _, err = io.ReadFull(g.rand, buf); err != nil { + return + } + g.clockSequence = binary.BigEndian.Uint16(buf) + }) + if err != nil { + return 0, 0, err + } + + g.storageMutex.Lock() + defer g.storageMutex.Unlock() + + timeNow := g.getEpoch() + // Clock didn't change since last UUID generation. + // Should increase clock sequence. + if timeNow <= g.lastTime { + g.clockSequence++ + } + g.lastTime = timeNow + + return timeNow, g.clockSequence, nil +} + +// Returns the hardware address. +func (g *Gen) getHardwareAddr() ([]byte, error) { + var err error + g.hardwareAddrOnce.Do(func() { + var hwAddr net.HardwareAddr + if hwAddr, err = g.hwAddrFunc(); err == nil { + copy(g.hardwareAddr[:], hwAddr) + return + } + + // Initialize hardwareAddr randomly in case + // of real network interfaces absence. + if _, err = io.ReadFull(g.rand, g.hardwareAddr[:]); err != nil { + return + } + // Set multicast bit as recommended by RFC-4122 + g.hardwareAddr[0] |= 0x01 + }) + if err != nil { + return []byte{}, err + } + return g.hardwareAddr[:], nil +} + +// Returns the difference between UUID epoch (October 15, 1582) +// and current time in 100-nanosecond intervals. +func (g *Gen) getEpoch() uint64 { + return epochStart + uint64(g.epochFunc().UnixNano()/100) +} + +// Returns the UUID based on the hashing of the namespace UUID and name. +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 +} + +// Returns the hardware address. +func defaultHWAddrFunc() (net.HardwareAddr, error) { + ifaces, err := net.Interfaces() + if err != nil { + return []byte{}, err + } + for _, iface := range ifaces { + if len(iface.HardwareAddr) >= 6 { + return iface.HardwareAddr, nil + } + } + return []byte{}, fmt.Errorf("uuid: no HW address found") +} diff --git a/vendor/github.com/gofrs/uuid/sql.go b/vendor/github.com/gofrs/uuid/sql.go new file mode 100644 index 000000000..6f254a4fd --- /dev/null +++ b/vendor/github.com/gofrs/uuid/sql.go @@ -0,0 +1,109 @@ +// Copyright (C) 2013-2018 by Maxim Bublis +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +package uuid + +import ( + "bytes" + "database/sql/driver" + "encoding/json" + "fmt" +) + +// Value implements the driver.Valuer interface. +func (u UUID) Value() (driver.Value, error) { + return u.String(), nil +} + +// Scan implements the sql.Scanner interface. +// A 16-byte slice will be handled by UnmarshalBinary, while +// a longer byte slice or a string will be handled by UnmarshalText. +func (u *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case UUID: // support gorm convert from UUID to NullUUID + *u = src + return nil + + case []byte: + if len(src) == Size { + return u.UnmarshalBinary(src) + } + return u.UnmarshalText(src) + + case string: + return u.UnmarshalText([]byte(src)) + } + + return fmt.Errorf("uuid: cannot convert %T to UUID", src) +} + +// NullUUID can be used with the standard sql package to represent a +// UUID value that can be NULL in the database. +type NullUUID struct { + UUID UUID + Valid bool +} + +// Value implements the driver.Valuer interface. +func (u NullUUID) Value() (driver.Value, error) { + if !u.Valid { + return nil, nil + } + // Delegate to UUID Value function + return u.UUID.Value() +} + +// Scan implements the sql.Scanner interface. +func (u *NullUUID) Scan(src interface{}) error { + if src == nil { + u.UUID, u.Valid = Nil, false + return nil + } + + // Delegate to UUID Scan function + u.Valid = true + return u.UUID.Scan(src) +} + +// MarshalJSON marshals the NullUUID as null or the nested UUID +func (u NullUUID) MarshalJSON() ([]byte, error) { + if !u.Valid { + return json.Marshal(nil) + } + + return json.Marshal(u.UUID) +} + +// UnmarshalJSON unmarshals a NullUUID +func (u *NullUUID) UnmarshalJSON(b []byte) error { + if bytes.Equal(b, []byte("null")) { + u.UUID, u.Valid = Nil, false + return nil + } + + if err := json.Unmarshal(b, &u.UUID); err != nil { + return err + } + + u.Valid = true + + return nil +} diff --git a/vendor/github.com/gofrs/uuid/uuid.go b/vendor/github.com/gofrs/uuid/uuid.go new file mode 100644 index 000000000..29ef44059 --- /dev/null +++ b/vendor/github.com/gofrs/uuid/uuid.go @@ -0,0 +1,189 @@ +// Copyright (C) 2013-2018 by Maxim Bublis +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +// Package uuid provides implementations of the Universally Unique Identifier (UUID), as specified in RFC-4122 and DCE 1.1. +// +// RFC-4122[1] provides the specification for versions 1, 3, 4, and 5. +// +// DCE 1.1[2] provides the specification for version 2. +// +// [1] https://tools.ietf.org/html/rfc4122 +// [2] http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01 +package uuid + +import ( + "encoding/binary" + "encoding/hex" + "fmt" + "time" +) + +// Size of a UUID in bytes. +const Size = 16 + +// UUID is an array type to represent the value of a UUID, as defined in RFC-4122. +type UUID [Size]byte + +// UUID versions. +const ( + _ byte = iota + V1 // Version 1 (date-time and MAC address) + V2 // Version 2 (date-time and MAC address, DCE security version) + V3 // Version 3 (namespace name-based) + V4 // Version 4 (random) + V5 // Version 5 (namespace name-based) +) + +// UUID layout variants. +const ( + VariantNCS byte = iota + VariantRFC4122 + VariantMicrosoft + VariantFuture +) + +// UUID DCE domains. +const ( + DomainPerson = iota + DomainGroup + DomainOrg +) + +// Timestamp is the count of 100-nanosecond intervals since 00:00:00.00, +// 15 October 1582 within a V1 UUID. This type has no meaning for V2-V5 +// UUIDs since they don't have an embedded timestamp. +type Timestamp uint64 + +const _100nsPerSecond = 10000000 + +// Time returns the UTC time.Time representation of a Timestamp +func (t Timestamp) Time() (time.Time, error) { + secs := uint64(t) / _100nsPerSecond + nsecs := 100 * (uint64(t) % _100nsPerSecond) + return time.Unix(int64(secs)-(epochStart/_100nsPerSecond), int64(nsecs)), nil +} + +// TimestampFromV1 returns the Timestamp embedded within a V1 UUID. +// Returns an error if the UUID is any version other than 1. +func TimestampFromV1(u UUID) (Timestamp, error) { + if u.Version() != 1 { + err := fmt.Errorf("uuid: %s is version %d, not version 1", u, u.Version()) + return 0, err + } + low := binary.BigEndian.Uint32(u[0:4]) + mid := binary.BigEndian.Uint16(u[4:6]) + hi := binary.BigEndian.Uint16(u[6:8]) & 0xfff + return Timestamp(uint64(low) + (uint64(mid) << 32) + (uint64(hi) << 48)), nil +} + +// String parse helpers. +var ( + urnPrefix = []byte("urn:uuid:") + byteGroups = []int{8, 4, 4, 4, 12} +) + +// Nil is the nil UUID, as specified in RFC-4122, that has all 128 bits set to +// zero. +var Nil = UUID{} + +// Predefined namespace UUIDs. +var ( + NamespaceDNS = Must(FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) + NamespaceURL = Must(FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) + NamespaceOID = Must(FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) + NamespaceX500 = Must(FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) +) + +// Version returns the algorithm version used to generate the UUID. +func (u UUID) Version() byte { + return u[6] >> 4 +} + +// Variant returns the UUID layout variant. +func (u UUID) Variant() byte { + switch { + case (u[8] >> 7) == 0x00: + return VariantNCS + case (u[8] >> 6) == 0x02: + return VariantRFC4122 + case (u[8] >> 5) == 0x06: + return VariantMicrosoft + case (u[8] >> 5) == 0x07: + fallthrough + default: + return VariantFuture + } +} + +// Bytes returns a byte slice representation of the UUID. +func (u UUID) Bytes() []byte { + return u[:] +} + +// String returns a canonical RFC-4122 string representation of the UUID: +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. +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) +} + +// SetVersion sets the version bits. +func (u *UUID) SetVersion(v byte) { + u[6] = (u[6] & 0x0f) | (v << 4) +} + +// SetVariant sets the variant bits. +func (u *UUID) SetVariant(v byte) { + switch v { + case VariantNCS: + u[8] = (u[8]&(0xff>>1) | (0x00 << 7)) + case VariantRFC4122: + u[8] = (u[8]&(0xff>>2) | (0x02 << 6)) + case VariantMicrosoft: + u[8] = (u[8]&(0xff>>3) | (0x06 << 5)) + case VariantFuture: + fallthrough + default: + u[8] = (u[8]&(0xff>>3) | (0x07 << 5)) + } +} + +// Must is a helper that wraps a call to a function returning (UUID, error) +// and panics if the error is non-nil. It is intended for use in variable +// initializations such as +// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000")) +func Must(u UUID, err error) UUID { + if err != nil { + panic(err) + } + return u +} diff --git a/vendor/github.com/golang-collections/collections/LICENSE b/vendor/github.com/golang-collections/collections/LICENSE new file mode 100644 index 000000000..75a26aeb3 --- /dev/null +++ b/vendor/github.com/golang-collections/collections/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2012 Caleb Doxsey + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/golang-collections/collections/stack/stack.go b/vendor/github.com/golang-collections/collections/stack/stack.go new file mode 100644 index 000000000..04063dfab --- /dev/null +++ b/vendor/github.com/golang-collections/collections/stack/stack.go @@ -0,0 +1,44 @@ +package stack + +type ( + Stack struct { + top *node + length int + } + node struct { + value interface{} + prev *node + } +) +// Create a new stack +func New() *Stack { + return &Stack{nil,0} +} +// Return the number of items in the stack +func (this *Stack) Len() int { + return this.length +} +// View the top item on the stack +func (this *Stack) Peek() interface{} { + if this.length == 0 { + return nil + } + return this.top.value +} +// Pop the top item of the stack and return it +func (this *Stack) Pop() interface{} { + if this.length == 0 { + return nil + } + + n := this.top + this.top = n.prev + this.length-- + return n.value +} +// Push a value onto the top of the stack +func (this *Stack) Push(value interface{}) { + n := &node{value,this.top} + this.top = n + this.length++ +} \ No newline at end of file diff --git a/vendor/github.com/gophercloud/gophercloud/.travis.yml b/vendor/github.com/gophercloud/gophercloud/.travis.yml index 02728f496..9153a00fc 100644 --- a/vendor/github.com/gophercloud/gophercloud/.travis.yml +++ b/vendor/github.com/gophercloud/gophercloud/.travis.yml @@ -1,21 +1,25 @@ language: go sudo: false install: -- go get golang.org/x/crypto/ssh -- go get -v -tags 'fixtures acceptance' ./... -- go get github.com/wadey/gocovmerge -- go get github.com/mattn/goveralls -- go get golang.org/x/tools/cmd/goimports +- GO111MODULE=off go get golang.org/x/crypto/ssh +- GO111MODULE=off go get -v -tags 'fixtures acceptance' ./... +- GO111MODULE=off go get github.com/wadey/gocovmerge +- GO111MODULE=off go get github.com/mattn/goveralls +- GO111MODULE=off go get golang.org/x/tools/cmd/goimports go: - "1.10" +- "1.11" +- "1.12" - "tip" env: global: - secure: "xSQsAG5wlL9emjbCdxzz/hYQsSpJ/bABO1kkbwMSISVcJ3Nk0u4ywF+LS4bgeOnwPfmFvNTOqVDu3RwEvMeWXSI76t1piCPcObutb2faKLVD/hLoAS76gYX+Z8yGWGHrSB7Do5vTPj1ERe2UljdrnsSeOXzoDwFxYRaZLX4bBOB4AyoGvRniil5QXPATiA1tsWX1VMicj8a4F8X+xeESzjt1Q5Iy31e7vkptu71bhvXCaoo5QhYwT+pLR9dN0S1b7Ro0KVvkRefmr1lUOSYd2e74h6Lc34tC1h3uYZCS4h47t7v5cOXvMNxinEj2C51RvbjvZI1RLVdkuAEJD1Iz4+Ote46nXbZ//6XRZMZz/YxQ13l7ux1PFjgEB6HAapmF5Xd8PRsgeTU9LRJxpiTJ3P5QJ3leS1va8qnziM5kYipj/Rn+V8g2ad/rgkRox9LSiR9VYZD2Pe45YCb1mTKSl2aIJnV7nkOqsShY5LNB4JZSg7xIffA+9YVDktw8dJlATjZqt7WvJJ49g6A61mIUV4C15q2JPGKTkZzDiG81NtmS7hFa7k0yaE2ELgYocbcuyUcAahhxntYTC0i23nJmEHVNiZmBO3u7EgpWe4KGVfumU+lt12tIn5b3dZRBBUk3QakKKozSK1QPHGpk/AZGrhu7H6l8to6IICKWtDcyMPQ=" + - GO111MODULE=on before_script: - go vet ./... script: - ./script/coverage +- ./script/unittest - ./script/format after_success: - $HOME/gopath/bin/goveralls -service=travis-ci -coverprofile=cover.out diff --git a/vendor/github.com/gophercloud/gophercloud/.zuul.yaml b/vendor/github.com/gophercloud/gophercloud/.zuul.yaml index 92fd9d482..135e3b203 100644 --- a/vendor/github.com/gophercloud/gophercloud/.zuul.yaml +++ b/vendor/github.com/gophercloud/gophercloud/.zuul.yaml @@ -13,6 +13,31 @@ Run gophercloud acceptance test on master branch run: .zuul/playbooks/gophercloud-acceptance-test/run.yaml +- job: + name: gophercloud-acceptance-test-ironic + parent: golang-test + description: | + Run gophercloud ironic acceptance test on master branch + run: .zuul/playbooks/gophercloud-acceptance-test-ironic/run.yaml + +- job: + name: gophercloud-acceptance-test-stein + parent: gophercloud-acceptance-test + description: | + Run gophercloud acceptance test on stein branch + vars: + global_env: + OS_BRANCH: stable/stein + +- job: + name: gophercloud-acceptance-test-rocky + parent: gophercloud-acceptance-test + description: | + Run gophercloud acceptance test on rocky branch + vars: + global_env: + OS_BRANCH: stable/rocky + - job: name: gophercloud-acceptance-test-queens parent: gophercloud-acceptance-test @@ -65,6 +90,7 @@ jobs: - gophercloud-unittest - gophercloud-acceptance-test + - gophercloud-acceptance-test-ironic recheck-mitaka: jobs: - gophercloud-acceptance-test-mitaka @@ -80,7 +106,9 @@ recheck-queens: jobs: - gophercloud-acceptance-test-queens - periodic: + recheck-rocky: jobs: - - gophercloud-unittest - - gophercloud-acceptance-test + - gophercloud-acceptance-test-rocky + recheck-stein: + jobs: + - gophercloud-acceptance-test-stein diff --git a/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md b/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md index e69de29bb..964015c3c 100644 --- a/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md +++ b/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md @@ -0,0 +1,40 @@ +## 0.3.0 (Unreleaesd) + +## 0.2.0 (June 17, 2019) + +IMPROVEMENTS + +* Added `networking/v2/extensions/qos/rules.ListBandwidthLimitRules` [GH-1584](https://github.com/gophercloud/gophercloud/pull/1584) +* Added `networking/v2/extensions/qos/rules.GetBandwidthLimitRule` [GH-1584](https://github.com/gophercloud/gophercloud/pull/1584) +* Added `networking/v2/extensions/qos/rules.CreateBandwidthLimitRule` [GH-1584](https://github.com/gophercloud/gophercloud/pull/1584) +* Added `networking/v2/extensions/qos/rules.UpdateBandwidthLimitRule` [GH-1589](https://github.com/gophercloud/gophercloud/pull/1589) +* Added `networking/v2/extensions/qos/rules.DeleteBandwidthLimitRule` [GH-1590](https://github.com/gophercloud/gophercloud/pull/1590) +* Added `networking/v2/extensions/qos/policies.List` [GH-1591](https://github.com/gophercloud/gophercloud/pull/1591) +* Added `networking/v2/extensions/qos/policies.Get` [GH-1593](https://github.com/gophercloud/gophercloud/pull/1593) +* Added `networking/v2/extensions/qos/rules.ListDSCPMarkingRules` [GH-1594](https://github.com/gophercloud/gophercloud/pull/1594) +* Added `networking/v2/extensions/qos/policies.Create` [GH-1595](https://github.com/gophercloud/gophercloud/pull/1595) +* Added `compute/v2/extensions/diagnostics.Get` [GH-1592](https://github.com/gophercloud/gophercloud/pull/1592) +* Added `networking/v2/extensions/qos/policies.Update` [GH-1603](https://github.com/gophercloud/gophercloud/pull/1603) +* Added `networking/v2/extensions/qos/policies.Delete` [GH-1603](https://github.com/gophercloud/gophercloud/pull/1603) +* Added `networking/v2/extensions/qos/rules.CreateDSCPMarkingRule` [GH-1605](https://github.com/gophercloud/gophercloud/pull/1605) +* Added `networking/v2/extensions/qos/rules.UpdateDSCPMarkingRule` [GH-1605](https://github.com/gophercloud/gophercloud/pull/1605) +* Added `networking/v2/extensions/qos/rules.GetDSCPMarkingRule` [GH-1609](https://github.com/gophercloud/gophercloud/pull/1609) +* Added `networking/v2/extensions/qos/rules.DeleteDSCPMarkingRule` [GH-1609](https://github.com/gophercloud/gophercloud/pull/1609) +* Added `networking/v2/extensions/qos/rules.ListMinimumBandwidthRules` [GH-1615](https://github.com/gophercloud/gophercloud/pull/1615) +* Added `networking/v2/extensions/qos/rules.GetMinimumBandwidthRule` [GH-1615](https://github.com/gophercloud/gophercloud/pull/1615) +* Added `networking/v2/extensions/qos/rules.CreateMinimumBandwidthRule` [GH-1615](https://github.com/gophercloud/gophercloud/pull/1615) +* Added `Hostname` to `baremetalintrospection/v1/introspection.Data` [GH-1627](https://github.com/gophercloud/gophercloud/pull/1627) +* Added `networking/v2/extensions/qos/rules.UpdateMinimumBandwidthRule` [GH-1624](https://github.com/gophercloud/gophercloud/pull/1624) +* Added `networking/v2/extensions/qos/rules.DeleteMinimumBandwidthRule` [GH-1624](https://github.com/gophercloud/gophercloud/pull/1624) +* Added `networking/v2/extensions/qos/ruletypes.GetRuleType` [GH-1625](https://github.com/gophercloud/gophercloud/pull/1625) +* Added `Extra` to `baremetalintrospection/v1/introspection.Data` [GH-1611](https://github.com/gophercloud/gophercloud/pull/1611) +* Added `blockstorage/extensions/volumeactions.SetImageMetadata` [GH-1621](https://github.com/gophercloud/gophercloud/pull/1621) + +BUG FIXES + +* Updated `networking/v2/extensions/qos/rules.UpdateBandwidthLimitRule` to use return code 200 [GH-1606](https://github.com/gophercloud/gophercloud/pull/1606) +* Fixed bug in `compute/v2/extensions/schedulerhints.SchedulerHints.Query` where contents will now be marshalled to a string [GH-1620](https://github.com/gophercloud/gophercloud/pull/1620) + +## 0.1.0 (May 27, 2019) + +Initial tagged release. diff --git a/vendor/github.com/gophercloud/gophercloud/auth_options.go b/vendor/github.com/gophercloud/gophercloud/auth_options.go index f28c8d2ad..5ffa8d1e0 100644 --- a/vendor/github.com/gophercloud/gophercloud/auth_options.go +++ b/vendor/github.com/gophercloud/gophercloud/auth_options.go @@ -185,7 +185,6 @@ func (opts *AuthOptions) ToTokenV3CreateMap(scope map[string]interface{}) (map[s // Populate the request structure based on the provided arguments. Create and return an error // if insufficient or incompatible information is present. var req request - var userRequest userReq if opts.Password == "" { if opts.TokenID != "" { @@ -229,25 +228,44 @@ func (opts *AuthOptions) ToTokenV3CreateMap(scope map[string]interface{}) (map[s if opts.ApplicationCredentialSecret == "" { return nil, ErrAppCredMissingSecret{} } - // make sure that only one of DomainName or DomainID were provided - if opts.DomainID == "" && opts.DomainName == "" { - return nil, ErrDomainIDOrDomainName{} + + var userRequest *userReq + + if opts.UserID != "" { + // UserID could be used without the domain information + userRequest = &userReq{ + ID: &opts.UserID, + } } - req.Auth.Identity.Methods = []string{"application_credential"} - if opts.DomainID != "" { - userRequest = userReq{ + + if userRequest == nil && opts.Username == "" { + // Make sure that Username or UserID are provided + return nil, ErrUsernameOrUserID{} + } + + if userRequest == nil && opts.DomainID != "" { + userRequest = &userReq{ Name: &opts.Username, Domain: &domainReq{ID: &opts.DomainID}, } - } else if opts.DomainName != "" { - userRequest = userReq{ + } + + if userRequest == nil && opts.DomainName != "" { + userRequest = &userReq{ Name: &opts.Username, Domain: &domainReq{Name: &opts.DomainName}, } } + + // Make sure that DomainID or DomainName are provided among Username + if userRequest == nil { + return nil, ErrDomainIDOrDomainName{} + } + + req.Auth.Identity.Methods = []string{"application_credential"} req.Auth.Identity.ApplicationCredential = &applicationCredentialReq{ Name: &opts.ApplicationCredentialName, - User: &userRequest, + User: userRequest, Secret: &opts.ApplicationCredentialSecret, } } else { diff --git a/vendor/github.com/gophercloud/gophercloud/auth_result.go b/vendor/github.com/gophercloud/gophercloud/auth_result.go new file mode 100644 index 000000000..2e4699b97 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/auth_result.go @@ -0,0 +1,52 @@ +package gophercloud + +/* +AuthResult is the result from the request that was used to obtain a provider +client's Keystone token. It is returned from ProviderClient.GetAuthResult(). + +The following types satisfy this interface: + + github.com/gophercloud/gophercloud/openstack/identity/v2/tokens.CreateResult + github.com/gophercloud/gophercloud/openstack/identity/v3/tokens.CreateResult + +Usage example: + + import ( + "github.com/gophercloud/gophercloud" + tokens2 "github.com/gophercloud/gophercloud/openstack/identity/v2/tokens" + tokens3 "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens" + ) + + func GetAuthenticatedUserID(providerClient *gophercloud.ProviderClient) (string, error) { + r := providerClient.GetAuthResult() + if r == nil { + //ProviderClient did not use openstack.Authenticate(), e.g. because token + //was set manually with ProviderClient.SetToken() + return "", errors.New("no AuthResult available") + } + switch r := r.(type) { + case tokens2.CreateResult: + u, err := r.ExtractUser() + if err != nil { + return "", err + } + return u.ID, nil + case tokens3.CreateResult: + u, err := r.ExtractUser() + if err != nil { + return "", err + } + return u.ID, nil + default: + panic(fmt.Sprintf("got unexpected AuthResult type %t", r)) + } + } + +Both implementing types share a lot of methods by name, like ExtractUser() in +this example. But those methods cannot be part of the AuthResult interface +because the return types are different (in this case, type tokens2.User vs. +type tokens3.User). +*/ +type AuthResult interface { + ExtractTokenID() (string, error) +} diff --git a/vendor/github.com/gophercloud/gophercloud/doc.go b/vendor/github.com/gophercloud/gophercloud/doc.go index 30067aa35..953ca822a 100644 --- a/vendor/github.com/gophercloud/gophercloud/doc.go +++ b/vendor/github.com/gophercloud/gophercloud/doc.go @@ -9,20 +9,37 @@ Provider structs represent the cloud providers that offer and manage a collection of services. You will generally want to create one Provider client per OpenStack cloud. + It is now recommended to use the `clientconfig` package found at + https://github.com/gophercloud/utils/tree/master/openstack/clientconfig + for all authentication purposes. + + The below documentation is still relevant. clientconfig simply implements + the below and presents it in an easier and more flexible way. + Use your OpenStack credentials to create a Provider client. The IdentityEndpoint is typically refered to as "auth_url" or "OS_AUTH_URL" in information provided by the cloud operator. Additionally, the cloud may refer to TenantID or TenantName as project_id and project_name. Credentials are specified like so: - opts := gophercloud.AuthOptions{ - IdentityEndpoint: "https://openstack.example.com:5000/v2.0", - Username: "{username}", - Password: "{password}", - TenantID: "{tenant_id}", - } + opts := gophercloud.AuthOptions{ + IdentityEndpoint: "https://openstack.example.com:5000/v2.0", + Username: "{username}", + Password: "{password}", + TenantID: "{tenant_id}", + } - provider, err := openstack.AuthenticatedClient(opts) + provider, err := openstack.AuthenticatedClient(opts) + +You can authenticate with a token by doing: + + opts := gophercloud.AuthOptions{ + IdentityEndpoint: "https://openstack.example.com:5000/v2.0", + TokenID: "{token_id}", + TenantID: "{tenant_id}", + } + + provider, err := openstack.AuthenticatedClient(opts) You may also use the openstack.AuthOptionsFromEnv() helper function. This function reads in standard environment variables frequently found in an @@ -39,16 +56,16 @@ operations for a particular OpenStack service. Examples of services include: Compute, Object Storage, Block Storage. In order to define one, you need to pass in the parent provider, like so: - opts := gophercloud.EndpointOpts{Region: "RegionOne"} + opts := gophercloud.EndpointOpts{Region: "RegionOne"} - client := openstack.NewComputeV2(provider, opts) + client, err := openstack.NewComputeV2(provider, opts) Resources Resource structs are the domain models that services make use of in order to work with and represent the state of API resources: - server, err := servers.Get(client, "{serverId}").Extract() + server, err := servers.Get(client, "{serverId}").Extract() Intermediate Result structs are returned for API operations, which allow generic access to the HTTP headers, response body, and any errors associated @@ -56,11 +73,11 @@ with the network transaction. To turn a result into a usable resource struct, you must call the Extract method which is chained to the response, or an Extract function from an applicable extension: - result := servers.Get(client, "{serverId}") + result := servers.Get(client, "{serverId}") - // Attempt to extract the disk configuration from the OS-DCF disk config - // extension: - config, err := diskconfig.ExtractGet(result) + // Attempt to extract the disk configuration from the OS-DCF disk config + // extension: + config, err := diskconfig.ExtractGet(result) All requests that enumerate a collection return a Pager struct that is used to iterate through the results one page at a time. Use the EachPage method on that @@ -68,17 +85,17 @@ Pager to handle each successive Page in a closure, then use the appropriate extraction method from that request's package to interpret that Page as a slice of results: - err := servers.List(client, nil).EachPage(func (page pagination.Page) (bool, error) { - s, err := servers.ExtractServers(page) - if err != nil { - return false, err - } + err := servers.List(client, nil).EachPage(func (page pagination.Page) (bool, error) { + s, err := servers.ExtractServers(page) + if err != nil { + return false, err + } - // Handle the []servers.Server slice. + // Handle the []servers.Server slice. - // Return "false" or an error to prematurely stop fetching new pages. - return true, nil - }) + // Return "false" or an error to prematurely stop fetching new pages. + return true, nil + }) If you want to obtain the entire collection of pages without doing any intermediary processing on each page, you can use the AllPages method: diff --git a/vendor/github.com/gophercloud/gophercloud/errors.go b/vendor/github.com/gophercloud/gophercloud/errors.go index 4bf102468..0bcb3af7f 100644 --- a/vendor/github.com/gophercloud/gophercloud/errors.go +++ b/vendor/github.com/gophercloud/gophercloud/errors.go @@ -122,6 +122,11 @@ type ErrDefault408 struct { ErrUnexpectedResponseCode } +// ErrDefault409 is the default error type returned on a 409 HTTP response code. +type ErrDefault409 struct { + ErrUnexpectedResponseCode +} + // ErrDefault429 is the default error type returned on a 429 HTTP response code. type ErrDefault429 struct { ErrUnexpectedResponseCode @@ -211,6 +216,12 @@ type Err408er interface { Error408(ErrUnexpectedResponseCode) error } +// Err409er is the interface resource error types implement to override the error message +// from a 409 error. +type Err409er interface { + Error409(ErrUnexpectedResponseCode) error +} + // Err429er is the interface resource error types implement to override the error message // from a 429 error. type Err429er interface { diff --git a/vendor/github.com/gophercloud/gophercloud/go.mod b/vendor/github.com/gophercloud/gophercloud/go.mod new file mode 100644 index 000000000..d1ee3b472 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/go.mod @@ -0,0 +1,7 @@ +module github.com/gophercloud/gophercloud + +require ( + golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 + golang.org/x/sys v0.0.0-20190209173611-3b5209105503 // indirect + gopkg.in/yaml.v2 v2.2.2 +) diff --git a/vendor/github.com/gophercloud/gophercloud/go.sum b/vendor/github.com/gophercloud/gophercloud/go.sum new file mode 100644 index 000000000..33cb0be8a --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/go.sum @@ -0,0 +1,8 @@ +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/sys v0.0.0-20190209173611-3b5209105503 h1:5SvYFrOM3W8Mexn9/oA44Ji7vhXAZQ9hiP+1Q/DMrWg= +golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/auth_env.go b/vendor/github.com/gophercloud/gophercloud/openstack/auth_env.go index 33c9aec44..0e8d90ff8 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/auth_env.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/auth_env.go @@ -13,15 +13,19 @@ AuthOptionsFromEnv fills out an identity.AuthOptions structure with the settings found on the various OpenStack OS_* environment variables. The following variables provide sources of truth: OS_AUTH_URL, OS_USERNAME, -OS_PASSWORD, OS_TENANT_ID, and OS_TENANT_NAME. +OS_PASSWORD and OS_PROJECT_ID. Of these, OS_USERNAME, OS_PASSWORD, and OS_AUTH_URL must have settings, -or an error will result. OS_TENANT_ID, OS_TENANT_NAME, OS_PROJECT_ID, and -OS_PROJECT_NAME are optional. +or an error will result. OS_PROJECT_ID, is optional. -OS_TENANT_ID and OS_TENANT_NAME are mutually exclusive to OS_PROJECT_ID and -OS_PROJECT_NAME. If OS_PROJECT_ID and OS_PROJECT_NAME are set, they will -still be referred as "tenant" in Gophercloud. +OS_TENANT_ID and OS_TENANT_NAME are deprecated forms of OS_PROJECT_ID and +OS_PROJECT_NAME and the latter are expected against a v3 auth api. + +If OS_PROJECT_ID and OS_PROJECT_NAME are set, they will still be referred +as "tenant" in Gophercloud. + +If OS_PROJECT_NAME is set, it requires OS_PROJECT_ID to be set as well to +handle projects not on the default domain. To use this function, first set the OS_* environment variables (for example, by sourcing an `openrc` file), then: @@ -59,11 +63,14 @@ func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) { return nilOptions, err } - if username == "" && userID == "" { - err := gophercloud.ErrMissingAnyoneOfEnvironmentVariables{ - EnvironmentVariables: []string{"OS_USERNAME", "OS_USERID"}, + if userID == "" && username == "" { + // Empty username and userID could be ignored, when applicationCredentialID and applicationCredentialSecret are set + if applicationCredentialID == "" && applicationCredentialSecret == "" { + err := gophercloud.ErrMissingAnyoneOfEnvironmentVariables{ + EnvironmentVariables: []string{"OS_USERID", "OS_USERNAME"}, + } + return nilOptions, err } - return nilOptions, err } if password == "" && applicationCredentialID == "" && applicationCredentialName == "" { @@ -80,6 +87,26 @@ func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) { return nilOptions, err } + if domainID == "" && domainName == "" && tenantID == "" && tenantName != "" { + err := gophercloud.ErrMissingEnvironmentVariable{ + EnvironmentVariable: "OS_PROJECT_ID", + } + return nilOptions, err + } + + if applicationCredentialID == "" && applicationCredentialName != "" && applicationCredentialSecret != "" { + if userID == "" && username == "" { + return nilOptions, gophercloud.ErrMissingAnyoneOfEnvironmentVariables{ + EnvironmentVariables: []string{"OS_USERID", "OS_USERNAME"}, + } + } + if username != "" && domainID == "" && domainName == "" { + return nilOptions, gophercloud.ErrMissingAnyoneOfEnvironmentVariables{ + EnvironmentVariables: []string{"OS_DOMAIN_ID", "OS_DOMAIN_NAME"}, + } + } + } + ao := gophercloud.AuthOptions{ IdentityEndpoint: authURL, UserID: userID, diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/requests.go index d18bff555..fdf322d3e 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/requests.go @@ -267,3 +267,34 @@ func ForceDelete(client *gophercloud.ServiceClient, id string) (r ForceDeleteRes _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"os-force_delete": ""}, nil, nil) return } + +// ImageMetadataOptsBuilder allows extensions to add additional parameters to the +// ImageMetadataRequest request. +type ImageMetadataOptsBuilder interface { + ToImageMetadataMap() (map[string]interface{}, error) +} + +// ImageMetadataOpts contains options for setting image metadata to a volume. +type ImageMetadataOpts struct { + // The image metadata to add to the volume as a set of metadata key and value pairs. + Metadata map[string]string `json:"metadata"` +} + +// ToImageMetadataMap assembles a request body based on the contents of a +// ImageMetadataOpts. +func (opts ImageMetadataOpts) ToImageMetadataMap() (map[string]interface{}, error) { + return gophercloud.BuildRequestBody(opts, "os-set_image_metadata") +} + +// SetImageMetadata will set image metadata on a volume based on the values in ImageMetadataOptsBuilder. +func SetImageMetadata(client *gophercloud.ServiceClient, id string, opts ImageMetadataOptsBuilder) (r SetImageMetadataResult) { + b, err := opts.ToImageMetadataMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(actionURL(client, id), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/results.go index 5cadd360f..aacee4c53 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/results.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions/results.go @@ -29,6 +29,12 @@ type UploadImageResult struct { gophercloud.Result } +// SetImageMetadataResult contains the response body and error from an SetImageMetadata +// request. +type SetImageMetadataResult struct { + gophercloud.ErrResult +} + // ReserveResult contains the response body and error from a Reserve request. type ReserveResult struct { gophercloud.ErrResult diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes/requests.go index b7977cbc8..25f70b27c 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes/requests.go @@ -38,6 +38,8 @@ type CreateOpts struct { ImageID string `json:"imageRef,omitempty"` // The associated volume type VolumeType string `json:"volume_type,omitempty"` + // Multiattach denotes if the volume is multi-attach capable. + Multiattach bool `json:"multiattach,omitempty"` } // ToVolumeCreateMap assembles a request body based on the contents of a @@ -61,9 +63,37 @@ func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r Create return } +// DeleteOptsBuilder allows extensions to add additional parameters to the +// Delete request. +type DeleteOptsBuilder interface { + ToVolumeDeleteQuery() (string, error) +} + +// DeleteOpts contains options for deleting a Volume. This object is passed to +// the volumes.Delete function. +type DeleteOpts struct { + // Delete all snapshots of this volume as well. + Cascade bool `q:"cascade"` +} + +// ToLoadBalancerDeleteQuery formats a DeleteOpts into a query string. +func (opts DeleteOpts) ToVolumeDeleteQuery() (string, error) { + q, err := gophercloud.BuildQueryString(opts) + return q.String(), err +} + // Delete will delete the existing Volume with the provided ID. -func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) { - _, r.Err = client.Delete(deleteURL(client, id), nil) +func Delete(client *gophercloud.ServiceClient, id string, opts DeleteOptsBuilder) (r DeleteResult) { + url := deleteURL(client, id) + if opts != nil { + query, err := opts.ToVolumeDeleteQuery() + if err != nil { + r.Err = err + return + } + url += query + } + _, r.Err = client.Delete(url, nil) return } @@ -145,8 +175,8 @@ type UpdateOptsBuilder interface { // to the volumes.Update function. For more information about the parameters, see // the Volume object. type UpdateOpts struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` } diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes/results.go index 87f71262c..3a33b5864 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes/results.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes/results.go @@ -77,6 +77,8 @@ type Volume struct { ConsistencyGroupID string `json:"consistencygroup_id"` // Multiattach denotes if the volume is multi-attach capable. Multiattach bool `json:"multiattach"` + // Image metadata entries, only included for volumes that were created from an image, or from a snapshot of a volume originally created from an image. + VolumeImageMetadata map[string]string `json:"volume_image_metadata"` } // UnmarshalJSON another unmarshalling function diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/client.go b/vendor/github.com/gophercloud/gophercloud/openstack/client.go index 6d93af5b4..50f239711 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/client.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/client.go @@ -135,7 +135,7 @@ func v2auth(client *gophercloud.ProviderClient, endpoint string, options gopherc result := tokens2.Create(v2Client, v2Opts) - token, err := result.ExtractToken() + err = client.SetTokenAndAuthResult(result) if err != nil { return err } @@ -150,8 +150,9 @@ func v2auth(client *gophercloud.ProviderClient, endpoint string, options gopherc // with the token and reauth func zeroed out. combined with setting `AllowReauth` to `false`, // this should retry authentication only once tac := *client + tac.SetThrowaway(true) tac.ReauthFunc = nil - tac.TokenID = "" + tac.SetTokenAndAuthResult(nil) tao := options tao.AllowReauth = false client.ReauthFunc = func() error { @@ -159,11 +160,10 @@ func v2auth(client *gophercloud.ProviderClient, endpoint string, options gopherc if err != nil { return err } - client.TokenID = tac.TokenID + client.CopyTokenFrom(&tac) return nil } } - client.TokenID = token.ID client.EndpointLocator = func(opts gophercloud.EndpointOpts) (string, error) { return V2EndpointURL(catalog, opts) } @@ -189,7 +189,7 @@ func v3auth(client *gophercloud.ProviderClient, endpoint string, opts tokens3.Au result := tokens3.Create(v3Client, opts) - token, err := result.ExtractToken() + err = client.SetTokenAndAuthResult(result) if err != nil { return err } @@ -199,15 +199,14 @@ func v3auth(client *gophercloud.ProviderClient, endpoint string, opts tokens3.Au return err } - client.TokenID = token.ID - if opts.CanReauth() { // here we're creating a throw-away client (tac). it's a copy of the user's provider client, but // with the token and reauth func zeroed out. combined with setting `AllowReauth` to `false`, // this should retry authentication only once tac := *client + tac.SetThrowaway(true) tac.ReauthFunc = nil - tac.TokenID = "" + tac.SetTokenAndAuthResult(nil) var tao tokens3.AuthOptionsBuilder switch ot := opts.(type) { case *gophercloud.AuthOptions: @@ -226,7 +225,7 @@ func v3auth(client *gophercloud.ProviderClient, endpoint string, opts tokens3.Au if err != nil { return err } - client.TokenID = tac.TokenID + client.CopyTokenFrom(&tac) return nil } } @@ -305,6 +304,18 @@ func initClientOpts(client *gophercloud.ProviderClient, eo gophercloud.EndpointO return sc, nil } +// NewBareMetalV1 creates a ServiceClient that may be used with the v1 +// bare metal package. +func NewBareMetalV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "baremetal") +} + +// NewBareMetalIntrospectionV1 creates a ServiceClient that may be used with the v1 +// bare metal introspection package. +func NewBareMetalIntrospectionV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "baremetal-inspector") +} + // NewObjectStorageV1 creates a ServiceClient that may be used with the v1 // object storage package. func NewObjectStorageV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs/requests.go index 4e5e499e3..b72807770 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs/requests.go @@ -68,7 +68,7 @@ func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r Create return } _, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{ - OkCodes: []int{200}, + OkCodes: []int{200, 201}, }) return } diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go index 539019e90..753024a18 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go @@ -148,7 +148,7 @@ func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r Create return } -// Get retrieves details of a single flavor. Use ExtractFlavor to convert its +// Get retrieves details of a single flavor. Use Extract to convert its // result into a Flavor. func Get(client *gophercloud.ServiceClient, id string) (r GetResult) { _, r.Err = client.Get(getURL(client, id), &r.Body, nil) diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/microversions.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/microversions.go new file mode 100644 index 000000000..84ec9f31d --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/microversions.go @@ -0,0 +1,11 @@ +package servers + +// ExtractTags will extract the tags of a server. +// This requires the client to be set to microversion 2.26 or later. +func (r serverResult) ExtractTags() ([]string, error) { + var s struct { + Tags []string `json:"tags"` + } + err := r.ExtractInto(&s) + return s.Tags, err +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go index a6530f8d6..ee8e93b1d 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go @@ -183,12 +183,22 @@ type CreateOpts struct { // AccessIPv4 specifies an IPv4 address for the instance. AccessIPv4 string `json:"accessIPv4,omitempty"` - // AccessIPv6 pecifies an IPv6 address for the instance. + // AccessIPv6 specifies an IPv6 address for the instance. AccessIPv6 string `json:"accessIPv6,omitempty"` + // Min specifies Minimum number of servers to launch. + Min int `json:"min_count,omitempty"` + + // Max specifies Maximum number of servers to launch. + Max int `json:"max_count,omitempty"` + // ServiceClient will allow calls to be made to retrieve an image or // flavor ID by name. ServiceClient *gophercloud.ServiceClient `json:"-"` + + // Tags allows a server to be tagged with single-word metadata. + // Requires microversion 2.52 or later. + Tags []string `json:"tags,omitempty"` } // ToServerCreateMap assembles a request body based on the contents of a @@ -272,6 +282,14 @@ func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error) { b["flavorRef"] = flavorID } + if opts.Min != 0 { + b["min_count"] = opts.Min + } + + if opts.Max != 0 { + b["max_count"] = opts.Max + } + return map[string]interface{}{"server": b}, nil } diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go index 60f58c8ce..f21a58f10 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go @@ -85,7 +85,7 @@ type UpdateOpts struct { Name string `json:"name,omitempty"` // Description is the description of the tenant. - Description string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` // Enabled sets the tenant status to enabled or disabled. Enabled *bool `json:"enabled,omitempty"` diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go index b11326772..ee5da37f4 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go @@ -135,6 +135,21 @@ func (r CreateResult) ExtractToken() (*Token, error) { }, nil } +// ExtractTokenID implements the gophercloud.AuthResult interface. The returned +// string is the same as the ID field of the Token struct returned from +// ExtractToken(). +func (r CreateResult) ExtractTokenID() (string, error) { + var s struct { + Access struct { + Token struct { + ID string `json:"id"` + } `json:"token"` + } `json:"access"` + } + err := r.ExtractInto(&s) + return s.Access.Token.ID, err +} + // ExtractServiceCatalog returns the ServiceCatalog that was generated along // with the user's Token. func (r CreateResult) ExtractServiceCatalog() (*ServiceCatalog, error) { diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/requests.go index 2d20fa6f4..e4d766b23 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/requests.go @@ -134,9 +134,9 @@ func Get(c *gophercloud.ServiceClient, token string) (r GetResult) { OkCodes: []int{200, 203}, }) if resp != nil { - r.Err = err r.Header = resp.Header } + r.Err = err return } diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go index ebdca58f6..6f26c96bc 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go @@ -102,6 +102,13 @@ func (r commonResult) ExtractToken() (*Token, error) { return &s, err } +// ExtractTokenID implements the gophercloud.AuthResult interface. The returned +// string is the same as the ID field of the Token struct returned from +// ExtractToken(). +func (r CreateResult) ExtractTokenID() (string, error) { + return r.Header.Get("X-Subject-Token"), r.Err +} + // ExtractServiceCatalog returns the ServiceCatalog that was generated along // with the user's Token. func (r commonResult) ExtractServiceCatalog() (*ServiceCatalog, error) { diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/imageservice/v2/images/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/imageservice/v2/images/requests.go index 16290d395..4e487ea9e 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/imageservice/v2/images/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/imageservice/v2/images/requests.go @@ -321,6 +321,20 @@ func (r ReplaceImageTags) ToImagePatchMap() map[string]interface{} { } } +// ReplaceImageMinDisk represents an updated min_disk property request. +type ReplaceImageMinDisk struct { + NewMinDisk int +} + +// ToImagePatchMap assembles a request body based on ReplaceImageTags. +func (r ReplaceImageMinDisk) ToImagePatchMap() map[string]interface{} { + return map[string]interface{}{ + "op": "replace", + "path": "/min_disk", + "value": r.NewMinDisk, + } +} + // UpdateOp represents a valid update operation. type UpdateOp string diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/doc.go index bf5ec6807..a71a3ec88 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/doc.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/doc.go @@ -52,7 +52,7 @@ Example to Disassociate a Floating IP with a Port fipID := "2f245a7b-796b-4f26-9cf9-9e82d248fda7" updateOpts := floatingips.UpdateOpts{ - PortID: nil, + PortID: new(string), } fip, err := floatingips.Update(networkingClient, fipID, updateOpts).Extract() diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/requests.go index d82a1bc8e..0c0db64d8 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/requests.go @@ -5,6 +5,12 @@ import ( "github.com/gophercloud/gophercloud/pagination" ) +// ListOptsBuilder allows extensions to add additional parameters to the +// List request. +type ListOptsBuilder interface { + ToFloatingIPListQuery() (string, error) +} + // ListOpts allows the filtering and sorting of paginated collections through // the API. Filtering is achieved by passing in struct field values that map to // the floating IP attributes you want to see returned. SortKey allows you to @@ -12,6 +18,7 @@ import ( // either `asc' or `desc'. Marker and Limit are used for pagination. type ListOpts struct { ID string `q:"id"` + Description string `q:"description"` FloatingNetworkID string `q:"floating_network_id"` PortID string `q:"port_id"` FixedIP string `q:"fixed_ip_address"` @@ -24,18 +31,31 @@ type ListOpts struct { SortDir string `q:"sort_dir"` RouterID string `q:"router_id"` Status string `q:"status"` + Tags string `q:"tags"` + TagsAny string `q:"tags-any"` + NotTags string `q:"not-tags"` + NotTagsAny string `q:"not-tags-any"` +} + +// ToNetworkListQuery formats a ListOpts into a query string. +func (opts ListOpts) ToFloatingIPListQuery() (string, error) { + q, err := gophercloud.BuildQueryString(opts) + return q.String(), err } // List returns a Pager which allows you to iterate over a collection of // floating IP resources. It accepts a ListOpts struct, which allows you to // filter and sort the returned collection for greater efficiency. -func List(c *gophercloud.ServiceClient, opts ListOpts) pagination.Pager { - q, err := gophercloud.BuildQueryString(&opts) - if err != nil { - return pagination.Pager{Err: err} +func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager { + url := rootURL(c) + if opts != nil { + query, err := opts.ToFloatingIPListQuery() + if err != nil { + return pagination.Pager{Err: err} + } + url += query } - u := rootURL(c) + q.String() - return pagination.NewPager(c, u, func(r pagination.PageResult) pagination.Page { + return pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page { return FloatingIPPage{pagination.LinkedPageBase{PageResult: r}} }) } @@ -50,6 +70,7 @@ type CreateOptsBuilder interface { // resource. The only required fields are FloatingNetworkID and PortID which // refer to the external network and internal port respectively. type CreateOpts struct { + Description string `json:"description,omitempty"` FloatingNetworkID string `json:"floating_network_id" required:"true"` FloatingIP string `json:"floating_ip_address,omitempty"` PortID string `json:"port_id,omitempty"` @@ -116,13 +137,24 @@ type UpdateOptsBuilder interface { // linked to. To associate the floating IP with a new internal port, provide its // ID. To disassociate the floating IP from all ports, provide an empty string. type UpdateOpts struct { - PortID *string `json:"port_id"` + Description *string `json:"description,omitempty"` + PortID *string `json:"port_id,omitempty"` + FixedIP string `json:"fixed_ip_address,omitempty"` } // ToFloatingIPUpdateMap allows UpdateOpts to satisfy the UpdateOptsBuilder // interface func (opts UpdateOpts) ToFloatingIPUpdateMap() (map[string]interface{}, error) { - return gophercloud.BuildRequestBody(opts, "floatingip") + b, err := gophercloud.BuildRequestBody(opts, "floatingip") + if err != nil { + return nil, err + } + + if m := b["floatingip"].(map[string]interface{}); m["port_id"] == "" { + m["port_id"] = nil + } + + return b, nil } // Update allows floating IP resources to be updated. Currently, the only way to diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/results.go index 8b1a51764..a9709ccec 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/results.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/results.go @@ -15,6 +15,9 @@ type FloatingIP struct { // ID is the unique identifier for the floating IP instance. ID string `json:"id"` + // Description for the floating IP instance. + Description string `json:"description"` + // FloatingNetworkID is the UUID of the external network where the floating // IP is to be created. FloatingNetworkID string `json:"floating_network_id"` @@ -42,6 +45,9 @@ type FloatingIP struct { // RouterID is the ID of the router used for this floating IP. RouterID string `json:"router_id"` + + // Tags optionally set via extensions/attributestags + Tags []string `json:"tags"` } type commonResult struct { @@ -50,11 +56,13 @@ type commonResult struct { // Extract will extract a FloatingIP resource from a result. func (r commonResult) Extract() (*FloatingIP, error) { - var s struct { - FloatingIP *FloatingIP `json:"floatingip"` - } + var s FloatingIP err := r.ExtractInto(&s) - return s.FloatingIP, err + return &s, err +} + +func (r commonResult) ExtractInto(v interface{}) error { + return r.Result.ExtractIntoStructPtr(v, "floatingip") } // CreateResult represents the result of a create operation. Call its Extract @@ -117,3 +125,7 @@ func ExtractFloatingIPs(r pagination.Page) ([]FloatingIP, error) { err := (r.(FloatingIPPage)).ExtractInto(&s) return s.FloatingIPs, err } + +func ExtractFloatingIPsInto(r pagination.Page, v interface{}) error { + return r.(FloatingIPPage).Result.ExtractIntoSlicePtr(v, "floatingips") +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/doc.go index e768b71f8..9d1dd5a7e 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/doc.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/doc.go @@ -45,8 +45,9 @@ Example to Update a Network networkID := "484cda0e-106f-4f4b-bb3f-d413710bbe78" + name := "new_name" updateOpts := networks.UpdateOpts{ - Name: "new_name", + Name: &name, } network, err := networks.Update(networkClient, networkID, updateOpts).Extract() diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/requests.go index 1fbf62092..8006c4816 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/requests.go @@ -19,6 +19,7 @@ type ListOptsBuilder interface { type ListOpts struct { Status string `q:"status"` Name string `q:"name"` + Description string `q:"description"` AdminStateUp *bool `q:"admin_state_up"` TenantID string `q:"tenant_id"` ProjectID string `q:"project_id"` @@ -28,6 +29,10 @@ type ListOpts struct { Limit int `q:"limit"` SortKey string `q:"sort_key"` SortDir string `q:"sort_dir"` + Tags string `q:"tags"` + TagsAny string `q:"tags-any"` + NotTags string `q:"not-tags"` + NotTagsAny string `q:"not-tags-any"` } // ToNetworkListQuery formats a ListOpts into a query string. @@ -69,6 +74,7 @@ type CreateOptsBuilder interface { type CreateOpts struct { AdminStateUp *bool `json:"admin_state_up,omitempty"` Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` Shared *bool `json:"shared,omitempty"` TenantID string `json:"tenant_id,omitempty"` ProjectID string `json:"project_id,omitempty"` @@ -105,9 +111,10 @@ type UpdateOptsBuilder interface { // UpdateOpts represents options used to update a network. type UpdateOpts struct { - AdminStateUp *bool `json:"admin_state_up,omitempty"` - Name string `json:"name,omitempty"` - Shared *bool `json:"shared,omitempty"` + AdminStateUp *bool `json:"admin_state_up,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Shared *bool `json:"shared,omitempty"` } // ToNetworkUpdateMap builds a request body from UpdateOpts. diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/results.go index 62f4b3c3a..f03067415 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/results.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/networking/v2/networks/results.go @@ -52,6 +52,9 @@ type Network struct { // Human-readable name for the network. Might not be unique. Name string `json:"name"` + // Description for the network + Description string `json:"description"` + // The administrative state of network. If false (down), the network does not // forward packets. AdminStateUp bool `json:"admin_state_up"` @@ -76,6 +79,9 @@ type Network struct { // Availability zone hints groups network nodes that run services like DHCP, L3, FW, and others. // Used to make network resources highly available. AvailabilityZoneHints []string `json:"availability_zone_hints"` + + // Tags optionally set via extensions/attributestags + Tags []string `json:"tags"` } // NetworkPage is the page returned by a pager when traversing over a diff --git a/vendor/github.com/gophercloud/gophercloud/params.go b/vendor/github.com/gophercloud/gophercloud/params.go index 19b8cf7bf..b9986660c 100644 --- a/vendor/github.com/gophercloud/gophercloud/params.go +++ b/vendor/github.com/gophercloud/gophercloud/params.go @@ -120,6 +120,22 @@ func BuildRequestBody(opts interface{}, parent string) (map[string]interface{}, continue } + if v.Kind() == reflect.Slice || (v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Slice) { + sliceValue := v + if sliceValue.Kind() == reflect.Ptr { + sliceValue = sliceValue.Elem() + } + + for i := 0; i < sliceValue.Len(); i++ { + element := sliceValue.Index(i) + if element.Kind() == reflect.Struct || (element.Kind() == reflect.Ptr && element.Elem().Kind() == reflect.Struct) { + _, err := BuildRequestBody(element.Interface(), "") + if err != nil { + return nil, err + } + } + } + } if v.Kind() == reflect.Struct || (v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Struct) { if zero { //fmt.Printf("value before change: %+v\n", optsValue.Field(i)) diff --git a/vendor/github.com/gophercloud/gophercloud/provider_client.go b/vendor/github.com/gophercloud/gophercloud/provider_client.go index 95fa11a78..fce00462f 100644 --- a/vendor/github.com/gophercloud/gophercloud/provider_client.go +++ b/vendor/github.com/gophercloud/gophercloud/provider_client.go @@ -2,7 +2,9 @@ package gophercloud import ( "bytes" + "context" "encoding/json" + "errors" "io" "io/ioutil" "net/http" @@ -71,26 +73,44 @@ type ProviderClient struct { // authentication functions for different Identity service versions. ReauthFunc func() error + // Throwaway determines whether if this client is a throw-away client. It's a copy of user's provider client + // with the token and reauth func zeroed. Such client can be used to perform reauthorization. + Throwaway bool + + // Context is the context passed to the HTTP request. + Context context.Context + + // mut is a mutex for the client. It protects read and write access to client attributes such as getting + // and setting the TokenID. mut *sync.RWMutex + // reauthmut is a mutex for reauthentication it attempts to ensure that only one reauthentication + // attempt happens at one time. reauthmut *reauthlock + + authResult AuthResult } +// reauthlock represents a set of attributes used to help in the reauthentication process. type reauthlock struct { sync.RWMutex - reauthing bool + reauthing bool + reauthingErr error + done *sync.Cond } // AuthenticatedHeaders returns a map of HTTP headers that are common for all -// authenticated service requests. +// authenticated service requests. Blocks if Reauthenticate is in progress. func (client *ProviderClient) AuthenticatedHeaders() (m map[string]string) { + if client.IsThrowaway() { + return + } if client.reauthmut != nil { - client.reauthmut.RLock() - if client.reauthmut.reauthing { - client.reauthmut.RUnlock() - return + client.reauthmut.Lock() + for client.reauthmut.reauthing { + client.reauthmut.done.Wait() } - client.reauthmut.RUnlock() + client.reauthmut.Unlock() } t := client.Token() if t == "" { @@ -106,6 +126,20 @@ func (client *ProviderClient) UseTokenLock() { client.reauthmut = new(reauthlock) } +// GetAuthResult returns the result from the request that was used to obtain a +// provider client's Keystone token. +// +// The result is nil when authentication has not yet taken place, when the token +// was set manually with SetToken(), or when a ReauthFunc was used that does not +// record the AuthResult. +func (client *ProviderClient) GetAuthResult() AuthResult { + if client.mut != nil { + client.mut.RLock() + defer client.mut.RUnlock() + } + return client.authResult +} + // Token safely reads the value of the auth token from the ProviderClient. Applications should // call this method to access the token instead of the TokenID field func (client *ProviderClient) Token() string { @@ -117,33 +151,102 @@ func (client *ProviderClient) Token() string { } // SetToken safely sets the value of the auth token in the ProviderClient. Applications may -// use this method in a custom ReauthFunc +// use this method in a custom ReauthFunc. +// +// WARNING: This function is deprecated. Use SetTokenAndAuthResult() instead. func (client *ProviderClient) SetToken(t string) { if client.mut != nil { client.mut.Lock() defer client.mut.Unlock() } client.TokenID = t + client.authResult = nil } -//Reauthenticate calls client.ReauthFunc in a thread-safe way. If this is -//called because of a 401 response, the caller may pass the previous token. In -//this case, the reauthentication can be skipped if another thread has already -//reauthenticated in the meantime. If no previous token is known, an empty -//string should be passed instead to force unconditional reauthentication. +// SetTokenAndAuthResult safely sets the value of the auth token in the +// ProviderClient and also records the AuthResult that was returned from the +// token creation request. Applications may call this in a custom ReauthFunc. +func (client *ProviderClient) SetTokenAndAuthResult(r AuthResult) error { + tokenID := "" + var err error + if r != nil { + tokenID, err = r.ExtractTokenID() + if err != nil { + return err + } + } + + if client.mut != nil { + client.mut.Lock() + defer client.mut.Unlock() + } + client.TokenID = tokenID + client.authResult = r + return nil +} + +// CopyTokenFrom safely copies the token from another ProviderClient into the +// this one. +func (client *ProviderClient) CopyTokenFrom(other *ProviderClient) { + if client.mut != nil { + client.mut.Lock() + defer client.mut.Unlock() + } + if other.mut != nil && other.mut != client.mut { + other.mut.RLock() + defer other.mut.RUnlock() + } + client.TokenID = other.TokenID + client.authResult = other.authResult +} + +// IsThrowaway safely reads the value of the client Throwaway field. +func (client *ProviderClient) IsThrowaway() bool { + if client.reauthmut != nil { + client.reauthmut.RLock() + defer client.reauthmut.RUnlock() + } + return client.Throwaway +} + +// SetThrowaway safely sets the value of the client Throwaway field. +func (client *ProviderClient) SetThrowaway(v bool) { + if client.reauthmut != nil { + client.reauthmut.Lock() + defer client.reauthmut.Unlock() + } + client.Throwaway = v +} + +// Reauthenticate calls client.ReauthFunc in a thread-safe way. If this is +// called because of a 401 response, the caller may pass the previous token. In +// this case, the reauthentication can be skipped if another thread has already +// reauthenticated in the meantime. If no previous token is known, an empty +// string should be passed instead to force unconditional reauthentication. func (client *ProviderClient) Reauthenticate(previousToken string) (err error) { if client.ReauthFunc == nil { return nil } - if client.mut == nil { + if client.reauthmut == nil { return client.ReauthFunc() } - client.mut.Lock() - defer client.mut.Unlock() + + client.reauthmut.Lock() + if client.reauthmut.reauthing { + for !client.reauthmut.reauthing { + client.reauthmut.done.Wait() + } + err = client.reauthmut.reauthingErr + client.reauthmut.Unlock() + return err + } + client.reauthmut.Unlock() client.reauthmut.Lock() client.reauthmut.reauthing = true + client.reauthmut.done = sync.NewCond(client.reauthmut) + client.reauthmut.reauthingErr = nil client.reauthmut.Unlock() if previousToken == "" || client.TokenID == previousToken { @@ -152,6 +255,8 @@ func (client *ProviderClient) Reauthenticate(previousToken string) (err error) { client.reauthmut.Lock() client.reauthmut.reauthing = false + client.reauthmut.reauthingErr = err + client.reauthmut.done.Broadcast() client.reauthmut.Unlock() return } @@ -192,7 +297,7 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts) // io.ReadSeeker as-is. Default the content-type to application/json. if options.JSONBody != nil { if options.RawBody != nil { - panic("Please provide only one of JSONBody or RawBody to gophercloud.Request().") + return nil, errors.New("please provide only one of JSONBody or RawBody to gophercloud.Request()") } rendered, err := json.Marshal(options.JSONBody) @@ -213,6 +318,9 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts) if err != nil { return nil, err } + if client.Context != nil { + req = req.WithContext(client.Context) + } // Populate the request headers. Apply options.MoreHeaders last, to give the caller the chance to // modify or omit any header. @@ -251,13 +359,14 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts) } // Allow default OkCodes if none explicitly set - if options.OkCodes == nil { - options.OkCodes = defaultOkCodes(method) + okc := options.OkCodes + if okc == nil { + okc = defaultOkCodes(method) } // Validate the HTTP response status. var ok bool - for _, code := range options.OkCodes { + for _, code := range okc { if resp.StatusCode == code { ok = true break @@ -295,11 +404,7 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts) seeker.Seek(0, 0) } } - // make a new call to request with a nil reauth func in order to avoid infinite loop - reauthFunc := client.ReauthFunc - client.ReauthFunc = nil resp, err = client.Request(method, url, options) - client.ReauthFunc = reauthFunc if err != nil { switch err.(type) { case *ErrUnexpectedResponseCode: @@ -338,6 +443,11 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts) if error408er, ok := errType.(Err408er); ok { err = error408er.Error408(respErr) } + case http.StatusConflict: + err = ErrDefault409{respErr} + if error409er, ok := errType.(Err409er); ok { + err = error409er.Error409(respErr) + } case 429: err = ErrDefault429{respErr} if error429er, ok := errType.(Err429er); ok { diff --git a/vendor/github.com/gophercloud/gophercloud/results.go b/vendor/github.com/gophercloud/gophercloud/results.go index 30d3b1559..94a16bff0 100644 --- a/vendor/github.com/gophercloud/gophercloud/results.go +++ b/vendor/github.com/gophercloud/gophercloud/results.go @@ -90,38 +90,40 @@ func (r Result) extractIntoPtr(to interface{}, label string) error { if typeOfV.NumField() > 0 && typeOfV.Field(0).Anonymous { newSlice := reflect.MakeSlice(reflect.SliceOf(typeOfV), 0, 0) - for _, v := range m[label].([]interface{}) { - // For each iteration of the slice, we create a new struct. - // This is to work around a bug where elements of a slice - // are reused and not overwritten when the same copy of the - // struct is used: - // - // https://github.com/golang/go/issues/21092 - // https://github.com/golang/go/issues/24155 - // https://play.golang.org/p/NHo3ywlPZli - newType := reflect.New(typeOfV).Elem() + if mSlice, ok := m[label].([]interface{}); ok { + for _, v := range mSlice { + // For each iteration of the slice, we create a new struct. + // This is to work around a bug where elements of a slice + // are reused and not overwritten when the same copy of the + // struct is used: + // + // https://github.com/golang/go/issues/21092 + // https://github.com/golang/go/issues/24155 + // https://play.golang.org/p/NHo3ywlPZli + newType := reflect.New(typeOfV).Elem() - b, err := json.Marshal(v) - if err != nil { - return err - } - - // This is needed for structs with an UnmarshalJSON method. - // Technically this is just unmarshalling the response into - // a struct that is never used, but it's good enough to - // trigger the UnmarshalJSON method. - for i := 0; i < newType.NumField(); i++ { - s := newType.Field(i).Addr().Interface() - - // Unmarshal is used rather than NewDecoder to also work - // around the above-mentioned bug. - err = json.Unmarshal(b, s) + b, err := json.Marshal(v) if err != nil { return err } - } - newSlice = reflect.Append(newSlice, newType) + // This is needed for structs with an UnmarshalJSON method. + // Technically this is just unmarshalling the response into + // a struct that is never used, but it's good enough to + // trigger the UnmarshalJSON method. + for i := 0; i < newType.NumField(); i++ { + s := newType.Field(i).Addr().Interface() + + // Unmarshal is used rather than NewDecoder to also work + // around the above-mentioned bug. + err = json.Unmarshal(b, s) + if err != nil { + return err + } + } + + newSlice = reflect.Append(newSlice, newType) + } } // "to" should now be properly modeled to receive the diff --git a/vendor/github.com/gophercloud/gophercloud/service_client.go b/vendor/github.com/gophercloud/gophercloud/service_client.go index 2734510e1..f222f05a6 100644 --- a/vendor/github.com/gophercloud/gophercloud/service_client.go +++ b/vendor/github.com/gophercloud/gophercloud/service_client.go @@ -129,6 +129,10 @@ func (client *ServiceClient) setMicroversionHeader(opts *RequestOpts) { opts.MoreHeaders["X-OpenStack-Manila-API-Version"] = client.Microversion case "volume": opts.MoreHeaders["X-OpenStack-Volume-API-Version"] = client.Microversion + case "baremetal": + opts.MoreHeaders["X-OpenStack-Ironic-API-Version"] = client.Microversion + case "baremetal-introspection": + opts.MoreHeaders["X-OpenStack-Ironic-Inspector-API-Version"] = client.Microversion } if client.Type != "" { diff --git a/vendor/github.com/hashicorp/go-getter/README.md b/vendor/github.com/hashicorp/go-getter/README.md index 85884fad4..ba4df6f4b 100644 --- a/vendor/github.com/hashicorp/go-getter/README.md +++ b/vendor/github.com/hashicorp/go-getter/README.md @@ -280,6 +280,16 @@ None * `depth` - The Git clone depth. The provided number specifies the last `n` revisions to clone from the repository. + +The `git` getter accepts both URL-style SSH addresses like +`git::ssh://git@example.com/foo/bar`, and "scp-style" addresses like +`git::git@example.com/foo/bar`. In the latter case, omitting the `git::` +force prefix is allowed if the username prefix is exactly `git@`. + +The "scp-style" addresses _cannot_ be used in conjunction with the `ssh://` +scheme prefix, because in that case the colon is used to mark an optional +port number to connect on, rather than to delimit the path from the host. + ### Mercurial (`hg`) * `rev` - The Mercurial revision to checkout. diff --git a/vendor/github.com/hashicorp/go-getter/checksum.go b/vendor/github.com/hashicorp/go-getter/checksum.go index bea7ed13c..eeccfea9d 100644 --- a/vendor/github.com/hashicorp/go-getter/checksum.go +++ b/vendor/github.com/hashicorp/go-getter/checksum.go @@ -19,8 +19,8 @@ import ( urlhelper "github.com/hashicorp/go-getter/helper/url" ) -// fileChecksum helps verifying the checksum for a file. -type fileChecksum struct { +// FileChecksum helps verifying the checksum for a file. +type FileChecksum struct { Type string Hash hash.Hash Value []byte @@ -50,7 +50,7 @@ func (cerr *ChecksumError) Error() string { // checksum is a simple method to compute the checksum of a source file // and compare it to the given expected value. -func (c *fileChecksum) checksum(source string) error { +func (c *FileChecksum) checksum(source string) error { f, err := os.Open(source) if err != nil { return fmt.Errorf("Failed to open file for checksum: %s", err) @@ -74,7 +74,7 @@ func (c *fileChecksum) checksum(source string) error { return nil } -// extractChecksum will return a fileChecksum based on the 'checksum' +// extractChecksum will return a FileChecksum based on the 'checksum' // parameter of u. // ex: // http://hashicorp.com/terraform?checksum= @@ -93,7 +93,7 @@ func (c *fileChecksum) checksum(source string) error { // *file2 // // see parseChecksumLine for more detail on checksum file parsing -func (c *Client) extractChecksum(u *url.URL) (*fileChecksum, error) { +func (c *Client) extractChecksum(u *url.URL) (*FileChecksum, error) { q := u.Query() v := q.Get("checksum") @@ -115,14 +115,14 @@ func (c *Client) extractChecksum(u *url.URL) (*fileChecksum, error) { switch checksumType { case "file": - return c.checksumFromFile(checksumValue, u) + return c.ChecksumFromFile(checksumValue, u) default: return newChecksumFromType(checksumType, checksumValue, filepath.Base(u.EscapedPath())) } } -func newChecksum(checksumValue, filename string) (*fileChecksum, error) { - c := &fileChecksum{ +func newChecksum(checksumValue, filename string) (*FileChecksum, error) { + c := &FileChecksum{ Filename: filename, } var err error @@ -133,7 +133,7 @@ func newChecksum(checksumValue, filename string) (*fileChecksum, error) { return c, nil } -func newChecksumFromType(checksumType, checksumValue, filename string) (*fileChecksum, error) { +func newChecksumFromType(checksumType, checksumValue, filename string) (*FileChecksum, error) { c, err := newChecksum(checksumValue, filename) if err != nil { return nil, err @@ -157,7 +157,7 @@ func newChecksumFromType(checksumType, checksumValue, filename string) (*fileChe return c, nil } -func newChecksumFromValue(checksumValue, filename string) (*fileChecksum, error) { +func newChecksumFromValue(checksumValue, filename string) (*FileChecksum, error) { c, err := newChecksum(checksumValue, filename) if err != nil { return nil, err @@ -183,14 +183,14 @@ func newChecksumFromValue(checksumValue, filename string) (*fileChecksum, error) return c, nil } -// checksumsFromFile will return all the fileChecksums found in file +// ChecksumFromFile will return all the FileChecksums found in file // -// checksumsFromFile will try to guess the hashing algorithm based on content +// ChecksumFromFile will try to guess the hashing algorithm based on content // of checksum file // -// checksumsFromFile will only return checksums for files that match file +// ChecksumFromFile will only return checksums for files that match file // behind src -func (c *Client) checksumFromFile(checksumFile string, src *url.URL) (*fileChecksum, error) { +func (c *Client) ChecksumFromFile(checksumFile string, src *url.URL) (*FileChecksum, error) { checksumFileURL, err := urlhelper.Parse(checksumFile) if err != nil { return nil, err @@ -286,7 +286,7 @@ func (c *Client) checksumFromFile(checksumFile string, src *url.URL) (*fileCheck // of a line. // for BSD type sums parseChecksumLine guesses the hashing algorithm // by checking the length of the checksum. -func parseChecksumLine(line string) (*fileChecksum, error) { +func parseChecksumLine(line string) (*FileChecksum, error) { parts := strings.Fields(line) switch len(parts) { diff --git a/vendor/github.com/hashicorp/go-getter/decompress_zip.go b/vendor/github.com/hashicorp/go-getter/decompress_zip.go index b0e70cac3..0830f7914 100644 --- a/vendor/github.com/hashicorp/go-getter/decompress_zip.go +++ b/vendor/github.com/hashicorp/go-getter/decompress_zip.go @@ -9,7 +9,7 @@ import ( ) // ZipDecompressor is an implementation of Decompressor that can -// decompress tar.gzip files. +// decompress zip files. type ZipDecompressor struct{} func (d *ZipDecompressor) Decompress(dst, src string, dir bool) error { diff --git a/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go b/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go index a183a17df..19047eb19 100644 --- a/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go +++ b/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go @@ -35,7 +35,7 @@ func (d *BitBucketDetector) detectHTTP(src string) (string, bool, error) { var info struct { SCM string `json:"scm"` } - infoUrl := "https://api.bitbucket.org/1.0/repositories" + u.Path + infoUrl := "https://api.bitbucket.org/2.0/repositories" + u.Path resp, err := http.Get(infoUrl) if err != nil { return "", true, fmt.Errorf("error looking up BitBucket URL: %s", err) diff --git a/vendor/github.com/hashicorp/go-getter/get_git.go b/vendor/github.com/hashicorp/go-getter/get_git.go index 2ff00d20f..67e8b2f49 100644 --- a/vendor/github.com/hashicorp/go-getter/get_git.go +++ b/vendor/github.com/hashicorp/go-getter/get_git.go @@ -34,6 +34,15 @@ func (g *GitGetter) Get(dst string, u *url.URL) error { return fmt.Errorf("git must be available and on the PATH") } + // The port number must be parseable as an integer. If not, the user + // was probably trying to use a scp-style address, in which case the + // ssh:// prefix must be removed to indicate that. + if portStr := u.Port(); portStr != "" { + if _, err := strconv.ParseUint(portStr, 10, 16); err != nil { + return fmt.Errorf("invalid port number %q; if using the \"scp-like\" git address scheme where a colon introduces the path instead, remove the ssh:// portion and use just the git:: prefix", portStr) + } + } + // Extract some query parameters we use var ref, sshKey string var depth int @@ -90,26 +99,6 @@ func (g *GitGetter) Get(dst string, u *url.URL) error { } } - // For SSH-style URLs, if they use the SCP syntax of host:path, then - // the URL will be mangled. We detect that here and correct the path. - // Example: host:path/bar will turn into host/path/bar - if u.Scheme == "ssh" { - if idx := strings.Index(u.Host, ":"); idx > -1 { - // Copy the URL so we don't modify the input - var newU url.URL = *u - u = &newU - - // Path includes the part after the ':'. - u.Path = u.Host[idx+1:] + u.Path - if u.Path[0] != '/' { - u.Path = "/" + u.Path - } - - // Host trims up to the : - u.Host = u.Host[:idx] - } - } - // Clone or update the repository _, err := os.Stat(dst) if err != nil && !os.IsNotExist(err) { diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/action.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/action.go index a261891e2..7ac042297 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/action.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/action.go @@ -3,6 +3,7 @@ package hcloud import ( "context" "fmt" + "net/url" "time" "github.com/hetznercloud/hcloud-go/hcloud/schema" @@ -95,11 +96,24 @@ func (c *ActionClient) GetByID(ctx context.Context, id int) (*Action, *Response, // ActionListOpts specifies options for listing actions. type ActionListOpts struct { ListOpts + Status []ActionStatus + Sort []string +} + +func (l ActionListOpts) values() url.Values { + vals := l.ListOpts.values() + for _, status := range l.Status { + vals.Add("status", string(status)) + } + for _, sort := range l.Sort { + vals.Add("sort", sort) + } + return vals } // List returns a list of actions for a specific page. func (c *ActionClient) List(ctx context.Context, opts ActionListOpts) ([]*Action, *Response, error) { - path := "/actions?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/actions?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err @@ -170,7 +184,7 @@ func (c *ActionClient) WatchProgress(ctx context.Context, action *Action) (<-cha a, _, err := c.GetByID(ctx, action.ID) if err != nil { - errCh <- ctx.Err() + errCh <- err return } diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/client.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/client.go index 9a80d1713..01215cd69 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/client.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/client.go @@ -9,6 +9,7 @@ import ( "io/ioutil" "math" "net/http" + "net/http/httputil" "net/url" "strconv" "strings" @@ -55,6 +56,7 @@ type Client struct { applicationName string applicationVersion string userAgent string + debugWriter io.Writer Action ActionClient Datacenter DatacenterClient @@ -62,6 +64,7 @@ type Client struct { Image ImageClient ISO ISOClient Location LocationClient + Network NetworkClient Pricing PricingClient Server ServerClient ServerType ServerTypeClient @@ -111,6 +114,14 @@ func WithApplication(name, version string) ClientOption { } } +// WithDebugWriter configures a Client to print debug information to the given +// writer. To, for example, print debug information on stderr, set it to os.Stderr. +func WithDebugWriter(debugWriter io.Writer) ClientOption { + return func(client *Client) { + client.debugWriter = debugWriter + } +} + // NewClient creates a new client. func NewClient(options ...ClientOption) *Client { client := &Client{ @@ -132,6 +143,7 @@ func NewClient(options ...ClientOption) *Client { client.Image = ImageClient{client: client} client.ISO = ISOClient{client: client} client.Location = LocationClient{client: client} + client.Network = NetworkClient{client: client} client.Pricing = PricingClient{client: client} client.Server = ServerClient{client: client} client.ServerType = ServerTypeClient{client: client} @@ -167,7 +179,6 @@ func (c *Client) Do(r *http.Request, v interface{}) (*Response, error) { return nil, err } response := &Response{Response: resp} - body, err := ioutil.ReadAll(resp.Body) if err != nil { resp.Body.Close() @@ -176,6 +187,20 @@ func (c *Client) Do(r *http.Request, v interface{}) (*Response, error) { resp.Body.Close() resp.Body = ioutil.NopCloser(bytes.NewReader(body)) + if c.debugWriter != nil { + dumpReq, err := httputil.DumpRequest(r, true) + if err != nil { + return nil, err + } + fmt.Fprintf(c.debugWriter, "--- Request:\n%s\n\n", dumpReq) + + dumpResp, err := httputil.DumpResponse(resp, true) + if err != nil { + return nil, err + } + fmt.Fprintf(c.debugWriter, "--- Response:\n%s\n\n", dumpResp) + } + if err = response.readMeta(body); err != nil { return response, fmt.Errorf("hcloud: error reading response meta data: %s", err) } @@ -314,16 +339,16 @@ type ListOpts struct { LabelSelector string // Label selector for filtering by labels } -func valuesForListOpts(opts ListOpts) url.Values { +func (l ListOpts) values() url.Values { vals := url.Values{} - if opts.Page > 0 { - vals.Add("page", strconv.Itoa(opts.Page)) + if l.Page > 0 { + vals.Add("page", strconv.Itoa(l.Page)) } - if opts.PerPage > 0 { - vals.Add("per_page", strconv.Itoa(opts.PerPage)) + if l.PerPage > 0 { + vals.Add("per_page", strconv.Itoa(l.PerPage)) } - if len(opts.LabelSelector) > 0 { - vals.Add("label_selector", opts.LabelSelector) + if len(l.LabelSelector) > 0 { + vals.Add("label_selector", l.LabelSelector) } return vals } diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/datacenter.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/datacenter.go index b0717f942..94676214f 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/datacenter.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/datacenter.go @@ -49,22 +49,11 @@ func (c *DatacenterClient) GetByID(ctx context.Context, id int) (*Datacenter, *R // GetByName retrieves an datacenter by its name. If the datacenter does not exist, nil is returned. func (c *DatacenterClient) GetByName(ctx context.Context, name string) (*Datacenter, *Response, error) { - path := "/datacenters?name=" + url.QueryEscape(name) - req, err := c.client.NewRequest(ctx, "GET", path, nil) - if err != nil { - return nil, nil, err + datacenters, response, err := c.List(ctx, DatacenterListOpts{Name: name}) + if len(datacenters) == 0 { + return nil, response, err } - - var body schema.DatacenterListResponse - resp, err := c.client.Do(req, &body) - if err != nil { - return nil, nil, err - } - - if len(body.Datacenters) == 0 { - return nil, resp, nil - } - return DatacenterFromSchema(body.Datacenters[0]), resp, nil + return datacenters[0], response, err } // Get retrieves a datacenter by its ID if the input can be parsed as an integer, otherwise it @@ -79,11 +68,20 @@ func (c *DatacenterClient) Get(ctx context.Context, idOrName string) (*Datacente // DatacenterListOpts specifies options for listing datacenters. type DatacenterListOpts struct { ListOpts + Name string +} + +func (l DatacenterListOpts) values() url.Values { + vals := l.ListOpts.values() + if l.Name != "" { + vals.Add("name", l.Name) + } + return vals } // List returns a list of datacenters for a specific page. func (c *DatacenterClient) List(ctx context.Context, opts DatacenterListOpts) ([]*Datacenter, *Response, error) { - path := "/datacenters?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/datacenters?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/error.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/error.go index 2e9f3b9a8..9eeab771d 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/error.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/error.go @@ -20,6 +20,8 @@ const ( ErrorCodeUniquenessError ErrorCode = "uniqueness_error" // One or more fields must be unique ErrorCodeProtected ErrorCode = "protected" // The actions you are trying is protected ErrorCodeMaintenance ErrorCode = "maintenance" // Cannot perform operation due to maintenance + ErrorCodeConflict ErrorCode = "conflict" // The resource has changed during the request, please retry + ErrorCodeServerAlreadyAttached ErrorCode = "server_already_attached" // The server is already attached to the resource // Deprecated error codes diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/floating_ip.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/floating_ip.go index 7fe2c55d0..afeeca939 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/floating_ip.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/floating_ip.go @@ -7,6 +7,8 @@ import ( "errors" "fmt" "net" + "net/url" + "time" "github.com/hetznercloud/hcloud-go/hcloud/schema" ) @@ -15,6 +17,7 @@ import ( type FloatingIP struct { ID int Description string + Created time.Time IP net.IP Network *net.IPNet Type FloatingIPType @@ -74,9 +77,13 @@ type FloatingIPListOpts struct { ListOpts } +func (l FloatingIPListOpts) values() url.Values { + return l.ListOpts.values() +} + // List returns a list of Floating IPs for a specific page. func (c *FloatingIPClient) List(ctx context.Context, opts FloatingIPListOpts) ([]*FloatingIP, *Response, error) { - path := "/floating_ips?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/floating_ips?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/hcloud.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/hcloud.go index 47648590f..55ec98444 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/hcloud.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/hcloud.go @@ -2,4 +2,4 @@ package hcloud // Version is the library's version following Semantic Versioning. -const Version = "1.12.0" +const Version = "1.15.1" diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/image.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/image.go index 4ebe4c3f5..caa533fdd 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/image.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/image.go @@ -91,22 +91,11 @@ func (c *ImageClient) GetByID(ctx context.Context, id int) (*Image, *Response, e // GetByName retrieves an image by its name. If the image does not exist, nil is returned. func (c *ImageClient) GetByName(ctx context.Context, name string) (*Image, *Response, error) { - path := "/images?name=" + url.QueryEscape(name) - req, err := c.client.NewRequest(ctx, "GET", path, nil) - if err != nil { - return nil, nil, err + images, response, err := c.List(ctx, ImageListOpts{Name: name}) + if len(images) == 0 { + return nil, response, err } - - var body schema.ImageListResponse - resp, err := c.client.Do(req, &body) - if err != nil { - return nil, nil, err - } - - if len(body.Images) == 0 { - return nil, resp, nil - } - return ImageFromSchema(body.Images[0]), resp, nil + return images[0], response, err } // Get retrieves an image by its ID if the input can be parsed as an integer, otherwise it @@ -121,11 +110,36 @@ func (c *ImageClient) Get(ctx context.Context, idOrName string) (*Image, *Respon // ImageListOpts specifies options for listing images. type ImageListOpts struct { ListOpts + Type []ImageType + BoundTo *Server + Name string + Sort []string + Status []ImageStatus +} + +func (l ImageListOpts) values() url.Values { + vals := l.ListOpts.values() + for _, typ := range l.Type { + vals.Add("type", string(typ)) + } + if l.BoundTo != nil { + vals.Add("bound_to", strconv.Itoa(l.BoundTo.ID)) + } + if l.Name != "" { + vals.Add("name", l.Name) + } + for _, sort := range l.Sort { + vals.Add("sort", sort) + } + for _, status := range l.Status { + vals.Add("status", string(status)) + } + return vals } // List returns a list of images for a specific page. func (c *ImageClient) List(ctx context.Context, opts ImageListOpts) ([]*Image, *Response, error) { - path := "/images?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/images?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err @@ -145,7 +159,7 @@ func (c *ImageClient) List(ctx context.Context, opts ImageListOpts) ([]*Image, * // All returns all images. func (c *ImageClient) All(ctx context.Context) ([]*Image, error) { - return c.AllWithOpts(ctx, ImageListOpts{ListOpts{PerPage: 50}}) + return c.AllWithOpts(ctx, ImageListOpts{ListOpts: ListOpts{PerPage: 50}}) } // AllWithOpts returns all images for the given options. diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/iso.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/iso.go index 852e69841..de360f545 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/iso.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/iso.go @@ -60,22 +60,11 @@ func (c *ISOClient) GetByID(ctx context.Context, id int) (*ISO, *Response, error // GetByName retrieves an ISO by its name. func (c *ISOClient) GetByName(ctx context.Context, name string) (*ISO, *Response, error) { - path := "/isos?name=" + url.QueryEscape(name) - req, err := c.client.NewRequest(ctx, "GET", path, nil) - if err != nil { - return nil, nil, err + isos, response, err := c.List(ctx, ISOListOpts{Name: name}) + if len(isos) == 0 { + return nil, response, err } - - var body schema.ISOListResponse - resp, err := c.client.Do(req, &body) - if err != nil { - return nil, nil, err - } - - if len(body.ISOs) == 0 { - return nil, resp, nil - } - return ISOFromSchema(body.ISOs[0]), resp, nil + return isos[0], response, err } // Get retrieves an ISO by its ID if the input can be parsed as an integer, otherwise it retrieves an ISO by its name. @@ -89,11 +78,20 @@ func (c *ISOClient) Get(ctx context.Context, idOrName string) (*ISO, *Response, // ISOListOpts specifies options for listing isos. type ISOListOpts struct { ListOpts + Name string +} + +func (l ISOListOpts) values() url.Values { + vals := l.ListOpts.values() + if l.Name != "" { + vals.Add("name", l.Name) + } + return vals } // List returns a list of ISOs for a specific page. func (c *ISOClient) List(ctx context.Context, opts ISOListOpts) ([]*ISO, *Response, error) { - path := "/isos?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/isos?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/location.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/location.go index 5269b7e76..5efb4a8d1 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/location.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/location.go @@ -18,6 +18,7 @@ type Location struct { City string Latitude float64 Longitude float64 + NetworkZone NetworkZone } // LocationClient is a client for the location API. @@ -45,22 +46,11 @@ func (c *LocationClient) GetByID(ctx context.Context, id int) (*Location, *Respo // GetByName retrieves an location by its name. If the location does not exist, nil is returned. func (c *LocationClient) GetByName(ctx context.Context, name string) (*Location, *Response, error) { - path := "/locations?name=" + url.QueryEscape(name) - req, err := c.client.NewRequest(ctx, "GET", path, nil) - if err != nil { - return nil, nil, err + locations, response, err := c.List(ctx, LocationListOpts{Name: name}) + if len(locations) == 0 { + return nil, response, err } - - var body schema.LocationListResponse - resp, err := c.client.Do(req, &body) - if err != nil { - return nil, nil, err - } - - if len(body.Locations) == 0 { - return nil, resp, nil - } - return LocationFromSchema(body.Locations[0]), resp, nil + return locations[0], response, err } // Get retrieves a location by its ID if the input can be parsed as an integer, otherwise it @@ -75,11 +65,20 @@ func (c *LocationClient) Get(ctx context.Context, idOrName string) (*Location, * // LocationListOpts specifies options for listing location. type LocationListOpts struct { ListOpts + Name string +} + +func (l LocationListOpts) values() url.Values { + vals := l.ListOpts.values() + if l.Name != "" { + vals.Add("name", l.Name) + } + return vals } // List returns a list of locations for a specific page. func (c *LocationClient) List(ctx context.Context, opts LocationListOpts) ([]*Location, *Response, error) { - path := "/locations?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/locations?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/network.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/network.go new file mode 100644 index 000000000..1f703d5cb --- /dev/null +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/network.go @@ -0,0 +1,445 @@ +package hcloud + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "net" + "net/url" + "strconv" + "time" + + "github.com/hetznercloud/hcloud-go/hcloud/schema" +) + +// NetworkZone specifies a network zone. +type NetworkZone string + +// List of available Network Zones. +const ( + NetworkZoneEUCentral NetworkZone = "eu-central" +) + +// NetworkSubnetType specifies a type of a subnet. +type NetworkSubnetType string + +// List of available network subnet types. +const ( + NetworkSubnetTypeServer NetworkSubnetType = "server" +) + +// Network represents a network in the Hetzner Cloud. +type Network struct { + ID int + Name string + Created time.Time + IPRange *net.IPNet + Subnets []NetworkSubnet + Routes []NetworkRoute + Servers []*Server + Protection NetworkProtection + Labels map[string]string +} + +// NetworkSubnet represents a subnet of a network in the Hetzner Cloud. +type NetworkSubnet struct { + Type NetworkSubnetType + IPRange *net.IPNet + NetworkZone NetworkZone + Gateway net.IP +} + +// NetworkRoute represents a route of a network. +type NetworkRoute struct { + Destination *net.IPNet + Gateway net.IP +} + +// NetworkProtection represents the protection level of a network. +type NetworkProtection struct { + Delete bool +} + +// NetworkClient is a client for the network API. +type NetworkClient struct { + client *Client +} + +// GetByID retrieves a network by its ID. If the network does not exist, nil is returned. +func (c *NetworkClient) GetByID(ctx context.Context, id int) (*Network, *Response, error) { + req, err := c.client.NewRequest(ctx, "GET", fmt.Sprintf("/networks/%d", id), nil) + if err != nil { + return nil, nil, err + } + + var body schema.NetworkGetResponse + resp, err := c.client.Do(req, &body) + if err != nil { + if IsError(err, ErrorCodeNotFound) { + return nil, resp, nil + } + return nil, nil, err + } + return NetworkFromSchema(body.Network), resp, nil +} + +// GetByName retrieves a network by its name. If the network does not exist, nil is returned. +func (c *NetworkClient) GetByName(ctx context.Context, name string) (*Network, *Response, error) { + Networks, response, err := c.List(ctx, NetworkListOpts{Name: name}) + if len(Networks) == 0 { + return nil, response, err + } + return Networks[0], response, err +} + +// Get retrieves a network by its ID if the input can be parsed as an integer, otherwise it +// retrieves a network by its name. If the network does not exist, nil is returned. +func (c *NetworkClient) Get(ctx context.Context, idOrName string) (*Network, *Response, error) { + if id, err := strconv.Atoi(idOrName); err == nil { + return c.GetByID(ctx, int(id)) + } + return c.GetByName(ctx, idOrName) +} + +// NetworkListOpts specifies options for listing networks. +type NetworkListOpts struct { + ListOpts + Name string +} + +func (l NetworkListOpts) values() url.Values { + vals := l.ListOpts.values() + if l.Name != "" { + vals.Add("name", l.Name) + } + return vals +} + +// List returns a list of networks for a specific page. +func (c *NetworkClient) List(ctx context.Context, opts NetworkListOpts) ([]*Network, *Response, error) { + path := "/networks?" + opts.values().Encode() + req, err := c.client.NewRequest(ctx, "GET", path, nil) + if err != nil { + return nil, nil, err + } + + var body schema.NetworkListResponse + resp, err := c.client.Do(req, &body) + if err != nil { + return nil, nil, err + } + Networks := make([]*Network, 0, len(body.Networks)) + for _, s := range body.Networks { + Networks = append(Networks, NetworkFromSchema(s)) + } + return Networks, resp, nil +} + +// All returns all networks. +func (c *NetworkClient) All(ctx context.Context) ([]*Network, error) { + return c.AllWithOpts(ctx, NetworkListOpts{ListOpts: ListOpts{PerPage: 50}}) +} + +// AllWithOpts returns all networks for the given options. +func (c *NetworkClient) AllWithOpts(ctx context.Context, opts NetworkListOpts) ([]*Network, error) { + var allNetworks []*Network + + _, err := c.client.all(func(page int) (*Response, error) { + opts.Page = page + Networks, resp, err := c.List(ctx, opts) + if err != nil { + return resp, err + } + allNetworks = append(allNetworks, Networks...) + return resp, nil + }) + if err != nil { + return nil, err + } + + return allNetworks, nil +} + +// Delete deletes a network. +func (c *NetworkClient) Delete(ctx context.Context, network *Network) (*Response, error) { + req, err := c.client.NewRequest(ctx, "DELETE", fmt.Sprintf("/networks/%d", network.ID), nil) + if err != nil { + return nil, err + } + return c.client.Do(req, nil) +} + +// NetworkUpdateOpts specifies options for updating a network. +type NetworkUpdateOpts struct { + Name string + Labels map[string]string +} + +// Update updates a network. +func (c *NetworkClient) Update(ctx context.Context, network *Network, opts NetworkUpdateOpts) (*Network, *Response, error) { + reqBody := schema.NetworkUpdateRequest{ + Name: opts.Name, + } + if opts.Labels != nil { + reqBody.Labels = &opts.Labels + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + + path := fmt.Sprintf("/networks/%d", network.ID) + req, err := c.client.NewRequest(ctx, "PUT", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.NetworkUpdateResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return NetworkFromSchema(respBody.Network), resp, nil +} + +// NetworkCreateOpts specifies options for creating a new network. +type NetworkCreateOpts struct { + Name string + IPRange *net.IPNet + Subnets []NetworkSubnet + Routes []NetworkRoute + Labels map[string]string +} + +// Validate checks if options are valid. +func (o NetworkCreateOpts) Validate() error { + if o.Name == "" { + return errors.New("missing name") + } + if o.IPRange == nil || o.IPRange.String() == "" { + return errors.New("missing IP range") + } + return nil +} + +// Create creates a new network. +func (c *NetworkClient) Create(ctx context.Context, opts NetworkCreateOpts) (*Network, *Response, error) { + if err := opts.Validate(); err != nil { + return nil, nil, err + } + reqBody := schema.NetworkCreateRequest{ + Name: opts.Name, + IPRange: opts.IPRange.String(), + } + for _, subnet := range opts.Subnets { + reqBody.Subnets = append(reqBody.Subnets, schema.NetworkSubnet{ + Type: string(subnet.Type), + IPRange: subnet.IPRange.String(), + NetworkZone: string(subnet.NetworkZone), + }) + } + for _, route := range opts.Routes { + reqBody.Routes = append(reqBody.Routes, schema.NetworkRoute{ + Destination: route.Destination.String(), + Gateway: route.Gateway.String(), + }) + } + if opts.Labels != nil { + reqBody.Labels = &opts.Labels + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + req, err := c.client.NewRequest(ctx, "POST", "/networks", bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.NetworkCreateResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return NetworkFromSchema(respBody.Network), resp, nil +} + +// NetworkChangeIPRangeOpts specifies options for changing the IP range of a network. +type NetworkChangeIPRangeOpts struct { + IPRange *net.IPNet +} + +// ChangeIPRange changes the IP range of a network. +func (c *NetworkClient) ChangeIPRange(ctx context.Context, network *Network, opts NetworkChangeIPRangeOpts) (*Action, *Response, error) { + reqBody := schema.NetworkActionChangeIPRangeRequest{ + IPRange: opts.IPRange.String(), + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + + path := fmt.Sprintf("/networks/%d/actions/change_ip_range", network.ID) + req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.NetworkActionChangeIPRangeResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return ActionFromSchema(respBody.Action), resp, nil +} + +// NetworkAddSubnetOpts specifies options for adding a subnet to a network. +type NetworkAddSubnetOpts struct { + Subnet NetworkSubnet +} + +// AddSubnet adds a subnet to a network. +func (c *NetworkClient) AddSubnet(ctx context.Context, network *Network, opts NetworkAddSubnetOpts) (*Action, *Response, error) { + reqBody := schema.NetworkActionAddSubnetRequest{ + Type: string(opts.Subnet.Type), + IPRange: opts.Subnet.IPRange.String(), + NetworkZone: string(opts.Subnet.NetworkZone), + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + + path := fmt.Sprintf("/networks/%d/actions/add_subnet", network.ID) + req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.NetworkActionAddSubnetResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return ActionFromSchema(respBody.Action), resp, nil +} + +// NetworkDeleteSubnetOpts specifies options for deleting a subnet from a network. +type NetworkDeleteSubnetOpts struct { + Subnet NetworkSubnet +} + +// DeleteSubnet deletes a subnet from a network. +func (c *NetworkClient) DeleteSubnet(ctx context.Context, network *Network, opts NetworkDeleteSubnetOpts) (*Action, *Response, error) { + reqBody := schema.NetworkActionDeleteSubnetRequest{ + IPRange: opts.Subnet.IPRange.String(), + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + + path := fmt.Sprintf("/networks/%d/actions/delete_subnet", network.ID) + req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.NetworkActionDeleteSubnetResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return ActionFromSchema(respBody.Action), resp, nil +} + +// NetworkAddRouteOpts specifies options for adding a route to a network. +type NetworkAddRouteOpts struct { + Route NetworkRoute +} + +// AddRoute adds a route to a network. +func (c *NetworkClient) AddRoute(ctx context.Context, network *Network, opts NetworkAddRouteOpts) (*Action, *Response, error) { + reqBody := schema.NetworkActionAddRouteRequest{ + Destination: opts.Route.Destination.String(), + Gateway: opts.Route.Gateway.String(), + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + + path := fmt.Sprintf("/networks/%d/actions/add_route", network.ID) + req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.NetworkActionAddSubnetResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return ActionFromSchema(respBody.Action), resp, nil +} + +// NetworkDeleteRouteOpts specifies options for deleting a route from a network. +type NetworkDeleteRouteOpts struct { + Route NetworkRoute +} + +// DeleteRoute deletes a route from a network. +func (c *NetworkClient) DeleteRoute(ctx context.Context, network *Network, opts NetworkDeleteRouteOpts) (*Action, *Response, error) { + reqBody := schema.NetworkActionDeleteRouteRequest{ + Destination: opts.Route.Destination.String(), + Gateway: opts.Route.Gateway.String(), + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + + path := fmt.Sprintf("/networks/%d/actions/delete_route", network.ID) + req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.NetworkActionDeleteSubnetResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return ActionFromSchema(respBody.Action), resp, nil +} + +// NetworkChangeProtectionOpts specifies options for changing the resource protection level of a network. +type NetworkChangeProtectionOpts struct { + Delete *bool +} + +// ChangeProtection changes the resource protection level of a network. +func (c *NetworkClient) ChangeProtection(ctx context.Context, network *Network, opts NetworkChangeProtectionOpts) (*Action, *Response, error) { + reqBody := schema.NetworkActionChangeProtectionRequest{ + Delete: opts.Delete, + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + + path := fmt.Sprintf("/networks/%d/actions/change_protection", network.ID) + req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.NetworkActionChangeProtectionResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return ActionFromSchema(respBody.Action), resp, err +} diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema.go index 47a194f3a..2b69605b8 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema.go @@ -50,6 +50,7 @@ func FloatingIPFromSchema(s schema.FloatingIP) *FloatingIP { ID: s.ID, Type: FloatingIPType(s.Type), HomeLocation: LocationFromSchema(s.HomeLocation), + Created: s.Created, Blocked: s.Blocked, Protection: FloatingIPProtection{ Delete: s.Protection.Delete, @@ -98,6 +99,7 @@ func LocationFromSchema(s schema.Location) *Location { City: s.City, Latitude: s.Latitude, Longitude: s.Longitude, + NetworkZone: NetworkZone(s.NetworkZone), } } @@ -162,6 +164,9 @@ func ServerFromSchema(s schema.Server) *Server { for _, id := range s.Volumes { server.Volumes = append(server.Volumes, &Volume{ID: id}) } + for _, privNet := range s.PrivateNet { + server.PrivateNet = append(server.PrivateNet, ServerPrivateNetFromSchema(privNet)) + } return server } @@ -202,6 +207,19 @@ func ServerPublicNetIPv6FromSchema(s schema.ServerPublicNetIPv6) ServerPublicNet return ipv6 } +// ServerPrivateNetFromSchema converts a schema.ServerPrivateNet to a ServerPrivateNet. +func ServerPrivateNetFromSchema(s schema.ServerPrivateNet) ServerPrivateNet { + n := ServerPrivateNet{ + Network: &Network{ID: s.Network}, + IP: net.ParseIP(s.IP), + MACAddress: s.MACAddress, + } + for _, ip := range s.AliasIPs { + n.Aliases = append(n.Aliases, net.ParseIP(ip)) + } + return n +} + // ServerTypeFromSchema converts a schema.ServerType to a ServerType. func ServerTypeFromSchema(s schema.ServerType) *ServerType { st := &ServerType{ @@ -311,6 +329,56 @@ func VolumeFromSchema(s schema.Volume) *Volume { return v } +// NetworkFromSchema converts a schema.Network to a Network. +func NetworkFromSchema(s schema.Network) *Network { + n := &Network{ + ID: s.ID, + Name: s.Name, + Created: s.Created, + Protection: NetworkProtection{ + Delete: s.Protection.Delete, + }, + Labels: map[string]string{}, + } + + _, n.IPRange, _ = net.ParseCIDR(s.IPRange) + + for _, subnet := range s.Subnets { + n.Subnets = append(n.Subnets, NetworkSubnetFromSchema(subnet)) + } + for _, route := range s.Routes { + n.Routes = append(n.Routes, NetworkRouteFromSchema(route)) + } + for _, serverID := range s.Servers { + n.Servers = append(n.Servers, &Server{ID: serverID}) + } + for key, value := range s.Labels { + n.Labels[key] = value + } + + return n +} + +// NetworkSubnetFromSchema converts a schema.NetworkSubnet to a NetworkSubnet. +func NetworkSubnetFromSchema(s schema.NetworkSubnet) NetworkSubnet { + sn := NetworkSubnet{ + Type: NetworkSubnetType(s.Type), + NetworkZone: NetworkZone(s.NetworkZone), + Gateway: net.ParseIP(s.Gateway), + } + _, sn.IPRange, _ = net.ParseCIDR(s.IPRange) + return sn +} + +// NetworkRouteFromSchema converts a schema.NetworkRoute to a NetworkRoute. +func NetworkRouteFromSchema(s schema.NetworkRoute) NetworkRoute { + r := NetworkRoute{ + Gateway: net.ParseIP(s.Gateway), + } + _, r.Destination, _ = net.ParseCIDR(s.Destination) + return r +} + // PaginationFromSchema converts a schema.MetaPagination to a Pagination. func PaginationFromSchema(s schema.MetaPagination) Pagination { return Pagination{ diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/floating_ip.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/floating_ip.go index 95ae2054b..4c56d874f 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/floating_ip.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/floating_ip.go @@ -1,9 +1,12 @@ package schema +import "time" + // FloatingIP defines the schema of a Floating IP. type FloatingIP struct { ID int `json:"id"` Description *string `json:"description"` + Created time.Time `json:"created"` IP string `json:"ip"` Type string `json:"type"` Server *int `json:"server"` diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/location.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/location.go index 1f030a9db..3dd58ad5e 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/location.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/location.go @@ -9,6 +9,7 @@ type Location struct { City string `json:"city"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` + NetworkZone string `json:"network_zone"` } // LocationGetResponse defines the schema of the response when retrieving a single location. diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/network.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/network.go new file mode 100644 index 000000000..e1c97e426 --- /dev/null +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/network.go @@ -0,0 +1,150 @@ +package schema + +import "time" + +// Network defines the schema of a network. +type Network struct { + ID int `json:"id"` + Name string `json:"name"` + Created time.Time `json:"created"` + IPRange string `json:"ip_range"` + Subnets []NetworkSubnet `json:"subnets"` + Routes []NetworkRoute `json:"routes"` + Servers []int `json:"servers"` + Protection NetworkProtection `json:"protection"` + Labels map[string]string `json:"labels"` +} + +// NetworkSubnet represents a subnet of a network. +type NetworkSubnet struct { + Type string `json:"type"` + IPRange string `json:"ip_range"` + NetworkZone string `json:"network_zone"` + Gateway string `json:"gateway"` +} + +// NetworkRoute represents a route of a network. +type NetworkRoute struct { + Destination string `json:"destination"` + Gateway string `json:"gateway"` +} + +// NetworkProtection represents the protection level of a network. +type NetworkProtection struct { + Delete bool `json:"delete"` +} + +// NetworkUpdateRequest defines the schema of the request to update a network. +type NetworkUpdateRequest struct { + Name string `json:"name,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` +} + +// NetworkUpdateResponse defines the schema of the response when updating a network. +type NetworkUpdateResponse struct { + Network Network `json:"network"` +} + +// NetworkListResponse defines the schema of the response when +// listing networks. +type NetworkListResponse struct { + Networks []Network `json:"networks"` +} + +// NetworkGetResponse defines the schema of the response when +// retrieving a single network. +type NetworkGetResponse struct { + Network Network `json:"network"` +} + +// NetworkCreateRequest defines the schema of the request to create a network. +type NetworkCreateRequest struct { + Name string `json:"name"` + IPRange string `json:"ip_range"` + Subnets []NetworkSubnet `json:"subnets,omitempty"` + Routes []NetworkRoute `json:"routes,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` +} + +// NetworkCreateResponse defines the schema of the response when +// creating a network. +type NetworkCreateResponse struct { + Network Network `json:"network"` +} + +// NetworkActionChangeIPRangeRequest defines the schema of the request to +// change the IP range of a network. +type NetworkActionChangeIPRangeRequest struct { + IPRange string `json:"ip_range"` +} + +// NetworkActionChangeIPRangeResponse defines the schema of the response when +// changing the IP range of a network. +type NetworkActionChangeIPRangeResponse struct { + Action Action `json:"action"` +} + +// NetworkActionAddSubnetRequest defines the schema of the request to +// add a subnet to a network. +type NetworkActionAddSubnetRequest struct { + Type string `json:"type"` + IPRange string `json:"ip_range,omitempty"` + NetworkZone string `json:"network_zone"` + Gateway string `json:"gateway"` +} + +// NetworkActionAddSubnetResponse defines the schema of the response when +// adding a subnet to a network. +type NetworkActionAddSubnetResponse struct { + Action Action `json:"action"` +} + +// NetworkActionDeleteSubnetRequest defines the schema of the request to +// delete a subnet from a network. +type NetworkActionDeleteSubnetRequest struct { + IPRange string `json:"ip_range"` +} + +// NetworkActionDeleteSubnetResponse defines the schema of the response when +// deleting a subnet from a network. +type NetworkActionDeleteSubnetResponse struct { + Action Action `json:"action"` +} + +// NetworkActionAddRouteRequest defines the schema of the request to +// add a route to a network. +type NetworkActionAddRouteRequest struct { + Destination string `json:"destination"` + Gateway string `json:"gateway"` +} + +// NetworkActionAddRouteResponse defines the schema of the response when +// adding a route to a network. +type NetworkActionAddRouteResponse struct { + Action Action `json:"action"` +} + +// NetworkActionDeleteRouteRequest defines the schema of the request to +// delete a route from a network. +type NetworkActionDeleteRouteRequest struct { + Destination string `json:"destination"` + Gateway string `json:"gateway"` +} + +// NetworkActionDeleteRouteResponse defines the schema of the response when +// deleting a route from a network. +type NetworkActionDeleteRouteResponse struct { + Action Action `json:"action"` +} + +// NetworkActionChangeProtectionRequest defines the schema of the request to +// change the resource protection of a network. +type NetworkActionChangeProtectionRequest struct { + Delete *bool `json:"delete,omitempty"` +} + +// NetworkActionChangeProtectionResponse defines the schema of the response when +// changing the resource protection of a network. +type NetworkActionChangeProtectionResponse struct { + Action Action `json:"action"` +} diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/server.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/server.go index e680ae75e..32cd00f90 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/server.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/schema/server.go @@ -4,24 +4,25 @@ import "time" // Server defines the schema of a server. type Server struct { - ID int `json:"id"` - Name string `json:"name"` - Status string `json:"status"` - Created time.Time `json:"created"` - PublicNet ServerPublicNet `json:"public_net"` - ServerType ServerType `json:"server_type"` - IncludedTraffic uint64 `json:"included_traffic"` - OutgoingTraffic *uint64 `json:"outgoing_traffic"` - IngoingTraffic *uint64 `json:"ingoing_traffic"` - BackupWindow *string `json:"backup_window"` - RescueEnabled bool `json:"rescue_enabled"` - ISO *ISO `json:"iso"` - Locked bool `json:"locked"` - Datacenter Datacenter `json:"datacenter"` - Image *Image `json:"image"` - Protection ServerProtection `json:"protection"` - Labels map[string]string `json:"labels"` - Volumes []int `json:"volumes"` + ID int `json:"id"` + Name string `json:"name"` + Status string `json:"status"` + Created time.Time `json:"created"` + PublicNet ServerPublicNet `json:"public_net"` + PrivateNet []ServerPrivateNet `json:"private_net"` + ServerType ServerType `json:"server_type"` + IncludedTraffic uint64 `json:"included_traffic"` + OutgoingTraffic *uint64 `json:"outgoing_traffic"` + IngoingTraffic *uint64 `json:"ingoing_traffic"` + BackupWindow *string `json:"backup_window"` + RescueEnabled bool `json:"rescue_enabled"` + ISO *ISO `json:"iso"` + Locked bool `json:"locked"` + Datacenter Datacenter `json:"datacenter"` + Image *Image `json:"image"` + Protection ServerProtection `json:"protection"` + Labels map[string]string `json:"labels"` + Volumes []int `json:"volumes"` } // ServerProtection defines the schema of a server's resource protection. @@ -61,6 +62,14 @@ type ServerPublicNetIPv6DNSPtr struct { DNSPtr string `json:"dns_ptr"` } +// ServerPrivateNet defines the schema of a server's private network information. +type ServerPrivateNet struct { + Network int `json:"network"` + IP string `json:"ip"` + AliasIPs []string `json:"alias_ips"` + MACAddress string `json:"mac_address"` +} + // ServerGetResponse defines the schema of the response when // retrieving a single server. type ServerGetResponse struct { @@ -87,6 +96,7 @@ type ServerCreateRequest struct { Labels *map[string]string `json:"labels,omitempty"` Automount *bool `json:"automount,omitempty"` Volumes []int `json:"volumes,omitempty"` + Networks []int `json:"networks,omitempty"` } // ServerCreateResponse defines the schema of the response when @@ -291,13 +301,54 @@ type ServerActionChangeDNSPtrResponse struct { Action Action `json:"action"` } -// ServerActionChangeProtectionRequest defines the schema of the request to change the resource protection of a server. +// ServerActionChangeProtectionRequest defines the schema of the request to +// change the resource protection of a server. type ServerActionChangeProtectionRequest struct { Rebuild *bool `json:"rebuild,omitempty"` Delete *bool `json:"delete,omitempty"` } -// ServerActionChangeProtectionResponse defines the schema of the response when changing the resource protection of a server. +// ServerActionChangeProtectionResponse defines the schema of the response when +// changing the resource protection of a server. type ServerActionChangeProtectionResponse struct { Action Action `json:"action"` } + +// ServerActionAttachToNetworkRequest defines the schema for the request to +// attach a network to a server. +type ServerActionAttachToNetworkRequest struct { + Network int `json:"network"` + IP *string `json:"ip,omitempty"` + AliasIPs []*string `json:"alias_ips,omitempty"` +} + +// ServerActionAttachToNetworkResponse defines the schema of the response when +// creating an attach_to_network server action. +type ServerActionAttachToNetworkResponse struct { + Action Action `json:"action"` +} + +// ServerActionDetachFromNetworkRequest defines the schema for the request to +// detach a network from a server. +type ServerActionDetachFromNetworkRequest struct { + Network int `json:"network"` +} + +// ServerActionDetachFromNetworkResponse defines the schema of the response when +// creating a detach_from_network server action. +type ServerActionDetachFromNetworkResponse struct { + Action Action `json:"action"` +} + +// ServerActionChangeAliasIPsRequest defines the schema for the request to +// change a server's alias IPs in a network. +type ServerActionChangeAliasIPsRequest struct { + Network int `json:"network"` + AliasIPs []string `json:"alias_ips"` +} + +// ServerActionChangeAliasIPsResponse defines the schema of the response when +// creating an change_alias_ips server action. +type ServerActionChangeAliasIPsResponse struct { + Action Action `json:"action"` +} diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/server.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/server.go index c301d5baf..9653a2539 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/server.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/server.go @@ -21,6 +21,7 @@ type Server struct { Status ServerStatus Created time.Time PublicNet ServerPublicNet + PrivateNet []ServerPrivateNet ServerType *ServerType Datacenter *Datacenter IncludedTraffic uint64 @@ -53,6 +54,24 @@ const ( // ServerStatusRunning is the status when a server is running. ServerStatusRunning ServerStatus = "running" + + // ServerStatusStarting is the status when a server is being started. + ServerStatusStarting ServerStatus = "starting" + + // ServerStatusStopping is the status when a server is being stopped. + ServerStatusStopping ServerStatus = "stopping" + + // ServerStatusMigrating is the status when a server is being migrated. + ServerStatusMigrating ServerStatus = "migrating" + + // ServerStatusRebuilding is the status when a server is being rebuilt. + ServerStatusRebuilding ServerStatus = "rebuilding" + + // ServerStatusDeleting is the status when a server is being deleted. + ServerStatusDeleting ServerStatus = "deleting" + + // ServerStatusUnknown is the status when a server's state is unknown. + ServerStatusUnknown ServerStatus = "unknown" ) // ServerPublicNet represents a server's public network. @@ -77,6 +96,14 @@ type ServerPublicNetIPv6 struct { DNSPtr map[string]string } +// ServerPrivateNet defines the schema of a server's private network information. +type ServerPrivateNet struct { + Network *Network + IP net.IP + Aliases []net.IP + MACAddress string +} + // DNSPtrForIP returns the reverse dns pointer of the ip address. func (s *ServerPublicNetIPv6) DNSPtrForIP(ip net.IP) string { return s.DNSPtr[ip.String()] @@ -115,24 +142,13 @@ func (c *ServerClient) GetByID(ctx context.Context, id int) (*Server, *Response, return ServerFromSchema(body.Server), resp, nil } -// GetByName retreives a server by its name. If the server does not exist, nil is returned. +// GetByName retrieves a server by its name. If the server does not exist, nil is returned. func (c *ServerClient) GetByName(ctx context.Context, name string) (*Server, *Response, error) { - path := "/servers?name=" + url.QueryEscape(name) - req, err := c.client.NewRequest(ctx, "GET", path, nil) - if err != nil { - return nil, nil, err + servers, response, err := c.List(ctx, ServerListOpts{Name: name}) + if len(servers) == 0 { + return nil, response, err } - - var body schema.ServerListResponse - resp, err := c.client.Do(req, &body) - if err != nil { - return nil, nil, err - } - - if len(body.Servers) == 0 { - return nil, resp, nil - } - return ServerFromSchema(body.Servers[0]), resp, nil + return servers[0], response, err } // Get retrieves a server by its ID if the input can be parsed as an integer, otherwise it @@ -147,11 +163,24 @@ func (c *ServerClient) Get(ctx context.Context, idOrName string) (*Server, *Resp // ServerListOpts specifies options for listing servers. type ServerListOpts struct { ListOpts + Name string + Status []ServerStatus +} + +func (l ServerListOpts) values() url.Values { + vals := l.ListOpts.values() + if l.Name != "" { + vals.Add("name", l.Name) + } + for _, status := range l.Status { + vals.Add("status", string(status)) + } + return vals } // List returns a list of servers for a specific page. func (c *ServerClient) List(ctx context.Context, opts ServerListOpts) ([]*Server, *Response, error) { - path := "/servers?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/servers?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err @@ -171,7 +200,7 @@ func (c *ServerClient) List(ctx context.Context, opts ServerListOpts) ([]*Server // All returns all servers. func (c *ServerClient) All(ctx context.Context) ([]*Server, error) { - return c.AllWithOpts(ctx, ServerListOpts{ListOpts{PerPage: 50}}) + return c.AllWithOpts(ctx, ServerListOpts{ListOpts: ListOpts{PerPage: 50}}) } // AllWithOpts returns all servers for the given options. @@ -207,6 +236,7 @@ type ServerCreateOpts struct { Labels map[string]string Automount *bool Volumes []*Volume + Networks []*Network } // Validate checks if options are valid. @@ -264,6 +294,9 @@ func (c *ServerClient) Create(ctx context.Context, opts ServerCreateOpts) (Serve for _, volume := range opts.Volumes { reqBody.Volumes = append(reqBody.Volumes, volume.ID) } + for _, network := range opts.Networks { + reqBody.Networks = append(reqBody.Networks, network.ID) + } if opts.Location != nil { if opts.Location.ID != 0 { @@ -763,7 +796,7 @@ type ServerChangeProtectionOpts struct { } // ChangeProtection changes the resource protection level of a server. -func (c *ServerClient) ChangeProtection(ctx context.Context, image *Server, opts ServerChangeProtectionOpts) (*Action, *Response, error) { +func (c *ServerClient) ChangeProtection(ctx context.Context, server *Server, opts ServerChangeProtectionOpts) (*Action, *Response, error) { reqBody := schema.ServerActionChangeProtectionRequest{ Rebuild: opts.Rebuild, Delete: opts.Delete, @@ -773,7 +806,7 @@ func (c *ServerClient) ChangeProtection(ctx context.Context, image *Server, opts return nil, nil, err } - path := fmt.Sprintf("/servers/%d/actions/change_protection", image.ID) + path := fmt.Sprintf("/servers/%d/actions/change_protection", server.ID) req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) if err != nil { return nil, nil, err @@ -786,3 +819,102 @@ func (c *ServerClient) ChangeProtection(ctx context.Context, image *Server, opts } return ActionFromSchema(respBody.Action), resp, err } + +// ServerAttachToNetworkOpts specifies options for attaching a server to a network. +type ServerAttachToNetworkOpts struct { + Network *Network + IP net.IP + AliasIPs []net.IP +} + +// AttachToNetwork attaches a server to a network. +func (c *ServerClient) AttachToNetwork(ctx context.Context, server *Server, opts ServerAttachToNetworkOpts) (*Action, *Response, error) { + reqBody := schema.ServerActionAttachToNetworkRequest{ + Network: opts.Network.ID, + } + if opts.IP != nil { + reqBody.IP = String(opts.IP.String()) + } + for _, aliasIP := range opts.AliasIPs { + reqBody.AliasIPs = append(reqBody.AliasIPs, String(aliasIP.String())) + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + + path := fmt.Sprintf("/servers/%d/actions/attach_to_network", server.ID) + req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.ServerActionAttachToNetworkResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return ActionFromSchema(respBody.Action), resp, err +} + +// ServerDetachFromNetworkOpts specifies options for detaching a server from a network. +type ServerDetachFromNetworkOpts struct { + Network *Network +} + +// DetachFromNetwork detaches a server from a network. +func (c *ServerClient) DetachFromNetwork(ctx context.Context, server *Server, opts ServerDetachFromNetworkOpts) (*Action, *Response, error) { + reqBody := schema.ServerActionDetachFromNetworkRequest{ + Network: opts.Network.ID, + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + + path := fmt.Sprintf("/servers/%d/actions/detach_from_network", server.ID) + req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.ServerActionDetachFromNetworkResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return ActionFromSchema(respBody.Action), resp, err +} + +// ServerChangeAliasIPsOpts specifies options for changing the alias ips of an already attached network. +type ServerChangeAliasIPsOpts struct { + Network *Network + AliasIPs []net.IP +} + +// ChangeAliasIPs changes a server's alias IPs in a network. +func (c *ServerClient) ChangeAliasIPs(ctx context.Context, server *Server, opts ServerChangeAliasIPsOpts) (*Action, *Response, error) { + reqBody := schema.ServerActionChangeAliasIPsRequest{ + Network: opts.Network.ID, + AliasIPs: []string{}, + } + for _, aliasIP := range opts.AliasIPs { + reqBody.AliasIPs = append(reqBody.AliasIPs, aliasIP.String()) + } + reqBodyData, err := json.Marshal(reqBody) + if err != nil { + return nil, nil, err + } + path := fmt.Sprintf("/servers/%d/actions/change_alias_ips", server.ID) + req, err := c.client.NewRequest(ctx, "POST", path, bytes.NewReader(reqBodyData)) + if err != nil { + return nil, nil, err + } + + respBody := schema.ServerActionDetachFromNetworkResponse{} + resp, err := c.client.Do(req, &respBody) + if err != nil { + return nil, resp, err + } + return ActionFromSchema(respBody.Action), resp, err +} diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/server_type.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/server_type.go index 6f12bd680..606dd5d7f 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/server_type.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/server_type.go @@ -69,22 +69,11 @@ func (c *ServerTypeClient) GetByID(ctx context.Context, id int) (*ServerType, *R // GetByName retrieves a server type by its name. If the server type does not exist, nil is returned. func (c *ServerTypeClient) GetByName(ctx context.Context, name string) (*ServerType, *Response, error) { - path := "/server_types?name=" + url.QueryEscape(name) - req, err := c.client.NewRequest(ctx, "GET", path, nil) - if err != nil { - return nil, nil, err + serverTypes, response, err := c.List(ctx, ServerTypeListOpts{Name: name}) + if len(serverTypes) == 0 { + return nil, response, err } - - var body schema.ServerTypeListResponse - resp, err := c.client.Do(req, &body) - if err != nil { - return nil, nil, err - } - - if len(body.ServerTypes) == 0 { - return nil, resp, nil - } - return ServerTypeFromSchema(body.ServerTypes[0]), resp, nil + return serverTypes[0], response, err } // Get retrieves a server type by its ID if the input can be parsed as an integer, otherwise it @@ -99,11 +88,20 @@ func (c *ServerTypeClient) Get(ctx context.Context, idOrName string) (*ServerTyp // ServerTypeListOpts specifies options for listing server types. type ServerTypeListOpts struct { ListOpts + Name string +} + +func (l ServerTypeListOpts) values() url.Values { + vals := l.ListOpts.values() + if l.Name != "" { + vals.Add("name", l.Name) + } + return vals } // List returns a list of server types for a specific page. func (c *ServerTypeClient) List(ctx context.Context, opts ServerTypeListOpts) ([]*ServerType, *Response, error) { - path := "/server_types?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/server_types?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/ssh_key.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/ssh_key.go index 7db8f0a9e..78e74c48d 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/ssh_key.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/ssh_key.go @@ -46,42 +46,20 @@ func (c *SSHKeyClient) GetByID(ctx context.Context, id int) (*SSHKey, *Response, // GetByName retrieves a SSH key by its name. If the SSH key does not exist, nil is returned. func (c *SSHKeyClient) GetByName(ctx context.Context, name string) (*SSHKey, *Response, error) { - path := "/ssh_keys?name=" + url.QueryEscape(name) - req, err := c.client.NewRequest(ctx, "GET", path, nil) - if err != nil { - return nil, nil, err + sshKeys, response, err := c.List(ctx, SSHKeyListOpts{Name: name}) + if len(sshKeys) == 0 { + return nil, response, err } - - var body schema.SSHKeyListResponse - resp, err := c.client.Do(req, &body) - if err != nil { - return nil, nil, err - } - - if len(body.SSHKeys) == 0 { - return nil, resp, nil - } - return SSHKeyFromSchema(body.SSHKeys[0]), resp, nil + return sshKeys[0], response, err } // GetByFingerprint retreives a SSH key by its fingerprint. If the SSH key does not exist, nil is returned. func (c *SSHKeyClient) GetByFingerprint(ctx context.Context, fingerprint string) (*SSHKey, *Response, error) { - path := "/ssh_keys?fingerprint=" + url.QueryEscape(fingerprint) - req, err := c.client.NewRequest(ctx, "GET", path, nil) - if err != nil { - return nil, nil, err + sshKeys, response, err := c.List(ctx, SSHKeyListOpts{Fingerprint: fingerprint}) + if len(sshKeys) == 0 { + return nil, response, err } - - var body schema.SSHKeyListResponse - resp, err := c.client.Do(req, &body) - if err != nil { - return nil, nil, err - } - - if len(body.SSHKeys) == 0 { - return nil, resp, nil - } - return SSHKeyFromSchema(body.SSHKeys[0]), resp, nil + return sshKeys[0], response, err } // Get retrieves a SSH key by its ID if the input can be parsed as an integer, otherwise it @@ -96,11 +74,24 @@ func (c *SSHKeyClient) Get(ctx context.Context, idOrName string) (*SSHKey, *Resp // SSHKeyListOpts specifies options for listing SSH keys. type SSHKeyListOpts struct { ListOpts + Name string + Fingerprint string +} + +func (l SSHKeyListOpts) values() url.Values { + vals := l.ListOpts.values() + if l.Name != "" { + vals.Add("name", l.Name) + } + if l.Fingerprint != "" { + vals.Add("fingerprint", l.Fingerprint) + } + return vals } // List returns a list of SSH keys for a specific page. func (c *SSHKeyClient) List(ctx context.Context, opts SSHKeyListOpts) ([]*SSHKey, *Response, error) { - path := "/ssh_keys?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/ssh_keys?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err @@ -120,7 +111,7 @@ func (c *SSHKeyClient) List(ctx context.Context, opts SSHKeyListOpts) ([]*SSHKey // All returns all SSH keys. func (c *SSHKeyClient) All(ctx context.Context) ([]*SSHKey, error) { - return c.AllWithOpts(ctx, SSHKeyListOpts{ListOpts{PerPage: 50}}) + return c.AllWithOpts(ctx, SSHKeyListOpts{ListOpts: ListOpts{PerPage: 50}}) } // AllWithOpts returns all SSH keys with the given options. diff --git a/vendor/github.com/hetznercloud/hcloud-go/hcloud/volume.go b/vendor/github.com/hetznercloud/hcloud-go/hcloud/volume.go index a9d2ea3d5..5c837d166 100644 --- a/vendor/github.com/hetznercloud/hcloud-go/hcloud/volume.go +++ b/vendor/github.com/hetznercloud/hcloud-go/hcloud/volume.go @@ -36,6 +36,17 @@ type VolumeClient struct { client *Client } +// VolumeStatus specifies a volume's status. +type VolumeStatus string + +const ( + // VolumeStatusCreating is the status when a volume is being created. + VolumeStatusCreating VolumeStatus = "creating" + + // VolumeStatusAvailable is the status when a volume is available. + VolumeStatusAvailable VolumeStatus = "available" +) + // GetByID retrieves a volume by its ID. If the volume does not exist, nil is returned. func (c *VolumeClient) GetByID(ctx context.Context, id int) (*Volume, *Response, error) { req, err := c.client.NewRequest(ctx, "GET", fmt.Sprintf("/volumes/%d", id), nil) @@ -56,22 +67,11 @@ func (c *VolumeClient) GetByID(ctx context.Context, id int) (*Volume, *Response, // GetByName retrieves a volume by its name. If the volume does not exist, nil is returned. func (c *VolumeClient) GetByName(ctx context.Context, name string) (*Volume, *Response, error) { - path := "/volumes?name=" + url.QueryEscape(name) - req, err := c.client.NewRequest(ctx, "GET", path, nil) - if err != nil { - return nil, nil, err + volumes, response, err := c.List(ctx, VolumeListOpts{Name: name}) + if len(volumes) == 0 { + return nil, response, err } - - var body schema.VolumeListResponse - resp, err := c.client.Do(req, &body) - if err != nil { - return nil, nil, err - } - - if len(body.Volumes) == 0 { - return nil, resp, nil - } - return VolumeFromSchema(body.Volumes[0]), resp, nil + return volumes[0], response, err } // Get retrieves a volume by its ID if the input can be parsed as an integer, otherwise it @@ -86,11 +86,24 @@ func (c *VolumeClient) Get(ctx context.Context, idOrName string) (*Volume, *Resp // VolumeListOpts specifies options for listing volumes. type VolumeListOpts struct { ListOpts + Name string + Status []VolumeStatus +} + +func (l VolumeListOpts) values() url.Values { + vals := l.ListOpts.values() + if l.Name != "" { + vals.Add("name", l.Name) + } + for _, status := range l.Status { + vals.Add("status", string(status)) + } + return vals } // List returns a list of volumes for a specific page. func (c *VolumeClient) List(ctx context.Context, opts VolumeListOpts) ([]*Volume, *Response, error) { - path := "/volumes?" + valuesForListOpts(opts.ListOpts).Encode() + path := "/volumes?" + opts.values().Encode() req, err := c.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err @@ -110,7 +123,7 @@ func (c *VolumeClient) List(ctx context.Context, opts VolumeListOpts) ([]*Volume // All returns all volumes. func (c *VolumeClient) All(ctx context.Context) ([]*Volume, error) { - return c.AllWithOpts(ctx, VolumeListOpts{ListOpts{PerPage: 50}}) + return c.AllWithOpts(ctx, VolumeListOpts{ListOpts: ListOpts{PerPage: 50}}) } // AllWithOpts returns all volumes with the given options. diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/LICENSE b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Config.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Config.go new file mode 100644 index 000000000..993bb0319 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Config.go @@ -0,0 +1,44 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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 core + +import "time" + +type Config struct { + Scheme string + Endpoint string + Timeout time.Duration +} + +// NewConfig returns a pointer of Config +// +// scheme only accepts http or https +// +// endpoint is the host to access, the connection could not be created if it's error +func NewConfig() *Config { + return &Config{SchemeHttps, "www.jdcloud-api.com", 10 * time.Second} +} + +func (c *Config) SetScheme(scheme string) { + c.Scheme = scheme +} + +func (c *Config) SetEndpoint(endpoint string) { + c.Endpoint = endpoint +} + +func (c *Config) SetTimeout(timeout time.Duration) { + c.Timeout = timeout +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Const.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Const.go new file mode 100644 index 000000000..bb8341d8e --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Const.go @@ -0,0 +1,32 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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 core + +const ( + SchemeHttp = "http" + SchemeHttps = "https" + + MethodGet = "GET" + MethodPut = "PUT" + MethodPost = "POST" + MethodDelete = "DELETE" + MethodPatch = "PATCH" + MethodHead = "HEAD" + + HeaderJcloudPrefix = "x-jcloud" + HeaderJdcloudPrefix = "x-jdcloud" + HeaderJdcloudRequestId = "x-jdcloud-request-id" +) + diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Credential.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Credential.go new file mode 100644 index 000000000..addc417f1 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Credential.go @@ -0,0 +1,26 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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 core + +// Credential is used to sign the request, +// AccessKey and SecretKey could be found in JDCloud console +type Credential struct { + AccessKey string + SecretKey string +} + +func NewCredentials(accessKey, secretKey string) *Credential { + return &Credential{accessKey, secretKey} +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Doc.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Doc.go new file mode 100644 index 000000000..77e4c4617 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Doc.go @@ -0,0 +1,4 @@ +// This core package providers API and clients base struct for services, +// and also some infrastructure function, such as signer, send http(s) +// request and so on. +package core diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/ErrorResponse.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/ErrorResponse.go new file mode 100644 index 000000000..ee2537109 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/ErrorResponse.go @@ -0,0 +1,21 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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 core + +type ErrorResponse struct { + Code int `json:"code"` + Status string `json:"status"` + Message string `json:"message"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/JdcloudClient.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/JdcloudClient.go new file mode 100644 index 000000000..82adae99e --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/JdcloudClient.go @@ -0,0 +1,120 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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 core + +import ( + "net/http" + "strings" + "time" + "fmt" + "encoding/json" + "encoding/base64" +) + +// JDCloudClient is the base struct of service clients +type JDCloudClient struct { + Credential Credential + Config Config + ServiceName string + Revision string + Logger Logger +} + +type SignFunc func(*http.Request) error + +// Send send the request and return the response to the client. +// Parameter request accepts concrete request object which follow RequestInterface. +func (c JDCloudClient) Send(request RequestInterface, serviceName string) ([]byte, error) { + method := request.GetMethod() + builder := GetParameterBuilder(method, c.Logger) + jsonReq, _ := json.Marshal(request) + encodedUrl, err := builder.BuildURL(request.GetURL(), jsonReq) + if err != nil { + return nil, err + } + reqUrl := fmt.Sprintf("%s://%s/%s%s", c.Config.Scheme, c.Config.Endpoint, request.GetVersion(), encodedUrl) + + body, err := builder.BuildBody(jsonReq) + if err != nil { + return nil, err + } + + sign := func(r *http.Request) error { + regionId := request.GetRegionId() + // some request has no region parameter, so give a value to it, + // then API gateway can calculate sign successfully. + if regionId == "" { + regionId = "jdcloud-api" + } + + signer := NewSigner(c.Credential, c.Logger) + _, err := signer.Sign(r, strings.NewReader(body), serviceName, regionId, time.Now()) + return err + } + + return c.doSend(method, reqUrl, body, request.GetHeaders(), c.Config.Timeout, sign) +} + +func (c JDCloudClient) doSend(method, url, data string, header map[string]string, timeout time.Duration, sign SignFunc) ([]byte, error) { + client := &http.Client{Timeout: timeout} + + req, err := http.NewRequest(method, url, strings.NewReader(data)) + if err != nil { + c.Logger.Log(LogFatal, err.Error()) + return nil, err + } + + c.setHeader(req, header) + + err = sign(req) + if err != nil { + return nil, err + } + + resp, err := client.Do(req) + if err != nil { + c.Logger.Log(LogError, err.Error()) + return nil, err + } + + processor := GetResponseProcessor(req.Method) + result, err := processor.Process(resp) + if err != nil { + c.Logger.Log(LogError, err.Error()) + return nil, err + } + return result, nil +} + +func (c JDCloudClient) setHeader(req *http.Request, header map[string]string) { + + req.Header.Set("Content-Type", "application/json") + req.Header.Set("User-Agent", fmt.Sprintf("JdcloudSdkGo/%s %s/%s", Version, c.ServiceName, c.Revision)) + + base64Headers := []string{HeaderJdcloudPrefix + "-pin", HeaderJdcloudPrefix + "-erp", HeaderJdcloudPrefix + "-security-token", + HeaderJcloudPrefix + "-pin", HeaderJcloudPrefix + "-erp", HeaderJcloudPrefix + "-security-token"} + + for k, v := range header { + if includes(base64Headers, strings.ToLower(k)) { + v = base64.StdEncoding.EncodeToString([]byte(v)) + } + + req.Header.Set(k, v) + } + + for k, v := range req.Header { + c.Logger.Log(LogInfo, k, v) + } +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/JdcloudRequest.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/JdcloudRequest.go new file mode 100644 index 000000000..3f98a8f67 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/JdcloudRequest.go @@ -0,0 +1,55 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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 core + +type RequestInterface interface { + GetURL() string + GetMethod() string + GetVersion() string + GetHeaders() map[string]string + GetRegionId() string +} + +// JDCloudRequest is the base struct of service requests +type JDCloudRequest struct { + URL string // resource url, i.e. /regions/${regionId}/elasticIps/${elasticIpId} + Method string + Header map[string]string + Version string +} + +func (r JDCloudRequest) GetURL() string { + return r.URL +} + +func (r JDCloudRequest) GetMethod() string { + return r.Method +} + +func (r JDCloudRequest) GetVersion() string { + return r.Version +} + +func (r JDCloudRequest) GetHeaders() map[string]string { + return r.Header +} + +// AddHeader only adds pin or erp, they will be encoded to base64 code +func (r *JDCloudRequest) AddHeader(key, value string) { + if r.Header == nil { + r.Header = make(map[string]string) + } + r.Header[key] = value +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Logger.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Logger.go new file mode 100644 index 000000000..deff03c9c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Logger.go @@ -0,0 +1,43 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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 core + +import "fmt" + +const ( + LogFatal = iota + LogError + LogWarn + LogInfo +) + +type Logger interface { + Log(level int, message... interface{}) +} + +type DefaultLogger struct { + Level int +} + +func NewDefaultLogger(level int) *DefaultLogger { + return &DefaultLogger{level} +} + +func (logger DefaultLogger) Log (level int, message... interface{}) { + if level <= logger.Level { + fmt.Println(message...) + } +} + diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/ParameterBuilder.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/ParameterBuilder.go new file mode 100644 index 000000000..a48dcc5d1 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/ParameterBuilder.go @@ -0,0 +1,216 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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 core + +import ( + "encoding/json" + "fmt" + "regexp" + "strings" + "errors" + "reflect" + urllib "net/url" +) + +var baseRequestFields []string + +func init() { + req := JDCloudRequest{} + reqType := reflect.TypeOf(req) + for i := 0; i < reqType.NumField(); i++ { + baseRequestFields = append(baseRequestFields, reqType.Field(i).Name) + } +} + +type ParameterBuilder interface { + BuildURL(url string, paramJson []byte) (string, error) + BuildBody(paramJson []byte) (string, error) +} + +func GetParameterBuilder(method string, logger Logger) ParameterBuilder { + if method == MethodGet || method == MethodDelete || method == MethodHead { + return &WithoutBodyBuilder{logger} + } else { + return &WithBodyBuilder{logger} + } +} + +// WithBodyBuilder supports PUT/POST/PATCH methods. +// It has path and body (json) parameters, but no query parameters. +type WithBodyBuilder struct { + Logger Logger +} + +func (b WithBodyBuilder) BuildURL(url string, paramJson []byte) (string, error) { + paramMap := make(map[string]interface{}) + err := json.Unmarshal(paramJson, ¶mMap) + if err != nil { + b.Logger.Log(LogError, err.Error()) + return "", err + } + + replacedUrl, err := replaceUrlWithPathParam(url, paramMap) + if err != nil { + b.Logger.Log(LogError, err.Error()) + return "", err + } + + encodedUrl, err := encodeUrl(replacedUrl, nil) + if err != nil { + return "", err + } + + b.Logger.Log(LogInfo, "URL=" + encodedUrl) + return encodedUrl, nil +} + +func (b WithBodyBuilder) BuildBody(paramJson []byte) (string, error) { + paramMap := make(map[string]interface{}) + err := json.Unmarshal(paramJson, ¶mMap) + if err != nil { + b.Logger.Log(LogError, err.Error()) + return "", err + } + + // remove base request fields + for k := range paramMap { + if includes(baseRequestFields, k) { + delete(paramMap, k) + } + } + + body, _ := json.Marshal(paramMap) + b.Logger.Log(LogInfo, "Body=", string(body)) + return string(body), nil +} + +// WithoutBodyBuilder supports GET/DELETE methods. +// It only builds path and query parameters. +type WithoutBodyBuilder struct { + Logger Logger +} + +func (b WithoutBodyBuilder) BuildURL(url string, paramJson []byte) (string, error) { + paramMap := make(map[string]interface{}) + err := json.Unmarshal(paramJson, ¶mMap) + if err != nil { + b.Logger.Log(LogError, err.Error()) + return "", err + } + + resultUrl, err := replaceUrlWithPathParam(url, paramMap) + if err != nil { + b.Logger.Log(LogError, err.Error()) + return "", err + } + + queryParams := buildQueryParams(paramMap, url) + encodedUrl, err := encodeUrl(resultUrl, queryParams) + if err != nil { + return "", err + } + + b.Logger.Log(LogInfo, string(paramJson)) + b.Logger.Log(LogInfo, "URL=" + encodedUrl) + return encodedUrl, nil +} + +func (b WithoutBodyBuilder) BuildBody(paramJson []byte) (string, error) { + return "", nil +} + +func replaceUrlWithPathParam(url string, paramMap map[string]interface{}) (string, error) { + r, _ := regexp.Compile("{[a-zA-Z0-9-_]+}") + matches := r.FindAllString(url, -1) + for _, match := range matches { + field := strings.TrimLeft(match, "{") + field = strings.TrimRight(field, "}") + value, ok := paramMap[field] + if !ok { + return "", errors.New("Can not find path parameter: " + field) + } + + valueStr := fmt.Sprintf("%v", value) + url = strings.Replace(url, match, valueStr, -1) + } + + return url, nil +} + +func buildQueryParams(paramMap map[string]interface{}, url string) urllib.Values { + values := urllib.Values{} + accessMap(paramMap, url, "", values) + return values +} + +func accessMap(paramMap map[string]interface{}, url, prefix string, values urllib.Values) { + for k, v := range paramMap { + // exclude fields of JDCloudRequest class and path parameters + if shouldIgnoreField(url, k) { + continue + } + + switch e := v.(type) { + case []interface{}: + for i, n := range e { + switch f := n.(type) { + case map[string]interface{}: + subPrefix := fmt.Sprintf("%s.%d.", k, i+1) + accessMap(f, url, subPrefix, values) + case nil: + default: + values.Set(fmt.Sprintf("%s%s.%d", prefix, k, i+1), fmt.Sprintf("%s", n)) + } + } + case nil: + default: + values.Set(fmt.Sprintf("%s%s", prefix, k), fmt.Sprintf("%v", v)) + } + } +} + +func shouldIgnoreField(url, field string) bool { + flag := "{" + field + "}" + if strings.Contains(url, flag) { + return true + } + + if includes(baseRequestFields, field) { + return true + } + + return false +} + +func encodeUrl(requestUrl string, values urllib.Values) (string, error) { + urlObj, err := urllib.Parse(requestUrl) + if err != nil { + return "", err + } + + urlObj.RawPath = EscapePath(urlObj.Path, false) + uri := urlObj.EscapedPath() + + if values != nil { + queryParam := values.Encode() + // RFC 3986, ' ' should be encoded to 20%, '+' to 2B% + queryParam = strings.Replace(queryParam, "+", "%20", -1) + if queryParam != "" { + uri += "?" + queryParam + } + } + + return uri, nil +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/ResponseProcessor.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/ResponseProcessor.go new file mode 100644 index 000000000..217b4b868 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/ResponseProcessor.go @@ -0,0 +1,40 @@ +package core + +import ( + "net/http" + "io/ioutil" + "errors" + "fmt" +) + +type ResponseProcessor interface { + Process(response *http.Response) ([]byte, error) +} + +func GetResponseProcessor(method string) ResponseProcessor { + if method == MethodHead { + return &WithoutBodyResponseProcessor{} + } else { + return &WithBodyResponseProcessor{} + } +} + +type WithBodyResponseProcessor struct { +} + +func (p WithBodyResponseProcessor) Process(response *http.Response) ([]byte, error) { + defer response.Body.Close() + return ioutil.ReadAll(response.Body) +} + +type WithoutBodyResponseProcessor struct { +} + +func (p WithoutBodyResponseProcessor) Process(response *http.Response) ([]byte, error) { + requestId := response.Header.Get(HeaderJdcloudRequestId) + if requestId != "" { + return []byte(fmt.Sprintf(`{"requestId":"%s"}`, requestId)), nil + } + + return nil, errors.New("can not get requestId in HEAD response") +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Signer.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Signer.go new file mode 100644 index 000000000..670868597 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Signer.go @@ -0,0 +1,380 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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. +// +// This signer is modified from AWS V4 signer algorithm. + +package core + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/hex" + "fmt" + "io" + "net/http" + "net/url" + "sort" + "strings" + "time" + "bytes" + "github.com/gofrs/uuid" +) + +const ( + authHeaderPrefix = "JDCLOUD2-HMAC-SHA256" + timeFormat = "20060102T150405Z" + shortTimeFormat = "20060102" + + // emptyStringSHA256 is a SHA256 of an empty string + emptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` +) + +var ignoredHeaders = []string {"Authorization", "User-Agent", "X-Jdcloud-Request-Id"} +var noEscape [256]bool + +func init() { + for i := 0; i < len(noEscape); i++ { + // expects every character except these to be escaped + noEscape[i] = (i >= 'A' && i <= 'Z') || + (i >= 'a' && i <= 'z') || + (i >= '0' && i <= '9') || + i == '-' || + i == '.' || + i == '_' || + i == '~' + } +} + + +type Signer struct { + Credentials Credential + Logger Logger +} + +func NewSigner(credsProvider Credential, logger Logger) *Signer { + return &Signer{ + Credentials: credsProvider, + Logger: logger, + } +} + +type signingCtx struct { + ServiceName string + Region string + Request *http.Request + Body io.ReadSeeker + Query url.Values + Time time.Time + ExpireTime time.Duration + SignedHeaderVals http.Header + + credValues Credential + formattedTime string + formattedShortTime string + + bodyDigest string + signedHeaders string + canonicalHeaders string + canonicalString string + credentialString string + stringToSign string + signature string + authorization string +} + +// Sign signs the request by using AWS V4 signer algorithm, and adds Authorization header +func (v4 Signer) Sign(r *http.Request, body io.ReadSeeker, service, region string, signTime time.Time) (http.Header, error) { + return v4.signWithBody(r, body, service, region, 0, signTime) +} + +func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, + signTime time.Time) (http.Header, error) { + + ctx := &signingCtx{ + Request: r, + Body: body, + Query: r.URL.Query(), + Time: signTime, + ExpireTime: exp, + ServiceName: service, + Region: region, + } + + for key := range ctx.Query { + sort.Strings(ctx.Query[key]) + } + + if ctx.isRequestSigned() { + ctx.Time = time.Now() + } + + ctx.credValues = v4.Credentials + ctx.build() + + v4.logSigningInfo(ctx) + return ctx.SignedHeaderVals, nil +} + +const logSignInfoMsg = `DEBUG: Request Signature: +---[ CANONICAL STRING ]----------------------------- +%s +---[ STRING TO SIGN ]-------------------------------- +%s%s +-----------------------------------------------------` + +func (v4 *Signer) logSigningInfo(ctx *signingCtx) { + signedURLMsg := "" + msg := fmt.Sprintf(logSignInfoMsg, ctx.canonicalString, ctx.stringToSign, signedURLMsg) + v4.Logger.Log(LogInfo, msg) +} + +func (ctx *signingCtx) build() { + ctx.buildTime() // no depends + ctx.buildNonce() // no depends + ctx.buildCredentialString() // no depends + ctx.buildBodyDigest() + + unsignedHeaders := ctx.Request.Header + ctx.buildCanonicalHeaders(unsignedHeaders) + ctx.buildCanonicalString() // depends on canon headers / signed headers + ctx.buildStringToSign() // depends on canon string + ctx.buildSignature() // depends on string to sign + + parts := []string{ + authHeaderPrefix + " Credential=" + ctx.credValues.AccessKey + "/" + ctx.credentialString, + "SignedHeaders=" + ctx.signedHeaders, + "Signature=" + ctx.signature, + } + ctx.Request.Header.Set("Authorization", strings.Join(parts, ", ")) +} + +func (ctx *signingCtx) buildTime() { + ctx.formattedTime = ctx.Time.UTC().Format(timeFormat) + ctx.formattedShortTime = ctx.Time.UTC().Format(shortTimeFormat) + + ctx.Request.Header.Set("x-jdcloud-date", ctx.formattedTime) +} + +func (ctx *signingCtx) buildNonce() { + nonce, _ := uuid.NewV4() + ctx.Request.Header.Set("x-jdcloud-nonce", nonce.String()) +} + +func (ctx *signingCtx) buildCredentialString() { + ctx.credentialString = strings.Join([]string{ + ctx.formattedShortTime, + ctx.Region, + ctx.ServiceName, + "jdcloud2_request", + }, "/") +} + +func (ctx *signingCtx) buildCanonicalHeaders(header http.Header) { + var headers []string + headers = append(headers, "host") + for k, v := range header { + canonicalKey := http.CanonicalHeaderKey(k) + if shouldIgnore(canonicalKey, ignoredHeaders) { + continue // ignored header + } + if ctx.SignedHeaderVals == nil { + ctx.SignedHeaderVals = make(http.Header) + } + + lowerCaseKey := strings.ToLower(k) + if _, ok := ctx.SignedHeaderVals[lowerCaseKey]; ok { + // include additional values + ctx.SignedHeaderVals[lowerCaseKey] = append(ctx.SignedHeaderVals[lowerCaseKey], v...) + continue + } + + headers = append(headers, lowerCaseKey) + ctx.SignedHeaderVals[lowerCaseKey] = v + } + sort.Strings(headers) + + ctx.signedHeaders = strings.Join(headers, ";") + + headerValues := make([]string, len(headers)) + for i, k := range headers { + if k == "host" { + if ctx.Request.Host != "" { + headerValues[i] = "host:" + ctx.Request.Host + } else { + headerValues[i] = "host:" + ctx.Request.URL.Host + } + } else { + headerValues[i] = k + ":" + + strings.Join(ctx.SignedHeaderVals[k], ",") + } + } + stripExcessSpaces(headerValues) + ctx.canonicalHeaders = strings.Join(headerValues, "\n") +} + +func (ctx *signingCtx) buildCanonicalString() { + uri := getURIPath(ctx.Request.URL) + + ctx.canonicalString = strings.Join([]string{ + ctx.Request.Method, + uri, + ctx.Request.URL.RawQuery, + ctx.canonicalHeaders + "\n", + ctx.signedHeaders, + ctx.bodyDigest, + }, "\n") +} + +func (ctx *signingCtx) buildStringToSign() { + ctx.stringToSign = strings.Join([]string{ + authHeaderPrefix, + ctx.formattedTime, + ctx.credentialString, + hex.EncodeToString(makeSha256([]byte(ctx.canonicalString))), + }, "\n") +} + +func (ctx *signingCtx) buildSignature() { + secret := ctx.credValues.SecretKey + date := makeHmac([]byte("JDCLOUD2"+secret), []byte(ctx.formattedShortTime)) + region := makeHmac(date, []byte(ctx.Region)) + service := makeHmac(region, []byte(ctx.ServiceName)) + credentials := makeHmac(service, []byte("jdcloud2_request")) + signature := makeHmac(credentials, []byte(ctx.stringToSign)) + ctx.signature = hex.EncodeToString(signature) +} + +func (ctx *signingCtx) buildBodyDigest() { + var hash string + if ctx.Body == nil { + hash = emptyStringSHA256 + } else { + hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) + } + + ctx.bodyDigest = hash +} + +// isRequestSigned returns if the request is currently signed or presigned +func (ctx *signingCtx) isRequestSigned() bool { + if ctx.Request.Header.Get("Authorization") != "" { + return true + } + + return false +} + +func makeHmac(key []byte, data []byte) []byte { + hash := hmac.New(sha256.New, key) + hash.Write(data) + return hash.Sum(nil) +} + +func makeSha256(data []byte) []byte { + hash := sha256.New() + hash.Write(data) + return hash.Sum(nil) +} + +func makeSha256Reader(reader io.ReadSeeker) []byte { + hash := sha256.New() + start, _ := reader.Seek(0, 1) + defer reader.Seek(start, 0) + + io.Copy(hash, reader) + return hash.Sum(nil) +} + +const doubleSpace = " " + +// stripExcessSpaces will rewrite the passed in slice's string values to not +// contain multiple side-by-side spaces. +func stripExcessSpaces(vals []string) { + var j, k, l, m, spaces int + for i, str := range vals { + // Trim trailing spaces + for j = len(str) - 1; j >= 0 && str[j] == ' '; j-- { + } + + // Trim leading spaces + for k = 0; k < j && str[k] == ' '; k++ { + } + str = str[k : j+1] + + // Strip multiple spaces. + j = strings.Index(str, doubleSpace) + if j < 0 { + vals[i] = str + continue + } + + buf := []byte(str) + for k, m, l = j, j, len(buf); k < l; k++ { + if buf[k] == ' ' { + if spaces == 0 { + // First space. + buf[m] = buf[k] + m++ + } + spaces++ + } else { + // End of multiple spaces. + spaces = 0 + buf[m] = buf[k] + m++ + } + } + + vals[i] = string(buf[:m]) + } +} + +func getURIPath(u *url.URL) string { + var uri string + + if len(u.Opaque) > 0 { + uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") + } else { + uri = u.EscapedPath() + } + + if len(uri) == 0 { + uri = "/" + } + + return uri +} + +func shouldIgnore(header string, ignoreHeaders []string) bool { + for _, v := range ignoreHeaders { + if v == header { + return true + } + } + return false +} + +// EscapePath escapes part of a URL path +func EscapePath(path string, encodeSep bool) string { + var buf bytes.Buffer + for i := 0; i < len(path); i++ { + c := path[i] + if noEscape[c] || (c == '/' && !encodeSep) { + buf.WriteByte(c) + } else { + fmt.Fprintf(&buf, "%%%02X", c) + } + } + return buf.String() +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Utils.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Utils.go new file mode 100644 index 000000000..62e2edbf4 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Utils.go @@ -0,0 +1,11 @@ +package core + +func includes(fields []string, field string) bool { + for _, v := range fields { + if v == field { + return true + } + } + + return false +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Version.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Version.go new file mode 100644 index 000000000..3bde9f3e9 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/core/Version.go @@ -0,0 +1,17 @@ +// Copyright 2018-2025 JDCLOUD.COM +// +// 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 core + +const Version = "1.1.3" diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models/Charge.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models/Charge.go new file mode 100644 index 000000000..c9669e0c5 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models/Charge.go @@ -0,0 +1,36 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Charge struct { + + /* 支付模式,取值为:prepaid_by_duration,postpaid_by_usage或postpaid_by_duration,prepaid_by_duration表示预付费,postpaid_by_usage表示按用量后付费,postpaid_by_duration表示按配置后付费,默认为postpaid_by_duration (Optional) */ + ChargeMode string `json:"chargeMode"` + + /* 费用支付状态,取值为:normal、overdue、arrear,normal表示正常,overdue表示已到期,arrear表示欠费 (Optional) */ + ChargeStatus string `json:"chargeStatus"` + + /* 计费开始时间,遵循ISO8601标准,使用UTC时间,格式为:YYYY-MM-DDTHH:mm:ssZ (Optional) */ + ChargeStartTime string `json:"chargeStartTime"` + + /* 过期时间,预付费资源的到期时间,遵循ISO8601标准,使用UTC时间,格式为:YYYY-MM-DDTHH:mm:ssZ,后付费资源此字段内容为空 (Optional) */ + ChargeExpiredTime string `json:"chargeExpiredTime"` + + /* 预期释放时间,资源的预期释放时间,预付费/后付费资源均有此值,遵循ISO8601标准,使用UTC时间,格式为:YYYY-MM-DDTHH:mm:ssZ (Optional) */ + ChargeRetireTime string `json:"chargeRetireTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models/ChargeSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models/ChargeSpec.go new file mode 100644 index 000000000..32169444e --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models/ChargeSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ChargeSpec struct { + + /* 计费模式,取值为:prepaid_by_duration,postpaid_by_usage或postpaid_by_duration,prepaid_by_duration表示预付费,postpaid_by_usage表示按用量后付费,postpaid_by_duration表示按配置后付费,默认为postpaid_by_duration (Optional) */ + ChargeMode *string `json:"chargeMode"` + + /* 预付费计费单位,当chargeMode为prepaid_by_duration时有效,取值为:month、year,默认为month (Optional) */ + ChargeUnit *string `json:"chargeUnit"` + + /* 预付费计费时长,当chargeMode取值为prepaid_by_duration时有效。当chargeUnit为month时取值为:1~9,当chargeUnit为year时取值为:1、2、3 (Optional) */ + ChargeDuration *int `json:"chargeDuration"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/Filter.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/Filter.go new file mode 100644 index 000000000..e89325aed --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/Filter.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Filter struct { + + /* 过滤条件的名称 */ + Name string `json:"name"` + + /* 过滤条件的操作符,默认eq (Optional) */ + Operator *string `json:"operator"` + + /* 过滤条件的值 */ + Values []string `json:"values"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/Quota.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/Quota.go new file mode 100644 index 000000000..a9553732c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/Quota.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Quota struct { + + /* 配额项的名称 (Optional) */ + Name string `json:"name"` + + /* 配额 (Optional) */ + Max int `json:"max"` + + /* 已使用的数目 (Optional) */ + Used int `json:"used"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/SimpleResponses.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/SimpleResponses.go new file mode 100644 index 000000000..dcc6059fd --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/SimpleResponses.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type SimpleResponses struct { + + /* Request ID (Optional) */ + RequestId string `json:"requestId"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/Sort.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/Sort.go new file mode 100644 index 000000000..b99a1853a --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/Sort.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Sort struct { + + /* 排序条件的名称 (Optional) */ + Name *string `json:"name"` + + /* 排序条件的方向 (Optional) */ + Direction *string `json:"direction"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/TagFilter.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/TagFilter.go new file mode 100644 index 000000000..60e1f0774 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/common/models/TagFilter.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type TagFilter struct { + + /* Tag键 */ + Key string `json:"key"` + + /* Tag值 */ + Values []string `json:"values"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Disk.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Disk.go new file mode 100644 index 000000000..27a2f0a2a --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Disk.go @@ -0,0 +1,73 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import charge "github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models" + +type Disk struct { + + /* 云硬盘ID (Optional) */ + DiskId string `json:"diskId"` + + /* 云硬盘所属AZ (Optional) */ + Az string `json:"az"` + + /* 云硬盘名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) */ + Name string `json:"name"` + + /* 云硬盘描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description string `json:"description"` + + /* 云硬盘类型,取值为 ssd,premium-hdd,ssd.gp1,ssd.io1,hdd.std1 (Optional) */ + DiskType string `json:"diskType"` + + /* 云硬盘大小,单位为 GiB (Optional) */ + DiskSizeGB int `json:"diskSizeGB"` + + /* 该云硬盘实际应用的iops值 (Optional) */ + Iops int `json:"iops"` + + /* 该云硬盘实际应用的吞吐量的数值 (Optional) */ + Throughput int `json:"throughput"` + + /* 云硬盘状态,取值为 creating、available、in-use、extending、restoring、deleting、deleted、error_create、error_delete、error_restore、error_extend 之一 (Optional) */ + Status string `json:"status"` + + /* 挂载信息 (Optional) */ + Attachments []DiskAttachment `json:"attachments"` + + /* 创建该云硬盘的快照ID (Optional) */ + SnapshotId string `json:"snapshotId"` + + /* 云盘是否支持多挂载 (Optional) */ + MultiAttachable bool `json:"multiAttachable"` + + /* 云盘是否为加密盘 (Optional) */ + Encrypted bool `json:"encrypted"` + + /* 云盘是否被暂停(IOPS限制为极低) (Optional) */ + Enable bool `json:"enable"` + + /* 创建云硬盘时间 (Optional) */ + CreateTime string `json:"createTime"` + + /* 云硬盘计费配置信息 (Optional) */ + Charge charge.Charge `json:"charge"` + + /* Tag信息 (Optional) */ + Tags []Tag `json:"tags"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/DiskAttachment.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/DiskAttachment.go new file mode 100644 index 000000000..220f3a51f --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/DiskAttachment.go @@ -0,0 +1,39 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type DiskAttachment struct { + + /* 挂载ID (Optional) */ + AttachmentId string `json:"attachmentId"` + + /* 云硬盘ID (Optional) */ + DiskId string `json:"diskId"` + + /* 挂载实例的类型,取值为 vm、nc (Optional) */ + InstanceType string `json:"instanceType"` + + /* 挂载实例的ID (Optional) */ + InstanceId string `json:"instanceId"` + + /* 挂载状态,取值为 "attaching", "attached", "detaching", "detached" (Optional) */ + Status string `json:"status"` + + /* 挂载时间 (Optional) */ + AttachTime string `json:"attachTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/DiskSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/DiskSpec.go new file mode 100644 index 000000000..c694ebf82 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/DiskSpec.go @@ -0,0 +1,49 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import charge "github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models" + +type DiskSpec struct { + + /* 云硬盘所属的可用区 */ + Az string `json:"az"` + + /* 云硬盘名称 */ + Name string `json:"name"` + + /* 云硬盘描述 (Optional) */ + Description *string `json:"description"` + + /* 云硬盘类型,取值为ssd、premium-hdd、ssd.gp1、ssd.io1、hdd.std1之一 */ + DiskType string `json:"diskType"` + + /* 云硬盘大小,单位为 GiB,ssd 类型取值范围[20,1000]GB,步长为10G,premium-hdd 类型取值范围[20,3000]GB,步长为10G */ + DiskSizeGB int `json:"diskSizeGB"` + + /* 用于创建云硬盘的快照ID (Optional) */ + SnapshotId *string `json:"snapshotId"` + + /* 计费配置;如不指定,默认计费类型是后付费-按使用时常付费 (Optional) */ + Charge *charge.ChargeSpec `json:"charge"` + + /* 云硬盘是否支持一盘多主机挂载,默认为false(不支持) (Optional) */ + MultiAttachable *bool `json:"multiAttachable"` + + /* 云硬盘是否加密,默认为false(不加密) (Optional) */ + Encrypt *bool `json:"encrypt"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/DiskSpecification.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/DiskSpecification.go new file mode 100644 index 000000000..8f439a49e --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/DiskSpecification.go @@ -0,0 +1,54 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type DiskSpecification struct { + + /* 云硬盘类型 (Optional) */ + DiskType string `json:"diskType"` + + /* 支持的最小尺寸,单位为 GiB (Optional) */ + MinSizeGB int `json:"minSizeGB"` + + /* 支持的最大尺寸,单位为 GiB (Optional) */ + MaxSizeGB int `json:"maxSizeGB"` + + /* 步长尺寸,单位为 GiB (Optional) */ + StepSizeGB int `json:"stepSizeGB"` + + /* 描述信息 (Optional) */ + Description string `json:"description"` + + /* 默认的iops数量(基础iops数量) (Optional) */ + DefaultIOPS int `json:"defaultIOPS"` + + /* iops步长增量 (Optional) */ + StepIOPS float32 `json:"stepIOPS"` + + /* 最大iops数量 (Optional) */ + MaxIOPS int `json:"maxIOPS"` + + /* 默认的吞吐量 (Optional) */ + DefaultThroughput int `json:"defaultThroughput"` + + /* 吞吐量步长增量 (Optional) */ + StepThroughput float32 `json:"stepThroughput"` + + /* 最大吞吐量 (Optional) */ + MaxThroughput int `json:"maxThroughput"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Quota.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Quota.go new file mode 100644 index 000000000..4f318f4a0 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Quota.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Quota struct { + + /* 配额 (Optional) */ + Limit int `json:"limit"` + + /* 已使用的数目 (Optional) */ + Used int `json:"used"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/ShareInfo.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/ShareInfo.go new file mode 100644 index 000000000..70f5df781 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/ShareInfo.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ShareInfo struct { + + /* 被共享快照的用户的pin (Optional) */ + ShareTo string `json:"shareTo"` + + /* 共享时间 (Optional) */ + ShareTime string `json:"shareTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Snapshot.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Snapshot.go new file mode 100644 index 000000000..12a3bbf94 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Snapshot.go @@ -0,0 +1,54 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Snapshot struct { + + /* 云硬盘快照ID (Optional) */ + SnapshotId string `json:"snapshotId"` + + /* 快照来源 可以有self,others两种来源 (Optional) */ + SnapshotSource string `json:"snapshotSource"` + + /* 创建快照的云硬盘ID(snapshotSource为others时不展示) (Optional) */ + DiskId string `json:"diskId"` + + /* 快照大小,单位为GiB (Optional) */ + SnapshotSizeGB int `json:"snapshotSizeGB"` + + /* 快照关联的所有镜像ID(snapshotSource为others时不展示) (Optional) */ + Images []string `json:"images"` + + /* 快照名称 (Optional) */ + Name string `json:"name"` + + /* 快照描述 (Optional) */ + Description string `json:"description"` + + /* 快照状态,取值为 creating、available、in-use、deleting、error_create、error_delete 之一 (Optional) */ + Status string `json:"status"` + + /* 创建时间 (Optional) */ + CreateTime string `json:"createTime"` + + /* 共享信息 (Optional) */ + SharInfo []ShareInfo `json:"sharInfo"` + + /* 快照是否为加密盘的快照 (Optional) */ + Encrypted bool `json:"encrypted"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/SnapshotSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/SnapshotSpec.go new file mode 100644 index 000000000..0918fa64a --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/SnapshotSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type SnapshotSpec struct { + + /* 快照名称 */ + Name string `json:"name"` + + /* 快照描述 (Optional) */ + Description *string `json:"description"` + + /* 用于创建快照的云盘ID */ + DiskId string `json:"diskId"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Soldout.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Soldout.go new file mode 100644 index 000000000..587bbdf25 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Soldout.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Soldout struct { + + /* 云硬盘所属的可用区 */ + AzName string `json:"azName"` + + /* 云硬盘类型,取值为ssd、premium-hdd、ssd.gp1、ssd.io1、hdd.std1之一 */ + MediaType string `json:"mediaType"` + + /* 是否售罄 */ + IsSoldOut bool `json:"isSoldOut"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Tag.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Tag.go new file mode 100644 index 000000000..467465457 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/Tag.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Tag struct { + + /* Tag键 (Optional) */ + Key string `json:"key"` + + /* Tag值 (Optional) */ + Value string `json:"value"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/TagFilter.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/TagFilter.go new file mode 100644 index 000000000..60e1f0774 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models/TagFilter.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type TagFilter struct { + + /* Tag键 */ + Key string `json:"key"` + + /* Tag值 */ + Values []string `json:"values"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/AssociateElasticIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/AssociateElasticIp.go new file mode 100644 index 000000000..c562811b1 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/AssociateElasticIp.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type AssociateElasticIpRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 弹性公网IP的ID */ + ElasticIpId string `json:"elasticIpId"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param elasticIpId: 弹性公网IP的ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAssociateElasticIpRequest( + regionId string, + instanceId string, + elasticIpId string, +) *AssociateElasticIpRequest { + + return &AssociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:associateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + ElasticIpId: elasticIpId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param elasticIpId: 弹性公网IP的ID (Required) + */ +func NewAssociateElasticIpRequestWithAllParams( + regionId string, + instanceId string, + elasticIpId string, +) *AssociateElasticIpRequest { + + return &AssociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:associateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + ElasticIpId: elasticIpId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAssociateElasticIpRequestWithoutParam() *AssociateElasticIpRequest { + + return &AssociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:associateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *AssociateElasticIpRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *AssociateElasticIpRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param elasticIpId: 弹性公网IP的ID(Required) */ +func (r *AssociateElasticIpRequest) SetElasticIpId(elasticIpId string) { + r.ElasticIpId = elasticIpId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AssociateElasticIpRequest) GetRegionId() string { + return r.RegionId +} + +type AssociateElasticIpResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AssociateElasticIpResult `json:"result"` +} + +type AssociateElasticIpResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/AttachDisk.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/AttachDisk.go new file mode 100644 index 000000000..e699d8ea5 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/AttachDisk.go @@ -0,0 +1,150 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type AttachDiskRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 云硬盘ID */ + DiskId string `json:"diskId"` + + /* 数据盘的逻辑挂载点[vda,vdb,vdc,vdd,vde,vdf,vdg,vdh,vdi],挂载系统盘时vda必传 (Optional) */ + DeviceName *string `json:"deviceName"` + + /* 自动随主机删除此云硬盘,默认为False。仅按配置计费云硬盘支持修改此参数,包年包月云硬盘默认为False且不可修改。如果是共享型云硬盘,此参数无效。 (Optional) */ + AutoDelete *bool `json:"autoDelete"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param diskId: 云硬盘ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAttachDiskRequest( + regionId string, + instanceId string, + diskId string, +) *AttachDiskRequest { + + return &AttachDiskRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:attachDisk", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + DiskId: diskId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param diskId: 云硬盘ID (Required) + * param deviceName: 数据盘的逻辑挂载点[vda,vdb,vdc,vdd,vde,vdf,vdg,vdh,vdi],挂载系统盘时vda必传 (Optional) + * param autoDelete: 自动随主机删除此云硬盘,默认为False。仅按配置计费云硬盘支持修改此参数,包年包月云硬盘默认为False且不可修改。如果是共享型云硬盘,此参数无效。 (Optional) + */ +func NewAttachDiskRequestWithAllParams( + regionId string, + instanceId string, + diskId string, + deviceName *string, + autoDelete *bool, +) *AttachDiskRequest { + + return &AttachDiskRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:attachDisk", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + DiskId: diskId, + DeviceName: deviceName, + AutoDelete: autoDelete, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAttachDiskRequestWithoutParam() *AttachDiskRequest { + + return &AttachDiskRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:attachDisk", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *AttachDiskRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *AttachDiskRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param diskId: 云硬盘ID(Required) */ +func (r *AttachDiskRequest) SetDiskId(diskId string) { + r.DiskId = diskId +} + +/* param deviceName: 数据盘的逻辑挂载点[vda,vdb,vdc,vdd,vde,vdf,vdg,vdh,vdi],挂载系统盘时vda必传(Optional) */ +func (r *AttachDiskRequest) SetDeviceName(deviceName string) { + r.DeviceName = &deviceName +} + +/* param autoDelete: 自动随主机删除此云硬盘,默认为False。仅按配置计费云硬盘支持修改此参数,包年包月云硬盘默认为False且不可修改。如果是共享型云硬盘,此参数无效。(Optional) */ +func (r *AttachDiskRequest) SetAutoDelete(autoDelete bool) { + r.AutoDelete = &autoDelete +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AttachDiskRequest) GetRegionId() string { + return r.RegionId +} + +type AttachDiskResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AttachDiskResult `json:"result"` +} + +type AttachDiskResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/AttachNetworkInterface.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/AttachNetworkInterface.go new file mode 100644 index 000000000..75c7720fd --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/AttachNetworkInterface.go @@ -0,0 +1,139 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type AttachNetworkInterfaceRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 弹性网卡ID */ + NetworkInterfaceId string `json:"networkInterfaceId"` + + /* 随主机自动删除,默认为False (Optional) */ + AutoDelete *bool `json:"autoDelete"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param networkInterfaceId: 弹性网卡ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAttachNetworkInterfaceRequest( + regionId string, + instanceId string, + networkInterfaceId string, +) *AttachNetworkInterfaceRequest { + + return &AttachNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:attachNetworkInterface", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param networkInterfaceId: 弹性网卡ID (Required) + * param autoDelete: 随主机自动删除,默认为False (Optional) + */ +func NewAttachNetworkInterfaceRequestWithAllParams( + regionId string, + instanceId string, + networkInterfaceId string, + autoDelete *bool, +) *AttachNetworkInterfaceRequest { + + return &AttachNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:attachNetworkInterface", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + NetworkInterfaceId: networkInterfaceId, + AutoDelete: autoDelete, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAttachNetworkInterfaceRequestWithoutParam() *AttachNetworkInterfaceRequest { + + return &AttachNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:attachNetworkInterface", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *AttachNetworkInterfaceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *AttachNetworkInterfaceRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param networkInterfaceId: 弹性网卡ID(Required) */ +func (r *AttachNetworkInterfaceRequest) SetNetworkInterfaceId(networkInterfaceId string) { + r.NetworkInterfaceId = networkInterfaceId +} + +/* param autoDelete: 随主机自动删除,默认为False(Optional) */ +func (r *AttachNetworkInterfaceRequest) SetAutoDelete(autoDelete bool) { + r.AutoDelete = &autoDelete +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AttachNetworkInterfaceRequest) GetRegionId() string { + return r.RegionId +} + +type AttachNetworkInterfaceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AttachNetworkInterfaceResult `json:"result"` +} + +type AttachNetworkInterfaceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CopyImages.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CopyImages.go new file mode 100644 index 000000000..a6c82e8e7 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CopyImages.go @@ -0,0 +1,130 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type CopyImagesRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 源镜像ID */ + SourceImageIds []string `json:"sourceImageIds"` + + /* 目标区域 */ + DestinationRegion string `json:"destinationRegion"` +} + +/* + * param regionId: 地域ID (Required) + * param sourceImageIds: 源镜像ID (Required) + * param destinationRegion: 目标区域 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCopyImagesRequest( + regionId string, + sourceImageIds []string, + destinationRegion string, +) *CopyImagesRequest { + + return &CopyImagesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images:copyImages", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SourceImageIds: sourceImageIds, + DestinationRegion: destinationRegion, + } +} + +/* + * param regionId: 地域ID (Required) + * param sourceImageIds: 源镜像ID (Required) + * param destinationRegion: 目标区域 (Required) + */ +func NewCopyImagesRequestWithAllParams( + regionId string, + sourceImageIds []string, + destinationRegion string, +) *CopyImagesRequest { + + return &CopyImagesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images:copyImages", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SourceImageIds: sourceImageIds, + DestinationRegion: destinationRegion, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCopyImagesRequestWithoutParam() *CopyImagesRequest { + + return &CopyImagesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images:copyImages", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *CopyImagesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param sourceImageIds: 源镜像ID(Required) */ +func (r *CopyImagesRequest) SetSourceImageIds(sourceImageIds []string) { + r.SourceImageIds = sourceImageIds +} + +/* param destinationRegion: 目标区域(Required) */ +func (r *CopyImagesRequest) SetDestinationRegion(destinationRegion string) { + r.DestinationRegion = destinationRegion +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CopyImagesRequest) GetRegionId() string { + return r.RegionId +} + +type CopyImagesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CopyImagesResult `json:"result"` +} + +type CopyImagesResult struct { + CopyImages []vm.CopyImage `json:"copyImages"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CreateImage.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CreateImage.go new file mode 100644 index 000000000..f9274a996 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CreateImage.go @@ -0,0 +1,155 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type CreateImageRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 镜像名称,参考公共参数规范。 */ + Name string `json:"name"` + + /* 镜像描述,参考公共参数规范。 */ + Description string `json:"description"` + + /* 数据盘列表,可以在实例已挂载数据盘的基础上,额外增加新的快照、空盘、或排除云主机中的数据盘。 (Optional) */ + DataDisks []vm.InstanceDiskAttachmentSpec `json:"dataDisks"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param name: 镜像名称,参考公共参数规范。 (Required) + * param description: 镜像描述,参考公共参数规范。 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateImageRequest( + regionId string, + instanceId string, + name string, + description string, +) *CreateImageRequest { + + return &CreateImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:createImage", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + Name: name, + Description: description, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param name: 镜像名称,参考公共参数规范。 (Required) + * param description: 镜像描述,参考公共参数规范。 (Required) + * param dataDisks: 数据盘列表,可以在实例已挂载数据盘的基础上,额外增加新的快照、空盘、或排除云主机中的数据盘。 (Optional) + */ +func NewCreateImageRequestWithAllParams( + regionId string, + instanceId string, + name string, + description string, + dataDisks []vm.InstanceDiskAttachmentSpec, +) *CreateImageRequest { + + return &CreateImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:createImage", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + Name: name, + Description: description, + DataDisks: dataDisks, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateImageRequestWithoutParam() *CreateImageRequest { + + return &CreateImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:createImage", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *CreateImageRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *CreateImageRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param name: 镜像名称,参考公共参数规范。(Required) */ +func (r *CreateImageRequest) SetName(name string) { + r.Name = name +} + +/* param description: 镜像描述,参考公共参数规范。(Required) */ +func (r *CreateImageRequest) SetDescription(description string) { + r.Description = description +} + +/* param dataDisks: 数据盘列表,可以在实例已挂载数据盘的基础上,额外增加新的快照、空盘、或排除云主机中的数据盘。(Optional) */ +func (r *CreateImageRequest) SetDataDisks(dataDisks []vm.InstanceDiskAttachmentSpec) { + r.DataDisks = dataDisks +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateImageRequest) GetRegionId() string { + return r.RegionId +} + +type CreateImageResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateImageResult `json:"result"` +} + +type CreateImageResult struct { + ImageId string `json:"imageId"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CreateInstances.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CreateInstances.go new file mode 100644 index 000000000..f5d342dc0 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CreateInstances.go @@ -0,0 +1,148 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type CreateInstancesRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 描述云主机配置 + */ + InstanceSpec *vm.InstanceSpec `json:"instanceSpec"` + + /* 购买云主机的数量;取值范围:[1,100],默认为1。 + (Optional) */ + MaxCount *int `json:"maxCount"` + + /* 用于保证请求的幂等性。由客户端生成,长度不能超过64个字符。 + (Optional) */ + ClientToken *string `json:"clientToken"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceSpec: 描述云主机配置 + (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateInstancesRequest( + regionId string, + instanceSpec *vm.InstanceSpec, +) *CreateInstancesRequest { + + return &CreateInstancesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceSpec: instanceSpec, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceSpec: 描述云主机配置 + (Required) + * param maxCount: 购买云主机的数量;取值范围:[1,100],默认为1。 + (Optional) + * param clientToken: 用于保证请求的幂等性。由客户端生成,长度不能超过64个字符。 + (Optional) + */ +func NewCreateInstancesRequestWithAllParams( + regionId string, + instanceSpec *vm.InstanceSpec, + maxCount *int, + clientToken *string, +) *CreateInstancesRequest { + + return &CreateInstancesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceSpec: instanceSpec, + MaxCount: maxCount, + ClientToken: clientToken, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateInstancesRequestWithoutParam() *CreateInstancesRequest { + + return &CreateInstancesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *CreateInstancesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceSpec: 描述云主机配置 +(Required) */ +func (r *CreateInstancesRequest) SetInstanceSpec(instanceSpec *vm.InstanceSpec) { + r.InstanceSpec = instanceSpec +} + +/* param maxCount: 购买云主机的数量;取值范围:[1,100],默认为1。 +(Optional) */ +func (r *CreateInstancesRequest) SetMaxCount(maxCount int) { + r.MaxCount = &maxCount +} + +/* param clientToken: 用于保证请求的幂等性。由客户端生成,长度不能超过64个字符。 +(Optional) */ +func (r *CreateInstancesRequest) SetClientToken(clientToken string) { + r.ClientToken = &clientToken +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateInstancesRequest) GetRegionId() string { + return r.RegionId +} + +type CreateInstancesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateInstancesResult `json:"result"` +} + +type CreateInstancesResult struct { + InstanceIds []string `json:"instanceIds"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CreateKeypair.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CreateKeypair.go new file mode 100644 index 000000000..6ffeee01c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/CreateKeypair.go @@ -0,0 +1,121 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type CreateKeypairRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 密钥对名称,需要全局唯一。只允许数字、大小写字母、下划线“_”及中划线“-”,不超过32个字符。 + */ + KeyName string `json:"keyName"` +} + +/* + * param regionId: 地域ID (Required) + * param keyName: 密钥对名称,需要全局唯一。只允许数字、大小写字母、下划线“_”及中划线“-”,不超过32个字符。 + (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateKeypairRequest( + regionId string, + keyName string, +) *CreateKeypairRequest { + + return &CreateKeypairRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + KeyName: keyName, + } +} + +/* + * param regionId: 地域ID (Required) + * param keyName: 密钥对名称,需要全局唯一。只允许数字、大小写字母、下划线“_”及中划线“-”,不超过32个字符。 + (Required) + */ +func NewCreateKeypairRequestWithAllParams( + regionId string, + keyName string, +) *CreateKeypairRequest { + + return &CreateKeypairRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + KeyName: keyName, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateKeypairRequestWithoutParam() *CreateKeypairRequest { + + return &CreateKeypairRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *CreateKeypairRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param keyName: 密钥对名称,需要全局唯一。只允许数字、大小写字母、下划线“_”及中划线“-”,不超过32个字符。 +(Required) */ +func (r *CreateKeypairRequest) SetKeyName(keyName string) { + r.KeyName = keyName +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateKeypairRequest) GetRegionId() string { + return r.RegionId +} + +type CreateKeypairResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateKeypairResult `json:"result"` +} + +type CreateKeypairResult struct { + KeyName string `json:"keyName"` + PrivateKey string `json:"privateKey"` + KeyFingerprint string `json:"keyFingerprint"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DeleteImage.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DeleteImage.go new file mode 100644 index 000000000..3496eace4 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DeleteImage.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteImageRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 镜像ID */ + ImageId string `json:"imageId"` +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteImageRequest( + regionId string, + imageId string, +) *DeleteImageRequest { + + return &DeleteImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + */ +func NewDeleteImageRequestWithAllParams( + regionId string, + imageId string, +) *DeleteImageRequest { + + return &DeleteImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteImageRequestWithoutParam() *DeleteImageRequest { + + return &DeleteImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DeleteImageRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param imageId: 镜像ID(Required) */ +func (r *DeleteImageRequest) SetImageId(imageId string) { + r.ImageId = imageId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteImageRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteImageResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteImageResult `json:"result"` +} + +type DeleteImageResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DeleteInstance.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DeleteInstance.go new file mode 100644 index 000000000..6482ece51 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DeleteInstance.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteInstanceRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteInstanceRequest( + regionId string, + instanceId string, +) *DeleteInstanceRequest { + + return &DeleteInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + */ +func NewDeleteInstanceRequestWithAllParams( + regionId string, + instanceId string, +) *DeleteInstanceRequest { + + return &DeleteInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteInstanceRequestWithoutParam() *DeleteInstanceRequest { + + return &DeleteInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DeleteInstanceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *DeleteInstanceRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteInstanceRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteInstanceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteInstanceResult `json:"result"` +} + +type DeleteInstanceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DeleteKeypair.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DeleteKeypair.go new file mode 100644 index 000000000..ddac09b04 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DeleteKeypair.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteKeypairRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 密钥名称 */ + KeyName string `json:"keyName"` +} + +/* + * param regionId: 地域ID (Required) + * param keyName: 密钥名称 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteKeypairRequest( + regionId string, + keyName string, +) *DeleteKeypairRequest { + + return &DeleteKeypairRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs/{keyName}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + KeyName: keyName, + } +} + +/* + * param regionId: 地域ID (Required) + * param keyName: 密钥名称 (Required) + */ +func NewDeleteKeypairRequestWithAllParams( + regionId string, + keyName string, +) *DeleteKeypairRequest { + + return &DeleteKeypairRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs/{keyName}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + KeyName: keyName, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteKeypairRequestWithoutParam() *DeleteKeypairRequest { + + return &DeleteKeypairRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs/{keyName}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DeleteKeypairRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param keyName: 密钥名称(Required) */ +func (r *DeleteKeypairRequest) SetKeyName(keyName string) { + r.KeyName = keyName +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteKeypairRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteKeypairResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteKeypairResult `json:"result"` +} + +type DeleteKeypairResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImage.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImage.go new file mode 100644 index 000000000..14b9b1709 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImage.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type DescribeImageRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 镜像ID */ + ImageId string `json:"imageId"` +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeImageRequest( + regionId string, + imageId string, +) *DescribeImageRequest { + + return &DescribeImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + */ +func NewDescribeImageRequestWithAllParams( + regionId string, + imageId string, +) *DescribeImageRequest { + + return &DescribeImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeImageRequestWithoutParam() *DescribeImageRequest { + + return &DescribeImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeImageRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param imageId: 镜像ID(Required) */ +func (r *DescribeImageRequest) SetImageId(imageId string) { + r.ImageId = imageId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeImageRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeImageResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeImageResult `json:"result"` +} + +type DescribeImageResult struct { + Image vm.Image `json:"image"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImageConstraints.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImageConstraints.go new file mode 100644 index 000000000..8011469e2 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImageConstraints.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type DescribeImageConstraintsRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 镜像ID */ + ImageId string `json:"imageId"` +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeImageConstraintsRequest( + regionId string, + imageId string, +) *DescribeImageConstraintsRequest { + + return &DescribeImageConstraintsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}/constraints", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + */ +func NewDescribeImageConstraintsRequestWithAllParams( + regionId string, + imageId string, +) *DescribeImageConstraintsRequest { + + return &DescribeImageConstraintsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}/constraints", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeImageConstraintsRequestWithoutParam() *DescribeImageConstraintsRequest { + + return &DescribeImageConstraintsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}/constraints", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeImageConstraintsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param imageId: 镜像ID(Required) */ +func (r *DescribeImageConstraintsRequest) SetImageId(imageId string) { + r.ImageId = imageId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeImageConstraintsRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeImageConstraintsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeImageConstraintsResult `json:"result"` +} + +type DescribeImageConstraintsResult struct { + ImageConstraints vm.ImageConstraint `json:"imageConstraints"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImageConstraintsBatch.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImageConstraintsBatch.go new file mode 100644 index 000000000..f0a968cc1 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImageConstraintsBatch.go @@ -0,0 +1,113 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type DescribeImageConstraintsBatchRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 镜像ID列表 (Optional) */ + Ids []string `json:"ids"` +} + +/* + * param regionId: 地域ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeImageConstraintsBatchRequest( + regionId string, +) *DescribeImageConstraintsBatchRequest { + + return &DescribeImageConstraintsBatchRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/imageConstraints", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: 地域ID (Required) + * param ids: 镜像ID列表 (Optional) + */ +func NewDescribeImageConstraintsBatchRequestWithAllParams( + regionId string, + ids []string, +) *DescribeImageConstraintsBatchRequest { + + return &DescribeImageConstraintsBatchRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/imageConstraints", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + Ids: ids, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeImageConstraintsBatchRequestWithoutParam() *DescribeImageConstraintsBatchRequest { + + return &DescribeImageConstraintsBatchRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/imageConstraints", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeImageConstraintsBatchRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param ids: 镜像ID列表(Optional) */ +func (r *DescribeImageConstraintsBatchRequest) SetIds(ids []string) { + r.Ids = ids +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeImageConstraintsBatchRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeImageConstraintsBatchResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeImageConstraintsBatchResult `json:"result"` +} + +type DescribeImageConstraintsBatchResult struct { + ImageConstraints []vm.ImageConstraint `json:"imageConstraints"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImageMembers.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImageMembers.go new file mode 100644 index 000000000..b4374fad7 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImageMembers.go @@ -0,0 +1,115 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DescribeImageMembersRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 镜像ID */ + ImageId string `json:"imageId"` +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeImageMembersRequest( + regionId string, + imageId string, +) *DescribeImageMembersRequest { + + return &DescribeImageMembersRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}/members", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + */ +func NewDescribeImageMembersRequestWithAllParams( + regionId string, + imageId string, +) *DescribeImageMembersRequest { + + return &DescribeImageMembersRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}/members", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeImageMembersRequestWithoutParam() *DescribeImageMembersRequest { + + return &DescribeImageMembersRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}/members", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeImageMembersRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param imageId: 镜像ID(Required) */ +func (r *DescribeImageMembersRequest) SetImageId(imageId string) { + r.ImageId = imageId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeImageMembersRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeImageMembersResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeImageMembersResult `json:"result"` +} + +type DescribeImageMembersResult struct { + Pins []string `json:"pins"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImages.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImages.go new file mode 100644 index 000000000..01e89cf65 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeImages.go @@ -0,0 +1,180 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type DescribeImagesRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 镜像来源,如果没有指定ids参数,此参数必传;取值范围:public、shared、thirdparty、private (Optional) */ + ImageSource *string `json:"imageSource"` + + /* 操作系统平台,取值范围:Windows Server、CentOS、Ubuntu (Optional) */ + Platform *string `json:"platform"` + + /* 镜像ID列表,如果指定了此参数,其它参数可为空 (Optional) */ + Ids []string `json:"ids"` + + /* 镜像支持的系统盘类型,[localDisk,cloudDisk] (Optional) */ + RootDeviceType *string `json:"rootDeviceType"` + + /* 参考镜像状态 (Optional) */ + Status *string `json:"status"` + + /* 页码;默认为1 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小;默认为20;取值范围[10, 100] (Optional) */ + PageSize *int `json:"pageSize"` +} + +/* + * param regionId: 地域ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeImagesRequest( + regionId string, +) *DescribeImagesRequest { + + return &DescribeImagesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: 地域ID (Required) + * param imageSource: 镜像来源,如果没有指定ids参数,此参数必传;取值范围:public、shared、thirdparty、private (Optional) + * param platform: 操作系统平台,取值范围:Windows Server、CentOS、Ubuntu (Optional) + * param ids: 镜像ID列表,如果指定了此参数,其它参数可为空 (Optional) + * param rootDeviceType: 镜像支持的系统盘类型,[localDisk,cloudDisk] (Optional) + * param status: 参考镜像状态 (Optional) + * param pageNumber: 页码;默认为1 (Optional) + * param pageSize: 分页大小;默认为20;取值范围[10, 100] (Optional) + */ +func NewDescribeImagesRequestWithAllParams( + regionId string, + imageSource *string, + platform *string, + ids []string, + rootDeviceType *string, + status *string, + pageNumber *int, + pageSize *int, +) *DescribeImagesRequest { + + return &DescribeImagesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageSource: imageSource, + Platform: platform, + Ids: ids, + RootDeviceType: rootDeviceType, + Status: status, + PageNumber: pageNumber, + PageSize: pageSize, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeImagesRequestWithoutParam() *DescribeImagesRequest { + + return &DescribeImagesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeImagesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param imageSource: 镜像来源,如果没有指定ids参数,此参数必传;取值范围:public、shared、thirdparty、private(Optional) */ +func (r *DescribeImagesRequest) SetImageSource(imageSource string) { + r.ImageSource = &imageSource +} + +/* param platform: 操作系统平台,取值范围:Windows Server、CentOS、Ubuntu(Optional) */ +func (r *DescribeImagesRequest) SetPlatform(platform string) { + r.Platform = &platform +} + +/* param ids: 镜像ID列表,如果指定了此参数,其它参数可为空(Optional) */ +func (r *DescribeImagesRequest) SetIds(ids []string) { + r.Ids = ids +} + +/* param rootDeviceType: 镜像支持的系统盘类型,[localDisk,cloudDisk](Optional) */ +func (r *DescribeImagesRequest) SetRootDeviceType(rootDeviceType string) { + r.RootDeviceType = &rootDeviceType +} + +/* param status: 参考镜像状态(Optional) */ +func (r *DescribeImagesRequest) SetStatus(status string) { + r.Status = &status +} + +/* param pageNumber: 页码;默认为1(Optional) */ +func (r *DescribeImagesRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小;默认为20;取值范围[10, 100](Optional) */ +func (r *DescribeImagesRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeImagesRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeImagesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeImagesResult `json:"result"` +} + +type DescribeImagesResult struct { + Images []vm.Image `json:"images"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstance.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstance.go new file mode 100644 index 000000000..84eb194e0 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstance.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type DescribeInstanceRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeInstanceRequest( + regionId string, + instanceId string, +) *DescribeInstanceRequest { + + return &DescribeInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + */ +func NewDescribeInstanceRequestWithAllParams( + regionId string, + instanceId string, +) *DescribeInstanceRequest { + + return &DescribeInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeInstanceRequestWithoutParam() *DescribeInstanceRequest { + + return &DescribeInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeInstanceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *DescribeInstanceRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeInstanceRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeInstanceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeInstanceResult `json:"result"` +} + +type DescribeInstanceResult struct { + Instance vm.Instance `json:"instance"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstancePrivateIpAddress.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstancePrivateIpAddress.go new file mode 100644 index 000000000..457d57089 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstancePrivateIpAddress.go @@ -0,0 +1,161 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeInstancePrivateIpAddressRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 页码;默认为1 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小;默认为20;取值范围[10, 100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* instanceId - 云主机ID,精确匹配,支持多个 +privateIpAddress - 主网卡内网主IP地址,模糊匹配,支持多个 +vpcId - 私有网络ID,精确匹配,支持多个 +status - 云主机状态,精确匹配,支持多个,参考云主机状态 +name - 云主机名称,模糊匹配,支持单个 +imageId - 镜像ID,精确匹配,支持多个 +networkInterfaceId - 弹性网卡ID,精确匹配,支持多个 +subnetId - 子网ID,精确匹配,支持多个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: 地域ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeInstancePrivateIpAddressRequest( + regionId string, +) *DescribeInstancePrivateIpAddressRequest { + + return &DescribeInstancePrivateIpAddressRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instancePrivateIpAddress", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: 地域ID (Required) + * param pageNumber: 页码;默认为1 (Optional) + * param pageSize: 分页大小;默认为20;取值范围[10, 100] (Optional) + * param filters: instanceId - 云主机ID,精确匹配,支持多个 +privateIpAddress - 主网卡内网主IP地址,模糊匹配,支持多个 +vpcId - 私有网络ID,精确匹配,支持多个 +status - 云主机状态,精确匹配,支持多个,参考云主机状态 +name - 云主机名称,模糊匹配,支持单个 +imageId - 镜像ID,精确匹配,支持多个 +networkInterfaceId - 弹性网卡ID,精确匹配,支持多个 +subnetId - 子网ID,精确匹配,支持多个 + (Optional) + */ +func NewDescribeInstancePrivateIpAddressRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeInstancePrivateIpAddressRequest { + + return &DescribeInstancePrivateIpAddressRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instancePrivateIpAddress", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeInstancePrivateIpAddressRequestWithoutParam() *DescribeInstancePrivateIpAddressRequest { + + return &DescribeInstancePrivateIpAddressRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instancePrivateIpAddress", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeInstancePrivateIpAddressRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码;默认为1(Optional) */ +func (r *DescribeInstancePrivateIpAddressRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小;默认为20;取值范围[10, 100](Optional) */ +func (r *DescribeInstancePrivateIpAddressRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: instanceId - 云主机ID,精确匹配,支持多个 +privateIpAddress - 主网卡内网主IP地址,模糊匹配,支持多个 +vpcId - 私有网络ID,精确匹配,支持多个 +status - 云主机状态,精确匹配,支持多个,参考云主机状态 +name - 云主机名称,模糊匹配,支持单个 +imageId - 镜像ID,精确匹配,支持多个 +networkInterfaceId - 弹性网卡ID,精确匹配,支持多个 +subnetId - 子网ID,精确匹配,支持多个 +(Optional) */ +func (r *DescribeInstancePrivateIpAddressRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeInstancePrivateIpAddressRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeInstancePrivateIpAddressResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeInstancePrivateIpAddressResult `json:"result"` +} + +type DescribeInstancePrivateIpAddressResult struct { + InstancePrivateIpAddress []vm.InstancePrivateIpAddress `json:"instancePrivateIpAddress"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstanceStatus.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstanceStatus.go new file mode 100644 index 000000000..2dbeb035a --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstanceStatus.go @@ -0,0 +1,161 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeInstanceStatusRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 页码;默认为1 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小;默认为20;取值范围[10, 100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* instanceId - 云主机ID,精确匹配,支持多个 +privateIpAddress - 主网卡内网主IP地址,模糊匹配,支持多个 +vpcId - 私有网络ID,精确匹配,支持多个 +status - 云主机状态,精确匹配,支持多个,参考云主机状态 +name - 云主机名称,模糊匹配,支持单个 +imageId - 镜像ID,精确匹配,支持多个 +networkInterfaceId - 弹性网卡ID,精确匹配,支持多个 +subnetId - 子网ID,精确匹配,支持多个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: 地域ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeInstanceStatusRequest( + regionId string, +) *DescribeInstanceStatusRequest { + + return &DescribeInstanceStatusRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instanceStatus", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: 地域ID (Required) + * param pageNumber: 页码;默认为1 (Optional) + * param pageSize: 分页大小;默认为20;取值范围[10, 100] (Optional) + * param filters: instanceId - 云主机ID,精确匹配,支持多个 +privateIpAddress - 主网卡内网主IP地址,模糊匹配,支持多个 +vpcId - 私有网络ID,精确匹配,支持多个 +status - 云主机状态,精确匹配,支持多个,参考云主机状态 +name - 云主机名称,模糊匹配,支持单个 +imageId - 镜像ID,精确匹配,支持多个 +networkInterfaceId - 弹性网卡ID,精确匹配,支持多个 +subnetId - 子网ID,精确匹配,支持多个 + (Optional) + */ +func NewDescribeInstanceStatusRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeInstanceStatusRequest { + + return &DescribeInstanceStatusRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instanceStatus", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeInstanceStatusRequestWithoutParam() *DescribeInstanceStatusRequest { + + return &DescribeInstanceStatusRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instanceStatus", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeInstanceStatusRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码;默认为1(Optional) */ +func (r *DescribeInstanceStatusRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小;默认为20;取值范围[10, 100](Optional) */ +func (r *DescribeInstanceStatusRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: instanceId - 云主机ID,精确匹配,支持多个 +privateIpAddress - 主网卡内网主IP地址,模糊匹配,支持多个 +vpcId - 私有网络ID,精确匹配,支持多个 +status - 云主机状态,精确匹配,支持多个,参考云主机状态 +name - 云主机名称,模糊匹配,支持单个 +imageId - 镜像ID,精确匹配,支持多个 +networkInterfaceId - 弹性网卡ID,精确匹配,支持多个 +subnetId - 子网ID,精确匹配,支持多个 +(Optional) */ +func (r *DescribeInstanceStatusRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeInstanceStatusRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeInstanceStatusResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeInstanceStatusResult `json:"result"` +} + +type DescribeInstanceStatusResult struct { + InstanceStatuses []vm.InstanceStatus `json:"instanceStatuses"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstanceTypes.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstanceTypes.go new file mode 100644 index 000000000..6ff9017ff --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstanceTypes.go @@ -0,0 +1,122 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeInstanceTypesRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* instanceTypes - 实例规格,精确匹配,支持多个 +az - 可用区,精确匹配,支持多个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: 地域ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeInstanceTypesRequest( + regionId string, +) *DescribeInstanceTypesRequest { + + return &DescribeInstanceTypesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instanceTypes", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: 地域ID (Required) + * param filters: instanceTypes - 实例规格,精确匹配,支持多个 +az - 可用区,精确匹配,支持多个 + (Optional) + */ +func NewDescribeInstanceTypesRequestWithAllParams( + regionId string, + filters []common.Filter, +) *DescribeInstanceTypesRequest { + + return &DescribeInstanceTypesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instanceTypes", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeInstanceTypesRequestWithoutParam() *DescribeInstanceTypesRequest { + + return &DescribeInstanceTypesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instanceTypes", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeInstanceTypesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param filters: instanceTypes - 实例规格,精确匹配,支持多个 +az - 可用区,精确匹配,支持多个 +(Optional) */ +func (r *DescribeInstanceTypesRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeInstanceTypesRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeInstanceTypesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeInstanceTypesResult `json:"result"` +} + +type DescribeInstanceTypesResult struct { + InstanceTypes []vm.InstanceType `json:"instanceTypes"` + SpecificInstanceTypes []vm.InstanceType `json:"specificInstanceTypes"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstanceVncUrl.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstanceVncUrl.go new file mode 100644 index 000000000..3026725f6 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstanceVncUrl.go @@ -0,0 +1,115 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DescribeInstanceVncUrlRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeInstanceVncUrlRequest( + regionId string, + instanceId string, +) *DescribeInstanceVncUrlRequest { + + return &DescribeInstanceVncUrlRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}/vnc", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + */ +func NewDescribeInstanceVncUrlRequestWithAllParams( + regionId string, + instanceId string, +) *DescribeInstanceVncUrlRequest { + + return &DescribeInstanceVncUrlRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}/vnc", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeInstanceVncUrlRequestWithoutParam() *DescribeInstanceVncUrlRequest { + + return &DescribeInstanceVncUrlRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}/vnc", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeInstanceVncUrlRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *DescribeInstanceVncUrlRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeInstanceVncUrlRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeInstanceVncUrlResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeInstanceVncUrlResult `json:"result"` +} + +type DescribeInstanceVncUrlResult struct { + VncUrl string `json:"vncUrl"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstances.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstances.go new file mode 100644 index 000000000..a1330c290 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeInstances.go @@ -0,0 +1,170 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeInstancesRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 页码;默认为1 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小;默认为20;取值范围[10, 100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* instanceId - 云主机ID,精确匹配,支持多个 +privateIpAddress - 主网卡内网主IP地址,模糊匹配,支持多个 +az - 可用区,精确匹配,支持多个 +vpcId - 私有网络ID,精确匹配,支持多个 +status - 云主机状态,精确匹配,支持多个,参考云主机状态 +name - 云主机名称,模糊匹配,支持单个 +imageId - 镜像ID,精确匹配,支持多个 +networkInterfaceId - 弹性网卡ID,精确匹配,支持多个 +subnetId - 子网ID,精确匹配,支持多个 +agId - 使用可用组id,支持单个 +faultDomain - 错误域,支持多个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: 地域ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeInstancesRequest( + regionId string, +) *DescribeInstancesRequest { + + return &DescribeInstancesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: 地域ID (Required) + * param pageNumber: 页码;默认为1 (Optional) + * param pageSize: 分页大小;默认为20;取值范围[10, 100] (Optional) + * param filters: instanceId - 云主机ID,精确匹配,支持多个 +privateIpAddress - 主网卡内网主IP地址,模糊匹配,支持多个 +az - 可用区,精确匹配,支持多个 +vpcId - 私有网络ID,精确匹配,支持多个 +status - 云主机状态,精确匹配,支持多个,参考云主机状态 +name - 云主机名称,模糊匹配,支持单个 +imageId - 镜像ID,精确匹配,支持多个 +networkInterfaceId - 弹性网卡ID,精确匹配,支持多个 +subnetId - 子网ID,精确匹配,支持多个 +agId - 使用可用组id,支持单个 +faultDomain - 错误域,支持多个 + (Optional) + */ +func NewDescribeInstancesRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeInstancesRequest { + + return &DescribeInstancesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeInstancesRequestWithoutParam() *DescribeInstancesRequest { + + return &DescribeInstancesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeInstancesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码;默认为1(Optional) */ +func (r *DescribeInstancesRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小;默认为20;取值范围[10, 100](Optional) */ +func (r *DescribeInstancesRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: instanceId - 云主机ID,精确匹配,支持多个 +privateIpAddress - 主网卡内网主IP地址,模糊匹配,支持多个 +az - 可用区,精确匹配,支持多个 +vpcId - 私有网络ID,精确匹配,支持多个 +status - 云主机状态,精确匹配,支持多个,参考云主机状态 +name - 云主机名称,模糊匹配,支持单个 +imageId - 镜像ID,精确匹配,支持多个 +networkInterfaceId - 弹性网卡ID,精确匹配,支持多个 +subnetId - 子网ID,精确匹配,支持多个 +agId - 使用可用组id,支持单个 +faultDomain - 错误域,支持多个 +(Optional) */ +func (r *DescribeInstancesRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeInstancesRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeInstancesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeInstancesResult `json:"result"` +} + +type DescribeInstancesResult struct { + Instances []vm.Instance `json:"instances"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeKeypairs.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeKeypairs.go new file mode 100644 index 000000000..75b6c5c53 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeKeypairs.go @@ -0,0 +1,140 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeKeypairsRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 页码;默认为1 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小;默认为20;取值范围[10, 100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* keyNames - 密钥对名称,精确匹配,支持多个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: 地域ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeKeypairsRequest( + regionId string, +) *DescribeKeypairsRequest { + + return &DescribeKeypairsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: 地域ID (Required) + * param pageNumber: 页码;默认为1 (Optional) + * param pageSize: 分页大小;默认为20;取值范围[10, 100] (Optional) + * param filters: keyNames - 密钥对名称,精确匹配,支持多个 + (Optional) + */ +func NewDescribeKeypairsRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeKeypairsRequest { + + return &DescribeKeypairsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeKeypairsRequestWithoutParam() *DescribeKeypairsRequest { + + return &DescribeKeypairsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeKeypairsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码;默认为1(Optional) */ +func (r *DescribeKeypairsRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小;默认为20;取值范围[10, 100](Optional) */ +func (r *DescribeKeypairsRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: keyNames - 密钥对名称,精确匹配,支持多个 +(Optional) */ +func (r *DescribeKeypairsRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeKeypairsRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeKeypairsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeKeypairsResult `json:"result"` +} + +type DescribeKeypairsResult struct { + Keypairs []vm.Keypair `json:"keypairs"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeQuotas.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeQuotas.go new file mode 100644 index 000000000..66041bb0c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DescribeQuotas.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeQuotasRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* resourceTypes - 资源类型,支持多个[instance,keypair,image,instanceTemplate,imageShare] + (Optional) */ + Filters []common.Filter `json:"filters"` + + /* 私有镜像Id,查询镜像共享(imageShare)配额时,此参数必传 (Optional) */ + ImageId *string `json:"imageId"` +} + +/* + * param regionId: 地域ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeQuotasRequest( + regionId string, +) *DescribeQuotasRequest { + + return &DescribeQuotasRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/quotas", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: 地域ID (Required) + * param filters: resourceTypes - 资源类型,支持多个[instance,keypair,image,instanceTemplate,imageShare] + (Optional) + * param imageId: 私有镜像Id,查询镜像共享(imageShare)配额时,此参数必传 (Optional) + */ +func NewDescribeQuotasRequestWithAllParams( + regionId string, + filters []common.Filter, + imageId *string, +) *DescribeQuotasRequest { + + return &DescribeQuotasRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/quotas", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + Filters: filters, + ImageId: imageId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeQuotasRequestWithoutParam() *DescribeQuotasRequest { + + return &DescribeQuotasRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/quotas", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DescribeQuotasRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param filters: resourceTypes - 资源类型,支持多个[instance,keypair,image,instanceTemplate,imageShare] +(Optional) */ +func (r *DescribeQuotasRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +/* param imageId: 私有镜像Id,查询镜像共享(imageShare)配额时,此参数必传(Optional) */ +func (r *DescribeQuotasRequest) SetImageId(imageId string) { + r.ImageId = &imageId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeQuotasRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeQuotasResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeQuotasResult `json:"result"` +} + +type DescribeQuotasResult struct { + Quotas []vm.Quota `json:"quotas"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DetachDisk.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DetachDisk.go new file mode 100644 index 000000000..e393dfb85 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DetachDisk.go @@ -0,0 +1,139 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DetachDiskRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 云硬盘ID */ + DiskId string `json:"diskId"` + + /* 强制缷载,默认False。如果此参数传值为True,代表数据盘的IO会被强制断掉。 (Optional) */ + Force *bool `json:"force"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param diskId: 云硬盘ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDetachDiskRequest( + regionId string, + instanceId string, + diskId string, +) *DetachDiskRequest { + + return &DetachDiskRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:detachDisk", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + DiskId: diskId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param diskId: 云硬盘ID (Required) + * param force: 强制缷载,默认False。如果此参数传值为True,代表数据盘的IO会被强制断掉。 (Optional) + */ +func NewDetachDiskRequestWithAllParams( + regionId string, + instanceId string, + diskId string, + force *bool, +) *DetachDiskRequest { + + return &DetachDiskRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:detachDisk", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + DiskId: diskId, + Force: force, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDetachDiskRequestWithoutParam() *DetachDiskRequest { + + return &DetachDiskRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:detachDisk", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DetachDiskRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *DetachDiskRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param diskId: 云硬盘ID(Required) */ +func (r *DetachDiskRequest) SetDiskId(diskId string) { + r.DiskId = diskId +} + +/* param force: 强制缷载,默认False。如果此参数传值为True,代表数据盘的IO会被强制断掉。(Optional) */ +func (r *DetachDiskRequest) SetForce(force bool) { + r.Force = &force +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DetachDiskRequest) GetRegionId() string { + return r.RegionId +} + +type DetachDiskResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DetachDiskResult `json:"result"` +} + +type DetachDiskResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DetachNetworkInterface.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DetachNetworkInterface.go new file mode 100644 index 000000000..83087439f --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DetachNetworkInterface.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DetachNetworkInterfaceRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 弹性网卡ID */ + NetworkInterfaceId string `json:"networkInterfaceId"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param networkInterfaceId: 弹性网卡ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDetachNetworkInterfaceRequest( + regionId string, + instanceId string, + networkInterfaceId string, +) *DetachNetworkInterfaceRequest { + + return &DetachNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:detachNetworkInterface", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param networkInterfaceId: 弹性网卡ID (Required) + */ +func NewDetachNetworkInterfaceRequestWithAllParams( + regionId string, + instanceId string, + networkInterfaceId string, +) *DetachNetworkInterfaceRequest { + + return &DetachNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:detachNetworkInterface", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDetachNetworkInterfaceRequestWithoutParam() *DetachNetworkInterfaceRequest { + + return &DetachNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:detachNetworkInterface", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DetachNetworkInterfaceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *DetachNetworkInterfaceRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param networkInterfaceId: 弹性网卡ID(Required) */ +func (r *DetachNetworkInterfaceRequest) SetNetworkInterfaceId(networkInterfaceId string) { + r.NetworkInterfaceId = networkInterfaceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DetachNetworkInterfaceRequest) GetRegionId() string { + return r.RegionId +} + +type DetachNetworkInterfaceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DetachNetworkInterfaceResult `json:"result"` +} + +type DetachNetworkInterfaceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DisassociateElasticIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DisassociateElasticIp.go new file mode 100644 index 000000000..d1c023f6b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/DisassociateElasticIp.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DisassociateElasticIpRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 弹性公网IP的ID */ + ElasticIpId string `json:"elasticIpId"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param elasticIpId: 弹性公网IP的ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDisassociateElasticIpRequest( + regionId string, + instanceId string, + elasticIpId string, +) *DisassociateElasticIpRequest { + + return &DisassociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:disassociateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + ElasticIpId: elasticIpId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param elasticIpId: 弹性公网IP的ID (Required) + */ +func NewDisassociateElasticIpRequestWithAllParams( + regionId string, + instanceId string, + elasticIpId string, +) *DisassociateElasticIpRequest { + + return &DisassociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:disassociateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + ElasticIpId: elasticIpId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDisassociateElasticIpRequestWithoutParam() *DisassociateElasticIpRequest { + + return &DisassociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:disassociateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *DisassociateElasticIpRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *DisassociateElasticIpRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param elasticIpId: 弹性公网IP的ID(Required) */ +func (r *DisassociateElasticIpRequest) SetElasticIpId(elasticIpId string) { + r.ElasticIpId = elasticIpId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DisassociateElasticIpRequest) GetRegionId() string { + return r.RegionId +} + +type DisassociateElasticIpResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DisassociateElasticIpResult `json:"result"` +} + +type DisassociateElasticIpResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ImportKeypair.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ImportKeypair.go new file mode 100644 index 000000000..387a85c6b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ImportKeypair.go @@ -0,0 +1,134 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ImportKeypairRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 密钥对名称,需要全局唯一。只允许数字、大小写字母、下划线“_”及中划线“-”,不超过32个字符。 + */ + KeyName string `json:"keyName"` + + /* 密钥对的公钥部分 */ + PublicKey string `json:"publicKey"` +} + +/* + * param regionId: 地域ID (Required) + * param keyName: 密钥对名称,需要全局唯一。只允许数字、大小写字母、下划线“_”及中划线“-”,不超过32个字符。 + (Required) + * param publicKey: 密钥对的公钥部分 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewImportKeypairRequest( + regionId string, + keyName string, + publicKey string, +) *ImportKeypairRequest { + + return &ImportKeypairRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs:import", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + KeyName: keyName, + PublicKey: publicKey, + } +} + +/* + * param regionId: 地域ID (Required) + * param keyName: 密钥对名称,需要全局唯一。只允许数字、大小写字母、下划线“_”及中划线“-”,不超过32个字符。 + (Required) + * param publicKey: 密钥对的公钥部分 (Required) + */ +func NewImportKeypairRequestWithAllParams( + regionId string, + keyName string, + publicKey string, +) *ImportKeypairRequest { + + return &ImportKeypairRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs:import", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + KeyName: keyName, + PublicKey: publicKey, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewImportKeypairRequestWithoutParam() *ImportKeypairRequest { + + return &ImportKeypairRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/keypairs:import", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *ImportKeypairRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param keyName: 密钥对名称,需要全局唯一。只允许数字、大小写字母、下划线“_”及中划线“-”,不超过32个字符。 +(Required) */ +func (r *ImportKeypairRequest) SetKeyName(keyName string) { + r.KeyName = keyName +} + +/* param publicKey: 密钥对的公钥部分(Required) */ +func (r *ImportKeypairRequest) SetPublicKey(publicKey string) { + r.PublicKey = publicKey +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ImportKeypairRequest) GetRegionId() string { + return r.RegionId +} + +type ImportKeypairResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ImportKeypairResult `json:"result"` +} + +type ImportKeypairResult struct { + KeyName string `json:"keyName"` + KeyFingerprint string `json:"keyFingerprint"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyImageAttribute.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyImageAttribute.go new file mode 100644 index 000000000..0b811aaf6 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyImageAttribute.go @@ -0,0 +1,136 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyImageAttributeRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 镜像ID */ + ImageId string `json:"imageId"` + + /* 名称,参考公共参数规范。 (Optional) */ + Name *string `json:"name"` + + /* 描述,参考公共参数规范。 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyImageAttributeRequest( + regionId string, + imageId string, +) *ModifyImageAttributeRequest { + + return &ModifyImageAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}:modifyImageAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * param name: 名称,参考公共参数规范。 (Optional) + * param description: 描述,参考公共参数规范。 (Optional) + */ +func NewModifyImageAttributeRequestWithAllParams( + regionId string, + imageId string, + name *string, + description *string, +) *ModifyImageAttributeRequest { + + return &ModifyImageAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}:modifyImageAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + Name: name, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyImageAttributeRequestWithoutParam() *ModifyImageAttributeRequest { + + return &ModifyImageAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}:modifyImageAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *ModifyImageAttributeRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param imageId: 镜像ID(Required) */ +func (r *ModifyImageAttributeRequest) SetImageId(imageId string) { + r.ImageId = imageId +} + +/* param name: 名称,参考公共参数规范。(Optional) */ +func (r *ModifyImageAttributeRequest) SetName(name string) { + r.Name = &name +} + +/* param description: 描述,参考公共参数规范。(Optional) */ +func (r *ModifyImageAttributeRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyImageAttributeRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyImageAttributeResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyImageAttributeResult `json:"result"` +} + +type ModifyImageAttributeResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstanceAttribute.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstanceAttribute.go new file mode 100644 index 000000000..cba1debfd --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstanceAttribute.go @@ -0,0 +1,136 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyInstanceAttributeRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 名称,参考公共参数规范。 (Optional) */ + Name *string `json:"name"` + + /* 描述,参考公共参数规范。 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyInstanceAttributeRequest( + regionId string, + instanceId string, +) *ModifyInstanceAttributeRequest { + + return &ModifyInstanceAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param name: 名称,参考公共参数规范。 (Optional) + * param description: 描述,参考公共参数规范。 (Optional) + */ +func NewModifyInstanceAttributeRequestWithAllParams( + regionId string, + instanceId string, + name *string, + description *string, +) *ModifyInstanceAttributeRequest { + + return &ModifyInstanceAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + Name: name, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyInstanceAttributeRequestWithoutParam() *ModifyInstanceAttributeRequest { + + return &ModifyInstanceAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *ModifyInstanceAttributeRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *ModifyInstanceAttributeRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param name: 名称,参考公共参数规范。(Optional) */ +func (r *ModifyInstanceAttributeRequest) SetName(name string) { + r.Name = &name +} + +/* param description: 描述,参考公共参数规范。(Optional) */ +func (r *ModifyInstanceAttributeRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyInstanceAttributeRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyInstanceAttributeResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyInstanceAttributeResult `json:"result"` +} + +type ModifyInstanceAttributeResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstanceDiskAttribute.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstanceDiskAttribute.go new file mode 100644 index 000000000..8be479476 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstanceDiskAttribute.go @@ -0,0 +1,126 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type ModifyInstanceDiskAttributeRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 云硬盘列表 (Optional) */ + DataDisks []vm.InstanceDiskAttribute `json:"dataDisks"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyInstanceDiskAttributeRequest( + regionId string, + instanceId string, +) *ModifyInstanceDiskAttributeRequest { + + return &ModifyInstanceDiskAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceDiskAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param dataDisks: 云硬盘列表 (Optional) + */ +func NewModifyInstanceDiskAttributeRequestWithAllParams( + regionId string, + instanceId string, + dataDisks []vm.InstanceDiskAttribute, +) *ModifyInstanceDiskAttributeRequest { + + return &ModifyInstanceDiskAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceDiskAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + DataDisks: dataDisks, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyInstanceDiskAttributeRequestWithoutParam() *ModifyInstanceDiskAttributeRequest { + + return &ModifyInstanceDiskAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceDiskAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *ModifyInstanceDiskAttributeRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *ModifyInstanceDiskAttributeRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param dataDisks: 云硬盘列表(Optional) */ +func (r *ModifyInstanceDiskAttributeRequest) SetDataDisks(dataDisks []vm.InstanceDiskAttribute) { + r.DataDisks = dataDisks +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyInstanceDiskAttributeRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyInstanceDiskAttributeResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyInstanceDiskAttributeResult `json:"result"` +} + +type ModifyInstanceDiskAttributeResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstanceNetworkAttribute.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstanceNetworkAttribute.go new file mode 100644 index 000000000..dd219907c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstanceNetworkAttribute.go @@ -0,0 +1,126 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" +) + +type ModifyInstanceNetworkAttributeRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 弹性网卡列表 (Optional) */ + Networks []vm.InstanceNetworkAttribute `json:"networks"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyInstanceNetworkAttributeRequest( + regionId string, + instanceId string, +) *ModifyInstanceNetworkAttributeRequest { + + return &ModifyInstanceNetworkAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceNetworkAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param networks: 弹性网卡列表 (Optional) + */ +func NewModifyInstanceNetworkAttributeRequestWithAllParams( + regionId string, + instanceId string, + networks []vm.InstanceNetworkAttribute, +) *ModifyInstanceNetworkAttributeRequest { + + return &ModifyInstanceNetworkAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceNetworkAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + Networks: networks, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyInstanceNetworkAttributeRequestWithoutParam() *ModifyInstanceNetworkAttributeRequest { + + return &ModifyInstanceNetworkAttributeRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceNetworkAttribute", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *ModifyInstanceNetworkAttributeRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *ModifyInstanceNetworkAttributeRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param networks: 弹性网卡列表(Optional) */ +func (r *ModifyInstanceNetworkAttributeRequest) SetNetworks(networks []vm.InstanceNetworkAttribute) { + r.Networks = networks +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyInstanceNetworkAttributeRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyInstanceNetworkAttributeResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyInstanceNetworkAttributeResult `json:"result"` +} + +type ModifyInstanceNetworkAttributeResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstancePassword.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstancePassword.go new file mode 100644 index 000000000..0d82721ef --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ModifyInstancePassword.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyInstancePasswordRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 密码,参考公共参数规范。 */ + Password string `json:"password"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param password: 密码,参考公共参数规范。 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyInstancePasswordRequest( + regionId string, + instanceId string, + password string, +) *ModifyInstancePasswordRequest { + + return &ModifyInstancePasswordRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstancePassword", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + Password: password, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param password: 密码,参考公共参数规范。 (Required) + */ +func NewModifyInstancePasswordRequestWithAllParams( + regionId string, + instanceId string, + password string, +) *ModifyInstancePasswordRequest { + + return &ModifyInstancePasswordRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstancePassword", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + Password: password, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyInstancePasswordRequestWithoutParam() *ModifyInstancePasswordRequest { + + return &ModifyInstancePasswordRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:modifyInstancePassword", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *ModifyInstancePasswordRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *ModifyInstancePasswordRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param password: 密码,参考公共参数规范。(Required) */ +func (r *ModifyInstancePasswordRequest) SetPassword(password string) { + r.Password = password +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyInstancePasswordRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyInstancePasswordResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyInstancePasswordResult `json:"result"` +} + +type ModifyInstancePasswordResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/RebootInstance.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/RebootInstance.go new file mode 100644 index 000000000..7bfac4809 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/RebootInstance.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type RebootInstanceRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewRebootInstanceRequest( + regionId string, + instanceId string, +) *RebootInstanceRequest { + + return &RebootInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:rebootInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + */ +func NewRebootInstanceRequestWithAllParams( + regionId string, + instanceId string, +) *RebootInstanceRequest { + + return &RebootInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:rebootInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewRebootInstanceRequestWithoutParam() *RebootInstanceRequest { + + return &RebootInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:rebootInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *RebootInstanceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *RebootInstanceRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r RebootInstanceRequest) GetRegionId() string { + return r.RegionId +} + +type RebootInstanceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result RebootInstanceResult `json:"result"` +} + +type RebootInstanceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/RebuildInstance.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/RebuildInstance.go new file mode 100644 index 000000000..0aa5380f7 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/RebuildInstance.go @@ -0,0 +1,150 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type RebuildInstanceRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 云主机密码,参考公共参数规范。 */ + Password string `json:"password"` + + /* 镜像ID。可查询DescribeImages接口获得指定地域的镜像信息。 (Optional) */ + ImageId *string `json:"imageId"` + + /* 密钥对名称;当前只支持一个。仅Linux系统支持指定。 (Optional) */ + KeyNames []string `json:"keyNames"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param password: 云主机密码,参考公共参数规范。 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewRebuildInstanceRequest( + regionId string, + instanceId string, + password string, +) *RebuildInstanceRequest { + + return &RebuildInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:rebuildInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + Password: password, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param password: 云主机密码,参考公共参数规范。 (Required) + * param imageId: 镜像ID。可查询DescribeImages接口获得指定地域的镜像信息。 (Optional) + * param keyNames: 密钥对名称;当前只支持一个。仅Linux系统支持指定。 (Optional) + */ +func NewRebuildInstanceRequestWithAllParams( + regionId string, + instanceId string, + password string, + imageId *string, + keyNames []string, +) *RebuildInstanceRequest { + + return &RebuildInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:rebuildInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + Password: password, + ImageId: imageId, + KeyNames: keyNames, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewRebuildInstanceRequestWithoutParam() *RebuildInstanceRequest { + + return &RebuildInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:rebuildInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *RebuildInstanceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *RebuildInstanceRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param password: 云主机密码,参考公共参数规范。(Required) */ +func (r *RebuildInstanceRequest) SetPassword(password string) { + r.Password = password +} + +/* param imageId: 镜像ID。可查询DescribeImages接口获得指定地域的镜像信息。(Optional) */ +func (r *RebuildInstanceRequest) SetImageId(imageId string) { + r.ImageId = &imageId +} + +/* param keyNames: 密钥对名称;当前只支持一个。仅Linux系统支持指定。(Optional) */ +func (r *RebuildInstanceRequest) SetKeyNames(keyNames []string) { + r.KeyNames = keyNames +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r RebuildInstanceRequest) GetRegionId() string { + return r.RegionId +} + +type RebuildInstanceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result RebuildInstanceResult `json:"result"` +} + +type RebuildInstanceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ResizeInstance.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ResizeInstance.go new file mode 100644 index 000000000..4c5f83bc3 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ResizeInstance.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ResizeInstanceRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` + + /* 实例规格,可查询DescribeInstanceTypes接口获得指定地域或可用区的规格信息。 */ + InstanceType string `json:"instanceType"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param instanceType: 实例规格,可查询DescribeInstanceTypes接口获得指定地域或可用区的规格信息。 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewResizeInstanceRequest( + regionId string, + instanceId string, + instanceType string, +) *ResizeInstanceRequest { + + return &ResizeInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:resizeInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + InstanceType: instanceType, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * param instanceType: 实例规格,可查询DescribeInstanceTypes接口获得指定地域或可用区的规格信息。 (Required) + */ +func NewResizeInstanceRequestWithAllParams( + regionId string, + instanceId string, + instanceType string, +) *ResizeInstanceRequest { + + return &ResizeInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:resizeInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + InstanceType: instanceType, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewResizeInstanceRequestWithoutParam() *ResizeInstanceRequest { + + return &ResizeInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:resizeInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *ResizeInstanceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *ResizeInstanceRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +/* param instanceType: 实例规格,可查询DescribeInstanceTypes接口获得指定地域或可用区的规格信息。(Required) */ +func (r *ResizeInstanceRequest) SetInstanceType(instanceType string) { + r.InstanceType = instanceType +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ResizeInstanceRequest) GetRegionId() string { + return r.RegionId +} + +type ResizeInstanceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ResizeInstanceResult `json:"result"` +} + +type ResizeInstanceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ShareImage.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ShareImage.go new file mode 100644 index 000000000..3f047a801 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/ShareImage.go @@ -0,0 +1,125 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ShareImageRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 镜像ID */ + ImageId string `json:"imageId"` + + /* 需要共享的帐户 (Optional) */ + Pins []string `json:"pins"` +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewShareImageRequest( + regionId string, + imageId string, +) *ShareImageRequest { + + return &ShareImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}:share", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * param pins: 需要共享的帐户 (Optional) + */ +func NewShareImageRequestWithAllParams( + regionId string, + imageId string, + pins []string, +) *ShareImageRequest { + + return &ShareImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}:share", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + Pins: pins, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewShareImageRequestWithoutParam() *ShareImageRequest { + + return &ShareImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}:share", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *ShareImageRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param imageId: 镜像ID(Required) */ +func (r *ShareImageRequest) SetImageId(imageId string) { + r.ImageId = imageId +} + +/* param pins: 需要共享的帐户(Optional) */ +func (r *ShareImageRequest) SetPins(pins []string) { + r.Pins = pins +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ShareImageRequest) GetRegionId() string { + return r.RegionId +} + +type ShareImageResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ShareImageResult `json:"result"` +} + +type ShareImageResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/StartInstance.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/StartInstance.go new file mode 100644 index 000000000..cdb93d9d9 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/StartInstance.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type StartInstanceRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewStartInstanceRequest( + regionId string, + instanceId string, +) *StartInstanceRequest { + + return &StartInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:startInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + */ +func NewStartInstanceRequestWithAllParams( + regionId string, + instanceId string, +) *StartInstanceRequest { + + return &StartInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:startInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewStartInstanceRequestWithoutParam() *StartInstanceRequest { + + return &StartInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:startInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *StartInstanceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *StartInstanceRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r StartInstanceRequest) GetRegionId() string { + return r.RegionId +} + +type StartInstanceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result StartInstanceResult `json:"result"` +} + +type StartInstanceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/StopInstance.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/StopInstance.go new file mode 100644 index 000000000..c23c6cd42 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/StopInstance.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type StopInstanceRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 云主机ID */ + InstanceId string `json:"instanceId"` +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewStopInstanceRequest( + regionId string, + instanceId string, +) *StopInstanceRequest { + + return &StopInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:stopInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* + * param regionId: 地域ID (Required) + * param instanceId: 云主机ID (Required) + */ +func NewStopInstanceRequestWithAllParams( + regionId string, + instanceId string, +) *StopInstanceRequest { + + return &StopInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:stopInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + InstanceId: instanceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewStopInstanceRequestWithoutParam() *StopInstanceRequest { + + return &StopInstanceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/instances/{instanceId}:stopInstance", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *StopInstanceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param instanceId: 云主机ID(Required) */ +func (r *StopInstanceRequest) SetInstanceId(instanceId string) { + r.InstanceId = instanceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r StopInstanceRequest) GetRegionId() string { + return r.RegionId +} + +type StopInstanceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result StopInstanceResult `json:"result"` +} + +type StopInstanceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/UnShareImage.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/UnShareImage.go new file mode 100644 index 000000000..0e34ed4f9 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis/UnShareImage.go @@ -0,0 +1,125 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type UnShareImageRequest struct { + + core.JDCloudRequest + + /* 地域ID */ + RegionId string `json:"regionId"` + + /* 镜像ID */ + ImageId string `json:"imageId"` + + /* 需要取消的帐户 (Optional) */ + Pins []string `json:"pins"` +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewUnShareImageRequest( + regionId string, + imageId string, +) *UnShareImageRequest { + + return &UnShareImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}:unshare", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + } +} + +/* + * param regionId: 地域ID (Required) + * param imageId: 镜像ID (Required) + * param pins: 需要取消的帐户 (Optional) + */ +func NewUnShareImageRequestWithAllParams( + regionId string, + imageId string, + pins []string, +) *UnShareImageRequest { + + return &UnShareImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}:unshare", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ImageId: imageId, + Pins: pins, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewUnShareImageRequestWithoutParam() *UnShareImageRequest { + + return &UnShareImageRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/images/{imageId}:unshare", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: 地域ID(Required) */ +func (r *UnShareImageRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param imageId: 镜像ID(Required) */ +func (r *UnShareImageRequest) SetImageId(imageId string) { + r.ImageId = imageId +} + +/* param pins: 需要取消的帐户(Optional) */ +func (r *UnShareImageRequest) SetPins(pins []string) { + r.Pins = pins +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r UnShareImageRequest) GetRegionId() string { + return r.RegionId +} + +type UnShareImageResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result UnShareImageResult `json:"result"` +} + +type UnShareImageResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/client/VmClient.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/client/VmClient.go new file mode 100644 index 000000000..6ec95e956 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/client/VmClient.go @@ -0,0 +1,962 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package client + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" + "encoding/json" + "errors" +) + +type VmClient struct { + core.JDCloudClient +} + +func NewVmClient(credential *core.Credential) *VmClient { + if credential == nil { + return nil + } + + config := core.NewConfig() + config.SetEndpoint("vm.jdcloud-api.com") + + return &VmClient{ + core.JDCloudClient{ + Credential: *credential, + Config: *config, + ServiceName: "vm", + Revision: "1.0.8", + Logger: core.NewDefaultLogger(core.LogInfo), + }} +} + +func (c *VmClient) SetConfig(config *core.Config) { + c.Config = *config +} + +func (c *VmClient) SetLogger(logger core.Logger) { + c.Logger = logger +} + +/* 查询镜像共享帐户列表,只允许操作您的个人私有镜像。 + */ +func (c *VmClient) DescribeImageMembers(request *vm.DescribeImageMembersRequest) (*vm.DescribeImageMembersResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeImageMembersResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 为云主机创建私有镜像。云主机状态必须为stopped
    +云主机没有正在进行中的任务才可制作镜像。
    +制作镜像以备份系统盘为基础,在此之上可选择全部或部分挂载数据盘制作整机镜像(如不做任何更改将默认制作整机镜像),制作镜像过程会为所挂载云硬盘创建快照并与镜像关联。
    +调用接口后,需要等待镜像状态变为ready后,才能正常使用镜像。 + */ +func (c *VmClient) CreateImage(request *vm.CreateImageRequest) (*vm.CreateImageResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.CreateImageResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建一台或多台指定配置的云主机,创建模式分为三种:1.普通方式、2.使用高可用组、3.使用启动模板。三种方式创建云主机时参数的必传与非必传是不同的,具体请参考参数详细说明
    +- 创建云主机需要通过实名认证 +- 实例规格 + - 可查询DescribeInstanceTypes接口获得指定地域或可用区的规格信息。 + - 不能使用已下线、或已售馨的规格ID +- 镜像 + - Windows Server 2012 R2标准版 64位 中文版 SQL Server 2014 标准版 SP2内存需大于1GB; + - Windows Server所有镜像CPU不可选超过64核CPU。 + - 可查询DescribeImages接口获得指定地域的镜像信息。 + - 选择的镜像必须支持选择的实例规格。可查询DescribeImageConstraints接口获得指定镜像的实例规格限制信息。
    +- 网络配置 + - 指定主网卡配置信息 + - 必须指定subnetId + - 可以指定elasticIp规格来约束创建的弹性IP,带宽取值范围[1-100]Mbps,步进1Mbps + - 可以指定主网卡的内网主IP(primaryIpAddress),此时maxCount只能为1 + - 安全组securityGroup需与子网Subnet在同一个私有网络VPC内 + - 一台云主机创建时必须指定一个安全组,至多指定5个安全组,如果没有指定安全组,默认使用默认安全组 + - 主网卡deviceIndex设置为1 +- 存储 + - 系统盘 + - 磁盘分类,系统盘支持local或cloud + - 磁盘大小 + - local:不能指定大小,默认为40GB + - cloud:取值范围: 40-500GB,并且不能小于镜像的最小系统盘大小,如果没有指定,默认以镜像中的系统盘大小为准 + - 自动删除 + - 如果是local,默认自动删除,不能修改此属性 + - 如果是cloud类型的按配置计费的云硬盘,可以指定为True + - 数据盘 + - 磁盘分类,数据盘仅支持cloud + - 云硬盘类型可以选择ssd、premium-hdd + - 磁盘大小 + - premium-hdd:范围[20,3000]GB,步长为10G + - ssd:范围[20,1000]GB,步长为10G + - 自动删除 + - 默认自动删除,如果是包年包月的数据盘或共享型数据盘,此参数不生效 + - 可以指定SnapshotId创建云硬盘 + - 可以从快照创建磁盘 + - local类型系统的云主机可以挂载8块云硬盘 + - cloud类型系统的云主机可以挂载7块云硬盘 +- 计费 + - 弹性IP的计费模式,如果选择按用量类型可以单独设置,其它计费模式都以主机为准 + - 云硬盘的计费模式以主机为准 +- 其他 + - 创建完成后,主机状态为running + - 仅Linux系统云主机可以指定密钥 + - maxCount为最大努力,不保证一定能达到maxCount + - 虚机的az会覆盖磁盘的az属性 +- 密码 + - 参考公共参数规范 + */ +func (c *VmClient) CreateInstances(request *vm.CreateInstancesRequest) (*vm.CreateInstancesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.CreateInstancesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 为云主机主网卡下的主内网IP绑定弹性公网IP。
    +一台云主机只能绑定一个弹性公网IP(主网卡),若主网卡已存在弹性公网IP,会返回错误。
    + */ +func (c *VmClient) AssociateElasticIp(request *vm.AssociateElasticIpRequest) (*vm.AssociateElasticIpResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.AssociateElasticIpResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 共享镜像,只允许操作您的个人私有镜像,单个镜像最多可共享给20个京东云帐户。
    +整机镜像目前不支持共享。 + */ +func (c *VmClient) ShareImage(request *vm.ShareImageRequest) (*vm.ShareImageResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.ShareImageResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 云主机解绑弹性公网IP,解绑的是主网卡、内网主IP对应的弹性公网IP。 + */ +func (c *VmClient) DisassociateElasticIp(request *vm.DisassociateElasticIpRequest) (*vm.DisassociateElasticIpResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DisassociateElasticIpResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 停止单个云主机,只能停止running状态的云主机,云主机没有正在进行中的任务才可停止 + */ +func (c *VmClient) StopInstance(request *vm.StopInstanceRequest) (*vm.StopInstanceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.StopInstanceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 启动单个云主机,只能启动stopped状态的云主机,云主机没有正在进行中的任务才可启动。
    +只能启动正常计费状态的云主机。 + */ +func (c *VmClient) StartInstance(request *vm.StartInstanceRequest) (*vm.StartInstanceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.StartInstanceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询镜像信息列表。
    +通过此接口可以查询到京东云官方镜像、第三方镜像、私有镜像、或其他用户共享给您的镜像。
    +此接口支持分页查询,默认每页20条。 + */ +func (c *VmClient) DescribeImages(request *vm.DescribeImagesRequest) (*vm.DescribeImagesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeImagesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询镜像的实例规格限制。
    +通过此接口可以查看镜像不支持的实例规格。只有官方镜像、第三方镜像有实例规格的限制,个人的私有镜像没有此限制。 + */ +func (c *VmClient) DescribeImageConstraints(request *vm.DescribeImageConstraintsRequest) (*vm.DescribeImageConstraintsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeImageConstraintsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 获取云主机vnc,用于连接管理云主机。
    +vnc地址的有效期为1个小时,调用接口获取vnc地址后如果1个小时内没有使用,vnc地址自动失效,再次使用需要重新获取。 + */ +func (c *VmClient) DescribeInstanceVncUrl(request *vm.DescribeInstanceVncUrlRequest) (*vm.DescribeInstanceVncUrlResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeInstanceVncUrlResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 云主机使用指定镜像重置云主机系统
    +云主机的状态必须为stopped状态。
    +若当前云主机的系统盘类型为local类型,那么更换的镜像必须为localDisk类型的镜像;同理若当前云主机的系统盘为cloud类型,那么更换的镜像必须为cloudDisk类型的镜像。可查询DescribeImages接口获得指定地域的镜像信息。
    +若不指定镜像ID,默认使用当前主机的原镜像重置系统。
    +指定的镜像必须能够支持当前主机的实例规格(instanceType),否则会返回错误。可查询DescribeImageConstraints接口获得指定镜像支持的系统盘类型信息。 + */ +func (c *VmClient) RebuildInstance(request *vm.RebuildInstanceRequest) (*vm.RebuildInstanceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.RebuildInstanceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 取消共享镜像,只允许操作您的个人私有镜像。 + */ +func (c *VmClient) UnShareImage(request *vm.UnShareImageRequest) (*vm.UnShareImageResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.UnShareImageResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改云主机部分信息,包括名称、描述。 + */ +func (c *VmClient) ModifyInstanceAttribute(request *vm.ModifyInstanceAttributeRequest) (*vm.ModifyInstanceAttributeResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.ModifyInstanceAttributeResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 云主机变更实例规格
    +云主机的状态必须为stopped状态。
    +16年创建的云硬盘做系统盘的主机,一代与二代实例规格不允许相互调整。
    +本地盘(local类型)做系统盘的主机,一代与二代实例规格不允许相互调整。
    +使用高可用组(Ag)创建的主机,一代与二代实例规格不允许相互调整。
    +云硬盘(cloud类型)做系统盘的主机,一代与二代实例规格允许相互调整。
    +如果当前主机中的弹性网卡数量,大于新实例规格允许的弹性网卡数量,会返回错误。可查询DescribeInstanceTypes接口获得指定地域及可用区下的实例规格信息。
    +当前主机所使用的镜像,需要支持要变更的目标实例规格,否则返回错误。可查询DescribeImageConstraints接口获得指定镜像的实例规格限制信息。
    +云主机欠费或到期时,无法更改实例规格。 + */ +func (c *VmClient) ResizeInstance(request *vm.ResizeInstanceRequest) (*vm.ResizeInstanceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.ResizeInstanceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 批量查询镜像的实例规格限制。
    +通过此接口可以查看镜像不支持的实例规格。只有官方镜像、第三方镜像有实例规格的限制,个人的私有镜像没有此限制。 + */ +func (c *VmClient) DescribeImageConstraintsBatch(request *vm.DescribeImageConstraintsBatchRequest) (*vm.DescribeImageConstraintsBatchResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeImageConstraintsBatchResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 为一台云主机挂载一块数据盘(云硬盘),云主机和云硬盘没有正在进行中的的任务时才可挂载。
    +云主机状态必须是runningstopped状态。
    +本地盘(local类型)做系统盘的云主机可挂载8块数据盘,云硬盘(cloud类型)做系统盘的云主机可挂载7块数据盘。 + */ +func (c *VmClient) AttachDisk(request *vm.AttachDiskRequest) (*vm.AttachDiskResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.AttachDiskResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改云主机密码,主机没有正在进行中的任务时才可操作。
    +修改密码后,需要重启云主机后生效。 + */ +func (c *VmClient) ModifyInstancePassword(request *vm.ModifyInstancePasswordRequest) (*vm.ModifyInstancePasswordResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.ModifyInstancePasswordResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除一个私有镜像,只允许操作您的个人私有镜像。
    +若镜像已共享给其他用户,需先取消共享才可删除。 + */ +func (c *VmClient) DeleteImage(request *vm.DeleteImageRequest) (*vm.DeleteImageResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DeleteImageResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询实例规格信息列表 + */ +func (c *VmClient) DescribeInstanceTypes(request *vm.DescribeInstanceTypesRequest) (*vm.DescribeInstanceTypesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeInstanceTypesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 云主机挂载一块弹性网卡。
    +云主机状态必须为runningstopped状态,并且没有正在进行中的任务才可操作。
    +弹性网卡上如果绑定了公网IP,那么公网IP所在az需要与云主机的az保持一致,或者公网IP属于全可用区,才可挂载。
    +云主机挂载弹性网卡的数量,不能超过实例规格的限制。可查询DescribeInstanceTypes接口获得指定规格可挂载弹性网卡的数量上限。
    +弹性网卡与云主机必须在相同vpc下。 + */ +func (c *VmClient) AttachNetworkInterface(request *vm.AttachNetworkInterfaceRequest) (*vm.AttachNetworkInterfaceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.AttachNetworkInterfaceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除ssh密钥对。 + */ +func (c *VmClient) DeleteKeypair(request *vm.DeleteKeypairRequest) (*vm.DeleteKeypairResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DeleteKeypairResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询镜像详情。 + */ +func (c *VmClient) DescribeImage(request *vm.DescribeImageRequest) (*vm.DescribeImageResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeImageResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 云主机缷载一块弹性网卡。
    +云主机状态必须为runningstopped状态,并且没有正在进行中的任务才可操作。
    +不能缷载主网卡。 + */ +func (c *VmClient) DetachNetworkInterface(request *vm.DetachNetworkInterfaceRequest) (*vm.DetachNetworkInterfaceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DetachNetworkInterfaceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 导入由其他工具生成的密钥对的公钥部分。
    +若传入已存在的密钥名称,会返回错误。 + */ +func (c *VmClient) ImportKeypair(request *vm.ImportKeypairRequest) (*vm.ImportKeypairResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.ImportKeypairResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 镜像跨区复制,将私有镜像复制到其它地域下,只允许操作您的个人私有镜像。
    +只支持rootDeviceType为cloudDisk的云硬盘系统盘镜像操作。 + */ +func (c *VmClient) CopyImages(request *vm.CopyImagesRequest) (*vm.CopyImagesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.CopyImagesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询一台云主机的详细信息 + */ +func (c *VmClient) DescribeInstance(request *vm.DescribeInstanceRequest) (*vm.DescribeInstanceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeInstanceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改虚机弹性网卡属性,包括是否随云主机一起删除。
    +不能修改主网卡。 + */ +func (c *VmClient) ModifyInstanceNetworkAttribute(request *vm.ModifyInstanceNetworkAttributeRequest) (*vm.ModifyInstanceNetworkAttributeResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.ModifyInstanceNetworkAttributeResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询配额,支持:云主机、镜像、密钥、模板、镜像共享 + */ +func (c *VmClient) DescribeQuotas(request *vm.DescribeQuotasRequest) (*vm.DescribeQuotasResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeQuotasResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改镜像信息,包括名称、描述;只允许操作您的个人私有镜像。 + */ +func (c *VmClient) ModifyImageAttribute(request *vm.ModifyImageAttributeRequest) (*vm.ModifyImageAttributeResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.ModifyImageAttributeResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 重启单个云主机,只能重启running状态的云主机,云主机没有正在进行中的任务才可重启。 + */ +func (c *VmClient) RebootInstance(request *vm.RebootInstanceRequest) (*vm.RebootInstanceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.RebootInstanceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改云主机挂载的数据盘属性,包括是否随主机删除。 + */ +func (c *VmClient) ModifyInstanceDiskAttribute(request *vm.ModifyInstanceDiskAttributeRequest) (*vm.ModifyInstanceDiskAttributeResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.ModifyInstanceDiskAttributeResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 批量查询云主机内网IP地址,查询的是主网卡内网主IP地址。 */ +func (c *VmClient) DescribeInstancePrivateIpAddress(request *vm.DescribeInstancePrivateIpAddressRequest) (*vm.DescribeInstancePrivateIpAddressResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeInstancePrivateIpAddressResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 批量查询云主机状态 */ +func (c *VmClient) DescribeInstanceStatus(request *vm.DescribeInstanceStatusRequest) (*vm.DescribeInstanceStatusResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeInstanceStatusResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 批量查询密钥对。
    +此接口支持分页查询,默认每页20条。 + */ +func (c *VmClient) DescribeKeypairs(request *vm.DescribeKeypairsRequest) (*vm.DescribeKeypairsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeKeypairsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 云主机缷载数据盘,云主机和云硬盘没有正在进行中的任务时才可缷载。
    + */ +func (c *VmClient) DetachDisk(request *vm.DetachDiskRequest) (*vm.DetachDiskResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DetachDiskResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除按配置计费、或包年包月已到期的单个云主机。不能删除没有计费信息的云主机。
    +云主机状态必须为运行running、停止stopped、错误error,同时云主机没有正在进行中的任务才可删除。
    +包年包月未到期的云主机不能删除。
    +如果主机中挂载的数据盘为按配置计费的云硬盘,并且不是共享型云硬盘,并且AutoDelete属性为true,那么数据盘会随主机一起删除。 + [MFA enabled] */ +func (c *VmClient) DeleteInstance(request *vm.DeleteInstanceRequest) (*vm.DeleteInstanceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DeleteInstanceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 批量查询云主机的详细信息
    +此接口支持分页查询,默认每页20条。 + */ +func (c *VmClient) DescribeInstances(request *vm.DescribeInstancesRequest) (*vm.DescribeInstancesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.DescribeInstancesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建ssh密钥对。公钥部分存储在京东云,并返回未加密的 PEM 编码的 PKCS#8 格式私钥,您只有一次机会保存您的私钥。请妥善保管。
    +若传入已存在的密钥名称,会返回错误。 + */ +func (c *VmClient) CreateKeypair(request *vm.CreateKeypairRequest) (*vm.CreateKeypairResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vm.CreateKeypairResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Ag.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Ag.go new file mode 100644 index 000000000..2e2d48e6a --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Ag.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Ag struct { + + /* 高可用组名称 (Optional) */ + Name string `json:"name"` + + /* 高可用组id (Optional) */ + Id string `json:"id"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/CopyImage.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/CopyImage.go new file mode 100644 index 000000000..43332d8c5 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/CopyImage.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type CopyImage struct { + + /* 复制后的目标镜像ID (Optional) */ + DestinationImageId string `json:"destinationImageId"` + + /* 源镜像ID (Optional) */ + SourceImageId string `json:"sourceImageId"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Gpu.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Gpu.go new file mode 100644 index 000000000..4755199be --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Gpu.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Gpu struct { + + /* GPU型号 (Optional) */ + Model string `json:"model"` + + /* GPU数量 (Optional) */ + Number int `json:"number"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Image.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Image.go new file mode 100644 index 000000000..70e7a6d95 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Image.go @@ -0,0 +1,72 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Image struct { + + /* 镜像ID (Optional) */ + ImageId string `json:"imageId"` + + /* 镜像名称 (Optional) */ + Name string `json:"name"` + + /* 镜像的操作系统发行版。取值:Ubuntu,CentOS,Windows Server (Optional) */ + Platform string `json:"platform"` + + /* 镜像的操作系统版本。 (Optional) */ + OsVersion string `json:"osVersion"` + + /* 镜像架构。取值:i386,x86_64 (Optional) */ + Architecture string `json:"architecture"` + + /* 镜像系统盘大小 (Optional) */ + SystemDiskSizeGB int `json:"systemDiskSizeGB"` + + /* 镜像来源。取值:jcloud:官方镜像;marketplace:镜像市场镜像;self:用户自己的镜像;shared:其他用户分享的镜像 (Optional) */ + ImageSource string `json:"imageSource"` + + /* 镜像的操作系统类型。取值:windows,linux (Optional) */ + OsType string `json:"osType"` + + /* 参考镜像状态 (Optional) */ + Status string `json:"status"` + + /* 创建时间 (Optional) */ + CreateTime string `json:"createTime"` + + /* 镜像文件实际大小 (Optional) */ + SizeMB int `json:"sizeMB"` + + /* 镜像描述 (Optional) */ + Desc string `json:"desc"` + + /* 镜像系统盘配置 (Optional) */ + SystemDisk InstanceDiskAttachment `json:"systemDisk"` + + /* 镜像数据盘映射信息 (Optional) */ + DataDisks []InstanceDiskAttachment `json:"dataDisks"` + + /* 创建云盘系统盘所使用的云硬盘快照ID。系统盘类型为本地盘的镜像,此参数为空。 (Optional) */ + SnapshotId string `json:"snapshotId"` + + /* 镜像支持的系统盘类型。取值:localDisk:本地盘系统盘;cloudDisk:云盘系统盘。 (Optional) */ + RootDeviceType string `json:"rootDeviceType"` + + /* 镜像复制和转换时的进度,仅显示数值,单位为百分比 (Optional) */ + Progress string `json:"progress"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/ImageConstraint.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/ImageConstraint.go new file mode 100644 index 000000000..66bca6972 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/ImageConstraint.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ImageConstraint struct { + + /* 镜像ID (Optional) */ + ImageId string `json:"imageId"` + + /* 使用镜像创建实例的规格限制 (Optional) */ + ImageInstanceTypeConstraint ImageInstanceTypeConstraint `json:"imageInstanceTypeConstraint"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/ImageInstanceTypeConstraint.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/ImageInstanceTypeConstraint.go new file mode 100644 index 000000000..a53ef7835 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/ImageInstanceTypeConstraint.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ImageInstanceTypeConstraint struct { + + /* 限制类型。取值:excludes:不支持的实例类型;includes:支持的实例类型。 (Optional) */ + ConstraintsType string `json:"constraintsType"` + + /* 实例规格列表 (Optional) */ + InstanceTypes []string `json:"instanceTypes"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Instance.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Instance.go new file mode 100644 index 000000000..c49c6471c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Instance.go @@ -0,0 +1,89 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import charge "github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models" +import disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models" + +type Instance struct { + + /* 云主机ID (Optional) */ + InstanceId string `json:"instanceId"` + + /* 云主机名称 (Optional) */ + InstanceName string `json:"instanceName"` + + /* 实例规格 (Optional) */ + InstanceType string `json:"instanceType"` + + /* 主网卡所属VPC的ID (Optional) */ + VpcId string `json:"vpcId"` + + /* 主网卡所属子网的ID (Optional) */ + SubnetId string `json:"subnetId"` + + /* 主网卡主IP地址 (Optional) */ + PrivateIpAddress string `json:"privateIpAddress"` + + /* 主网卡主IP绑定弹性IP的ID (Optional) */ + ElasticIpId string `json:"elasticIpId"` + + /* 主网卡主IP绑定弹性IP的地址 (Optional) */ + ElasticIpAddress string `json:"elasticIpAddress"` + + /* 云主机状态,参考云主机状态 (Optional) */ + Status string `json:"status"` + + /* 云主机描述 (Optional) */ + Description string `json:"description"` + + /* 镜像ID (Optional) */ + ImageId string `json:"imageId"` + + /* 系统盘配置 (Optional) */ + SystemDisk InstanceDiskAttachment `json:"systemDisk"` + + /* 数据盘配置 (Optional) */ + DataDisks []InstanceDiskAttachment `json:"dataDisks"` + + /* 主网卡配置 (Optional) */ + PrimaryNetworkInterface InstanceNetworkInterfaceAttachment `json:"primaryNetworkInterface"` + + /* 辅助网卡配置 (Optional) */ + SecondaryNetworkInterfaces []InstanceNetworkInterfaceAttachment `json:"secondaryNetworkInterfaces"` + + /* 创建时间 (Optional) */ + LaunchTime string `json:"launchTime"` + + /* 云主机所在可用区 (Optional) */ + Az string `json:"az"` + + /* 密钥对名称 (Optional) */ + KeyNames []string `json:"keyNames"` + + /* 计费信息 (Optional) */ + Charge charge.Charge `json:"charge"` + + /* 高可用组,如果创建云主机使用了高可用组,此处可展示高可用组名称 (Optional) */ + Ag Ag `json:"ag"` + + /* 高可用组中的错误域 (Optional) */ + FaultDomain string `json:"faultDomain"` + + /* Tag信息 (Optional) */ + Tags []disk.Tag `json:"tags"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceDiskAttachment.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceDiskAttachment.go new file mode 100644 index 000000000..33aa425e8 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceDiskAttachment.go @@ -0,0 +1,46 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models" + +type InstanceDiskAttachment struct { + + /* 磁盘分类,取值为本地盘(local)或者数据盘(cloud)。 +系统盘支持本地盘(local)或者云硬盘(cloud)。系统盘选择local类型,必须使用localDisk类型的镜像;同理系统盘选择cloud类型,必须使用cloudDisk类型的镜像。 +数据盘仅支持云硬盘(cloud)。 + (Optional) */ + DiskCategory string `json:"diskCategory"` + + /* 随云主机一起删除,删除主机时自动删除此磁盘,默认为true,本地盘(local)不能更改此值。 +如果云主机中的数据盘(cloud)是包年包月计费方式,此参数不生效。 +如果云主机中的数据盘(cloud)是共享型数据盘,此参数不生效。 + (Optional) */ + AutoDelete bool `json:"autoDelete"` + + /* 本地磁盘配置 (Optional) */ + LocalDisk LocalDisk `json:"localDisk"` + + /* 云硬盘配置 (Optional) */ + CloudDisk disk.Disk `json:"cloudDisk"` + + /* 数据盘逻辑挂载点,取值范围:vda,vdb,vdc,vdd,vde,vdf,vdg,vdh,vdi (Optional) */ + DeviceName string `json:"deviceName"` + + /* 数据盘挂载状态,取值范围:attaching,detaching,attached,detached,error_attach,error_detach (Optional) */ + Status string `json:"status"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceDiskAttachmentSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceDiskAttachmentSpec.go new file mode 100644 index 000000000..452770331 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceDiskAttachmentSpec.go @@ -0,0 +1,47 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models" + +type InstanceDiskAttachmentSpec struct { + + /* 磁盘分类,取值为本地盘(local)或者云硬盘(cloud)。 +系统盘支持本地盘(local)或者云硬盘(cloud)。系统盘选择local类型,必须使用localDisk类型的镜像;同理系统盘选择cloud类型,必须使用cloudDisk类型的镜像。 +数据盘仅支持云硬盘(cloud)。 + (Optional) */ + DiskCategory *string `json:"diskCategory"` + + /* 是否随云主机一起删除,即删除主机时是否自动删除此磁盘,默认为true,本地盘(local)不能更改此值。 +如果云主机中的数据盘(cloud)是包年包月计费方式,此参数不生效。 +如果云主机中的数据盘(cloud)是共享型数据盘,此参数不生效。 + (Optional) */ + AutoDelete *bool `json:"autoDelete"` + + /* 数据盘配置 (Optional) */ + CloudDiskSpec *disk.DiskSpec `json:"cloudDiskSpec"` + + /* 数据盘逻辑挂载点,取值范围:vda,vdb,vdc,vdd,vde,vdf,vdg,vdh,vdi (Optional) */ + DeviceName *string `json:"deviceName"` + + /* 排除设备,使用此参数noDevice配合deviceName一起使用。 +创建整机镜像:如deviceName:vdb、noDevice:true,则表示云主机中的数据盘vdb不参与创建镜像。 +创建模板:如deviceName:vdb、noDevice:true,则表示镜像中的数据盘vdb不参与创建主机。 +创建主机:如deviceName:vdb、noDevice:true,则表示镜像中的数据盘vdb,或者模板(使用模板创建主机)中的数据盘vdb不参与创建主机。 + (Optional) */ + NoDevice *bool `json:"noDevice"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceDiskAttribute.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceDiskAttribute.go new file mode 100644 index 000000000..ef0197d39 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceDiskAttribute.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceDiskAttribute struct { + + /* 云硬盘ID (Optional) */ + DiskId *string `json:"diskId"` + + /* 随云主机一起删除,删除主机时自动删除此磁盘,默认为false,本地盘(local)不能更改此值。 +如果云主机中的数据盘(cloud)是包年包月计费方式,此参数不生效。 +如果云主机中的数据盘(cloud)是共享型数据盘,此参数不生效。 + (Optional) */ + AutoDelete *bool `json:"autoDelete"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkAttribute.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkAttribute.go new file mode 100644 index 000000000..c44383dc5 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkAttribute.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceNetworkAttribute struct { + + /* 弹性网卡ID (Optional) */ + NetworkInterfaceId *string `json:"networkInterfaceId"` + + /* 随主机自动删除,默认为False (Optional) */ + AutoDelete *bool `json:"autoDelete"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkInterface.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkInterface.go new file mode 100644 index 000000000..29af23e42 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkInterface.go @@ -0,0 +1,46 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + +type InstanceNetworkInterface struct { + + /* 弹性网卡ID (Optional) */ + NetworkInterfaceId string `json:"networkInterfaceId"` + + /* 以太网地址 (Optional) */ + MacAddress string `json:"macAddress"` + + /* 虚拟网络ID (Optional) */ + VpcId string `json:"vpcId"` + + /* 子网ID (Optional) */ + SubnetId string `json:"subnetId"` + + /* (Optional) */ + SecurityGroups []SecurityGroupSimple `json:"securityGroups"` + + /* 源和目标IP地址校验,取值为0或者1 (Optional) */ + SanityCheck int `json:"sanityCheck"` + + /* 网卡主IP (Optional) */ + PrimaryIp vpc.NetworkInterfacePrivateIp `json:"primaryIp"` + + /* 网卡辅IP (Optional) */ + SecondaryIps []vpc.NetworkInterfacePrivateIp `json:"secondaryIps"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkInterfaceAttachment.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkInterfaceAttachment.go new file mode 100644 index 000000000..2a8c79961 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkInterfaceAttachment.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceNetworkInterfaceAttachment struct { + + /* 设备Index (Optional) */ + DeviceIndex int `json:"deviceIndex"` + + /* 指明删除实例时是否删除网卡,默认true;当前只能是true (Optional) */ + AutoDelete bool `json:"autoDelete"` + + /* 网卡接口规范 (Optional) */ + NetworkInterface InstanceNetworkInterface `json:"networkInterface"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkInterfaceAttachmentSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkInterfaceAttachmentSpec.go new file mode 100644 index 000000000..d6e11621b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceNetworkInterfaceAttachmentSpec.go @@ -0,0 +1,28 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + +type InstanceNetworkInterfaceAttachmentSpec struct { + + /* 网卡设备Index,主网卡只能是1 (Optional) */ + DeviceIndex *int `json:"deviceIndex"` + + /* 网卡接口规范 (Optional) */ + NetworkInterface *vpc.NetworkInterfaceSpec `json:"networkInterface"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstancePrivateIpAddress.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstancePrivateIpAddress.go new file mode 100644 index 000000000..6436045c2 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstancePrivateIpAddress.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstancePrivateIpAddress struct { + + /* 云主机ID (Optional) */ + InstanceId string `json:"instanceId"` + + /* 主网卡内网主IP地址 (Optional) */ + PrivateIpAddress string `json:"privateIpAddress"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceSpec.go new file mode 100644 index 000000000..5dc4861c5 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceSpec.go @@ -0,0 +1,69 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +import charge "github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models" + +type InstanceSpec struct { + + /* 高可用组Id。指定了此参数后,只能通过高可用组关联的实例模板创建虚机,并且实例模板中的参数不可覆盖替换。实例模板以外的参数还可以指定。 (Optional) */ + AgId *string `json:"agId"` + + /* 实例模板id,如果没有使用高可用组,那么对于实例模板中没有的信息,需要使用创建虚机的参数进行补充,或者选择覆盖启动模板中的参数。 (Optional) */ + InstanceTemplateId *string `json:"instanceTemplateId"` + + /* 云主机所属的可用区。 (Optional) */ + Az *string `json:"az"` + + /* 实例规格。可查询DescribeInstanceTypes接口获得指定地域或可用区的规格信息。 (Optional) */ + InstanceType *string `json:"instanceType"` + + /* 镜像ID。可查询DescribeImages接口获得指定地域的镜像信息。 (Optional) */ + ImageId *string `json:"imageId"` + + /* 云主机名称,参考公共参数规范。 */ + Name string `json:"name"` + + /* 密码,参考公共参数规范。 (Optional) */ + Password *string `json:"password"` + + /* 密钥对名称,当前只支持传入一个。 (Optional) */ + KeyNames []string `json:"keyNames"` + + /* 主网卡主IP关联的弹性IP规格 (Optional) */ + ElasticIp *vpc.ElasticIpSpec `json:"elasticIp"` + + /* 主网卡配置信息 (Optional) */ + PrimaryNetworkInterface *InstanceNetworkInterfaceAttachmentSpec `json:"primaryNetworkInterface"` + + /* 系统盘配置信息 (Optional) */ + SystemDisk *InstanceDiskAttachmentSpec `json:"systemDisk"` + + /* 数据盘配置信息,本地盘(local类型)做系统盘的云主机可挂载8块数据盘,云硬盘(cloud类型)做系统盘的云主机可挂载7块数据盘。 (Optional) */ + DataDisks []InstanceDiskAttachmentSpec `json:"dataDisks"` + + /* 计费配置 +云主机不支持按用量方式计费,默认为按配置计费。 +打包创建数据盘的情况下,数据盘的计费方式只能与云主机保持一致。 +打包创建弹性公网IP的情况下,若公网IP的计费方式没有指定为按用量计费,那么公网IP计费方式只能与云主机保持一致。 + (Optional) */ + Charge *charge.ChargeSpec `json:"charge"` + + /* 主机描述,参考公共参数规范。 (Optional) */ + Description *string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceStatus.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceStatus.go new file mode 100644 index 000000000..3752f1930 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceStatus.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceStatus struct { + + /* 云主机ID (Optional) */ + InstanceId string `json:"instanceId"` + + /* 参考云主机状态 (Optional) */ + Status string `json:"status"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplate.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplate.go new file mode 100644 index 000000000..324918daf --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplate.go @@ -0,0 +1,39 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplate struct { + + /* 启动模板ID (Optional) */ + Id string `json:"id"` + + /* 启动模板名称 (Optional) */ + Name string `json:"name"` + + /* 启动模板描述 (Optional) */ + Description string `json:"description"` + + /* 启动模板的数据 (Optional) */ + InstanceTemplateData InstanceTemplateData `json:"instanceTemplateData"` + + /* 关联的高可用组(ag)信息 (Optional) */ + Ags []Ag `json:"ags"` + + /* 创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateData.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateData.go new file mode 100644 index 000000000..025e481cd --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateData.go @@ -0,0 +1,48 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateData struct { + + /* 实例规格 (Optional) */ + InstanceType string `json:"instanceType"` + + /* 主网卡所属VPC的ID (Optional) */ + VpcId string `json:"vpcId"` + + /* 镜像ID (Optional) */ + ImageId string `json:"imageId"` + + /* 启动模板中是否包含自定义密码,true:包含密码,false:不包含密码 (Optional) */ + IncludePassword bool `json:"includePassword"` + + /* 系统盘信息 (Optional) */ + SystemDisk InstanceTemplateDiskAttachment `json:"systemDisk"` + + /* 数据盘信息,本地盘(local类型)做系统盘的云主机可挂载8块数据盘,云硬盘(cloud类型)做系统盘的云主机可挂载7块数据盘。 (Optional) */ + DataDisks []InstanceTemplateDiskAttachment `json:"dataDisks"` + + /* 主网卡信息 (Optional) */ + PrimaryNetworkInterface InstanceTemplateNetworkInterfaceAttachmentSpec `json:"primaryNetworkInterface"` + + /* 主网卡主IP关联的弹性IP规格 (Optional) */ + ElasticIp InstanceTemplateElasticIp `json:"elasticIp"` + + /* 密钥对名称;当前只支持一个 (Optional) */ + KeyNames []string `json:"keyNames"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDisk.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDisk.go new file mode 100644 index 000000000..460df4513 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDisk.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateDisk struct { + + /* 云硬盘类型,取值为 ssd 或 premium-hdd (Optional) */ + DiskType string `json:"diskType"` + + /* 云硬盘大小,单位为 GiB;ssd 类型取值范围[20,1000]GB,步长为10G,premium-hdd 类型取值范围[20,3000]GB,步长为10G (Optional) */ + DiskSizeGB int `json:"diskSizeGB"` + + /* 用于创建云硬盘的快照ID (Optional) */ + SnapshotId string `json:"snapshotId"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDiskAttachment.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDiskAttachment.go new file mode 100644 index 000000000..ca4db289a --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDiskAttachment.go @@ -0,0 +1,46 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateDiskAttachment struct { + + /* 磁盘分类,取值为本地盘(local)或者数据盘(cloud)。 +系统盘支持本地盘(local)或者云硬盘(cloud)。系统盘选择local类型,必须使用localDisk类型的镜像;同理系统盘选择cloud类型,必须使用cloudDisk类型的镜像。 +数据盘仅支持云硬盘(cloud)。 + (Optional) */ + DiskCategory string `json:"diskCategory"` + + /* 随云主机一起删除,删除主机时自动删除此磁盘,默认为true,本地盘(local)不能更改此值。 +如果云主机中的数据盘(cloud)是包年包月计费方式,此参数不生效。 +如果云主机中的数据盘(cloud)是共享型数据盘,此参数不生效。 + (Optional) */ + AutoDelete bool `json:"autoDelete"` + + /* 数据盘配置 (Optional) */ + InstanceTemplateDisk InstanceTemplateDisk `json:"instanceTemplateDisk"` + + /* 数据盘逻辑挂载点,取值范围:vda,vdb,vdc,vdd,vde,vdf,vdg,vdh,vdi。系统盘不需要使用,数据盘时才能够使用。 (Optional) */ + DeviceName string `json:"deviceName"` + + /* 排除设备,使用此参数noDevice配合deviceName一起使用。 +创建整机镜像:如deviceName:vdb、noDevice:true,则表示云主机中的数据盘vdb不参与创建镜像。 +创建模板:如deviceName:vdb、noDevice:true,则表示镜像中的数据盘vdb不参与创建主机。 +创建主机:如deviceName:vdb、noDevice:true,则表示镜像中的数据盘vdb,或者模板(使用模板创建主机)中的数据盘vdb不参与创建主机。 + (Optional) */ + NoDevice bool `json:"noDevice"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDiskAttachmentSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDiskAttachmentSpec.go new file mode 100644 index 000000000..1a6746bd8 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDiskAttachmentSpec.go @@ -0,0 +1,44 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateDiskAttachmentSpec struct { + + /* 磁盘分类,取值为本地盘(local)或者数据盘(cloud)。 +系统盘支持本地盘(local)或者云硬盘(cloud)。系统盘选择local类型,必须使用localDisk类型的镜像;同理系统盘选择cloud类型,必须使用cloudDisk类型的镜像。 +数据盘仅支持云硬盘(cloud)。 + (Optional) */ + DiskCategory string `json:"diskCategory"` + + /* 随云主机一起删除,删除主机时自动删除此磁盘,默认为true,本地盘(local)不能更改此值。 +如果云主机中的数据盘(cloud)是包年包月计费方式,此参数不生效。 +如果云主机中的数据盘(cloud)是共享型数据盘,此参数不生效。 + (Optional) */ + AutoDelete bool `json:"autoDelete"` + + /* 数据盘规格 (Optional) */ + CloudDiskSpec InstanceTemplateDiskSpec `json:"cloudDiskSpec"` + + /* 数据盘逻辑挂载点,取值范围:vda,vdb,vdc,vdd,vde,vdf,vdg,vdh,vdi (Optional) */ + DeviceName string `json:"deviceName"` + + /* 排除设备,使用此参数noDevice配合deviceName一起使用。 +创建模板:如deviceName:vdb、noDevice:true,则表示镜像中的数据盘vdb不参与创建主机。 + (Optional) */ + NoDevice bool `json:"noDevice"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDiskSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDiskSpec.go new file mode 100644 index 000000000..b9784ffe7 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateDiskSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateDiskSpec struct { + + /* 云硬盘类型,取值为 ssd 或 premium-hdd (Optional) */ + DiskType string `json:"diskType"` + + /* 云硬盘大小,单位为 GiB;ssd 类型取值范围[20,1000]GB,步长为10G,premium-hdd 类型取值范围[20,3000]GB,步长为10G (Optional) */ + DiskSizeGB int `json:"diskSizeGB"` + + /* 用于创建云硬盘的快照ID (Optional) */ + SnapshotId string `json:"snapshotId"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateElasticIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateElasticIp.go new file mode 100644 index 000000000..b6db16956 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateElasticIp.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateElasticIp struct { + + /* 弹性公网IP的限速(单位:MB) */ + BandwidthMbps int `json:"bandwidthMbps"` + + /* IP服务商,取值为BGP,nonBGP (Optional) */ + Provider string `json:"provider"` + + /* 计费类型,支持按带宽计费(bandwith),按流量计费(flow) */ + ChargeMode string `json:"chargeMode"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateElasticIpSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateElasticIpSpec.go new file mode 100644 index 000000000..8ef4e0061 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateElasticIpSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateElasticIpSpec struct { + + /* 弹性公网IP的限速(单位:MB) */ + BandwidthMbps int `json:"bandwidthMbps"` + + /* IP服务商,取值为BGP,nonBGP (Optional) */ + Provider string `json:"provider"` + + /* 计费类型,支持按带宽计费(bandwith),按流量计费(flow) */ + ChargeMode string `json:"chargeMode"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateNetworkInterfaceAttachmentSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateNetworkInterfaceAttachmentSpec.go new file mode 100644 index 000000000..755410d02 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateNetworkInterfaceAttachmentSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateNetworkInterfaceAttachmentSpec struct { + + /* 设备Index;主网卡的index必须为1;当前仅支持主网卡 (Optional) */ + DeviceIndex int `json:"deviceIndex"` + + /* 指明删除实例时是否删除网卡,默认true;当前只能是true (Optional) */ + AutoDelete bool `json:"autoDelete"` + + /* 网卡接口规范;此字段当前必填 */ + NetworkInterface InstanceTemplateNetworkInterfaceSpec `json:"networkInterface"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateNetworkInterfaceSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateNetworkInterfaceSpec.go new file mode 100644 index 000000000..84ee385bf --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateNetworkInterfaceSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateNetworkInterfaceSpec struct { + + /* 子网ID */ + SubnetId string `json:"subnetId"` + + /* 安全组ID列表 (Optional) */ + SecurityGroups []string `json:"securityGroups"` + + /* PortSecurity,取值为0或者1,默认为1 (Optional) */ + SanityCheck int `json:"sanityCheck"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateSpec.go new file mode 100644 index 000000000..1eb5b7a7b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTemplateSpec.go @@ -0,0 +1,45 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTemplateSpec struct { + + /* 实例规格,可查询DescribeInstanceTypes接口获得指定地域或可用区的规格信息。 */ + InstanceType string `json:"instanceType"` + + /* 镜像ID,可查询DescribeImages接口获得指定地域的镜像信息。 */ + ImageId string `json:"imageId"` + + /* 密码,参考公共参数规范。 (Optional) */ + Password string `json:"password"` + + /* 密钥对名称;当前只支持一个 (Optional) */ + KeyNames []string `json:"keyNames"` + + /* 主网卡主IP关联的弹性IP规格 (Optional) */ + ElasticIp InstanceTemplateElasticIpSpec `json:"elasticIp"` + + /* 主网卡配置信息 */ + PrimaryNetworkInterface InstanceTemplateNetworkInterfaceAttachmentSpec `json:"primaryNetworkInterface"` + + /* 系统盘配置信息 */ + SystemDisk InstanceTemplateDiskAttachmentSpec `json:"systemDisk"` + + /* 数据盘配置信息 (Optional) */ + DataDisks []InstanceTemplateDiskAttachmentSpec `json:"dataDisks"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceType.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceType.go new file mode 100644 index 000000000..dbe403b20 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceType.go @@ -0,0 +1,48 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceType struct { + + /* 实例规格类型 (Optional) */ + Family string `json:"family"` + + /* 实例规格,比如g.b1.2xlarge (Optional) */ + InstanceType string `json:"instanceType"` + + /* cpu个数 (Optional) */ + Cpu int `json:"cpu"` + + /* 内存大小 (Optional) */ + MemoryMB int `json:"memoryMB"` + + /* 支持弹性网卡的数量 (Optional) */ + NicLimit int `json:"nicLimit"` + + /* 描述 (Optional) */ + Desc string `json:"desc"` + + /* 规格状态 (Optional) */ + State []InstanceTypeState `json:"state"` + + /* Gpu配置 (Optional) */ + Gpu Gpu `json:"gpu"` + + /* 本地缓存盘配置,目前只有Gpu规格上才有 (Optional) */ + LocalDisks []LocalDisk `json:"localDisks"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTypeState.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTypeState.go new file mode 100644 index 000000000..e047de43e --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/InstanceTypeState.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type InstanceTypeState struct { + + /* 可用区 (Optional) */ + Az string `json:"az"` + + /* 可售卖情况,true:可售卖、false:已售罄不可用 (Optional) */ + InStock bool `json:"inStock"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Keypair.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Keypair.go new file mode 100644 index 000000000..05c7ae891 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Keypair.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Keypair struct { + + /* 密钥对名称 (Optional) */ + KeyName string `json:"keyName"` + + /* 密钥对的指纹,根据 RFC4716 定义的公钥指纹格式,采用 MD5 信息摘要算法。 (Optional) */ + KeyFingerprint string `json:"keyFingerprint"` + + /* 创建时间 (Optional) */ + CreateTime string `json:"createTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/LocalDisk.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/LocalDisk.go new file mode 100644 index 000000000..740e65288 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/LocalDisk.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type LocalDisk struct { + + /* 磁盘类型,取值范围{premium-hdd, ssd} (Optional) */ + DiskType string `json:"diskType"` + + /* 磁盘大小 (Optional) */ + DiskSizeGB int `json:"diskSizeGB"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Quota.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Quota.go new file mode 100644 index 000000000..4d7f16df6 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Quota.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Quota struct { + + /* 资源类型[instance,keypair,image,instanceTemplate] (Optional) */ + ResourceType string `json:"resourceType"` + + /* 配额上限 (Optional) */ + Limit int `json:"limit"` + + /* 已用配额 (Optional) */ + Used int `json:"used"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/SecurityGroupSimple.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/SecurityGroupSimple.go new file mode 100644 index 000000000..17e221b6e --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/SecurityGroupSimple.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type SecurityGroupSimple struct { + + /* 安全组ID (Optional) */ + GroupId string `json:"groupId"` + + /* 安全组名称 (Optional) */ + GroupName string `json:"groupName"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Tag.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Tag.go new file mode 100644 index 000000000..467465457 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/Tag.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Tag struct { + + /* Tag键 (Optional) */ + Key string `json:"key"` + + /* Tag值 (Optional) */ + Value string `json:"value"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/TagFilter.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/TagFilter.go new file mode 100644 index 000000000..13daa19a1 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models/TagFilter.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type TagFilter struct { + + /* Tag键 (Optional) */ + Key string `json:"key"` + + /* Tag值 (Optional) */ + Values []string `json:"values"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AddNetworkAclRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AddNetworkAclRules.go new file mode 100644 index 000000000..9f52c7283 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AddNetworkAclRules.go @@ -0,0 +1,129 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type AddNetworkAclRulesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkAclId ID */ + NetworkAclId string `json:"networkAclId"` + + /* networkAcl规则列表 */ + NetworkAclRuleSpecs []vpc.AddNetworkAclRuleSpec `json:"networkAclRuleSpecs"` +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param networkAclRuleSpecs: networkAcl规则列表 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAddNetworkAclRulesRequest( + regionId string, + networkAclId string, + networkAclRuleSpecs []vpc.AddNetworkAclRuleSpec, +) *AddNetworkAclRulesRequest { + + return &AddNetworkAclRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:addNetworkAclRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + NetworkAclRuleSpecs: networkAclRuleSpecs, + } +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param networkAclRuleSpecs: networkAcl规则列表 (Required) + */ +func NewAddNetworkAclRulesRequestWithAllParams( + regionId string, + networkAclId string, + networkAclRuleSpecs []vpc.AddNetworkAclRuleSpec, +) *AddNetworkAclRulesRequest { + + return &AddNetworkAclRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:addNetworkAclRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + NetworkAclRuleSpecs: networkAclRuleSpecs, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAddNetworkAclRulesRequestWithoutParam() *AddNetworkAclRulesRequest { + + return &AddNetworkAclRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:addNetworkAclRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *AddNetworkAclRulesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkAclId: networkAclId ID(Required) */ +func (r *AddNetworkAclRulesRequest) SetNetworkAclId(networkAclId string) { + r.NetworkAclId = networkAclId +} + +/* param networkAclRuleSpecs: networkAcl规则列表(Required) */ +func (r *AddNetworkAclRulesRequest) SetNetworkAclRuleSpecs(networkAclRuleSpecs []vpc.AddNetworkAclRuleSpec) { + r.NetworkAclRuleSpecs = networkAclRuleSpecs +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AddNetworkAclRulesRequest) GetRegionId() string { + return r.RegionId +} + +type AddNetworkAclRulesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AddNetworkAclRulesResult `json:"result"` +} + +type AddNetworkAclRulesResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AddNetworkSecurityGroupRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AddNetworkSecurityGroupRules.go new file mode 100644 index 000000000..e4f635018 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AddNetworkSecurityGroupRules.go @@ -0,0 +1,129 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type AddNetworkSecurityGroupRulesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* NetworkSecurityGroup ID */ + NetworkSecurityGroupId string `json:"networkSecurityGroupId"` + + /* 安全组规则信息 */ + NetworkSecurityGroupRuleSpecs []vpc.AddSecurityGroupRules `json:"networkSecurityGroupRuleSpecs"` +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * param networkSecurityGroupRuleSpecs: 安全组规则信息 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAddNetworkSecurityGroupRulesRequest( + regionId string, + networkSecurityGroupId string, + networkSecurityGroupRuleSpecs []vpc.AddSecurityGroupRules, +) *AddNetworkSecurityGroupRulesRequest { + + return &AddNetworkSecurityGroupRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}:addNetworkSecurityGroupRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + NetworkSecurityGroupRuleSpecs: networkSecurityGroupRuleSpecs, + } +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * param networkSecurityGroupRuleSpecs: 安全组规则信息 (Required) + */ +func NewAddNetworkSecurityGroupRulesRequestWithAllParams( + regionId string, + networkSecurityGroupId string, + networkSecurityGroupRuleSpecs []vpc.AddSecurityGroupRules, +) *AddNetworkSecurityGroupRulesRequest { + + return &AddNetworkSecurityGroupRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}:addNetworkSecurityGroupRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + NetworkSecurityGroupRuleSpecs: networkSecurityGroupRuleSpecs, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAddNetworkSecurityGroupRulesRequestWithoutParam() *AddNetworkSecurityGroupRulesRequest { + + return &AddNetworkSecurityGroupRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}:addNetworkSecurityGroupRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *AddNetworkSecurityGroupRulesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkSecurityGroupId: NetworkSecurityGroup ID(Required) */ +func (r *AddNetworkSecurityGroupRulesRequest) SetNetworkSecurityGroupId(networkSecurityGroupId string) { + r.NetworkSecurityGroupId = networkSecurityGroupId +} + +/* param networkSecurityGroupRuleSpecs: 安全组规则信息(Required) */ +func (r *AddNetworkSecurityGroupRulesRequest) SetNetworkSecurityGroupRuleSpecs(networkSecurityGroupRuleSpecs []vpc.AddSecurityGroupRules) { + r.NetworkSecurityGroupRuleSpecs = networkSecurityGroupRuleSpecs +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AddNetworkSecurityGroupRulesRequest) GetRegionId() string { + return r.RegionId +} + +type AddNetworkSecurityGroupRulesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AddNetworkSecurityGroupRulesResult `json:"result"` +} + +type AddNetworkSecurityGroupRulesResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AddRouteTableRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AddRouteTableRules.go new file mode 100644 index 000000000..1dbd5382b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AddRouteTableRules.go @@ -0,0 +1,129 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type AddRouteTableRulesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* RouteTable ID */ + RouteTableId string `json:"routeTableId"` + + /* 安全组规则信息 */ + RouteTableRuleSpecs []vpc.AddRouteTableRules `json:"routeTableRuleSpecs"` +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param routeTableRuleSpecs: 安全组规则信息 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAddRouteTableRulesRequest( + regionId string, + routeTableId string, + routeTableRuleSpecs []vpc.AddRouteTableRules, +) *AddRouteTableRulesRequest { + + return &AddRouteTableRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:addRouteTableRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + RouteTableRuleSpecs: routeTableRuleSpecs, + } +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param routeTableRuleSpecs: 安全组规则信息 (Required) + */ +func NewAddRouteTableRulesRequestWithAllParams( + regionId string, + routeTableId string, + routeTableRuleSpecs []vpc.AddRouteTableRules, +) *AddRouteTableRulesRequest { + + return &AddRouteTableRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:addRouteTableRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + RouteTableRuleSpecs: routeTableRuleSpecs, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAddRouteTableRulesRequestWithoutParam() *AddRouteTableRulesRequest { + + return &AddRouteTableRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:addRouteTableRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *AddRouteTableRulesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param routeTableId: RouteTable ID(Required) */ +func (r *AddRouteTableRulesRequest) SetRouteTableId(routeTableId string) { + r.RouteTableId = routeTableId +} + +/* param routeTableRuleSpecs: 安全组规则信息(Required) */ +func (r *AddRouteTableRulesRequest) SetRouteTableRuleSpecs(routeTableRuleSpecs []vpc.AddRouteTableRules) { + r.RouteTableRuleSpecs = routeTableRuleSpecs +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AddRouteTableRulesRequest) GetRegionId() string { + return r.RegionId +} + +type AddRouteTableRulesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AddRouteTableRulesResult `json:"result"` +} + +type AddRouteTableRulesResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssignSecondaryIps.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssignSecondaryIps.go new file mode 100644 index 000000000..ecf6b3a43 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssignSecondaryIps.go @@ -0,0 +1,147 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type AssignSecondaryIpsRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkInterface ID */ + NetworkInterfaceId string `json:"networkInterfaceId"` + + /* secondary ip被其他接口占用时,是否抢占。false:非抢占重分配,true:抢占重分配,默认抢占重分配。默认值:true (Optional) */ + Force *bool `json:"force"` + + /* 指定分配的secondaryIp地址 (Optional) */ + SecondaryIps []string `json:"secondaryIps"` + + /* 指定自动分配的secondaryIp个数 (Optional) */ + SecondaryIpCount *int `json:"secondaryIpCount"` +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAssignSecondaryIpsRequest( + regionId string, + networkInterfaceId string, +) *AssignSecondaryIpsRequest { + + return &AssignSecondaryIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:assignSecondaryIps", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * param force: secondary ip被其他接口占用时,是否抢占。false:非抢占重分配,true:抢占重分配,默认抢占重分配。默认值:true (Optional) + * param secondaryIps: 指定分配的secondaryIp地址 (Optional) + * param secondaryIpCount: 指定自动分配的secondaryIp个数 (Optional) + */ +func NewAssignSecondaryIpsRequestWithAllParams( + regionId string, + networkInterfaceId string, + force *bool, + secondaryIps []string, + secondaryIpCount *int, +) *AssignSecondaryIpsRequest { + + return &AssignSecondaryIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:assignSecondaryIps", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + Force: force, + SecondaryIps: secondaryIps, + SecondaryIpCount: secondaryIpCount, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAssignSecondaryIpsRequestWithoutParam() *AssignSecondaryIpsRequest { + + return &AssignSecondaryIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:assignSecondaryIps", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *AssignSecondaryIpsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkInterfaceId: networkInterface ID(Required) */ +func (r *AssignSecondaryIpsRequest) SetNetworkInterfaceId(networkInterfaceId string) { + r.NetworkInterfaceId = networkInterfaceId +} + +/* param force: secondary ip被其他接口占用时,是否抢占。false:非抢占重分配,true:抢占重分配,默认抢占重分配。默认值:true(Optional) */ +func (r *AssignSecondaryIpsRequest) SetForce(force bool) { + r.Force = &force +} + +/* param secondaryIps: 指定分配的secondaryIp地址(Optional) */ +func (r *AssignSecondaryIpsRequest) SetSecondaryIps(secondaryIps []string) { + r.SecondaryIps = secondaryIps +} + +/* param secondaryIpCount: 指定自动分配的secondaryIp个数(Optional) */ +func (r *AssignSecondaryIpsRequest) SetSecondaryIpCount(secondaryIpCount int) { + r.SecondaryIpCount = &secondaryIpCount +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AssignSecondaryIpsRequest) GetRegionId() string { + return r.RegionId +} + +type AssignSecondaryIpsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AssignSecondaryIpsResult `json:"result"` +} + +type AssignSecondaryIpsResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssociateElasticIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssociateElasticIp.go new file mode 100644 index 000000000..325099c4f --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssociateElasticIp.go @@ -0,0 +1,147 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type AssociateElasticIpRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkInterface ID */ + NetworkInterfaceId string `json:"networkInterfaceId"` + + /* 绑定的弹性Ip Id (Optional) */ + ElasticIpId *string `json:"elasticIpId"` + + /* 绑定弹性Ip到指定的privateIp (Optional) */ + PrivateIpAddress *string `json:"privateIpAddress"` + + /* 绑定的弹性Ip地址 (Optional) */ + ElasticIpAddress *string `json:"elasticIpAddress"` +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAssociateElasticIpRequest( + regionId string, + networkInterfaceId string, +) *AssociateElasticIpRequest { + + return &AssociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:associateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * param elasticIpId: 绑定的弹性Ip Id (Optional) + * param privateIpAddress: 绑定弹性Ip到指定的privateIp (Optional) + * param elasticIpAddress: 绑定的弹性Ip地址 (Optional) + */ +func NewAssociateElasticIpRequestWithAllParams( + regionId string, + networkInterfaceId string, + elasticIpId *string, + privateIpAddress *string, + elasticIpAddress *string, +) *AssociateElasticIpRequest { + + return &AssociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:associateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + ElasticIpId: elasticIpId, + PrivateIpAddress: privateIpAddress, + ElasticIpAddress: elasticIpAddress, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAssociateElasticIpRequestWithoutParam() *AssociateElasticIpRequest { + + return &AssociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:associateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *AssociateElasticIpRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkInterfaceId: networkInterface ID(Required) */ +func (r *AssociateElasticIpRequest) SetNetworkInterfaceId(networkInterfaceId string) { + r.NetworkInterfaceId = networkInterfaceId +} + +/* param elasticIpId: 绑定的弹性Ip Id(Optional) */ +func (r *AssociateElasticIpRequest) SetElasticIpId(elasticIpId string) { + r.ElasticIpId = &elasticIpId +} + +/* param privateIpAddress: 绑定弹性Ip到指定的privateIp(Optional) */ +func (r *AssociateElasticIpRequest) SetPrivateIpAddress(privateIpAddress string) { + r.PrivateIpAddress = &privateIpAddress +} + +/* param elasticIpAddress: 绑定的弹性Ip地址(Optional) */ +func (r *AssociateElasticIpRequest) SetElasticIpAddress(elasticIpAddress string) { + r.ElasticIpAddress = &elasticIpAddress +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AssociateElasticIpRequest) GetRegionId() string { + return r.RegionId +} + +type AssociateElasticIpResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AssociateElasticIpResult `json:"result"` +} + +type AssociateElasticIpResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssociateNetworkAcl.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssociateNetworkAcl.go new file mode 100644 index 000000000..2e33b993b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssociateNetworkAcl.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type AssociateNetworkAclRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkAclId ID */ + NetworkAclId string `json:"networkAclId"` + + /* networkAcl要绑定的子网ID列表, subnet已被其他networkAcl绑定时,自动解绑 */ + SubnetIds []string `json:"subnetIds"` +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param subnetIds: networkAcl要绑定的子网ID列表, subnet已被其他networkAcl绑定时,自动解绑 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAssociateNetworkAclRequest( + regionId string, + networkAclId string, + subnetIds []string, +) *AssociateNetworkAclRequest { + + return &AssociateNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:associateNetworkAcl", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + SubnetIds: subnetIds, + } +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param subnetIds: networkAcl要绑定的子网ID列表, subnet已被其他networkAcl绑定时,自动解绑 (Required) + */ +func NewAssociateNetworkAclRequestWithAllParams( + regionId string, + networkAclId string, + subnetIds []string, +) *AssociateNetworkAclRequest { + + return &AssociateNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:associateNetworkAcl", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + SubnetIds: subnetIds, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAssociateNetworkAclRequestWithoutParam() *AssociateNetworkAclRequest { + + return &AssociateNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:associateNetworkAcl", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *AssociateNetworkAclRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkAclId: networkAclId ID(Required) */ +func (r *AssociateNetworkAclRequest) SetNetworkAclId(networkAclId string) { + r.NetworkAclId = networkAclId +} + +/* param subnetIds: networkAcl要绑定的子网ID列表, subnet已被其他networkAcl绑定时,自动解绑(Required) */ +func (r *AssociateNetworkAclRequest) SetSubnetIds(subnetIds []string) { + r.SubnetIds = subnetIds +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AssociateNetworkAclRequest) GetRegionId() string { + return r.RegionId +} + +type AssociateNetworkAclResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AssociateNetworkAclResult `json:"result"` +} + +type AssociateNetworkAclResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssociateRouteTable.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssociateRouteTable.go new file mode 100644 index 000000000..d7f544e8b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/AssociateRouteTable.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type AssociateRouteTableRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* RouteTable ID */ + RouteTableId string `json:"routeTableId"` + + /* 路由表要绑定的子网ID列表, subnet已被其他路由表绑定时,自动解绑。 */ + SubnetIds []string `json:"subnetIds"` +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param subnetIds: 路由表要绑定的子网ID列表, subnet已被其他路由表绑定时,自动解绑。 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewAssociateRouteTableRequest( + regionId string, + routeTableId string, + subnetIds []string, +) *AssociateRouteTableRequest { + + return &AssociateRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:associateRouteTable", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + SubnetIds: subnetIds, + } +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param subnetIds: 路由表要绑定的子网ID列表, subnet已被其他路由表绑定时,自动解绑。 (Required) + */ +func NewAssociateRouteTableRequestWithAllParams( + regionId string, + routeTableId string, + subnetIds []string, +) *AssociateRouteTableRequest { + + return &AssociateRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:associateRouteTable", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + SubnetIds: subnetIds, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewAssociateRouteTableRequestWithoutParam() *AssociateRouteTableRequest { + + return &AssociateRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:associateRouteTable", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *AssociateRouteTableRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param routeTableId: RouteTable ID(Required) */ +func (r *AssociateRouteTableRequest) SetRouteTableId(routeTableId string) { + r.RouteTableId = routeTableId +} + +/* param subnetIds: 路由表要绑定的子网ID列表, subnet已被其他路由表绑定时,自动解绑。(Required) */ +func (r *AssociateRouteTableRequest) SetSubnetIds(subnetIds []string) { + r.SubnetIds = subnetIds +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r AssociateRouteTableRequest) GetRegionId() string { + return r.RegionId +} + +type AssociateRouteTableResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result AssociateRouteTableResult `json:"result"` +} + +type AssociateRouteTableResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateElasticIps.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateElasticIps.go new file mode 100644 index 000000000..6ac78c2f5 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateElasticIps.go @@ -0,0 +1,142 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type CreateElasticIpsRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 购买弹性ip数量;取值范围:[1,100] */ + MaxCount int `json:"maxCount"` + + /* 指定弹性ip地址进行创建,当申请创建多个弹性ip时,必须为空 (Optional) */ + ElasticIpAddress *string `json:"elasticIpAddress"` + + /* 弹性ip规格 */ + ElasticIpSpec *vpc.ElasticIpSpec `json:"elasticIpSpec"` +} + +/* + * param regionId: Region ID (Required) + * param maxCount: 购买弹性ip数量;取值范围:[1,100] (Required) + * param elasticIpSpec: 弹性ip规格 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateElasticIpsRequest( + regionId string, + maxCount int, + elasticIpSpec *vpc.ElasticIpSpec, +) *CreateElasticIpsRequest { + + return &CreateElasticIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + MaxCount: maxCount, + ElasticIpSpec: elasticIpSpec, + } +} + +/* + * param regionId: Region ID (Required) + * param maxCount: 购买弹性ip数量;取值范围:[1,100] (Required) + * param elasticIpAddress: 指定弹性ip地址进行创建,当申请创建多个弹性ip时,必须为空 (Optional) + * param elasticIpSpec: 弹性ip规格 (Required) + */ +func NewCreateElasticIpsRequestWithAllParams( + regionId string, + maxCount int, + elasticIpAddress *string, + elasticIpSpec *vpc.ElasticIpSpec, +) *CreateElasticIpsRequest { + + return &CreateElasticIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + MaxCount: maxCount, + ElasticIpAddress: elasticIpAddress, + ElasticIpSpec: elasticIpSpec, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateElasticIpsRequestWithoutParam() *CreateElasticIpsRequest { + + return &CreateElasticIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *CreateElasticIpsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param maxCount: 购买弹性ip数量;取值范围:[1,100](Required) */ +func (r *CreateElasticIpsRequest) SetMaxCount(maxCount int) { + r.MaxCount = maxCount +} + +/* param elasticIpAddress: 指定弹性ip地址进行创建,当申请创建多个弹性ip时,必须为空(Optional) */ +func (r *CreateElasticIpsRequest) SetElasticIpAddress(elasticIpAddress string) { + r.ElasticIpAddress = &elasticIpAddress +} + +/* param elasticIpSpec: 弹性ip规格(Required) */ +func (r *CreateElasticIpsRequest) SetElasticIpSpec(elasticIpSpec *vpc.ElasticIpSpec) { + r.ElasticIpSpec = elasticIpSpec +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateElasticIpsRequest) GetRegionId() string { + return r.RegionId +} + +type CreateElasticIpsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateElasticIpsResult `json:"result"` +} + +type CreateElasticIpsResult struct { + ElasticIpIds []string `json:"elasticIpIds"` + RequestId string `json:"requestId"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateNetworkAcl.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateNetworkAcl.go new file mode 100644 index 000000000..f1f81bfd8 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateNetworkAcl.go @@ -0,0 +1,140 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type CreateNetworkAclRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 私有网络id */ + VpcId string `json:"vpcId"` + + /* networkAcl名称 */ + NetworkAclName string `json:"networkAclName"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param vpcId: 私有网络id (Required) + * param networkAclName: networkAcl名称 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateNetworkAclRequest( + regionId string, + vpcId string, + networkAclName string, +) *CreateNetworkAclRequest { + + return &CreateNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + NetworkAclName: networkAclName, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcId: 私有网络id (Required) + * param networkAclName: networkAcl名称 (Required) + * param description: 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) + */ +func NewCreateNetworkAclRequestWithAllParams( + regionId string, + vpcId string, + networkAclName string, + description *string, +) *CreateNetworkAclRequest { + + return &CreateNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + NetworkAclName: networkAclName, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateNetworkAclRequestWithoutParam() *CreateNetworkAclRequest { + + return &CreateNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *CreateNetworkAclRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcId: 私有网络id(Required) */ +func (r *CreateNetworkAclRequest) SetVpcId(vpcId string) { + r.VpcId = vpcId +} + +/* param networkAclName: networkAcl名称(Required) */ +func (r *CreateNetworkAclRequest) SetNetworkAclName(networkAclName string) { + r.NetworkAclName = networkAclName +} + +/* param description: 描述,允许输入UTF-8编码下的全部字符,不超过256字符(Optional) */ +func (r *CreateNetworkAclRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateNetworkAclRequest) GetRegionId() string { + return r.RegionId +} + +type CreateNetworkAclResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateNetworkAclResult `json:"result"` +} + +type CreateNetworkAclResult struct { + NetworkAclId string `json:"networkAclId"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateNetworkInterface.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateNetworkInterface.go new file mode 100644 index 000000000..14ce0da3c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateNetworkInterface.go @@ -0,0 +1,203 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type CreateNetworkInterfaceRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 子网ID */ + SubnetId string `json:"subnetId"` + + /* 可用区,用户的默认可用区 (Optional) */ + Az *string `json:"az"` + + /* 网卡名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) */ + NetworkInterfaceName *string `json:"networkInterfaceName"` + + /* 网卡主IP,如果不指定,会自动从子网中分配 (Optional) */ + PrimaryIpAddress *string `json:"primaryIpAddress"` + + /* SecondaryIp列表 (Optional) */ + SecondaryIpAddresses []string `json:"secondaryIpAddresses"` + + /* 自动分配的SecondaryIp数量 (Optional) */ + SecondaryIpCount *int `json:"secondaryIpCount"` + + /* 要绑定的安全组ID列表,最多指定5个安全组 (Optional) */ + SecurityGroups []string `json:"securityGroups"` + + /* 源和目标IP地址校验,取值为0或者1,默认为1 (Optional) */ + SanityCheck *int `json:"sanityCheck"` + + /* 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param subnetId: 子网ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateNetworkInterfaceRequest( + regionId string, + subnetId string, +) *CreateNetworkInterfaceRequest { + + return &CreateNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SubnetId: subnetId, + } +} + +/* + * param regionId: Region ID (Required) + * param subnetId: 子网ID (Required) + * param az: 可用区,用户的默认可用区 (Optional) + * param networkInterfaceName: 网卡名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) + * param primaryIpAddress: 网卡主IP,如果不指定,会自动从子网中分配 (Optional) + * param secondaryIpAddresses: SecondaryIp列表 (Optional) + * param secondaryIpCount: 自动分配的SecondaryIp数量 (Optional) + * param securityGroups: 要绑定的安全组ID列表,最多指定5个安全组 (Optional) + * param sanityCheck: 源和目标IP地址校验,取值为0或者1,默认为1 (Optional) + * param description: 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) + */ +func NewCreateNetworkInterfaceRequestWithAllParams( + regionId string, + subnetId string, + az *string, + networkInterfaceName *string, + primaryIpAddress *string, + secondaryIpAddresses []string, + secondaryIpCount *int, + securityGroups []string, + sanityCheck *int, + description *string, +) *CreateNetworkInterfaceRequest { + + return &CreateNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SubnetId: subnetId, + Az: az, + NetworkInterfaceName: networkInterfaceName, + PrimaryIpAddress: primaryIpAddress, + SecondaryIpAddresses: secondaryIpAddresses, + SecondaryIpCount: secondaryIpCount, + SecurityGroups: securityGroups, + SanityCheck: sanityCheck, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateNetworkInterfaceRequestWithoutParam() *CreateNetworkInterfaceRequest { + + return &CreateNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *CreateNetworkInterfaceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param subnetId: 子网ID(Required) */ +func (r *CreateNetworkInterfaceRequest) SetSubnetId(subnetId string) { + r.SubnetId = subnetId +} + +/* param az: 可用区,用户的默认可用区(Optional) */ +func (r *CreateNetworkInterfaceRequest) SetAz(az string) { + r.Az = &az +} + +/* param networkInterfaceName: 网卡名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。(Optional) */ +func (r *CreateNetworkInterfaceRequest) SetNetworkInterfaceName(networkInterfaceName string) { + r.NetworkInterfaceName = &networkInterfaceName +} + +/* param primaryIpAddress: 网卡主IP,如果不指定,会自动从子网中分配(Optional) */ +func (r *CreateNetworkInterfaceRequest) SetPrimaryIpAddress(primaryIpAddress string) { + r.PrimaryIpAddress = &primaryIpAddress +} + +/* param secondaryIpAddresses: SecondaryIp列表(Optional) */ +func (r *CreateNetworkInterfaceRequest) SetSecondaryIpAddresses(secondaryIpAddresses []string) { + r.SecondaryIpAddresses = secondaryIpAddresses +} + +/* param secondaryIpCount: 自动分配的SecondaryIp数量(Optional) */ +func (r *CreateNetworkInterfaceRequest) SetSecondaryIpCount(secondaryIpCount int) { + r.SecondaryIpCount = &secondaryIpCount +} + +/* param securityGroups: 要绑定的安全组ID列表,最多指定5个安全组(Optional) */ +func (r *CreateNetworkInterfaceRequest) SetSecurityGroups(securityGroups []string) { + r.SecurityGroups = securityGroups +} + +/* param sanityCheck: 源和目标IP地址校验,取值为0或者1,默认为1(Optional) */ +func (r *CreateNetworkInterfaceRequest) SetSanityCheck(sanityCheck int) { + r.SanityCheck = &sanityCheck +} + +/* param description: 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符(Optional) */ +func (r *CreateNetworkInterfaceRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateNetworkInterfaceRequest) GetRegionId() string { + return r.RegionId +} + +type CreateNetworkInterfaceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateNetworkInterfaceResult `json:"result"` +} + +type CreateNetworkInterfaceResult struct { + NetworkInterfaceId string `json:"networkInterfaceId"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateNetworkSecurityGroup.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateNetworkSecurityGroup.go new file mode 100644 index 000000000..c0765bb2c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateNetworkSecurityGroup.go @@ -0,0 +1,140 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type CreateNetworkSecurityGroupRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 私有网络ID */ + VpcId string `json:"vpcId"` + + /* 安全组名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 */ + NetworkSecurityGroupName string `json:"networkSecurityGroupName"` + + /* 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param vpcId: 私有网络ID (Required) + * param networkSecurityGroupName: 安全组名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateNetworkSecurityGroupRequest( + regionId string, + vpcId string, + networkSecurityGroupName string, +) *CreateNetworkSecurityGroupRequest { + + return &CreateNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + NetworkSecurityGroupName: networkSecurityGroupName, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcId: 私有网络ID (Required) + * param networkSecurityGroupName: 安全组名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required) + * param description: 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) + */ +func NewCreateNetworkSecurityGroupRequestWithAllParams( + regionId string, + vpcId string, + networkSecurityGroupName string, + description *string, +) *CreateNetworkSecurityGroupRequest { + + return &CreateNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + NetworkSecurityGroupName: networkSecurityGroupName, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateNetworkSecurityGroupRequestWithoutParam() *CreateNetworkSecurityGroupRequest { + + return &CreateNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *CreateNetworkSecurityGroupRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcId: 私有网络ID(Required) */ +func (r *CreateNetworkSecurityGroupRequest) SetVpcId(vpcId string) { + r.VpcId = vpcId +} + +/* param networkSecurityGroupName: 安全组名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。(Required) */ +func (r *CreateNetworkSecurityGroupRequest) SetNetworkSecurityGroupName(networkSecurityGroupName string) { + r.NetworkSecurityGroupName = networkSecurityGroupName +} + +/* param description: 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符(Optional) */ +func (r *CreateNetworkSecurityGroupRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateNetworkSecurityGroupRequest) GetRegionId() string { + return r.RegionId +} + +type CreateNetworkSecurityGroupResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateNetworkSecurityGroupResult `json:"result"` +} + +type CreateNetworkSecurityGroupResult struct { + NetworkSecurityGroupId string `json:"networkSecurityGroupId"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateRouteTable.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateRouteTable.go new file mode 100644 index 000000000..9cf289d88 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateRouteTable.go @@ -0,0 +1,140 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type CreateRouteTableRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 路由表所属的私有网络ID */ + VpcId string `json:"vpcId"` + + /* 路由表名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 */ + RouteTableName string `json:"routeTableName"` + + /* 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param vpcId: 路由表所属的私有网络ID (Required) + * param routeTableName: 路由表名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateRouteTableRequest( + regionId string, + vpcId string, + routeTableName string, +) *CreateRouteTableRequest { + + return &CreateRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + RouteTableName: routeTableName, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcId: 路由表所属的私有网络ID (Required) + * param routeTableName: 路由表名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required) + * param description: 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) + */ +func NewCreateRouteTableRequestWithAllParams( + regionId string, + vpcId string, + routeTableName string, + description *string, +) *CreateRouteTableRequest { + + return &CreateRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + RouteTableName: routeTableName, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateRouteTableRequestWithoutParam() *CreateRouteTableRequest { + + return &CreateRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *CreateRouteTableRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcId: 路由表所属的私有网络ID(Required) */ +func (r *CreateRouteTableRequest) SetVpcId(vpcId string) { + r.VpcId = vpcId +} + +/* param routeTableName: 路由表名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。(Required) */ +func (r *CreateRouteTableRequest) SetRouteTableName(routeTableName string) { + r.RouteTableName = routeTableName +} + +/* param description: 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符(Optional) */ +func (r *CreateRouteTableRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateRouteTableRequest) GetRegionId() string { + return r.RegionId +} + +type CreateRouteTableResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateRouteTableResult `json:"result"` +} + +type CreateRouteTableResult struct { + RouteTableId string `json:"routeTableId"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateSubnet.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateSubnet.go new file mode 100644 index 000000000..eb2523d43 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateSubnet.go @@ -0,0 +1,165 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type CreateSubnetRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 子网所属vpc的Id */ + VpcId string `json:"vpcId"` + + /* 子网名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 */ + SubnetName string `json:"subnetName"` + + /* 子网网段,vpc内子网网段不能重叠,cidr的取值范围:10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间,如果vpc含有cidr,则必须为vpc所在cidr的子网 */ + AddressPrefix string `json:"addressPrefix"` + + /* 子网关联的路由表Id, 默认为vpc的默认路由表 (Optional) */ + RouteTableId *string `json:"routeTableId"` + + /* 子网描述信息,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param vpcId: 子网所属vpc的Id (Required) + * param subnetName: 子网名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required) + * param addressPrefix: 子网网段,vpc内子网网段不能重叠,cidr的取值范围:10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间,如果vpc含有cidr,则必须为vpc所在cidr的子网 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateSubnetRequest( + regionId string, + vpcId string, + subnetName string, + addressPrefix string, +) *CreateSubnetRequest { + + return &CreateSubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + SubnetName: subnetName, + AddressPrefix: addressPrefix, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcId: 子网所属vpc的Id (Required) + * param subnetName: 子网名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required) + * param addressPrefix: 子网网段,vpc内子网网段不能重叠,cidr的取值范围:10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间,如果vpc含有cidr,则必须为vpc所在cidr的子网 (Required) + * param routeTableId: 子网关联的路由表Id, 默认为vpc的默认路由表 (Optional) + * param description: 子网描述信息,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) + */ +func NewCreateSubnetRequestWithAllParams( + regionId string, + vpcId string, + subnetName string, + addressPrefix string, + routeTableId *string, + description *string, +) *CreateSubnetRequest { + + return &CreateSubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + SubnetName: subnetName, + AddressPrefix: addressPrefix, + RouteTableId: routeTableId, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateSubnetRequestWithoutParam() *CreateSubnetRequest { + + return &CreateSubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *CreateSubnetRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcId: 子网所属vpc的Id(Required) */ +func (r *CreateSubnetRequest) SetVpcId(vpcId string) { + r.VpcId = vpcId +} + +/* param subnetName: 子网名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。(Required) */ +func (r *CreateSubnetRequest) SetSubnetName(subnetName string) { + r.SubnetName = subnetName +} + +/* param addressPrefix: 子网网段,vpc内子网网段不能重叠,cidr的取值范围:10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间,如果vpc含有cidr,则必须为vpc所在cidr的子网(Required) */ +func (r *CreateSubnetRequest) SetAddressPrefix(addressPrefix string) { + r.AddressPrefix = addressPrefix +} + +/* param routeTableId: 子网关联的路由表Id, 默认为vpc的默认路由表(Optional) */ +func (r *CreateSubnetRequest) SetRouteTableId(routeTableId string) { + r.RouteTableId = &routeTableId +} + +/* param description: 子网描述信息,允许输入UTF-8编码下的全部字符,不超过256字符。(Optional) */ +func (r *CreateSubnetRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateSubnetRequest) GetRegionId() string { + return r.RegionId +} + +type CreateSubnetResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateSubnetResult `json:"result"` +} + +type CreateSubnetResult struct { + SubnetId string `json:"subnetId"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateVpc.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateVpc.go new file mode 100644 index 000000000..60641f9d9 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateVpc.go @@ -0,0 +1,137 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type CreateVpcRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 */ + VpcName string `json:"vpcName"` + + /* 如果为空,则不限制网段,如果不为空,10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间 (Optional) */ + AddressPrefix *string `json:"addressPrefix"` + + /* vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param vpcName: 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateVpcRequest( + regionId string, + vpcName string, +) *CreateVpcRequest { + + return &CreateVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcName: vpcName, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcName: 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required) + * param addressPrefix: 如果为空,则不限制网段,如果不为空,10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间 (Optional) + * param description: vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) + */ +func NewCreateVpcRequestWithAllParams( + regionId string, + vpcName string, + addressPrefix *string, + description *string, +) *CreateVpcRequest { + + return &CreateVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcName: vpcName, + AddressPrefix: addressPrefix, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateVpcRequestWithoutParam() *CreateVpcRequest { + + return &CreateVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *CreateVpcRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcName: 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。(Required) */ +func (r *CreateVpcRequest) SetVpcName(vpcName string) { + r.VpcName = vpcName +} + +/* param addressPrefix: 如果为空,则不限制网段,如果不为空,10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间(Optional) */ +func (r *CreateVpcRequest) SetAddressPrefix(addressPrefix string) { + r.AddressPrefix = &addressPrefix +} + +/* param description: vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。(Optional) */ +func (r *CreateVpcRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateVpcRequest) GetRegionId() string { + return r.RegionId +} + +type CreateVpcResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateVpcResult `json:"result"` +} + +type CreateVpcResult struct { + VpcId string `json:"vpcId"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateVpcPeering.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateVpcPeering.go new file mode 100644 index 000000000..518a33f57 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/CreateVpcPeering.go @@ -0,0 +1,155 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type CreateVpcPeeringRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* VpcPeering的名字,不为空。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 */ + VpcPeeringName string `json:"vpcPeeringName"` + + /* VpcPeering本端Vpc的Id */ + VpcId string `json:"vpcId"` + + /* VpcPeering对端Vpc的Id */ + RemoteVpcId string `json:"remoteVpcId"` + + /* VpcPeering 描述,取值范围:0-256个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param vpcPeeringName: VpcPeering的名字,不为空。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Required) + * param vpcId: VpcPeering本端Vpc的Id (Required) + * param remoteVpcId: VpcPeering对端Vpc的Id (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewCreateVpcPeeringRequest( + regionId string, + vpcPeeringName string, + vpcId string, + remoteVpcId string, +) *CreateVpcPeeringRequest { + + return &CreateVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcPeeringName: vpcPeeringName, + VpcId: vpcId, + RemoteVpcId: remoteVpcId, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcPeeringName: VpcPeering的名字,不为空。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Required) + * param vpcId: VpcPeering本端Vpc的Id (Required) + * param remoteVpcId: VpcPeering对端Vpc的Id (Required) + * param description: VpcPeering 描述,取值范围:0-256个中文、英文大小写的字母、数字和下划线分隔符 (Optional) + */ +func NewCreateVpcPeeringRequestWithAllParams( + regionId string, + vpcPeeringName string, + vpcId string, + remoteVpcId string, + description *string, +) *CreateVpcPeeringRequest { + + return &CreateVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcPeeringName: vpcPeeringName, + VpcId: vpcId, + RemoteVpcId: remoteVpcId, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewCreateVpcPeeringRequestWithoutParam() *CreateVpcPeeringRequest { + + return &CreateVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *CreateVpcPeeringRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcPeeringName: VpcPeering的名字,不为空。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符(Required) */ +func (r *CreateVpcPeeringRequest) SetVpcPeeringName(vpcPeeringName string) { + r.VpcPeeringName = vpcPeeringName +} + +/* param vpcId: VpcPeering本端Vpc的Id(Required) */ +func (r *CreateVpcPeeringRequest) SetVpcId(vpcId string) { + r.VpcId = vpcId +} + +/* param remoteVpcId: VpcPeering对端Vpc的Id(Required) */ +func (r *CreateVpcPeeringRequest) SetRemoteVpcId(remoteVpcId string) { + r.RemoteVpcId = remoteVpcId +} + +/* param description: VpcPeering 描述,取值范围:0-256个中文、英文大小写的字母、数字和下划线分隔符(Optional) */ +func (r *CreateVpcPeeringRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r CreateVpcPeeringRequest) GetRegionId() string { + return r.RegionId +} + +type CreateVpcPeeringResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result CreateVpcPeeringResult `json:"result"` +} + +type CreateVpcPeeringResult struct { + VpcPeering vpc.VpcPeering `json:"vpcPeering"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteElasticIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteElasticIp.go new file mode 100644 index 000000000..0aa9c8bcc --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteElasticIp.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteElasticIpRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* ElasticIp ID */ + ElasticIpId string `json:"elasticIpId"` +} + +/* + * param regionId: Region ID (Required) + * param elasticIpId: ElasticIp ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteElasticIpRequest( + regionId string, + elasticIpId string, +) *DeleteElasticIpRequest { + + return &DeleteElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/{elasticIpId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ElasticIpId: elasticIpId, + } +} + +/* + * param regionId: Region ID (Required) + * param elasticIpId: ElasticIp ID (Required) + */ +func NewDeleteElasticIpRequestWithAllParams( + regionId string, + elasticIpId string, +) *DeleteElasticIpRequest { + + return &DeleteElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/{elasticIpId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ElasticIpId: elasticIpId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteElasticIpRequestWithoutParam() *DeleteElasticIpRequest { + + return &DeleteElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/{elasticIpId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DeleteElasticIpRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param elasticIpId: ElasticIp ID(Required) */ +func (r *DeleteElasticIpRequest) SetElasticIpId(elasticIpId string) { + r.ElasticIpId = elasticIpId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteElasticIpRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteElasticIpResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteElasticIpResult `json:"result"` +} + +type DeleteElasticIpResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteNetworkAcl.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteNetworkAcl.go new file mode 100644 index 000000000..a4be188bb --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteNetworkAcl.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteNetworkAclRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkAclId ID */ + NetworkAclId string `json:"networkAclId"` +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteNetworkAclRequest( + regionId string, + networkAclId string, +) *DeleteNetworkAclRequest { + + return &DeleteNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + */ +func NewDeleteNetworkAclRequestWithAllParams( + regionId string, + networkAclId string, +) *DeleteNetworkAclRequest { + + return &DeleteNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteNetworkAclRequestWithoutParam() *DeleteNetworkAclRequest { + + return &DeleteNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DeleteNetworkAclRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkAclId: networkAclId ID(Required) */ +func (r *DeleteNetworkAclRequest) SetNetworkAclId(networkAclId string) { + r.NetworkAclId = networkAclId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteNetworkAclRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteNetworkAclResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteNetworkAclResult `json:"result"` +} + +type DeleteNetworkAclResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteNetworkInterface.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteNetworkInterface.go new file mode 100644 index 000000000..3e64d6fde --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteNetworkInterface.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteNetworkInterfaceRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkInterface ID */ + NetworkInterfaceId string `json:"networkInterfaceId"` +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteNetworkInterfaceRequest( + regionId string, + networkInterfaceId string, +) *DeleteNetworkInterfaceRequest { + + return &DeleteNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + */ +func NewDeleteNetworkInterfaceRequestWithAllParams( + regionId string, + networkInterfaceId string, +) *DeleteNetworkInterfaceRequest { + + return &DeleteNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteNetworkInterfaceRequestWithoutParam() *DeleteNetworkInterfaceRequest { + + return &DeleteNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DeleteNetworkInterfaceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkInterfaceId: networkInterface ID(Required) */ +func (r *DeleteNetworkInterfaceRequest) SetNetworkInterfaceId(networkInterfaceId string) { + r.NetworkInterfaceId = networkInterfaceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteNetworkInterfaceRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteNetworkInterfaceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteNetworkInterfaceResult `json:"result"` +} + +type DeleteNetworkInterfaceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteNetworkSecurityGroup.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteNetworkSecurityGroup.go new file mode 100644 index 000000000..f48291b13 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteNetworkSecurityGroup.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteNetworkSecurityGroupRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* NetworkSecurityGroup ID */ + NetworkSecurityGroupId string `json:"networkSecurityGroupId"` +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteNetworkSecurityGroupRequest( + regionId string, + networkSecurityGroupId string, +) *DeleteNetworkSecurityGroupRequest { + + return &DeleteNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + */ +func NewDeleteNetworkSecurityGroupRequestWithAllParams( + regionId string, + networkSecurityGroupId string, +) *DeleteNetworkSecurityGroupRequest { + + return &DeleteNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteNetworkSecurityGroupRequestWithoutParam() *DeleteNetworkSecurityGroupRequest { + + return &DeleteNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DeleteNetworkSecurityGroupRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkSecurityGroupId: NetworkSecurityGroup ID(Required) */ +func (r *DeleteNetworkSecurityGroupRequest) SetNetworkSecurityGroupId(networkSecurityGroupId string) { + r.NetworkSecurityGroupId = networkSecurityGroupId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteNetworkSecurityGroupRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteNetworkSecurityGroupResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteNetworkSecurityGroupResult `json:"result"` +} + +type DeleteNetworkSecurityGroupResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteRouteTable.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteRouteTable.go new file mode 100644 index 000000000..e272e5b2e --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteRouteTable.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteRouteTableRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* RouteTable ID */ + RouteTableId string `json:"routeTableId"` +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteRouteTableRequest( + regionId string, + routeTableId string, +) *DeleteRouteTableRequest { + + return &DeleteRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + } +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + */ +func NewDeleteRouteTableRequestWithAllParams( + regionId string, + routeTableId string, +) *DeleteRouteTableRequest { + + return &DeleteRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteRouteTableRequestWithoutParam() *DeleteRouteTableRequest { + + return &DeleteRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DeleteRouteTableRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param routeTableId: RouteTable ID(Required) */ +func (r *DeleteRouteTableRequest) SetRouteTableId(routeTableId string) { + r.RouteTableId = routeTableId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteRouteTableRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteRouteTableResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteRouteTableResult `json:"result"` +} + +type DeleteRouteTableResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteSubnet.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteSubnet.go new file mode 100644 index 000000000..15c2be6af --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteSubnet.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteSubnetRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* Subnet ID */ + SubnetId string `json:"subnetId"` +} + +/* + * param regionId: Region ID (Required) + * param subnetId: Subnet ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteSubnetRequest( + regionId string, + subnetId string, +) *DeleteSubnetRequest { + + return &DeleteSubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/{subnetId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SubnetId: subnetId, + } +} + +/* + * param regionId: Region ID (Required) + * param subnetId: Subnet ID (Required) + */ +func NewDeleteSubnetRequestWithAllParams( + regionId string, + subnetId string, +) *DeleteSubnetRequest { + + return &DeleteSubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/{subnetId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SubnetId: subnetId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteSubnetRequestWithoutParam() *DeleteSubnetRequest { + + return &DeleteSubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/{subnetId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DeleteSubnetRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param subnetId: Subnet ID(Required) */ +func (r *DeleteSubnetRequest) SetSubnetId(subnetId string) { + r.SubnetId = subnetId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteSubnetRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteSubnetResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteSubnetResult `json:"result"` +} + +type DeleteSubnetResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteVpc.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteVpc.go new file mode 100644 index 000000000..ef98f098d --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteVpc.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteVpcRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* Vpc ID */ + VpcId string `json:"vpcId"` +} + +/* + * param regionId: Region ID (Required) + * param vpcId: Vpc ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteVpcRequest( + regionId string, + vpcId string, +) *DeleteVpcRequest { + + return &DeleteVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/{vpcId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcId: Vpc ID (Required) + */ +func NewDeleteVpcRequestWithAllParams( + regionId string, + vpcId string, +) *DeleteVpcRequest { + + return &DeleteVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/{vpcId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteVpcRequestWithoutParam() *DeleteVpcRequest { + + return &DeleteVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/{vpcId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DeleteVpcRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcId: Vpc ID(Required) */ +func (r *DeleteVpcRequest) SetVpcId(vpcId string) { + r.VpcId = vpcId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteVpcRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteVpcResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteVpcResult `json:"result"` +} + +type DeleteVpcResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteVpcPeering.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteVpcPeering.go new file mode 100644 index 000000000..b77e471dd --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DeleteVpcPeering.go @@ -0,0 +1,114 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DeleteVpcPeeringRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* vpcPeeringId ID */ + VpcPeeringId string `json:"vpcPeeringId"` +} + +/* + * param regionId: Region ID (Required) + * param vpcPeeringId: vpcPeeringId ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDeleteVpcPeeringRequest( + regionId string, + vpcPeeringId string, +) *DeleteVpcPeeringRequest { + + return &DeleteVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/{vpcPeeringId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcPeeringId: vpcPeeringId, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcPeeringId: vpcPeeringId ID (Required) + */ +func NewDeleteVpcPeeringRequestWithAllParams( + regionId string, + vpcPeeringId string, +) *DeleteVpcPeeringRequest { + + return &DeleteVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/{vpcPeeringId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcPeeringId: vpcPeeringId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDeleteVpcPeeringRequestWithoutParam() *DeleteVpcPeeringRequest { + + return &DeleteVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/{vpcPeeringId}", + Method: "DELETE", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DeleteVpcPeeringRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcPeeringId: vpcPeeringId ID(Required) */ +func (r *DeleteVpcPeeringRequest) SetVpcPeeringId(vpcPeeringId string) { + r.VpcPeeringId = vpcPeeringId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DeleteVpcPeeringRequest) GetRegionId() string { + return r.RegionId +} + +type DeleteVpcPeeringResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DeleteVpcPeeringResult `json:"result"` +} + +type DeleteVpcPeeringResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeElasticIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeElasticIp.go new file mode 100644 index 000000000..6ecb5a97c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeElasticIp.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type DescribeElasticIpRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* ElasticIp ID */ + ElasticIpId string `json:"elasticIpId"` +} + +/* + * param regionId: Region ID (Required) + * param elasticIpId: ElasticIp ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeElasticIpRequest( + regionId string, + elasticIpId string, +) *DescribeElasticIpRequest { + + return &DescribeElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/{elasticIpId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ElasticIpId: elasticIpId, + } +} + +/* + * param regionId: Region ID (Required) + * param elasticIpId: ElasticIp ID (Required) + */ +func NewDescribeElasticIpRequestWithAllParams( + regionId string, + elasticIpId string, +) *DescribeElasticIpRequest { + + return &DescribeElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/{elasticIpId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ElasticIpId: elasticIpId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeElasticIpRequestWithoutParam() *DescribeElasticIpRequest { + + return &DescribeElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/{elasticIpId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeElasticIpRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param elasticIpId: ElasticIp ID(Required) */ +func (r *DescribeElasticIpRequest) SetElasticIpId(elasticIpId string) { + r.ElasticIpId = elasticIpId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeElasticIpRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeElasticIpResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeElasticIpResult `json:"result"` +} + +type DescribeElasticIpResult struct { + ElasticIp vpc.ElasticIp `json:"elasticIp"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeElasticIps.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeElasticIps.go new file mode 100644 index 000000000..94927eff2 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeElasticIps.go @@ -0,0 +1,146 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeElasticIpsRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小,默认为20,取值范围:[10,100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* elasticIpIds - elasticip id数组条件,支持多个 +elasticIpAddress - eip的IP地址,支持单个 +chargeStatus - eip的费用支付状态,normal(正常状态) or overdue(预付费已到期) or arrear(欠费状态),支持单个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: Region ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeElasticIpsRequest( + regionId string, +) *DescribeElasticIpsRequest { + + return &DescribeElasticIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: Region ID (Required) + * param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) + * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional) + * param filters: elasticIpIds - elasticip id数组条件,支持多个 +elasticIpAddress - eip的IP地址,支持单个 +chargeStatus - eip的费用支付状态,normal(正常状态) or overdue(预付费已到期) or arrear(欠费状态),支持单个 + (Optional) + */ +func NewDescribeElasticIpsRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeElasticIpsRequest { + + return &DescribeElasticIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeElasticIpsRequestWithoutParam() *DescribeElasticIpsRequest { + + return &DescribeElasticIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeElasticIpsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页(Optional) */ +func (r *DescribeElasticIpsRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */ +func (r *DescribeElasticIpsRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: elasticIpIds - elasticip id数组条件,支持多个 +elasticIpAddress - eip的IP地址,支持单个 +chargeStatus - eip的费用支付状态,normal(正常状态) or overdue(预付费已到期) or arrear(欠费状态),支持单个 +(Optional) */ +func (r *DescribeElasticIpsRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeElasticIpsRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeElasticIpsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeElasticIpsResult `json:"result"` +} + +type DescribeElasticIpsResult struct { + ElasticIps []vpc.ElasticIp `json:"elasticIps"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkAcl.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkAcl.go new file mode 100644 index 000000000..6692a7f70 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkAcl.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type DescribeNetworkAclRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkAclId ID */ + NetworkAclId string `json:"networkAclId"` +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeNetworkAclRequest( + regionId string, + networkAclId string, +) *DescribeNetworkAclRequest { + + return &DescribeNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + */ +func NewDescribeNetworkAclRequestWithAllParams( + regionId string, + networkAclId string, +) *DescribeNetworkAclRequest { + + return &DescribeNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeNetworkAclRequestWithoutParam() *DescribeNetworkAclRequest { + + return &DescribeNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeNetworkAclRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkAclId: networkAclId ID(Required) */ +func (r *DescribeNetworkAclRequest) SetNetworkAclId(networkAclId string) { + r.NetworkAclId = networkAclId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeNetworkAclRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeNetworkAclResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeNetworkAclResult `json:"result"` +} + +type DescribeNetworkAclResult struct { + NetworkAcl vpc.NetworkAcl `json:"networkAcl"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkAcls.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkAcls.go new file mode 100644 index 000000000..5344e55ad --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkAcls.go @@ -0,0 +1,146 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeNetworkAclsRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小,默认为20,取值范围:[10,100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* networkAclIds - 弹性网卡ID列表,支持多个 +networkAclNames - 弹性网卡名称列表,支持多个 +vpcId - 弹性网卡所属vpc Id,支持单个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: Region ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeNetworkAclsRequest( + regionId string, +) *DescribeNetworkAclsRequest { + + return &DescribeNetworkAclsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: Region ID (Required) + * param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) + * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional) + * param filters: networkAclIds - 弹性网卡ID列表,支持多个 +networkAclNames - 弹性网卡名称列表,支持多个 +vpcId - 弹性网卡所属vpc Id,支持单个 + (Optional) + */ +func NewDescribeNetworkAclsRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeNetworkAclsRequest { + + return &DescribeNetworkAclsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeNetworkAclsRequestWithoutParam() *DescribeNetworkAclsRequest { + + return &DescribeNetworkAclsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeNetworkAclsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页(Optional) */ +func (r *DescribeNetworkAclsRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */ +func (r *DescribeNetworkAclsRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: networkAclIds - 弹性网卡ID列表,支持多个 +networkAclNames - 弹性网卡名称列表,支持多个 +vpcId - 弹性网卡所属vpc Id,支持单个 +(Optional) */ +func (r *DescribeNetworkAclsRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeNetworkAclsRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeNetworkAclsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeNetworkAclsResult `json:"result"` +} + +type DescribeNetworkAclsResult struct { + NetworkAcls []vpc.NetworkAcl `json:"networkAcls"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkInterface.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkInterface.go new file mode 100644 index 000000000..284b32b5d --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkInterface.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type DescribeNetworkInterfaceRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkInterface ID */ + NetworkInterfaceId string `json:"networkInterfaceId"` +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeNetworkInterfaceRequest( + regionId string, + networkInterfaceId string, +) *DescribeNetworkInterfaceRequest { + + return &DescribeNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + */ +func NewDescribeNetworkInterfaceRequestWithAllParams( + regionId string, + networkInterfaceId string, +) *DescribeNetworkInterfaceRequest { + + return &DescribeNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeNetworkInterfaceRequestWithoutParam() *DescribeNetworkInterfaceRequest { + + return &DescribeNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeNetworkInterfaceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkInterfaceId: networkInterface ID(Required) */ +func (r *DescribeNetworkInterfaceRequest) SetNetworkInterfaceId(networkInterfaceId string) { + r.NetworkInterfaceId = networkInterfaceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeNetworkInterfaceRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeNetworkInterfaceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeNetworkInterfaceResult `json:"result"` +} + +type DescribeNetworkInterfaceResult struct { + NetworkInterface vpc.NetworkInterface `json:"networkInterface"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkInterfaces.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkInterfaces.go new file mode 100644 index 000000000..2503ca0e1 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkInterfaces.go @@ -0,0 +1,152 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeNetworkInterfacesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小,默认为20,取值范围:[10,100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* networkInterfaceIds - 弹性网卡ID列表,支持多个 +networkInterfaceNames - 弹性网卡名称列表,支持多个 +vpcId - 弹性网卡所属vpc Id,支持单个 +subnetId - 弹性网卡所属子网Id,支持单个 +role - 网卡角色,取值范围:Primary(主网卡)、Secondary(辅助网卡),支持单个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: Region ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeNetworkInterfacesRequest( + regionId string, +) *DescribeNetworkInterfacesRequest { + + return &DescribeNetworkInterfacesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: Region ID (Required) + * param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) + * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional) + * param filters: networkInterfaceIds - 弹性网卡ID列表,支持多个 +networkInterfaceNames - 弹性网卡名称列表,支持多个 +vpcId - 弹性网卡所属vpc Id,支持单个 +subnetId - 弹性网卡所属子网Id,支持单个 +role - 网卡角色,取值范围:Primary(主网卡)、Secondary(辅助网卡),支持单个 + (Optional) + */ +func NewDescribeNetworkInterfacesRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeNetworkInterfacesRequest { + + return &DescribeNetworkInterfacesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeNetworkInterfacesRequestWithoutParam() *DescribeNetworkInterfacesRequest { + + return &DescribeNetworkInterfacesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeNetworkInterfacesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页(Optional) */ +func (r *DescribeNetworkInterfacesRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */ +func (r *DescribeNetworkInterfacesRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: networkInterfaceIds - 弹性网卡ID列表,支持多个 +networkInterfaceNames - 弹性网卡名称列表,支持多个 +vpcId - 弹性网卡所属vpc Id,支持单个 +subnetId - 弹性网卡所属子网Id,支持单个 +role - 网卡角色,取值范围:Primary(主网卡)、Secondary(辅助网卡),支持单个 +(Optional) */ +func (r *DescribeNetworkInterfacesRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeNetworkInterfacesRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeNetworkInterfacesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeNetworkInterfacesResult `json:"result"` +} + +type DescribeNetworkInterfacesResult struct { + NetworkInterfaces []vpc.NetworkInterface `json:"networkInterfaces"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkSecurityGroup.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkSecurityGroup.go new file mode 100644 index 000000000..b7f29d797 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkSecurityGroup.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type DescribeNetworkSecurityGroupRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* NetworkSecurityGroup ID */ + NetworkSecurityGroupId string `json:"networkSecurityGroupId"` +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeNetworkSecurityGroupRequest( + regionId string, + networkSecurityGroupId string, +) *DescribeNetworkSecurityGroupRequest { + + return &DescribeNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + */ +func NewDescribeNetworkSecurityGroupRequestWithAllParams( + regionId string, + networkSecurityGroupId string, +) *DescribeNetworkSecurityGroupRequest { + + return &DescribeNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeNetworkSecurityGroupRequestWithoutParam() *DescribeNetworkSecurityGroupRequest { + + return &DescribeNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeNetworkSecurityGroupRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkSecurityGroupId: NetworkSecurityGroup ID(Required) */ +func (r *DescribeNetworkSecurityGroupRequest) SetNetworkSecurityGroupId(networkSecurityGroupId string) { + r.NetworkSecurityGroupId = networkSecurityGroupId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeNetworkSecurityGroupRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeNetworkSecurityGroupResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeNetworkSecurityGroupResult `json:"result"` +} + +type DescribeNetworkSecurityGroupResult struct { + NetworkSecurityGroup vpc.NetworkSecurityGroup `json:"networkSecurityGroup"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkSecurityGroups.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkSecurityGroups.go new file mode 100644 index 000000000..e85cc7170 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeNetworkSecurityGroups.go @@ -0,0 +1,146 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeNetworkSecurityGroupsRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小,默认为20,取值范围:[10,100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* networkSecurityGroupIds - 安全组ID列表,支持多个 +networkSecurityGroupNames - 安全组名称列表,支持多个 +vpcId - 安全组所属vpc Id,支持单个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: Region ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeNetworkSecurityGroupsRequest( + regionId string, +) *DescribeNetworkSecurityGroupsRequest { + + return &DescribeNetworkSecurityGroupsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: Region ID (Required) + * param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) + * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional) + * param filters: networkSecurityGroupIds - 安全组ID列表,支持多个 +networkSecurityGroupNames - 安全组名称列表,支持多个 +vpcId - 安全组所属vpc Id,支持单个 + (Optional) + */ +func NewDescribeNetworkSecurityGroupsRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeNetworkSecurityGroupsRequest { + + return &DescribeNetworkSecurityGroupsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeNetworkSecurityGroupsRequestWithoutParam() *DescribeNetworkSecurityGroupsRequest { + + return &DescribeNetworkSecurityGroupsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeNetworkSecurityGroupsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页(Optional) */ +func (r *DescribeNetworkSecurityGroupsRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */ +func (r *DescribeNetworkSecurityGroupsRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: networkSecurityGroupIds - 安全组ID列表,支持多个 +networkSecurityGroupNames - 安全组名称列表,支持多个 +vpcId - 安全组所属vpc Id,支持单个 +(Optional) */ +func (r *DescribeNetworkSecurityGroupsRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeNetworkSecurityGroupsRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeNetworkSecurityGroupsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeNetworkSecurityGroupsResult `json:"result"` +} + +type DescribeNetworkSecurityGroupsResult struct { + NetworkSecurityGroups []vpc.NetworkSecurityGroup `json:"networkSecurityGroups"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeQuota.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeQuota.go new file mode 100644 index 000000000..4b6544e0f --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeQuota.go @@ -0,0 +1,126 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DescribeQuotaRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 资源类型,取值范围:vpc、elastic_ip、subnet、security_group、vpcpeering、network_interface(配额只统计辅助网卡) */ + Type string `json:"type"` + + /* type为vpc、elastic_ip、network_interface不设置, type为subnet、security_group、vpcpeering设置为vpcId (Optional) */ + ParentResourceId *string `json:"parentResourceId"` +} + +/* + * param regionId: Region ID (Required) + * param type_: 资源类型,取值范围:vpc、elastic_ip、subnet、security_group、vpcpeering、network_interface(配额只统计辅助网卡) (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeQuotaRequest( + regionId string, + type_ string, +) *DescribeQuotaRequest { + + return &DescribeQuotaRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/quotas/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + Type: type_, + } +} + +/* + * param regionId: Region ID (Required) + * param type_: 资源类型,取值范围:vpc、elastic_ip、subnet、security_group、vpcpeering、network_interface(配额只统计辅助网卡) (Required) + * param parentResourceId: type为vpc、elastic_ip、network_interface不设置, type为subnet、security_group、vpcpeering设置为vpcId (Optional) + */ +func NewDescribeQuotaRequestWithAllParams( + regionId string, + type_ string, + parentResourceId *string, +) *DescribeQuotaRequest { + + return &DescribeQuotaRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/quotas/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + Type: type_, + ParentResourceId: parentResourceId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeQuotaRequestWithoutParam() *DescribeQuotaRequest { + + return &DescribeQuotaRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/quotas/", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeQuotaRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param type_: 资源类型,取值范围:vpc、elastic_ip、subnet、security_group、vpcpeering、network_interface(配额只统计辅助网卡)(Required) */ +func (r *DescribeQuotaRequest) SetType(type_ string) { + r.Type = type_ +} + +/* param parentResourceId: type为vpc、elastic_ip、network_interface不设置, type为subnet、security_group、vpcpeering设置为vpcId(Optional) */ +func (r *DescribeQuotaRequest) SetParentResourceId(parentResourceId string) { + r.ParentResourceId = &parentResourceId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeQuotaRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeQuotaResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeQuotaResult `json:"result"` +} + +type DescribeQuotaResult struct { + Quota interface{} `json:"quota"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeRouteTable.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeRouteTable.go new file mode 100644 index 000000000..5e6785914 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeRouteTable.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type DescribeRouteTableRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* RouteTable ID */ + RouteTableId string `json:"routeTableId"` +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeRouteTableRequest( + regionId string, + routeTableId string, +) *DescribeRouteTableRequest { + + return &DescribeRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + } +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + */ +func NewDescribeRouteTableRequestWithAllParams( + regionId string, + routeTableId string, +) *DescribeRouteTableRequest { + + return &DescribeRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeRouteTableRequestWithoutParam() *DescribeRouteTableRequest { + + return &DescribeRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeRouteTableRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param routeTableId: RouteTable ID(Required) */ +func (r *DescribeRouteTableRequest) SetRouteTableId(routeTableId string) { + r.RouteTableId = routeTableId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeRouteTableRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeRouteTableResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeRouteTableResult `json:"result"` +} + +type DescribeRouteTableResult struct { + RouteTable vpc.RouteTable `json:"routeTable"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeRouteTables.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeRouteTables.go new file mode 100644 index 000000000..801d94c8b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeRouteTables.go @@ -0,0 +1,146 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeRouteTablesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小,默认为20,取值范围:[10,100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* routeTableIds - 路由表ID列表,支持多个 +routeTableNames - 路由表名称列表,支持多个 +vpcId - 路由表所属vpc Id,支持单个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: Region ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeRouteTablesRequest( + regionId string, +) *DescribeRouteTablesRequest { + + return &DescribeRouteTablesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: Region ID (Required) + * param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) + * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional) + * param filters: routeTableIds - 路由表ID列表,支持多个 +routeTableNames - 路由表名称列表,支持多个 +vpcId - 路由表所属vpc Id,支持单个 + (Optional) + */ +func NewDescribeRouteTablesRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeRouteTablesRequest { + + return &DescribeRouteTablesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeRouteTablesRequestWithoutParam() *DescribeRouteTablesRequest { + + return &DescribeRouteTablesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeRouteTablesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页(Optional) */ +func (r *DescribeRouteTablesRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */ +func (r *DescribeRouteTablesRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: routeTableIds - 路由表ID列表,支持多个 +routeTableNames - 路由表名称列表,支持多个 +vpcId - 路由表所属vpc Id,支持单个 +(Optional) */ +func (r *DescribeRouteTablesRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeRouteTablesRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeRouteTablesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeRouteTablesResult `json:"result"` +} + +type DescribeRouteTablesResult struct { + RouteTables []vpc.RouteTable `json:"routeTables"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeSubnet.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeSubnet.go new file mode 100644 index 000000000..2fee1a574 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeSubnet.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type DescribeSubnetRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* Subnet ID */ + SubnetId string `json:"subnetId"` +} + +/* + * param regionId: Region ID (Required) + * param subnetId: Subnet ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeSubnetRequest( + regionId string, + subnetId string, +) *DescribeSubnetRequest { + + return &DescribeSubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/{subnetId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SubnetId: subnetId, + } +} + +/* + * param regionId: Region ID (Required) + * param subnetId: Subnet ID (Required) + */ +func NewDescribeSubnetRequestWithAllParams( + regionId string, + subnetId string, +) *DescribeSubnetRequest { + + return &DescribeSubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/{subnetId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SubnetId: subnetId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeSubnetRequestWithoutParam() *DescribeSubnetRequest { + + return &DescribeSubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/{subnetId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeSubnetRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param subnetId: Subnet ID(Required) */ +func (r *DescribeSubnetRequest) SetSubnetId(subnetId string) { + r.SubnetId = subnetId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeSubnetRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeSubnetResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeSubnetResult `json:"result"` +} + +type DescribeSubnetResult struct { + Subnet vpc.Subnet `json:"subnet"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeSubnets.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeSubnets.go new file mode 100644 index 000000000..6bb8ce98d --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeSubnets.go @@ -0,0 +1,152 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeSubnetsRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小,默认为20,取值范围:[10,100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* subnetIds - subnet ID列表,支持多个 +subnetNames - subnet名称列表,支持多个 +routeTableId - 子网关联路由表Id,支持单个 +aclId - 子网关联acl Id,支持单个 +vpcId - 子网所属VPC Id,支持单个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: Region ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeSubnetsRequest( + regionId string, +) *DescribeSubnetsRequest { + + return &DescribeSubnetsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: Region ID (Required) + * param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) + * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional) + * param filters: subnetIds - subnet ID列表,支持多个 +subnetNames - subnet名称列表,支持多个 +routeTableId - 子网关联路由表Id,支持单个 +aclId - 子网关联acl Id,支持单个 +vpcId - 子网所属VPC Id,支持单个 + (Optional) + */ +func NewDescribeSubnetsRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeSubnetsRequest { + + return &DescribeSubnetsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeSubnetsRequestWithoutParam() *DescribeSubnetsRequest { + + return &DescribeSubnetsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeSubnetsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页(Optional) */ +func (r *DescribeSubnetsRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */ +func (r *DescribeSubnetsRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: subnetIds - subnet ID列表,支持多个 +subnetNames - subnet名称列表,支持多个 +routeTableId - 子网关联路由表Id,支持单个 +aclId - 子网关联acl Id,支持单个 +vpcId - 子网所属VPC Id,支持单个 +(Optional) */ +func (r *DescribeSubnetsRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeSubnetsRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeSubnetsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeSubnetsResult `json:"result"` +} + +type DescribeSubnetsResult struct { + Subnets []vpc.Subnet `json:"subnets"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpc.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpc.go new file mode 100644 index 000000000..d406b724c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpc.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type DescribeVpcRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* Vpc ID */ + VpcId string `json:"vpcId"` +} + +/* + * param regionId: Region ID (Required) + * param vpcId: Vpc ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeVpcRequest( + regionId string, + vpcId string, +) *DescribeVpcRequest { + + return &DescribeVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/{vpcId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcId: Vpc ID (Required) + */ +func NewDescribeVpcRequestWithAllParams( + regionId string, + vpcId string, +) *DescribeVpcRequest { + + return &DescribeVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/{vpcId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeVpcRequestWithoutParam() *DescribeVpcRequest { + + return &DescribeVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/{vpcId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeVpcRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcId: Vpc ID(Required) */ +func (r *DescribeVpcRequest) SetVpcId(vpcId string) { + r.VpcId = vpcId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeVpcRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeVpcResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeVpcResult `json:"result"` +} + +type DescribeVpcResult struct { + Vpc vpc.Vpc `json:"vpc"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpcPeering.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpcPeering.go new file mode 100644 index 000000000..e0230599a --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpcPeering.go @@ -0,0 +1,116 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type DescribeVpcPeeringRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* vpcPeeringId ID */ + VpcPeeringId string `json:"vpcPeeringId"` +} + +/* + * param regionId: Region ID (Required) + * param vpcPeeringId: vpcPeeringId ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeVpcPeeringRequest( + regionId string, + vpcPeeringId string, +) *DescribeVpcPeeringRequest { + + return &DescribeVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/{vpcPeeringId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcPeeringId: vpcPeeringId, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcPeeringId: vpcPeeringId ID (Required) + */ +func NewDescribeVpcPeeringRequestWithAllParams( + regionId string, + vpcPeeringId string, +) *DescribeVpcPeeringRequest { + + return &DescribeVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/{vpcPeeringId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcPeeringId: vpcPeeringId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeVpcPeeringRequestWithoutParam() *DescribeVpcPeeringRequest { + + return &DescribeVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/{vpcPeeringId}", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeVpcPeeringRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcPeeringId: vpcPeeringId ID(Required) */ +func (r *DescribeVpcPeeringRequest) SetVpcPeeringId(vpcPeeringId string) { + r.VpcPeeringId = vpcPeeringId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeVpcPeeringRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeVpcPeeringResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeVpcPeeringResult `json:"result"` +} + +type DescribeVpcPeeringResult struct { + VpcPeering vpc.VpcPeering `json:"vpcPeering"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpcPeerings.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpcPeerings.go new file mode 100644 index 000000000..391f01b16 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpcPeerings.go @@ -0,0 +1,149 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeVpcPeeringsRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小,默认为20,取值范围:[10,100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* vpcPeeringIds - vpcPeering ID,支持多个 +vpcPeeringNames - vpcPeering名称列表,支持多个 +vpcId - vpcPeering本端Vpc Id,支持单个 +remoteVpcId - vpcPeering对端Vpc Id,支持单个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: Region ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeVpcPeeringsRequest( + regionId string, +) *DescribeVpcPeeringsRequest { + + return &DescribeVpcPeeringsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: Region ID (Required) + * param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) + * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional) + * param filters: vpcPeeringIds - vpcPeering ID,支持多个 +vpcPeeringNames - vpcPeering名称列表,支持多个 +vpcId - vpcPeering本端Vpc Id,支持单个 +remoteVpcId - vpcPeering对端Vpc Id,支持单个 + (Optional) + */ +func NewDescribeVpcPeeringsRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeVpcPeeringsRequest { + + return &DescribeVpcPeeringsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeVpcPeeringsRequestWithoutParam() *DescribeVpcPeeringsRequest { + + return &DescribeVpcPeeringsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeVpcPeeringsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页(Optional) */ +func (r *DescribeVpcPeeringsRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */ +func (r *DescribeVpcPeeringsRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: vpcPeeringIds - vpcPeering ID,支持多个 +vpcPeeringNames - vpcPeering名称列表,支持多个 +vpcId - vpcPeering本端Vpc Id,支持单个 +remoteVpcId - vpcPeering对端Vpc Id,支持单个 +(Optional) */ +func (r *DescribeVpcPeeringsRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeVpcPeeringsRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeVpcPeeringsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeVpcPeeringsResult `json:"result"` +} + +type DescribeVpcPeeringsResult struct { + VpcPeerings []vpc.VpcPeering `json:"vpcPeerings"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpcs.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpcs.go new file mode 100644 index 000000000..8faac163c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DescribeVpcs.go @@ -0,0 +1,143 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" + common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models" +) + +type DescribeVpcsRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) */ + PageNumber *int `json:"pageNumber"` + + /* 分页大小,默认为20,取值范围:[10,100] (Optional) */ + PageSize *int `json:"pageSize"` + + /* vpcIds - vpc ID列表,支持多个 +vpcNames - vpc名称列表,支持多个 + (Optional) */ + Filters []common.Filter `json:"filters"` +} + +/* + * param regionId: Region ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDescribeVpcsRequest( + regionId string, +) *DescribeVpcsRequest { + + return &DescribeVpcsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + } +} + +/* + * param regionId: Region ID (Required) + * param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页 (Optional) + * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional) + * param filters: vpcIds - vpc ID列表,支持多个 +vpcNames - vpc名称列表,支持多个 + (Optional) + */ +func NewDescribeVpcsRequestWithAllParams( + regionId string, + pageNumber *int, + pageSize *int, + filters []common.Filter, +) *DescribeVpcsRequest { + + return &DescribeVpcsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/", + Method: "GET", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + PageNumber: pageNumber, + PageSize: pageSize, + Filters: filters, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDescribeVpcsRequestWithoutParam() *DescribeVpcsRequest { + + return &DescribeVpcsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/", + Method: "GET", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DescribeVpcsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞), 页码超过总页数时, 显示最后一页(Optional) */ +func (r *DescribeVpcsRequest) SetPageNumber(pageNumber int) { + r.PageNumber = &pageNumber +} + +/* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */ +func (r *DescribeVpcsRequest) SetPageSize(pageSize int) { + r.PageSize = &pageSize +} + +/* param filters: vpcIds - vpc ID列表,支持多个 +vpcNames - vpc名称列表,支持多个 +(Optional) */ +func (r *DescribeVpcsRequest) SetFilters(filters []common.Filter) { + r.Filters = filters +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DescribeVpcsRequest) GetRegionId() string { + return r.RegionId +} + +type DescribeVpcsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DescribeVpcsResult `json:"result"` +} + +type DescribeVpcsResult struct { + Vpcs []vpc.Vpc `json:"vpcs"` + TotalCount int `json:"totalCount"` +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DisassociateElasticIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DisassociateElasticIp.go new file mode 100644 index 000000000..35e7dc50e --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DisassociateElasticIp.go @@ -0,0 +1,136 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DisassociateElasticIpRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkInterface ID */ + NetworkInterfaceId string `json:"networkInterfaceId"` + + /* 指定解绑的弹性Ip Id (Optional) */ + ElasticIpId *string `json:"elasticIpId"` + + /* 指定解绑的弹性Ip地址 (Optional) */ + ElasticIpAddress *string `json:"elasticIpAddress"` +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDisassociateElasticIpRequest( + regionId string, + networkInterfaceId string, +) *DisassociateElasticIpRequest { + + return &DisassociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:disassociateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * param elasticIpId: 指定解绑的弹性Ip Id (Optional) + * param elasticIpAddress: 指定解绑的弹性Ip地址 (Optional) + */ +func NewDisassociateElasticIpRequestWithAllParams( + regionId string, + networkInterfaceId string, + elasticIpId *string, + elasticIpAddress *string, +) *DisassociateElasticIpRequest { + + return &DisassociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:disassociateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + ElasticIpId: elasticIpId, + ElasticIpAddress: elasticIpAddress, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDisassociateElasticIpRequestWithoutParam() *DisassociateElasticIpRequest { + + return &DisassociateElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:disassociateElasticIp", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DisassociateElasticIpRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkInterfaceId: networkInterface ID(Required) */ +func (r *DisassociateElasticIpRequest) SetNetworkInterfaceId(networkInterfaceId string) { + r.NetworkInterfaceId = networkInterfaceId +} + +/* param elasticIpId: 指定解绑的弹性Ip Id(Optional) */ +func (r *DisassociateElasticIpRequest) SetElasticIpId(elasticIpId string) { + r.ElasticIpId = &elasticIpId +} + +/* param elasticIpAddress: 指定解绑的弹性Ip地址(Optional) */ +func (r *DisassociateElasticIpRequest) SetElasticIpAddress(elasticIpAddress string) { + r.ElasticIpAddress = &elasticIpAddress +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DisassociateElasticIpRequest) GetRegionId() string { + return r.RegionId +} + +type DisassociateElasticIpResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DisassociateElasticIpResult `json:"result"` +} + +type DisassociateElasticIpResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DisassociateNetworkAcl.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DisassociateNetworkAcl.go new file mode 100644 index 000000000..41874c7bb --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DisassociateNetworkAcl.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DisassociateNetworkAclRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkAclId ID */ + NetworkAclId string `json:"networkAclId"` + + /* networkAcl要解绑的子网ID */ + SubnetId string `json:"subnetId"` +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param subnetId: networkAcl要解绑的子网ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDisassociateNetworkAclRequest( + regionId string, + networkAclId string, + subnetId string, +) *DisassociateNetworkAclRequest { + + return &DisassociateNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:disassociateNetworkAcl", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + SubnetId: subnetId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param subnetId: networkAcl要解绑的子网ID (Required) + */ +func NewDisassociateNetworkAclRequestWithAllParams( + regionId string, + networkAclId string, + subnetId string, +) *DisassociateNetworkAclRequest { + + return &DisassociateNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:disassociateNetworkAcl", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + SubnetId: subnetId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDisassociateNetworkAclRequestWithoutParam() *DisassociateNetworkAclRequest { + + return &DisassociateNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:disassociateNetworkAcl", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DisassociateNetworkAclRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkAclId: networkAclId ID(Required) */ +func (r *DisassociateNetworkAclRequest) SetNetworkAclId(networkAclId string) { + r.NetworkAclId = networkAclId +} + +/* param subnetId: networkAcl要解绑的子网ID(Required) */ +func (r *DisassociateNetworkAclRequest) SetSubnetId(subnetId string) { + r.SubnetId = subnetId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DisassociateNetworkAclRequest) GetRegionId() string { + return r.RegionId +} + +type DisassociateNetworkAclResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DisassociateNetworkAclResult `json:"result"` +} + +type DisassociateNetworkAclResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DisassociateRouteTable.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DisassociateRouteTable.go new file mode 100644 index 000000000..65d7f1c65 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/DisassociateRouteTable.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type DisassociateRouteTableRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* RouteTable ID */ + RouteTableId string `json:"routeTableId"` + + /* 路由表要解绑的子网ID,解绑后子网绑定默认路由表 */ + SubnetId string `json:"subnetId"` +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param subnetId: 路由表要解绑的子网ID,解绑后子网绑定默认路由表 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewDisassociateRouteTableRequest( + regionId string, + routeTableId string, + subnetId string, +) *DisassociateRouteTableRequest { + + return &DisassociateRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:disassociateRouteTable", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + SubnetId: subnetId, + } +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param subnetId: 路由表要解绑的子网ID,解绑后子网绑定默认路由表 (Required) + */ +func NewDisassociateRouteTableRequestWithAllParams( + regionId string, + routeTableId string, + subnetId string, +) *DisassociateRouteTableRequest { + + return &DisassociateRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:disassociateRouteTable", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + SubnetId: subnetId, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewDisassociateRouteTableRequestWithoutParam() *DisassociateRouteTableRequest { + + return &DisassociateRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:disassociateRouteTable", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *DisassociateRouteTableRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param routeTableId: RouteTable ID(Required) */ +func (r *DisassociateRouteTableRequest) SetRouteTableId(routeTableId string) { + r.RouteTableId = routeTableId +} + +/* param subnetId: 路由表要解绑的子网ID,解绑后子网绑定默认路由表(Required) */ +func (r *DisassociateRouteTableRequest) SetSubnetId(subnetId string) { + r.SubnetId = subnetId +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r DisassociateRouteTableRequest) GetRegionId() string { + return r.RegionId +} + +type DisassociateRouteTableResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result DisassociateRouteTableResult `json:"result"` +} + +type DisassociateRouteTableResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyElasticIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyElasticIp.go new file mode 100644 index 000000000..146229ba0 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyElasticIp.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyElasticIpRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* ElasticIp ID */ + ElasticIpId string `json:"elasticIpId"` + + /* 弹性公网IP的限速(单位:Mbps),取值范围为[1-200] */ + BandwidthMbps int `json:"bandwidthMbps"` +} + +/* + * param regionId: Region ID (Required) + * param elasticIpId: ElasticIp ID (Required) + * param bandwidthMbps: 弹性公网IP的限速(单位:Mbps),取值范围为[1-200] (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyElasticIpRequest( + regionId string, + elasticIpId string, + bandwidthMbps int, +) *ModifyElasticIpRequest { + + return &ModifyElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/{elasticIpId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ElasticIpId: elasticIpId, + BandwidthMbps: bandwidthMbps, + } +} + +/* + * param regionId: Region ID (Required) + * param elasticIpId: ElasticIp ID (Required) + * param bandwidthMbps: 弹性公网IP的限速(单位:Mbps),取值范围为[1-200] (Required) + */ +func NewModifyElasticIpRequestWithAllParams( + regionId string, + elasticIpId string, + bandwidthMbps int, +) *ModifyElasticIpRequest { + + return &ModifyElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/{elasticIpId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + ElasticIpId: elasticIpId, + BandwidthMbps: bandwidthMbps, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyElasticIpRequestWithoutParam() *ModifyElasticIpRequest { + + return &ModifyElasticIpRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/elasticIps/{elasticIpId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyElasticIpRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param elasticIpId: ElasticIp ID(Required) */ +func (r *ModifyElasticIpRequest) SetElasticIpId(elasticIpId string) { + r.ElasticIpId = elasticIpId +} + +/* param bandwidthMbps: 弹性公网IP的限速(单位:Mbps),取值范围为[1-200](Required) */ +func (r *ModifyElasticIpRequest) SetBandwidthMbps(bandwidthMbps int) { + r.BandwidthMbps = bandwidthMbps +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyElasticIpRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyElasticIpResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyElasticIpResult `json:"result"` +} + +type ModifyElasticIpResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkAcl.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkAcl.go new file mode 100644 index 000000000..c091d48a3 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkAcl.go @@ -0,0 +1,136 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyNetworkAclRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkAclId ID */ + NetworkAclId string `json:"networkAclId"` + + /* networkAcl名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符 (Optional) */ + NetworkAclName *string `json:"networkAclName"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyNetworkAclRequest( + regionId string, + networkAclId string, +) *ModifyNetworkAclRequest { + + return &ModifyNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param networkAclName: networkAcl名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符 (Optional) + * param description: 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) + */ +func NewModifyNetworkAclRequestWithAllParams( + regionId string, + networkAclId string, + networkAclName *string, + description *string, +) *ModifyNetworkAclRequest { + + return &ModifyNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + NetworkAclName: networkAclName, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyNetworkAclRequestWithoutParam() *ModifyNetworkAclRequest { + + return &ModifyNetworkAclRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyNetworkAclRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkAclId: networkAclId ID(Required) */ +func (r *ModifyNetworkAclRequest) SetNetworkAclId(networkAclId string) { + r.NetworkAclId = networkAclId +} + +/* param networkAclName: networkAcl名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符(Optional) */ +func (r *ModifyNetworkAclRequest) SetNetworkAclName(networkAclName string) { + r.NetworkAclName = &networkAclName +} + +/* param description: 描述,允许输入UTF-8编码下的全部字符,不超过256字符(Optional) */ +func (r *ModifyNetworkAclRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyNetworkAclRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyNetworkAclResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyNetworkAclResult `json:"result"` +} + +type ModifyNetworkAclResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkAclRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkAclRules.go new file mode 100644 index 000000000..21f44d284 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkAclRules.go @@ -0,0 +1,129 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type ModifyNetworkAclRulesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkAclId ID */ + NetworkAclId string `json:"networkAclId"` + + /* networkAcl规则列表 */ + ModifyNetworkAclRuleSpecs []vpc.ModifyNetworkAclRuleSpec `json:"modifyNetworkAclRuleSpecs"` +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param modifyNetworkAclRuleSpecs: networkAcl规则列表 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyNetworkAclRulesRequest( + regionId string, + networkAclId string, + modifyNetworkAclRuleSpecs []vpc.ModifyNetworkAclRuleSpec, +) *ModifyNetworkAclRulesRequest { + + return &ModifyNetworkAclRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:modifyNetworkAclRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + ModifyNetworkAclRuleSpecs: modifyNetworkAclRuleSpecs, + } +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param modifyNetworkAclRuleSpecs: networkAcl规则列表 (Required) + */ +func NewModifyNetworkAclRulesRequestWithAllParams( + regionId string, + networkAclId string, + modifyNetworkAclRuleSpecs []vpc.ModifyNetworkAclRuleSpec, +) *ModifyNetworkAclRulesRequest { + + return &ModifyNetworkAclRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:modifyNetworkAclRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + ModifyNetworkAclRuleSpecs: modifyNetworkAclRuleSpecs, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyNetworkAclRulesRequestWithoutParam() *ModifyNetworkAclRulesRequest { + + return &ModifyNetworkAclRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:modifyNetworkAclRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyNetworkAclRulesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkAclId: networkAclId ID(Required) */ +func (r *ModifyNetworkAclRulesRequest) SetNetworkAclId(networkAclId string) { + r.NetworkAclId = networkAclId +} + +/* param modifyNetworkAclRuleSpecs: networkAcl规则列表(Required) */ +func (r *ModifyNetworkAclRulesRequest) SetModifyNetworkAclRuleSpecs(modifyNetworkAclRuleSpecs []vpc.ModifyNetworkAclRuleSpec) { + r.ModifyNetworkAclRuleSpecs = modifyNetworkAclRuleSpecs +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyNetworkAclRulesRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyNetworkAclRulesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyNetworkAclRulesResult `json:"result"` +} + +type ModifyNetworkAclRulesResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkInterface.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkInterface.go new file mode 100644 index 000000000..071bfebe4 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkInterface.go @@ -0,0 +1,147 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyNetworkInterfaceRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkInterface ID */ + NetworkInterfaceId string `json:"networkInterfaceId"` + + /* 弹性网卡名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符 (Optional) */ + NetworkInterfaceName *string `json:"networkInterfaceName"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` + + /* 以覆盖原有安全组的方式更新的安全组。如果更新安全组ID列表,最多5个安全组 (Optional) */ + SecurityGroups []string `json:"securityGroups"` +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyNetworkInterfaceRequest( + regionId string, + networkInterfaceId string, +) *ModifyNetworkInterfaceRequest { + + return &ModifyNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * param networkInterfaceName: 弹性网卡名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符 (Optional) + * param description: 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) + * param securityGroups: 以覆盖原有安全组的方式更新的安全组。如果更新安全组ID列表,最多5个安全组 (Optional) + */ +func NewModifyNetworkInterfaceRequestWithAllParams( + regionId string, + networkInterfaceId string, + networkInterfaceName *string, + description *string, + securityGroups []string, +) *ModifyNetworkInterfaceRequest { + + return &ModifyNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + NetworkInterfaceName: networkInterfaceName, + Description: description, + SecurityGroups: securityGroups, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyNetworkInterfaceRequestWithoutParam() *ModifyNetworkInterfaceRequest { + + return &ModifyNetworkInterfaceRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyNetworkInterfaceRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkInterfaceId: networkInterface ID(Required) */ +func (r *ModifyNetworkInterfaceRequest) SetNetworkInterfaceId(networkInterfaceId string) { + r.NetworkInterfaceId = networkInterfaceId +} + +/* param networkInterfaceName: 弹性网卡名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符(Optional) */ +func (r *ModifyNetworkInterfaceRequest) SetNetworkInterfaceName(networkInterfaceName string) { + r.NetworkInterfaceName = &networkInterfaceName +} + +/* param description: 描述,允许输入UTF-8编码下的全部字符,不超过256字符(Optional) */ +func (r *ModifyNetworkInterfaceRequest) SetDescription(description string) { + r.Description = &description +} + +/* param securityGroups: 以覆盖原有安全组的方式更新的安全组。如果更新安全组ID列表,最多5个安全组(Optional) */ +func (r *ModifyNetworkInterfaceRequest) SetSecurityGroups(securityGroups []string) { + r.SecurityGroups = securityGroups +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyNetworkInterfaceRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyNetworkInterfaceResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyNetworkInterfaceResult `json:"result"` +} + +type ModifyNetworkInterfaceResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkSecurityGroup.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkSecurityGroup.go new file mode 100644 index 000000000..eccec066c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkSecurityGroup.go @@ -0,0 +1,136 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyNetworkSecurityGroupRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* NetworkSecurityGroup ID */ + NetworkSecurityGroupId string `json:"networkSecurityGroupId"` + + /* 安全组的名字。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + NetworkSecurityGroupName *string `json:"networkSecurityGroupName"` + + /* 安全组的描述,取值范围:0-256个UTF-8编码下的全部字符 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyNetworkSecurityGroupRequest( + regionId string, + networkSecurityGroupId string, +) *ModifyNetworkSecurityGroupRequest { + + return &ModifyNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * param networkSecurityGroupName: 安全组的名字。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) + * param description: 安全组的描述,取值范围:0-256个UTF-8编码下的全部字符 (Optional) + */ +func NewModifyNetworkSecurityGroupRequestWithAllParams( + regionId string, + networkSecurityGroupId string, + networkSecurityGroupName *string, + description *string, +) *ModifyNetworkSecurityGroupRequest { + + return &ModifyNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + NetworkSecurityGroupName: networkSecurityGroupName, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyNetworkSecurityGroupRequestWithoutParam() *ModifyNetworkSecurityGroupRequest { + + return &ModifyNetworkSecurityGroupRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyNetworkSecurityGroupRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkSecurityGroupId: NetworkSecurityGroup ID(Required) */ +func (r *ModifyNetworkSecurityGroupRequest) SetNetworkSecurityGroupId(networkSecurityGroupId string) { + r.NetworkSecurityGroupId = networkSecurityGroupId +} + +/* param networkSecurityGroupName: 安全组的名字。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符(Optional) */ +func (r *ModifyNetworkSecurityGroupRequest) SetNetworkSecurityGroupName(networkSecurityGroupName string) { + r.NetworkSecurityGroupName = &networkSecurityGroupName +} + +/* param description: 安全组的描述,取值范围:0-256个UTF-8编码下的全部字符(Optional) */ +func (r *ModifyNetworkSecurityGroupRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyNetworkSecurityGroupRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyNetworkSecurityGroupResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyNetworkSecurityGroupResult `json:"result"` +} + +type ModifyNetworkSecurityGroupResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkSecurityGroupRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkSecurityGroupRules.go new file mode 100644 index 000000000..63b6949f8 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyNetworkSecurityGroupRules.go @@ -0,0 +1,129 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type ModifyNetworkSecurityGroupRulesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* NetworkSecurityGroup ID */ + NetworkSecurityGroupId string `json:"networkSecurityGroupId"` + + /* 安全组规则信息 */ + ModifySecurityGroupRuleSpecs []vpc.ModifySecurityGroupRules `json:"modifySecurityGroupRuleSpecs"` +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * param modifySecurityGroupRuleSpecs: 安全组规则信息 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyNetworkSecurityGroupRulesRequest( + regionId string, + networkSecurityGroupId string, + modifySecurityGroupRuleSpecs []vpc.ModifySecurityGroupRules, +) *ModifyNetworkSecurityGroupRulesRequest { + + return &ModifyNetworkSecurityGroupRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}:modifyNetworkSecurityGroupRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + ModifySecurityGroupRuleSpecs: modifySecurityGroupRuleSpecs, + } +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * param modifySecurityGroupRuleSpecs: 安全组规则信息 (Required) + */ +func NewModifyNetworkSecurityGroupRulesRequestWithAllParams( + regionId string, + networkSecurityGroupId string, + modifySecurityGroupRuleSpecs []vpc.ModifySecurityGroupRules, +) *ModifyNetworkSecurityGroupRulesRequest { + + return &ModifyNetworkSecurityGroupRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}:modifyNetworkSecurityGroupRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + ModifySecurityGroupRuleSpecs: modifySecurityGroupRuleSpecs, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyNetworkSecurityGroupRulesRequestWithoutParam() *ModifyNetworkSecurityGroupRulesRequest { + + return &ModifyNetworkSecurityGroupRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}:modifyNetworkSecurityGroupRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyNetworkSecurityGroupRulesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkSecurityGroupId: NetworkSecurityGroup ID(Required) */ +func (r *ModifyNetworkSecurityGroupRulesRequest) SetNetworkSecurityGroupId(networkSecurityGroupId string) { + r.NetworkSecurityGroupId = networkSecurityGroupId +} + +/* param modifySecurityGroupRuleSpecs: 安全组规则信息(Required) */ +func (r *ModifyNetworkSecurityGroupRulesRequest) SetModifySecurityGroupRuleSpecs(modifySecurityGroupRuleSpecs []vpc.ModifySecurityGroupRules) { + r.ModifySecurityGroupRuleSpecs = modifySecurityGroupRuleSpecs +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyNetworkSecurityGroupRulesRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyNetworkSecurityGroupRulesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyNetworkSecurityGroupRulesResult `json:"result"` +} + +type ModifyNetworkSecurityGroupRulesResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyRouteTable.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyRouteTable.go new file mode 100644 index 000000000..e97386635 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyRouteTable.go @@ -0,0 +1,136 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyRouteTableRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* RouteTable ID */ + RouteTableId string `json:"routeTableId"` + + /* 路由表的名字。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + RouteTableName *string `json:"routeTableName"` + + /* 路由表的描述,取值范围:0-256个UTF-8编码下的全部字符 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyRouteTableRequest( + regionId string, + routeTableId string, +) *ModifyRouteTableRequest { + + return &ModifyRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + } +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param routeTableName: 路由表的名字。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) + * param description: 路由表的描述,取值范围:0-256个UTF-8编码下的全部字符 (Optional) + */ +func NewModifyRouteTableRequestWithAllParams( + regionId string, + routeTableId string, + routeTableName *string, + description *string, +) *ModifyRouteTableRequest { + + return &ModifyRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + RouteTableName: routeTableName, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyRouteTableRequestWithoutParam() *ModifyRouteTableRequest { + + return &ModifyRouteTableRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyRouteTableRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param routeTableId: RouteTable ID(Required) */ +func (r *ModifyRouteTableRequest) SetRouteTableId(routeTableId string) { + r.RouteTableId = routeTableId +} + +/* param routeTableName: 路由表的名字。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符(Optional) */ +func (r *ModifyRouteTableRequest) SetRouteTableName(routeTableName string) { + r.RouteTableName = &routeTableName +} + +/* param description: 路由表的描述,取值范围:0-256个UTF-8编码下的全部字符(Optional) */ +func (r *ModifyRouteTableRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyRouteTableRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyRouteTableResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyRouteTableResult `json:"result"` +} + +type ModifyRouteTableResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyRouteTableRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyRouteTableRules.go new file mode 100644 index 000000000..7a1479c9c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyRouteTableRules.go @@ -0,0 +1,129 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models" +) + +type ModifyRouteTableRulesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* RouteTable ID */ + RouteTableId string `json:"routeTableId"` + + /* 路由表规则信息 */ + ModifyRouteTableRuleSpecs []vpc.ModifyRouteTableRules `json:"modifyRouteTableRuleSpecs"` +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param modifyRouteTableRuleSpecs: 路由表规则信息 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyRouteTableRulesRequest( + regionId string, + routeTableId string, + modifyRouteTableRuleSpecs []vpc.ModifyRouteTableRules, +) *ModifyRouteTableRulesRequest { + + return &ModifyRouteTableRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:modifyRouteTableRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + ModifyRouteTableRuleSpecs: modifyRouteTableRuleSpecs, + } +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param modifyRouteTableRuleSpecs: 路由表规则信息 (Required) + */ +func NewModifyRouteTableRulesRequestWithAllParams( + regionId string, + routeTableId string, + modifyRouteTableRuleSpecs []vpc.ModifyRouteTableRules, +) *ModifyRouteTableRulesRequest { + + return &ModifyRouteTableRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:modifyRouteTableRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + ModifyRouteTableRuleSpecs: modifyRouteTableRuleSpecs, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyRouteTableRulesRequestWithoutParam() *ModifyRouteTableRulesRequest { + + return &ModifyRouteTableRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:modifyRouteTableRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyRouteTableRulesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param routeTableId: RouteTable ID(Required) */ +func (r *ModifyRouteTableRulesRequest) SetRouteTableId(routeTableId string) { + r.RouteTableId = routeTableId +} + +/* param modifyRouteTableRuleSpecs: 路由表规则信息(Required) */ +func (r *ModifyRouteTableRulesRequest) SetModifyRouteTableRuleSpecs(modifyRouteTableRuleSpecs []vpc.ModifyRouteTableRules) { + r.ModifyRouteTableRuleSpecs = modifyRouteTableRuleSpecs +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyRouteTableRulesRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyRouteTableRulesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyRouteTableRulesResult `json:"result"` +} + +type ModifyRouteTableRulesResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifySubnet.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifySubnet.go new file mode 100644 index 000000000..1465afc76 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifySubnet.go @@ -0,0 +1,136 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifySubnetRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* Subnet ID */ + SubnetId string `json:"subnetId"` + + /* 子网名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) */ + SubnetName *string `json:"subnetName"` + + /* 子网描述信息,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param subnetId: Subnet ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifySubnetRequest( + regionId string, + subnetId string, +) *ModifySubnetRequest { + + return &ModifySubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/{subnetId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SubnetId: subnetId, + } +} + +/* + * param regionId: Region ID (Required) + * param subnetId: Subnet ID (Required) + * param subnetName: 子网名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) + * param description: 子网描述信息,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) + */ +func NewModifySubnetRequestWithAllParams( + regionId string, + subnetId string, + subnetName *string, + description *string, +) *ModifySubnetRequest { + + return &ModifySubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/{subnetId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + SubnetId: subnetId, + SubnetName: subnetName, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifySubnetRequestWithoutParam() *ModifySubnetRequest { + + return &ModifySubnetRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/subnets/{subnetId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifySubnetRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param subnetId: Subnet ID(Required) */ +func (r *ModifySubnetRequest) SetSubnetId(subnetId string) { + r.SubnetId = subnetId +} + +/* param subnetName: 子网名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。(Optional) */ +func (r *ModifySubnetRequest) SetSubnetName(subnetName string) { + r.SubnetName = &subnetName +} + +/* param description: 子网描述信息,允许输入UTF-8编码下的全部字符,不超过256字符。(Optional) */ +func (r *ModifySubnetRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifySubnetRequest) GetRegionId() string { + return r.RegionId +} + +type ModifySubnetResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifySubnetResult `json:"result"` +} + +type ModifySubnetResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyVpc.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyVpc.go new file mode 100644 index 000000000..c66845701 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyVpc.go @@ -0,0 +1,136 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyVpcRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* Vpc ID */ + VpcId string `json:"vpcId"` + + /* 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) */ + VpcName *string `json:"vpcName"` + + /* vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param vpcId: Vpc ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyVpcRequest( + regionId string, + vpcId string, +) *ModifyVpcRequest { + + return &ModifyVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/{vpcId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcId: Vpc ID (Required) + * param vpcName: 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) + * param description: vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) + */ +func NewModifyVpcRequestWithAllParams( + regionId string, + vpcId string, + vpcName *string, + description *string, +) *ModifyVpcRequest { + + return &ModifyVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/{vpcId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcId: vpcId, + VpcName: vpcName, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyVpcRequestWithoutParam() *ModifyVpcRequest { + + return &ModifyVpcRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcs/{vpcId}", + Method: "PATCH", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyVpcRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcId: Vpc ID(Required) */ +func (r *ModifyVpcRequest) SetVpcId(vpcId string) { + r.VpcId = vpcId +} + +/* param vpcName: 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。(Optional) */ +func (r *ModifyVpcRequest) SetVpcName(vpcName string) { + r.VpcName = &vpcName +} + +/* param description: vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。(Optional) */ +func (r *ModifyVpcRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyVpcRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyVpcResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyVpcResult `json:"result"` +} + +type ModifyVpcResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyVpcPeering.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyVpcPeering.go new file mode 100644 index 000000000..804b6c5b8 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/ModifyVpcPeering.go @@ -0,0 +1,136 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type ModifyVpcPeeringRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* vpcPeeringId ID */ + VpcPeeringId string `json:"vpcPeeringId"` + + /* VpcPeering的名字,不为空。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + VpcPeeringName *string `json:"vpcPeeringName"` + + /* VpcPeering 描述,取值范围:0-256个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + Description *string `json:"description"` +} + +/* + * param regionId: Region ID (Required) + * param vpcPeeringId: vpcPeeringId ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewModifyVpcPeeringRequest( + regionId string, + vpcPeeringId string, +) *ModifyVpcPeeringRequest { + + return &ModifyVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/{vpcPeeringId}", + Method: "PUT", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcPeeringId: vpcPeeringId, + } +} + +/* + * param regionId: Region ID (Required) + * param vpcPeeringId: vpcPeeringId ID (Required) + * param vpcPeeringName: VpcPeering的名字,不为空。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) + * param description: VpcPeering 描述,取值范围:0-256个中文、英文大小写的字母、数字和下划线分隔符 (Optional) + */ +func NewModifyVpcPeeringRequestWithAllParams( + regionId string, + vpcPeeringId string, + vpcPeeringName *string, + description *string, +) *ModifyVpcPeeringRequest { + + return &ModifyVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/{vpcPeeringId}", + Method: "PUT", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + VpcPeeringId: vpcPeeringId, + VpcPeeringName: vpcPeeringName, + Description: description, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewModifyVpcPeeringRequestWithoutParam() *ModifyVpcPeeringRequest { + + return &ModifyVpcPeeringRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/vpcPeerings/{vpcPeeringId}", + Method: "PUT", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *ModifyVpcPeeringRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param vpcPeeringId: vpcPeeringId ID(Required) */ +func (r *ModifyVpcPeeringRequest) SetVpcPeeringId(vpcPeeringId string) { + r.VpcPeeringId = vpcPeeringId +} + +/* param vpcPeeringName: VpcPeering的名字,不为空。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符(Optional) */ +func (r *ModifyVpcPeeringRequest) SetVpcPeeringName(vpcPeeringName string) { + r.VpcPeeringName = &vpcPeeringName +} + +/* param description: VpcPeering 描述,取值范围:0-256个中文、英文大小写的字母、数字和下划线分隔符(Optional) */ +func (r *ModifyVpcPeeringRequest) SetDescription(description string) { + r.Description = &description +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r ModifyVpcPeeringRequest) GetRegionId() string { + return r.RegionId +} + +type ModifyVpcPeeringResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result ModifyVpcPeeringResult `json:"result"` +} + +type ModifyVpcPeeringResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/RemoveNetworkAclRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/RemoveNetworkAclRules.go new file mode 100644 index 000000000..3bea0a0b7 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/RemoveNetworkAclRules.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type RemoveNetworkAclRulesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkAclId ID */ + NetworkAclId string `json:"networkAclId"` + + /* networkAcl规则ID列表 */ + RuleIds []string `json:"ruleIds"` +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param ruleIds: networkAcl规则ID列表 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewRemoveNetworkAclRulesRequest( + regionId string, + networkAclId string, + ruleIds []string, +) *RemoveNetworkAclRulesRequest { + + return &RemoveNetworkAclRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:removeNetworkAclRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + RuleIds: ruleIds, + } +} + +/* + * param regionId: Region ID (Required) + * param networkAclId: networkAclId ID (Required) + * param ruleIds: networkAcl规则ID列表 (Required) + */ +func NewRemoveNetworkAclRulesRequestWithAllParams( + regionId string, + networkAclId string, + ruleIds []string, +) *RemoveNetworkAclRulesRequest { + + return &RemoveNetworkAclRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:removeNetworkAclRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkAclId: networkAclId, + RuleIds: ruleIds, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewRemoveNetworkAclRulesRequestWithoutParam() *RemoveNetworkAclRulesRequest { + + return &RemoveNetworkAclRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkAcls/{networkAclId}:removeNetworkAclRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *RemoveNetworkAclRulesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkAclId: networkAclId ID(Required) */ +func (r *RemoveNetworkAclRulesRequest) SetNetworkAclId(networkAclId string) { + r.NetworkAclId = networkAclId +} + +/* param ruleIds: networkAcl规则ID列表(Required) */ +func (r *RemoveNetworkAclRulesRequest) SetRuleIds(ruleIds []string) { + r.RuleIds = ruleIds +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r RemoveNetworkAclRulesRequest) GetRegionId() string { + return r.RegionId +} + +type RemoveNetworkAclRulesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result RemoveNetworkAclRulesResult `json:"result"` +} + +type RemoveNetworkAclRulesResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/RemoveNetworkSecurityGroupRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/RemoveNetworkSecurityGroupRules.go new file mode 100644 index 000000000..abb2c3977 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/RemoveNetworkSecurityGroupRules.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type RemoveNetworkSecurityGroupRulesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* NetworkSecurityGroup ID */ + NetworkSecurityGroupId string `json:"networkSecurityGroupId"` + + /* 安全组规则Id列表 */ + RuleIds []string `json:"ruleIds"` +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * param ruleIds: 安全组规则Id列表 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewRemoveNetworkSecurityGroupRulesRequest( + regionId string, + networkSecurityGroupId string, + ruleIds []string, +) *RemoveNetworkSecurityGroupRulesRequest { + + return &RemoveNetworkSecurityGroupRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}:removeNetworkSecurityGroupRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + RuleIds: ruleIds, + } +} + +/* + * param regionId: Region ID (Required) + * param networkSecurityGroupId: NetworkSecurityGroup ID (Required) + * param ruleIds: 安全组规则Id列表 (Required) + */ +func NewRemoveNetworkSecurityGroupRulesRequestWithAllParams( + regionId string, + networkSecurityGroupId string, + ruleIds []string, +) *RemoveNetworkSecurityGroupRulesRequest { + + return &RemoveNetworkSecurityGroupRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}:removeNetworkSecurityGroupRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkSecurityGroupId: networkSecurityGroupId, + RuleIds: ruleIds, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewRemoveNetworkSecurityGroupRulesRequestWithoutParam() *RemoveNetworkSecurityGroupRulesRequest { + + return &RemoveNetworkSecurityGroupRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkSecurityGroups/{networkSecurityGroupId}:removeNetworkSecurityGroupRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *RemoveNetworkSecurityGroupRulesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkSecurityGroupId: NetworkSecurityGroup ID(Required) */ +func (r *RemoveNetworkSecurityGroupRulesRequest) SetNetworkSecurityGroupId(networkSecurityGroupId string) { + r.NetworkSecurityGroupId = networkSecurityGroupId +} + +/* param ruleIds: 安全组规则Id列表(Required) */ +func (r *RemoveNetworkSecurityGroupRulesRequest) SetRuleIds(ruleIds []string) { + r.RuleIds = ruleIds +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r RemoveNetworkSecurityGroupRulesRequest) GetRegionId() string { + return r.RegionId +} + +type RemoveNetworkSecurityGroupRulesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result RemoveNetworkSecurityGroupRulesResult `json:"result"` +} + +type RemoveNetworkSecurityGroupRulesResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/RemoveRouteTableRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/RemoveRouteTableRules.go new file mode 100644 index 000000000..a307b98db --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/RemoveRouteTableRules.go @@ -0,0 +1,128 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type RemoveRouteTableRulesRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* RouteTable ID */ + RouteTableId string `json:"routeTableId"` + + /* 路由表规则Id列表 */ + RuleIds []string `json:"ruleIds"` +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param ruleIds: 路由表规则Id列表 (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewRemoveRouteTableRulesRequest( + regionId string, + routeTableId string, + ruleIds []string, +) *RemoveRouteTableRulesRequest { + + return &RemoveRouteTableRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:removeRouteTableRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + RuleIds: ruleIds, + } +} + +/* + * param regionId: Region ID (Required) + * param routeTableId: RouteTable ID (Required) + * param ruleIds: 路由表规则Id列表 (Required) + */ +func NewRemoveRouteTableRulesRequestWithAllParams( + regionId string, + routeTableId string, + ruleIds []string, +) *RemoveRouteTableRulesRequest { + + return &RemoveRouteTableRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:removeRouteTableRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + RouteTableId: routeTableId, + RuleIds: ruleIds, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewRemoveRouteTableRulesRequestWithoutParam() *RemoveRouteTableRulesRequest { + + return &RemoveRouteTableRulesRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/routeTables/{routeTableId}:removeRouteTableRules", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *RemoveRouteTableRulesRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param routeTableId: RouteTable ID(Required) */ +func (r *RemoveRouteTableRulesRequest) SetRouteTableId(routeTableId string) { + r.RouteTableId = routeTableId +} + +/* param ruleIds: 路由表规则Id列表(Required) */ +func (r *RemoveRouteTableRulesRequest) SetRuleIds(ruleIds []string) { + r.RuleIds = ruleIds +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r RemoveRouteTableRulesRequest) GetRegionId() string { + return r.RegionId +} + +type RemoveRouteTableRulesResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result RemoveRouteTableRulesResult `json:"result"` +} + +type RemoveRouteTableRulesResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/UnassignSecondaryIps.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/UnassignSecondaryIps.go new file mode 100644 index 000000000..5d3e7260f --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis/UnassignSecondaryIps.go @@ -0,0 +1,125 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package apis + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" +) + +type UnassignSecondaryIpsRequest struct { + + core.JDCloudRequest + + /* Region ID */ + RegionId string `json:"regionId"` + + /* networkInterface ID */ + NetworkInterfaceId string `json:"networkInterfaceId"` + + /* 指定删除的secondaryIp地址 (Optional) */ + SecondaryIps []string `json:"secondaryIps"` +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * + * @Deprecated, not compatible when mandatory parameters changed + */ +func NewUnassignSecondaryIpsRequest( + regionId string, + networkInterfaceId string, +) *UnassignSecondaryIpsRequest { + + return &UnassignSecondaryIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:unassignSecondaryIps", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + } +} + +/* + * param regionId: Region ID (Required) + * param networkInterfaceId: networkInterface ID (Required) + * param secondaryIps: 指定删除的secondaryIp地址 (Optional) + */ +func NewUnassignSecondaryIpsRequestWithAllParams( + regionId string, + networkInterfaceId string, + secondaryIps []string, +) *UnassignSecondaryIpsRequest { + + return &UnassignSecondaryIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:unassignSecondaryIps", + Method: "POST", + Header: nil, + Version: "v1", + }, + RegionId: regionId, + NetworkInterfaceId: networkInterfaceId, + SecondaryIps: secondaryIps, + } +} + +/* This constructor has better compatible ability when API parameters changed */ +func NewUnassignSecondaryIpsRequestWithoutParam() *UnassignSecondaryIpsRequest { + + return &UnassignSecondaryIpsRequest{ + JDCloudRequest: core.JDCloudRequest{ + URL: "/regions/{regionId}/networkInterfaces/{networkInterfaceId}:unassignSecondaryIps", + Method: "POST", + Header: nil, + Version: "v1", + }, + } +} + +/* param regionId: Region ID(Required) */ +func (r *UnassignSecondaryIpsRequest) SetRegionId(regionId string) { + r.RegionId = regionId +} + +/* param networkInterfaceId: networkInterface ID(Required) */ +func (r *UnassignSecondaryIpsRequest) SetNetworkInterfaceId(networkInterfaceId string) { + r.NetworkInterfaceId = networkInterfaceId +} + +/* param secondaryIps: 指定删除的secondaryIp地址(Optional) */ +func (r *UnassignSecondaryIpsRequest) SetSecondaryIps(secondaryIps []string) { + r.SecondaryIps = secondaryIps +} + +// GetRegionId returns path parameter 'regionId' if exist, +// otherwise return empty string +func (r UnassignSecondaryIpsRequest) GetRegionId() string { + return r.RegionId +} + +type UnassignSecondaryIpsResponse struct { + RequestID string `json:"requestId"` + Error core.ErrorResponse `json:"error"` + Result UnassignSecondaryIpsResult `json:"result"` +} + +type UnassignSecondaryIpsResult struct { +} \ No newline at end of file diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/client/VpcClient.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/client/VpcClient.go new file mode 100644 index 000000000..a81ad2155 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/client/VpcClient.go @@ -0,0 +1,1215 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package client + +import ( + "github.com/jdcloud-api/jdcloud-sdk-go/core" + vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis" + "encoding/json" + "errors" +) + +type VpcClient struct { + core.JDCloudClient +} + +func NewVpcClient(credential *core.Credential) *VpcClient { + if credential == nil { + return nil + } + + config := core.NewConfig() + config.SetEndpoint("vpc.jdcloud-api.com") + + return &VpcClient{ + core.JDCloudClient{ + Credential: *credential, + Config: *config, + ServiceName: "vpc", + Revision: "0.5.1", + Logger: core.NewDefaultLogger(core.LogInfo), + }} +} + +func (c *VpcClient) SetConfig(config *core.Config) { + c.Config = *config +} + +func (c *VpcClient) SetLogger(logger core.Logger) { + c.Logger = logger +} + +/* 删除弹性Ip */ +func (c *VpcClient) DeleteElasticIp(request *vpc.DeleteElasticIpRequest) (*vpc.DeleteElasticIpResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DeleteElasticIpResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改VpcPeering接口 */ +func (c *VpcClient) ModifyVpcPeering(request *vpc.ModifyVpcPeeringRequest) (*vpc.ModifyVpcPeeringResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyVpcPeeringResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改弹性IP */ +func (c *VpcClient) ModifyElasticIp(request *vpc.ModifyElasticIpRequest) (*vpc.ModifyElasticIpResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyElasticIpResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改networkAcl接口 */ +func (c *VpcClient) ModifyNetworkAclRules(request *vpc.ModifyNetworkAclRulesRequest) (*vpc.ModifyNetworkAclRulesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyNetworkAclRulesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除networkAcl接口 */ +func (c *VpcClient) DeleteNetworkAcl(request *vpc.DeleteNetworkAclRequest) (*vpc.DeleteNetworkAclResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DeleteNetworkAclResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除子网 */ +func (c *VpcClient) DeleteSubnet(request *vpc.DeleteSubnetRequest) (*vpc.DeleteSubnetResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DeleteSubnetResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询子网列表 */ +func (c *VpcClient) DescribeSubnets(request *vpc.DescribeSubnetsRequest) (*vpc.DescribeSubnetsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeSubnetsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询弹性网卡列表 */ +func (c *VpcClient) DescribeNetworkInterfaces(request *vpc.DescribeNetworkInterfacesRequest) (*vpc.DescribeNetworkInterfacesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeNetworkInterfacesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 移除安全组规则 */ +func (c *VpcClient) RemoveNetworkSecurityGroupRules(request *vpc.RemoveNetworkSecurityGroupRulesRequest) (*vpc.RemoveNetworkSecurityGroupRulesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.RemoveNetworkSecurityGroupRulesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改安全组属性 */ +func (c *VpcClient) ModifyNetworkSecurityGroup(request *vpc.ModifyNetworkSecurityGroupRequest) (*vpc.ModifyNetworkSecurityGroupResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyNetworkSecurityGroupResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 添加安全组规则 */ +func (c *VpcClient) AddNetworkSecurityGroupRules(request *vpc.AddNetworkSecurityGroupRulesRequest) (*vpc.AddNetworkSecurityGroupRulesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.AddNetworkSecurityGroupRulesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建networkAcl接口 */ +func (c *VpcClient) CreateNetworkAcl(request *vpc.CreateNetworkAclRequest) (*vpc.CreateNetworkAclResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.CreateNetworkAclResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询配额信息 */ +func (c *VpcClient) DescribeQuota(request *vpc.DescribeQuotaRequest) (*vpc.DescribeQuotaResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeQuotaResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建路由表 */ +func (c *VpcClient) CreateRouteTable(request *vpc.CreateRouteTableRequest) (*vpc.CreateRouteTableResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.CreateRouteTableResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除安全组 */ +func (c *VpcClient) DeleteNetworkSecurityGroup(request *vpc.DeleteNetworkSecurityGroupRequest) (*vpc.DeleteNetworkSecurityGroupResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DeleteNetworkSecurityGroupResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询路由表信息详情 */ +func (c *VpcClient) DescribeRouteTable(request *vpc.DescribeRouteTableRequest) (*vpc.DescribeRouteTableResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeRouteTableResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除私有网络 */ +func (c *VpcClient) DeleteVpc(request *vpc.DeleteVpcRequest) (*vpc.DeleteVpcResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DeleteVpcResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询VpcPeering资源列表 */ +func (c *VpcClient) DescribeVpcPeerings(request *vpc.DescribeVpcPeeringsRequest) (*vpc.DescribeVpcPeeringsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeVpcPeeringsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询Acl列表 */ +func (c *VpcClient) DescribeNetworkAcls(request *vpc.DescribeNetworkAclsRequest) (*vpc.DescribeNetworkAclsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeNetworkAclsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询子网信息详情 */ +func (c *VpcClient) DescribeSubnet(request *vpc.DescribeSubnetRequest) (*vpc.DescribeSubnetResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeSubnetResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询安全组信息详情 */ +func (c *VpcClient) DescribeNetworkSecurityGroup(request *vpc.DescribeNetworkSecurityGroupRequest) (*vpc.DescribeNetworkSecurityGroupResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeNetworkSecurityGroupResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询安全组列表 */ +func (c *VpcClient) DescribeNetworkSecurityGroups(request *vpc.DescribeNetworkSecurityGroupsRequest) (*vpc.DescribeNetworkSecurityGroupsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeNetworkSecurityGroupsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询Vpc信息详情 */ +func (c *VpcClient) DescribeVpc(request *vpc.DescribeVpcRequest) (*vpc.DescribeVpcResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeVpcResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 给子网解绑NetworkAcl接口 */ +func (c *VpcClient) DisassociateNetworkAcl(request *vpc.DisassociateNetworkAclRequest) (*vpc.DisassociateNetworkAclResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DisassociateNetworkAclResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 移除networkAcl规则 */ +func (c *VpcClient) RemoveNetworkAclRules(request *vpc.RemoveNetworkAclRulesRequest) (*vpc.RemoveNetworkAclRulesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.RemoveNetworkAclRulesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 路由表绑定子网接口 */ +func (c *VpcClient) AssociateRouteTable(request *vpc.AssociateRouteTableRequest) (*vpc.AssociateRouteTableResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.AssociateRouteTableResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询私有网络列表 */ +func (c *VpcClient) DescribeVpcs(request *vpc.DescribeVpcsRequest) (*vpc.DescribeVpcsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeVpcsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建安全组 */ +func (c *VpcClient) CreateNetworkSecurityGroup(request *vpc.CreateNetworkSecurityGroupRequest) (*vpc.CreateNetworkSecurityGroupResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.CreateNetworkSecurityGroupResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建子网 */ +func (c *VpcClient) CreateSubnet(request *vpc.CreateSubnetRequest) (*vpc.CreateSubnetResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.CreateSubnetResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除路由表 */ +func (c *VpcClient) DeleteRouteTable(request *vpc.DeleteRouteTableRequest) (*vpc.DeleteRouteTableResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DeleteRouteTableResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询VpcPeering资源详情 */ +func (c *VpcClient) DescribeVpcPeering(request *vpc.DescribeVpcPeeringRequest) (*vpc.DescribeVpcPeeringResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeVpcPeeringResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 移除路由表规则 */ +func (c *VpcClient) RemoveRouteTableRules(request *vpc.RemoveRouteTableRulesRequest) (*vpc.RemoveRouteTableRulesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.RemoveRouteTableRulesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建VpcPeering接口 */ +func (c *VpcClient) CreateVpcPeering(request *vpc.CreateVpcPeeringRequest) (*vpc.CreateVpcPeeringResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.CreateVpcPeeringResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 给网卡分配secondaryIp接口 */ +func (c *VpcClient) AssignSecondaryIps(request *vpc.AssignSecondaryIpsRequest) (*vpc.AssignSecondaryIpsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.AssignSecondaryIpsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询路由表列表 */ +func (c *VpcClient) DescribeRouteTables(request *vpc.DescribeRouteTablesRequest) (*vpc.DescribeRouteTablesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeRouteTablesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改弹性网卡接口 */ +func (c *VpcClient) ModifyNetworkInterface(request *vpc.ModifyNetworkInterfaceRequest) (*vpc.ModifyNetworkInterfaceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyNetworkInterfaceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询弹性ip列表 */ +func (c *VpcClient) DescribeElasticIps(request *vpc.DescribeElasticIpsRequest) (*vpc.DescribeElasticIpsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeElasticIpsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改安全组规则 */ +func (c *VpcClient) ModifyNetworkSecurityGroupRules(request *vpc.ModifyNetworkSecurityGroupRulesRequest) (*vpc.ModifyNetworkSecurityGroupRulesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyNetworkSecurityGroupRulesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改networkAcl接口 */ +func (c *VpcClient) ModifyNetworkAcl(request *vpc.ModifyNetworkAclRequest) (*vpc.ModifyNetworkAclResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyNetworkAclResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询弹性网卡信息详情 */ +func (c *VpcClient) DescribeNetworkInterface(request *vpc.DescribeNetworkInterfaceRequest) (*vpc.DescribeNetworkInterfaceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeNetworkInterfaceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 给网卡解绑弹性Ip接口 */ +func (c *VpcClient) DisassociateElasticIp(request *vpc.DisassociateElasticIpRequest) (*vpc.DisassociateElasticIpResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DisassociateElasticIpResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除VpcPeering接口 */ +func (c *VpcClient) DeleteVpcPeering(request *vpc.DeleteVpcPeeringRequest) (*vpc.DeleteVpcPeeringResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DeleteVpcPeeringResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建网卡接口,只能创建辅助网卡 */ +func (c *VpcClient) CreateNetworkInterface(request *vpc.CreateNetworkInterfaceRequest) (*vpc.CreateNetworkInterfaceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.CreateNetworkInterfaceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建私有网络 */ +func (c *VpcClient) CreateVpc(request *vpc.CreateVpcRequest) (*vpc.CreateVpcResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.CreateVpcResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改路由表规则 */ +func (c *VpcClient) ModifyRouteTableRules(request *vpc.ModifyRouteTableRulesRequest) (*vpc.ModifyRouteTableRulesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyRouteTableRulesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 添加路由表规则 */ +func (c *VpcClient) AddRouteTableRules(request *vpc.AddRouteTableRulesRequest) (*vpc.AddRouteTableRulesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.AddRouteTableRulesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* ElasticIp资源信息详情 */ +func (c *VpcClient) DescribeElasticIp(request *vpc.DescribeElasticIpRequest) (*vpc.DescribeElasticIpResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeElasticIpResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 给网卡删除secondaryIp接口 */ +func (c *VpcClient) UnassignSecondaryIps(request *vpc.UnassignSecondaryIpsRequest) (*vpc.UnassignSecondaryIpsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.UnassignSecondaryIpsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改路由表属性 */ +func (c *VpcClient) ModifyRouteTable(request *vpc.ModifyRouteTableRequest) (*vpc.ModifyRouteTableResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyRouteTableResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 给网卡绑定弹性Ip接口 */ +func (c *VpcClient) AssociateElasticIp(request *vpc.AssociateElasticIpRequest) (*vpc.AssociateElasticIpResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.AssociateElasticIpResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 给路由表解绑子网接口 */ +func (c *VpcClient) DisassociateRouteTable(request *vpc.DisassociateRouteTableRequest) (*vpc.DisassociateRouteTableResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DisassociateRouteTableResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改私有网络接口 */ +func (c *VpcClient) ModifyVpc(request *vpc.ModifyVpcRequest) (*vpc.ModifyVpcResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifyVpcResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 给子网绑定networkAcl接口 */ +func (c *VpcClient) AssociateNetworkAcl(request *vpc.AssociateNetworkAclRequest) (*vpc.AssociateNetworkAclResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.AssociateNetworkAclResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 修改子网接口 */ +func (c *VpcClient) ModifySubnet(request *vpc.ModifySubnetRequest) (*vpc.ModifySubnetResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.ModifySubnetResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 创建一个或者多个弹性Ip */ +func (c *VpcClient) CreateElasticIps(request *vpc.CreateElasticIpsRequest) (*vpc.CreateElasticIpsResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.CreateElasticIpsResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 删除弹性网卡接口 */ +func (c *VpcClient) DeleteNetworkInterface(request *vpc.DeleteNetworkInterfaceRequest) (*vpc.DeleteNetworkInterfaceResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DeleteNetworkInterfaceResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 查询networkAcl资源详情 */ +func (c *VpcClient) DescribeNetworkAcl(request *vpc.DescribeNetworkAclRequest) (*vpc.DescribeNetworkAclResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.DescribeNetworkAclResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + +/* 添加networkAcl规则接口 */ +func (c *VpcClient) AddNetworkAclRules(request *vpc.AddNetworkAclRulesRequest) (*vpc.AddNetworkAclRulesResponse, error) { + if request == nil { + return nil, errors.New("Request object is nil. ") + } + resp, err := c.Send(request, c.ServiceName) + if err != nil { + return nil, err + } + + jdResp := &vpc.AddNetworkAclRulesResponse{} + err = json.Unmarshal(resp, jdResp) + if err != nil { + c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp)) + return nil, err + } + + return jdResp, err +} + diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddNetworkAclRuleSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddNetworkAclRuleSpec.go new file mode 100644 index 000000000..8a4a6f079 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddNetworkAclRuleSpec.go @@ -0,0 +1,45 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type AddNetworkAclRuleSpec struct { + + /* 规则限定协议。取值范围:All,TCP,UDP,ICMP */ + Protocol string `json:"protocol"` + + /* 规则限定起始传输层端口, 取值范围:1-65535, 若protocol为传输层协议,默认值为1,若protocol不是传输层协议,设置无效,恒为0。如果规则只限定一个端口号,fromPort和toPort填写同一个值 (Optional) */ + FromPort *int `json:"fromPort"` + + /* 规则限定终止传输层端口, 取值范围:1-65535, 若protocol为传输层协议,默认值为65535,若protocol不是传输层协议,设置无效,恒为0。如果规则只限定一个端口号,fromPort和toPort填写同一个值 (Optional) */ + ToPort *int `json:"toPort"` + + /* networkAcl规则方向。ingress:入规则; egress:出规则 */ + Direction string `json:"direction"` + + /* 匹配地址前缀 */ + AddressPrefix string `json:"addressPrefix"` + + /* 访问控制策略:allow:允许,deny:拒绝 */ + RuleAction string `json:"ruleAction"` + + /* 规则匹配优先级,取值范围为[1,32768],优先级数字越小优先级越高 */ + Priority int `json:"priority"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddNetworkAclRulesSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddNetworkAclRulesSpec.go new file mode 100644 index 000000000..1ab41cf86 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddNetworkAclRulesSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type AddNetworkAclRulesSpec struct { + + /* networkAcl规则列表 */ + NetworkAclRuleSpecs []AddNetworkAclRuleSpec `json:"networkAclRuleSpecs"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddNetworkSecurityGroupRulesSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddNetworkSecurityGroupRulesSpec.go new file mode 100644 index 000000000..1c4473104 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddNetworkSecurityGroupRulesSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type AddNetworkSecurityGroupRulesSpec struct { + + /* 安全组规则信息 */ + NetworkSecurityGroupRuleSpecs []AddSecurityGroupRules `json:"networkSecurityGroupRuleSpecs"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddRouteTableRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddRouteTableRules.go new file mode 100644 index 000000000..d6c3fac30 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddRouteTableRules.go @@ -0,0 +1,33 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type AddRouteTableRules struct { + + /* 下一跳类型, 取值范围:instance:云主机, internet:公网, vpc_peering:vpc对等连接, bgw:边界网关 */ + NextHopType string `json:"nextHopType"` + + /* 下一跳id */ + NextHopId string `json:"nextHopId"` + + /* 匹配地址前缀, internet类型路由跟其他类型的路由,addressPrefix不允许重复 */ + AddressPrefix string `json:"addressPrefix"` + + /* 规则匹配优先级,取值范围[1,255],默认为100。当路由规则子网掩码不同时,路由最长匹配优先;当路由规则子网掩码相同时, 按照优先级匹配转发, 优先级数字越小优先级越高,路由规则子网掩码相同、优先级相同、下一跳不同时,形成等价路由,不同下一跳负载均担。 (Optional) */ + Priority *int `json:"priority"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddRouteTableRulesSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddRouteTableRulesSpec.go new file mode 100644 index 000000000..599703cd7 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddRouteTableRulesSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type AddRouteTableRulesSpec struct { + + /* 安全组规则信息 */ + RouteTableRuleSpecs []AddRouteTableRules `json:"routeTableRuleSpecs"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddSecurityGroupRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddSecurityGroupRules.go new file mode 100644 index 000000000..f9b279022 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AddSecurityGroupRules.go @@ -0,0 +1,39 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type AddSecurityGroupRules struct { + + /* 规则限定协议。300:All; 6:TCP; 17:UDP; 1:ICMP */ + Protocol int `json:"protocol"` + + /* 安全组规则方向。0:入规则; 1:出规则 */ + Direction int `json:"direction"` + + /* 匹配地址前缀 */ + AddressPrefix string `json:"addressPrefix"` + + /* 规则限定起始传输层端口, 取值范围:1-65535, 若protocol为传输层协议,默认值为1,若protocol不是传输层协议,恒为0。如果规则只限定一个端口号,fromPort和toPort填写同一个值 (Optional) */ + FromPort *int `json:"fromPort"` + + /* 规则限定终止传输层端口, 取值范围:1-65535, 若protocol为传输层协议,默认值为65535,若protocol不是传输层协议,恒为0。如果规则只限定一个端口号,fromPort和toPort填写同一个值 (Optional) */ + ToPort *int `json:"toPort"` + + /* 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AssignSecondaryIpsSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AssignSecondaryIpsSpec.go new file mode 100644 index 000000000..fb151872b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AssignSecondaryIpsSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type AssignSecondaryIpsSpec struct { + + /* secondary ip被其他接口占用时,是否抢占。false:非抢占重分配,true:抢占重分配,默认抢占重分配。默认值:true (Optional) */ + Force bool `json:"force"` + + /* 指定分配的secondaryIp地址 (Optional) */ + SecondaryIps []string `json:"secondaryIps"` + + /* 指定自动分配的secondaryIp个数 (Optional) */ + SecondaryIpCount int `json:"secondaryIpCount"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AssociateElasticIpSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AssociateElasticIpSpec.go new file mode 100644 index 000000000..fea484c08 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AssociateElasticIpSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type AssociateElasticIpSpec struct { + + /* 绑定的弹性Ip Id (Optional) */ + ElasticIpId string `json:"elasticIpId"` + + /* 绑定弹性Ip到指定的privateIp (Optional) */ + PrivateIpAddress string `json:"privateIpAddress"` + + /* 绑定的弹性Ip地址 (Optional) */ + ElasticIpAddress string `json:"elasticIpAddress"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AssociateRouteTableSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AssociateRouteTableSpec.go new file mode 100644 index 000000000..77cbe3c90 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/AssociateRouteTableSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type AssociateRouteTableSpec struct { + + /* 路由表要绑定的子网ID列表, subnet已被其他路由表绑定时,自动解绑。 */ + SubnetIds []string `json:"subnetIds"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/CreateElasticIpSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/CreateElasticIpSpec.go new file mode 100644 index 000000000..681f0f2e7 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/CreateElasticIpSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type CreateElasticIpSpec struct { + + /* 购买弹性ip数量;取值范围:[1,100] */ + MaxCount int `json:"maxCount"` + + /* 指定弹性ip地址进行创建,当申请创建多个弹性ip时,必须为空 (Optional) */ + ElasticIpAddress string `json:"elasticIpAddress"` + + /* 弹性ip规格 */ + ElasticIpSpec ElasticIpSpec `json:"elasticIpSpec"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/CreateVpcPeeringSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/CreateVpcPeeringSpec.go new file mode 100644 index 000000000..5733faa74 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/CreateVpcPeeringSpec.go @@ -0,0 +1,33 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type CreateVpcPeeringSpec struct { + + /* VpcPeering的名字,不为空。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 */ + VpcPeeringName string `json:"vpcPeeringName"` + + /* VpcPeering本端Vpc的Id */ + VpcId string `json:"vpcId"` + + /* VpcPeering对端Vpc的Id */ + RemoteVpcId string `json:"remoteVpcId"` + + /* VpcPeering 描述,取值范围:0-256个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/DisassociateElasticIpSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/DisassociateElasticIpSpec.go new file mode 100644 index 000000000..c9512a325 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/DisassociateElasticIpSpec.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type DisassociateElasticIpSpec struct { + + /* 指定解绑的弹性Ip Id (Optional) */ + ElasticIpId string `json:"elasticIpId"` + + /* 指定解绑的弹性Ip地址 (Optional) */ + ElasticIpAddress string `json:"elasticIpAddress"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/DisassociateRouteTableSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/DisassociateRouteTableSpec.go new file mode 100644 index 000000000..86aad64ef --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/DisassociateRouteTableSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type DisassociateRouteTableSpec struct { + + /* 路由表要解绑的子网ID,解绑后子网绑定默认路由表 */ + SubnetId string `json:"subnetId"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ElasticIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ElasticIp.go new file mode 100644 index 000000000..11822a39d --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ElasticIp.go @@ -0,0 +1,55 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import charge "github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models" + +type ElasticIp struct { + + /* 弹性IP的Id (Optional) */ + ElasticIpId string `json:"elasticIpId"` + + /* 弹性IP地址 (Optional) */ + ElasticIpAddress string `json:"elasticIpAddress"` + + /* 弹性ip的限速(单位:Mbps) (Optional) */ + BandwidthMbps int `json:"bandwidthMbps"` + + /* IP服务商,取值为bgp或no_bgp (Optional) */ + Provider string `json:"provider"` + + /* 私有IP的IPV4地址 (Optional) */ + PrivateIpAddress string `json:"privateIpAddress"` + + /* 配置弹性网卡Id (Optional) */ + NetworkInterfaceId string `json:"networkInterfaceId"` + + /* 实例Id (Optional) */ + InstanceId string `json:"instanceId"` + + /* 实例类型 (Optional) */ + InstanceType string `json:"instanceType"` + + /* 计费配置 (Optional) */ + Charge charge.Charge `json:"charge"` + + /* 弹性ip创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` + + /* 弹性ip可用区属性,如果为空,表示全可用区 (Optional) */ + Az string `json:"az"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ElasticIpSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ElasticIpSpec.go new file mode 100644 index 000000000..bc641a734 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ElasticIpSpec.go @@ -0,0 +1,31 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + +import charge "github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models" + +type ElasticIpSpec struct { + + /* 弹性公网IP的限速(单位:Mbps),取值范围为[1-200] */ + BandwidthMbps int `json:"bandwidthMbps"` + + /* IP服务商,取值为bgp或no_bgp,cn-north-1:bgp;cn-south-1:[bgp,no_bgp];cn-east-1:[bgp,no_bgp];cn-east-2:bgp */ + Provider string `json:"provider"` + + /* 计费配置 (Optional) */ + ChargeSpec *charge.ChargeSpec `json:"chargeSpec"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyElasticIpSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyElasticIpSpec.go new file mode 100644 index 000000000..d4c8823f7 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyElasticIpSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyElasticIpSpec struct { + + /* 弹性公网IP的限速(单位:Mbps),取值范围为[1-200] */ + BandwidthMbps int `json:"bandwidthMbps"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclRuleSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclRuleSpec.go new file mode 100644 index 000000000..7e8a9aa32 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclRuleSpec.go @@ -0,0 +1,45 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyNetworkAclRuleSpec struct { + + /* networkAcl规则ID */ + RuleId string `json:"ruleId"` + + /* 规则限定协议。取值范围:All,TCP,UDP,ICMP (Optional) */ + Protocol *string `json:"protocol"` + + /* 规则限定起始传输层端口, 取值范围:1-65535, 若protocol为传输层协议,默认值为1,若protocol不是传输层协议,设置无效,恒为0。如果规则只限定一个端口号,fromPort和toPort填写同一个值 (Optional) */ + FromPort *int `json:"fromPort"` + + /* 规则限定终止传输层端口, 取值范围:1-65535, 若protocol为传输层协议,默认值为65535,若protocol不是传输层协议,设置无效,恒为0。如果规则只限定一个端口号,fromPort和toPort填写同一个值 (Optional) */ + ToPort *int `json:"toPort"` + + /* 匹配地址前缀 (Optional) */ + AddressPrefix *string `json:"addressPrefix"` + + /* 访问控制策略:allow:允许,deny:拒绝 (Optional) */ + RuleAction *string `json:"ruleAction"` + + /* 规则匹配优先级,取值范围为[1,32768],优先级数字越小优先级越高 (Optional) */ + Priority *int `json:"priority"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclRuleSpecs.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclRuleSpecs.go new file mode 100644 index 000000000..9864bdb22 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclRuleSpecs.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyNetworkAclRuleSpecs struct { + + /* networkAcl规则列表 */ + ModifyNetworkAclRuleSpecs []ModifyNetworkAclRuleSpec `json:"modifyNetworkAclRuleSpecs"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclRulesSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclRulesSpec.go new file mode 100644 index 000000000..13df02392 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclRulesSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyNetworkAclRulesSpec struct { + + /* networkAcl规则列表 */ + ModifyNetworkAclRuleSpecs []ModifyNetworkAclRuleSpec `json:"modifyNetworkAclRuleSpecs"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclSpec.go new file mode 100644 index 000000000..4c2170648 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkAclSpec.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyNetworkAclSpec struct { + + /* networkAcl名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符 (Optional) */ + NetworkAclName string `json:"networkAclName"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkInterfaceSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkInterfaceSpec.go new file mode 100644 index 000000000..292bfe914 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkInterfaceSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyNetworkInterfaceSpec struct { + + /* 弹性网卡名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符 (Optional) */ + NetworkInterfaceName string `json:"networkInterfaceName"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description string `json:"description"` + + /* 以覆盖原有安全组的方式更新的安全组。如果更新安全组ID列表,最多5个安全组 (Optional) */ + SecurityGroups []string `json:"securityGroups"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkSecurityGroupSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkSecurityGroupSpec.go new file mode 100644 index 000000000..335009736 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyNetworkSecurityGroupSpec.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyNetworkSecurityGroupSpec struct { + + /* 安全组的名字。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + NetworkSecurityGroupName string `json:"networkSecurityGroupName"` + + /* 安全组的描述,取值范围:0-256个UTF-8编码下的全部字符 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyQuotaSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyQuotaSpec.go new file mode 100644 index 000000000..ec25778c1 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyQuotaSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyQuotaSpec struct { + + /* 资源类型,取值范围:vpc、elastic_ip、subnet、security_group、vpcpeering、network_interface(配额只统计辅助网卡) */ + Type string `json:"type"` + + /* type为vpc、elastic_ip、network_interface不设置, type为subnet、security_group、vpcpeering设置为vpcId (Optional) */ + ParentResourceId string `json:"parentResourceId"` + + /* 配额大小 */ + MaxLimit int `json:"maxLimit"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyRouteTableRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyRouteTableRules.go new file mode 100644 index 000000000..8b79e5a38 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyRouteTableRules.go @@ -0,0 +1,36 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyRouteTableRules struct { + + /* 路由表规则的ID */ + RuleId string `json:"ruleId"` + + /* 规则匹配优先级,取值范围[1,255]。当路由规则子网掩码不同时,路由最长匹配优先;当路由规则子网掩码相同时, 按照优先级匹配转发, 优先级数字越小优先级越高,路由规则子网掩码相同、优先级相同、下一跳不同时,形成等价路由,不同下一跳负载均担。 (Optional) */ + Priority *int `json:"priority"` + + /* 下一跳类型, 取值范围:instance:云主机, internet:公网, vpc_peering:vpc对等连接, bgw:边界网关 (Optional) */ + NextHopType *string `json:"nextHopType"` + + /* 下一跳id (Optional) */ + NextHopId *string `json:"nextHopId"` + + /* 路由表规则前缀, internet类型路由跟其他类型的路由,addressPrefix不允许重复 (Optional) */ + AddressPrefix *string `json:"addressPrefix"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyRouteTableRulesSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyRouteTableRulesSpec.go new file mode 100644 index 000000000..d8894b0dc --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyRouteTableRulesSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyRouteTableRulesSpec struct { + + /* 路由表规则信息 */ + ModifyRouteTableRuleSpecs []ModifyRouteTableRules `json:"modifyRouteTableRuleSpecs"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyRouteTableSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyRouteTableSpec.go new file mode 100644 index 000000000..3a1c902dc --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyRouteTableSpec.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyRouteTableSpec struct { + + /* 路由表的名字。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + RouteTableName string `json:"routeTableName"` + + /* 路由表的描述,取值范围:0-256个UTF-8编码下的全部字符 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifySecurityGroupRuleSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifySecurityGroupRuleSpec.go new file mode 100644 index 000000000..f59fc26b5 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifySecurityGroupRuleSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifySecurityGroupRuleSpec struct { + + /* 安全组规则信息 */ + ModifySecurityGroupRuleSpecs []ModifySecurityGroupRules `json:"modifySecurityGroupRuleSpecs"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifySecurityGroupRules.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifySecurityGroupRules.go new file mode 100644 index 000000000..38d47fc7e --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifySecurityGroupRules.go @@ -0,0 +1,39 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifySecurityGroupRules struct { + + /* 安全组规则的ID。 */ + RuleId string `json:"ruleId"` + + /* 规则限定协议。300:All; 6:TCP; 17:UDP; 1:ICMP (Optional) */ + Protocol *int `json:"protocol"` + + /* 安全组规则的起始端口。取值范围:1-65535 (Optional) */ + FromPort *int `json:"fromPort"` + + /* 安全组规则的终端口。取值范围:1-65535 (Optional) */ + ToPort *int `json:"toPort"` + + /* 安全组规则前缀,取值范围:正确的CIDR (Optional) */ + AddressPrefix *string `json:"addressPrefix"` + + /* 安全组规则的描述,取值范围:0-256个UTF-8编码下的全部字符 (Optional) */ + Description *string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifySubnetSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifySubnetSpec.go new file mode 100644 index 000000000..aac57100f --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifySubnetSpec.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifySubnetSpec struct { + + /* 子网名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) */ + SubnetName string `json:"subnetName"` + + /* 子网描述信息,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyVpcPeeringSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyVpcPeeringSpec.go new file mode 100644 index 000000000..056f0f1f5 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyVpcPeeringSpec.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyVpcPeeringSpec struct { + + /* VpcPeering的名字,不为空。名称取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + VpcPeeringName string `json:"vpcPeeringName"` + + /* VpcPeering 描述,取值范围:0-256个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyVpcSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyVpcSpec.go new file mode 100644 index 000000000..9c4419843 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/ModifyVpcSpec.go @@ -0,0 +1,27 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type ModifyVpcSpec struct { + + /* 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) */ + VpcName string `json:"vpcName"` + + /* vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkAcl.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkAcl.go new file mode 100644 index 000000000..422ed1611 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkAcl.go @@ -0,0 +1,42 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type NetworkAcl struct { + + /* networkAcl ID (Optional) */ + NetworkAclId string `json:"networkAclId"` + + /* networkAcl名称 (Optional) */ + NetworkAclName string `json:"networkAclName"` + + /* 私有网络 ID (Optional) */ + VpcId string `json:"vpcId"` + + /* networkAcl规则列表 (Optional) */ + NetworkAclRules []NetworkAclRule `json:"networkAclRules"` + + /* networkAcl绑定的子网列表 (Optional) */ + SubnetIds []string `json:"subnetIds"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description string `json:"description"` + + /* networkAcl创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkAclRule.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkAclRule.go new file mode 100644 index 000000000..2cd5027b6 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkAclRule.go @@ -0,0 +1,51 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type NetworkAclRule struct { + + /* networkAcl规则ID (Optional) */ + RuleId string `json:"ruleId"` + + /* 规则限定协议。取值范围:All,TCP,UDP,ICMP (Optional) */ + Protocol string `json:"protocol"` + + /* 规则限定起始传输层端口, 取值范围:1-65535, 若protocol为传输层协议,默认值为1,若protocol不是传输层协议,设置无效,恒为0。如果规则只限定一个端口号,fromPort和toPort填写同一个值 (Optional) */ + FromPort int `json:"fromPort"` + + /* 规则限定终止传输层端口, 取值范围:1-65535, 若protocol为传输层协议,默认值为65535,若protocol不是传输层协议,设置无效,恒为0。如果规则只限定一个端口号,fromPort和toPort填写同一个值 (Optional) */ + ToPort int `json:"toPort"` + + /* networkAcl规则方向。ingress:入规则; egress:出规则 (Optional) */ + Direction string `json:"direction"` + + /* 匹配地址前缀 (Optional) */ + AddressPrefix string `json:"addressPrefix"` + + /* 访问控制策略:allow:允许,deny:拒绝 (Optional) */ + RuleAction string `json:"ruleAction"` + + /* 规则匹配优先级,取值范围为[1,32768],优先级数字越小优先级越高 (Optional) */ + Priority int `json:"priority"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description string `json:"description"` + + /* networkAclRule创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkAclSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkAclSpec.go new file mode 100644 index 000000000..9710fddec --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkAclSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type NetworkAclSpec struct { + + /* 私有网络id */ + VpcId string `json:"vpcId"` + + /* networkAcl名称 */ + NetworkAclName string `json:"networkAclName"` + + /* 描述,允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkInterface.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkInterface.go new file mode 100644 index 000000000..b9fc7244b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkInterface.go @@ -0,0 +1,72 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type NetworkInterface struct { + + /* 弹性网卡名称 (Optional) */ + NetworkInterfaceName string `json:"networkInterfaceName"` + + /* 弹性网卡ID (Optional) */ + NetworkInterfaceId string `json:"networkInterfaceId"` + + /* 可用区名称 (Optional) */ + Az string `json:"az"` + + /* 网卡角色,取值范围:Primary(主网卡)、Secondary(辅助网卡) (Optional) */ + Role string `json:"role"` + + /* 以太网地址 (Optional) */ + MacAddress string `json:"macAddress"` + + /* 虚拟网络ID (Optional) */ + VpcId string `json:"vpcId"` + + /* 子网ID (Optional) */ + SubnetId string `json:"subnetId"` + + /* 安全组ID列表 (Optional) */ + NetworkSecurityGroupIds []string `json:"networkSecurityGroupIds"` + + /* 源和目标IP地址校验,取值为0或者1 (Optional) */ + SanityCheck int `json:"sanityCheck"` + + /* 网卡主IP (Optional) */ + PrimaryIp NetworkInterfacePrivateIp `json:"primaryIp"` + + /* 网卡附属IP列表 (Optional) */ + SecondaryIps []NetworkInterfacePrivateIp `json:"secondaryIps"` + + /* 关联实例类型,取值范围:vm (Optional) */ + InstanceType string `json:"instanceType"` + + /* 关联实例ID (Optional) */ + InstanceId string `json:"instanceId"` + + /* 实例所属的账号 (Optional) */ + InstanceOwnerId string `json:"instanceOwnerId"` + + /* 网卡在实例上的设备索引号,取值范围:[0,8],0:辅助网卡未绑定设备,1:主网卡,2-8:辅助网卡已绑定设备 (Optional) */ + DeviceIndex int `json:"deviceIndex"` + + /* 网卡描述信息 (Optional) */ + Description string `json:"description"` + + /* 弹性网卡创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkInterfacePrivateIp.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkInterfacePrivateIp.go new file mode 100644 index 000000000..ba235e86a --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkInterfacePrivateIp.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type NetworkInterfacePrivateIp struct { + + /* 私有IP的IPV4地址 (Optional) */ + PrivateIpAddress string `json:"privateIpAddress"` + + /* 弹性IP实例ID (Optional) */ + ElasticIpId string `json:"elasticIpId"` + + /* 弹性IP实例地址 (Optional) */ + ElasticIpAddress string `json:"elasticIpAddress"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkInterfaceSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkInterfaceSpec.go new file mode 100644 index 000000000..75c2909e6 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkInterfaceSpec.go @@ -0,0 +1,48 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type NetworkInterfaceSpec struct { + + /* 子网ID */ + SubnetId string `json:"subnetId"` + + /* 可用区,用户的默认可用区 (Optional) */ + Az *string `json:"az"` + + /* 网卡名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) */ + NetworkInterfaceName *string `json:"networkInterfaceName"` + + /* 网卡主IP,如果不指定,会自动从子网中分配 (Optional) */ + PrimaryIpAddress *string `json:"primaryIpAddress"` + + /* SecondaryIp列表 (Optional) */ + SecondaryIpAddresses []string `json:"secondaryIpAddresses"` + + /* 自动分配的SecondaryIp数量 (Optional) */ + SecondaryIpCount *int `json:"secondaryIpCount"` + + /* 要绑定的安全组ID列表,最多指定5个安全组 (Optional) */ + SecurityGroups []string `json:"securityGroups"` + + /* 源和目标IP地址校验,取值为0或者1,默认为1 (Optional) */ + SanityCheck *int `json:"sanityCheck"` + + /* 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description *string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkSecurityGroup.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkSecurityGroup.go new file mode 100644 index 000000000..406631dfe --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkSecurityGroup.go @@ -0,0 +1,39 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type NetworkSecurityGroup struct { + + /* 安全组ID (Optional) */ + NetworkSecurityGroupId string `json:"networkSecurityGroupId"` + + /* 安全组名称 (Optional) */ + NetworkSecurityGroupName string `json:"networkSecurityGroupName"` + + /* 安全组描述信息 (Optional) */ + Description string `json:"description"` + + /* 安全组所在vpc的Id (Optional) */ + VpcId string `json:"vpcId"` + + /* 安全组规则信息 (Optional) */ + SecurityGroupRules []SecurityGroupRule `json:"securityGroupRules"` + + /* 安全组创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkSecurityGroupSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkSecurityGroupSpec.go new file mode 100644 index 000000000..b38e540b4 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/NetworkSecurityGroupSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type NetworkSecurityGroupSpec struct { + + /* 私有网络ID */ + VpcId string `json:"vpcId"` + + /* 安全组名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 */ + NetworkSecurityGroupName string `json:"networkSecurityGroupName"` + + /* 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Quota.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Quota.go new file mode 100644 index 000000000..cb0f4081f --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Quota.go @@ -0,0 +1,33 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Quota struct { + + /* 资源类型,取值范围:vpc、elastic_ip、subnet、security_group、vpcpeering、network_interface(配额只统计辅助网卡) (Optional) */ + Type string `json:"type"` + + /* vpc、elastic_ip、network_interface为空, subnet、security_group、vpcpeering为vpcId (Optional) */ + ParentResourceId string `json:"parentResourceId"` + + /* 配额大小 (Optional) */ + MaxLimit int `json:"maxLimit"` + + /* 已存在的资源数量 (Optional) */ + Count int `json:"count"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/RouteTable.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/RouteTable.go new file mode 100644 index 000000000..b7bf11e18 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/RouteTable.go @@ -0,0 +1,45 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type RouteTable struct { + + /* 路由表ID (Optional) */ + RouteTableId string `json:"routeTableId"` + + /* 路由表名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) */ + RouteTableName string `json:"routeTableName"` + + /* 路由表类型,default:默认路由表,custom:自定义路由表 (Optional) */ + RouteTableType string `json:"routeTableType"` + + /* 路由表描述信息,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description string `json:"description"` + + /* 私有网络ID (Optional) */ + VpcId string `json:"vpcId"` + + /* 路由表规则信息 (Optional) */ + RouteTableRules []RouteTableRule `json:"routeTableRules"` + + /* 路由表绑定的子网列表 (Optional) */ + SubnetIds []string `json:"subnetIds"` + + /* 路由表创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/RouteTableRule.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/RouteTableRule.go new file mode 100644 index 000000000..049d9b766 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/RouteTableRule.go @@ -0,0 +1,36 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type RouteTableRule struct { + + /* 路由表规则ID (Optional) */ + RuleId string `json:"ruleId"` + + /* 规则匹配优先级,取值范围[1,255],默认为100。当路由规则子网掩码不同时,路由最长匹配优先;当路由规则子网掩码相同时, 按照优先级匹配转发, 优先级数字越小优先级越高,路由规则子网掩码相同、优先级相同、下一跳不同时,形成等价路由,不同下一跳负载均担。 (Optional) */ + Priority int `json:"priority"` + + /* 下一跳类型, 取值范围:local:本地, instance:云主机, internet:公网, vpc_peering:vpc对等连接, bgw:边界网关 (Optional) */ + NextHopType string `json:"nextHopType"` + + /* 下一跳id (Optional) */ + NextHopId string `json:"nextHopId"` + + /* 匹配地址前缀, internet类型路由跟其他类型的路由,addressPrefix不允许重复 (Optional) */ + AddressPrefix string `json:"addressPrefix"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/RouteTableSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/RouteTableSpec.go new file mode 100644 index 000000000..c91f16c6c --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/RouteTableSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type RouteTableSpec struct { + + /* 路由表所属的私有网络ID */ + VpcId string `json:"vpcId"` + + /* 路由表名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 */ + RouteTableName string `json:"routeTableName"` + + /* 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/SecurityGroupRule.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/SecurityGroupRule.go new file mode 100644 index 000000000..74ba05afd --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/SecurityGroupRule.go @@ -0,0 +1,48 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type SecurityGroupRule struct { + + /* 安全组规则ID (Optional) */ + RuleId string `json:"ruleId"` + + /* 安全组规则方向。0:入规则; 1:出规则 (Optional) */ + Direction int `json:"direction"` + + /* 规则限定协议。300:All; 6:TCP; 17:UDP; 1:ICMP (Optional) */ + Protocol int `json:"protocol"` + + /* 匹配地址前缀 (Optional) */ + AddressPrefix string `json:"addressPrefix"` + + /* 匹配地址协议版本。4:IPv4 (Optional) */ + IpVersion int `json:"ipVersion"` + + /* 规则限定起始传输层端口, 默认1 ,若protocal不是传输层协议,恒为0 (Optional) */ + FromPort int `json:"fromPort"` + + /* 规则限定终止传输层端口, 默认1 ,若protocal不是传输层协议,恒为0 (Optional) */ + ToPort int `json:"toPort"` + + /* 安全组规则创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` + + /* 描述,​ 允许输入UTF-8编码下的全部字符,不超过256字符 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Segment.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Segment.go new file mode 100644 index 000000000..875486ad1 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Segment.go @@ -0,0 +1,45 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Segment struct { + + /* 网段的Id (Optional) */ + SegmentId string `json:"segmentId"` + + /* 网段名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Optional) */ + SegmentName string `json:"segmentName"` + + /* 网段描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description string `json:"description"` + + /* 网络地址段 (Optional) */ + AddressPrefix string `json:"addressPrefix"` + + /* 网段可用ip数量 (Optional) */ + AvailableIpCount int `json:"availableIpCount"` + + /* IP服务商,取值为bgp或no_bgp,cn-north-1:bgp;cn-south-1:[bgp,no_bgp];cn-east-1:[bgp,no_bgp];cn-east-2:bgp (Optional) */ + Provider string `json:"provider"` + + /* 网段的起始地址 (Optional) */ + StartIp string `json:"startIp"` + + /* 网段的结束地址 (Optional) */ + EndIp string `json:"endIp"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Subnet.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Subnet.go new file mode 100644 index 000000000..9bd241dae --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Subnet.go @@ -0,0 +1,54 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Subnet struct { + + /* Subnet的Id (Optional) */ + SubnetId string `json:"subnetId"` + + /* 子网名称 (Optional) */ + SubnetName string `json:"subnetName"` + + /* 子网所属VPC的Id (Optional) */ + VpcId string `json:"vpcId"` + + /* 子网网段,vpc内子网网段不能重叠,cidr的取值范围:10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间,如果VPC含有Cidr,则必须为VPC所在Cidr的子网 (Optional) */ + AddressPrefix string `json:"addressPrefix"` + + /* 子网可用ip数量 (Optional) */ + AvailableIpCount int `json:"availableIpCount"` + + /* 子网描述信息 (Optional) */ + Description string `json:"description"` + + /* 子网关联的路由表Id (Optional) */ + RouteTableId string `json:"routeTableId"` + + /* 子网关联的acl Id (Optional) */ + AclId string `json:"aclId"` + + /* 子网的起始地址,子网第1个地位为路由器网关保留,第2个地址为dhcp服务保留 (Optional) */ + StartIp string `json:"startIp"` + + /* 子网的结束地址,子网第1个地位为路由器网关保留,第2个地址为dhcp服务保留 (Optional) */ + EndIp string `json:"endIp"` + + /* 子网创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/SubnetSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/SubnetSpec.go new file mode 100644 index 000000000..611a18910 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/SubnetSpec.go @@ -0,0 +1,36 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type SubnetSpec struct { + + /* 子网所属vpc的Id */ + VpcId string `json:"vpcId"` + + /* 子网名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 */ + SubnetName string `json:"subnetName"` + + /* 子网网段,vpc内子网网段不能重叠,cidr的取值范围:10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间,如果vpc含有cidr,则必须为vpc所在cidr的子网 */ + AddressPrefix string `json:"addressPrefix"` + + /* 子网关联的路由表Id, 默认为vpc的默认路由表 (Optional) */ + RouteTableId string `json:"routeTableId"` + + /* 子网描述信息,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/UnassignSecondaryIpsSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/UnassignSecondaryIpsSpec.go new file mode 100644 index 000000000..ba3a12e19 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/UnassignSecondaryIpsSpec.go @@ -0,0 +1,24 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type UnassignSecondaryIpsSpec struct { + + /* 指定删除的secondaryIp地址 (Optional) */ + SecondaryIps []string `json:"secondaryIps"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Vpc.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Vpc.go new file mode 100644 index 000000000..896b3341b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/Vpc.go @@ -0,0 +1,45 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type Vpc struct { + + /* Vpc的Id (Optional) */ + VpcId string `json:"vpcId"` + + /* 如果为空,则不限制网段,如果不为空,10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间 (Optional) */ + AddressPrefix string `json:"addressPrefix"` + + /* VPC 描述,取值范围:1~120个字符 (Optional) */ + Description string `json:"description"` + + /* 私有网络名称,取值范围:1-60个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + VpcName string `json:"vpcName"` + + /* 同一vpc下的acl id 列表 (Optional) */ + AclIds []string `json:"aclIds"` + + /* (Optional) */ + RouteTableIds []string `json:"routeTableIds"` + + /* 私有网络包含的子网列表 (Optional) */ + Subnets []Subnet `json:"subnets"` + + /* vpc创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/VpcPeering.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/VpcPeering.go new file mode 100644 index 000000000..e6245b759 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/VpcPeering.go @@ -0,0 +1,42 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type VpcPeering struct { + + /* VpcPeering的Id (Optional) */ + VpcPeeringId string `json:"vpcPeeringId"` + + /* VpcPeering名称,同账号下不允许重名,取值范围:1-32个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + VpcPeeringName string `json:"vpcPeeringName"` + + /* 状态,取值为Connected,Disconnected,Initiated (Optional) */ + VpcPeeringState string `json:"vpcPeeringState"` + + /* VpcPeering 描述,可为空值,取值范围:0-256个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + Description string `json:"description"` + + /* 发起VpcPeering的Vpc信息 (Optional) */ + VpcInfo VpcPeeringVpcInfo `json:"vpcInfo"` + + /* 对端的Vpc信息 (Optional) */ + RemoteVpcInfo VpcPeeringVpcInfo `json:"remoteVpcInfo"` + + /* VpcPeering创建时间 (Optional) */ + CreatedTime string `json:"createdTime"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/VpcPeeringVpcInfo.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/VpcPeeringVpcInfo.go new file mode 100644 index 000000000..4581b43e9 --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/VpcPeeringVpcInfo.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type VpcPeeringVpcInfo struct { + + /* 子网所属VPC的Id (Optional) */ + VpcId string `json:"vpcId"` + + /* 私有网络名称,取值范围:1-60个中文、英文大小写的字母、数字和下划线分隔符 (Optional) */ + VpcName string `json:"vpcName"` + + /* 如果为空,则不限制网段,如果不为空,10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间 (Optional) */ + AddressPrefix []string `json:"addressPrefix"` +} diff --git a/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/VpcSpec.go b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/VpcSpec.go new file mode 100644 index 000000000..f9f4f9e1b --- /dev/null +++ b/vendor/github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models/VpcSpec.go @@ -0,0 +1,30 @@ +// Copyright 2018 JDCLOUD.COM +// +// 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. +// +// NOTE: This class is auto generated by the jdcloud code generator program. + +package models + + +type VpcSpec struct { + + /* 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 */ + VpcName string `json:"vpcName"` + + /* 如果为空,则不限制网段,如果不为空,10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间 (Optional) */ + AddressPrefix string `json:"addressPrefix"` + + /* vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */ + Description string `json:"description"` +} diff --git a/vendor/github.com/outscale/osc-go/oapi/client.go b/vendor/github.com/outscale/osc-go/oapi/client.go new file mode 100644 index 000000000..8a2bfc560 --- /dev/null +++ b/vendor/github.com/outscale/osc-go/oapi/client.go @@ -0,0 +1,10477 @@ +// GENERATED FILE: DO NOT EDIT! + +package oapi + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "log" + "net/http" + "net/url" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/outscale/osc-go/utils" +) + +type Client struct { + service string + + signer *v4.Signer + + client *http.Client + + config *Config +} + +type Config struct { + AccessKey string + SecretKey string + Region string + URL string + + //Only Used for OAPI + Service string + + // User agent for client + UserAgent string +} + +func (c Config) ServiceURL() string { + s := fmt.Sprintf("https://%s.%s.%s", c.Service, c.Region, c.URL) + + u, err := url.Parse(s) + if err != nil { + panic(err) + } + + return u.String() +} + +// NewClient creates an API client. +func NewClient(config *Config, c *http.Client) *Client { + client := &Client{} + client.service = config.ServiceURL() + if c != nil { + client.client = c + } else { + client.client = http.DefaultClient + } + + s := &v4.Signer{ + Credentials: credentials.NewStaticCredentials(config.AccessKey, + config.SecretKey, ""), + } + + client.signer = s + client.config = config + + return client +} + +func (c *Client) GetConfig() *Config { + return c.config +} + +// Sign ... +func (c *Client) Sign(req *http.Request, body []byte) error { + reader := strings.NewReader(string(body)) + timestamp := time.Now() + _, err := c.signer.Sign(req, reader, "oapi", c.config.Region, timestamp) + utils.DebugRequest(req) + return err + +} + +// Do ... +func (c *Client) Do(req *http.Request) (*http.Response, error) { + resp, err := c.client.Do(req) + if err != nil { + log.Printf("[DEBUG] Error in Do Request %s", err) + } + + if resp != nil { + utils.DebugResponse(resp) + } else { + log.Println("[DEBUG] No response to show.") + } + + return resp, err +} + +// +func (client *Client) POST_AcceptNetPeering( + acceptnetpeeringrequest AcceptNetPeeringRequest, +) ( + response *POST_AcceptNetPeeringResponses, + err error, +) { + path := client.service + "/AcceptNetPeering" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(acceptnetpeeringrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_AcceptNetPeeringResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &AcceptNetPeeringResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 409: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code409 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_AuthenticateAccount( + authenticateaccountrequest AuthenticateAccountRequest, +) ( + response *POST_AuthenticateAccountResponses, + err error, +) { + path := client.service + "/AuthenticateAccount" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(authenticateaccountrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_AuthenticateAccountResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &AuthenticateAccountResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CheckSignature( + checksignaturerequest CheckSignatureRequest, +) ( + response *POST_CheckSignatureResponses, + err error, +) { + path := client.service + "/CheckSignature" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(checksignaturerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CheckSignatureResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CheckSignatureResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CopyAccount( + copyaccountrequest CopyAccountRequest, +) ( + response *POST_CopyAccountResponses, + err error, +) { + path := client.service + "/CopyAccount" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(copyaccountrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CopyAccountResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CopyAccountResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateAccount( + createaccountrequest CreateAccountRequest, +) ( + response *POST_CreateAccountResponses, + err error, +) { + path := client.service + "/CreateAccount" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createaccountrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateAccountResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateAccountResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateApiKey( + createapikeyrequest CreateApiKeyRequest, +) ( + response *POST_CreateApiKeyResponses, + err error, +) { + path := client.service + "/CreateApiKey" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createapikeyrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateApiKeyResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateApiKeyResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateClientGateway( + createclientgatewayrequest CreateClientGatewayRequest, +) ( + response *POST_CreateClientGatewayResponses, + err error, +) { + path := client.service + "/CreateClientGateway" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createclientgatewayrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateClientGatewayResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateClientGatewayResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateDhcpOptions( + createdhcpoptionsrequest CreateDhcpOptionsRequest, +) ( + response *POST_CreateDhcpOptionsResponses, + err error, +) { + path := client.service + "/CreateDhcpOptions" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createdhcpoptionsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateDhcpOptionsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateDhcpOptionsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateDirectLink( + createdirectlinkrequest CreateDirectLinkRequest, +) ( + response *POST_CreateDirectLinkResponses, + err error, +) { + path := client.service + "/CreateDirectLink" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createdirectlinkrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateDirectLinkResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateDirectLinkResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateDirectLinkInterface( + createdirectlinkinterfacerequest CreateDirectLinkInterfaceRequest, +) ( + response *POST_CreateDirectLinkInterfaceResponses, + err error, +) { + path := client.service + "/CreateDirectLinkInterface" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createdirectlinkinterfacerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateDirectLinkInterfaceResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateDirectLinkInterfaceResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateImage( + createimagerequest CreateImageRequest, +) ( + response *POST_CreateImageResponses, + err error, +) { + path := client.service + "/CreateImage" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createimagerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateImageResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateImageResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateImageExportTask( + createimageexporttaskrequest CreateImageExportTaskRequest, +) ( + response *POST_CreateImageExportTaskResponses, + err error, +) { + path := client.service + "/CreateImageExportTask" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createimageexporttaskrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateImageExportTaskResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateImageExportTaskResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateInternetService( + createinternetservicerequest CreateInternetServiceRequest, +) ( + response *POST_CreateInternetServiceResponses, + err error, +) { + path := client.service + "/CreateInternetService" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createinternetservicerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateInternetServiceResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateInternetServiceResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateKeypair( + createkeypairrequest CreateKeypairRequest, +) ( + response *POST_CreateKeypairResponses, + err error, +) { + path := client.service + "/CreateKeypair" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createkeypairrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateKeypairResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateKeypairResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 409: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code409 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateListenerRule( + createlistenerrulerequest CreateListenerRuleRequest, +) ( + response *POST_CreateListenerRuleResponses, + err error, +) { + path := client.service + "/CreateListenerRule" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createlistenerrulerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateListenerRuleResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateListenerRuleResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateLoadBalancer( + createloadbalancerrequest CreateLoadBalancerRequest, +) ( + response *POST_CreateLoadBalancerResponses, + err error, +) { + path := client.service + "/CreateLoadBalancer" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createloadbalancerrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateLoadBalancerResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateLoadBalancerResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateLoadBalancerListeners( + createloadbalancerlistenersrequest CreateLoadBalancerListenersRequest, +) ( + response *POST_CreateLoadBalancerListenersResponses, + err error, +) { + path := client.service + "/CreateLoadBalancerListeners" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createloadbalancerlistenersrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateLoadBalancerListenersResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateLoadBalancerListenersResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateLoadBalancerPolicy( + createloadbalancerpolicyrequest CreateLoadBalancerPolicyRequest, +) ( + response *POST_CreateLoadBalancerPolicyResponses, + err error, +) { + path := client.service + "/CreateLoadBalancerPolicy" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createloadbalancerpolicyrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateLoadBalancerPolicyResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateLoadBalancerPolicyResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateNatService( + createnatservicerequest CreateNatServiceRequest, +) ( + response *POST_CreateNatServiceResponses, + err error, +) { + path := client.service + "/CreateNatService" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createnatservicerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateNatServiceResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateNatServiceResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateNet( + createnetrequest CreateNetRequest, +) ( + response *POST_CreateNetResponses, + err error, +) { + path := client.service + "/CreateNet" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createnetrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateNetResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateNetResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 409: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code409 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateNetAccessPoint( + createnetaccesspointrequest CreateNetAccessPointRequest, +) ( + response *POST_CreateNetAccessPointResponses, + err error, +) { + path := client.service + "/CreateNetAccessPoint" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createnetaccesspointrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateNetAccessPointResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateNetAccessPointResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateNetPeering( + createnetpeeringrequest CreateNetPeeringRequest, +) ( + response *POST_CreateNetPeeringResponses, + err error, +) { + path := client.service + "/CreateNetPeering" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createnetpeeringrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateNetPeeringResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateNetPeeringResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateNic( + createnicrequest CreateNicRequest, +) ( + response *POST_CreateNicResponses, + err error, +) { + path := client.service + "/CreateNic" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createnicrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateNicResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateNicResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreatePolicy( + createpolicyrequest CreatePolicyRequest, +) ( + response *POST_CreatePolicyResponses, + err error, +) { + path := client.service + "/CreatePolicy" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createpolicyrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreatePolicyResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreatePolicyResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreatePublicIp( + createpubliciprequest CreatePublicIpRequest, +) ( + response *POST_CreatePublicIpResponses, + err error, +) { + path := client.service + "/CreatePublicIp" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createpubliciprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreatePublicIpResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreatePublicIpResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateRoute( + createrouterequest CreateRouteRequest, +) ( + response *POST_CreateRouteResponses, + err error, +) { + path := client.service + "/CreateRoute" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createrouterequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateRouteResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateRouteResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateRouteTable( + createroutetablerequest CreateRouteTableRequest, +) ( + response *POST_CreateRouteTableResponses, + err error, +) { + path := client.service + "/CreateRouteTable" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createroutetablerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateRouteTableResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateRouteTableResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateSecurityGroup( + createsecuritygrouprequest CreateSecurityGroupRequest, +) ( + response *POST_CreateSecurityGroupResponses, + err error, +) { + path := client.service + "/CreateSecurityGroup" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createsecuritygrouprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateSecurityGroupResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateSecurityGroupResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateSecurityGroupRule( + createsecuritygrouprulerequest CreateSecurityGroupRuleRequest, +) ( + response *POST_CreateSecurityGroupRuleResponses, + err error, +) { + path := client.service + "/CreateSecurityGroupRule" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createsecuritygrouprulerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateSecurityGroupRuleResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateSecurityGroupRuleResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateServerCertificate( + createservercertificaterequest CreateServerCertificateRequest, +) ( + response *POST_CreateServerCertificateResponses, + err error, +) { + path := client.service + "/CreateServerCertificate" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createservercertificaterequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateServerCertificateResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateServerCertificateResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateSnapshot( + createsnapshotrequest CreateSnapshotRequest, +) ( + response *POST_CreateSnapshotResponses, + err error, +) { + path := client.service + "/CreateSnapshot" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createsnapshotrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateSnapshotResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateSnapshotResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateSnapshotExportTask( + createsnapshotexporttaskrequest CreateSnapshotExportTaskRequest, +) ( + response *POST_CreateSnapshotExportTaskResponses, + err error, +) { + path := client.service + "/CreateSnapshotExportTask" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createsnapshotexporttaskrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateSnapshotExportTaskResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateSnapshotExportTaskResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateSubnet( + createsubnetrequest CreateSubnetRequest, +) ( + response *POST_CreateSubnetResponses, + err error, +) { + path := client.service + "/CreateSubnet" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createsubnetrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateSubnetResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateSubnetResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 409: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code409 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateTags( + createtagsrequest CreateTagsRequest, +) ( + response *POST_CreateTagsResponses, + err error, +) { + path := client.service + "/CreateTags" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createtagsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateTagsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateTagsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateUser( + createuserrequest CreateUserRequest, +) ( + response *POST_CreateUserResponses, + err error, +) { + path := client.service + "/CreateUser" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createuserrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateUserResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateUserResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateUserGroup( + createusergrouprequest CreateUserGroupRequest, +) ( + response *POST_CreateUserGroupResponses, + err error, +) { + path := client.service + "/CreateUserGroup" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createusergrouprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateUserGroupResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateUserGroupResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateVirtualGateway( + createvirtualgatewayrequest CreateVirtualGatewayRequest, +) ( + response *POST_CreateVirtualGatewayResponses, + err error, +) { + path := client.service + "/CreateVirtualGateway" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createvirtualgatewayrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateVirtualGatewayResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateVirtualGatewayResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateVms( + createvmsrequest CreateVmsRequest, +) ( + response *POST_CreateVmsResponses, + err error, +) { + path := client.service + "/CreateVms" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createvmsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateVmsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateVmsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateVolume( + createvolumerequest CreateVolumeRequest, +) ( + response *POST_CreateVolumeResponses, + err error, +) { + path := client.service + "/CreateVolume" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createvolumerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateVolumeResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateVolumeResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + return nil, checkErrorResponse(resp) + } + return +} + +// +func (client *Client) POST_CreateVpnConnection( + createvpnconnectionrequest CreateVpnConnectionRequest, +) ( + response *POST_CreateVpnConnectionResponses, + err error, +) { + path := client.service + "/CreateVpnConnection" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createvpnconnectionrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateVpnConnectionResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateVpnConnectionResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_CreateVpnConnectionRoute( + createvpnconnectionrouterequest CreateVpnConnectionRouteRequest, +) ( + response *POST_CreateVpnConnectionRouteResponses, + err error, +) { + path := client.service + "/CreateVpnConnectionRoute" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(createvpnconnectionrouterequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_CreateVpnConnectionRouteResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &CreateVpnConnectionRouteResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteApiKey( + deleteapikeyrequest DeleteApiKeyRequest, +) ( + response *POST_DeleteApiKeyResponses, + err error, +) { + path := client.service + "/DeleteApiKey" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteapikeyrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteApiKeyResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteApiKeyResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteClientGateway( + deleteclientgatewayrequest DeleteClientGatewayRequest, +) ( + response *POST_DeleteClientGatewayResponses, + err error, +) { + path := client.service + "/DeleteClientGateway" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteclientgatewayrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteClientGatewayResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteClientGatewayResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteDhcpOptions( + deletedhcpoptionsrequest DeleteDhcpOptionsRequest, +) ( + response *POST_DeleteDhcpOptionsResponses, + err error, +) { + path := client.service + "/DeleteDhcpOptions" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletedhcpoptionsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteDhcpOptionsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteDhcpOptionsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteDirectLink( + deletedirectlinkrequest DeleteDirectLinkRequest, +) ( + response *POST_DeleteDirectLinkResponses, + err error, +) { + path := client.service + "/DeleteDirectLink" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletedirectlinkrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteDirectLinkResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteDirectLinkResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteDirectLinkInterface( + deletedirectlinkinterfacerequest DeleteDirectLinkInterfaceRequest, +) ( + response *POST_DeleteDirectLinkInterfaceResponses, + err error, +) { + path := client.service + "/DeleteDirectLinkInterface" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletedirectlinkinterfacerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteDirectLinkInterfaceResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteDirectLinkInterfaceResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteExportTask( + deleteexporttaskrequest DeleteExportTaskRequest, +) ( + response *POST_DeleteExportTaskResponses, + err error, +) { + path := client.service + "/DeleteExportTask" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteexporttaskrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteExportTaskResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteExportTaskResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteImage( + deleteimagerequest DeleteImageRequest, +) ( + response *POST_DeleteImageResponses, + err error, +) { + path := client.service + "/DeleteImage" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteimagerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteImageResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteImageResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteInternetService( + deleteinternetservicerequest DeleteInternetServiceRequest, +) ( + response *POST_DeleteInternetServiceResponses, + err error, +) { + path := client.service + "/DeleteInternetService" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteinternetservicerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteInternetServiceResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteInternetServiceResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteKeypair( + deletekeypairrequest DeleteKeypairRequest, +) ( + response *POST_DeleteKeypairResponses, + err error, +) { + path := client.service + "/DeleteKeypair" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletekeypairrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteKeypairResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteKeypairResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteListenerRule( + deletelistenerrulerequest DeleteListenerRuleRequest, +) ( + response *POST_DeleteListenerRuleResponses, + err error, +) { + path := client.service + "/DeleteListenerRule" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletelistenerrulerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteListenerRuleResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteListenerRuleResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteLoadBalancer( + deleteloadbalancerrequest DeleteLoadBalancerRequest, +) ( + response *POST_DeleteLoadBalancerResponses, + err error, +) { + path := client.service + "/DeleteLoadBalancer" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteloadbalancerrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteLoadBalancerResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteLoadBalancerResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteLoadBalancerListeners( + deleteloadbalancerlistenersrequest DeleteLoadBalancerListenersRequest, +) ( + response *POST_DeleteLoadBalancerListenersResponses, + err error, +) { + path := client.service + "/DeleteLoadBalancerListeners" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteloadbalancerlistenersrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteLoadBalancerListenersResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteLoadBalancerListenersResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteLoadBalancerPolicy( + deleteloadbalancerpolicyrequest DeleteLoadBalancerPolicyRequest, +) ( + response *POST_DeleteLoadBalancerPolicyResponses, + err error, +) { + path := client.service + "/DeleteLoadBalancerPolicy" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteloadbalancerpolicyrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteLoadBalancerPolicyResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteLoadBalancerPolicyResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteNatService( + deletenatservicerequest DeleteNatServiceRequest, +) ( + response *POST_DeleteNatServiceResponses, + err error, +) { + path := client.service + "/DeleteNatService" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletenatservicerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteNatServiceResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteNatServiceResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteNet( + deletenetrequest DeleteNetRequest, +) ( + response *POST_DeleteNetResponses, + err error, +) { + path := client.service + "/DeleteNet" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletenetrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteNetResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteNetResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteNetAccessPoints( + deletenetaccesspointsrequest DeleteNetAccessPointsRequest, +) ( + response *POST_DeleteNetAccessPointsResponses, + err error, +) { + path := client.service + "/DeleteNetAccessPoints" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletenetaccesspointsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteNetAccessPointsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteNetAccessPointsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteNetPeering( + deletenetpeeringrequest DeleteNetPeeringRequest, +) ( + response *POST_DeleteNetPeeringResponses, + err error, +) { + path := client.service + "/DeleteNetPeering" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletenetpeeringrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteNetPeeringResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteNetPeeringResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 409: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code409 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteNic( + deletenicrequest DeleteNicRequest, +) ( + response *POST_DeleteNicResponses, + err error, +) { + path := client.service + "/DeleteNic" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletenicrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteNicResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteNicResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeletePolicy( + deletepolicyrequest DeletePolicyRequest, +) ( + response *POST_DeletePolicyResponses, + err error, +) { + path := client.service + "/DeletePolicy" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletepolicyrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeletePolicyResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeletePolicyResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeletePublicIp( + deletepubliciprequest DeletePublicIpRequest, +) ( + response *POST_DeletePublicIpResponses, + err error, +) { + path := client.service + "/DeletePublicIp" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletepubliciprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeletePublicIpResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeletePublicIpResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteRoute( + deleterouterequest DeleteRouteRequest, +) ( + response *POST_DeleteRouteResponses, + err error, +) { + path := client.service + "/DeleteRoute" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleterouterequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteRouteResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteRouteResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteRouteTable( + deleteroutetablerequest DeleteRouteTableRequest, +) ( + response *POST_DeleteRouteTableResponses, + err error, +) { + path := client.service + "/DeleteRouteTable" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteroutetablerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteRouteTableResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteRouteTableResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteSecurityGroup( + deletesecuritygrouprequest DeleteSecurityGroupRequest, +) ( + response *POST_DeleteSecurityGroupResponses, + err error, +) { + path := client.service + "/DeleteSecurityGroup" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletesecuritygrouprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteSecurityGroupResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteSecurityGroupResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteSecurityGroupRule( + deletesecuritygrouprulerequest DeleteSecurityGroupRuleRequest, +) ( + response *POST_DeleteSecurityGroupRuleResponses, + err error, +) { + path := client.service + "/DeleteSecurityGroupRule" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletesecuritygrouprulerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteSecurityGroupRuleResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteSecurityGroupRuleResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteServerCertificate( + deleteservercertificaterequest DeleteServerCertificateRequest, +) ( + response *POST_DeleteServerCertificateResponses, + err error, +) { + path := client.service + "/DeleteServerCertificate" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteservercertificaterequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteServerCertificateResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteServerCertificateResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteSnapshot( + deletesnapshotrequest DeleteSnapshotRequest, +) ( + response *POST_DeleteSnapshotResponses, + err error, +) { + path := client.service + "/DeleteSnapshot" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletesnapshotrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteSnapshotResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteSnapshotResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteSubnet( + deletesubnetrequest DeleteSubnetRequest, +) ( + response *POST_DeleteSubnetResponses, + err error, +) { + path := client.service + "/DeleteSubnet" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletesubnetrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteSubnetResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteSubnetResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteTags( + deletetagsrequest DeleteTagsRequest, +) ( + response *POST_DeleteTagsResponses, + err error, +) { + path := client.service + "/DeleteTags" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletetagsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteTagsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteTagsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteUser( + deleteuserrequest DeleteUserRequest, +) ( + response *POST_DeleteUserResponses, + err error, +) { + path := client.service + "/DeleteUser" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteuserrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteUserResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteUserResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteUserGroup( + deleteusergrouprequest DeleteUserGroupRequest, +) ( + response *POST_DeleteUserGroupResponses, + err error, +) { + path := client.service + "/DeleteUserGroup" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deleteusergrouprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteUserGroupResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteUserGroupResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteVirtualGateway( + deletevirtualgatewayrequest DeleteVirtualGatewayRequest, +) ( + response *POST_DeleteVirtualGatewayResponses, + err error, +) { + path := client.service + "/DeleteVirtualGateway" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletevirtualgatewayrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteVirtualGatewayResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteVirtualGatewayResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteVms( + deletevmsrequest DeleteVmsRequest, +) ( + response *POST_DeleteVmsResponses, + err error, +) { + path := client.service + "/DeleteVms" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletevmsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteVmsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteVmsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteVolume( + deletevolumerequest DeleteVolumeRequest, +) ( + response *POST_DeleteVolumeResponses, + err error, +) { + path := client.service + "/DeleteVolume" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletevolumerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteVolumeResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteVolumeResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteVpnConnection( + deletevpnconnectionrequest DeleteVpnConnectionRequest, +) ( + response *POST_DeleteVpnConnectionResponses, + err error, +) { + path := client.service + "/DeleteVpnConnection" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletevpnconnectionrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteVpnConnectionResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteVpnConnectionResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeleteVpnConnectionRoute( + deletevpnconnectionrouterequest DeleteVpnConnectionRouteRequest, +) ( + response *POST_DeleteVpnConnectionRouteResponses, + err error, +) { + path := client.service + "/DeleteVpnConnectionRoute" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deletevpnconnectionrouterequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeleteVpnConnectionRouteResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeleteVpnConnectionRouteResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeregisterUserInUserGroup( + deregisteruserinusergrouprequest DeregisterUserInUserGroupRequest, +) ( + response *POST_DeregisterUserInUserGroupResponses, + err error, +) { + path := client.service + "/DeregisterUserInUserGroup" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deregisteruserinusergrouprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeregisterUserInUserGroupResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeregisterUserInUserGroupResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_DeregisterVmsInLoadBalancer( + deregistervmsinloadbalancerrequest DeregisterVmsInLoadBalancerRequest, +) ( + response *POST_DeregisterVmsInLoadBalancerResponses, + err error, +) { + path := client.service + "/DeregisterVmsInLoadBalancer" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(deregistervmsinloadbalancerrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_DeregisterVmsInLoadBalancerResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &DeregisterVmsInLoadBalancerResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_LinkInternetService( + linkinternetservicerequest LinkInternetServiceRequest, +) ( + response *POST_LinkInternetServiceResponses, + err error, +) { + path := client.service + "/LinkInternetService" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(linkinternetservicerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_LinkInternetServiceResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &LinkInternetServiceResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_LinkNic( + linknicrequest LinkNicRequest, +) ( + response *POST_LinkNicResponses, + err error, +) { + path := client.service + "/LinkNic" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(linknicrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_LinkNicResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &LinkNicResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_LinkPolicy( + linkpolicyrequest LinkPolicyRequest, +) ( + response *POST_LinkPolicyResponses, + err error, +) { + path := client.service + "/LinkPolicy" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(linkpolicyrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_LinkPolicyResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &LinkPolicyResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_LinkPrivateIps( + linkprivateipsrequest LinkPrivateIpsRequest, +) ( + response *POST_LinkPrivateIpsResponses, + err error, +) { + path := client.service + "/LinkPrivateIps" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(linkprivateipsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_LinkPrivateIpsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &LinkPrivateIpsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_LinkPublicIp( + linkpubliciprequest LinkPublicIpRequest, +) ( + response *POST_LinkPublicIpResponses, + err error, +) { + path := client.service + "/LinkPublicIp" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(linkpubliciprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_LinkPublicIpResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &LinkPublicIpResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_LinkRouteTable( + linkroutetablerequest LinkRouteTableRequest, +) ( + response *POST_LinkRouteTableResponses, + err error, +) { + path := client.service + "/LinkRouteTable" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(linkroutetablerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_LinkRouteTableResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &LinkRouteTableResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_LinkVirtualGateway( + linkvirtualgatewayrequest LinkVirtualGatewayRequest, +) ( + response *POST_LinkVirtualGatewayResponses, + err error, +) { + path := client.service + "/LinkVirtualGateway" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(linkvirtualgatewayrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_LinkVirtualGatewayResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &LinkVirtualGatewayResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_LinkVolume( + linkvolumerequest LinkVolumeRequest, +) ( + response *POST_LinkVolumeResponses, + err error, +) { + path := client.service + "/LinkVolume" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(linkvolumerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_LinkVolumeResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &LinkVolumeResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_PurchaseReservedVmsOffer( + purchasereservedvmsofferrequest PurchaseReservedVmsOfferRequest, +) ( + response *POST_PurchaseReservedVmsOfferResponses, + err error, +) { + path := client.service + "/PurchaseReservedVmsOffer" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(purchasereservedvmsofferrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_PurchaseReservedVmsOfferResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &PurchaseReservedVmsOfferResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadAccount( + readaccountrequest ReadAccountRequest, +) ( + response *POST_ReadAccountResponses, + err error, +) { + path := client.service + "/ReadAccount" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readaccountrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadAccountResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadAccountResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadAccountConsumption( + readaccountconsumptionrequest ReadAccountConsumptionRequest, +) ( + response *POST_ReadAccountConsumptionResponses, + err error, +) { + path := client.service + "/ReadAccountConsumption" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readaccountconsumptionrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadAccountConsumptionResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadAccountConsumptionResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadAdminPassword( + readadminpasswordrequest ReadAdminPasswordRequest, +) ( + response *POST_ReadAdminPasswordResponses, + err error, +) { + path := client.service + "/ReadAdminPassword" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readadminpasswordrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadAdminPasswordResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadAdminPasswordResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadApiKeys( + readapikeysrequest ReadApiKeysRequest, +) ( + response *POST_ReadApiKeysResponses, + err error, +) { + path := client.service + "/ReadApiKeys" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readapikeysrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadApiKeysResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadApiKeysResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadApiLogs( + readapilogsrequest ReadApiLogsRequest, +) ( + response *POST_ReadApiLogsResponses, + err error, +) { + path := client.service + "/ReadApiLogs" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readapilogsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadApiLogsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadApiLogsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadBillableDigest( + readbillabledigestrequest ReadBillableDigestRequest, +) ( + response *POST_ReadBillableDigestResponses, + err error, +) { + path := client.service + "/ReadBillableDigest" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readbillabledigestrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadBillableDigestResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadBillableDigestResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadCatalog( + readcatalogrequest ReadCatalogRequest, +) ( + response *POST_ReadCatalogResponses, + err error, +) { + path := client.service + "/ReadCatalog" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readcatalogrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadCatalogResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadCatalogResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadClientGateways( + readclientgatewaysrequest ReadClientGatewaysRequest, +) ( + response *POST_ReadClientGatewaysResponses, + err error, +) { + path := client.service + "/ReadClientGateways" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readclientgatewaysrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadClientGatewaysResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadClientGatewaysResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadConsoleOutput( + readconsoleoutputrequest ReadConsoleOutputRequest, +) ( + response *POST_ReadConsoleOutputResponses, + err error, +) { + path := client.service + "/ReadConsoleOutput" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readconsoleoutputrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadConsoleOutputResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadConsoleOutputResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadDhcpOptions( + readdhcpoptionsrequest ReadDhcpOptionsRequest, +) ( + response *POST_ReadDhcpOptionsResponses, + err error, +) { + path := client.service + "/ReadDhcpOptions" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readdhcpoptionsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadDhcpOptionsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadDhcpOptionsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadDirectLinkInterfaces( + readdirectlinkinterfacesrequest ReadDirectLinkInterfacesRequest, +) ( + response *POST_ReadDirectLinkInterfacesResponses, + err error, +) { + path := client.service + "/ReadDirectLinkInterfaces" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readdirectlinkinterfacesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadDirectLinkInterfacesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadDirectLinkInterfacesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadDirectLinks( + readdirectlinksrequest ReadDirectLinksRequest, +) ( + response *POST_ReadDirectLinksResponses, + err error, +) { + path := client.service + "/ReadDirectLinks" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readdirectlinksrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadDirectLinksResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadDirectLinksResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadImageExportTasks( + readimageexporttasksrequest ReadImageExportTasksRequest, +) ( + response *POST_ReadImageExportTasksResponses, + err error, +) { + path := client.service + "/ReadImageExportTasks" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readimageexporttasksrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadImageExportTasksResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadImageExportTasksResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadImages( + readimagesrequest ReadImagesRequest, +) ( + response *POST_ReadImagesResponses, + err error, +) { + path := client.service + "/ReadImages" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readimagesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadImagesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadImagesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadInternetServices( + readinternetservicesrequest ReadInternetServicesRequest, +) ( + response *POST_ReadInternetServicesResponses, + err error, +) { + path := client.service + "/ReadInternetServices" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readinternetservicesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadInternetServicesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadInternetServicesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadKeypairs( + readkeypairsrequest ReadKeypairsRequest, +) ( + response *POST_ReadKeypairsResponses, + err error, +) { + path := client.service + "/ReadKeypairs" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readkeypairsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadKeypairsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadKeypairsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadListenerRules( + readlistenerrulesrequest ReadListenerRulesRequest, +) ( + response *POST_ReadListenerRulesResponses, + err error, +) { + path := client.service + "/ReadListenerRules" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readlistenerrulesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + utils.DebugRequest(req) + resp, err := client.Do(req) + if resp != nil { + utils.DebugResponse(resp) + } + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadListenerRulesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadListenerRulesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadLoadBalancers( + readloadbalancersrequest ReadLoadBalancersRequest, +) ( + response *POST_ReadLoadBalancersResponses, + err error, +) { + path := client.service + "/ReadLoadBalancers" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readloadbalancersrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadLoadBalancersResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadLoadBalancersResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadLocations( + readlocationsrequest ReadLocationsRequest, +) ( + response *POST_ReadLocationsResponses, + err error, +) { + path := client.service + "/ReadLocations" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readlocationsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadLocationsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadLocationsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadNatServices( + readnatservicesrequest ReadNatServicesRequest, +) ( + response *POST_ReadNatServicesResponses, + err error, +) { + path := client.service + "/ReadNatServices" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readnatservicesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadNatServicesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadNatServicesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadNetAccessPointServices( + readnetaccesspointservicesrequest ReadNetAccessPointServicesRequest, +) ( + response *POST_ReadNetAccessPointServicesResponses, + err error, +) { + path := client.service + "/ReadNetAccessPointServices" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readnetaccesspointservicesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadNetAccessPointServicesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadNetAccessPointServicesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadNetAccessPoints( + readnetaccesspointsrequest ReadNetAccessPointsRequest, +) ( + response *POST_ReadNetAccessPointsResponses, + err error, +) { + path := client.service + "/ReadNetAccessPoints" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readnetaccesspointsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadNetAccessPointsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadNetAccessPointsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadNetPeerings( + readnetpeeringsrequest ReadNetPeeringsRequest, +) ( + response *POST_ReadNetPeeringsResponses, + err error, +) { + path := client.service + "/ReadNetPeerings" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readnetpeeringsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadNetPeeringsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadNetPeeringsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadNets( + readnetsrequest ReadNetsRequest, +) ( + response *POST_ReadNetsResponses, + err error, +) { + path := client.service + "/ReadNets" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readnetsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadNetsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadNetsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadNics( + readnicsrequest ReadNicsRequest, +) ( + response *POST_ReadNicsResponses, + err error, +) { + path := client.service + "/ReadNics" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readnicsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadNicsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadNicsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadPolicies( + readpoliciesrequest ReadPoliciesRequest, +) ( + response *POST_ReadPoliciesResponses, + err error, +) { + path := client.service + "/ReadPolicies" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readpoliciesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadPoliciesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadPoliciesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadPrefixLists( + readprefixlistsrequest ReadPrefixListsRequest, +) ( + response *POST_ReadPrefixListsResponses, + err error, +) { + path := client.service + "/ReadPrefixLists" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readprefixlistsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadPrefixListsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadPrefixListsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadProductTypes( + readproducttypesrequest ReadProductTypesRequest, +) ( + response *POST_ReadProductTypesResponses, + err error, +) { + path := client.service + "/ReadProductTypes" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readproducttypesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadProductTypesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadProductTypesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadPublicCatalog( + readpubliccatalogrequest ReadPublicCatalogRequest, +) ( + response *POST_ReadPublicCatalogResponses, + err error, +) { + path := client.service + "/ReadPublicCatalog" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readpubliccatalogrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadPublicCatalogResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadPublicCatalogResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadPublicIpRanges( + readpubliciprangesrequest ReadPublicIpRangesRequest, +) ( + response *POST_ReadPublicIpRangesResponses, + err error, +) { + path := client.service + "/ReadPublicIpRanges" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readpubliciprangesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadPublicIpRangesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadPublicIpRangesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadPublicIps( + readpublicipsrequest ReadPublicIpsRequest, +) ( + response *POST_ReadPublicIpsResponses, + err error, +) { + path := client.service + "/ReadPublicIps" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readpublicipsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadPublicIpsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadPublicIpsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadQuotas( + readquotasrequest ReadQuotasRequest, +) ( + response *POST_ReadQuotasResponses, + err error, +) { + path := client.service + "/ReadQuotas" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readquotasrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadQuotasResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadQuotasResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadRegionConfig( + readregionconfigrequest ReadRegionConfigRequest, +) ( + response *POST_ReadRegionConfigResponses, + err error, +) { + path := client.service + "/ReadRegionConfig" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readregionconfigrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadRegionConfigResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadRegionConfigResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadRegions( + readregionsrequest ReadRegionsRequest, +) ( + response *POST_ReadRegionsResponses, + err error, +) { + path := client.service + "/ReadRegions" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readregionsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadRegionsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadRegionsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadReservedVmOffers( + readreservedvmoffersrequest ReadReservedVmOffersRequest, +) ( + response *POST_ReadReservedVmOffersResponses, + err error, +) { + path := client.service + "/ReadReservedVmOffers" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readreservedvmoffersrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadReservedVmOffersResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadReservedVmOffersResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadReservedVms( + readreservedvmsrequest ReadReservedVmsRequest, +) ( + response *POST_ReadReservedVmsResponses, + err error, +) { + path := client.service + "/ReadReservedVms" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readreservedvmsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + utils.DebugRequest(req) + resp, err := client.Do(req) + if resp != nil { + utils.DebugResponse(resp) + } + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadReservedVmsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadReservedVmsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadRouteTables( + readroutetablesrequest ReadRouteTablesRequest, +) ( + response *POST_ReadRouteTablesResponses, + err error, +) { + path := client.service + "/ReadRouteTables" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readroutetablesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadRouteTablesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadRouteTablesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadSecurityGroups( + readsecuritygroupsrequest ReadSecurityGroupsRequest, +) ( + response *POST_ReadSecurityGroupsResponses, + err error, +) { + path := client.service + "/ReadSecurityGroups" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readsecuritygroupsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadSecurityGroupsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadSecurityGroupsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadServerCertificates( + readservercertificatesrequest ReadServerCertificatesRequest, +) ( + response *POST_ReadServerCertificatesResponses, + err error, +) { + path := client.service + "/ReadServerCertificates" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readservercertificatesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadServerCertificatesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadServerCertificatesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadSnapshotExportTasks( + readsnapshotexporttasksrequest ReadSnapshotExportTasksRequest, +) ( + response *POST_ReadSnapshotExportTasksResponses, + err error, +) { + path := client.service + "/ReadSnapshotExportTasks" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readsnapshotexporttasksrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadSnapshotExportTasksResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadSnapshotExportTasksResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadSnapshots( + readsnapshotsrequest ReadSnapshotsRequest, +) ( + response *POST_ReadSnapshotsResponses, + err error, +) { + path := client.service + "/ReadSnapshots" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readsnapshotsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadSnapshotsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadSnapshotsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadSubnets( + readsubnetsrequest ReadSubnetsRequest, +) ( + response *POST_ReadSubnetsResponses, + err error, +) { + path := client.service + "/ReadSubnets" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readsubnetsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadSubnetsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadSubnetsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadSubregions( + readsubregionsrequest ReadSubregionsRequest, +) ( + response *POST_ReadSubregionsResponses, + err error, +) { + path := client.service + "/ReadSubregions" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readsubregionsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadSubregionsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadSubregionsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadTags( + readtagsrequest ReadTagsRequest, +) ( + response *POST_ReadTagsResponses, + err error, +) { + path := client.service + "/ReadTags" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readtagsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadTagsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadTagsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadUserGroups( + readusergroupsrequest ReadUserGroupsRequest, +) ( + response *POST_ReadUserGroupsResponses, + err error, +) { + path := client.service + "/ReadUserGroups" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readusergroupsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadUserGroupsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadUserGroupsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadUsers( + readusersrequest ReadUsersRequest, +) ( + response *POST_ReadUsersResponses, + err error, +) { + path := client.service + "/ReadUsers" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readusersrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadUsersResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadUsersResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadVirtualGateways( + readvirtualgatewaysrequest ReadVirtualGatewaysRequest, +) ( + response *POST_ReadVirtualGatewaysResponses, + err error, +) { + path := client.service + "/ReadVirtualGateways" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readvirtualgatewaysrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadVirtualGatewaysResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadVirtualGatewaysResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadVmTypes( + readvmtypesrequest ReadVmTypesRequest, +) ( + response *POST_ReadVmTypesResponses, + err error, +) { + path := client.service + "/ReadVmTypes" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readvmtypesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadVmTypesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadVmTypesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadVms( + readvmsrequest ReadVmsRequest, +) ( + response *POST_ReadVmsResponses, + err error, +) { + path := client.service + "/ReadVms" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readvmsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadVmsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadVmsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadVmsHealth( + readvmshealthrequest ReadVmsHealthRequest, +) ( + response *POST_ReadVmsHealthResponses, + err error, +) { + path := client.service + "/ReadVmsHealth" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readvmshealthrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadVmsHealthResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadVmsHealthResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadVmsState( + readvmsstaterequest ReadVmsStateRequest, +) ( + response *POST_ReadVmsStateResponses, + err error, +) { + path := client.service + "/ReadVmsState" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readvmsstaterequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadVmsStateResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadVmsStateResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadVolumes( + readvolumesrequest ReadVolumesRequest, +) ( + response *POST_ReadVolumesResponses, + err error, +) { + path := client.service + "/ReadVolumes" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readvolumesrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadVolumesResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadVolumesResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ReadVpnConnections( + readvpnconnectionsrequest ReadVpnConnectionsRequest, +) ( + response *POST_ReadVpnConnectionsResponses, + err error, +) { + path := client.service + "/ReadVpnConnections" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(readvpnconnectionsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ReadVpnConnectionsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ReadVpnConnectionsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_RebootVms( + rebootvmsrequest RebootVmsRequest, +) ( + response *POST_RebootVmsResponses, + err error, +) { + path := client.service + "/RebootVms" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(rebootvmsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_RebootVmsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &RebootVmsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_RegisterUserInUserGroup( + registeruserinusergrouprequest RegisterUserInUserGroupRequest, +) ( + response *POST_RegisterUserInUserGroupResponses, + err error, +) { + path := client.service + "/RegisterUserInUserGroup" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(registeruserinusergrouprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_RegisterUserInUserGroupResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &RegisterUserInUserGroupResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_RegisterVmsInLoadBalancer( + registervmsinloadbalancerrequest RegisterVmsInLoadBalancerRequest, +) ( + response *POST_RegisterVmsInLoadBalancerResponses, + err error, +) { + path := client.service + "/RegisterVmsInLoadBalancer" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(registervmsinloadbalancerrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_RegisterVmsInLoadBalancerResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &RegisterVmsInLoadBalancerResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_RejectNetPeering( + rejectnetpeeringrequest RejectNetPeeringRequest, +) ( + response *POST_RejectNetPeeringResponses, + err error, +) { + path := client.service + "/RejectNetPeering" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(rejectnetpeeringrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_RejectNetPeeringResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &RejectNetPeeringResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 409: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code409 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_ResetAccountPassword( + resetaccountpasswordrequest ResetAccountPasswordRequest, +) ( + response *POST_ResetAccountPasswordResponses, + err error, +) { + path := client.service + "/ResetAccountPassword" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(resetaccountpasswordrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_ResetAccountPasswordResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ResetAccountPasswordResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_SendResetPasswordEmail( + sendresetpasswordemailrequest SendResetPasswordEmailRequest, +) ( + response *POST_SendResetPasswordEmailResponses, + err error, +) { + path := client.service + "/SendResetPasswordEmail" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(sendresetpasswordemailrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_SendResetPasswordEmailResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &SendResetPasswordEmailResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_StartVms( + startvmsrequest StartVmsRequest, +) ( + response *POST_StartVmsResponses, + err error, +) { + path := client.service + "/StartVms" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(startvmsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_StartVmsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &StartVmsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_StopVms( + stopvmsrequest StopVmsRequest, +) ( + response *POST_StopVmsResponses, + err error, +) { + path := client.service + "/StopVms" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(stopvmsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_StopVmsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &StopVmsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UnlinkInternetService( + unlinkinternetservicerequest UnlinkInternetServiceRequest, +) ( + response *POST_UnlinkInternetServiceResponses, + err error, +) { + path := client.service + "/UnlinkInternetService" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(unlinkinternetservicerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + utils.DebugRequest(req) + resp, err := client.Do(req) + if resp != nil { + utils.DebugResponse(resp) + } + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UnlinkInternetServiceResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UnlinkInternetServiceResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UnlinkNic( + unlinknicrequest UnlinkNicRequest, +) ( + response *POST_UnlinkNicResponses, + err error, +) { + path := client.service + "/UnlinkNic" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(unlinknicrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UnlinkNicResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UnlinkNicResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UnlinkPolicy( + unlinkpolicyrequest UnlinkPolicyRequest, +) ( + response *POST_UnlinkPolicyResponses, + err error, +) { + path := client.service + "/UnlinkPolicy" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(unlinkpolicyrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UnlinkPolicyResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UnlinkPolicyResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UnlinkPrivateIps( + unlinkprivateipsrequest UnlinkPrivateIpsRequest, +) ( + response *POST_UnlinkPrivateIpsResponses, + err error, +) { + path := client.service + "/UnlinkPrivateIps" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(unlinkprivateipsrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UnlinkPrivateIpsResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UnlinkPrivateIpsResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UnlinkPublicIp( + unlinkpubliciprequest UnlinkPublicIpRequest, +) ( + response *POST_UnlinkPublicIpResponses, + err error, +) { + path := client.service + "/UnlinkPublicIp" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(unlinkpubliciprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UnlinkPublicIpResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UnlinkPublicIpResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UnlinkRouteTable( + unlinkroutetablerequest UnlinkRouteTableRequest, +) ( + response *POST_UnlinkRouteTableResponses, + err error, +) { + path := client.service + "/UnlinkRouteTable" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(unlinkroutetablerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UnlinkRouteTableResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UnlinkRouteTableResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UnlinkVirtualGateway( + unlinkvirtualgatewayrequest UnlinkVirtualGatewayRequest, +) ( + response *POST_UnlinkVirtualGatewayResponses, + err error, +) { + path := client.service + "/UnlinkVirtualGateway" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(unlinkvirtualgatewayrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UnlinkVirtualGatewayResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UnlinkVirtualGatewayResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UnlinkVolume( + unlinkvolumerequest UnlinkVolumeRequest, +) ( + response *POST_UnlinkVolumeResponses, + err error, +) { + path := client.service + "/UnlinkVolume" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(unlinkvolumerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UnlinkVolumeResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UnlinkVolumeResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateAccount( + updateaccountrequest UpdateAccountRequest, +) ( + response *POST_UpdateAccountResponses, + err error, +) { + path := client.service + "/UpdateAccount" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updateaccountrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateAccountResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateAccountResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateApiKey( + updateapikeyrequest UpdateApiKeyRequest, +) ( + response *POST_UpdateApiKeyResponses, + err error, +) { + path := client.service + "/UpdateApiKey" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updateapikeyrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateApiKeyResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateApiKeyResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateHealthCheck( + updatehealthcheckrequest UpdateHealthCheckRequest, +) ( + response *POST_UpdateHealthCheckResponses, + err error, +) { + path := client.service + "/UpdateHealthCheck" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updatehealthcheckrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateHealthCheckResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateHealthCheckResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateImage( + updateimagerequest UpdateImageRequest, +) ( + response *POST_UpdateImageResponses, + err error, +) { + path := client.service + "/UpdateImage" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updateimagerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateImageResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateImageResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateKeypair( + updatekeypairrequest UpdateKeypairRequest, +) ( + response *POST_UpdateKeypairResponses, + err error, +) { + path := client.service + "/UpdateKeypair" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updatekeypairrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateKeypairResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateKeypairResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateListenerRule( + updatelistenerrulerequest UpdateListenerRuleRequest, +) ( + response *POST_UpdateListenerRuleResponses, + err error, +) { + path := client.service + "/UpdateListenerRule" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updatelistenerrulerequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateListenerRuleResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateListenerRuleResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateLoadBalancer( + updateloadbalancerrequest UpdateLoadBalancerRequest, +) ( + response *POST_UpdateLoadBalancerResponses, + err error, +) { + path := client.service + "/UpdateLoadBalancer" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updateloadbalancerrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateLoadBalancerResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateLoadBalancerResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateNet( + updatenetrequest UpdateNetRequest, +) ( + response *POST_UpdateNetResponses, + err error, +) { + path := client.service + "/UpdateNet" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updatenetrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateNetResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateNetResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateNetAccessPoint( + updatenetaccesspointrequest UpdateNetAccessPointRequest, +) ( + response *POST_UpdateNetAccessPointResponses, + err error, +) { + path := client.service + "/UpdateNetAccessPoint" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updatenetaccesspointrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateNetAccessPointResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateNetAccessPointResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateNic( + updatenicrequest UpdateNicRequest, +) ( + response *POST_UpdateNicResponses, + err error, +) { + path := client.service + "/UpdateNic" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updatenicrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateNicResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateNicResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateRoute( + updaterouterequest UpdateRouteRequest, +) ( + response *POST_UpdateRouteResponses, + err error, +) { + path := client.service + "/UpdateRoute" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updaterouterequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateRouteResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateRouteResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateRoutePropagation( + updateroutepropagationrequest UpdateRoutePropagationRequest, +) ( + response *POST_UpdateRoutePropagationResponses, + err error, +) { + path := client.service + "/UpdateRoutePropagation" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updateroutepropagationrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateRoutePropagationResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateRoutePropagationResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateServerCertificate( + updateservercertificaterequest UpdateServerCertificateRequest, +) ( + response *POST_UpdateServerCertificateResponses, + err error, +) { + path := client.service + "/UpdateServerCertificate" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updateservercertificaterequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateServerCertificateResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateServerCertificateResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateSnapshot( + updatesnapshotrequest UpdateSnapshotRequest, +) ( + response *POST_UpdateSnapshotResponses, + err error, +) { + path := client.service + "/UpdateSnapshot" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updatesnapshotrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateSnapshotResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateSnapshotResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateUser( + updateuserrequest UpdateUserRequest, +) ( + response *POST_UpdateUserResponses, + err error, +) { + path := client.service + "/UpdateUser" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updateuserrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateUserResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateUserResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateUserGroup( + updateusergrouprequest UpdateUserGroupRequest, +) ( + response *POST_UpdateUserGroupResponses, + err error, +) { + path := client.service + "/UpdateUserGroup" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updateusergrouprequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateUserGroupResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateUserGroupResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + default: + break + } + return +} + +// +func (client *Client) POST_UpdateVm( + updatevmrequest UpdateVmRequest, +) ( + response *POST_UpdateVmResponses, + err error, +) { + path := client.service + "/UpdateVm" + body := new(bytes.Buffer) + json.NewEncoder(body).Encode(updatevmrequest) + req, err := http.NewRequest("POST", path, body) + reqHeaders := make(http.Header) + reqHeaders.Set("Content-Type", "application/json") + req.Header = reqHeaders + client.Sign(req, body.Bytes()) + if err != nil { + return + } + utils.DebugRequest(req) + resp, err := client.Do(req) + if resp != nil { + utils.DebugResponse(resp) + } + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, checkErrorResponse(resp) + } + response = &POST_UpdateVmResponses{} + switch { + case resp.StatusCode == 200: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &UpdateVmResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.OK = result + case resp.StatusCode == 400: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code400 = result + case resp.StatusCode == 401: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code401 = result + case resp.StatusCode == 500: + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + result := &ErrorResponse{} + err = json.Unmarshal(body, result) + if err != nil { + return nil, err + } + response.Code500 = result + default: + break + } + return +} + +func checkErrorResponse(resp *http.Response) error { + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return fmt.Errorf("error reading response error body %s", err) + } + + reason, errFmt := fmtErrorResponse(body) + if errFmt != nil { + return fmt.Errorf("error formating error resonse %s", err) + } + + return fmt.Errorf("error, status code %d, reason: %s", resp.StatusCode, reason) +} + +func fmtErrorResponse(errBody []byte) (string, error) { + result := &ErrorResponse{} + err := json.Unmarshal(errBody, result) + if err != nil { + return "", err + } + + errors, errPretty := json.MarshalIndent(result, "", " ") + if errPretty != nil { + return "", err + } + + return string(errors), nil +} + +var _ OAPIClient = (*Client)(nil) diff --git a/vendor/github.com/outscale/osc-go/oapi/interface.go b/vendor/github.com/outscale/osc-go/oapi/interface.go new file mode 100644 index 000000000..96aeebc5d --- /dev/null +++ b/vendor/github.com/outscale/osc-go/oapi/interface.go @@ -0,0 +1,1213 @@ +package oapi + +type OAPIClient interface { + POST_AcceptNetPeering( + acceptnetpeeringrequest AcceptNetPeeringRequest, + ) ( + response *POST_AcceptNetPeeringResponses, + err error, + ) + + POST_AuthenticateAccount( + authenticateaccountrequest AuthenticateAccountRequest, + ) ( + response *POST_AuthenticateAccountResponses, + err error, + ) + + POST_CheckSignature( + checksignaturerequest CheckSignatureRequest, + ) ( + response *POST_CheckSignatureResponses, + err error, + ) + + POST_CopyAccount( + copyaccountrequest CopyAccountRequest, + ) ( + response *POST_CopyAccountResponses, + err error, + ) + + POST_CreateAccount( + createaccountrequest CreateAccountRequest, + ) ( + response *POST_CreateAccountResponses, + err error, + ) + + POST_CreateApiKey( + createapikeyrequest CreateApiKeyRequest, + ) ( + response *POST_CreateApiKeyResponses, + err error, + ) + + POST_CreateClientGateway( + createclientgatewayrequest CreateClientGatewayRequest, + ) ( + response *POST_CreateClientGatewayResponses, + err error, + ) + + POST_CreateDhcpOptions( + createdhcpoptionsrequest CreateDhcpOptionsRequest, + ) ( + response *POST_CreateDhcpOptionsResponses, + err error, + ) + + POST_CreateDirectLink( + createdirectlinkrequest CreateDirectLinkRequest, + ) ( + response *POST_CreateDirectLinkResponses, + err error, + ) + + POST_CreateDirectLinkInterface( + createdirectlinkinterfacerequest CreateDirectLinkInterfaceRequest, + ) ( + response *POST_CreateDirectLinkInterfaceResponses, + err error, + ) + + POST_CreateImage( + createimagerequest CreateImageRequest, + ) ( + response *POST_CreateImageResponses, + err error, + ) + + POST_CreateImageExportTask( + createimageexporttaskrequest CreateImageExportTaskRequest, + ) ( + response *POST_CreateImageExportTaskResponses, + err error, + ) + + POST_CreateInternetService( + createinternetservicerequest CreateInternetServiceRequest, + ) ( + response *POST_CreateInternetServiceResponses, + err error, + ) + + POST_CreateKeypair( + createkeypairrequest CreateKeypairRequest, + ) ( + response *POST_CreateKeypairResponses, + err error, + ) + + POST_CreateListenerRule( + createlistenerrulerequest CreateListenerRuleRequest, + ) ( + response *POST_CreateListenerRuleResponses, + err error, + ) + + POST_CreateLoadBalancer( + createloadbalancerrequest CreateLoadBalancerRequest, + ) ( + response *POST_CreateLoadBalancerResponses, + err error, + ) + + POST_CreateLoadBalancerListeners( + createloadbalancerlistenersrequest CreateLoadBalancerListenersRequest, + ) ( + response *POST_CreateLoadBalancerListenersResponses, + err error, + ) + + POST_CreateLoadBalancerPolicy( + createloadbalancerpolicyrequest CreateLoadBalancerPolicyRequest, + ) ( + response *POST_CreateLoadBalancerPolicyResponses, + err error, + ) + + POST_CreateNatService( + createnatservicerequest CreateNatServiceRequest, + ) ( + response *POST_CreateNatServiceResponses, + err error, + ) + + POST_CreateNet( + createnetrequest CreateNetRequest, + ) ( + response *POST_CreateNetResponses, + err error, + ) + + POST_CreateNetAccessPoint( + createnetaccesspointrequest CreateNetAccessPointRequest, + ) ( + response *POST_CreateNetAccessPointResponses, + err error, + ) + + POST_CreateNetPeering( + createnetpeeringrequest CreateNetPeeringRequest, + ) ( + response *POST_CreateNetPeeringResponses, + err error, + ) + + POST_CreateNic( + createnicrequest CreateNicRequest, + ) ( + response *POST_CreateNicResponses, + err error, + ) + + POST_CreatePolicy( + createpolicyrequest CreatePolicyRequest, + ) ( + response *POST_CreatePolicyResponses, + err error, + ) + + POST_CreatePublicIp( + createpubliciprequest CreatePublicIpRequest, + ) ( + response *POST_CreatePublicIpResponses, + err error, + ) + + POST_CreateRoute( + createrouterequest CreateRouteRequest, + ) ( + response *POST_CreateRouteResponses, + err error, + ) + + POST_CreateRouteTable( + createroutetablerequest CreateRouteTableRequest, + ) ( + response *POST_CreateRouteTableResponses, + err error, + ) + + POST_CreateSecurityGroup( + createsecuritygrouprequest CreateSecurityGroupRequest, + ) ( + response *POST_CreateSecurityGroupResponses, + err error, + ) + + POST_CreateSecurityGroupRule( + createsecuritygrouprulerequest CreateSecurityGroupRuleRequest, + ) ( + response *POST_CreateSecurityGroupRuleResponses, + err error, + ) + + POST_CreateServerCertificate( + createservercertificaterequest CreateServerCertificateRequest, + ) ( + response *POST_CreateServerCertificateResponses, + err error, + ) + + POST_CreateSnapshot( + createsnapshotrequest CreateSnapshotRequest, + ) ( + response *POST_CreateSnapshotResponses, + err error, + ) + + POST_CreateSnapshotExportTask( + createsnapshotexporttaskrequest CreateSnapshotExportTaskRequest, + ) ( + response *POST_CreateSnapshotExportTaskResponses, + err error, + ) + + POST_CreateSubnet( + createsubnetrequest CreateSubnetRequest, + ) ( + response *POST_CreateSubnetResponses, + err error, + ) + + POST_CreateTags( + createtagsrequest CreateTagsRequest, + ) ( + response *POST_CreateTagsResponses, + err error, + ) + + POST_CreateUser( + createuserrequest CreateUserRequest, + ) ( + response *POST_CreateUserResponses, + err error, + ) + + POST_CreateUserGroup( + createusergrouprequest CreateUserGroupRequest, + ) ( + response *POST_CreateUserGroupResponses, + err error, + ) + + POST_CreateVirtualGateway( + createvirtualgatewayrequest CreateVirtualGatewayRequest, + ) ( + response *POST_CreateVirtualGatewayResponses, + err error, + ) + + POST_CreateVms( + createvmsrequest CreateVmsRequest, + ) ( + response *POST_CreateVmsResponses, + err error, + ) + + POST_CreateVolume( + createvolumerequest CreateVolumeRequest, + ) ( + response *POST_CreateVolumeResponses, + err error, + ) + + POST_CreateVpnConnection( + createvpnconnectionrequest CreateVpnConnectionRequest, + ) ( + response *POST_CreateVpnConnectionResponses, + err error, + ) + + POST_CreateVpnConnectionRoute( + createvpnconnectionrouterequest CreateVpnConnectionRouteRequest, + ) ( + response *POST_CreateVpnConnectionRouteResponses, + err error, + ) + + POST_DeleteApiKey( + deleteapikeyrequest DeleteApiKeyRequest, + ) ( + response *POST_DeleteApiKeyResponses, + err error, + ) + + POST_DeleteClientGateway( + deleteclientgatewayrequest DeleteClientGatewayRequest, + ) ( + response *POST_DeleteClientGatewayResponses, + err error, + ) + + POST_DeleteDhcpOptions( + deletedhcpoptionsrequest DeleteDhcpOptionsRequest, + ) ( + response *POST_DeleteDhcpOptionsResponses, + err error, + ) + + POST_DeleteDirectLink( + deletedirectlinkrequest DeleteDirectLinkRequest, + ) ( + response *POST_DeleteDirectLinkResponses, + err error, + ) + + POST_DeleteDirectLinkInterface( + deletedirectlinkinterfacerequest DeleteDirectLinkInterfaceRequest, + ) ( + response *POST_DeleteDirectLinkInterfaceResponses, + err error, + ) + + POST_DeleteExportTask( + deleteexporttaskrequest DeleteExportTaskRequest, + ) ( + response *POST_DeleteExportTaskResponses, + err error, + ) + + POST_DeleteImage( + deleteimagerequest DeleteImageRequest, + ) ( + response *POST_DeleteImageResponses, + err error, + ) + + POST_DeleteInternetService( + deleteinternetservicerequest DeleteInternetServiceRequest, + ) ( + response *POST_DeleteInternetServiceResponses, + err error, + ) + + POST_DeleteKeypair( + deletekeypairrequest DeleteKeypairRequest, + ) ( + response *POST_DeleteKeypairResponses, + err error, + ) + + POST_DeleteListenerRule( + deletelistenerrulerequest DeleteListenerRuleRequest, + ) ( + response *POST_DeleteListenerRuleResponses, + err error, + ) + + POST_DeleteLoadBalancer( + deleteloadbalancerrequest DeleteLoadBalancerRequest, + ) ( + response *POST_DeleteLoadBalancerResponses, + err error, + ) + + POST_DeleteLoadBalancerListeners( + deleteloadbalancerlistenersrequest DeleteLoadBalancerListenersRequest, + ) ( + response *POST_DeleteLoadBalancerListenersResponses, + err error, + ) + + POST_DeleteLoadBalancerPolicy( + deleteloadbalancerpolicyrequest DeleteLoadBalancerPolicyRequest, + ) ( + response *POST_DeleteLoadBalancerPolicyResponses, + err error, + ) + + POST_DeleteNatService( + deletenatservicerequest DeleteNatServiceRequest, + ) ( + response *POST_DeleteNatServiceResponses, + err error, + ) + + POST_DeleteNet( + deletenetrequest DeleteNetRequest, + ) ( + response *POST_DeleteNetResponses, + err error, + ) + + POST_DeleteNetAccessPoints( + deletenetaccesspointsrequest DeleteNetAccessPointsRequest, + ) ( + response *POST_DeleteNetAccessPointsResponses, + err error, + ) + + POST_DeleteNetPeering( + deletenetpeeringrequest DeleteNetPeeringRequest, + ) ( + response *POST_DeleteNetPeeringResponses, + err error, + ) + + POST_DeleteNic( + deletenicrequest DeleteNicRequest, + ) ( + response *POST_DeleteNicResponses, + err error, + ) + + POST_DeletePolicy( + deletepolicyrequest DeletePolicyRequest, + ) ( + response *POST_DeletePolicyResponses, + err error, + ) + + POST_DeletePublicIp( + deletepubliciprequest DeletePublicIpRequest, + ) ( + response *POST_DeletePublicIpResponses, + err error, + ) + + POST_DeleteRoute( + deleterouterequest DeleteRouteRequest, + ) ( + response *POST_DeleteRouteResponses, + err error, + ) + + POST_DeleteRouteTable( + deleteroutetablerequest DeleteRouteTableRequest, + ) ( + response *POST_DeleteRouteTableResponses, + err error, + ) + + POST_DeleteSecurityGroup( + deletesecuritygrouprequest DeleteSecurityGroupRequest, + ) ( + response *POST_DeleteSecurityGroupResponses, + err error, + ) + + POST_DeleteSecurityGroupRule( + deletesecuritygrouprulerequest DeleteSecurityGroupRuleRequest, + ) ( + response *POST_DeleteSecurityGroupRuleResponses, + err error, + ) + + POST_DeleteServerCertificate( + deleteservercertificaterequest DeleteServerCertificateRequest, + ) ( + response *POST_DeleteServerCertificateResponses, + err error, + ) + + POST_DeleteSnapshot( + deletesnapshotrequest DeleteSnapshotRequest, + ) ( + response *POST_DeleteSnapshotResponses, + err error, + ) + + POST_DeleteSubnet( + deletesubnetrequest DeleteSubnetRequest, + ) ( + response *POST_DeleteSubnetResponses, + err error, + ) + + POST_DeleteTags( + deletetagsrequest DeleteTagsRequest, + ) ( + response *POST_DeleteTagsResponses, + err error, + ) + + POST_DeleteUser( + deleteuserrequest DeleteUserRequest, + ) ( + response *POST_DeleteUserResponses, + err error, + ) + + POST_DeleteUserGroup( + deleteusergrouprequest DeleteUserGroupRequest, + ) ( + response *POST_DeleteUserGroupResponses, + err error, + ) + + POST_DeleteVirtualGateway( + deletevirtualgatewayrequest DeleteVirtualGatewayRequest, + ) ( + response *POST_DeleteVirtualGatewayResponses, + err error, + ) + + POST_DeleteVms( + deletevmsrequest DeleteVmsRequest, + ) ( + response *POST_DeleteVmsResponses, + err error, + ) + + POST_DeleteVolume( + deletevolumerequest DeleteVolumeRequest, + ) ( + response *POST_DeleteVolumeResponses, + err error, + ) + + POST_DeleteVpnConnection( + deletevpnconnectionrequest DeleteVpnConnectionRequest, + ) ( + response *POST_DeleteVpnConnectionResponses, + err error, + ) + + POST_DeleteVpnConnectionRoute( + deletevpnconnectionrouterequest DeleteVpnConnectionRouteRequest, + ) ( + response *POST_DeleteVpnConnectionRouteResponses, + err error, + ) + + POST_DeregisterUserInUserGroup( + deregisteruserinusergrouprequest DeregisterUserInUserGroupRequest, + ) ( + response *POST_DeregisterUserInUserGroupResponses, + err error, + ) + + POST_DeregisterVmsInLoadBalancer( + deregistervmsinloadbalancerrequest DeregisterVmsInLoadBalancerRequest, + ) ( + response *POST_DeregisterVmsInLoadBalancerResponses, + err error, + ) + + POST_LinkInternetService( + linkinternetservicerequest LinkInternetServiceRequest, + ) ( + response *POST_LinkInternetServiceResponses, + err error, + ) + + POST_LinkNic( + linknicrequest LinkNicRequest, + ) ( + response *POST_LinkNicResponses, + err error, + ) + + POST_LinkPolicy( + linkpolicyrequest LinkPolicyRequest, + ) ( + response *POST_LinkPolicyResponses, + err error, + ) + + POST_LinkPrivateIps( + linkprivateipsrequest LinkPrivateIpsRequest, + ) ( + response *POST_LinkPrivateIpsResponses, + err error, + ) + + POST_LinkPublicIp( + linkpubliciprequest LinkPublicIpRequest, + ) ( + response *POST_LinkPublicIpResponses, + err error, + ) + + POST_LinkRouteTable( + linkroutetablerequest LinkRouteTableRequest, + ) ( + response *POST_LinkRouteTableResponses, + err error, + ) + + POST_LinkVirtualGateway( + linkvirtualgatewayrequest LinkVirtualGatewayRequest, + ) ( + response *POST_LinkVirtualGatewayResponses, + err error, + ) + + POST_LinkVolume( + linkvolumerequest LinkVolumeRequest, + ) ( + response *POST_LinkVolumeResponses, + err error, + ) + + POST_PurchaseReservedVmsOffer( + purchasereservedvmsofferrequest PurchaseReservedVmsOfferRequest, + ) ( + response *POST_PurchaseReservedVmsOfferResponses, + err error, + ) + + POST_ReadAccount( + readaccountrequest ReadAccountRequest, + ) ( + response *POST_ReadAccountResponses, + err error, + ) + + POST_ReadAccountConsumption( + readaccountconsumptionrequest ReadAccountConsumptionRequest, + ) ( + response *POST_ReadAccountConsumptionResponses, + err error, + ) + + POST_ReadAdminPassword( + readadminpasswordrequest ReadAdminPasswordRequest, + ) ( + response *POST_ReadAdminPasswordResponses, + err error, + ) + + POST_ReadApiKeys( + readapikeysrequest ReadApiKeysRequest, + ) ( + response *POST_ReadApiKeysResponses, + err error, + ) + + POST_ReadApiLogs( + readapilogsrequest ReadApiLogsRequest, + ) ( + response *POST_ReadApiLogsResponses, + err error, + ) + + POST_ReadBillableDigest( + readbillabledigestrequest ReadBillableDigestRequest, + ) ( + response *POST_ReadBillableDigestResponses, + err error, + ) + + POST_ReadCatalog( + readcatalogrequest ReadCatalogRequest, + ) ( + response *POST_ReadCatalogResponses, + err error, + ) + + POST_ReadClientGateways( + readclientgatewaysrequest ReadClientGatewaysRequest, + ) ( + response *POST_ReadClientGatewaysResponses, + err error, + ) + + POST_ReadConsoleOutput( + readconsoleoutputrequest ReadConsoleOutputRequest, + ) ( + response *POST_ReadConsoleOutputResponses, + err error, + ) + + POST_ReadDhcpOptions( + readdhcpoptionsrequest ReadDhcpOptionsRequest, + ) ( + response *POST_ReadDhcpOptionsResponses, + err error, + ) + + POST_ReadDirectLinkInterfaces( + readdirectlinkinterfacesrequest ReadDirectLinkInterfacesRequest, + ) ( + response *POST_ReadDirectLinkInterfacesResponses, + err error, + ) + + POST_ReadDirectLinks( + readdirectlinksrequest ReadDirectLinksRequest, + ) ( + response *POST_ReadDirectLinksResponses, + err error, + ) + + POST_ReadImageExportTasks( + readimageexporttasksrequest ReadImageExportTasksRequest, + ) ( + response *POST_ReadImageExportTasksResponses, + err error, + ) + + POST_ReadImages( + readimagesrequest ReadImagesRequest, + ) ( + response *POST_ReadImagesResponses, + err error, + ) + + POST_ReadInternetServices( + readinternetservicesrequest ReadInternetServicesRequest, + ) ( + response *POST_ReadInternetServicesResponses, + err error, + ) + + POST_ReadKeypairs( + readkeypairsrequest ReadKeypairsRequest, + ) ( + response *POST_ReadKeypairsResponses, + err error, + ) + + POST_ReadListenerRules( + readlistenerrulesrequest ReadListenerRulesRequest, + ) ( + response *POST_ReadListenerRulesResponses, + err error, + ) + + POST_ReadLoadBalancers( + readloadbalancersrequest ReadLoadBalancersRequest, + ) ( + response *POST_ReadLoadBalancersResponses, + err error, + ) + + POST_ReadLocations( + readlocationsrequest ReadLocationsRequest, + ) ( + response *POST_ReadLocationsResponses, + err error, + ) + + POST_ReadNatServices( + readnatservicesrequest ReadNatServicesRequest, + ) ( + response *POST_ReadNatServicesResponses, + err error, + ) + + POST_ReadNetAccessPointServices( + readnetaccesspointservicesrequest ReadNetAccessPointServicesRequest, + ) ( + response *POST_ReadNetAccessPointServicesResponses, + err error, + ) + + POST_ReadNetAccessPoints( + readnetaccesspointsrequest ReadNetAccessPointsRequest, + ) ( + response *POST_ReadNetAccessPointsResponses, + err error, + ) + + POST_ReadNetPeerings( + readnetpeeringsrequest ReadNetPeeringsRequest, + ) ( + response *POST_ReadNetPeeringsResponses, + err error, + ) + + POST_ReadNets( + readnetsrequest ReadNetsRequest, + ) ( + response *POST_ReadNetsResponses, + err error, + ) + + POST_ReadNics( + readnicsrequest ReadNicsRequest, + ) ( + response *POST_ReadNicsResponses, + err error, + ) + + POST_ReadPolicies( + readpoliciesrequest ReadPoliciesRequest, + ) ( + response *POST_ReadPoliciesResponses, + err error, + ) + + POST_ReadPrefixLists( + readprefixlistsrequest ReadPrefixListsRequest, + ) ( + response *POST_ReadPrefixListsResponses, + err error, + ) + + POST_ReadProductTypes( + readproducttypesrequest ReadProductTypesRequest, + ) ( + response *POST_ReadProductTypesResponses, + err error, + ) + + POST_ReadPublicCatalog( + readpubliccatalogrequest ReadPublicCatalogRequest, + ) ( + response *POST_ReadPublicCatalogResponses, + err error, + ) + + POST_ReadPublicIpRanges( + readpubliciprangesrequest ReadPublicIpRangesRequest, + ) ( + response *POST_ReadPublicIpRangesResponses, + err error, + ) + + POST_ReadPublicIps( + readpublicipsrequest ReadPublicIpsRequest, + ) ( + response *POST_ReadPublicIpsResponses, + err error, + ) + + POST_ReadQuotas( + readquotasrequest ReadQuotasRequest, + ) ( + response *POST_ReadQuotasResponses, + err error, + ) + + POST_ReadRegionConfig( + readregionconfigrequest ReadRegionConfigRequest, + ) ( + response *POST_ReadRegionConfigResponses, + err error, + ) + + POST_ReadRegions( + readregionsrequest ReadRegionsRequest, + ) ( + response *POST_ReadRegionsResponses, + err error, + ) + + POST_ReadReservedVmOffers( + readreservedvmoffersrequest ReadReservedVmOffersRequest, + ) ( + response *POST_ReadReservedVmOffersResponses, + err error, + ) + + POST_ReadReservedVms( + readreservedvmsrequest ReadReservedVmsRequest, + ) ( + response *POST_ReadReservedVmsResponses, + err error, + ) + + POST_ReadRouteTables( + readroutetablesrequest ReadRouteTablesRequest, + ) ( + response *POST_ReadRouteTablesResponses, + err error, + ) + + POST_ReadSecurityGroups( + readsecuritygroupsrequest ReadSecurityGroupsRequest, + ) ( + response *POST_ReadSecurityGroupsResponses, + err error, + ) + + POST_ReadServerCertificates( + readservercertificatesrequest ReadServerCertificatesRequest, + ) ( + response *POST_ReadServerCertificatesResponses, + err error, + ) + + POST_ReadSnapshotExportTasks( + readsnapshotexporttasksrequest ReadSnapshotExportTasksRequest, + ) ( + response *POST_ReadSnapshotExportTasksResponses, + err error, + ) + + POST_ReadSnapshots( + readsnapshotsrequest ReadSnapshotsRequest, + ) ( + response *POST_ReadSnapshotsResponses, + err error, + ) + + POST_ReadSubnets( + readsubnetsrequest ReadSubnetsRequest, + ) ( + response *POST_ReadSubnetsResponses, + err error, + ) + + POST_ReadSubregions( + readsubregionsrequest ReadSubregionsRequest, + ) ( + response *POST_ReadSubregionsResponses, + err error, + ) + + POST_ReadTags( + readtagsrequest ReadTagsRequest, + ) ( + response *POST_ReadTagsResponses, + err error, + ) + + POST_ReadUserGroups( + readusergroupsrequest ReadUserGroupsRequest, + ) ( + response *POST_ReadUserGroupsResponses, + err error, + ) + + POST_ReadUsers( + readusersrequest ReadUsersRequest, + ) ( + response *POST_ReadUsersResponses, + err error, + ) + + POST_ReadVirtualGateways( + readvirtualgatewaysrequest ReadVirtualGatewaysRequest, + ) ( + response *POST_ReadVirtualGatewaysResponses, + err error, + ) + POST_ReadVmTypes( + readvmtypesrequest ReadVmTypesRequest, + ) ( + response *POST_ReadVmTypesResponses, + err error, + ) + + POST_ReadVms( + readvmsrequest ReadVmsRequest, + ) ( + response *POST_ReadVmsResponses, + err error, + ) + + POST_ReadVmsHealth( + readvmshealthrequest ReadVmsHealthRequest, + ) ( + response *POST_ReadVmsHealthResponses, + err error, + ) + + POST_ReadVmsState( + readvmsstaterequest ReadVmsStateRequest, + ) ( + response *POST_ReadVmsStateResponses, + err error, + ) + + POST_ReadVolumes( + readvolumesrequest ReadVolumesRequest, + ) ( + response *POST_ReadVolumesResponses, + err error, + ) + + POST_ReadVpnConnections( + readvpnconnectionsrequest ReadVpnConnectionsRequest, + ) ( + response *POST_ReadVpnConnectionsResponses, + err error, + ) + + POST_RebootVms( + rebootvmsrequest RebootVmsRequest, + ) ( + response *POST_RebootVmsResponses, + err error, + ) + + POST_RegisterUserInUserGroup( + registeruserinusergrouprequest RegisterUserInUserGroupRequest, + ) ( + response *POST_RegisterUserInUserGroupResponses, + err error, + ) + + POST_RegisterVmsInLoadBalancer( + registervmsinloadbalancerrequest RegisterVmsInLoadBalancerRequest, + ) ( + response *POST_RegisterVmsInLoadBalancerResponses, + err error, + ) + + POST_RejectNetPeering( + rejectnetpeeringrequest RejectNetPeeringRequest, + ) ( + response *POST_RejectNetPeeringResponses, + err error, + ) + + POST_ResetAccountPassword( + resetaccountpasswordrequest ResetAccountPasswordRequest, + ) ( + response *POST_ResetAccountPasswordResponses, + err error, + ) + + POST_SendResetPasswordEmail( + sendresetpasswordemailrequest SendResetPasswordEmailRequest, + ) ( + response *POST_SendResetPasswordEmailResponses, + err error, + ) + + POST_StartVms( + startvmsrequest StartVmsRequest, + ) ( + response *POST_StartVmsResponses, + err error, + ) + + POST_StopVms( + stopvmsrequest StopVmsRequest, + ) ( + response *POST_StopVmsResponses, + err error, + ) + + POST_UnlinkInternetService( + unlinkinternetservicerequest UnlinkInternetServiceRequest, + ) ( + response *POST_UnlinkInternetServiceResponses, + err error, + ) + + POST_UnlinkNic( + unlinknicrequest UnlinkNicRequest, + ) ( + response *POST_UnlinkNicResponses, + err error, + ) + + POST_UnlinkPolicy( + unlinkpolicyrequest UnlinkPolicyRequest, + ) ( + response *POST_UnlinkPolicyResponses, + err error, + ) + + POST_UnlinkPrivateIps( + unlinkprivateipsrequest UnlinkPrivateIpsRequest, + ) ( + response *POST_UnlinkPrivateIpsResponses, + err error, + ) + + POST_UnlinkPublicIp( + unlinkpubliciprequest UnlinkPublicIpRequest, + ) ( + response *POST_UnlinkPublicIpResponses, + err error, + ) + + POST_UnlinkRouteTable( + unlinkroutetablerequest UnlinkRouteTableRequest, + ) ( + response *POST_UnlinkRouteTableResponses, + err error, + ) + + POST_UnlinkVirtualGateway( + unlinkvirtualgatewayrequest UnlinkVirtualGatewayRequest, + ) ( + response *POST_UnlinkVirtualGatewayResponses, + err error, + ) + + POST_UnlinkVolume( + unlinkvolumerequest UnlinkVolumeRequest, + ) ( + response *POST_UnlinkVolumeResponses, + err error, + ) + + POST_UpdateAccount( + updateaccountrequest UpdateAccountRequest, + ) ( + response *POST_UpdateAccountResponses, + err error, + ) + + POST_UpdateApiKey( + updateapikeyrequest UpdateApiKeyRequest, + ) ( + response *POST_UpdateApiKeyResponses, + err error, + ) + + POST_UpdateHealthCheck( + updatehealthcheckrequest UpdateHealthCheckRequest, + ) ( + response *POST_UpdateHealthCheckResponses, + err error, + ) + + POST_UpdateImage( + updateimagerequest UpdateImageRequest, + ) ( + response *POST_UpdateImageResponses, + err error, + ) + + POST_UpdateKeypair( + updatekeypairrequest UpdateKeypairRequest, + ) ( + response *POST_UpdateKeypairResponses, + err error, + ) + + POST_UpdateListenerRule( + updatelistenerrulerequest UpdateListenerRuleRequest, + ) ( + response *POST_UpdateListenerRuleResponses, + err error, + ) + + POST_UpdateLoadBalancer( + updateloadbalancerrequest UpdateLoadBalancerRequest, + ) ( + response *POST_UpdateLoadBalancerResponses, + err error, + ) + + POST_UpdateNet( + updatenetrequest UpdateNetRequest, + ) ( + response *POST_UpdateNetResponses, + err error, + ) + + POST_UpdateNetAccessPoint( + updatenetaccesspointrequest UpdateNetAccessPointRequest, + ) ( + response *POST_UpdateNetAccessPointResponses, + err error, + ) + + POST_UpdateNic( + updatenicrequest UpdateNicRequest, + ) ( + response *POST_UpdateNicResponses, + err error, + ) + + POST_UpdateRoute( + updaterouterequest UpdateRouteRequest, + ) ( + response *POST_UpdateRouteResponses, + err error, + ) + + POST_UpdateRoutePropagation( + updateroutepropagationrequest UpdateRoutePropagationRequest, + ) ( + response *POST_UpdateRoutePropagationResponses, + err error, + ) + + POST_UpdateServerCertificate( + updateservercertificaterequest UpdateServerCertificateRequest, + ) ( + response *POST_UpdateServerCertificateResponses, + err error, + ) + + POST_UpdateSnapshot( + updatesnapshotrequest UpdateSnapshotRequest, + ) ( + response *POST_UpdateSnapshotResponses, + err error, + ) + + POST_UpdateUser( + updateuserrequest UpdateUserRequest, + ) ( + response *POST_UpdateUserResponses, + err error, + ) + + POST_UpdateUserGroup( + updateusergrouprequest UpdateUserGroupRequest, + ) ( + response *POST_UpdateUserGroupResponses, + err error, + ) + + POST_UpdateVm( + updatevmrequest UpdateVmRequest, + ) ( + response *POST_UpdateVmResponses, + err error, + ) +} diff --git a/vendor/github.com/outscale/osc-go/oapi/provider.go b/vendor/github.com/outscale/osc-go/oapi/provider.go new file mode 100644 index 000000000..0ae1b4d3b --- /dev/null +++ b/vendor/github.com/outscale/osc-go/oapi/provider.go @@ -0,0 +1,527 @@ +// GENERATED FILE: DO NOT EDIT! + +package oapi + +// To create a server, first write a class that implements this interface. +// Then pass an instance of it to Initialize(). +type Provider interface { + + // + POST_AcceptNetPeering(parameters *POST_AcceptNetPeeringParameters, responses *POST_AcceptNetPeeringResponses) (err error) + + // + POST_AuthenticateAccount(parameters *POST_AuthenticateAccountParameters, responses *POST_AuthenticateAccountResponses) (err error) + + // + POST_CheckSignature(parameters *POST_CheckSignatureParameters, responses *POST_CheckSignatureResponses) (err error) + + // + POST_CopyAccount(parameters *POST_CopyAccountParameters, responses *POST_CopyAccountResponses) (err error) + + // + POST_CreateAccount(parameters *POST_CreateAccountParameters, responses *POST_CreateAccountResponses) (err error) + + // + POST_CreateApiKey(parameters *POST_CreateApiKeyParameters, responses *POST_CreateApiKeyResponses) (err error) + + // + POST_CreateClientGateway(parameters *POST_CreateClientGatewayParameters, responses *POST_CreateClientGatewayResponses) (err error) + + // + POST_CreateDhcpOptions(parameters *POST_CreateDhcpOptionsParameters, responses *POST_CreateDhcpOptionsResponses) (err error) + + // + POST_CreateDirectLink(parameters *POST_CreateDirectLinkParameters, responses *POST_CreateDirectLinkResponses) (err error) + + // + POST_CreateDirectLinkInterface(parameters *POST_CreateDirectLinkInterfaceParameters, responses *POST_CreateDirectLinkInterfaceResponses) (err error) + + // + POST_CreateImage(parameters *POST_CreateImageParameters, responses *POST_CreateImageResponses) (err error) + + // + POST_CreateImageExportTask(parameters *POST_CreateImageExportTaskParameters, responses *POST_CreateImageExportTaskResponses) (err error) + + // + POST_CreateInternetService(parameters *POST_CreateInternetServiceParameters, responses *POST_CreateInternetServiceResponses) (err error) + + // + POST_CreateKeypair(parameters *POST_CreateKeypairParameters, responses *POST_CreateKeypairResponses) (err error) + + // + POST_CreateListenerRule(parameters *POST_CreateListenerRuleParameters, responses *POST_CreateListenerRuleResponses) (err error) + + // + POST_CreateLoadBalancer(parameters *POST_CreateLoadBalancerParameters, responses *POST_CreateLoadBalancerResponses) (err error) + + // + POST_CreateLoadBalancerListeners(parameters *POST_CreateLoadBalancerListenersParameters, responses *POST_CreateLoadBalancerListenersResponses) (err error) + + // + POST_CreateLoadBalancerPolicy(parameters *POST_CreateLoadBalancerPolicyParameters, responses *POST_CreateLoadBalancerPolicyResponses) (err error) + + // + POST_CreateNatService(parameters *POST_CreateNatServiceParameters, responses *POST_CreateNatServiceResponses) (err error) + + // + POST_CreateNet(parameters *POST_CreateNetParameters, responses *POST_CreateNetResponses) (err error) + + // + POST_CreateNetAccessPoint(parameters *POST_CreateNetAccessPointParameters, responses *POST_CreateNetAccessPointResponses) (err error) + + // + POST_CreateNetPeering(parameters *POST_CreateNetPeeringParameters, responses *POST_CreateNetPeeringResponses) (err error) + + // + POST_CreateNic(parameters *POST_CreateNicParameters, responses *POST_CreateNicResponses) (err error) + + // + POST_CreatePolicy(parameters *POST_CreatePolicyParameters, responses *POST_CreatePolicyResponses) (err error) + + // + POST_CreatePublicIp(parameters *POST_CreatePublicIpParameters, responses *POST_CreatePublicIpResponses) (err error) + + // + POST_CreateRoute(parameters *POST_CreateRouteParameters, responses *POST_CreateRouteResponses) (err error) + + // + POST_CreateRouteTable(parameters *POST_CreateRouteTableParameters, responses *POST_CreateRouteTableResponses) (err error) + + // + POST_CreateSecurityGroup(parameters *POST_CreateSecurityGroupParameters, responses *POST_CreateSecurityGroupResponses) (err error) + + // + POST_CreateSecurityGroupRule(parameters *POST_CreateSecurityGroupRuleParameters, responses *POST_CreateSecurityGroupRuleResponses) (err error) + + // + POST_CreateServerCertificate(parameters *POST_CreateServerCertificateParameters, responses *POST_CreateServerCertificateResponses) (err error) + + // + POST_CreateSnapshot(parameters *POST_CreateSnapshotParameters, responses *POST_CreateSnapshotResponses) (err error) + + // + POST_CreateSnapshotExportTask(parameters *POST_CreateSnapshotExportTaskParameters, responses *POST_CreateSnapshotExportTaskResponses) (err error) + + // + POST_CreateSubnet(parameters *POST_CreateSubnetParameters, responses *POST_CreateSubnetResponses) (err error) + + // + POST_CreateTags(parameters *POST_CreateTagsParameters, responses *POST_CreateTagsResponses) (err error) + + // + POST_CreateUser(parameters *POST_CreateUserParameters, responses *POST_CreateUserResponses) (err error) + + // + POST_CreateUserGroup(parameters *POST_CreateUserGroupParameters, responses *POST_CreateUserGroupResponses) (err error) + + // + POST_CreateVirtualGateway(parameters *POST_CreateVirtualGatewayParameters, responses *POST_CreateVirtualGatewayResponses) (err error) + + // + POST_CreateVms(parameters *POST_CreateVmsParameters, responses *POST_CreateVmsResponses) (err error) + + // + POST_CreateVolume(parameters *POST_CreateVolumeParameters, responses *POST_CreateVolumeResponses) (err error) + + // + POST_CreateVpnConnection(parameters *POST_CreateVpnConnectionParameters, responses *POST_CreateVpnConnectionResponses) (err error) + + // + POST_CreateVpnConnectionRoute(parameters *POST_CreateVpnConnectionRouteParameters, responses *POST_CreateVpnConnectionRouteResponses) (err error) + + // + POST_DeleteApiKey(parameters *POST_DeleteApiKeyParameters, responses *POST_DeleteApiKeyResponses) (err error) + + // + POST_DeleteClientGateway(parameters *POST_DeleteClientGatewayParameters, responses *POST_DeleteClientGatewayResponses) (err error) + + // + POST_DeleteDhcpOptions(parameters *POST_DeleteDhcpOptionsParameters, responses *POST_DeleteDhcpOptionsResponses) (err error) + + // + POST_DeleteDirectLink(parameters *POST_DeleteDirectLinkParameters, responses *POST_DeleteDirectLinkResponses) (err error) + + // + POST_DeleteDirectLinkInterface(parameters *POST_DeleteDirectLinkInterfaceParameters, responses *POST_DeleteDirectLinkInterfaceResponses) (err error) + + // + POST_DeleteExportTask(parameters *POST_DeleteExportTaskParameters, responses *POST_DeleteExportTaskResponses) (err error) + + // + POST_DeleteImage(parameters *POST_DeleteImageParameters, responses *POST_DeleteImageResponses) (err error) + + // + POST_DeleteInternetService(parameters *POST_DeleteInternetServiceParameters, responses *POST_DeleteInternetServiceResponses) (err error) + + // + POST_DeleteKeypair(parameters *POST_DeleteKeypairParameters, responses *POST_DeleteKeypairResponses) (err error) + + // + POST_DeleteListenerRule(parameters *POST_DeleteListenerRuleParameters, responses *POST_DeleteListenerRuleResponses) (err error) + + // + POST_DeleteLoadBalancer(parameters *POST_DeleteLoadBalancerParameters, responses *POST_DeleteLoadBalancerResponses) (err error) + + // + POST_DeleteLoadBalancerListeners(parameters *POST_DeleteLoadBalancerListenersParameters, responses *POST_DeleteLoadBalancerListenersResponses) (err error) + + // + POST_DeleteLoadBalancerPolicy(parameters *POST_DeleteLoadBalancerPolicyParameters, responses *POST_DeleteLoadBalancerPolicyResponses) (err error) + + // + POST_DeleteNatService(parameters *POST_DeleteNatServiceParameters, responses *POST_DeleteNatServiceResponses) (err error) + + // + POST_DeleteNet(parameters *POST_DeleteNetParameters, responses *POST_DeleteNetResponses) (err error) + + // + POST_DeleteNetAccessPoints(parameters *POST_DeleteNetAccessPointsParameters, responses *POST_DeleteNetAccessPointsResponses) (err error) + + // + POST_DeleteNetPeering(parameters *POST_DeleteNetPeeringParameters, responses *POST_DeleteNetPeeringResponses) (err error) + + // + POST_DeleteNic(parameters *POST_DeleteNicParameters, responses *POST_DeleteNicResponses) (err error) + + // + POST_DeletePolicy(parameters *POST_DeletePolicyParameters, responses *POST_DeletePolicyResponses) (err error) + + // + POST_DeletePublicIp(parameters *POST_DeletePublicIpParameters, responses *POST_DeletePublicIpResponses) (err error) + + // + POST_DeleteRoute(parameters *POST_DeleteRouteParameters, responses *POST_DeleteRouteResponses) (err error) + + // + POST_DeleteRouteTable(parameters *POST_DeleteRouteTableParameters, responses *POST_DeleteRouteTableResponses) (err error) + + // + POST_DeleteSecurityGroup(parameters *POST_DeleteSecurityGroupParameters, responses *POST_DeleteSecurityGroupResponses) (err error) + + // + POST_DeleteSecurityGroupRule(parameters *POST_DeleteSecurityGroupRuleParameters, responses *POST_DeleteSecurityGroupRuleResponses) (err error) + + // + POST_DeleteServerCertificate(parameters *POST_DeleteServerCertificateParameters, responses *POST_DeleteServerCertificateResponses) (err error) + + // + POST_DeleteSnapshot(parameters *POST_DeleteSnapshotParameters, responses *POST_DeleteSnapshotResponses) (err error) + + // + POST_DeleteSubnet(parameters *POST_DeleteSubnetParameters, responses *POST_DeleteSubnetResponses) (err error) + + // + POST_DeleteTags(parameters *POST_DeleteTagsParameters, responses *POST_DeleteTagsResponses) (err error) + + // + POST_DeleteUser(parameters *POST_DeleteUserParameters, responses *POST_DeleteUserResponses) (err error) + + // + POST_DeleteUserGroup(parameters *POST_DeleteUserGroupParameters, responses *POST_DeleteUserGroupResponses) (err error) + + // + POST_DeleteVirtualGateway(parameters *POST_DeleteVirtualGatewayParameters, responses *POST_DeleteVirtualGatewayResponses) (err error) + + // + POST_DeleteVms(parameters *POST_DeleteVmsParameters, responses *POST_DeleteVmsResponses) (err error) + + // + POST_DeleteVolume(parameters *POST_DeleteVolumeParameters, responses *POST_DeleteVolumeResponses) (err error) + + // + POST_DeleteVpnConnection(parameters *POST_DeleteVpnConnectionParameters, responses *POST_DeleteVpnConnectionResponses) (err error) + + // + POST_DeleteVpnConnectionRoute(parameters *POST_DeleteVpnConnectionRouteParameters, responses *POST_DeleteVpnConnectionRouteResponses) (err error) + + // + POST_DeregisterUserInUserGroup(parameters *POST_DeregisterUserInUserGroupParameters, responses *POST_DeregisterUserInUserGroupResponses) (err error) + + // + POST_DeregisterVmsInLoadBalancer(parameters *POST_DeregisterVmsInLoadBalancerParameters, responses *POST_DeregisterVmsInLoadBalancerResponses) (err error) + + // + POST_LinkInternetService(parameters *POST_LinkInternetServiceParameters, responses *POST_LinkInternetServiceResponses) (err error) + + // + POST_LinkNic(parameters *POST_LinkNicParameters, responses *POST_LinkNicResponses) (err error) + + // + POST_LinkPolicy(parameters *POST_LinkPolicyParameters, responses *POST_LinkPolicyResponses) (err error) + + // + POST_LinkPrivateIps(parameters *POST_LinkPrivateIpsParameters, responses *POST_LinkPrivateIpsResponses) (err error) + + // + POST_LinkPublicIp(parameters *POST_LinkPublicIpParameters, responses *POST_LinkPublicIpResponses) (err error) + + // + POST_LinkRouteTable(parameters *POST_LinkRouteTableParameters, responses *POST_LinkRouteTableResponses) (err error) + + // + POST_LinkVirtualGateway(parameters *POST_LinkVirtualGatewayParameters, responses *POST_LinkVirtualGatewayResponses) (err error) + + // + POST_LinkVolume(parameters *POST_LinkVolumeParameters, responses *POST_LinkVolumeResponses) (err error) + + // + POST_PurchaseReservedVmsOffer(parameters *POST_PurchaseReservedVmsOfferParameters, responses *POST_PurchaseReservedVmsOfferResponses) (err error) + + // + POST_ReadAccount(parameters *POST_ReadAccountParameters, responses *POST_ReadAccountResponses) (err error) + + // + POST_ReadAccountConsumption(parameters *POST_ReadAccountConsumptionParameters, responses *POST_ReadAccountConsumptionResponses) (err error) + + // + POST_ReadAdminPassword(parameters *POST_ReadAdminPasswordParameters, responses *POST_ReadAdminPasswordResponses) (err error) + + // + POST_ReadApiKeys(parameters *POST_ReadApiKeysParameters, responses *POST_ReadApiKeysResponses) (err error) + + // + POST_ReadApiLogs(parameters *POST_ReadApiLogsParameters, responses *POST_ReadApiLogsResponses) (err error) + + // + POST_ReadBillableDigest(parameters *POST_ReadBillableDigestParameters, responses *POST_ReadBillableDigestResponses) (err error) + + // + POST_ReadCatalog(parameters *POST_ReadCatalogParameters, responses *POST_ReadCatalogResponses) (err error) + + // + POST_ReadClientGateways(parameters *POST_ReadClientGatewaysParameters, responses *POST_ReadClientGatewaysResponses) (err error) + + // + POST_ReadConsoleOutput(parameters *POST_ReadConsoleOutputParameters, responses *POST_ReadConsoleOutputResponses) (err error) + + // + POST_ReadDhcpOptions(parameters *POST_ReadDhcpOptionsParameters, responses *POST_ReadDhcpOptionsResponses) (err error) + + // + POST_ReadDirectLinkInterfaces(parameters *POST_ReadDirectLinkInterfacesParameters, responses *POST_ReadDirectLinkInterfacesResponses) (err error) + + // + POST_ReadDirectLinks(parameters *POST_ReadDirectLinksParameters, responses *POST_ReadDirectLinksResponses) (err error) + + // + POST_ReadImageExportTasks(parameters *POST_ReadImageExportTasksParameters, responses *POST_ReadImageExportTasksResponses) (err error) + + // + POST_ReadImages(parameters *POST_ReadImagesParameters, responses *POST_ReadImagesResponses) (err error) + + // + POST_ReadInternetServices(parameters *POST_ReadInternetServicesParameters, responses *POST_ReadInternetServicesResponses) (err error) + + // + POST_ReadKeypairs(parameters *POST_ReadKeypairsParameters, responses *POST_ReadKeypairsResponses) (err error) + + // + POST_ReadListenerRules(parameters *POST_ReadListenerRulesParameters, responses *POST_ReadListenerRulesResponses) (err error) + + // + POST_ReadLoadBalancers(parameters *POST_ReadLoadBalancersParameters, responses *POST_ReadLoadBalancersResponses) (err error) + + // + POST_ReadLocations(parameters *POST_ReadLocationsParameters, responses *POST_ReadLocationsResponses) (err error) + + // + POST_ReadNatServices(parameters *POST_ReadNatServicesParameters, responses *POST_ReadNatServicesResponses) (err error) + + // + POST_ReadNetAccessPointServices(parameters *POST_ReadNetAccessPointServicesParameters, responses *POST_ReadNetAccessPointServicesResponses) (err error) + + // + POST_ReadNetAccessPoints(parameters *POST_ReadNetAccessPointsParameters, responses *POST_ReadNetAccessPointsResponses) (err error) + + // + POST_ReadNetPeerings(parameters *POST_ReadNetPeeringsParameters, responses *POST_ReadNetPeeringsResponses) (err error) + + // + POST_ReadNets(parameters *POST_ReadNetsParameters, responses *POST_ReadNetsResponses) (err error) + + // + POST_ReadNics(parameters *POST_ReadNicsParameters, responses *POST_ReadNicsResponses) (err error) + + // + POST_ReadPolicies(parameters *POST_ReadPoliciesParameters, responses *POST_ReadPoliciesResponses) (err error) + + // + POST_ReadPrefixLists(parameters *POST_ReadPrefixListsParameters, responses *POST_ReadPrefixListsResponses) (err error) + + // + POST_ReadProductTypes(parameters *POST_ReadProductTypesParameters, responses *POST_ReadProductTypesResponses) (err error) + + // + POST_ReadPublicCatalog(parameters *POST_ReadPublicCatalogParameters, responses *POST_ReadPublicCatalogResponses) (err error) + + // + POST_ReadPublicIpRanges(parameters *POST_ReadPublicIpRangesParameters, responses *POST_ReadPublicIpRangesResponses) (err error) + + // + POST_ReadPublicIps(parameters *POST_ReadPublicIpsParameters, responses *POST_ReadPublicIpsResponses) (err error) + + // + POST_ReadQuotas(parameters *POST_ReadQuotasParameters, responses *POST_ReadQuotasResponses) (err error) + + // + POST_ReadRegionConfig(parameters *POST_ReadRegionConfigParameters, responses *POST_ReadRegionConfigResponses) (err error) + + // + POST_ReadRegions(parameters *POST_ReadRegionsParameters, responses *POST_ReadRegionsResponses) (err error) + + // + POST_ReadReservedVmOffers(parameters *POST_ReadReservedVmOffersParameters, responses *POST_ReadReservedVmOffersResponses) (err error) + + // + POST_ReadReservedVms(parameters *POST_ReadReservedVmsParameters, responses *POST_ReadReservedVmsResponses) (err error) + + // + POST_ReadRouteTables(parameters *POST_ReadRouteTablesParameters, responses *POST_ReadRouteTablesResponses) (err error) + + // + POST_ReadSecurityGroups(parameters *POST_ReadSecurityGroupsParameters, responses *POST_ReadSecurityGroupsResponses) (err error) + + // + POST_ReadServerCertificates(parameters *POST_ReadServerCertificatesParameters, responses *POST_ReadServerCertificatesResponses) (err error) + + // + POST_ReadSnapshotExportTasks(parameters *POST_ReadSnapshotExportTasksParameters, responses *POST_ReadSnapshotExportTasksResponses) (err error) + + // + POST_ReadSnapshots(parameters *POST_ReadSnapshotsParameters, responses *POST_ReadSnapshotsResponses) (err error) + + // + POST_ReadSubnets(parameters *POST_ReadSubnetsParameters, responses *POST_ReadSubnetsResponses) (err error) + + // + POST_ReadSubregions(parameters *POST_ReadSubregionsParameters, responses *POST_ReadSubregionsResponses) (err error) + + // + POST_ReadTags(parameters *POST_ReadTagsParameters, responses *POST_ReadTagsResponses) (err error) + + // + POST_ReadUserGroups(parameters *POST_ReadUserGroupsParameters, responses *POST_ReadUserGroupsResponses) (err error) + + // + POST_ReadUsers(parameters *POST_ReadUsersParameters, responses *POST_ReadUsersResponses) (err error) + + // + POST_ReadVirtualGateways(parameters *POST_ReadVirtualGatewaysParameters, responses *POST_ReadVirtualGatewaysResponses) (err error) + + // + POST_ReadVmTypes(parameters *POST_ReadVmTypesParameters, responses *POST_ReadVmTypesResponses) (err error) + + // + POST_ReadVms(parameters *POST_ReadVmsParameters, responses *POST_ReadVmsResponses) (err error) + + // + POST_ReadVmsHealth(parameters *POST_ReadVmsHealthParameters, responses *POST_ReadVmsHealthResponses) (err error) + + // + POST_ReadVmsState(parameters *POST_ReadVmsStateParameters, responses *POST_ReadVmsStateResponses) (err error) + + // + POST_ReadVolumes(parameters *POST_ReadVolumesParameters, responses *POST_ReadVolumesResponses) (err error) + + // + POST_ReadVpnConnections(parameters *POST_ReadVpnConnectionsParameters, responses *POST_ReadVpnConnectionsResponses) (err error) + + // + POST_RebootVms(parameters *POST_RebootVmsParameters, responses *POST_RebootVmsResponses) (err error) + + // + POST_RegisterUserInUserGroup(parameters *POST_RegisterUserInUserGroupParameters, responses *POST_RegisterUserInUserGroupResponses) (err error) + + // + POST_RegisterVmsInLoadBalancer(parameters *POST_RegisterVmsInLoadBalancerParameters, responses *POST_RegisterVmsInLoadBalancerResponses) (err error) + + // + POST_RejectNetPeering(parameters *POST_RejectNetPeeringParameters, responses *POST_RejectNetPeeringResponses) (err error) + + // + POST_ResetAccountPassword(parameters *POST_ResetAccountPasswordParameters, responses *POST_ResetAccountPasswordResponses) (err error) + + // + POST_SendResetPasswordEmail(parameters *POST_SendResetPasswordEmailParameters, responses *POST_SendResetPasswordEmailResponses) (err error) + + // + POST_StartVms(parameters *POST_StartVmsParameters, responses *POST_StartVmsResponses) (err error) + + // + POST_StopVms(parameters *POST_StopVmsParameters, responses *POST_StopVmsResponses) (err error) + + // + POST_UnlinkInternetService(parameters *POST_UnlinkInternetServiceParameters, responses *POST_UnlinkInternetServiceResponses) (err error) + + // + POST_UnlinkNic(parameters *POST_UnlinkNicParameters, responses *POST_UnlinkNicResponses) (err error) + + // + POST_UnlinkPolicy(parameters *POST_UnlinkPolicyParameters, responses *POST_UnlinkPolicyResponses) (err error) + + // + POST_UnlinkPrivateIps(parameters *POST_UnlinkPrivateIpsParameters, responses *POST_UnlinkPrivateIpsResponses) (err error) + + // + POST_UnlinkPublicIp(parameters *POST_UnlinkPublicIpParameters, responses *POST_UnlinkPublicIpResponses) (err error) + + // + POST_UnlinkRouteTable(parameters *POST_UnlinkRouteTableParameters, responses *POST_UnlinkRouteTableResponses) (err error) + + // + POST_UnlinkVirtualGateway(parameters *POST_UnlinkVirtualGatewayParameters, responses *POST_UnlinkVirtualGatewayResponses) (err error) + + // + POST_UnlinkVolume(parameters *POST_UnlinkVolumeParameters, responses *POST_UnlinkVolumeResponses) (err error) + + // + POST_UpdateAccount(parameters *POST_UpdateAccountParameters, responses *POST_UpdateAccountResponses) (err error) + + // + POST_UpdateApiKey(parameters *POST_UpdateApiKeyParameters, responses *POST_UpdateApiKeyResponses) (err error) + + // + POST_UpdateHealthCheck(parameters *POST_UpdateHealthCheckParameters, responses *POST_UpdateHealthCheckResponses) (err error) + + // + POST_UpdateImage(parameters *POST_UpdateImageParameters, responses *POST_UpdateImageResponses) (err error) + + // + POST_UpdateKeypair(parameters *POST_UpdateKeypairParameters, responses *POST_UpdateKeypairResponses) (err error) + + // + POST_UpdateListenerRule(parameters *POST_UpdateListenerRuleParameters, responses *POST_UpdateListenerRuleResponses) (err error) + + // + POST_UpdateLoadBalancer(parameters *POST_UpdateLoadBalancerParameters, responses *POST_UpdateLoadBalancerResponses) (err error) + + // + POST_UpdateNet(parameters *POST_UpdateNetParameters, responses *POST_UpdateNetResponses) (err error) + + // + POST_UpdateNetAccessPoint(parameters *POST_UpdateNetAccessPointParameters, responses *POST_UpdateNetAccessPointResponses) (err error) + + // + POST_UpdateNic(parameters *POST_UpdateNicParameters, responses *POST_UpdateNicResponses) (err error) + + // + POST_UpdateRoute(parameters *POST_UpdateRouteParameters, responses *POST_UpdateRouteResponses) (err error) + + // + POST_UpdateRoutePropagation(parameters *POST_UpdateRoutePropagationParameters, responses *POST_UpdateRoutePropagationResponses) (err error) + + // + POST_UpdateServerCertificate(parameters *POST_UpdateServerCertificateParameters, responses *POST_UpdateServerCertificateResponses) (err error) + + // + POST_UpdateSnapshot(parameters *POST_UpdateSnapshotParameters, responses *POST_UpdateSnapshotResponses) (err error) + + // + POST_UpdateUser(parameters *POST_UpdateUserParameters, responses *POST_UpdateUserResponses) (err error) + + // + POST_UpdateUserGroup(parameters *POST_UpdateUserGroupParameters, responses *POST_UpdateUserGroupResponses) (err error) + + // + POST_UpdateVm(parameters *POST_UpdateVmParameters, responses *POST_UpdateVmResponses) (err error) +} diff --git a/vendor/github.com/outscale/osc-go/oapi/types.go b/vendor/github.com/outscale/osc-go/oapi/types.go new file mode 100644 index 000000000..81e9539de --- /dev/null +++ b/vendor/github.com/outscale/osc-go/oapi/types.go @@ -0,0 +1,5660 @@ +// GENERATED FILE: DO NOT EDIT! + +package oapi + +// Types used by the API. +// implements the service definition of AcceptNetPeeringRequest +type AcceptNetPeeringRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NetPeeringId string `json:"NetPeeringId,omitempty"` +} + +// implements the service definition of AcceptNetPeeringResponse +type AcceptNetPeeringResponse struct { + NetPeering NetPeering `json:"NetPeering,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of AccepterNet +type AccepterNet struct { + AccountId string `json:"AccountId,omitempty"` + IpRange string `json:"IpRange,omitempty"` + NetId string `json:"NetId,omitempty"` +} + +// implements the service definition of AccessLog +type AccessLog struct { + IsEnabled bool `json:"IsEnabled,omitempty"` + OsuBucketName string `json:"OsuBucketName,omitempty"` + OsuBucketPrefix string `json:"OsuBucketPrefix,omitempty"` + PublicationInterval int64 `json:"PublicationInterval,omitempty"` +} + +// implements the service definition of Account +type Account struct { + AccountId string `json:"AccountId,omitempty"` + City string `json:"City,omitempty"` + CompanyName string `json:"CompanyName,omitempty"` + Country string `json:"Country,omitempty"` + CustomerId string `json:"CustomerId,omitempty"` + Email string `json:"Email,omitempty"` + FirstName string `json:"FirstName,omitempty"` + JobTitle string `json:"JobTitle,omitempty"` + LastName string `json:"LastName,omitempty"` + Mobile string `json:"Mobile,omitempty"` + Phone string `json:"Phone,omitempty"` + StateProvince string `json:"StateProvince,omitempty"` + VatNumber string `json:"VatNumber,omitempty"` + ZipCode string `json:"ZipCode,omitempty"` +} + +// implements the service definition of ApiKey +type ApiKey struct { + AccountId string `json:"AccountId,omitempty"` + ApiKeyId string `json:"ApiKeyId,omitempty"` + SecretKey string `json:"SecretKey,omitempty"` + State string `json:"State,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of ApplicationStickyCookiePolicy +type ApplicationStickyCookiePolicy struct { + CookieName string `json:"CookieName,omitempty"` + PolicyName string `json:"PolicyName,omitempty"` +} + +// implements the service definition of Attribute +type Attribute struct { + Key string `json:"Key,omitempty"` + Value string `json:"Value,omitempty"` +} + +// implements the service definition of AuthenticateAccountRequest +type AuthenticateAccountRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Login string `json:"Login,omitempty"` + Password string `json:"Password,omitempty"` +} + +// implements the service definition of AuthenticateAccountResponse +type AuthenticateAccountResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of BackendVmsHealth +type BackendVmsHealth struct { + Description string `json:"Description,omitempty"` + State string `json:"State,omitempty"` + StateReason string `json:"StateReason,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of BlockDeviceMapping +type BlockDeviceMapping struct { + Bsu Bsu `json:"Bsu,omitempty"` + DeviceName string `json:"DeviceName,omitempty"` + NoDevice string `json:"NoDevice,omitempty"` + VirtualDeviceName string `json:"VirtualDeviceName,omitempty"` +} + +// implements the service definition of BlockDeviceMappingCreated +type BlockDeviceMappingCreated struct { + Bsu BsuCreated `json:"Bsu,omitempty"` + DeviceName string `json:"DeviceName,omitempty"` +} + +// implements the service definition of BlockDeviceMappingImage +type BlockDeviceMappingImage struct { + Bsu BsuToCreate `json:"Bsu,omitempty"` + DeviceName string `json:"DeviceName,omitempty"` + VirtualDeviceName string `json:"VirtualDeviceName,omitempty"` +} + +// implements the service definition of BlockDeviceMappingVmCreation +type BlockDeviceMappingVmCreation struct { + Bsu BsuToCreate `json:"Bsu,omitempty"` + DeviceName string `json:"DeviceName,omitempty"` + NoDevice string `json:"NoDevice,omitempty"` + VirtualDeviceName string `json:"VirtualDeviceName,omitempty"` +} + +// implements the service definition of BlockDeviceMappingVmUpdate +type BlockDeviceMappingVmUpdate struct { + Bsu BsuToUpdateVm `json:"Bsu,omitempty"` + DeviceName string `json:"DeviceName,omitempty"` + NoDevice string `json:"NoDevice,omitempty"` + VirtualDeviceName string `json:"VirtualDeviceName,omitempty"` +} + +// implements the service definition of Bsu +type Bsu struct { + DeleteOnVmDeletion *bool `json:"DeleteOnVmDeletion,omitempty"` + Iops int64 `json:"Iops,omitempty"` + LinkDate string `json:"LinkDate,omitempty"` + SnapshotId string `json:"SnapshotId,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` + VolumeSize int64 `json:"VolumeSize,omitempty"` + VolumeType string `json:"VolumeType,omitempty"` +} + +// implements the service definition of BsuCreated +type BsuCreated struct { + DeleteOnVmDeletion *bool `json:"DeleteOnVmDeletion,omitempty"` + LinkDate string `json:"LinkDate,omitempty"` + State string `json:"State,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` +} + +// implements the service definition of BsuToCreate +type BsuToCreate struct { + DeleteOnVmDeletion *bool `json:"DeleteOnVmDeletion,omitempty"` + Iops int64 `json:"Iops,omitempty"` + SnapshotId string `json:"SnapshotId,omitempty"` + VolumeSize int64 `json:"VolumeSize,omitempty"` + VolumeType string `json:"VolumeType,omitempty"` +} + +// implements the service definition of BsuToUpdateVm +type BsuToUpdateVm struct { + DeleteOnVmDeletion *bool `json:"DeleteOnVmDeletion,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` +} + +// implements the service definition of CatalogAttribute +type CatalogAttribute struct { + Key string `json:"Key,omitempty"` + Value string `json:"Value,omitempty"` +} + +// implements the service definition of CatalogEntry +type CatalogEntry struct { + CatalogAttributes []CatalogAttribute `json:"CatalogAttributes,omitempty"` + EntryKey string `json:"EntryKey,omitempty"` + EntryValue string `json:"EntryValue,omitempty"` + ShortDescription string `json:"ShortDescription,omitempty"` +} + +// implements the service definition of Catalog_0 +type Catalog_0 struct { + Domain string `json:"Domain,omitempty"` + Instance string `json:"Instance,omitempty"` + SourceRegionName string `json:"SourceRegionName,omitempty"` + TargetRegionName string `json:"TargetRegionName,omitempty"` + Version string `json:"Version,omitempty"` +} + +// implements the service definition of Catalog_1 +type Catalog_1 struct { + CatalogAttributes []CatalogAttribute `json:"CatalogAttributes,omitempty"` + CatalogEntries []CatalogEntry `json:"CatalogEntries,omitempty"` +} + +// implements the service definition of CheckSignatureRequest +type CheckSignatureRequest struct { + ApiKeyId string `json:"ApiKeyId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + RegionName string `json:"RegionName,omitempty"` + RequestDate string `json:"RequestDate,omitempty"` + Service string `json:"Service,omitempty"` + Signature string `json:"Signature,omitempty"` + SignedContent string `json:"SignedContent,omitempty"` +} + +// implements the service definition of CheckSignatureResponse +type CheckSignatureResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ClientGateway +type ClientGateway struct { + BgpAsn int64 `json:"BgpAsn,omitempty"` + ClientGatewayId string `json:"ClientGatewayId,omitempty"` + ConnectionType string `json:"ConnectionType,omitempty"` + PublicIp string `json:"PublicIp,omitempty"` + State string `json:"State,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of ConsumptionEntries +type ConsumptionEntries struct { + Category string `json:"Category,omitempty"` + ConsumptionValue string `json:"ConsumptionValue,omitempty"` + Entry string `json:"Entry,omitempty"` + ResourceType string `json:"ResourceType,omitempty"` + Service string `json:"Service,omitempty"` + ShortDescription string `json:"ShortDescription,omitempty"` +} + +// implements the service definition of CopyAccountRequest +type CopyAccountRequest struct { + DestinationRegionName string `json:"DestinationRegionName,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + QuotaProfile string `json:"QuotaProfile,omitempty"` +} + +// implements the service definition of CopyAccountResponse +type CopyAccountResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateAccountRequest +type CreateAccountRequest struct { + AccountId string `json:"AccountId,omitempty"` + ApiKeys []ApiKey `json:"ApiKeys,omitempty"` + City string `json:"City,omitempty"` + CompanyName string `json:"CompanyName,omitempty"` + Country string `json:"Country,omitempty"` + CustomerId string `json:"CustomerId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + Email string `json:"Email,omitempty"` + FirstName string `json:"FirstName,omitempty"` + JobTitle string `json:"JobTitle,omitempty"` + LastName string `json:"LastName,omitempty"` + Mobile string `json:"Mobile,omitempty"` + Password string `json:"Password,omitempty"` + Phone string `json:"Phone,omitempty"` + QuotaProfile string `json:"QuotaProfile,omitempty"` + StateProvince string `json:"StateProvince,omitempty"` + VatNumber string `json:"VatNumber,omitempty"` + ZipCode string `json:"ZipCode,omitempty"` +} + +// implements the service definition of CreateAccountResponse +type CreateAccountResponse struct { + Account Account `json:"Account,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateApiKeyRequest +type CreateApiKeyRequest struct { + ApiKeyId string `json:"ApiKeyId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + SecretKey string `json:"SecretKey,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of CreateApiKeyResponse +type CreateApiKeyResponse struct { + ApiKey ApiKey `json:"ApiKey,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateClientGatewayRequest +type CreateClientGatewayRequest struct { + BgpAsn int64 `json:"BgpAsn,omitempty"` + ConnectionType string `json:"ConnectionType,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + PublicIp string `json:"PublicIp,omitempty"` +} + +// implements the service definition of CreateClientGatewayResponse +type CreateClientGatewayResponse struct { + ClientGateway ClientGateway `json:"ClientGateway,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateDhcpOptionsRequest +type CreateDhcpOptionsRequest struct { + DomainName string `json:"DomainName,omitempty"` + DomainNameServers []string `json:"DomainNameServers,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + NtpServers []string `json:"NtpServers,omitempty"` +} + +// implements the service definition of CreateDhcpOptionsResponse +type CreateDhcpOptionsResponse struct { + DhcpOptionsSet DhcpOptionsSet `json:"DhcpOptionsSet,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateDirectLinkInterfaceRequest +type CreateDirectLinkInterfaceRequest struct { + DirectLinkId string `json:"DirectLinkId,omitempty"` + DirectLinkInterface DirectLinkInterface `json:"DirectLinkInterface,omitempty"` + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of CreateDirectLinkInterfaceResponse +type CreateDirectLinkInterfaceResponse struct { + DirectLinkInterface DirectLinkInterfaces `json:"DirectLinkInterface,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateDirectLinkRequest +type CreateDirectLinkRequest struct { + Bandwidth string `json:"Bandwidth,omitempty"` + DirectLinkName string `json:"DirectLinkName,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + Location string `json:"Location,omitempty"` +} + +// implements the service definition of CreateDirectLinkResponse +type CreateDirectLinkResponse struct { + DirectLink DirectLink `json:"DirectLink,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateImageExportTaskRequest +type CreateImageExportTaskRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ImageId string `json:"ImageId,omitempty"` + OsuExport OsuExport `json:"OsuExport,omitempty"` +} + +// implements the service definition of CreateImageExportTaskResponse +type CreateImageExportTaskResponse struct { + ImageExportTask ImageExportTask `json:"ImageExportTask,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateImageRequest +type CreateImageRequest struct { + Architecture string `json:"Architecture,omitempty"` + BlockDeviceMappings []BlockDeviceMappingImage `json:"BlockDeviceMappings,omitempty"` + Description string `json:"Description,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + FileLocation string `json:"FileLocation,omitempty"` + ImageName string `json:"ImageName,omitempty"` + NoReboot bool `json:"NoReboot,omitempty"` + RootDeviceName string `json:"RootDeviceName,omitempty"` + SourceImageId string `json:"SourceImageId,omitempty"` + SourceRegionName string `json:"SourceRegionName,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of CreateImageResponse +type CreateImageResponse struct { + Image Image `json:"Image,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateInternetServiceRequest +type CreateInternetServiceRequest struct { + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of CreateInternetServiceResponse +type CreateInternetServiceResponse struct { + InternetService InternetService `json:"InternetService,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateKeypairRequest +type CreateKeypairRequest struct { + DryRun bool `json:"DryRun,omitempty"` + KeypairName string `json:"KeypairName,omitempty"` + PublicKey string `json:"PublicKey,omitempty"` +} + +// implements the service definition of CreateKeypairResponse +type CreateKeypairResponse struct { + Keypair KeypairCreated `json:"Keypair,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateListenerRuleRequest +type CreateListenerRuleRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Listener LoadBalancerLight `json:"Listener,omitempty"` + ListenerRule ListenerRule `json:"ListenerRule,omitempty"` + VmIds []string `json:"VmIds,omitempty"` +} + +// implements the service definition of CreateListenerRuleResponse +type CreateListenerRuleResponse struct { + ListenerId string `json:"ListenerId,omitempty"` + ListenerRule ListenerRule `json:"ListenerRule,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + VmIds []string `json:"VmIds,omitempty"` +} + +// implements the service definition of CreateLoadBalancerListenersRequest +type CreateLoadBalancerListenersRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Listeners []ListenerForCreation `json:"Listeners,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` +} + +// implements the service definition of CreateLoadBalancerListenersResponse +type CreateLoadBalancerListenersResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateLoadBalancerPolicyRequest +type CreateLoadBalancerPolicyRequest struct { + CookieName string `json:"CookieName,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` + PolicyName string `json:"PolicyName,omitempty"` + PolicyType string `json:"PolicyType,omitempty"` +} + +// implements the service definition of CreateLoadBalancerPolicyResponse +type CreateLoadBalancerPolicyResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateLoadBalancerRequest +type CreateLoadBalancerRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Listeners []ListenerForCreation `json:"Listeners,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` + LoadBalancerType string `json:"LoadBalancerType,omitempty"` + SecurityGroups []string `json:"SecurityGroups,omitempty"` + Subnets []string `json:"Subnets,omitempty"` + SubregionNames []string `json:"SubregionNames,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of CreateLoadBalancerResponse +type CreateLoadBalancerResponse struct { + LoadBalancer LoadBalancer `json:"LoadBalancer,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateNatServiceRequest +type CreateNatServiceRequest struct { + DryRun bool `json:"DryRun,omitempty"` + PublicIpId string `json:"PublicIpId,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` +} + +// implements the service definition of CreateNatServiceResponse +type CreateNatServiceResponse struct { + NatService NatService `json:"NatService,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateNetAccessPointRequest +type CreateNetAccessPointRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NetId string `json:"NetId,omitempty"` + PrefixListName string `json:"PrefixListName,omitempty"` + RouteTableIds []string `json:"RouteTableIds,omitempty"` +} + +// implements the service definition of CreateNetAccessPointResponse +type CreateNetAccessPointResponse struct { + NetAccessPoint NetAccessPoint `json:"NetAccessPoint,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateNetPeeringRequest +type CreateNetPeeringRequest struct { + AccepterNetId string `json:"AccepterNetId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + SourceNetId string `json:"SourceNetId,omitempty"` +} + +// implements the service definition of CreateNetPeeringResponse +type CreateNetPeeringResponse struct { + NetPeering NetPeering `json:"NetPeering,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateNetRequest +type CreateNetRequest struct { + DryRun bool `json:"DryRun,omitempty"` + IpRange string `json:"IpRange,omitempty"` + Tenancy string `json:"Tenancy,omitempty"` +} + +// implements the service definition of CreateNetResponse +type CreateNetResponse struct { + Net Net `json:"Net,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateNicRequest +type CreateNicRequest struct { + Description string `json:"Description,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + PrivateIps []PrivateIpLight `json:"PrivateIps,omitempty"` + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` +} + +// implements the service definition of CreateNicResponse +type CreateNicResponse struct { + Nic Nic `json:"Nic,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreatePolicyRequest +type CreatePolicyRequest struct { + Description string `json:"Description,omitempty"` + Document string `json:"Document,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + Path string `json:"Path,omitempty"` + PolicyName string `json:"PolicyName,omitempty"` +} + +// implements the service definition of CreatePolicyResponse +type CreatePolicyResponse struct { + Policy Policy `json:"Policy,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreatePublicIpRequest +type CreatePublicIpRequest struct { + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of CreatePublicIpResponse +type CreatePublicIpResponse struct { + PublicIp PublicIp `json:"PublicIp,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateRouteRequest +type CreateRouteRequest struct { + DestinationIpRange string `json:"DestinationIpRange,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + GatewayId string `json:"GatewayId,omitempty"` + NatServiceId string `json:"NatServiceId,omitempty"` + NetPeeringId string `json:"NetPeeringId,omitempty"` + NicId string `json:"NicId,omitempty"` + RouteTableId string `json:"RouteTableId,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of CreateRouteResponse +type CreateRouteResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Route Route `json:"Route,omitempty"` +} + +// implements the service definition of CreateRouteTableRequest +type CreateRouteTableRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NetId string `json:"NetId,omitempty"` +} + +// implements the service definition of CreateRouteTableResponse +type CreateRouteTableResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + RouteTable RouteTable `json:"RouteTable,omitempty"` +} + +// implements the service definition of CreateSecurityGroupRequest +type CreateSecurityGroupRequest struct { + Description string `json:"Description,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + NetId string `json:"NetId,omitempty"` + SecurityGroupName string `json:"SecurityGroupName,omitempty"` +} + +// implements the service definition of CreateSecurityGroupResponse +type CreateSecurityGroupResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + SecurityGroup SecurityGroup `json:"SecurityGroup,omitempty"` +} + +// implements the service definition of CreateSecurityGroupRuleRequest +type CreateSecurityGroupRuleRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Flow string `json:"Flow,omitempty"` + FromPortRange int64 `json:"FromPortRange,omitempty"` + IpProtocol string `json:"IpProtocol,omitempty"` + IpRange string `json:"IpRange,omitempty"` + Rules []SecurityGroupRule `json:"Rules,omitempty"` + SecurityGroupAccountIdToLink string `json:"SecurityGroupAccountIdToLink,omitempty"` + SecurityGroupId string `json:"SecurityGroupId,omitempty"` + SecurityGroupNameToLink string `json:"SecurityGroupNameToLink,omitempty"` + ToPortRange int64 `json:"ToPortRange,omitempty"` +} + +// implements the service definition of CreateSecurityGroupRuleResponse +type CreateSecurityGroupRuleResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + SecurityGroupRule SecurityGroupRule `json:"SecurityGroupRule,omitempty"` +} + +// implements the service definition of CreateServerCertificateRequest +type CreateServerCertificateRequest struct { + DryRun bool `json:"DryRun,omitempty"` + PrivateKey string `json:"PrivateKey,omitempty"` + ServerCertificateBody string `json:"ServerCertificateBody,omitempty"` + ServerCertificateChain string `json:"ServerCertificateChain,omitempty"` + ServerCertificateName string `json:"ServerCertificateName,omitempty"` + ServerCertificatePath string `json:"ServerCertificatePath,omitempty"` +} + +// implements the service definition of CreateServerCertificateResponse +type CreateServerCertificateResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + ServerCertificate ServerCertificate `json:"ServerCertificate,omitempty"` +} + +// implements the service definition of CreateSnapshotExportTaskRequest +type CreateSnapshotExportTaskRequest struct { + DryRun bool `json:"DryRun,omitempty"` + OsuExport OsuExport `json:"OsuExport,omitempty"` + SnapshotId string `json:"SnapshotId,omitempty"` +} + +// implements the service definition of CreateSnapshotExportTaskResponse +type CreateSnapshotExportTaskResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + SnapshotExportTask SnapshotExportTask `json:"SnapshotExportTask,omitempty"` +} + +// implements the service definition of CreateSnapshotRequest +type CreateSnapshotRequest struct { + Description string `json:"Description,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + FileLocation string `json:"FileLocation,omitempty"` + SnapshotSize int64 `json:"SnapshotSize,omitempty"` + SourceRegionName string `json:"SourceRegionName,omitempty"` + SourceSnapshotId string `json:"SourceSnapshotId,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` +} + +// implements the service definition of CreateSnapshotResponse +type CreateSnapshotResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Snapshot Snapshot `json:"Snapshot,omitempty"` +} + +// implements the service definition of CreateSubnetRequest +type CreateSubnetRequest struct { + DryRun bool `json:"DryRun,omitempty"` + IpRange string `json:"IpRange,omitempty"` + NetId string `json:"NetId,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` +} + +// implements the service definition of CreateSubnetResponse +type CreateSubnetResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Subnet Subnet `json:"Subnet,omitempty"` +} + +// implements the service definition of CreateTagsRequest +type CreateTagsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ResourceIds []string `json:"ResourceIds,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of CreateTagsResponse +type CreateTagsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of CreateUserGroupRequest +type CreateUserGroupRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Path string `json:"Path,omitempty"` + UserGroupName string `json:"UserGroupName,omitempty"` +} + +// implements the service definition of CreateUserGroupResponse +type CreateUserGroupResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + UserGroup UserGroup `json:"UserGroup,omitempty"` +} + +// implements the service definition of CreateUserRequest +type CreateUserRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Path string `json:"Path,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of CreateUserResponse +type CreateUserResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + User User `json:"User,omitempty"` +} + +// implements the service definition of CreateVirtualGatewayRequest +type CreateVirtualGatewayRequest struct { + ConnectionType string `json:"ConnectionType,omitempty"` + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of CreateVirtualGatewayResponse +type CreateVirtualGatewayResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + VirtualGateway VirtualGateway `json:"VirtualGateway,omitempty"` +} + +// implements the service definition of CreateVmsRequest +type CreateVmsRequest struct { + BlockDeviceMappings []BlockDeviceMappingVmCreation `json:"BlockDeviceMappings,omitempty"` + BsuOptimized bool `json:"BsuOptimized,omitempty"` + ClientToken string `json:"ClientToken,omitempty"` + DeletionProtection bool `json:"DeletionProtection,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + ImageId string `json:"ImageId,omitempty"` + KeypairName string `json:"KeypairName,omitempty"` + MaxVmsCount int64 `json:"MaxVmsCount,omitempty"` + MinVmsCount int64 `json:"MinVmsCount,omitempty"` + Nics []NicForVmCreation `json:"Nics,omitempty"` + Placement Placement `json:"Placement,omitempty"` + PrivateIps []string `json:"PrivateIps,omitempty"` + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + SecurityGroups []string `json:"SecurityGroups,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` + UserData string `json:"UserData,omitempty"` + VmInitiatedShutdownBehavior string `json:"VmInitiatedShutdownBehavior,omitempty"` + VmType string `json:"VmType,omitempty"` +} + +// implements the service definition of CreateVmsResponse +type CreateVmsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Vms []Vm `json:"Vms,omitempty"` +} + +// implements the service definition of CreateVolumeRequest +type CreateVolumeRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Iops int64 `json:"Iops,omitempty"` + Size int64 `json:"Size,omitempty"` + SnapshotId string `json:"SnapshotId,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` + VolumeType string `json:"VolumeType,omitempty"` +} + +// implements the service definition of CreateVolumeResponse +type CreateVolumeResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Volume Volume `json:"Volume,omitempty"` +} + +// implements the service definition of CreateVpnConnectionRequest +type CreateVpnConnectionRequest struct { + ClientGatewayId string `json:"ClientGatewayId,omitempty"` + ConnectionType string `json:"ConnectionType,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + StaticRoutesOnly bool `json:"StaticRoutesOnly,omitempty"` + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` +} + +// implements the service definition of CreateVpnConnectionResponse +type CreateVpnConnectionResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + VpnConnection VpnConnection `json:"VpnConnection,omitempty"` +} + +// implements the service definition of CreateVpnConnectionRouteRequest +type CreateVpnConnectionRouteRequest struct { + DestinationIpRange string `json:"DestinationIpRange,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + VpnConnectionId string `json:"VpnConnectionId,omitempty"` +} + +// implements the service definition of CreateVpnConnectionRouteResponse +type CreateVpnConnectionRouteResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteApiKeyRequest +type DeleteApiKeyRequest struct { + ApiKeyId string `json:"ApiKeyId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of DeleteApiKeyResponse +type DeleteApiKeyResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteClientGatewayRequest +type DeleteClientGatewayRequest struct { + ClientGatewayId string `json:"ClientGatewayId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of DeleteClientGatewayResponse +type DeleteClientGatewayResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteDhcpOptionsRequest +type DeleteDhcpOptionsRequest struct { + DhcpOptionsSetId string `json:"DhcpOptionsSetId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of DeleteDhcpOptionsResponse +type DeleteDhcpOptionsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteDirectLinkInterfaceRequest +type DeleteDirectLinkInterfaceRequest struct { + DirectLinkInterfaceId string `json:"DirectLinkInterfaceId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of DeleteDirectLinkInterfaceResponse +type DeleteDirectLinkInterfaceResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteDirectLinkRequest +type DeleteDirectLinkRequest struct { + DirectLinkId string `json:"DirectLinkId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of DeleteDirectLinkResponse +type DeleteDirectLinkResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteExportTaskRequest +type DeleteExportTaskRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ExportTaskId string `json:"ExportTaskId,omitempty"` +} + +// implements the service definition of DeleteExportTaskResponse +type DeleteExportTaskResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteImageRequest +type DeleteImageRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ImageId string `json:"ImageId,omitempty"` +} + +// implements the service definition of DeleteImageResponse +type DeleteImageResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteInternetServiceRequest +type DeleteInternetServiceRequest struct { + DryRun bool `json:"DryRun,omitempty"` + InternetServiceId string `json:"InternetServiceId,omitempty"` +} + +// implements the service definition of DeleteInternetServiceResponse +type DeleteInternetServiceResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteKeypairRequest +type DeleteKeypairRequest struct { + DryRun bool `json:"DryRun,omitempty"` + KeypairName string `json:"KeypairName,omitempty"` +} + +// implements the service definition of DeleteKeypairResponse +type DeleteKeypairResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteListenerRuleRequest +type DeleteListenerRuleRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ListenerRuleName string `json:"ListenerRuleName,omitempty"` +} + +// implements the service definition of DeleteListenerRuleResponse +type DeleteListenerRuleResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteLoadBalancerListenersRequest +type DeleteLoadBalancerListenersRequest struct { + DryRun bool `json:"DryRun,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` + LoadBalancerPorts []int64 `json:"LoadBalancerPorts,omitempty"` +} + +// implements the service definition of DeleteLoadBalancerListenersResponse +type DeleteLoadBalancerListenersResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteLoadBalancerPolicyRequest +type DeleteLoadBalancerPolicyRequest struct { + DryRun bool `json:"DryRun,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` + PolicyName string `json:"PolicyName,omitempty"` +} + +// implements the service definition of DeleteLoadBalancerPolicyResponse +type DeleteLoadBalancerPolicyResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteLoadBalancerRequest +type DeleteLoadBalancerRequest struct { + DryRun bool `json:"DryRun,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` +} + +// implements the service definition of DeleteLoadBalancerResponse +type DeleteLoadBalancerResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteNatServiceRequest +type DeleteNatServiceRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NatServiceId string `json:"NatServiceId,omitempty"` +} + +// implements the service definition of DeleteNatServiceResponse +type DeleteNatServiceResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteNetAccessPointsRequest +type DeleteNetAccessPointsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NetAccessPointIds []string `json:"NetAccessPointIds,omitempty"` +} + +// implements the service definition of DeleteNetAccessPointsResponse +type DeleteNetAccessPointsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteNetPeeringRequest +type DeleteNetPeeringRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NetPeeringId string `json:"NetPeeringId,omitempty"` +} + +// implements the service definition of DeleteNetPeeringResponse +type DeleteNetPeeringResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteNetRequest +type DeleteNetRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NetId string `json:"NetId,omitempty"` +} + +// implements the service definition of DeleteNetResponse +type DeleteNetResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteNicRequest +type DeleteNicRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NicId string `json:"NicId,omitempty"` +} + +// implements the service definition of DeleteNicResponse +type DeleteNicResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeletePolicyRequest +type DeletePolicyRequest struct { + DryRun bool `json:"DryRun,omitempty"` + PolicyId string `json:"PolicyId,omitempty"` +} + +// implements the service definition of DeletePolicyResponse +type DeletePolicyResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeletePublicIpRequest +type DeletePublicIpRequest struct { + DryRun bool `json:"DryRun,omitempty"` + PublicIp string `json:"PublicIp,omitempty"` + PublicIpId string `json:"PublicIpId,omitempty"` +} + +// implements the service definition of DeletePublicIpResponse +type DeletePublicIpResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteRouteRequest +type DeleteRouteRequest struct { + DestinationIpRange string `json:"DestinationIpRange,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + RouteTableId string `json:"RouteTableId,omitempty"` +} + +// implements the service definition of DeleteRouteResponse +type DeleteRouteResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteRouteTableRequest +type DeleteRouteTableRequest struct { + DryRun bool `json:"DryRun,omitempty"` + RouteTableId string `json:"RouteTableId,omitempty"` +} + +// implements the service definition of DeleteRouteTableResponse +type DeleteRouteTableResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteSecurityGroupRequest +type DeleteSecurityGroupRequest struct { + DryRun bool `json:"DryRun,omitempty"` + SecurityGroupId string `json:"SecurityGroupId,omitempty"` + SecurityGroupName string `json:"SecurityGroupName,omitempty"` +} + +// implements the service definition of DeleteSecurityGroupResponse +type DeleteSecurityGroupResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteSecurityGroupRuleRequest +type DeleteSecurityGroupRuleRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Flow string `json:"Flow,omitempty"` + FromPortRange int64 `json:"FromPortRange,omitempty"` + IpProtocol string `json:"IpProtocol,omitempty"` + IpRange string `json:"IpRange,omitempty"` + Rules []SecurityGroupRule `json:"Rules,omitempty"` + SecurityGroupAccountIdToUnlink string `json:"SecurityGroupAccountIdToUnlink,omitempty"` + SecurityGroupId string `json:"SecurityGroupId,omitempty"` + SecurityGroupNameToUnlink string `json:"SecurityGroupNameToUnlink,omitempty"` + ToPortRange int64 `json:"ToPortRange,omitempty"` +} + +// implements the service definition of DeleteSecurityGroupRuleResponse +type DeleteSecurityGroupRuleResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteServerCertificateRequest +type DeleteServerCertificateRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ServerCertificateName string `json:"ServerCertificateName,omitempty"` +} + +// implements the service definition of DeleteServerCertificateResponse +type DeleteServerCertificateResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteSnapshotRequest +type DeleteSnapshotRequest struct { + DryRun bool `json:"DryRun,omitempty"` + SnapshotId string `json:"SnapshotId,omitempty"` +} + +// implements the service definition of DeleteSnapshotResponse +type DeleteSnapshotResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteSubnetRequest +type DeleteSubnetRequest struct { + DryRun bool `json:"DryRun,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` +} + +// implements the service definition of DeleteSubnetResponse +type DeleteSubnetResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteTagsRequest +type DeleteTagsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ResourceIds []string `json:"ResourceIds,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of DeleteTagsResponse +type DeleteTagsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteUserGroupRequest +type DeleteUserGroupRequest struct { + DryRun bool `json:"DryRun,omitempty"` + UserGroupName string `json:"UserGroupName,omitempty"` +} + +// implements the service definition of DeleteUserGroupResponse +type DeleteUserGroupResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteUserRequest +type DeleteUserRequest struct { + DryRun bool `json:"DryRun,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of DeleteUserResponse +type DeleteUserResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteVirtualGatewayRequest +type DeleteVirtualGatewayRequest struct { + DryRun bool `json:"DryRun,omitempty"` + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` +} + +// implements the service definition of DeleteVirtualGatewayResponse +type DeleteVirtualGatewayResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteVmsRequest +type DeleteVmsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + VmIds []string `json:"VmIds,omitempty"` +} + +// implements the service definition of DeleteVmsResponse +type DeleteVmsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Vms []VmState `json:"Vms,omitempty"` +} + +// implements the service definition of DeleteVolumeRequest +type DeleteVolumeRequest struct { + DryRun bool `json:"DryRun,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` +} + +// implements the service definition of DeleteVolumeResponse +type DeleteVolumeResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteVpnConnectionRequest +type DeleteVpnConnectionRequest struct { + DryRun bool `json:"DryRun,omitempty"` + VpnConnectionId string `json:"VpnConnectionId,omitempty"` +} + +// implements the service definition of DeleteVpnConnectionResponse +type DeleteVpnConnectionResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeleteVpnConnectionRouteRequest +type DeleteVpnConnectionRouteRequest struct { + DestinationIpRange string `json:"DestinationIpRange,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + VpnConnectionId string `json:"VpnConnectionId,omitempty"` +} + +// implements the service definition of DeleteVpnConnectionRouteResponse +type DeleteVpnConnectionRouteResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeregisterUserInUserGroupRequest +type DeregisterUserInUserGroupRequest struct { + DryRun bool `json:"DryRun,omitempty"` + UserGroupName string `json:"UserGroupName,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of DeregisterUserInUserGroupResponse +type DeregisterUserInUserGroupResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DeregisterVmsInLoadBalancerRequest +type DeregisterVmsInLoadBalancerRequest struct { + BackendVmsIds []string `json:"BackendVmsIds,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` +} + +// implements the service definition of DeregisterVmsInLoadBalancerResponse +type DeregisterVmsInLoadBalancerResponse struct { + BackendVmsIds []string `json:"BackendVmsIds,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of DhcpOptionsSet +type DhcpOptionsSet struct { + Default bool `json:"Default,omitempty"` + DhcpOptionsName string `json:"DhcpOptionsName,omitempty"` + DhcpOptionsSetId string `json:"DhcpOptionsSetId,omitempty"` + DomainName string `json:"DomainName,omitempty"` + DomainNameServers []string `json:"DomainNameServers,omitempty"` + NtpServers []string `json:"NtpServers,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of DirectLink +type DirectLink struct { + AccountId string `json:"AccountId,omitempty"` + Bandwidth string `json:"Bandwidth,omitempty"` + DirectLinkId string `json:"DirectLinkId,omitempty"` + DirectLinkName string `json:"DirectLinkName,omitempty"` + Location string `json:"Location,omitempty"` + RegionName string `json:"RegionName,omitempty"` + State string `json:"State,omitempty"` +} + +// implements the service definition of DirectLinkInterface +type DirectLinkInterface struct { + BgpAsn int64 `json:"BgpAsn,omitempty"` + BgpKey string `json:"BgpKey,omitempty"` + ClientPrivateIp string `json:"ClientPrivateIp,omitempty"` + DirectLinkInterfaceName string `json:"DirectLinkInterfaceName,omitempty"` + OutscalePrivateIp string `json:"OutscalePrivateIp,omitempty"` + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` + Vlan int64 `json:"Vlan,omitempty"` +} + +// implements the service definition of DirectLinkInterfaces +type DirectLinkInterfaces struct { + AccountId string `json:"AccountId,omitempty"` + BgpAsn int64 `json:"BgpAsn,omitempty"` + BgpKey string `json:"BgpKey,omitempty"` + ClientPrivateIp string `json:"ClientPrivateIp,omitempty"` + DirectLinkId string `json:"DirectLinkId,omitempty"` + DirectLinkInterfaceId string `json:"DirectLinkInterfaceId,omitempty"` + DirectLinkInterfaceName string `json:"DirectLinkInterfaceName,omitempty"` + InterfaceType string `json:"InterfaceType,omitempty"` + Location string `json:"Location,omitempty"` + OutscalePrivateIp string `json:"OutscalePrivateIp,omitempty"` + State string `json:"State,omitempty"` + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` + Vlan int64 `json:"Vlan,omitempty"` +} + +// implements the service definition of ErrorResponse +type ErrorResponse struct { + Errors []Errors `json:"Errors,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of Errors +type Errors struct { + Code string `json:"Code,omitempty"` + Details string `json:"Details,omitempty"` + Type string `json:"Type,omitempty"` +} + +// implements the service definition of FiltersApiLog +type FiltersApiLog struct { + QueryAccessKeys []string `json:"QueryAccessKeys,omitempty"` + QueryApiNames []string `json:"QueryApiNames,omitempty"` + QueryCallNames []string `json:"QueryCallNames,omitempty"` + QueryDateAfter string `json:"QueryDateAfter,omitempty"` + QueryDateBefore string `json:"QueryDateBefore,omitempty"` + QueryIpAddresses []string `json:"QueryIpAddresses,omitempty"` + QueryUserAgents []string `json:"QueryUserAgents,omitempty"` + ResponseIds []string `json:"ResponseIds,omitempty"` + ResponseStatusCodes []int64 `json:"ResponseStatusCodes,omitempty"` +} + +// implements the service definition of FiltersDhcpOptions +type FiltersDhcpOptions struct { + Defaults []string `json:"Defaults,omitempty"` + DhcpOptionsSetIds []string `json:"DhcpOptionsSetIds,omitempty"` + DomainNameServers []string `json:"DomainNameServers,omitempty"` + DomainNames []string `json:"DomainNames,omitempty"` + NtpServers []string `json:"NtpServers,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` +} + +// implements the service definition of FiltersExportTask +type FiltersExportTask struct { + TaskIds []string `json:"TaskIds,omitempty"` +} + +// implements the service definition of FiltersImage +type FiltersImage struct { + AccountAliases []string `json:"AccountAliases,omitempty"` + AccountIds []string `json:"AccountIds,omitempty"` + Architectures []string `json:"Architectures,omitempty"` + BlockDeviceMappingDeleteOnVmTermination bool `json:"BlockDeviceMappingDeleteOnVmTermination,omitempty"` + BlockDeviceMappingDeviceNames []string `json:"BlockDeviceMappingDeviceNames,omitempty"` + BlockDeviceMappingSnapshotIds []string `json:"BlockDeviceMappingSnapshotIds,omitempty"` + BlockDeviceMappingVolumeSize []int64 `json:"BlockDeviceMappingVolumeSize,omitempty"` + BlockDeviceMappingVolumeType []string `json:"BlockDeviceMappingVolumeType,omitempty"` + Descriptions []string `json:"Descriptions,omitempty"` + Hypervisors []string `json:"Hypervisors,omitempty"` + ImageIds []string `json:"ImageIds,omitempty"` + ImageNames []string `json:"ImageNames,omitempty"` + ImageTypes []string `json:"ImageTypes,omitempty"` + KernelIds []string `json:"KernelIds,omitempty"` + ManifestLocation []string `json:"ManifestLocation,omitempty"` + PermissionsToLaunchAccountIds []string `json:"PermissionsToLaunchAccountIds,omitempty"` + PermissionsToLaunchGlobalPermission bool `json:"PermissionsToLaunchGlobalPermission,omitempty"` + ProductCodes []string `json:"ProductCodes,omitempty"` + RamDiskIds []string `json:"RamDiskIds,omitempty"` + RootDeviceNames []string `json:"RootDeviceNames,omitempty"` + RootDeviceTypes []string `json:"RootDeviceTypes,omitempty"` + States []string `json:"States,omitempty"` + System []string `json:"System,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` + VirtualizationTypes []string `json:"VirtualizationTypes,omitempty"` +} + +// implements the service definition of FiltersInternetService +type FiltersInternetService struct { + InternetServiceIds []string `json:"InternetServiceIds,omitempty"` +} + +// implements the service definition of FiltersKeypair +type FiltersKeypair struct { + KeypairFingerprints []string `json:"KeypairFingerprints,omitempty"` + KeypairNames []string `json:"KeypairNames,omitempty"` +} + +// implements the service definition of FiltersLoadBalancer +type FiltersLoadBalancer struct { + LoadBalancerNames []string `json:"LoadBalancerNames,omitempty"` +} + +// implements the service definition of FiltersNatService +type FiltersNatService struct { + NatServiceIds []string `json:"NatServiceIds,omitempty"` + NetIds []string `json:"NetIds,omitempty"` + States []string `json:"States,omitempty"` + SubnetIds []string `json:"SubnetIds,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` +} + +// implements the service definition of FiltersNet +type FiltersNet struct { + DhcpOptionsSetIds []string `json:"DhcpOptionsSetIds,omitempty"` + IpRanges []string `json:"IpRanges,omitempty"` + IsDefault bool `json:"IsDefault,omitempty"` + NetIds []string `json:"NetIds,omitempty"` + States []string `json:"States,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` +} + +// implements the service definition of FiltersNetPeering +type FiltersNetPeering struct { + AccepterNetAccountIds []string `json:"AccepterNetAccountIds,omitempty"` + AccepterNetIpRanges []string `json:"AccepterNetIpRanges,omitempty"` + AccepterNetNetIds []string `json:"AccepterNetNetIds,omitempty"` + NetPeeringIds []string `json:"NetPeeringIds,omitempty"` + SourceNetAccountIds []string `json:"SourceNetAccountIds,omitempty"` + SourceNetIpRanges []string `json:"SourceNetIpRanges,omitempty"` + SourceNetNetIds []string `json:"SourceNetNetIds,omitempty"` + StateMessages []string `json:"StateMessages,omitempty"` + StateNames []string `json:"StateNames,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` +} + +// implements the service definition of FiltersNic +type FiltersNic struct { + AccountIds []string `json:"AccountIds,omitempty"` + ActivatedChecks []string `json:"ActivatedChecks,omitempty"` + Descriptions []string `json:"Descriptions,omitempty"` + LinkNicDeleteOnVmDeletion bool `json:"LinkNicDeleteOnVmDeletion,omitempty"` + LinkNicLinkDates []string `json:"LinkNicLinkDates,omitempty"` + LinkNicLinkNicIds []string `json:"LinkNicLinkNicIds,omitempty"` + LinkNicSortNumbers []int64 `json:"LinkNicSortNumbers,omitempty"` + LinkNicStates []string `json:"LinkNicStates,omitempty"` + LinkNicVmAccountIds []string `json:"LinkNicVmAccountIds,omitempty"` + LinkNicVmIds []string `json:"LinkNicVmIds,omitempty"` + LinkPublicIpAccountIds []string `json:"LinkPublicIpAccountIds,omitempty"` + LinkPublicIpLinkPublicIpIds []string `json:"LinkPublicIpLinkPublicIpIds,omitempty"` + LinkPublicIpPublicIpIds []string `json:"LinkPublicIpPublicIpIds,omitempty"` + LinkPublicIpPublicIps []string `json:"LinkPublicIpPublicIps,omitempty"` + MacAddresses []string `json:"MacAddresses,omitempty"` + NetIds []string `json:"NetIds,omitempty"` + NicIds []string `json:"NicIds,omitempty"` + PrivateDnsNames []string `json:"PrivateDnsNames,omitempty"` + PrivateIpsLinkPublicIpAccountIds []string `json:"PrivateIpsLinkPublicIpAccountIds,omitempty"` + PrivateIpsLinkPublicIpPublicIps []string `json:"PrivateIpsLinkPublicIpPublicIps,omitempty"` + PrivateIpsPrimaryIp bool `json:"PrivateIpsPrimaryIp,omitempty"` + PrivateIpsPrivateIps []string `json:"PrivateIpsPrivateIps,omitempty"` + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + SecurityGroupNames []string `json:"SecurityGroupNames,omitempty"` + States []string `json:"States,omitempty"` + SubnetIds []string `json:"SubnetIds,omitempty"` + SubregionNames []string `json:"SubregionNames,omitempty"` +} + +// implements the service definition of FiltersOldFormat +type FiltersOldFormat struct { + Name string `json:"Name,omitempty"` + Values []string `json:"Values,omitempty"` +} + +// implements the service definition of FiltersPublicIp +type FiltersPublicIp struct { + LinkPublicIpIds []string `json:"LinkPublicIpIds,omitempty"` + NicAccountIds []string `json:"NicAccountIds,omitempty"` + NicIds []string `json:"NicIds,omitempty"` + Placements []string `json:"Placements,omitempty"` + PrivateIps []string `json:"PrivateIps,omitempty"` + PublicIpIds []string `json:"PublicIpIds,omitempty"` + PublicIps []string `json:"PublicIps,omitempty"` + VmIds []string `json:"VmIds,omitempty"` +} + +// implements the service definition of FiltersRouteTable +type FiltersRouteTable struct { + LinkRouteTableIds []string `json:"LinkRouteTableIds,omitempty"` + LinkRouteTableLinkRouteTableIds []string `json:"LinkRouteTableLinkRouteTableIds,omitempty"` + LinkRouteTableMain bool `json:"LinkRouteTableMain,omitempty"` + LinkSubnetIds []string `json:"LinkSubnetIds,omitempty"` + NetIds []string `json:"NetIds,omitempty"` + RouteCreationMethods []string `json:"RouteCreationMethods,omitempty"` + RouteDestinationIpRanges []string `json:"RouteDestinationIpRanges,omitempty"` + RouteDestinationPrefixListIds []string `json:"RouteDestinationPrefixListIds,omitempty"` + RouteGatewayIds []string `json:"RouteGatewayIds,omitempty"` + RouteNatServiceIds []string `json:"RouteNatServiceIds,omitempty"` + RouteNetPeeringIds []string `json:"RouteNetPeeringIds,omitempty"` + RouteStates []string `json:"RouteStates,omitempty"` + RouteTableIds []string `json:"RouteTableIds,omitempty"` + RouteVmIds []string `json:"RouteVmIds,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` +} + +// implements the service definition of FiltersSecurityGroup +type FiltersSecurityGroup struct { + AccountIds []string `json:"AccountIds,omitempty"` + Descriptions []string `json:"Descriptions,omitempty"` + InboundRuleAccountIds []string `json:"InboundRuleAccountIds,omitempty"` + InboundRuleFromPortRanges []int64 `json:"InboundRuleFromPortRanges,omitempty"` + InboundRuleIpRanges []string `json:"InboundRuleIpRanges,omitempty"` + InboundRuleProtocols []string `json:"InboundRuleProtocols,omitempty"` + InboundRuleSecurityGroupIds []string `json:"InboundRuleSecurityGroupIds,omitempty"` + InboundRuleSecurityGroupNames []string `json:"InboundRuleSecurityGroupNames,omitempty"` + InboundRuleToPortRanges []int64 `json:"InboundRuleToPortRanges,omitempty"` + NetIds []string `json:"NetIds,omitempty"` + OutboundRuleAccountIds []string `json:"OutboundRuleAccountIds,omitempty"` + OutboundRuleFromPortRanges []int64 `json:"OutboundRuleFromPortRanges,omitempty"` + OutboundRuleIpRanges []string `json:"OutboundRuleIpRanges,omitempty"` + OutboundRuleProtocols []string `json:"OutboundRuleProtocols,omitempty"` + OutboundRuleSecurityGroupIds []string `json:"OutboundRuleSecurityGroupIds,omitempty"` + OutboundRuleSecurityGroupNames []string `json:"OutboundRuleSecurityGroupNames,omitempty"` + OutboundRuleToPortRanges []int64 `json:"OutboundRuleToPortRanges,omitempty"` + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + SecurityGroupNames []string `json:"SecurityGroupNames,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` +} + +// implements the service definition of FiltersServices +type FiltersServices struct { + Attributes []Attribute `json:"Attributes,omitempty"` + Endpoint string `json:"Endpoint,omitempty"` + Schema string `json:"Schema,omitempty"` + ServiceName string `json:"ServiceName,omitempty"` +} + +// implements the service definition of FiltersSnapshot +type FiltersSnapshot struct { + AccountAliases []string `json:"AccountAliases,omitempty"` + AccountIds []string `json:"AccountIds,omitempty"` + Descriptions []string `json:"Descriptions,omitempty"` + PermissionsToCreateVolumeAccountIds []string `json:"PermissionsToCreateVolumeAccountIds,omitempty"` + PermissionsToCreateVolumeGlobalPermission bool `json:"PermissionsToCreateVolumeGlobalPermission,omitempty"` + Progresses []int64 `json:"Progresses,omitempty"` + SnapshotIds []string `json:"SnapshotIds,omitempty"` + States []string `json:"States,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` + VolumeIds []string `json:"VolumeIds,omitempty"` + VolumeSizes []int64 `json:"VolumeSizes,omitempty"` +} + +// implements the service definition of FiltersSubnet +type FiltersSubnet struct { + AvailableIpsCounts []int64 `json:"AvailableIpsCounts,omitempty"` + IpRanges []string `json:"IpRanges,omitempty"` + NetIds []string `json:"NetIds,omitempty"` + States []string `json:"States,omitempty"` + SubnetIds []string `json:"SubnetIds,omitempty"` + SubregionNames []string `json:"SubregionNames,omitempty"` +} + +// implements the service definition of FiltersTag +type FiltersTag struct { + Keys []string `json:"Keys,omitempty"` + ResourceIds []string `json:"ResourceIds,omitempty"` + ResourceTypes []string `json:"ResourceTypes,omitempty"` + Values []string `json:"Values,omitempty"` +} + +// implements the service definition of FiltersUserGroup +type FiltersUserGroup struct { + Paths []string `json:"Paths,omitempty"` + UserNames []string `json:"UserNames,omitempty"` +} + +// implements the service definition of FiltersVm +type FiltersVm struct { + AccountIds []string `json:"AccountIds,omitempty"` + ActivatedCheck bool `json:"ActivatedCheck,omitempty"` + Architectures []string `json:"Architectures,omitempty"` + BlockDeviceMappingDeleteOnVmDeletion *bool `json:"BlockDeviceMappingDeleteOnVmDeletion,omitempty"` + BlockDeviceMappingDeviceNames []string `json:"BlockDeviceMappingDeviceNames,omitempty"` + BlockDeviceMappingLinkDates []string `json:"BlockDeviceMappingLinkDates,omitempty"` + BlockDeviceMappingStates []string `json:"BlockDeviceMappingStates,omitempty"` + BlockDeviceMappingVolumeIds []string `json:"BlockDeviceMappingVolumeIds,omitempty"` + Comments []string `json:"Comments,omitempty"` + CreationDates []string `json:"CreationDates,omitempty"` + DnsNames []string `json:"DnsNames,omitempty"` + Hypervisors []string `json:"Hypervisors,omitempty"` + ImageIds []string `json:"ImageIds,omitempty"` + KernelIds []string `json:"KernelIds,omitempty"` + KeypairNames []string `json:"KeypairNames,omitempty"` + LaunchSortNumbers []int64 `json:"LaunchSortNumbers,omitempty"` + LinkNicDeleteOnVmDeletion bool `json:"LinkNicDeleteOnVmDeletion,omitempty"` + LinkNicLinkDates []string `json:"LinkNicLinkDates,omitempty"` + LinkNicLinkNicIds []string `json:"LinkNicLinkNicIds,omitempty"` + LinkNicLinkPublicIpIds []string `json:"LinkNicLinkPublicIpIds,omitempty"` + LinkNicNicIds []string `json:"LinkNicNicIds,omitempty"` + LinkNicNicSortNumbers []int64 `json:"LinkNicNicSortNumbers,omitempty"` + LinkNicPublicIpAccountIds []string `json:"LinkNicPublicIpAccountIds,omitempty"` + LinkNicPublicIpIds []string `json:"LinkNicPublicIpIds,omitempty"` + LinkNicPublicIps []string `json:"LinkNicPublicIps,omitempty"` + LinkNicStates []string `json:"LinkNicStates,omitempty"` + LinkNicVmAccountIds []string `json:"LinkNicVmAccountIds,omitempty"` + LinkNicVmIds []string `json:"LinkNicVmIds,omitempty"` + MonitoringStates []string `json:"MonitoringStates,omitempty"` + NetIds []string `json:"NetIds,omitempty"` + NicAccountIds []string `json:"NicAccountIds,omitempty"` + NicActivatedCheck bool `json:"NicActivatedCheck,omitempty"` + NicDescriptions []string `json:"NicDescriptions,omitempty"` + NicMacAddresses []string `json:"NicMacAddresses,omitempty"` + NicNetIds []string `json:"NicNetIds,omitempty"` + NicNicIds []string `json:"NicNicIds,omitempty"` + NicPrivateDnsNames []string `json:"NicPrivateDnsNames,omitempty"` + NicSecurityGroupIds []string `json:"NicSecurityGroupIds,omitempty"` + NicSecurityGroupNames []string `json:"NicSecurityGroupNames,omitempty"` + NicStates []string `json:"NicStates,omitempty"` + NicSubnetIds []string `json:"NicSubnetIds,omitempty"` + NicSubregionNames []string `json:"NicSubregionNames,omitempty"` + PlacementGroups []string `json:"PlacementGroups,omitempty"` + PrivateDnsNames []string `json:"PrivateDnsNames,omitempty"` + PrivateIpLinkPrivateIpAccountIds []string `json:"PrivateIpLinkPrivateIpAccountIds,omitempty"` + PrivateIpLinkPublicIps []string `json:"PrivateIpLinkPublicIps,omitempty"` + PrivateIpPrimaryIps []string `json:"PrivateIpPrimaryIps,omitempty"` + PrivateIpPrivateIps []string `json:"PrivateIpPrivateIps,omitempty"` + PrivateIps []string `json:"PrivateIps,omitempty"` + ProductCodes []string `json:"ProductCodes,omitempty"` + PublicIps []string `json:"PublicIps,omitempty"` + RamDiskIds []string `json:"RamDiskIds,omitempty"` + RootDeviceNames []string `json:"RootDeviceNames,omitempty"` + RootDeviceTypes []string `json:"RootDeviceTypes,omitempty"` + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + SecurityGroupNames []string `json:"SecurityGroupNames,omitempty"` + SpotVmRequestIds []string `json:"SpotVmRequestIds,omitempty"` + SpotVms []string `json:"SpotVms,omitempty"` + StateComments []string `json:"StateComments,omitempty"` + SubnetIds []string `json:"SubnetIds,omitempty"` + SubregionNames []string `json:"SubregionNames,omitempty"` + Systems []string `json:"Systems,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` + Tenancies []string `json:"Tenancies,omitempty"` + Tokens []string `json:"Tokens,omitempty"` + VirtualizationTypes []string `json:"VirtualizationTypes,omitempty"` + VmIds []string `json:"VmIds,omitempty"` + VmStates []string `json:"VmStates,omitempty"` + VmTypes []string `json:"VmTypes,omitempty"` + VmsSecurityGroupIds []string `json:"VmsSecurityGroupIds,omitempty"` + VmsSecurityGroupNames []string `json:"VmsSecurityGroupNames,omitempty"` +} + +// implements the service definition of FiltersVmsState +type FiltersVmsState struct { + MaintenanceEventCodes []string `json:"MaintenanceEventCodes,omitempty"` + MaintenanceEventDescriptions []string `json:"MaintenanceEventDescriptions,omitempty"` + MaintenanceEventsNotAfter []string `json:"MaintenanceEventsNotAfter,omitempty"` + MaintenanceEventsNotBefore []string `json:"MaintenanceEventsNotBefore,omitempty"` + SubregionNames []string `json:"SubregionNames,omitempty"` + VmIds []string `json:"VmIds,omitempty"` + VmStates []string `json:"VmStates,omitempty"` +} + +// implements the service definition of FiltersVolume +type FiltersVolume struct { + CreationDates []string `json:"CreationDates,omitempty"` + SnapshotIds []string `json:"SnapshotIds,omitempty"` + SubregionNames []string `json:"SubregionNames,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` + VolumeIds []string `json:"VolumeIds,omitempty"` + VolumeSizes []int64 `json:"VolumeSizes,omitempty"` + VolumeTypes []string `json:"VolumeTypes,omitempty"` +} + +// implements the service definition of FiltersVpnConnection +type FiltersVpnConnection struct { + ConnectionTypes []string `json:"ConnectionTypes,omitempty"` + NetToVirtualGatewayLinkNetIds []string `json:"NetToVirtualGatewayLinkNetIds,omitempty"` + NetToVirtualGatewayLinkStates []string `json:"NetToVirtualGatewayLinkStates,omitempty"` + States []string `json:"States,omitempty"` + TagKeys []string `json:"TagKeys,omitempty"` + TagValues []string `json:"TagValues,omitempty"` + Tags []string `json:"Tags,omitempty"` + VirtualGatewayIds []string `json:"VirtualGatewayIds,omitempty"` +} + +// implements the service definition of HealthCheck +type HealthCheck struct { + CheckInterval int64 `json:"CheckInterval,omitempty"` + HealthyThreshold int64 `json:"HealthyThreshold,omitempty"` + Path string `json:"Path,omitempty"` + Port int64 `json:"Port,omitempty"` + Protocol string `json:"Protocol,omitempty"` + Timeout int64 `json:"Timeout,omitempty"` + UnhealthyThreshold int64 `json:"UnhealthyThreshold,omitempty"` +} + +// implements the service definition of Image +type Image struct { + AccountAlias string `json:"AccountAlias,omitempty"` + AccountId string `json:"AccountId,omitempty"` + Architecture string `json:"Architecture,omitempty"` + BlockDeviceMappings []BlockDeviceMappingImage `json:"BlockDeviceMappings,omitempty"` + CreationDate string `json:"CreationDate,omitempty"` + Description string `json:"Description,omitempty"` + FileLocation string `json:"FileLocation,omitempty"` + ImageId string `json:"ImageId,omitempty"` + ImageName string `json:"ImageName,omitempty"` + ImageType string `json:"ImageType,omitempty"` + PermissionsToLaunch PermissionsOnResource `json:"PermissionsToLaunch,omitempty"` + ProductCodes []string `json:"ProductCodes,omitempty"` + RootDeviceName string `json:"RootDeviceName,omitempty"` + RootDeviceType string `json:"RootDeviceType,omitempty"` + State string `json:"State,omitempty"` + StateComment StateComment `json:"StateComment,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of ImageExportTask +type ImageExportTask struct { + Comment string `json:"Comment,omitempty"` + ImageId string `json:"ImageId,omitempty"` + OsuExport OsuExport `json:"OsuExport,omitempty"` + Progress int64 `json:"Progress,omitempty"` + State string `json:"State,omitempty"` + TaskId string `json:"TaskId,omitempty"` +} + +// implements the service definition of InternetService +type InternetService struct { + InternetServiceId string `json:"InternetServiceId,omitempty"` + NetId string `json:"NetId,omitempty"` + State string `json:"State,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of Item +type Item struct { + AccountId string `json:"AccountId,omitempty"` + Catalog []Catalog_0 `json:"Catalog,omitempty"` + ComsuptionValue int `json:"ComsuptionValue,omitempty"` + Entry string `json:"Entry,omitempty"` + FromDate string `json:"FromDate,omitempty"` + PayingAccountId string `json:"PayingAccountId,omitempty"` + Service string `json:"Service,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` + ToDate string `json:"ToDate,omitempty"` + Type string `json:"Type,omitempty"` +} + +// implements the service definition of Keypair +type Keypair struct { + KeypairFingerprint string `json:"KeypairFingerprint,omitempty"` + KeypairName string `json:"KeypairName,omitempty"` +} + +// implements the service definition of KeypairCreated +type KeypairCreated struct { + KeypairFingerprint string `json:"KeypairFingerprint,omitempty"` + KeypairName string `json:"KeypairName,omitempty"` + PrivateKey string `json:"PrivateKey,omitempty"` +} + +// implements the service definition of LinkInternetServiceRequest +type LinkInternetServiceRequest struct { + DryRun bool `json:"DryRun,omitempty"` + InternetServiceId string `json:"InternetServiceId,omitempty"` + NetId string `json:"NetId,omitempty"` +} + +// implements the service definition of LinkInternetServiceResponse +type LinkInternetServiceResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of LinkNic +type LinkNic struct { + DeleteOnVmDeletion *bool `json:"DeleteOnVmDeletion,omitempty"` + DeviceNumber int64 `json:"DeviceNumber,omitempty"` + LinkNicId string `json:"LinkNicId,omitempty"` + State string `json:"State,omitempty"` + VmAccountId string `json:"VmAccountId,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of LinkNicLight +type LinkNicLight struct { + DeleteOnVmDeletion *bool `json:"DeleteOnVmDeletion,omitempty"` + DeviceNumber int64 `json:"DeviceNumber,omitempty"` + LinkNicId string `json:"LinkNicId,omitempty"` + State string `json:"State,omitempty"` +} + +// implements the service definition of LinkNicRequest +type LinkNicRequest struct { + DeviceNumber int64 `json:"DeviceNumber,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + NicId string `json:"NicId,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of LinkNicResponse +type LinkNicResponse struct { + LinkNicId string `json:"LinkNicId,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of LinkNicToUpdate +type LinkNicToUpdate struct { + DeleteOnVmDeletion *bool `json:"DeleteOnVmDeletion,omitempty"` + LinkNicId string `json:"LinkNicId,omitempty"` +} + +// implements the service definition of LinkPolicyRequest +type LinkPolicyRequest struct { + DryRun bool `json:"DryRun,omitempty"` + PolicyId string `json:"PolicyId,omitempty"` + UserGroupName string `json:"UserGroupName,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of LinkPolicyResponse +type LinkPolicyResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of LinkPrivateIpsRequest +type LinkPrivateIpsRequest struct { + AllowRelink bool `json:"AllowRelink,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + NicId string `json:"NicId,omitempty"` + PrivateIps []string `json:"PrivateIps,omitempty"` + SecondaryPrivateIpCount int64 `json:"SecondaryPrivateIpCount,omitempty"` +} + +// implements the service definition of LinkPrivateIpsResponse +type LinkPrivateIpsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of LinkPublicIp +type LinkPublicIp struct { + LinkPublicIpId string `json:"LinkPublicIpId,omitempty"` + PublicDnsName string `json:"PublicDnsName,omitempty"` + PublicIp string `json:"PublicIp,omitempty"` + PublicIpAccountId string `json:"PublicIpAccountId,omitempty"` + PublicIpId string `json:"PublicIpId,omitempty"` +} + +// implements the service definition of LinkPublicIpLightForVm +type LinkPublicIpLightForVm struct { + PublicDnsName string `json:"PublicDnsName,omitempty"` + PublicIp string `json:"PublicIp,omitempty"` + PublicIpAccountId string `json:"PublicIpAccountId,omitempty"` +} + +// implements the service definition of LinkPublicIpRequest +type LinkPublicIpRequest struct { + AllowRelink bool `json:"AllowRelink,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + NicId string `json:"NicId,omitempty"` + PrivateIp string `json:"PrivateIp,omitempty"` + PublicIp string `json:"PublicIp,omitempty"` + PublicIpId string `json:"PublicIpId,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of LinkPublicIpResponse +type LinkPublicIpResponse struct { + LinkPublicIpId string `json:"LinkPublicIpId,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of LinkRouteTable +type LinkRouteTable struct { + LinkRouteTableId string `json:"LinkRouteTableId,omitempty"` + Main bool `json:"Main,omitempty"` + RouteTableId string `json:"RouteTableId,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` +} + +// implements the service definition of LinkRouteTableRequest +type LinkRouteTableRequest struct { + DryRun bool `json:"DryRun,omitempty"` + RouteTableId string `json:"RouteTableId,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` +} + +// implements the service definition of LinkRouteTableResponse +type LinkRouteTableResponse struct { + LinkRouteTableId string `json:"LinkRouteTableId,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of LinkVirtualGatewayRequest +type LinkVirtualGatewayRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NetId string `json:"NetId,omitempty"` + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` +} + +// implements the service definition of LinkVirtualGatewayResponse +type LinkVirtualGatewayResponse struct { + NetToVirtualGatewayLink NetToVirtualGatewayLink `json:"NetToVirtualGatewayLink,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of LinkVolumeRequest +type LinkVolumeRequest struct { + DeviceName string `json:"DeviceName,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + VmId string `json:"VmId,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` +} + +// implements the service definition of LinkVolumeResponse +type LinkVolumeResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of LinkedVolume +type LinkedVolume struct { + DeleteOnVmDeletion *bool `json:"DeleteOnVmDeletion,omitempty"` + DeviceName string `json:"DeviceName,omitempty"` + State string `json:"State,omitempty"` + VmId string `json:"VmId,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` +} + +// implements the service definition of Listener +type Listener struct { + BackendPort int64 `json:"BackendPort,omitempty"` + BackendProtocol string `json:"BackendProtocol,omitempty"` + LoadBalancerPort int64 `json:"LoadBalancerPort,omitempty"` + LoadBalancerProtocol string `json:"LoadBalancerProtocol,omitempty"` + PolicyNames []string `json:"PolicyNames,omitempty"` + ServerCertificateId string `json:"ServerCertificateId,omitempty"` +} + +// implements the service definition of ListenerForCreation +type ListenerForCreation struct { + BackendPort int64 `json:"BackendPort,omitempty"` + BackendProtocol string `json:"BackendProtocol,omitempty"` + LoadBalancerPort int64 `json:"LoadBalancerPort,omitempty"` + LoadBalancerProtocol string `json:"LoadBalancerProtocol,omitempty"` + ServerCertificateId string `json:"ServerCertificateId,omitempty"` +} + +// implements the service definition of ListenerRule +type ListenerRule struct { + Action string `json:"Action,omitempty"` + HostNamePattern string `json:"HostNamePattern,omitempty"` + ListenerRuleId string `json:"ListenerRuleId,omitempty"` + ListenerRuleName string `json:"ListenerRuleName,omitempty"` + PathPattern string `json:"PathPattern,omitempty"` + Priority int64 `json:"Priority,omitempty"` +} + +// implements the service definition of ListenerRules +type ListenerRules struct { + ListenerId string `json:"ListenerId,omitempty"` + ListenerRule ListenerRule `json:"ListenerRule,omitempty"` + VmIds []string `json:"VmIds,omitempty"` +} + +// implements the service definition of LoadBalancer +type LoadBalancer struct { + AccessLog AccessLog `json:"AccessLog,omitempty"` + ApplicationStickyCookiePolicies []ApplicationStickyCookiePolicy `json:"ApplicationStickyCookiePolicies,omitempty"` + BackendVmsIds []string `json:"BackendVmsIds,omitempty"` + DnsName string `json:"DnsName,omitempty"` + HealthCheck HealthCheck `json:"HealthCheck,omitempty"` + Listeners []Listener `json:"Listeners,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` + LoadBalancerStickyCookiePolicies []LoadBalancerStickyCookiePolicy `json:"LoadBalancerStickyCookiePolicies,omitempty"` + LoadBalancerType string `json:"LoadBalancerType,omitempty"` + NetId string `json:"NetId,omitempty"` + SecurityGroups []string `json:"SecurityGroups,omitempty"` + SourceSecurityGroup SourceSecurityGroup `json:"SourceSecurityGroup,omitempty"` + Subnets []string `json:"Subnets,omitempty"` + SubregionNames []string `json:"SubregionNames,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of LoadBalancerLight +type LoadBalancerLight struct { + LoadBalancerName string `json:"LoadBalancerName,omitempty"` + LoadBalancerPort int64 `json:"LoadBalancerPort,omitempty"` +} + +// implements the service definition of LoadBalancerStickyCookiePolicy +type LoadBalancerStickyCookiePolicy struct { + PolicyName string `json:"PolicyName,omitempty"` +} + +// implements the service definition of Location +type Location struct { + Code string `json:"Code,omitempty"` + Name string `json:"Name,omitempty"` +} + +// implements the service definition of Log +type Log struct { + CallDuration int64 `json:"CallDuration,omitempty"` + QueryAccessKey string `json:"QueryAccessKey,omitempty"` + QueryApiName string `json:"QueryApiName,omitempty"` + QueryApiVersion string `json:"QueryApiVersion,omitempty"` + QueryCallName string `json:"QueryCallName,omitempty"` + QueryDate string `json:"QueryDate,omitempty"` + QueryIpAddress string `json:"QueryIpAddress,omitempty"` + QueryRaw string `json:"QueryRaw,omitempty"` + QuerySize int64 `json:"QuerySize,omitempty"` + QueryUserAgent string `json:"QueryUserAgent,omitempty"` + ResponseId string `json:"ResponseId,omitempty"` + ResponseSize int64 `json:"ResponseSize,omitempty"` + ResponseStatusCode int64 `json:"ResponseStatusCode,omitempty"` +} + +// implements the service definition of MaintenanceEvent +type MaintenanceEvent struct { + Code string `json:"Code,omitempty"` + Description string `json:"Description,omitempty"` + NotAfter string `json:"NotAfter,omitempty"` + NotBefore string `json:"NotBefore,omitempty"` +} + +// implements the service definition of NatService +type NatService struct { + NatServiceId string `json:"NatServiceId,omitempty"` + NetId string `json:"NetId,omitempty"` + PublicIps []PublicIpLight `json:"PublicIps,omitempty"` + State string `json:"State,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` +} + +// implements the service definition of Net +type Net struct { + DhcpOptionsSetId string `json:"DhcpOptionsSetId,omitempty"` + IpRange string `json:"IpRange,omitempty"` + NetId string `json:"NetId,omitempty"` + State string `json:"State,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` + Tenancy string `json:"Tenancy,omitempty"` +} + +// implements the service definition of NetAccessPoint +type NetAccessPoint struct { + NetAccessPointId string `json:"NetAccessPointId,omitempty"` + NetId string `json:"NetId,omitempty"` + PrefixListName string `json:"PrefixListName,omitempty"` + RouteTableIds []string `json:"RouteTableIds,omitempty"` + State string `json:"State,omitempty"` +} + +// implements the service definition of NetPeering +type NetPeering struct { + AccepterNet AccepterNet `json:"AccepterNet,omitempty"` + NetPeeringId string `json:"NetPeeringId,omitempty"` + SourceNet SourceNet `json:"SourceNet,omitempty"` + State NetPeeringState `json:"State,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of NetPeeringState +type NetPeeringState struct { + Message string `json:"Message,omitempty"` + Name string `json:"Name,omitempty"` +} + +// implements the service definition of NetToVirtualGatewayLink +type NetToVirtualGatewayLink struct { + NetId string `json:"NetId,omitempty"` + State string `json:"State,omitempty"` +} + +// implements the service definition of Nic +type Nic struct { + AccountId string `json:"AccountId,omitempty"` + Description string `json:"Description,omitempty"` + IsSourceDestChecked bool `json:"IsSourceDestChecked,omitempty"` + LinkNic LinkNic `json:"LinkNic,omitempty"` + LinkPublicIp LinkPublicIp `json:"LinkPublicIp,omitempty"` + MacAddress string `json:"MacAddress,omitempty"` + NetId string `json:"NetId,omitempty"` + NicId string `json:"NicId,omitempty"` + PrivateDnsName string `json:"PrivateDnsName,omitempty"` + PrivateIps []PrivateIp `json:"PrivateIps,omitempty"` + SecurityGroups []SecurityGroupLight `json:"SecurityGroups,omitempty"` + State string `json:"State,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of NicForVmCreation +type NicForVmCreation struct { + DeleteOnVmDeletion bool `json:"DeleteOnVmDeletion,omitempty"` + Description string `json:"Description,omitempty"` + DeviceNumber int64 `json:"DeviceNumber,omitempty"` + NicId string `json:"NicId,omitempty"` + PrivateIps []PrivateIpLight `json:"PrivateIps,omitempty"` + SecondaryPrivateIpCount int64 `json:"SecondaryPrivateIpCount,omitempty"` + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` +} + +// implements the service definition of NicLight +type NicLight struct { + AccountId string `json:"AccountId,omitempty"` + Description string `json:"Description,omitempty"` + IsSourceDestChecked bool `json:"IsSourceDestChecked,omitempty"` + LinkNic LinkNicLight `json:"LinkNic,omitempty"` + LinkPublicIp LinkPublicIpLightForVm `json:"LinkPublicIp,omitempty"` + MacAddress string `json:"MacAddress,omitempty"` + NetId string `json:"NetId,omitempty"` + NicId string `json:"NicId,omitempty"` + PrivateDnsName string `json:"PrivateDnsName,omitempty"` + PrivateIps []PrivateIpLightForVm `json:"PrivateIps,omitempty"` + SecurityGroups []SecurityGroupLight `json:"SecurityGroups,omitempty"` + State string `json:"State,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` +} + +// implements the service definition of OsuApiKey +type OsuApiKey struct { + ApiKeyId string `json:"ApiKeyId,omitempty"` + SecretKey string `json:"SecretKey,omitempty"` +} + +// implements the service definition of OsuExport +type OsuExport struct { + DiskImageFormat string `json:"DiskImageFormat,omitempty"` + OsuApiKey OsuApiKey `json:"OsuApiKey,omitempty"` + OsuBucket string `json:"OsuBucket,omitempty"` + OsuManifestUrl string `json:"OsuManifestUrl,omitempty"` + OsuPrefix string `json:"OsuPrefix,omitempty"` +} + +// implements the service definition of PermissionsOnResource +type PermissionsOnResource struct { + AccountIds []string `json:"AccountIds,omitempty"` + GlobalPermission bool `json:"GlobalPermission,omitempty"` +} + +// implements the service definition of PermissionsOnResourceCreation +type PermissionsOnResourceCreation struct { + Additions PermissionsOnResource `json:"Additions,omitempty"` + Removals PermissionsOnResource `json:"Removals,omitempty"` +} + +// implements the service definition of Placement +type Placement struct { + SubregionName string `json:"SubregionName,omitempty"` + Tenancy string `json:"Tenancy,omitempty"` +} + +// implements the service definition of Policy +type Policy struct { + Description string `json:"Description,omitempty"` + IsLinkable bool `json:"IsLinkable,omitempty"` + Path string `json:"Path,omitempty"` + PolicyDefaultVersionId string `json:"PolicyDefaultVersionId,omitempty"` + PolicyId string `json:"PolicyId,omitempty"` + PolicyName string `json:"PolicyName,omitempty"` + ResourcesCount int64 `json:"ResourcesCount,omitempty"` +} + +// implements the service definition of PrefixLists +type PrefixLists struct { + IpRanges []string `json:"IpRanges,omitempty"` + PrefixListId string `json:"PrefixListId,omitempty"` + PrefixListName string `json:"PrefixListName,omitempty"` +} + +// implements the service definition of PricingDetail +type PricingDetail struct { + Count int64 `json:"Count,omitempty"` +} + +// implements the service definition of PrivateIp +type PrivateIp struct { + IsPrimary bool `json:"IsPrimary,omitempty"` + LinkPublicIp LinkPublicIp `json:"LinkPublicIp,omitempty"` + PrivateDnsName string `json:"PrivateDnsName,omitempty"` + PrivateIp string `json:"PrivateIp,omitempty"` +} + +// implements the service definition of PrivateIpLight +type PrivateIpLight struct { + IsPrimary bool `json:"IsPrimary,omitempty"` + PrivateIp string `json:"PrivateIp,omitempty"` +} + +// implements the service definition of PrivateIpLightForVm +type PrivateIpLightForVm struct { + IsPrimary bool `json:"IsPrimary,omitempty"` + LinkPublicIp LinkPublicIpLightForVm `json:"LinkPublicIp,omitempty"` + PrivateDnsName string `json:"PrivateDnsName,omitempty"` + PrivateIp string `json:"PrivateIp,omitempty"` +} + +// implements the service definition of ProductType +type ProductType struct { + Description string `json:"Description,omitempty"` + ProductTypeId string `json:"ProductTypeId,omitempty"` + Vendor string `json:"Vendor,omitempty"` +} + +// implements the service definition of PublicIp +type PublicIp struct { + LinkPublicIpId string `json:"LinkPublicIpId,omitempty"` + NicAccountId string `json:"NicAccountId,omitempty"` + NicId string `json:"NicId,omitempty"` + PrivateIp string `json:"PrivateIp,omitempty"` + PublicIp string `json:"PublicIp,omitempty"` + PublicIpId string `json:"PublicIpId,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of PublicIpLight +type PublicIpLight struct { + PublicIp string `json:"PublicIp,omitempty"` + PublicIpId string `json:"PublicIpId,omitempty"` +} + +// implements the service definition of PurchaseReservedVmsOfferRequest +type PurchaseReservedVmsOfferRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ReservedVmsOfferId string `json:"ReservedVmsOfferId,omitempty"` + VmCount int64 `json:"VmCount,omitempty"` +} + +// implements the service definition of PurchaseReservedVmsOfferResponse +type PurchaseReservedVmsOfferResponse struct { + ReservedVmsId string `json:"ReservedVmsId,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of Quota +type Quota struct { + AccountId string `json:"AccountId,omitempty"` + Description string `json:"Description,omitempty"` + MaxValue int64 `json:"MaxValue,omitempty"` + Name string `json:"Name,omitempty"` + QuotaCollection string `json:"QuotaCollection,omitempty"` + ShortDescription string `json:"ShortDescription,omitempty"` + UsedValue int64 `json:"UsedValue,omitempty"` +} + +// implements the service definition of QuotaTypes +type QuotaTypes struct { + QuotaType string `json:"QuotaType,omitempty"` + Quotas []Quota `json:"Quotas,omitempty"` +} + +// implements the service definition of ReadAccountConsumptionRequest +type ReadAccountConsumptionRequest struct { + DryRun bool `json:"DryRun,omitempty"` + FromDate string `json:"FromDate,omitempty"` + ToDate string `json:"ToDate,omitempty"` +} + +// implements the service definition of ReadAccountConsumptionResponse +type ReadAccountConsumptionResponse struct { + ConsumptionEntries ConsumptionEntries `json:"ConsumptionEntries,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadAccountRequest +type ReadAccountRequest struct { + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of ReadAccountResponse +type ReadAccountResponse struct { + Account Account `json:"Account,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadAdminPasswordRequest +type ReadAdminPasswordRequest struct { + DryRun bool `json:"DryRun,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of ReadAdminPasswordResponse +type ReadAdminPasswordResponse struct { + AdminPassword string `json:"AdminPassword,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of ReadApiKeysRequest +type ReadApiKeysRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of ReadApiKeysResponse +type ReadApiKeysResponse struct { + ApiKeys []ApiKey `json:"ApiKeys,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadApiLogsRequest +type ReadApiLogsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersApiLog `json:"Filters,omitempty"` + With With `json:"With,omitempty"` +} + +// implements the service definition of ReadApiLogsResponse +type ReadApiLogsResponse struct { + Logs []Log `json:"Logs,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadBillableDigestRequest +type ReadBillableDigestRequest struct { + AccountId string `json:"AccountId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + FromDate string `json:"FromDate,omitempty"` + InvoiceState string `json:"InvoiceState,omitempty"` + IsConsolidated bool `json:"IsConsolidated,omitempty"` + ToDate string `json:"ToDate,omitempty"` +} + +// implements the service definition of ReadBillableDigestResponse +type ReadBillableDigestResponse struct { + Items []Item `json:"Items,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadCatalogRequest +type ReadCatalogRequest struct { + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of ReadCatalogResponse +type ReadCatalogResponse struct { + Catalog Catalog_1 `json:"Catalog,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadClientGatewaysRequest +type ReadClientGatewaysRequest struct { + ClientGatewayIds []string `json:"ClientGatewayIds,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` +} + +// implements the service definition of ReadClientGatewaysResponse +type ReadClientGatewaysResponse struct { + ClientGateways []ClientGateway `json:"ClientGateways,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadConsoleOutputRequest +type ReadConsoleOutputRequest struct { + DryRun bool `json:"DryRun,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of ReadConsoleOutputResponse +type ReadConsoleOutputResponse struct { + ConsoleOutput string `json:"ConsoleOutput,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of ReadDhcpOptionsRequest +type ReadDhcpOptionsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersDhcpOptions `json:"Filters,omitempty"` +} + +// implements the service definition of ReadDhcpOptionsResponse +type ReadDhcpOptionsResponse struct { + DhcpOptionsSets []DhcpOptionsSet `json:"DhcpOptionsSets,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadDirectLinkInterfacesRequest +type ReadDirectLinkInterfacesRequest struct { + DirectLinkId string `json:"DirectLinkId,omitempty"` + DirectLinkInterfaceId string `json:"DirectLinkInterfaceId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of ReadDirectLinkInterfacesResponse +type ReadDirectLinkInterfacesResponse struct { + DirectLinkInterfaces []DirectLinkInterfaces `json:"DirectLinkInterfaces,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadDirectLinksRequest +type ReadDirectLinksRequest struct { + DirectLinkId string `json:"DirectLinkId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of ReadDirectLinksResponse +type ReadDirectLinksResponse struct { + DirectLinks []DirectLink `json:"DirectLinks,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadImageExportTasksRequest +type ReadImageExportTasksRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersExportTask `json:"Filters,omitempty"` +} + +// implements the service definition of ReadImageExportTasksResponse +type ReadImageExportTasksResponse struct { + ImageExportTasks []ImageExportTask `json:"ImageExportTasks,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadImagesRequest +type ReadImagesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersImage `json:"Filters,omitempty"` +} + +// implements the service definition of ReadImagesResponse +type ReadImagesResponse struct { + Images []Image `json:"Images,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadInternetServicesRequest +type ReadInternetServicesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersInternetService `json:"Filters,omitempty"` +} + +// implements the service definition of ReadInternetServicesResponse +type ReadInternetServicesResponse struct { + InternetServices []InternetService `json:"InternetServices,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadKeypairsRequest +type ReadKeypairsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersKeypair `json:"Filters,omitempty"` +} + +// implements the service definition of ReadKeypairsResponse +type ReadKeypairsResponse struct { + Keypairs []Keypair `json:"Keypairs,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadListenerRulesRequest +type ReadListenerRulesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ListenerRuleNames []string `json:"ListenerRuleNames,omitempty"` +} + +// implements the service definition of ReadListenerRulesResponse +type ReadListenerRulesResponse struct { + ListenerRules []ListenerRules `json:"ListenerRules,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadLoadBalancersRequest +type ReadLoadBalancersRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersLoadBalancer `json:"Filters,omitempty"` +} + +// implements the service definition of ReadLoadBalancersResponse +type ReadLoadBalancersResponse struct { + LoadBalancers []LoadBalancer `json:"LoadBalancers,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadLocationsRequest +type ReadLocationsRequest struct { + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of ReadLocationsResponse +type ReadLocationsResponse struct { + Locations []Location `json:"Locations,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadNatServicesRequest +type ReadNatServicesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersNatService `json:"Filters,omitempty"` +} + +// implements the service definition of ReadNatServicesResponse +type ReadNatServicesResponse struct { + NatServices []NatService `json:"NatServices,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadNetAccessPointServicesRequest +type ReadNetAccessPointServicesRequest struct { + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of ReadNetAccessPointServicesResponse +type ReadNetAccessPointServicesResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + ServiceNames []string `json:"ServiceNames,omitempty"` +} + +// implements the service definition of ReadNetAccessPointsRequest +type ReadNetAccessPointsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` + NetAccessPointIds []string `json:"NetAccessPointIds,omitempty"` +} + +// implements the service definition of ReadNetAccessPointsResponse +type ReadNetAccessPointsResponse struct { + NetAccessPoints []NetAccessPoint `json:"NetAccessPoints,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadNetPeeringsRequest +type ReadNetPeeringsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersNetPeering `json:"Filters,omitempty"` +} + +// implements the service definition of ReadNetPeeringsResponse +type ReadNetPeeringsResponse struct { + NetPeerings []NetPeering `json:"NetPeerings,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadNetsRequest +type ReadNetsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersNet `json:"Filters,omitempty"` +} + +// implements the service definition of ReadNetsResponse +type ReadNetsResponse struct { + Nets []Net `json:"Nets,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadNicsRequest +type ReadNicsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersNic `json:"Filters,omitempty"` +} + +// implements the service definition of ReadNicsResponse +type ReadNicsResponse struct { + Nics []Nic `json:"Nics,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadPoliciesRequest +type ReadPoliciesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + IsLinked bool `json:"IsLinked,omitempty"` + Path string `json:"Path,omitempty"` + UserGroupName string `json:"UserGroupName,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of ReadPoliciesResponse +type ReadPoliciesResponse struct { + Policies []Policy `json:"Policies,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadPrefixListsRequest +type ReadPrefixListsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` + PrefixListIds []string `json:"PrefixListIds,omitempty"` +} + +// implements the service definition of ReadPrefixListsResponse +type ReadPrefixListsResponse struct { + PrefixLists []PrefixLists `json:"PrefixLists,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadProductTypesRequest +type ReadProductTypesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` +} + +// implements the service definition of ReadProductTypesResponse +type ReadProductTypesResponse struct { + ProductTypes []ProductType `json:"ProductTypes,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadPublicCatalogRequest +type ReadPublicCatalogRequest struct { + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of ReadPublicCatalogResponse +type ReadPublicCatalogResponse struct { + Catalog Catalog_1 `json:"Catalog,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadPublicIpRangesRequest +type ReadPublicIpRangesRequest struct { + DryRun bool `json:"DryRun,omitempty"` +} + +// implements the service definition of ReadPublicIpRangesResponse +type ReadPublicIpRangesResponse struct { + PublicIps []string `json:"PublicIps,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadPublicIpsRequest +type ReadPublicIpsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersPublicIp `json:"Filters,omitempty"` +} + +// implements the service definition of ReadPublicIpsResponse +type ReadPublicIpsResponse struct { + PublicIps []PublicIp `json:"PublicIps,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadQuotasRequest +type ReadQuotasRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` + QuotaNames []string `json:"QuotaNames,omitempty"` +} + +// implements the service definition of ReadQuotasResponse +type ReadQuotasResponse struct { + QuotaTypes []QuotaTypes `json:"QuotaTypes,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadRegionConfigRequest +type ReadRegionConfigRequest struct { + DryRun bool `json:"DryRun,omitempty"` + FromDate string `json:"FromDate,omitempty"` +} + +// implements the service definition of ReadRegionConfigResponse +type ReadRegionConfigResponse struct { + RegionConfig RegionConfig `json:"RegionConfig,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadRegionsRequest +type ReadRegionsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` + RegionNames []string `json:"RegionNames,omitempty"` +} + +// implements the service definition of ReadRegionsResponse +type ReadRegionsResponse struct { + Regions []Region `json:"Regions,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadReservedVmOffersRequest +type ReadReservedVmOffersRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` + OfferingType string `json:"OfferingType,omitempty"` + ProductType string `json:"ProductType,omitempty"` + ReservedVmsOfferIds []string `json:"ReservedVmsOfferIds,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` + Tenancy string `json:"Tenancy,omitempty"` + VmType string `json:"VmType,omitempty"` +} + +// implements the service definition of ReadReservedVmOffersResponse +type ReadReservedVmOffersResponse struct { + ReservedVmsOffers []ReservedVmsOffer `json:"ReservedVmsOffers,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadReservedVmsRequest +type ReadReservedVmsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` + OfferingType string `json:"OfferingType,omitempty"` + ReservedVmsIds []string `json:"ReservedVmsIds,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` +} + +// implements the service definition of ReadReservedVmsResponse +type ReadReservedVmsResponse struct { + ReservedVms []ReservedVm `json:"ReservedVms,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadRouteTablesRequest +type ReadRouteTablesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersRouteTable `json:"Filters,omitempty"` +} + +// implements the service definition of ReadRouteTablesResponse +type ReadRouteTablesResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + RouteTables []RouteTable `json:"RouteTables,omitempty"` +} + +// implements the service definition of ReadSecurityGroupsRequest +type ReadSecurityGroupsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersSecurityGroup `json:"Filters,omitempty"` +} + +// implements the service definition of ReadSecurityGroupsResponse +type ReadSecurityGroupsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + SecurityGroups []SecurityGroup `json:"SecurityGroups,omitempty"` +} + +// implements the service definition of ReadServerCertificatesRequest +type ReadServerCertificatesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Path string `json:"Path,omitempty"` +} + +// implements the service definition of ReadServerCertificatesResponse +type ReadServerCertificatesResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + ServerCertificates []ServerCertificate `json:"ServerCertificates,omitempty"` +} + +// implements the service definition of ReadSnapshotExportTasksRequest +type ReadSnapshotExportTasksRequest struct { + DryRun bool `json:"DryRun,omitempty"` + TaskIds []string `json:"TaskIds,omitempty"` +} + +// implements the service definition of ReadSnapshotExportTasksResponse +type ReadSnapshotExportTasksResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + SnapshotExportTasks []SnapshotExportTask `json:"SnapshotExportTasks,omitempty"` +} + +// implements the service definition of ReadSnapshotsRequest +type ReadSnapshotsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersSnapshot `json:"Filters,omitempty"` +} + +// implements the service definition of ReadSnapshotsResponse +type ReadSnapshotsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Snapshots []Snapshot `json:"Snapshots,omitempty"` +} + +// implements the service definition of ReadSubnetsRequest +type ReadSubnetsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersSubnet `json:"Filters,omitempty"` +} + +// implements the service definition of ReadSubnetsResponse +type ReadSubnetsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Subnets []Subnet `json:"Subnets,omitempty"` +} + +// implements the service definition of ReadSubregionsRequest +type ReadSubregionsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` + SubregionNames []string `json:"SubregionNames,omitempty"` +} + +// implements the service definition of ReadSubregionsResponse +type ReadSubregionsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Subregions []Subregion `json:"Subregions,omitempty"` +} + +// implements the service definition of ReadTagsRequest +type ReadTagsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersTag `json:"Filters,omitempty"` +} + +// implements the service definition of ReadTagsResponse +type ReadTagsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Tags []Tag `json:"Tags,omitempty"` +} + +// implements the service definition of ReadUserGroupsRequest +type ReadUserGroupsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersUserGroup `json:"Filters,omitempty"` +} + +// implements the service definition of ReadUserGroupsResponse +type ReadUserGroupsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + UserGroups []UserGroup `json:"UserGroups,omitempty"` +} + +// implements the service definition of ReadUsersRequest +type ReadUsersRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Path string `json:"Path,omitempty"` +} + +// implements the service definition of ReadUsersResponse +type ReadUsersResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Users []User `json:"Users,omitempty"` +} + +// implements the service definition of ReadVirtualGatewaysRequest +type ReadVirtualGatewaysRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` +} + +// implements the service definition of ReadVirtualGatewaysResponse +type ReadVirtualGatewaysResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + VirtualGateways []VirtualGateway `json:"VirtualGateways,omitempty"` +} + +// implements the service definition of ReadVmTypesRequest +type ReadVmTypesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters []FiltersOldFormat `json:"Filters,omitempty"` +} + +// implements the service definition of ReadVmTypesResponse +type ReadVmTypesResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + VmTypes []VmType `json:"VmTypes,omitempty"` +} + +// implements the service definition of ReadVmsHealthRequest +type ReadVmsHealthRequest struct { + BackendVmsIds []string `json:"BackendVmsIds,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` +} + +// implements the service definition of ReadVmsHealthResponse +type ReadVmsHealthResponse struct { + BackendVmsHealth []BackendVmsHealth `json:"BackendVmsHealth,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReadVmsRequest +type ReadVmsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersVm `json:"Filters,omitempty"` +} + +// implements the service definition of ReadVmsResponse +type ReadVmsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Vms []Vm `json:"Vms,omitempty"` +} + +// implements the service definition of ReadVmsStateRequest +type ReadVmsStateRequest struct { + AllVms bool `json:"AllVms,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersVmsState `json:"Filters,omitempty"` +} + +// implements the service definition of ReadVmsStateResponse +type ReadVmsStateResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + VmStates []VmStates `json:"VmStates,omitempty"` +} + +// implements the service definition of ReadVolumesRequest +type ReadVolumesRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersVolume `json:"Filters,omitempty"` +} + +// implements the service definition of ReadVolumesResponse +type ReadVolumesResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Volumes []Volume `json:"Volumes,omitempty"` +} + +// implements the service definition of ReadVpnConnectionsRequest +type ReadVpnConnectionsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Filters FiltersVpnConnection `json:"Filters,omitempty"` + VpnConnectionIds []string `json:"VpnConnectionIds,omitempty"` +} + +// implements the service definition of ReadVpnConnectionsResponse +type ReadVpnConnectionsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + VpnConnections []VpnConnection `json:"VpnConnections,omitempty"` +} + +// implements the service definition of RebootVmsRequest +type RebootVmsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + VmIds []string `json:"VmIds,omitempty"` +} + +// implements the service definition of RebootVmsResponse +type RebootVmsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of RecurringCharge +type RecurringCharge struct { + Frequency string `json:"Frequency,omitempty"` +} + +// implements the service definition of Region +type Region struct { + RegionEndpoint string `json:"RegionEndpoint,omitempty"` + RegionName string `json:"RegionName,omitempty"` +} + +// implements the service definition of RegionConfig +type RegionConfig struct { + FromDate string `json:"FromDate,omitempty"` + Regions []RegionDescription `json:"Regions,omitempty"` + TargetRegion TargetRegion `json:"TargetRegion,omitempty"` +} + +// implements the service definition of RegionDescription +type RegionDescription struct { + Attributes []Attribute `json:"Attributes,omitempty"` + Continent string `json:"Continent,omitempty"` + CurrencyCode string `json:"CurrencyCode,omitempty"` + Entity string `json:"Entity,omitempty"` + IsPublic bool `json:"IsPublic,omitempty"` + IsSynchronized bool `json:"IsSynchronized,omitempty"` + Permissions []RegionDescriptionPermission `json:"Permissions,omitempty"` + RegionDomain string `json:"RegionDomain,omitempty"` + RegionId string `json:"RegionId,omitempty"` + RegionInstance string `json:"RegionInstance,omitempty"` + RegionName string `json:"RegionName,omitempty"` + SerialFactor int64 `json:"SerialFactor,omitempty"` + Services []Service `json:"Services,omitempty"` + SubregionNames []string `json:"SubregionNames,omitempty"` +} + +// implements the service definition of RegionDescriptionPermission +type RegionDescriptionPermission struct { + Filter string `json:"Filter,omitempty"` + PermissionType string `json:"PermissionType,omitempty"` +} + +// implements the service definition of RegisterUserInUserGroupRequest +type RegisterUserInUserGroupRequest struct { + DryRun bool `json:"DryRun,omitempty"` + UserGroupName string `json:"UserGroupName,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of RegisterUserInUserGroupResponse +type RegisterUserInUserGroupResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of RegisterVmsInLoadBalancerRequest +type RegisterVmsInLoadBalancerRequest struct { + BackendVmsIds []string `json:"BackendVmsIds,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` +} + +// implements the service definition of RegisterVmsInLoadBalancerResponse +type RegisterVmsInLoadBalancerResponse struct { + BackendVmsIds []string `json:"BackendVmsIds,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of RejectNetPeeringRequest +type RejectNetPeeringRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NetPeeringId string `json:"NetPeeringId,omitempty"` +} + +// implements the service definition of RejectNetPeeringResponse +type RejectNetPeeringResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ReservedVm +type ReservedVm struct { + CurrencyCode string `json:"CurrencyCode,omitempty"` + OfferingType string `json:"OfferingType,omitempty"` + ProductType string `json:"ProductType,omitempty"` + RecurringCharges []RecurringCharge `json:"RecurringCharges,omitempty"` + ReservedVmsId string `json:"ReservedVmsId,omitempty"` + State string `json:"State,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` + Tenancy string `json:"Tenancy,omitempty"` + VmCount int64 `json:"VmCount,omitempty"` + VmType string `json:"VmType,omitempty"` +} + +// implements the service definition of ReservedVmsOffer +type ReservedVmsOffer struct { + CurrencyCode string `json:"CurrencyCode,omitempty"` + Duration int64 `json:"Duration,omitempty"` + FixedPrice int `json:"FixedPrice,omitempty"` + OfferingType string `json:"OfferingType,omitempty"` + PricingDetails []PricingDetail `json:"PricingDetails,omitempty"` + ProductType string `json:"ProductType,omitempty"` + RecurringCharges []RecurringCharge `json:"RecurringCharges,omitempty"` + ReservedVmsOfferId string `json:"ReservedVmsOfferId,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` + Tenancy string `json:"Tenancy,omitempty"` + UsagePrice int `json:"UsagePrice,omitempty"` + VmType string `json:"VmType,omitempty"` +} + +// implements the service definition of ResetAccountPasswordRequest +type ResetAccountPasswordRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Password string `json:"Password,omitempty"` + PasswordToken string `json:"PasswordToken,omitempty"` +} + +// implements the service definition of ResetAccountPasswordResponse +type ResetAccountPasswordResponse struct { + Email string `json:"Email,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ResourceTag +type ResourceTag struct { + Key string `json:"Key,omitempty"` + Value string `json:"Value,omitempty"` +} + +// implements the service definition of ResponseContext +type ResponseContext struct { + RequestId string `json:"RequestId,omitempty"` +} + +// implements the service definition of Route +type Route struct { + CreationMethod string `json:"CreationMethod,omitempty"` + DestinationIpRange string `json:"DestinationIpRange,omitempty"` + DestinationPrefixListId string `json:"DestinationPrefixListId,omitempty"` + GatewayId string `json:"GatewayId,omitempty"` + NatServiceId string `json:"NatServiceId,omitempty"` + NetPeeringId string `json:"NetPeeringId,omitempty"` + NicId string `json:"NicId,omitempty"` + State string `json:"State,omitempty"` + VmAccountId string `json:"VmAccountId,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of RouteLight +type RouteLight struct { + DestinationIpRange string `json:"DestinationIpRange,omitempty"` + RouteType string `json:"RouteType,omitempty"` + State string `json:"State,omitempty"` +} + +// implements the service definition of RoutePropagatingVirtualGateway +type RoutePropagatingVirtualGateway struct { + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` +} + +// implements the service definition of RouteTable +type RouteTable struct { + LinkRouteTables []LinkRouteTable `json:"LinkRouteTables,omitempty"` + NetId string `json:"NetId,omitempty"` + RoutePropagatingVirtualGateways []RoutePropagatingVirtualGateway `json:"RoutePropagatingVirtualGateways,omitempty"` + RouteTableId string `json:"RouteTableId,omitempty"` + Routes []Route `json:"Routes,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of SecurityGroup +type SecurityGroup struct { + AccountId string `json:"AccountId,omitempty"` + Description string `json:"Description,omitempty"` + InboundRules []SecurityGroupRule `json:"InboundRules,omitempty"` + NetId string `json:"NetId,omitempty"` + OutboundRules []SecurityGroupRule `json:"OutboundRules,omitempty"` + SecurityGroupId string `json:"SecurityGroupId,omitempty"` + SecurityGroupName string `json:"SecurityGroupName,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of SecurityGroupLight +type SecurityGroupLight struct { + SecurityGroupId string `json:"SecurityGroupId,omitempty"` + SecurityGroupName string `json:"SecurityGroupName,omitempty"` +} + +// implements the service definition of SecurityGroupRule +type SecurityGroupRule struct { + FromPortRange int64 `json:"FromPortRange,omitempty"` + IpProtocol string `json:"IpProtocol,omitempty"` + IpRanges []string `json:"IpRanges,omitempty"` + PrefixListIds []string `json:"PrefixListIds,omitempty"` + SecurityGroupsMembers []SecurityGroupsMember `json:"SecurityGroupsMembers,omitempty"` + ToPortRange int64 `json:"ToPortRange,omitempty"` +} + +// implements the service definition of SecurityGroupsMember +type SecurityGroupsMember struct { + AccountId string `json:"AccountId,omitempty"` + SecurityGroupId string `json:"SecurityGroupId,omitempty"` + SecurityGroupName string `json:"SecurityGroupName,omitempty"` +} + +// implements the service definition of SendResetPasswordEmailRequest +type SendResetPasswordEmailRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Email string `json:"Email,omitempty"` +} + +// implements the service definition of SendResetPasswordEmailResponse +type SendResetPasswordEmailResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of ServerCertificate +type ServerCertificate struct { + Path string `json:"Path,omitempty"` + ServerCertificateId string `json:"ServerCertificateId,omitempty"` + ServerCertificateName string `json:"ServerCertificateName,omitempty"` +} + +// implements the service definition of Service +type Service struct { + Filters []FiltersServices `json:"Filters,omitempty"` + ServiceName string `json:"ServiceName,omitempty"` + ServiceType string `json:"ServiceType,omitempty"` +} + +// implements the service definition of Snapshot +type Snapshot struct { + AccountAlias string `json:"AccountAlias,omitempty"` + AccountId string `json:"AccountId,omitempty"` + Description string `json:"Description,omitempty"` + PermissionsToCreateVolume PermissionsOnResource `json:"PermissionsToCreateVolume,omitempty"` + Progress int64 `json:"Progress,omitempty"` + SnapshotId string `json:"SnapshotId,omitempty"` + State string `json:"State,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` + VolumeSize int64 `json:"VolumeSize,omitempty"` +} + +// implements the service definition of SnapshotExportTask +type SnapshotExportTask struct { + Comment string `json:"Comment,omitempty"` + OsuExport OsuExport `json:"OsuExport,omitempty"` + Progress int64 `json:"Progress,omitempty"` + SnapshotId string `json:"SnapshotId,omitempty"` + State string `json:"State,omitempty"` + TaskId string `json:"TaskId,omitempty"` +} + +// implements the service definition of SourceNet +type SourceNet struct { + AccountId string `json:"AccountId,omitempty"` + IpRange string `json:"IpRange,omitempty"` + NetId string `json:"NetId,omitempty"` +} + +// implements the service definition of SourceSecurityGroup +type SourceSecurityGroup struct { + SecurityGroupAccountId string `json:"SecurityGroupAccountId,omitempty"` + SecurityGroupName string `json:"SecurityGroupName,omitempty"` +} + +// implements the service definition of StartVmsRequest +type StartVmsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + VmIds []string `json:"VmIds,omitempty"` +} + +// implements the service definition of StartVmsResponse +type StartVmsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Vms []VmState `json:"Vms,omitempty"` +} + +// implements the service definition of StateComment +type StateComment struct { + StateCode string `json:"StateCode,omitempty"` + StateMessage string `json:"StateMessage,omitempty"` +} + +// implements the service definition of StopVmsRequest +type StopVmsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ForceStop bool `json:"ForceStop,omitempty"` + VmIds []string `json:"VmIds,omitempty"` +} + +// implements the service definition of StopVmsResponse +type StopVmsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Vms []VmState `json:"Vms,omitempty"` +} + +// implements the service definition of Subnet +type Subnet struct { + AvailableIpsCount int64 `json:"AvailableIpsCount,omitempty"` + IpRange string `json:"IpRange,omitempty"` + NetId string `json:"NetId,omitempty"` + State string `json:"State,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` +} + +// implements the service definition of Subregion +type Subregion struct { + RegionName string `json:"RegionName,omitempty"` + State string `json:"State,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` +} + +// implements the service definition of Tag +type Tag struct { + Key string `json:"Key,omitempty"` + ResourceId string `json:"ResourceId,omitempty"` + ResourceType string `json:"ResourceType,omitempty"` + Value string `json:"Value,omitempty"` +} + +// implements the service definition of TargetRegion +type TargetRegion struct { + RegionDomain string `json:"RegionDomain,omitempty"` + RegionId string `json:"RegionId,omitempty"` + RegionName string `json:"RegionName,omitempty"` +} + +// implements the service definition of UnlinkInternetServiceRequest +type UnlinkInternetServiceRequest struct { + DryRun bool `json:"DryRun,omitempty"` + InternetServiceId string `json:"InternetServiceId,omitempty"` + NetId string `json:"NetId,omitempty"` +} + +// implements the service definition of UnlinkInternetServiceResponse +type UnlinkInternetServiceResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UnlinkNicRequest +type UnlinkNicRequest struct { + DryRun bool `json:"DryRun,omitempty"` + LinkNicId string `json:"LinkNicId,omitempty"` +} + +// implements the service definition of UnlinkNicResponse +type UnlinkNicResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UnlinkPolicyRequest +type UnlinkPolicyRequest struct { + DryRun bool `json:"DryRun,omitempty"` + PolicyId string `json:"PolicyId,omitempty"` + UserGroupName string `json:"UserGroupName,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of UnlinkPolicyResponse +type UnlinkPolicyResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UnlinkPrivateIpsRequest +type UnlinkPrivateIpsRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NicId string `json:"NicId,omitempty"` + PrivateIps []string `json:"PrivateIps,omitempty"` +} + +// implements the service definition of UnlinkPrivateIpsResponse +type UnlinkPrivateIpsResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UnlinkPublicIpRequest +type UnlinkPublicIpRequest struct { + DryRun bool `json:"DryRun,omitempty"` + LinkPublicIpId string `json:"LinkPublicIpId,omitempty"` + PublicIp string `json:"PublicIp,omitempty"` +} + +// implements the service definition of UnlinkPublicIpResponse +type UnlinkPublicIpResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UnlinkRouteTableRequest +type UnlinkRouteTableRequest struct { + DryRun bool `json:"DryRun,omitempty"` + LinkRouteTableId string `json:"LinkRouteTableId,omitempty"` +} + +// implements the service definition of UnlinkRouteTableResponse +type UnlinkRouteTableResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UnlinkVirtualGatewayRequest +type UnlinkVirtualGatewayRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NetId string `json:"NetId,omitempty"` + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` +} + +// implements the service definition of UnlinkVirtualGatewayResponse +type UnlinkVirtualGatewayResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UnlinkVolumeRequest +type UnlinkVolumeRequest struct { + DeviceName string `json:"DeviceName,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + ForceUnlink bool `json:"ForceUnlink,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` +} + +// implements the service definition of UnlinkVolumeResponse +type UnlinkVolumeResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateAccountRequest +type UpdateAccountRequest struct { + City string `json:"City,omitempty"` + CompanyName string `json:"CompanyName,omitempty"` + Country string `json:"Country,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + Email string `json:"Email,omitempty"` + FirstName string `json:"FirstName,omitempty"` + JobTitle string `json:"JobTitle,omitempty"` + LastName string `json:"LastName,omitempty"` + Mobile string `json:"Mobile,omitempty"` + Password string `json:"Password,omitempty"` + Phone string `json:"Phone,omitempty"` + StateProvince string `json:"StateProvince,omitempty"` + VatNumber string `json:"VatNumber,omitempty"` + ZipCode string `json:"ZipCode,omitempty"` +} + +// implements the service definition of UpdateAccountResponse +type UpdateAccountResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateApiKeyRequest +type UpdateApiKeyRequest struct { + ApiKeyId string `json:"ApiKeyId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + State string `json:"State,omitempty"` +} + +// implements the service definition of UpdateApiKeyResponse +type UpdateApiKeyResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateHealthCheckRequest +type UpdateHealthCheckRequest struct { + DryRun bool `json:"DryRun,omitempty"` + HealthCheck HealthCheck `json:"HealthCheck,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` +} + +// implements the service definition of UpdateHealthCheckResponse +type UpdateHealthCheckResponse struct { + HealthCheck HealthCheck `json:"HealthCheck,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateImageRequest +type UpdateImageRequest struct { + DryRun bool `json:"DryRun,omitempty"` + ImageId string `json:"ImageId,omitempty"` + PermissionsToLaunch PermissionsOnResourceCreation `json:"PermissionsToLaunch,omitempty"` +} + +// implements the service definition of UpdateImageResponse +type UpdateImageResponse struct { + Image Image `json:"Image,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateKeypairRequest +type UpdateKeypairRequest struct { + DryRun bool `json:"DryRun,omitempty"` + KeypairName string `json:"KeypairName,omitempty"` + PublicKey string `json:"PublicKey,omitempty"` +} + +// implements the service definition of UpdateKeypairResponse +type UpdateKeypairResponse struct { + KeypairFingerprint string `json:"KeypairFingerprint,omitempty"` + KeypairName string `json:"KeypairName,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateListenerRuleRequest +type UpdateListenerRuleRequest struct { + Attribute string `json:"Attribute,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + ListenerRuleName string `json:"ListenerRuleName,omitempty"` + Value string `json:"Value,omitempty"` +} + +// implements the service definition of UpdateListenerRuleResponse +type UpdateListenerRuleResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateLoadBalancerRequest +type UpdateLoadBalancerRequest struct { + AccessLog AccessLog `json:"AccessLog,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + LoadBalancerName string `json:"LoadBalancerName,omitempty"` + LoadBalancerPort int64 `json:"LoadBalancerPort,omitempty"` + PolicyNames []string `json:"PolicyNames,omitempty"` + ServerCertificateId string `json:"ServerCertificateId,omitempty"` +} + +// implements the service definition of UpdateLoadBalancerResponse +type UpdateLoadBalancerResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateNetAccessPointRequest +type UpdateNetAccessPointRequest struct { + AddRouteTableIds []string `json:"AddRouteTableIds,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + NetAccessPointId string `json:"NetAccessPointId,omitempty"` + RemoveRouteTableIds []string `json:"RemoveRouteTableIds,omitempty"` +} + +// implements the service definition of UpdateNetAccessPointResponse +type UpdateNetAccessPointResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateNetRequest +type UpdateNetRequest struct { + DhcpOptionsSetId string `json:"DhcpOptionsSetId,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + NetId string `json:"NetId,omitempty"` +} + +// implements the service definition of UpdateNetResponse +type UpdateNetResponse struct { + Net Net `json:"Net,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateNicRequest +type UpdateNicRequest struct { + Description string `json:"Description,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + LinkNic LinkNicToUpdate `json:"LinkNic,omitempty"` + NicId string `json:"NicId,omitempty"` + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` +} + +// implements the service definition of UpdateNicResponse +type UpdateNicResponse struct { + Nic Nic `json:"Nic,omitempty"` + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateRoutePropagationRequest +type UpdateRoutePropagationRequest struct { + DryRun bool `json:"DryRun,omitempty"` + Enable bool `json:"Enable,omitempty"` + RouteTableId string `json:"RouteTableId,omitempty"` + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` +} + +// implements the service definition of UpdateRoutePropagationResponse +type UpdateRoutePropagationResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + RouteTable RouteTable `json:"RouteTable,omitempty"` +} + +// implements the service definition of UpdateRouteRequest +type UpdateRouteRequest struct { + DestinationIpRange string `json:"DestinationIpRange,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + GatewayId string `json:"GatewayId,omitempty"` + NatServiceId string `json:"NatServiceId,omitempty"` + NetPeeringId string `json:"NetPeeringId,omitempty"` + NicId string `json:"NicId,omitempty"` + RouteTableId string `json:"RouteTableId,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of UpdateRouteResponse +type UpdateRouteResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Route Route `json:"Route,omitempty"` +} + +// implements the service definition of UpdateServerCertificateRequest +type UpdateServerCertificateRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NewPath string `json:"NewPath,omitempty"` + NewServerCertificateName string `json:"NewServerCertificateName,omitempty"` + ServerCertificateName string `json:"ServerCertificateName,omitempty"` +} + +// implements the service definition of UpdateServerCertificateResponse +type UpdateServerCertificateResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateSnapshotRequest +type UpdateSnapshotRequest struct { + DryRun bool `json:"DryRun,omitempty"` + PermissionsToCreateVolume PermissionsOnResourceCreation `json:"PermissionsToCreateVolume,omitempty"` + SnapshotId string `json:"SnapshotId,omitempty"` +} + +// implements the service definition of UpdateSnapshotResponse +type UpdateSnapshotResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Snapshot Snapshot `json:"Snapshot,omitempty"` +} + +// implements the service definition of UpdateUserGroupRequest +type UpdateUserGroupRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NewPath string `json:"NewPath,omitempty"` + NewUserGroupName string `json:"NewUserGroupName,omitempty"` + UserGroupName string `json:"UserGroupName,omitempty"` +} + +// implements the service definition of UpdateUserGroupResponse +type UpdateUserGroupResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateUserRequest +type UpdateUserRequest struct { + DryRun bool `json:"DryRun,omitempty"` + NewPath string `json:"NewPath,omitempty"` + NewUserName string `json:"NewUserName,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of UpdateUserResponse +type UpdateUserResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` +} + +// implements the service definition of UpdateVmRequest +type UpdateVmRequest struct { + BlockDeviceMappings []BlockDeviceMappingVmUpdate `json:"BlockDeviceMappings,omitempty"` + BsuOptimized bool `json:"BsuOptimized,omitempty"` + DeletionProtection bool `json:"DeletionProtection,omitempty"` + DryRun bool `json:"DryRun,omitempty"` + IsSourceDestChecked bool `json:"IsSourceDestChecked,omitempty"` + KeypairName string `json:"KeypairName,omitempty"` + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + UserData string `json:"UserData,omitempty"` + VmId string `json:"VmId,omitempty"` + VmInitiatedShutdownBehavior string `json:"VmInitiatedShutdownBehavior,omitempty"` + VmType string `json:"VmType,omitempty"` +} + +// implements the service definition of UpdateVmResponse +type UpdateVmResponse struct { + ResponseContext ResponseContext `json:"ResponseContext,omitempty"` + Vm Vm `json:"Vm,omitempty"` +} + +// implements the service definition of User +type User struct { + Path string `json:"Path,omitempty"` + UserId string `json:"UserId,omitempty"` + UserName string `json:"UserName,omitempty"` +} + +// implements the service definition of UserGroup +type UserGroup struct { + Path string `json:"Path,omitempty"` + UserGroupId string `json:"UserGroupId,omitempty"` + UserGroupName string `json:"UserGroupName,omitempty"` +} + +// implements the service definition of VirtualGateway +type VirtualGateway struct { + ConnectionType string `json:"ConnectionType,omitempty"` + NetToVirtualGatewayLinks []NetToVirtualGatewayLink `json:"NetToVirtualGatewayLinks,omitempty"` + State string `json:"State,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` +} + +// implements the service definition of Vm +type Vm struct { + Architecture string `json:"Architecture,omitempty"` + BlockDeviceMappings []BlockDeviceMappingCreated `json:"BlockDeviceMappings,omitempty"` + BsuOptimized bool `json:"BsuOptimized,omitempty"` + ClientToken string `json:"ClientToken,omitempty"` + DeletionProtection bool `json:"DeletionProtection,omitempty"` + Hypervisor string `json:"Hypervisor,omitempty"` + ImageId string `json:"ImageId,omitempty"` + IsSourceDestChecked bool `json:"IsSourceDestChecked,omitempty"` + KeypairName string `json:"KeypairName,omitempty"` + LaunchNumber int64 `json:"LaunchNumber,omitempty"` + NetId string `json:"NetId,omitempty"` + Nics []NicLight `json:"Nics,omitempty"` + OsFamily string `json:"OsFamily,omitempty"` + Placement Placement `json:"Placement,omitempty"` + PrivateDnsName string `json:"PrivateDnsName,omitempty"` + PrivateIp string `json:"PrivateIp,omitempty"` + ProductCodes []string `json:"ProductCodes,omitempty"` + PublicDnsName string `json:"PublicDnsName,omitempty"` + PublicIp string `json:"PublicIp,omitempty"` + ReservationId string `json:"ReservationId,omitempty"` + RootDeviceName string `json:"RootDeviceName,omitempty"` + RootDeviceType string `json:"RootDeviceType,omitempty"` + SecurityGroups []SecurityGroupLight `json:"SecurityGroups,omitempty"` + State string `json:"State,omitempty"` + StateReason string `json:"StateReason,omitempty"` + SubnetId string `json:"SubnetId,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` + UserData string `json:"UserData,omitempty"` + VmId string `json:"VmId,omitempty"` + VmInitiatedShutdownBehavior string `json:"VmInitiatedShutdownBehavior,omitempty"` + VmType string `json:"VmType,omitempty"` +} + +// implements the service definition of VmState +type VmState struct { + CurrentState string `json:"CurrentState,omitempty"` + PreviousState string `json:"PreviousState,omitempty"` + VmId string `json:"VmId,omitempty"` +} + +// implements the service definition of VmStates +type VmStates struct { + MaintenanceEvents []MaintenanceEvent `json:"MaintenanceEvents,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` + VmId string `json:"VmId,omitempty"` + VmState string `json:"VmState,omitempty"` +} + +// implements the service definition of VmType +type VmType struct { + IsBsuOptimized bool `json:"IsBsuOptimized,omitempty"` + MaxPrivateIps int64 `json:"MaxPrivateIps,omitempty"` + MemorySize int64 `json:"MemorySize,omitempty"` + StorageCount int64 `json:"StorageCount,omitempty"` + StorageSize int64 `json:"StorageSize,omitempty"` + VcoreCount int64 `json:"VcoreCount,omitempty"` + VmTypeName string `json:"VmTypeName,omitempty"` +} + +// implements the service definition of Volume +type Volume struct { + Iops int64 `json:"Iops,omitempty"` + LinkedVolumes []LinkedVolume `json:"LinkedVolumes,omitempty"` + Size int64 `json:"Size,omitempty"` + SnapshotId string `json:"SnapshotId,omitempty"` + State string `json:"State,omitempty"` + SubregionName string `json:"SubregionName,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` + VolumeId string `json:"VolumeId,omitempty"` + VolumeType string `json:"VolumeType,omitempty"` +} + +// implements the service definition of VpnConnection +type VpnConnection struct { + ClientGatewayConfiguration string `json:"ClientGatewayConfiguration,omitempty"` + ClientGatewayId string `json:"ClientGatewayId,omitempty"` + ConnectionType string `json:"ConnectionType,omitempty"` + Routes []RouteLight `json:"Routes,omitempty"` + State string `json:"State,omitempty"` + StaticRoutesOnly bool `json:"StaticRoutesOnly,omitempty"` + Tags []ResourceTag `json:"Tags,omitempty"` + VirtualGatewayId string `json:"VirtualGatewayId,omitempty"` + VpnConnectionId string `json:"VpnConnectionId,omitempty"` +} + +// implements the service definition of With +type With struct { + CallDuration bool `json:"CallDuration,omitempty"` + QueryAccessKey bool `json:"QueryAccessKey,omitempty"` + QueryApiName bool `json:"QueryApiName,omitempty"` + QueryApiVersion bool `json:"QueryApiVersion,omitempty"` + QueryCallName bool `json:"QueryCallName,omitempty"` + QueryDate bool `json:"QueryDate,omitempty"` + QueryIpAddress bool `json:"QueryIpAddress,omitempty"` + QueryRaw bool `json:"QueryRaw,omitempty"` + QuerySize bool `json:"QuerySize,omitempty"` + QueryUserAgent bool `json:"QueryUserAgent,omitempty"` + ResponseId bool `json:"ResponseId,omitempty"` + ResponseSize bool `json:"ResponseSize,omitempty"` + ResponseStatusCode bool `json:"ResponseStatusCode,omitempty"` +} + +// POST_AcceptNetPeeringParameters holds parameters to POST_AcceptNetPeering +type POST_AcceptNetPeeringParameters struct { + Acceptnetpeeringrequest AcceptNetPeeringRequest `json:"acceptnetpeeringrequest,omitempty"` +} + +// POST_AcceptNetPeeringResponses holds responses of POST_AcceptNetPeering +type POST_AcceptNetPeeringResponses struct { + OK *AcceptNetPeeringResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code409 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_AuthenticateAccountParameters holds parameters to POST_AuthenticateAccount +type POST_AuthenticateAccountParameters struct { + Authenticateaccountrequest AuthenticateAccountRequest `json:"authenticateaccountrequest,omitempty"` +} + +// POST_AuthenticateAccountResponses holds responses of POST_AuthenticateAccount +type POST_AuthenticateAccountResponses struct { + OK *AuthenticateAccountResponse +} + +// POST_CheckSignatureParameters holds parameters to POST_CheckSignature +type POST_CheckSignatureParameters struct { + Checksignaturerequest CheckSignatureRequest `json:"checksignaturerequest,omitempty"` +} + +// POST_CheckSignatureResponses holds responses of POST_CheckSignature +type POST_CheckSignatureResponses struct { + OK *CheckSignatureResponse +} + +// POST_CopyAccountParameters holds parameters to POST_CopyAccount +type POST_CopyAccountParameters struct { + Copyaccountrequest CopyAccountRequest `json:"copyaccountrequest,omitempty"` +} + +// POST_CopyAccountResponses holds responses of POST_CopyAccount +type POST_CopyAccountResponses struct { + OK *CopyAccountResponse +} + +// POST_CreateAccountParameters holds parameters to POST_CreateAccount +type POST_CreateAccountParameters struct { + Createaccountrequest CreateAccountRequest `json:"createaccountrequest,omitempty"` +} + +// POST_CreateAccountResponses holds responses of POST_CreateAccount +type POST_CreateAccountResponses struct { + OK *CreateAccountResponse +} + +// POST_CreateApiKeyParameters holds parameters to POST_CreateApiKey +type POST_CreateApiKeyParameters struct { + Createapikeyrequest CreateApiKeyRequest `json:"createapikeyrequest,omitempty"` +} + +// POST_CreateApiKeyResponses holds responses of POST_CreateApiKey +type POST_CreateApiKeyResponses struct { + OK *CreateApiKeyResponse +} + +// POST_CreateClientGatewayParameters holds parameters to POST_CreateClientGateway +type POST_CreateClientGatewayParameters struct { + Createclientgatewayrequest CreateClientGatewayRequest `json:"createclientgatewayrequest,omitempty"` +} + +// POST_CreateClientGatewayResponses holds responses of POST_CreateClientGateway +type POST_CreateClientGatewayResponses struct { + OK *CreateClientGatewayResponse +} + +// POST_CreateDhcpOptionsParameters holds parameters to POST_CreateDhcpOptions +type POST_CreateDhcpOptionsParameters struct { + Createdhcpoptionsrequest CreateDhcpOptionsRequest `json:"createdhcpoptionsrequest,omitempty"` +} + +// POST_CreateDhcpOptionsResponses holds responses of POST_CreateDhcpOptions +type POST_CreateDhcpOptionsResponses struct { + OK *CreateDhcpOptionsResponse +} + +// POST_CreateDirectLinkParameters holds parameters to POST_CreateDirectLink +type POST_CreateDirectLinkParameters struct { + Createdirectlinkrequest CreateDirectLinkRequest `json:"createdirectlinkrequest,omitempty"` +} + +// POST_CreateDirectLinkResponses holds responses of POST_CreateDirectLink +type POST_CreateDirectLinkResponses struct { + OK *CreateDirectLinkResponse +} + +// POST_CreateDirectLinkInterfaceParameters holds parameters to POST_CreateDirectLinkInterface +type POST_CreateDirectLinkInterfaceParameters struct { + Createdirectlinkinterfacerequest CreateDirectLinkInterfaceRequest `json:"createdirectlinkinterfacerequest,omitempty"` +} + +// POST_CreateDirectLinkInterfaceResponses holds responses of POST_CreateDirectLinkInterface +type POST_CreateDirectLinkInterfaceResponses struct { + OK *CreateDirectLinkInterfaceResponse +} + +// POST_CreateImageParameters holds parameters to POST_CreateImage +type POST_CreateImageParameters struct { + Createimagerequest CreateImageRequest `json:"createimagerequest,omitempty"` +} + +// POST_CreateImageResponses holds responses of POST_CreateImage +type POST_CreateImageResponses struct { + OK *CreateImageResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateImageExportTaskParameters holds parameters to POST_CreateImageExportTask +type POST_CreateImageExportTaskParameters struct { + Createimageexporttaskrequest CreateImageExportTaskRequest `json:"createimageexporttaskrequest,omitempty"` +} + +// POST_CreateImageExportTaskResponses holds responses of POST_CreateImageExportTask +type POST_CreateImageExportTaskResponses struct { + OK *CreateImageExportTaskResponse +} + +// POST_CreateInternetServiceParameters holds parameters to POST_CreateInternetService +type POST_CreateInternetServiceParameters struct { + Createinternetservicerequest CreateInternetServiceRequest `json:"createinternetservicerequest,omitempty"` +} + +// POST_CreateInternetServiceResponses holds responses of POST_CreateInternetService +type POST_CreateInternetServiceResponses struct { + OK *CreateInternetServiceResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateKeypairParameters holds parameters to POST_CreateKeypair +type POST_CreateKeypairParameters struct { + Createkeypairrequest CreateKeypairRequest `json:"createkeypairrequest,omitempty"` +} + +// POST_CreateKeypairResponses holds responses of POST_CreateKeypair +type POST_CreateKeypairResponses struct { + OK *CreateKeypairResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code409 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateListenerRuleParameters holds parameters to POST_CreateListenerRule +type POST_CreateListenerRuleParameters struct { + Createlistenerrulerequest CreateListenerRuleRequest `json:"createlistenerrulerequest,omitempty"` +} + +// POST_CreateListenerRuleResponses holds responses of POST_CreateListenerRule +type POST_CreateListenerRuleResponses struct { + OK *CreateListenerRuleResponse +} + +// POST_CreateLoadBalancerParameters holds parameters to POST_CreateLoadBalancer +type POST_CreateLoadBalancerParameters struct { + Createloadbalancerrequest CreateLoadBalancerRequest `json:"createloadbalancerrequest,omitempty"` +} + +// POST_CreateLoadBalancerResponses holds responses of POST_CreateLoadBalancer +type POST_CreateLoadBalancerResponses struct { + OK *CreateLoadBalancerResponse +} + +// POST_CreateLoadBalancerListenersParameters holds parameters to POST_CreateLoadBalancerListeners +type POST_CreateLoadBalancerListenersParameters struct { + Createloadbalancerlistenersrequest CreateLoadBalancerListenersRequest `json:"createloadbalancerlistenersrequest,omitempty"` +} + +// POST_CreateLoadBalancerListenersResponses holds responses of POST_CreateLoadBalancerListeners +type POST_CreateLoadBalancerListenersResponses struct { + OK *CreateLoadBalancerListenersResponse +} + +// POST_CreateLoadBalancerPolicyParameters holds parameters to POST_CreateLoadBalancerPolicy +type POST_CreateLoadBalancerPolicyParameters struct { + Createloadbalancerpolicyrequest CreateLoadBalancerPolicyRequest `json:"createloadbalancerpolicyrequest,omitempty"` +} + +// POST_CreateLoadBalancerPolicyResponses holds responses of POST_CreateLoadBalancerPolicy +type POST_CreateLoadBalancerPolicyResponses struct { + OK *CreateLoadBalancerPolicyResponse +} + +// POST_CreateNatServiceParameters holds parameters to POST_CreateNatService +type POST_CreateNatServiceParameters struct { + Createnatservicerequest CreateNatServiceRequest `json:"createnatservicerequest,omitempty"` +} + +// POST_CreateNatServiceResponses holds responses of POST_CreateNatService +type POST_CreateNatServiceResponses struct { + OK *CreateNatServiceResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateNetParameters holds parameters to POST_CreateNet +type POST_CreateNetParameters struct { + Createnetrequest CreateNetRequest `json:"createnetrequest,omitempty"` +} + +// POST_CreateNetResponses holds responses of POST_CreateNet +type POST_CreateNetResponses struct { + OK *CreateNetResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code409 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateNetAccessPointParameters holds parameters to POST_CreateNetAccessPoint +type POST_CreateNetAccessPointParameters struct { + Createnetaccesspointrequest CreateNetAccessPointRequest `json:"createnetaccesspointrequest,omitempty"` +} + +// POST_CreateNetAccessPointResponses holds responses of POST_CreateNetAccessPoint +type POST_CreateNetAccessPointResponses struct { + OK *CreateNetAccessPointResponse +} + +// POST_CreateNetPeeringParameters holds parameters to POST_CreateNetPeering +type POST_CreateNetPeeringParameters struct { + Createnetpeeringrequest CreateNetPeeringRequest `json:"createnetpeeringrequest,omitempty"` +} + +// POST_CreateNetPeeringResponses holds responses of POST_CreateNetPeering +type POST_CreateNetPeeringResponses struct { + OK *CreateNetPeeringResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateNicParameters holds parameters to POST_CreateNic +type POST_CreateNicParameters struct { + Createnicrequest CreateNicRequest `json:"createnicrequest,omitempty"` +} + +// POST_CreateNicResponses holds responses of POST_CreateNic +type POST_CreateNicResponses struct { + OK *CreateNicResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreatePolicyParameters holds parameters to POST_CreatePolicy +type POST_CreatePolicyParameters struct { + Createpolicyrequest CreatePolicyRequest `json:"createpolicyrequest,omitempty"` +} + +// POST_CreatePolicyResponses holds responses of POST_CreatePolicy +type POST_CreatePolicyResponses struct { + OK *CreatePolicyResponse +} + +// POST_CreatePublicIpParameters holds parameters to POST_CreatePublicIp +type POST_CreatePublicIpParameters struct { + Createpubliciprequest CreatePublicIpRequest `json:"createpubliciprequest,omitempty"` +} + +// POST_CreatePublicIpResponses holds responses of POST_CreatePublicIp +type POST_CreatePublicIpResponses struct { + OK *CreatePublicIpResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateRouteParameters holds parameters to POST_CreateRoute +type POST_CreateRouteParameters struct { + Createrouterequest CreateRouteRequest `json:"createrouterequest,omitempty"` +} + +// POST_CreateRouteResponses holds responses of POST_CreateRoute +type POST_CreateRouteResponses struct { + OK *CreateRouteResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateRouteTableParameters holds parameters to POST_CreateRouteTable +type POST_CreateRouteTableParameters struct { + Createroutetablerequest CreateRouteTableRequest `json:"createroutetablerequest,omitempty"` +} + +// POST_CreateRouteTableResponses holds responses of POST_CreateRouteTable +type POST_CreateRouteTableResponses struct { + OK *CreateRouteTableResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateSecurityGroupParameters holds parameters to POST_CreateSecurityGroup +type POST_CreateSecurityGroupParameters struct { + Createsecuritygrouprequest CreateSecurityGroupRequest `json:"createsecuritygrouprequest,omitempty"` +} + +// POST_CreateSecurityGroupResponses holds responses of POST_CreateSecurityGroup +type POST_CreateSecurityGroupResponses struct { + OK *CreateSecurityGroupResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateSecurityGroupRuleParameters holds parameters to POST_CreateSecurityGroupRule +type POST_CreateSecurityGroupRuleParameters struct { + Createsecuritygrouprulerequest CreateSecurityGroupRuleRequest `json:"createsecuritygrouprulerequest,omitempty"` +} + +// POST_CreateSecurityGroupRuleResponses holds responses of POST_CreateSecurityGroupRule +type POST_CreateSecurityGroupRuleResponses struct { + OK *CreateSecurityGroupRuleResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateServerCertificateParameters holds parameters to POST_CreateServerCertificate +type POST_CreateServerCertificateParameters struct { + Createservercertificaterequest CreateServerCertificateRequest `json:"createservercertificaterequest,omitempty"` +} + +// POST_CreateServerCertificateResponses holds responses of POST_CreateServerCertificate +type POST_CreateServerCertificateResponses struct { + OK *CreateServerCertificateResponse +} + +// POST_CreateSnapshotParameters holds parameters to POST_CreateSnapshot +type POST_CreateSnapshotParameters struct { + Createsnapshotrequest CreateSnapshotRequest `json:"createsnapshotrequest,omitempty"` +} + +// POST_CreateSnapshotResponses holds responses of POST_CreateSnapshot +type POST_CreateSnapshotResponses struct { + OK *CreateSnapshotResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateSnapshotExportTaskParameters holds parameters to POST_CreateSnapshotExportTask +type POST_CreateSnapshotExportTaskParameters struct { + Createsnapshotexporttaskrequest CreateSnapshotExportTaskRequest `json:"createsnapshotexporttaskrequest,omitempty"` +} + +// POST_CreateSnapshotExportTaskResponses holds responses of POST_CreateSnapshotExportTask +type POST_CreateSnapshotExportTaskResponses struct { + OK *CreateSnapshotExportTaskResponse +} + +// POST_CreateSubnetParameters holds parameters to POST_CreateSubnet +type POST_CreateSubnetParameters struct { + Createsubnetrequest CreateSubnetRequest `json:"createsubnetrequest,omitempty"` +} + +// POST_CreateSubnetResponses holds responses of POST_CreateSubnet +type POST_CreateSubnetResponses struct { + OK *CreateSubnetResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code409 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateTagsParameters holds parameters to POST_CreateTags +type POST_CreateTagsParameters struct { + Createtagsrequest CreateTagsRequest `json:"createtagsrequest,omitempty"` +} + +// POST_CreateTagsResponses holds responses of POST_CreateTags +type POST_CreateTagsResponses struct { + OK *CreateTagsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateUserParameters holds parameters to POST_CreateUser +type POST_CreateUserParameters struct { + Createuserrequest CreateUserRequest `json:"createuserrequest,omitempty"` +} + +// POST_CreateUserResponses holds responses of POST_CreateUser +type POST_CreateUserResponses struct { + OK *CreateUserResponse +} + +// POST_CreateUserGroupParameters holds parameters to POST_CreateUserGroup +type POST_CreateUserGroupParameters struct { + Createusergrouprequest CreateUserGroupRequest `json:"createusergrouprequest,omitempty"` +} + +// POST_CreateUserGroupResponses holds responses of POST_CreateUserGroup +type POST_CreateUserGroupResponses struct { + OK *CreateUserGroupResponse +} + +// POST_CreateVirtualGatewayParameters holds parameters to POST_CreateVirtualGateway +type POST_CreateVirtualGatewayParameters struct { + Createvirtualgatewayrequest CreateVirtualGatewayRequest `json:"createvirtualgatewayrequest,omitempty"` +} + +// POST_CreateVirtualGatewayResponses holds responses of POST_CreateVirtualGateway +type POST_CreateVirtualGatewayResponses struct { + OK *CreateVirtualGatewayResponse +} + +// POST_CreateVmsParameters holds parameters to POST_CreateVms +type POST_CreateVmsParameters struct { + Createvmsrequest CreateVmsRequest `json:"createvmsrequest,omitempty"` +} + +// POST_CreateVmsResponses holds responses of POST_CreateVms +type POST_CreateVmsResponses struct { + OK *CreateVmsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateVolumeParameters holds parameters to POST_CreateVolume +type POST_CreateVolumeParameters struct { + Createvolumerequest CreateVolumeRequest `json:"createvolumerequest,omitempty"` +} + +// POST_CreateVolumeResponses holds responses of POST_CreateVolume +type POST_CreateVolumeResponses struct { + OK *CreateVolumeResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_CreateVpnConnectionParameters holds parameters to POST_CreateVpnConnection +type POST_CreateVpnConnectionParameters struct { + Createvpnconnectionrequest CreateVpnConnectionRequest `json:"createvpnconnectionrequest,omitempty"` +} + +// POST_CreateVpnConnectionResponses holds responses of POST_CreateVpnConnection +type POST_CreateVpnConnectionResponses struct { + OK *CreateVpnConnectionResponse +} + +// POST_CreateVpnConnectionRouteParameters holds parameters to POST_CreateVpnConnectionRoute +type POST_CreateVpnConnectionRouteParameters struct { + Createvpnconnectionrouterequest CreateVpnConnectionRouteRequest `json:"createvpnconnectionrouterequest,omitempty"` +} + +// POST_CreateVpnConnectionRouteResponses holds responses of POST_CreateVpnConnectionRoute +type POST_CreateVpnConnectionRouteResponses struct { + OK *CreateVpnConnectionRouteResponse +} + +// POST_DeleteApiKeyParameters holds parameters to POST_DeleteApiKey +type POST_DeleteApiKeyParameters struct { + Deleteapikeyrequest DeleteApiKeyRequest `json:"deleteapikeyrequest,omitempty"` +} + +// POST_DeleteApiKeyResponses holds responses of POST_DeleteApiKey +type POST_DeleteApiKeyResponses struct { + OK *DeleteApiKeyResponse +} + +// POST_DeleteClientGatewayParameters holds parameters to POST_DeleteClientGateway +type POST_DeleteClientGatewayParameters struct { + Deleteclientgatewayrequest DeleteClientGatewayRequest `json:"deleteclientgatewayrequest,omitempty"` +} + +// POST_DeleteClientGatewayResponses holds responses of POST_DeleteClientGateway +type POST_DeleteClientGatewayResponses struct { + OK *DeleteClientGatewayResponse +} + +// POST_DeleteDhcpOptionsParameters holds parameters to POST_DeleteDhcpOptions +type POST_DeleteDhcpOptionsParameters struct { + Deletedhcpoptionsrequest DeleteDhcpOptionsRequest `json:"deletedhcpoptionsrequest,omitempty"` +} + +// POST_DeleteDhcpOptionsResponses holds responses of POST_DeleteDhcpOptions +type POST_DeleteDhcpOptionsResponses struct { + OK *DeleteDhcpOptionsResponse +} + +// POST_DeleteDirectLinkParameters holds parameters to POST_DeleteDirectLink +type POST_DeleteDirectLinkParameters struct { + Deletedirectlinkrequest DeleteDirectLinkRequest `json:"deletedirectlinkrequest,omitempty"` +} + +// POST_DeleteDirectLinkResponses holds responses of POST_DeleteDirectLink +type POST_DeleteDirectLinkResponses struct { + OK *DeleteDirectLinkResponse +} + +// POST_DeleteDirectLinkInterfaceParameters holds parameters to POST_DeleteDirectLinkInterface +type POST_DeleteDirectLinkInterfaceParameters struct { + Deletedirectlinkinterfacerequest DeleteDirectLinkInterfaceRequest `json:"deletedirectlinkinterfacerequest,omitempty"` +} + +// POST_DeleteDirectLinkInterfaceResponses holds responses of POST_DeleteDirectLinkInterface +type POST_DeleteDirectLinkInterfaceResponses struct { + OK *DeleteDirectLinkInterfaceResponse +} + +// POST_DeleteExportTaskParameters holds parameters to POST_DeleteExportTask +type POST_DeleteExportTaskParameters struct { + Deleteexporttaskrequest DeleteExportTaskRequest `json:"deleteexporttaskrequest,omitempty"` +} + +// POST_DeleteExportTaskResponses holds responses of POST_DeleteExportTask +type POST_DeleteExportTaskResponses struct { + OK *DeleteExportTaskResponse +} + +// POST_DeleteImageParameters holds parameters to POST_DeleteImage +type POST_DeleteImageParameters struct { + Deleteimagerequest DeleteImageRequest `json:"deleteimagerequest,omitempty"` +} + +// POST_DeleteImageResponses holds responses of POST_DeleteImage +type POST_DeleteImageResponses struct { + OK *DeleteImageResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteInternetServiceParameters holds parameters to POST_DeleteInternetService +type POST_DeleteInternetServiceParameters struct { + Deleteinternetservicerequest DeleteInternetServiceRequest `json:"deleteinternetservicerequest,omitempty"` +} + +// POST_DeleteInternetServiceResponses holds responses of POST_DeleteInternetService +type POST_DeleteInternetServiceResponses struct { + OK *DeleteInternetServiceResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteKeypairParameters holds parameters to POST_DeleteKeypair +type POST_DeleteKeypairParameters struct { + Deletekeypairrequest DeleteKeypairRequest `json:"deletekeypairrequest,omitempty"` +} + +// POST_DeleteKeypairResponses holds responses of POST_DeleteKeypair +type POST_DeleteKeypairResponses struct { + OK *DeleteKeypairResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteListenerRuleParameters holds parameters to POST_DeleteListenerRule +type POST_DeleteListenerRuleParameters struct { + Deletelistenerrulerequest DeleteListenerRuleRequest `json:"deletelistenerrulerequest,omitempty"` +} + +// POST_DeleteListenerRuleResponses holds responses of POST_DeleteListenerRule +type POST_DeleteListenerRuleResponses struct { + OK *DeleteListenerRuleResponse +} + +// POST_DeleteLoadBalancerParameters holds parameters to POST_DeleteLoadBalancer +type POST_DeleteLoadBalancerParameters struct { + Deleteloadbalancerrequest DeleteLoadBalancerRequest `json:"deleteloadbalancerrequest,omitempty"` +} + +// POST_DeleteLoadBalancerResponses holds responses of POST_DeleteLoadBalancer +type POST_DeleteLoadBalancerResponses struct { + OK *DeleteLoadBalancerResponse +} + +// POST_DeleteLoadBalancerListenersParameters holds parameters to POST_DeleteLoadBalancerListeners +type POST_DeleteLoadBalancerListenersParameters struct { + Deleteloadbalancerlistenersrequest DeleteLoadBalancerListenersRequest `json:"deleteloadbalancerlistenersrequest,omitempty"` +} + +// POST_DeleteLoadBalancerListenersResponses holds responses of POST_DeleteLoadBalancerListeners +type POST_DeleteLoadBalancerListenersResponses struct { + OK *DeleteLoadBalancerListenersResponse +} + +// POST_DeleteLoadBalancerPolicyParameters holds parameters to POST_DeleteLoadBalancerPolicy +type POST_DeleteLoadBalancerPolicyParameters struct { + Deleteloadbalancerpolicyrequest DeleteLoadBalancerPolicyRequest `json:"deleteloadbalancerpolicyrequest,omitempty"` +} + +// POST_DeleteLoadBalancerPolicyResponses holds responses of POST_DeleteLoadBalancerPolicy +type POST_DeleteLoadBalancerPolicyResponses struct { + OK *DeleteLoadBalancerPolicyResponse +} + +// POST_DeleteNatServiceParameters holds parameters to POST_DeleteNatService +type POST_DeleteNatServiceParameters struct { + Deletenatservicerequest DeleteNatServiceRequest `json:"deletenatservicerequest,omitempty"` +} + +// POST_DeleteNatServiceResponses holds responses of POST_DeleteNatService +type POST_DeleteNatServiceResponses struct { + OK *DeleteNatServiceResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteNetParameters holds parameters to POST_DeleteNet +type POST_DeleteNetParameters struct { + Deletenetrequest DeleteNetRequest `json:"deletenetrequest,omitempty"` +} + +// POST_DeleteNetResponses holds responses of POST_DeleteNet +type POST_DeleteNetResponses struct { + OK *DeleteNetResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteNetAccessPointsParameters holds parameters to POST_DeleteNetAccessPoints +type POST_DeleteNetAccessPointsParameters struct { + Deletenetaccesspointsrequest DeleteNetAccessPointsRequest `json:"deletenetaccesspointsrequest,omitempty"` +} + +// POST_DeleteNetAccessPointsResponses holds responses of POST_DeleteNetAccessPoints +type POST_DeleteNetAccessPointsResponses struct { + OK *DeleteNetAccessPointsResponse +} + +// POST_DeleteNetPeeringParameters holds parameters to POST_DeleteNetPeering +type POST_DeleteNetPeeringParameters struct { + Deletenetpeeringrequest DeleteNetPeeringRequest `json:"deletenetpeeringrequest,omitempty"` +} + +// POST_DeleteNetPeeringResponses holds responses of POST_DeleteNetPeering +type POST_DeleteNetPeeringResponses struct { + OK *DeleteNetPeeringResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code409 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteNicParameters holds parameters to POST_DeleteNic +type POST_DeleteNicParameters struct { + Deletenicrequest DeleteNicRequest `json:"deletenicrequest,omitempty"` +} + +// POST_DeleteNicResponses holds responses of POST_DeleteNic +type POST_DeleteNicResponses struct { + OK *DeleteNicResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeletePolicyParameters holds parameters to POST_DeletePolicy +type POST_DeletePolicyParameters struct { + Deletepolicyrequest DeletePolicyRequest `json:"deletepolicyrequest,omitempty"` +} + +// POST_DeletePolicyResponses holds responses of POST_DeletePolicy +type POST_DeletePolicyResponses struct { + OK *DeletePolicyResponse +} + +// POST_DeletePublicIpParameters holds parameters to POST_DeletePublicIp +type POST_DeletePublicIpParameters struct { + Deletepubliciprequest DeletePublicIpRequest `json:"deletepubliciprequest,omitempty"` +} + +// POST_DeletePublicIpResponses holds responses of POST_DeletePublicIp +type POST_DeletePublicIpResponses struct { + OK *DeletePublicIpResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteRouteParameters holds parameters to POST_DeleteRoute +type POST_DeleteRouteParameters struct { + Deleterouterequest DeleteRouteRequest `json:"deleterouterequest,omitempty"` +} + +// POST_DeleteRouteResponses holds responses of POST_DeleteRoute +type POST_DeleteRouteResponses struct { + OK *DeleteRouteResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteRouteTableParameters holds parameters to POST_DeleteRouteTable +type POST_DeleteRouteTableParameters struct { + Deleteroutetablerequest DeleteRouteTableRequest `json:"deleteroutetablerequest,omitempty"` +} + +// POST_DeleteRouteTableResponses holds responses of POST_DeleteRouteTable +type POST_DeleteRouteTableResponses struct { + OK *DeleteRouteTableResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteSecurityGroupParameters holds parameters to POST_DeleteSecurityGroup +type POST_DeleteSecurityGroupParameters struct { + Deletesecuritygrouprequest DeleteSecurityGroupRequest `json:"deletesecuritygrouprequest,omitempty"` +} + +// POST_DeleteSecurityGroupResponses holds responses of POST_DeleteSecurityGroup +type POST_DeleteSecurityGroupResponses struct { + OK *DeleteSecurityGroupResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteSecurityGroupRuleParameters holds parameters to POST_DeleteSecurityGroupRule +type POST_DeleteSecurityGroupRuleParameters struct { + Deletesecuritygrouprulerequest DeleteSecurityGroupRuleRequest `json:"deletesecuritygrouprulerequest,omitempty"` +} + +// POST_DeleteSecurityGroupRuleResponses holds responses of POST_DeleteSecurityGroupRule +type POST_DeleteSecurityGroupRuleResponses struct { + OK *DeleteSecurityGroupRuleResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteServerCertificateParameters holds parameters to POST_DeleteServerCertificate +type POST_DeleteServerCertificateParameters struct { + Deleteservercertificaterequest DeleteServerCertificateRequest `json:"deleteservercertificaterequest,omitempty"` +} + +// POST_DeleteServerCertificateResponses holds responses of POST_DeleteServerCertificate +type POST_DeleteServerCertificateResponses struct { + OK *DeleteServerCertificateResponse +} + +// POST_DeleteSnapshotParameters holds parameters to POST_DeleteSnapshot +type POST_DeleteSnapshotParameters struct { + Deletesnapshotrequest DeleteSnapshotRequest `json:"deletesnapshotrequest,omitempty"` +} + +// POST_DeleteSnapshotResponses holds responses of POST_DeleteSnapshot +type POST_DeleteSnapshotResponses struct { + OK *DeleteSnapshotResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteSubnetParameters holds parameters to POST_DeleteSubnet +type POST_DeleteSubnetParameters struct { + Deletesubnetrequest DeleteSubnetRequest `json:"deletesubnetrequest,omitempty"` +} + +// POST_DeleteSubnetResponses holds responses of POST_DeleteSubnet +type POST_DeleteSubnetResponses struct { + OK *DeleteSubnetResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteTagsParameters holds parameters to POST_DeleteTags +type POST_DeleteTagsParameters struct { + Deletetagsrequest DeleteTagsRequest `json:"deletetagsrequest,omitempty"` +} + +// POST_DeleteTagsResponses holds responses of POST_DeleteTags +type POST_DeleteTagsResponses struct { + OK *DeleteTagsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteUserParameters holds parameters to POST_DeleteUser +type POST_DeleteUserParameters struct { + Deleteuserrequest DeleteUserRequest `json:"deleteuserrequest,omitempty"` +} + +// POST_DeleteUserResponses holds responses of POST_DeleteUser +type POST_DeleteUserResponses struct { + OK *DeleteUserResponse +} + +// POST_DeleteUserGroupParameters holds parameters to POST_DeleteUserGroup +type POST_DeleteUserGroupParameters struct { + Deleteusergrouprequest DeleteUserGroupRequest `json:"deleteusergrouprequest,omitempty"` +} + +// POST_DeleteUserGroupResponses holds responses of POST_DeleteUserGroup +type POST_DeleteUserGroupResponses struct { + OK *DeleteUserGroupResponse +} + +// POST_DeleteVirtualGatewayParameters holds parameters to POST_DeleteVirtualGateway +type POST_DeleteVirtualGatewayParameters struct { + Deletevirtualgatewayrequest DeleteVirtualGatewayRequest `json:"deletevirtualgatewayrequest,omitempty"` +} + +// POST_DeleteVirtualGatewayResponses holds responses of POST_DeleteVirtualGateway +type POST_DeleteVirtualGatewayResponses struct { + OK *DeleteVirtualGatewayResponse +} + +// POST_DeleteVmsParameters holds parameters to POST_DeleteVms +type POST_DeleteVmsParameters struct { + Deletevmsrequest DeleteVmsRequest `json:"deletevmsrequest,omitempty"` +} + +// POST_DeleteVmsResponses holds responses of POST_DeleteVms +type POST_DeleteVmsResponses struct { + OK *DeleteVmsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteVolumeParameters holds parameters to POST_DeleteVolume +type POST_DeleteVolumeParameters struct { + Deletevolumerequest DeleteVolumeRequest `json:"deletevolumerequest,omitempty"` +} + +// POST_DeleteVolumeResponses holds responses of POST_DeleteVolume +type POST_DeleteVolumeResponses struct { + OK *DeleteVolumeResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_DeleteVpnConnectionParameters holds parameters to POST_DeleteVpnConnection +type POST_DeleteVpnConnectionParameters struct { + Deletevpnconnectionrequest DeleteVpnConnectionRequest `json:"deletevpnconnectionrequest,omitempty"` +} + +// POST_DeleteVpnConnectionResponses holds responses of POST_DeleteVpnConnection +type POST_DeleteVpnConnectionResponses struct { + OK *DeleteVpnConnectionResponse +} + +// POST_DeleteVpnConnectionRouteParameters holds parameters to POST_DeleteVpnConnectionRoute +type POST_DeleteVpnConnectionRouteParameters struct { + Deletevpnconnectionrouterequest DeleteVpnConnectionRouteRequest `json:"deletevpnconnectionrouterequest,omitempty"` +} + +// POST_DeleteVpnConnectionRouteResponses holds responses of POST_DeleteVpnConnectionRoute +type POST_DeleteVpnConnectionRouteResponses struct { + OK *DeleteVpnConnectionRouteResponse +} + +// POST_DeregisterUserInUserGroupParameters holds parameters to POST_DeregisterUserInUserGroup +type POST_DeregisterUserInUserGroupParameters struct { + Deregisteruserinusergrouprequest DeregisterUserInUserGroupRequest `json:"deregisteruserinusergrouprequest,omitempty"` +} + +// POST_DeregisterUserInUserGroupResponses holds responses of POST_DeregisterUserInUserGroup +type POST_DeregisterUserInUserGroupResponses struct { + OK *DeregisterUserInUserGroupResponse +} + +// POST_DeregisterVmsInLoadBalancerParameters holds parameters to POST_DeregisterVmsInLoadBalancer +type POST_DeregisterVmsInLoadBalancerParameters struct { + Deregistervmsinloadbalancerrequest DeregisterVmsInLoadBalancerRequest `json:"deregistervmsinloadbalancerrequest,omitempty"` +} + +// POST_DeregisterVmsInLoadBalancerResponses holds responses of POST_DeregisterVmsInLoadBalancer +type POST_DeregisterVmsInLoadBalancerResponses struct { + OK *DeregisterVmsInLoadBalancerResponse +} + +// POST_LinkInternetServiceParameters holds parameters to POST_LinkInternetService +type POST_LinkInternetServiceParameters struct { + Linkinternetservicerequest LinkInternetServiceRequest `json:"linkinternetservicerequest,omitempty"` +} + +// POST_LinkInternetServiceResponses holds responses of POST_LinkInternetService +type POST_LinkInternetServiceResponses struct { + OK *LinkInternetServiceResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_LinkNicParameters holds parameters to POST_LinkNic +type POST_LinkNicParameters struct { + Linknicrequest LinkNicRequest `json:"linknicrequest,omitempty"` +} + +// POST_LinkNicResponses holds responses of POST_LinkNic +type POST_LinkNicResponses struct { + OK *LinkNicResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_LinkPolicyParameters holds parameters to POST_LinkPolicy +type POST_LinkPolicyParameters struct { + Linkpolicyrequest LinkPolicyRequest `json:"linkpolicyrequest,omitempty"` +} + +// POST_LinkPolicyResponses holds responses of POST_LinkPolicy +type POST_LinkPolicyResponses struct { + OK *LinkPolicyResponse +} + +// POST_LinkPrivateIpsParameters holds parameters to POST_LinkPrivateIps +type POST_LinkPrivateIpsParameters struct { + Linkprivateipsrequest LinkPrivateIpsRequest `json:"linkprivateipsrequest,omitempty"` +} + +// POST_LinkPrivateIpsResponses holds responses of POST_LinkPrivateIps +type POST_LinkPrivateIpsResponses struct { + OK *LinkPrivateIpsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_LinkPublicIpParameters holds parameters to POST_LinkPublicIp +type POST_LinkPublicIpParameters struct { + Linkpubliciprequest LinkPublicIpRequest `json:"linkpubliciprequest,omitempty"` +} + +// POST_LinkPublicIpResponses holds responses of POST_LinkPublicIp +type POST_LinkPublicIpResponses struct { + OK *LinkPublicIpResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_LinkRouteTableParameters holds parameters to POST_LinkRouteTable +type POST_LinkRouteTableParameters struct { + Linkroutetablerequest LinkRouteTableRequest `json:"linkroutetablerequest,omitempty"` +} + +// POST_LinkRouteTableResponses holds responses of POST_LinkRouteTable +type POST_LinkRouteTableResponses struct { + OK *LinkRouteTableResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_LinkVirtualGatewayParameters holds parameters to POST_LinkVirtualGateway +type POST_LinkVirtualGatewayParameters struct { + Linkvirtualgatewayrequest LinkVirtualGatewayRequest `json:"linkvirtualgatewayrequest,omitempty"` +} + +// POST_LinkVirtualGatewayResponses holds responses of POST_LinkVirtualGateway +type POST_LinkVirtualGatewayResponses struct { + OK *LinkVirtualGatewayResponse +} + +// POST_LinkVolumeParameters holds parameters to POST_LinkVolume +type POST_LinkVolumeParameters struct { + Linkvolumerequest LinkVolumeRequest `json:"linkvolumerequest,omitempty"` +} + +// POST_LinkVolumeResponses holds responses of POST_LinkVolume +type POST_LinkVolumeResponses struct { + OK *LinkVolumeResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_PurchaseReservedVmsOfferParameters holds parameters to POST_PurchaseReservedVmsOffer +type POST_PurchaseReservedVmsOfferParameters struct { + Purchasereservedvmsofferrequest PurchaseReservedVmsOfferRequest `json:"purchasereservedvmsofferrequest,omitempty"` +} + +// POST_PurchaseReservedVmsOfferResponses holds responses of POST_PurchaseReservedVmsOffer +type POST_PurchaseReservedVmsOfferResponses struct { + OK *PurchaseReservedVmsOfferResponse +} + +// POST_ReadAccountParameters holds parameters to POST_ReadAccount +type POST_ReadAccountParameters struct { + Readaccountrequest ReadAccountRequest `json:"readaccountrequest,omitempty"` +} + +// POST_ReadAccountResponses holds responses of POST_ReadAccount +type POST_ReadAccountResponses struct { + OK *ReadAccountResponse +} + +// POST_ReadAccountConsumptionParameters holds parameters to POST_ReadAccountConsumption +type POST_ReadAccountConsumptionParameters struct { + Readaccountconsumptionrequest ReadAccountConsumptionRequest `json:"readaccountconsumptionrequest,omitempty"` +} + +// POST_ReadAccountConsumptionResponses holds responses of POST_ReadAccountConsumption +type POST_ReadAccountConsumptionResponses struct { + OK *ReadAccountConsumptionResponse +} + +// POST_ReadAdminPasswordParameters holds parameters to POST_ReadAdminPassword +type POST_ReadAdminPasswordParameters struct { + Readadminpasswordrequest ReadAdminPasswordRequest `json:"readadminpasswordrequest,omitempty"` +} + +// POST_ReadAdminPasswordResponses holds responses of POST_ReadAdminPassword +type POST_ReadAdminPasswordResponses struct { + OK *ReadAdminPasswordResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadApiKeysParameters holds parameters to POST_ReadApiKeys +type POST_ReadApiKeysParameters struct { + Readapikeysrequest ReadApiKeysRequest `json:"readapikeysrequest,omitempty"` +} + +// POST_ReadApiKeysResponses holds responses of POST_ReadApiKeys +type POST_ReadApiKeysResponses struct { + OK *ReadApiKeysResponse +} + +// POST_ReadApiLogsParameters holds parameters to POST_ReadApiLogs +type POST_ReadApiLogsParameters struct { + Readapilogsrequest ReadApiLogsRequest `json:"readapilogsrequest,omitempty"` +} + +// POST_ReadApiLogsResponses holds responses of POST_ReadApiLogs +type POST_ReadApiLogsResponses struct { + OK *ReadApiLogsResponse +} + +// POST_ReadBillableDigestParameters holds parameters to POST_ReadBillableDigest +type POST_ReadBillableDigestParameters struct { + Readbillabledigestrequest ReadBillableDigestRequest `json:"readbillabledigestrequest,omitempty"` +} + +// POST_ReadBillableDigestResponses holds responses of POST_ReadBillableDigest +type POST_ReadBillableDigestResponses struct { + OK *ReadBillableDigestResponse +} + +// POST_ReadCatalogParameters holds parameters to POST_ReadCatalog +type POST_ReadCatalogParameters struct { + Readcatalogrequest ReadCatalogRequest `json:"readcatalogrequest,omitempty"` +} + +// POST_ReadCatalogResponses holds responses of POST_ReadCatalog +type POST_ReadCatalogResponses struct { + OK *ReadCatalogResponse +} + +// POST_ReadClientGatewaysParameters holds parameters to POST_ReadClientGateways +type POST_ReadClientGatewaysParameters struct { + Readclientgatewaysrequest ReadClientGatewaysRequest `json:"readclientgatewaysrequest,omitempty"` +} + +// POST_ReadClientGatewaysResponses holds responses of POST_ReadClientGateways +type POST_ReadClientGatewaysResponses struct { + OK *ReadClientGatewaysResponse +} + +// POST_ReadConsoleOutputParameters holds parameters to POST_ReadConsoleOutput +type POST_ReadConsoleOutputParameters struct { + Readconsoleoutputrequest ReadConsoleOutputRequest `json:"readconsoleoutputrequest,omitempty"` +} + +// POST_ReadConsoleOutputResponses holds responses of POST_ReadConsoleOutput +type POST_ReadConsoleOutputResponses struct { + OK *ReadConsoleOutputResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadDhcpOptionsParameters holds parameters to POST_ReadDhcpOptions +type POST_ReadDhcpOptionsParameters struct { + Readdhcpoptionsrequest ReadDhcpOptionsRequest `json:"readdhcpoptionsrequest,omitempty"` +} + +// POST_ReadDhcpOptionsResponses holds responses of POST_ReadDhcpOptions +type POST_ReadDhcpOptionsResponses struct { + OK *ReadDhcpOptionsResponse +} + +// POST_ReadDirectLinkInterfacesParameters holds parameters to POST_ReadDirectLinkInterfaces +type POST_ReadDirectLinkInterfacesParameters struct { + Readdirectlinkinterfacesrequest ReadDirectLinkInterfacesRequest `json:"readdirectlinkinterfacesrequest,omitempty"` +} + +// POST_ReadDirectLinkInterfacesResponses holds responses of POST_ReadDirectLinkInterfaces +type POST_ReadDirectLinkInterfacesResponses struct { + OK *ReadDirectLinkInterfacesResponse +} + +// POST_ReadDirectLinksParameters holds parameters to POST_ReadDirectLinks +type POST_ReadDirectLinksParameters struct { + Readdirectlinksrequest ReadDirectLinksRequest `json:"readdirectlinksrequest,omitempty"` +} + +// POST_ReadDirectLinksResponses holds responses of POST_ReadDirectLinks +type POST_ReadDirectLinksResponses struct { + OK *ReadDirectLinksResponse +} + +// POST_ReadImageExportTasksParameters holds parameters to POST_ReadImageExportTasks +type POST_ReadImageExportTasksParameters struct { + Readimageexporttasksrequest ReadImageExportTasksRequest `json:"readimageexporttasksrequest,omitempty"` +} + +// POST_ReadImageExportTasksResponses holds responses of POST_ReadImageExportTasks +type POST_ReadImageExportTasksResponses struct { + OK *ReadImageExportTasksResponse +} + +// POST_ReadImagesParameters holds parameters to POST_ReadImages +type POST_ReadImagesParameters struct { + Readimagesrequest ReadImagesRequest `json:"readimagesrequest,omitempty"` +} + +// POST_ReadImagesResponses holds responses of POST_ReadImages +type POST_ReadImagesResponses struct { + OK *ReadImagesResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadInternetServicesParameters holds parameters to POST_ReadInternetServices +type POST_ReadInternetServicesParameters struct { + Readinternetservicesrequest ReadInternetServicesRequest `json:"readinternetservicesrequest,omitempty"` +} + +// POST_ReadInternetServicesResponses holds responses of POST_ReadInternetServices +type POST_ReadInternetServicesResponses struct { + OK *ReadInternetServicesResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadKeypairsParameters holds parameters to POST_ReadKeypairs +type POST_ReadKeypairsParameters struct { + Readkeypairsrequest ReadKeypairsRequest `json:"readkeypairsrequest,omitempty"` +} + +// POST_ReadKeypairsResponses holds responses of POST_ReadKeypairs +type POST_ReadKeypairsResponses struct { + OK *ReadKeypairsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadListenerRulesParameters holds parameters to POST_ReadListenerRules +type POST_ReadListenerRulesParameters struct { + Readlistenerrulesrequest ReadListenerRulesRequest `json:"readlistenerrulesrequest,omitempty"` +} + +// POST_ReadListenerRulesResponses holds responses of POST_ReadListenerRules +type POST_ReadListenerRulesResponses struct { + OK *ReadListenerRulesResponse +} + +// POST_ReadLoadBalancersParameters holds parameters to POST_ReadLoadBalancers +type POST_ReadLoadBalancersParameters struct { + Readloadbalancersrequest ReadLoadBalancersRequest `json:"readloadbalancersrequest,omitempty"` +} + +// POST_ReadLoadBalancersResponses holds responses of POST_ReadLoadBalancers +type POST_ReadLoadBalancersResponses struct { + OK *ReadLoadBalancersResponse +} + +// POST_ReadLocationsParameters holds parameters to POST_ReadLocations +type POST_ReadLocationsParameters struct { + Readlocationsrequest ReadLocationsRequest `json:"readlocationsrequest,omitempty"` +} + +// POST_ReadLocationsResponses holds responses of POST_ReadLocations +type POST_ReadLocationsResponses struct { + OK *ReadLocationsResponse +} + +// POST_ReadNatServicesParameters holds parameters to POST_ReadNatServices +type POST_ReadNatServicesParameters struct { + Readnatservicesrequest ReadNatServicesRequest `json:"readnatservicesrequest,omitempty"` +} + +// POST_ReadNatServicesResponses holds responses of POST_ReadNatServices +type POST_ReadNatServicesResponses struct { + OK *ReadNatServicesResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadNetAccessPointServicesParameters holds parameters to POST_ReadNetAccessPointServices +type POST_ReadNetAccessPointServicesParameters struct { + Readnetaccesspointservicesrequest ReadNetAccessPointServicesRequest `json:"readnetaccesspointservicesrequest,omitempty"` +} + +// POST_ReadNetAccessPointServicesResponses holds responses of POST_ReadNetAccessPointServices +type POST_ReadNetAccessPointServicesResponses struct { + OK *ReadNetAccessPointServicesResponse +} + +// POST_ReadNetAccessPointsParameters holds parameters to POST_ReadNetAccessPoints +type POST_ReadNetAccessPointsParameters struct { + Readnetaccesspointsrequest ReadNetAccessPointsRequest `json:"readnetaccesspointsrequest,omitempty"` +} + +// POST_ReadNetAccessPointsResponses holds responses of POST_ReadNetAccessPoints +type POST_ReadNetAccessPointsResponses struct { + OK *ReadNetAccessPointsResponse +} + +// POST_ReadNetPeeringsParameters holds parameters to POST_ReadNetPeerings +type POST_ReadNetPeeringsParameters struct { + Readnetpeeringsrequest ReadNetPeeringsRequest `json:"readnetpeeringsrequest,omitempty"` +} + +// POST_ReadNetPeeringsResponses holds responses of POST_ReadNetPeerings +type POST_ReadNetPeeringsResponses struct { + OK *ReadNetPeeringsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadNetsParameters holds parameters to POST_ReadNets +type POST_ReadNetsParameters struct { + Readnetsrequest ReadNetsRequest `json:"readnetsrequest,omitempty"` +} + +// POST_ReadNetsResponses holds responses of POST_ReadNets +type POST_ReadNetsResponses struct { + OK *ReadNetsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadNicsParameters holds parameters to POST_ReadNics +type POST_ReadNicsParameters struct { + Readnicsrequest ReadNicsRequest `json:"readnicsrequest,omitempty"` +} + +// POST_ReadNicsResponses holds responses of POST_ReadNics +type POST_ReadNicsResponses struct { + OK *ReadNicsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadPoliciesParameters holds parameters to POST_ReadPolicies +type POST_ReadPoliciesParameters struct { + Readpoliciesrequest ReadPoliciesRequest `json:"readpoliciesrequest,omitempty"` +} + +// POST_ReadPoliciesResponses holds responses of POST_ReadPolicies +type POST_ReadPoliciesResponses struct { + OK *ReadPoliciesResponse +} + +// POST_ReadPrefixListsParameters holds parameters to POST_ReadPrefixLists +type POST_ReadPrefixListsParameters struct { + Readprefixlistsrequest ReadPrefixListsRequest `json:"readprefixlistsrequest,omitempty"` +} + +// POST_ReadPrefixListsResponses holds responses of POST_ReadPrefixLists +type POST_ReadPrefixListsResponses struct { + OK *ReadPrefixListsResponse +} + +// POST_ReadProductTypesParameters holds parameters to POST_ReadProductTypes +type POST_ReadProductTypesParameters struct { + Readproducttypesrequest ReadProductTypesRequest `json:"readproducttypesrequest,omitempty"` +} + +// POST_ReadProductTypesResponses holds responses of POST_ReadProductTypes +type POST_ReadProductTypesResponses struct { + OK *ReadProductTypesResponse +} + +// POST_ReadPublicCatalogParameters holds parameters to POST_ReadPublicCatalog +type POST_ReadPublicCatalogParameters struct { + Readpubliccatalogrequest ReadPublicCatalogRequest `json:"readpubliccatalogrequest,omitempty"` +} + +// POST_ReadPublicCatalogResponses holds responses of POST_ReadPublicCatalog +type POST_ReadPublicCatalogResponses struct { + OK *ReadPublicCatalogResponse +} + +// POST_ReadPublicIpRangesParameters holds parameters to POST_ReadPublicIpRanges +type POST_ReadPublicIpRangesParameters struct { + Readpubliciprangesrequest ReadPublicIpRangesRequest `json:"readpubliciprangesrequest,omitempty"` +} + +// POST_ReadPublicIpRangesResponses holds responses of POST_ReadPublicIpRanges +type POST_ReadPublicIpRangesResponses struct { + OK *ReadPublicIpRangesResponse +} + +// POST_ReadPublicIpsParameters holds parameters to POST_ReadPublicIps +type POST_ReadPublicIpsParameters struct { + Readpublicipsrequest ReadPublicIpsRequest `json:"readpublicipsrequest,omitempty"` +} + +// POST_ReadPublicIpsResponses holds responses of POST_ReadPublicIps +type POST_ReadPublicIpsResponses struct { + OK *ReadPublicIpsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadQuotasParameters holds parameters to POST_ReadQuotas +type POST_ReadQuotasParameters struct { + Readquotasrequest ReadQuotasRequest `json:"readquotasrequest,omitempty"` +} + +// POST_ReadQuotasResponses holds responses of POST_ReadQuotas +type POST_ReadQuotasResponses struct { + OK *ReadQuotasResponse +} + +// POST_ReadRegionConfigParameters holds parameters to POST_ReadRegionConfig +type POST_ReadRegionConfigParameters struct { + Readregionconfigrequest ReadRegionConfigRequest `json:"readregionconfigrequest,omitempty"` +} + +// POST_ReadRegionConfigResponses holds responses of POST_ReadRegionConfig +type POST_ReadRegionConfigResponses struct { + OK *ReadRegionConfigResponse +} + +// POST_ReadRegionsParameters holds parameters to POST_ReadRegions +type POST_ReadRegionsParameters struct { + Readregionsrequest ReadRegionsRequest `json:"readregionsrequest,omitempty"` +} + +// POST_ReadRegionsResponses holds responses of POST_ReadRegions +type POST_ReadRegionsResponses struct { + OK *ReadRegionsResponse +} + +// POST_ReadReservedVmOffersParameters holds parameters to POST_ReadReservedVmOffers +type POST_ReadReservedVmOffersParameters struct { + Readreservedvmoffersrequest ReadReservedVmOffersRequest `json:"readreservedvmoffersrequest,omitempty"` +} + +// POST_ReadReservedVmOffersResponses holds responses of POST_ReadReservedVmOffers +type POST_ReadReservedVmOffersResponses struct { + OK *ReadReservedVmOffersResponse +} + +// POST_ReadReservedVmsParameters holds parameters to POST_ReadReservedVms +type POST_ReadReservedVmsParameters struct { + Readreservedvmsrequest ReadReservedVmsRequest `json:"readreservedvmsrequest,omitempty"` +} + +// POST_ReadReservedVmsResponses holds responses of POST_ReadReservedVms +type POST_ReadReservedVmsResponses struct { + OK *ReadReservedVmsResponse +} + +// POST_ReadRouteTablesParameters holds parameters to POST_ReadRouteTables +type POST_ReadRouteTablesParameters struct { + Readroutetablesrequest ReadRouteTablesRequest `json:"readroutetablesrequest,omitempty"` +} + +// POST_ReadRouteTablesResponses holds responses of POST_ReadRouteTables +type POST_ReadRouteTablesResponses struct { + OK *ReadRouteTablesResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadSecurityGroupsParameters holds parameters to POST_ReadSecurityGroups +type POST_ReadSecurityGroupsParameters struct { + Readsecuritygroupsrequest ReadSecurityGroupsRequest `json:"readsecuritygroupsrequest,omitempty"` +} + +// POST_ReadSecurityGroupsResponses holds responses of POST_ReadSecurityGroups +type POST_ReadSecurityGroupsResponses struct { + OK *ReadSecurityGroupsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadServerCertificatesParameters holds parameters to POST_ReadServerCertificates +type POST_ReadServerCertificatesParameters struct { + Readservercertificatesrequest ReadServerCertificatesRequest `json:"readservercertificatesrequest,omitempty"` +} + +// POST_ReadServerCertificatesResponses holds responses of POST_ReadServerCertificates +type POST_ReadServerCertificatesResponses struct { + OK *ReadServerCertificatesResponse +} + +// POST_ReadSnapshotExportTasksParameters holds parameters to POST_ReadSnapshotExportTasks +type POST_ReadSnapshotExportTasksParameters struct { + Readsnapshotexporttasksrequest ReadSnapshotExportTasksRequest `json:"readsnapshotexporttasksrequest,omitempty"` +} + +// POST_ReadSnapshotExportTasksResponses holds responses of POST_ReadSnapshotExportTasks +type POST_ReadSnapshotExportTasksResponses struct { + OK *ReadSnapshotExportTasksResponse +} + +// POST_ReadSnapshotsParameters holds parameters to POST_ReadSnapshots +type POST_ReadSnapshotsParameters struct { + Readsnapshotsrequest ReadSnapshotsRequest `json:"readsnapshotsrequest,omitempty"` +} + +// POST_ReadSnapshotsResponses holds responses of POST_ReadSnapshots +type POST_ReadSnapshotsResponses struct { + OK *ReadSnapshotsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadSubnetsParameters holds parameters to POST_ReadSubnets +type POST_ReadSubnetsParameters struct { + Readsubnetsrequest ReadSubnetsRequest `json:"readsubnetsrequest,omitempty"` +} + +// POST_ReadSubnetsResponses holds responses of POST_ReadSubnets +type POST_ReadSubnetsResponses struct { + OK *ReadSubnetsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadSubregionsParameters holds parameters to POST_ReadSubregions +type POST_ReadSubregionsParameters struct { + Readsubregionsrequest ReadSubregionsRequest `json:"readsubregionsrequest,omitempty"` +} + +// POST_ReadSubregionsResponses holds responses of POST_ReadSubregions +type POST_ReadSubregionsResponses struct { + OK *ReadSubregionsResponse +} + +// POST_ReadTagsParameters holds parameters to POST_ReadTags +type POST_ReadTagsParameters struct { + Readtagsrequest ReadTagsRequest `json:"readtagsrequest,omitempty"` +} + +// POST_ReadTagsResponses holds responses of POST_ReadTags +type POST_ReadTagsResponses struct { + OK *ReadTagsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadUserGroupsParameters holds parameters to POST_ReadUserGroups +type POST_ReadUserGroupsParameters struct { + Readusergroupsrequest ReadUserGroupsRequest `json:"readusergroupsrequest,omitempty"` +} + +// POST_ReadUserGroupsResponses holds responses of POST_ReadUserGroups +type POST_ReadUserGroupsResponses struct { + OK *ReadUserGroupsResponse +} + +// POST_ReadUsersParameters holds parameters to POST_ReadUsers +type POST_ReadUsersParameters struct { + Readusersrequest ReadUsersRequest `json:"readusersrequest,omitempty"` +} + +// POST_ReadUsersResponses holds responses of POST_ReadUsers +type POST_ReadUsersResponses struct { + OK *ReadUsersResponse +} + +// POST_ReadVirtualGatewaysParameters holds parameters to POST_ReadVirtualGateways +type POST_ReadVirtualGatewaysParameters struct { + Readvirtualgatewaysrequest ReadVirtualGatewaysRequest `json:"readvirtualgatewaysrequest,omitempty"` +} + +// POST_ReadVirtualGatewaysResponses holds responses of POST_ReadVirtualGateways +type POST_ReadVirtualGatewaysResponses struct { + OK *ReadVirtualGatewaysResponse +} + +// POST_ReadVmTypesParameters holds parameters to POST_ReadVmTypes +type POST_ReadVmTypesParameters struct { + Readvmtypesrequest ReadVmTypesRequest `json:"readvmtypesrequest,omitempty"` +} + +// POST_ReadVmTypesResponses holds responses of POST_ReadVmTypes +type POST_ReadVmTypesResponses struct { + OK *ReadVmTypesResponse +} + +// POST_ReadVmsParameters holds parameters to POST_ReadVms +type POST_ReadVmsParameters struct { + Readvmsrequest ReadVmsRequest `json:"readvmsrequest,omitempty"` +} + +// POST_ReadVmsResponses holds responses of POST_ReadVms +type POST_ReadVmsResponses struct { + OK *ReadVmsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadVmsHealthParameters holds parameters to POST_ReadVmsHealth +type POST_ReadVmsHealthParameters struct { + Readvmshealthrequest ReadVmsHealthRequest `json:"readvmshealthrequest,omitempty"` +} + +// POST_ReadVmsHealthResponses holds responses of POST_ReadVmsHealth +type POST_ReadVmsHealthResponses struct { + OK *ReadVmsHealthResponse +} + +// POST_ReadVmsStateParameters holds parameters to POST_ReadVmsState +type POST_ReadVmsStateParameters struct { + Readvmsstaterequest ReadVmsStateRequest `json:"readvmsstaterequest,omitempty"` +} + +// POST_ReadVmsStateResponses holds responses of POST_ReadVmsState +type POST_ReadVmsStateResponses struct { + OK *ReadVmsStateResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadVolumesParameters holds parameters to POST_ReadVolumes +type POST_ReadVolumesParameters struct { + Readvolumesrequest ReadVolumesRequest `json:"readvolumesrequest,omitempty"` +} + +// POST_ReadVolumesResponses holds responses of POST_ReadVolumes +type POST_ReadVolumesResponses struct { + OK *ReadVolumesResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ReadVpnConnectionsParameters holds parameters to POST_ReadVpnConnections +type POST_ReadVpnConnectionsParameters struct { + Readvpnconnectionsrequest ReadVpnConnectionsRequest `json:"readvpnconnectionsrequest,omitempty"` +} + +// POST_ReadVpnConnectionsResponses holds responses of POST_ReadVpnConnections +type POST_ReadVpnConnectionsResponses struct { + OK *ReadVpnConnectionsResponse +} + +// POST_RebootVmsParameters holds parameters to POST_RebootVms +type POST_RebootVmsParameters struct { + Rebootvmsrequest RebootVmsRequest `json:"rebootvmsrequest,omitempty"` +} + +// POST_RebootVmsResponses holds responses of POST_RebootVms +type POST_RebootVmsResponses struct { + OK *RebootVmsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_RegisterUserInUserGroupParameters holds parameters to POST_RegisterUserInUserGroup +type POST_RegisterUserInUserGroupParameters struct { + Registeruserinusergrouprequest RegisterUserInUserGroupRequest `json:"registeruserinusergrouprequest,omitempty"` +} + +// POST_RegisterUserInUserGroupResponses holds responses of POST_RegisterUserInUserGroup +type POST_RegisterUserInUserGroupResponses struct { + OK *RegisterUserInUserGroupResponse +} + +// POST_RegisterVmsInLoadBalancerParameters holds parameters to POST_RegisterVmsInLoadBalancer +type POST_RegisterVmsInLoadBalancerParameters struct { + Registervmsinloadbalancerrequest RegisterVmsInLoadBalancerRequest `json:"registervmsinloadbalancerrequest,omitempty"` +} + +// POST_RegisterVmsInLoadBalancerResponses holds responses of POST_RegisterVmsInLoadBalancer +type POST_RegisterVmsInLoadBalancerResponses struct { + OK *RegisterVmsInLoadBalancerResponse +} + +// POST_RejectNetPeeringParameters holds parameters to POST_RejectNetPeering +type POST_RejectNetPeeringParameters struct { + Rejectnetpeeringrequest RejectNetPeeringRequest `json:"rejectnetpeeringrequest,omitempty"` +} + +// POST_RejectNetPeeringResponses holds responses of POST_RejectNetPeering +type POST_RejectNetPeeringResponses struct { + OK *RejectNetPeeringResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code409 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_ResetAccountPasswordParameters holds parameters to POST_ResetAccountPassword +type POST_ResetAccountPasswordParameters struct { + Resetaccountpasswordrequest ResetAccountPasswordRequest `json:"resetaccountpasswordrequest,omitempty"` +} + +// POST_ResetAccountPasswordResponses holds responses of POST_ResetAccountPassword +type POST_ResetAccountPasswordResponses struct { + OK *ResetAccountPasswordResponse +} + +// POST_SendResetPasswordEmailParameters holds parameters to POST_SendResetPasswordEmail +type POST_SendResetPasswordEmailParameters struct { + Sendresetpasswordemailrequest SendResetPasswordEmailRequest `json:"sendresetpasswordemailrequest,omitempty"` +} + +// POST_SendResetPasswordEmailResponses holds responses of POST_SendResetPasswordEmail +type POST_SendResetPasswordEmailResponses struct { + OK *SendResetPasswordEmailResponse +} + +// POST_StartVmsParameters holds parameters to POST_StartVms +type POST_StartVmsParameters struct { + Startvmsrequest StartVmsRequest `json:"startvmsrequest,omitempty"` +} + +// POST_StartVmsResponses holds responses of POST_StartVms +type POST_StartVmsResponses struct { + OK *StartVmsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_StopVmsParameters holds parameters to POST_StopVms +type POST_StopVmsParameters struct { + Stopvmsrequest StopVmsRequest `json:"stopvmsrequest,omitempty"` +} + +// POST_StopVmsResponses holds responses of POST_StopVms +type POST_StopVmsResponses struct { + OK *StopVmsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UnlinkInternetServiceParameters holds parameters to POST_UnlinkInternetService +type POST_UnlinkInternetServiceParameters struct { + Unlinkinternetservicerequest UnlinkInternetServiceRequest `json:"unlinkinternetservicerequest,omitempty"` +} + +// POST_UnlinkInternetServiceResponses holds responses of POST_UnlinkInternetService +type POST_UnlinkInternetServiceResponses struct { + OK *UnlinkInternetServiceResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UnlinkNicParameters holds parameters to POST_UnlinkNic +type POST_UnlinkNicParameters struct { + Unlinknicrequest UnlinkNicRequest `json:"unlinknicrequest,omitempty"` +} + +// POST_UnlinkNicResponses holds responses of POST_UnlinkNic +type POST_UnlinkNicResponses struct { + OK *UnlinkNicResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UnlinkPolicyParameters holds parameters to POST_UnlinkPolicy +type POST_UnlinkPolicyParameters struct { + Unlinkpolicyrequest UnlinkPolicyRequest `json:"unlinkpolicyrequest,omitempty"` +} + +// POST_UnlinkPolicyResponses holds responses of POST_UnlinkPolicy +type POST_UnlinkPolicyResponses struct { + OK *UnlinkPolicyResponse +} + +// POST_UnlinkPrivateIpsParameters holds parameters to POST_UnlinkPrivateIps +type POST_UnlinkPrivateIpsParameters struct { + Unlinkprivateipsrequest UnlinkPrivateIpsRequest `json:"unlinkprivateipsrequest,omitempty"` +} + +// POST_UnlinkPrivateIpsResponses holds responses of POST_UnlinkPrivateIps +type POST_UnlinkPrivateIpsResponses struct { + OK *UnlinkPrivateIpsResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UnlinkPublicIpParameters holds parameters to POST_UnlinkPublicIp +type POST_UnlinkPublicIpParameters struct { + Unlinkpubliciprequest UnlinkPublicIpRequest `json:"unlinkpubliciprequest,omitempty"` +} + +// POST_UnlinkPublicIpResponses holds responses of POST_UnlinkPublicIp +type POST_UnlinkPublicIpResponses struct { + OK *UnlinkPublicIpResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UnlinkRouteTableParameters holds parameters to POST_UnlinkRouteTable +type POST_UnlinkRouteTableParameters struct { + Unlinkroutetablerequest UnlinkRouteTableRequest `json:"unlinkroutetablerequest,omitempty"` +} + +// POST_UnlinkRouteTableResponses holds responses of POST_UnlinkRouteTable +type POST_UnlinkRouteTableResponses struct { + OK *UnlinkRouteTableResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UnlinkVirtualGatewayParameters holds parameters to POST_UnlinkVirtualGateway +type POST_UnlinkVirtualGatewayParameters struct { + Unlinkvirtualgatewayrequest UnlinkVirtualGatewayRequest `json:"unlinkvirtualgatewayrequest,omitempty"` +} + +// POST_UnlinkVirtualGatewayResponses holds responses of POST_UnlinkVirtualGateway +type POST_UnlinkVirtualGatewayResponses struct { + OK *UnlinkVirtualGatewayResponse +} + +// POST_UnlinkVolumeParameters holds parameters to POST_UnlinkVolume +type POST_UnlinkVolumeParameters struct { + Unlinkvolumerequest UnlinkVolumeRequest `json:"unlinkvolumerequest,omitempty"` +} + +// POST_UnlinkVolumeResponses holds responses of POST_UnlinkVolume +type POST_UnlinkVolumeResponses struct { + OK *UnlinkVolumeResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UpdateAccountParameters holds parameters to POST_UpdateAccount +type POST_UpdateAccountParameters struct { + Updateaccountrequest UpdateAccountRequest `json:"updateaccountrequest,omitempty"` +} + +// POST_UpdateAccountResponses holds responses of POST_UpdateAccount +type POST_UpdateAccountResponses struct { + OK *UpdateAccountResponse +} + +// POST_UpdateApiKeyParameters holds parameters to POST_UpdateApiKey +type POST_UpdateApiKeyParameters struct { + Updateapikeyrequest UpdateApiKeyRequest `json:"updateapikeyrequest,omitempty"` +} + +// POST_UpdateApiKeyResponses holds responses of POST_UpdateApiKey +type POST_UpdateApiKeyResponses struct { + OK *UpdateApiKeyResponse +} + +// POST_UpdateHealthCheckParameters holds parameters to POST_UpdateHealthCheck +type POST_UpdateHealthCheckParameters struct { + Updatehealthcheckrequest UpdateHealthCheckRequest `json:"updatehealthcheckrequest,omitempty"` +} + +// POST_UpdateHealthCheckResponses holds responses of POST_UpdateHealthCheck +type POST_UpdateHealthCheckResponses struct { + OK *UpdateHealthCheckResponse +} + +// POST_UpdateImageParameters holds parameters to POST_UpdateImage +type POST_UpdateImageParameters struct { + Updateimagerequest UpdateImageRequest `json:"updateimagerequest,omitempty"` +} + +// POST_UpdateImageResponses holds responses of POST_UpdateImage +type POST_UpdateImageResponses struct { + OK *UpdateImageResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UpdateKeypairParameters holds parameters to POST_UpdateKeypair +type POST_UpdateKeypairParameters struct { + Updatekeypairrequest UpdateKeypairRequest `json:"updatekeypairrequest,omitempty"` +} + +// POST_UpdateKeypairResponses holds responses of POST_UpdateKeypair +type POST_UpdateKeypairResponses struct { + OK *UpdateKeypairResponse +} + +// POST_UpdateListenerRuleParameters holds parameters to POST_UpdateListenerRule +type POST_UpdateListenerRuleParameters struct { + Updatelistenerrulerequest UpdateListenerRuleRequest `json:"updatelistenerrulerequest,omitempty"` +} + +// POST_UpdateListenerRuleResponses holds responses of POST_UpdateListenerRule +type POST_UpdateListenerRuleResponses struct { + OK *UpdateListenerRuleResponse +} + +// POST_UpdateLoadBalancerParameters holds parameters to POST_UpdateLoadBalancer +type POST_UpdateLoadBalancerParameters struct { + Updateloadbalancerrequest UpdateLoadBalancerRequest `json:"updateloadbalancerrequest,omitempty"` +} + +// POST_UpdateLoadBalancerResponses holds responses of POST_UpdateLoadBalancer +type POST_UpdateLoadBalancerResponses struct { + OK *UpdateLoadBalancerResponse +} + +// POST_UpdateNetParameters holds parameters to POST_UpdateNet +type POST_UpdateNetParameters struct { + Updatenetrequest UpdateNetRequest `json:"updatenetrequest,omitempty"` +} + +// POST_UpdateNetResponses holds responses of POST_UpdateNet +type POST_UpdateNetResponses struct { + OK *UpdateNetResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UpdateNetAccessPointParameters holds parameters to POST_UpdateNetAccessPoint +type POST_UpdateNetAccessPointParameters struct { + Updatenetaccesspointrequest UpdateNetAccessPointRequest `json:"updatenetaccesspointrequest,omitempty"` +} + +// POST_UpdateNetAccessPointResponses holds responses of POST_UpdateNetAccessPoint +type POST_UpdateNetAccessPointResponses struct { + OK *UpdateNetAccessPointResponse +} + +// POST_UpdateNicParameters holds parameters to POST_UpdateNic +type POST_UpdateNicParameters struct { + Updatenicrequest UpdateNicRequest `json:"updatenicrequest,omitempty"` +} + +// POST_UpdateNicResponses holds responses of POST_UpdateNic +type POST_UpdateNicResponses struct { + OK *UpdateNicResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UpdateRouteParameters holds parameters to POST_UpdateRoute +type POST_UpdateRouteParameters struct { + Updaterouterequest UpdateRouteRequest `json:"updaterouterequest,omitempty"` +} + +// POST_UpdateRouteResponses holds responses of POST_UpdateRoute +type POST_UpdateRouteResponses struct { + OK *UpdateRouteResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UpdateRoutePropagationParameters holds parameters to POST_UpdateRoutePropagation +type POST_UpdateRoutePropagationParameters struct { + Updateroutepropagationrequest UpdateRoutePropagationRequest `json:"updateroutepropagationrequest,omitempty"` +} + +// POST_UpdateRoutePropagationResponses holds responses of POST_UpdateRoutePropagation +type POST_UpdateRoutePropagationResponses struct { + OK *UpdateRoutePropagationResponse +} + +// POST_UpdateServerCertificateParameters holds parameters to POST_UpdateServerCertificate +type POST_UpdateServerCertificateParameters struct { + Updateservercertificaterequest UpdateServerCertificateRequest `json:"updateservercertificaterequest,omitempty"` +} + +// POST_UpdateServerCertificateResponses holds responses of POST_UpdateServerCertificate +type POST_UpdateServerCertificateResponses struct { + OK *UpdateServerCertificateResponse +} + +// POST_UpdateSnapshotParameters holds parameters to POST_UpdateSnapshot +type POST_UpdateSnapshotParameters struct { + Updatesnapshotrequest UpdateSnapshotRequest `json:"updatesnapshotrequest,omitempty"` +} + +// POST_UpdateSnapshotResponses holds responses of POST_UpdateSnapshot +type POST_UpdateSnapshotResponses struct { + OK *UpdateSnapshotResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} + +// POST_UpdateUserParameters holds parameters to POST_UpdateUser +type POST_UpdateUserParameters struct { + Updateuserrequest UpdateUserRequest `json:"updateuserrequest,omitempty"` +} + +// POST_UpdateUserResponses holds responses of POST_UpdateUser +type POST_UpdateUserResponses struct { + OK *UpdateUserResponse +} + +// POST_UpdateUserGroupParameters holds parameters to POST_UpdateUserGroup +type POST_UpdateUserGroupParameters struct { + Updateusergrouprequest UpdateUserGroupRequest `json:"updateusergrouprequest,omitempty"` +} + +// POST_UpdateUserGroupResponses holds responses of POST_UpdateUserGroup +type POST_UpdateUserGroupResponses struct { + OK *UpdateUserGroupResponse +} + +// POST_UpdateVmParameters holds parameters to POST_UpdateVm +type POST_UpdateVmParameters struct { + Updatevmrequest UpdateVmRequest `json:"updatevmrequest,omitempty"` +} + +// POST_UpdateVmResponses holds responses of POST_UpdateVm +type POST_UpdateVmResponses struct { + OK *UpdateVmResponse + Code400 *ErrorResponse + Code401 *ErrorResponse + Code500 *ErrorResponse +} diff --git a/vendor/github.com/outscale/osc-go/utils/utils.go b/vendor/github.com/outscale/osc-go/utils/utils.go new file mode 100644 index 000000000..5ecfb59be --- /dev/null +++ b/vendor/github.com/outscale/osc-go/utils/utils.go @@ -0,0 +1,27 @@ +package utils + +import ( + "fmt" + "log" + "net/http" + "net/http/httputil" +) + +// DebugRequest ... +func DebugRequest(req *http.Request) { + requestDump, err := httputil.DumpRequest(req, true) + if err != nil { + fmt.Println(err) + } + log.Printf("[DEBUG] Request\n%s", string(requestDump)) +} + +// DebugResponse ... +func DebugResponse(res *http.Response) { + responseDump, err := httputil.DumpResponse(res, true) + if err != nil { + fmt.Println(err) + } + + log.Printf("[DEBUG] Response\n%s", string(responseDump)) +} diff --git a/vendor/github.com/sirupsen/logrus/.travis.yml b/vendor/github.com/sirupsen/logrus/.travis.yml index 1f953bebd..a8f154515 100644 --- a/vendor/github.com/sirupsen/logrus/.travis.yml +++ b/vendor/github.com/sirupsen/logrus/.travis.yml @@ -1,4 +1,5 @@ language: go +go_import_path: github.com/sirupsen/logrus env: - GOMAXPROCS=4 GORACE=halt_on_error=1 matrix: diff --git a/vendor/github.com/sirupsen/logrus/README.md b/vendor/github.com/sirupsen/logrus/README.md index 093bb13f8..398731055 100644 --- a/vendor/github.com/sirupsen/logrus/README.md +++ b/vendor/github.com/sirupsen/logrus/README.md @@ -361,6 +361,7 @@ The built-in logging formatters are: Third party logging formatters: * [`FluentdFormatter`](https://github.com/joonix/log). Formats entries that can be parsed by Kubernetes and Google Container Engine. +* [`GELF`](https://github.com/fabienm/go-logrus-formatters). Formats entries so they comply to Graylog's [GELF 1.1 specification](http://docs.graylog.org/en/2.4/pages/gelf.html). * [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events. * [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout. * [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦. diff --git a/vendor/github.com/sirupsen/logrus/entry.go b/vendor/github.com/sirupsen/logrus/entry.go index cc85d3aab..df6d188de 100644 --- a/vendor/github.com/sirupsen/logrus/entry.go +++ b/vendor/github.com/sirupsen/logrus/entry.go @@ -108,23 +108,34 @@ func (entry *Entry) WithFields(fields Fields) *Entry { for k, v := range entry.Data { data[k] = v } - var field_err string + fieldErr := entry.err for k, v := range fields { - if t := reflect.TypeOf(v); t != nil && t.Kind() == reflect.Func { - field_err = fmt.Sprintf("can not add field %q", k) - if entry.err != "" { - field_err = entry.err + ", " + field_err + isErrField := false + if t := reflect.TypeOf(v); t != nil { + switch t.Kind() { + case reflect.Func: + isErrField = true + case reflect.Ptr: + isErrField = t.Elem().Kind() == reflect.Func + } + } + if isErrField { + tmp := fmt.Sprintf("can not add field %q", k) + if fieldErr != "" { + fieldErr = entry.err + ", " + tmp + } else { + fieldErr = tmp } } else { data[k] = v } } - return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, err: field_err} + return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, err: fieldErr} } // Overrides the time of the Entry. func (entry *Entry) WithTime(t time.Time) *Entry { - return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t} + return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t, err: entry.err} } // getPackageName reduces a fully qualified function name to the package name @@ -240,16 +251,18 @@ func (entry *Entry) write() { } } -func (entry *Entry) Trace(args ...interface{}) { - if entry.Logger.IsLevelEnabled(TraceLevel) { - entry.log(TraceLevel, fmt.Sprint(args...)) +func (entry *Entry) Log(level Level, args ...interface{}) { + if entry.Logger.IsLevelEnabled(level) { + entry.log(level, fmt.Sprint(args...)) } } +func (entry *Entry) Trace(args ...interface{}) { + entry.Log(TraceLevel, args...) +} + func (entry *Entry) Debug(args ...interface{}) { - if entry.Logger.IsLevelEnabled(DebugLevel) { - entry.log(DebugLevel, fmt.Sprint(args...)) - } + entry.Log(DebugLevel, args...) } func (entry *Entry) Print(args ...interface{}) { @@ -257,15 +270,11 @@ func (entry *Entry) Print(args ...interface{}) { } func (entry *Entry) Info(args ...interface{}) { - if entry.Logger.IsLevelEnabled(InfoLevel) { - entry.log(InfoLevel, fmt.Sprint(args...)) - } + entry.Log(InfoLevel, args...) } func (entry *Entry) Warn(args ...interface{}) { - if entry.Logger.IsLevelEnabled(WarnLevel) { - entry.log(WarnLevel, fmt.Sprint(args...)) - } + entry.Log(WarnLevel, args...) } func (entry *Entry) Warning(args ...interface{}) { @@ -273,43 +282,35 @@ func (entry *Entry) Warning(args ...interface{}) { } func (entry *Entry) Error(args ...interface{}) { - if entry.Logger.IsLevelEnabled(ErrorLevel) { - entry.log(ErrorLevel, fmt.Sprint(args...)) - } + entry.Log(ErrorLevel, args...) } func (entry *Entry) Fatal(args ...interface{}) { - if entry.Logger.IsLevelEnabled(FatalLevel) { - entry.log(FatalLevel, fmt.Sprint(args...)) - } + entry.Log(FatalLevel, args...) entry.Logger.Exit(1) } func (entry *Entry) Panic(args ...interface{}) { - if entry.Logger.IsLevelEnabled(PanicLevel) { - entry.log(PanicLevel, fmt.Sprint(args...)) - } + entry.Log(PanicLevel, args...) panic(fmt.Sprint(args...)) } // Entry Printf family functions +func (entry *Entry) Logf(level Level, format string, args ...interface{}) { + entry.Log(level, fmt.Sprintf(format, args...)) +} + func (entry *Entry) Tracef(format string, args ...interface{}) { - if entry.Logger.IsLevelEnabled(TraceLevel) { - entry.Trace(fmt.Sprintf(format, args...)) - } + entry.Logf(TraceLevel, format, args...) } func (entry *Entry) Debugf(format string, args ...interface{}) { - if entry.Logger.IsLevelEnabled(DebugLevel) { - entry.Debug(fmt.Sprintf(format, args...)) - } + entry.Logf(DebugLevel, format, args...) } func (entry *Entry) Infof(format string, args ...interface{}) { - if entry.Logger.IsLevelEnabled(InfoLevel) { - entry.Info(fmt.Sprintf(format, args...)) - } + entry.Logf(InfoLevel, format, args...) } func (entry *Entry) Printf(format string, args ...interface{}) { @@ -317,9 +318,7 @@ func (entry *Entry) Printf(format string, args ...interface{}) { } func (entry *Entry) Warnf(format string, args ...interface{}) { - if entry.Logger.IsLevelEnabled(WarnLevel) { - entry.Warn(fmt.Sprintf(format, args...)) - } + entry.Logf(WarnLevel, format, args...) } func (entry *Entry) Warningf(format string, args ...interface{}) { @@ -327,42 +326,36 @@ func (entry *Entry) Warningf(format string, args ...interface{}) { } func (entry *Entry) Errorf(format string, args ...interface{}) { - if entry.Logger.IsLevelEnabled(ErrorLevel) { - entry.Error(fmt.Sprintf(format, args...)) - } + entry.Logf(ErrorLevel, format, args...) } func (entry *Entry) Fatalf(format string, args ...interface{}) { - if entry.Logger.IsLevelEnabled(FatalLevel) { - entry.Fatal(fmt.Sprintf(format, args...)) - } + entry.Logf(FatalLevel, format, args...) entry.Logger.Exit(1) } func (entry *Entry) Panicf(format string, args ...interface{}) { - if entry.Logger.IsLevelEnabled(PanicLevel) { - entry.Panic(fmt.Sprintf(format, args...)) - } + entry.Logf(PanicLevel, format, args...) } // Entry Println family functions -func (entry *Entry) Traceln(args ...interface{}) { - if entry.Logger.IsLevelEnabled(TraceLevel) { - entry.Trace(entry.sprintlnn(args...)) +func (entry *Entry) Logln(level Level, args ...interface{}) { + if entry.Logger.IsLevelEnabled(level) { + entry.Log(level, entry.sprintlnn(args...)) } } +func (entry *Entry) Traceln(args ...interface{}) { + entry.Logln(TraceLevel, args...) +} + func (entry *Entry) Debugln(args ...interface{}) { - if entry.Logger.IsLevelEnabled(DebugLevel) { - entry.Debug(entry.sprintlnn(args...)) - } + entry.Logln(DebugLevel, args...) } func (entry *Entry) Infoln(args ...interface{}) { - if entry.Logger.IsLevelEnabled(InfoLevel) { - entry.Info(entry.sprintlnn(args...)) - } + entry.Logln(InfoLevel, args...) } func (entry *Entry) Println(args ...interface{}) { @@ -370,9 +363,7 @@ func (entry *Entry) Println(args ...interface{}) { } func (entry *Entry) Warnln(args ...interface{}) { - if entry.Logger.IsLevelEnabled(WarnLevel) { - entry.Warn(entry.sprintlnn(args...)) - } + entry.Logln(WarnLevel, args...) } func (entry *Entry) Warningln(args ...interface{}) { @@ -380,22 +371,16 @@ func (entry *Entry) Warningln(args ...interface{}) { } func (entry *Entry) Errorln(args ...interface{}) { - if entry.Logger.IsLevelEnabled(ErrorLevel) { - entry.Error(entry.sprintlnn(args...)) - } + entry.Logln(ErrorLevel, args...) } func (entry *Entry) Fatalln(args ...interface{}) { - if entry.Logger.IsLevelEnabled(FatalLevel) { - entry.Fatal(entry.sprintlnn(args...)) - } + entry.Logln(FatalLevel, args...) entry.Logger.Exit(1) } func (entry *Entry) Panicln(args ...interface{}) { - if entry.Logger.IsLevelEnabled(PanicLevel) { - entry.Panic(entry.sprintlnn(args...)) - } + entry.Logln(PanicLevel, args...) } // Sprintlnn => Sprint no newline. This is to get the behavior of how diff --git a/vendor/github.com/sirupsen/logrus/logger.go b/vendor/github.com/sirupsen/logrus/logger.go index 5ceca0eab..9bf64e22a 100644 --- a/vendor/github.com/sirupsen/logrus/logger.go +++ b/vendor/github.com/sirupsen/logrus/logger.go @@ -131,28 +131,24 @@ func (logger *Logger) WithTime(t time.Time) *Entry { return entry.WithTime(t) } -func (logger *Logger) Tracef(format string, args ...interface{}) { - if logger.IsLevelEnabled(TraceLevel) { +func (logger *Logger) Logf(level Level, format string, args ...interface{}) { + if logger.IsLevelEnabled(level) { entry := logger.newEntry() - entry.Tracef(format, args...) + entry.Logf(level, format, args...) logger.releaseEntry(entry) } } +func (logger *Logger) Tracef(format string, args ...interface{}) { + logger.Logf(TraceLevel, format, args...) +} + func (logger *Logger) Debugf(format string, args ...interface{}) { - if logger.IsLevelEnabled(DebugLevel) { - entry := logger.newEntry() - entry.Debugf(format, args...) - logger.releaseEntry(entry) - } + logger.Logf(DebugLevel, format, args...) } func (logger *Logger) Infof(format string, args ...interface{}) { - if logger.IsLevelEnabled(InfoLevel) { - entry := logger.newEntry() - entry.Infof(format, args...) - logger.releaseEntry(entry) - } + logger.Logf(InfoLevel, format, args...) } func (logger *Logger) Printf(format string, args ...interface{}) { @@ -162,68 +158,44 @@ func (logger *Logger) Printf(format string, args ...interface{}) { } func (logger *Logger) Warnf(format string, args ...interface{}) { - if logger.IsLevelEnabled(WarnLevel) { - entry := logger.newEntry() - entry.Warnf(format, args...) - logger.releaseEntry(entry) - } + logger.Logf(WarnLevel, format, args...) } func (logger *Logger) Warningf(format string, args ...interface{}) { - if logger.IsLevelEnabled(WarnLevel) { - entry := logger.newEntry() - entry.Warnf(format, args...) - logger.releaseEntry(entry) - } + logger.Warnf(format, args...) } func (logger *Logger) Errorf(format string, args ...interface{}) { - if logger.IsLevelEnabled(ErrorLevel) { - entry := logger.newEntry() - entry.Errorf(format, args...) - logger.releaseEntry(entry) - } + logger.Logf(ErrorLevel, format, args...) } func (logger *Logger) Fatalf(format string, args ...interface{}) { - if logger.IsLevelEnabled(FatalLevel) { - entry := logger.newEntry() - entry.Fatalf(format, args...) - logger.releaseEntry(entry) - } + logger.Logf(FatalLevel, format, args...) logger.Exit(1) } func (logger *Logger) Panicf(format string, args ...interface{}) { - if logger.IsLevelEnabled(PanicLevel) { + logger.Logf(PanicLevel, format, args...) +} + +func (logger *Logger) Log(level Level, args ...interface{}) { + if logger.IsLevelEnabled(level) { entry := logger.newEntry() - entry.Panicf(format, args...) + entry.Log(level, args...) logger.releaseEntry(entry) } } func (logger *Logger) Trace(args ...interface{}) { - if logger.IsLevelEnabled(TraceLevel) { - entry := logger.newEntry() - entry.Trace(args...) - logger.releaseEntry(entry) - } + logger.Log(TraceLevel, args...) } func (logger *Logger) Debug(args ...interface{}) { - if logger.IsLevelEnabled(DebugLevel) { - entry := logger.newEntry() - entry.Debug(args...) - logger.releaseEntry(entry) - } + logger.Log(DebugLevel, args...) } func (logger *Logger) Info(args ...interface{}) { - if logger.IsLevelEnabled(InfoLevel) { - entry := logger.newEntry() - entry.Info(args...) - logger.releaseEntry(entry) - } + logger.Log(InfoLevel, args...) } func (logger *Logger) Print(args ...interface{}) { @@ -233,68 +205,44 @@ func (logger *Logger) Print(args ...interface{}) { } func (logger *Logger) Warn(args ...interface{}) { - if logger.IsLevelEnabled(WarnLevel) { - entry := logger.newEntry() - entry.Warn(args...) - logger.releaseEntry(entry) - } + logger.Log(WarnLevel, args...) } func (logger *Logger) Warning(args ...interface{}) { - if logger.IsLevelEnabled(WarnLevel) { - entry := logger.newEntry() - entry.Warn(args...) - logger.releaseEntry(entry) - } + logger.Warn(args...) } func (logger *Logger) Error(args ...interface{}) { - if logger.IsLevelEnabled(ErrorLevel) { - entry := logger.newEntry() - entry.Error(args...) - logger.releaseEntry(entry) - } + logger.Log(ErrorLevel, args...) } func (logger *Logger) Fatal(args ...interface{}) { - if logger.IsLevelEnabled(FatalLevel) { - entry := logger.newEntry() - entry.Fatal(args...) - logger.releaseEntry(entry) - } + logger.Log(FatalLevel, args...) logger.Exit(1) } func (logger *Logger) Panic(args ...interface{}) { - if logger.IsLevelEnabled(PanicLevel) { + logger.Log(PanicLevel, args...) +} + +func (logger *Logger) Logln(level Level, args ...interface{}) { + if logger.IsLevelEnabled(level) { entry := logger.newEntry() - entry.Panic(args...) + entry.Logln(level, args...) logger.releaseEntry(entry) } } func (logger *Logger) Traceln(args ...interface{}) { - if logger.IsLevelEnabled(TraceLevel) { - entry := logger.newEntry() - entry.Traceln(args...) - logger.releaseEntry(entry) - } + logger.Logln(TraceLevel, args...) } func (logger *Logger) Debugln(args ...interface{}) { - if logger.IsLevelEnabled(DebugLevel) { - entry := logger.newEntry() - entry.Debugln(args...) - logger.releaseEntry(entry) - } + logger.Logln(DebugLevel, args...) } func (logger *Logger) Infoln(args ...interface{}) { - if logger.IsLevelEnabled(InfoLevel) { - entry := logger.newEntry() - entry.Infoln(args...) - logger.releaseEntry(entry) - } + logger.Logln(InfoLevel, args...) } func (logger *Logger) Println(args ...interface{}) { @@ -304,44 +252,24 @@ func (logger *Logger) Println(args ...interface{}) { } func (logger *Logger) Warnln(args ...interface{}) { - if logger.IsLevelEnabled(WarnLevel) { - entry := logger.newEntry() - entry.Warnln(args...) - logger.releaseEntry(entry) - } + logger.Logln(WarnLevel, args...) } func (logger *Logger) Warningln(args ...interface{}) { - if logger.IsLevelEnabled(WarnLevel) { - entry := logger.newEntry() - entry.Warnln(args...) - logger.releaseEntry(entry) - } + logger.Warn(args...) } func (logger *Logger) Errorln(args ...interface{}) { - if logger.IsLevelEnabled(ErrorLevel) { - entry := logger.newEntry() - entry.Errorln(args...) - logger.releaseEntry(entry) - } + logger.Logln(ErrorLevel, args...) } func (logger *Logger) Fatalln(args ...interface{}) { - if logger.IsLevelEnabled(FatalLevel) { - entry := logger.newEntry() - entry.Fatalln(args...) - logger.releaseEntry(entry) - } + logger.Logln(FatalLevel, args...) logger.Exit(1) } func (logger *Logger) Panicln(args ...interface{}) { - if logger.IsLevelEnabled(PanicLevel) { - entry := logger.newEntry() - entry.Panicln(args...) - logger.releaseEntry(entry) - } + logger.Logln(PanicLevel, args...) } func (logger *Logger) Exit(code int) { diff --git a/vendor/github.com/sirupsen/logrus/logrus.go b/vendor/github.com/sirupsen/logrus/logrus.go index 4ef451866..c1ca88990 100644 --- a/vendor/github.com/sirupsen/logrus/logrus.go +++ b/vendor/github.com/sirupsen/logrus/logrus.go @@ -14,24 +14,11 @@ type Level uint32 // Convert the Level to a string. E.g. PanicLevel becomes "panic". func (level Level) String() string { - switch level { - case TraceLevel: - return "trace" - case DebugLevel: - return "debug" - case InfoLevel: - return "info" - case WarnLevel: - return "warning" - case ErrorLevel: - return "error" - case FatalLevel: - return "fatal" - case PanicLevel: - return "panic" + if b, err := level.MarshalText(); err == nil { + return string(b) + } else { + return "unknown" } - - return "unknown" } // ParseLevel takes a string level and returns the Logrus log level constant. @@ -69,6 +56,27 @@ func (level *Level) UnmarshalText(text []byte) error { return nil } +func (level Level) MarshalText() ([]byte, error) { + switch level { + case TraceLevel: + return []byte("trace"), nil + case DebugLevel: + return []byte("debug"), nil + case InfoLevel: + return []byte("info"), nil + case WarnLevel: + return []byte("warning"), nil + case ErrorLevel: + return []byte("error"), nil + case FatalLevel: + return []byte("fatal"), nil + case PanicLevel: + return []byte("panic"), nil + } + + return nil, fmt.Errorf("not a valid lorus level %q", level) +} + // A constant exposing all logging levels var AllLevels = []Level{ PanicLevel, diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_aix.go b/vendor/github.com/sirupsen/logrus/terminal_check_aix.go new file mode 100644 index 000000000..04fdb7ba3 --- /dev/null +++ b/vendor/github.com/sirupsen/logrus/terminal_check_aix.go @@ -0,0 +1,9 @@ +// +build !appengine,!js,!windows,aix + +package logrus + +import "io" + +func checkIfTerminal(w io.Writer) bool { + return false +} diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go index cf309d6fb..d46556509 100644 --- a/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go +++ b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go @@ -1,4 +1,4 @@ -// +build !appengine,!js,!windows +// +build !appengine,!js,!windows,!aix package logrus diff --git a/vendor/github.com/sirupsen/logrus/text_formatter.go b/vendor/github.com/sirupsen/logrus/text_formatter.go index 49ec92f17..fb21649c9 100644 --- a/vendor/github.com/sirupsen/logrus/text_formatter.go +++ b/vendor/github.com/sirupsen/logrus/text_formatter.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "os" + "runtime" "sort" "strings" "sync" @@ -90,7 +91,7 @@ func (f *TextFormatter) init(entry *Entry) { } func (f *TextFormatter) isColored() bool { - isColored := f.ForceColors || f.isTerminal + isColored := f.ForceColors || (f.isTerminal && (runtime.GOOS != "windows")) if f.EnvironmentOverrideColors { if force, ok := os.LookupEnv("CLICOLOR_FORCE"); ok && force != "0" { @@ -107,14 +108,17 @@ func (f *TextFormatter) isColored() bool { // Format renders a single log entry func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { - prefixFieldClashes(entry.Data, f.FieldMap, entry.HasCaller()) - - keys := make([]string, 0, len(entry.Data)) - for k := range entry.Data { + data := make(Fields) + for k, v := range entry.Data { + data[k] = v + } + prefixFieldClashes(data, f.FieldMap, entry.HasCaller()) + keys := make([]string, 0, len(data)) + for k := range data { keys = append(keys, k) } - fixedKeys := make([]string, 0, 4+len(entry.Data)) + fixedKeys := make([]string, 0, 4+len(data)) if !f.DisableTimestamp { fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyTime)) } @@ -160,7 +164,7 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { timestampFormat = defaultTimestampFormat } if f.isColored() { - f.printColored(b, entry, keys, timestampFormat) + f.printColored(b, entry, keys, data, timestampFormat) } else { for _, key := range fixedKeys { var value interface{} @@ -178,7 +182,7 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { case key == f.FieldMap.resolve(FieldKeyFile) && entry.HasCaller(): value = fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line) default: - value = entry.Data[key] + value = data[key] } f.appendKeyValue(b, key, value) } @@ -188,7 +192,7 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { return b.Bytes(), nil } -func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) { +func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, data Fields, timestampFormat string) { var levelColor int switch entry.Level { case DebugLevel, TraceLevel: @@ -225,7 +229,7 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s]%s %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), caller, entry.Message) } for _, k := range keys { - v := entry.Data[k] + v := data[k] fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k) f.appendValue(b, v) } diff --git a/vendor/github.com/temoto/robotstxt/.gitignore b/vendor/github.com/temoto/robotstxt/.gitignore index 2ef152f63..66af3f0f8 100644 --- a/vendor/github.com/temoto/robotstxt/.gitignore +++ b/vendor/github.com/temoto/robotstxt/.gitignore @@ -3,6 +3,7 @@ *.so *.sublime-* .DS_Store +.idea/ _cgo_* _obj _test diff --git a/vendor/github.com/temoto/robotstxt/.golangci.yml b/vendor/github.com/temoto/robotstxt/.golangci.yml new file mode 100644 index 000000000..24e5858fa --- /dev/null +++ b/vendor/github.com/temoto/robotstxt/.golangci.yml @@ -0,0 +1,20 @@ +linters: + enable: + - goconst + - gofmt + - gosec + - maligned + - prealloc + - staticcheck + disable: + - deadcode + - structcheck + - varcheck + +linters-settings: + gofmt: + simplify: true + govet: + check-shadowing: true + maligned: + suggest-new: true diff --git a/vendor/github.com/temoto/robotstxt/.travis.yml b/vendor/github.com/temoto/robotstxt/.travis.yml index 94d72beaa..2a4f09abc 100644 --- a/vendor/github.com/temoto/robotstxt/.travis.yml +++ b/vendor/github.com/temoto/robotstxt/.travis.yml @@ -1,30 +1,35 @@ -language: go -sudo: false - cache: go: true directories: - - "$HOME/.cache" + - $HOME/.cache + - $HOME/bin + - $HOME/gopath/pkg/mod +language: go go: +- 1.11 +- 1.12 - master -- 1.10.x -- 1.9 -- 1.8 -- 1.7 -- 1.6 +install: true +script: GO111MODULE=on go test -race matrix: include: - - go: 1.10.x - env: task=bench - go: 1.7 + install: go get -t + - go: 1.8 + install: go get -t + - go: 1.9 + install: go get -t + - go: 1.10.x + install: go get -t + - go: 1.x + env: task=coverage + script: GO111MODULE=on go test -race -covermode=atomic -coverprofile=coverage.txt + after_success: bash <(curl -s https://codecov.io/bash) + - go: 1.x env: task=bench - - go: master - env: task=bench - - go: master + script: GO111MODULE=on ./script/bench + - go: 1.x + install: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $HOME/bin v1.16.0 env: task=clean - -install: - - go get -u github.com/alecthomas/gometalinter -script: ./script/${task:-test} -after_success: if [[ -z "$task" ]] ; then bash <(curl -s https://codecov.io/bash) ; fi + script: GO111MODULE=on ./script/clean diff --git a/vendor/github.com/temoto/robotstxt/README.rst b/vendor/github.com/temoto/robotstxt/README.rst index 2f181810c..02037ec06 100644 --- a/vendor/github.com/temoto/robotstxt/README.rst +++ b/vendor/github.com/temoto/robotstxt/README.rst @@ -110,3 +110,6 @@ Flair .. image:: https://codecov.io/gh/temoto/robotstxt/branch/master/graph/badge.svg :target: https://codecov.io/gh/temoto/robotstxt + +.. image:: https://goreportcard.com/badge/github.com/temoto/robotstxt + :target: https://goreportcard.com/report/github.com/temoto/robotstxt diff --git a/vendor/github.com/temoto/robotstxt/go.mod b/vendor/github.com/temoto/robotstxt/go.mod new file mode 100644 index 000000000..1a5ea1b34 --- /dev/null +++ b/vendor/github.com/temoto/robotstxt/go.mod @@ -0,0 +1,5 @@ +module github.com/temoto/robotstxt + +go 1.11 + +require github.com/stretchr/testify v1.3.0 diff --git a/vendor/github.com/temoto/robotstxt/go.sum b/vendor/github.com/temoto/robotstxt/go.sum new file mode 100644 index 000000000..4347755af --- /dev/null +++ b/vendor/github.com/temoto/robotstxt/go.sum @@ -0,0 +1,7 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/temoto/robotstxt/metalinter.json b/vendor/github.com/temoto/robotstxt/metalinter.json deleted file mode 100644 index 0cfc7a064..000000000 --- a/vendor/github.com/temoto/robotstxt/metalinter.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Deadline": "60s", - "Exclude": [ - "should have comment or be unexported" - ], - "Tests": true, - "Vendor": true, - "VendoredLinters": true -} diff --git a/vendor/github.com/temoto/robotstxt/parser.go b/vendor/github.com/temoto/robotstxt/parser.go index 0ce2acc63..3433dad45 100644 --- a/vendor/github.com/temoto/robotstxt/parser.go +++ b/vendor/github.com/temoto/robotstxt/parser.go @@ -148,7 +148,7 @@ func (p *parser) parseLine() (li *lineInfo, err error) { // Helper closure for all string-based tokens, common behaviour: // - Consume t2 token - // - If empty, return unkown line info + // - If empty, return unknown line info // - Otherwise return the specified line info returnStringVal := func(t lineType) (*lineInfo, error) { p.popToken() @@ -160,7 +160,7 @@ func (p *parser) parseLine() (li *lineInfo, err error) { // Helper closure for all path tokens (allow/disallow), common behaviour: // - Consume t2 token - // - If empty, return unkown line info + // - If empty, return unknown line info // - Otherwise, normalize the path (add leading "/" if missing, remove trailing "*") // - Detect if wildcards are present, if so, compile into a regexp // - Return the specified line info @@ -198,7 +198,7 @@ func (p *parser) parseLine() (li *lineInfo, err error) { } switch strings.ToLower(t1) { - case "\n": + case tokEOL: // Don't consume t2 and continue parsing return &lineInfo{t: lIgnore}, nil diff --git a/vendor/github.com/temoto/robotstxt/robotstxt.go b/vendor/github.com/temoto/robotstxt/robotstxt.go index 9dfcc2552..e1221116d 100644 --- a/vendor/github.com/temoto/robotstxt/robotstxt.go +++ b/vendor/github.com/temoto/robotstxt/robotstxt.go @@ -111,12 +111,8 @@ func FromBytes(body []byte) (r *RobotsData, err error) { sc := newByteScanner("bytes", true) //sc.Quiet = !print_errors - sc.Feed(body, true) - var tokens []string - tokens, err = sc.ScanAll() - if err != nil { - return nil, err - } + sc.feed(body, true) + tokens := sc.scanAll() // special case worth optimization if len(tokens) == 0 { diff --git a/vendor/github.com/temoto/robotstxt/scanner.go b/vendor/github.com/temoto/robotstxt/scanner.go index 157763799..6bd98c2ec 100644 --- a/vendor/github.com/temoto/robotstxt/scanner.go +++ b/vendor/github.com/temoto/robotstxt/scanner.go @@ -4,23 +4,25 @@ import ( "bytes" "fmt" "go/token" - "io" "os" + "sync" "unicode/utf8" ) type byteScanner struct { - ErrorCount int - Quiet bool - - buf []byte pos token.Position - lastChunk bool + buf []byte + ErrorCount int ch rune + Quiet bool keyTokenFound bool + lastChunk bool } +const tokEOL = "\n" + var WhitespaceChars = []rune{' ', '\t', '\v'} +var tokBuffers = sync.Pool{New: func() interface{} { return bytes.NewBuffer(make([]byte, 32)) }} func newByteScanner(srcname string, quiet bool) *byteScanner { return &byteScanner{ @@ -30,7 +32,7 @@ func newByteScanner(srcname string, quiet bool) *byteScanner { } } -func (s *byteScanner) Feed(input []byte, end bool) error { +func (s *byteScanner) feed(input []byte, end bool) { s.buf = input s.pos.Offset = 0 s.pos.Line = 1 @@ -38,8 +40,8 @@ func (s *byteScanner) Feed(input []byte, end bool) error { s.lastChunk = end // Read first char into look-ahead buffer `s.ch`. - if err := s.nextChar(); err != nil { - return err + if !s.nextChar() { + return } // Skip UTF-8 byte order mark @@ -47,63 +49,50 @@ func (s *byteScanner) Feed(input []byte, end bool) error { s.nextChar() s.pos.Column = 1 } - - return nil } func (s *byteScanner) GetPosition() token.Position { return s.pos } -func (s *byteScanner) Scan() (string, error) { - //println("--- Scan(). Offset / len(s.buf): ", s.pos.Offset, len(s.buf)) - - for { - // Note Offset > len, not >=, so we can Scan last character. - if s.lastChunk && s.pos.Offset > len(s.buf) { - return "", io.EOF - } - - s.skipSpace() - - if s.ch == -1 { - return "", io.EOF - } - - // EOL - if s.isEol() { - s.keyTokenFound = false - // skip subsequent newline chars - for s.ch != -1 && s.isEol() { - s.nextChar() - } - // emit newline as separate token - return "\n", nil - } - - // skip comments - if s.ch == '#' { - s.keyTokenFound = false - s.skipUntilEol() - // s.state = "start" - if s.ch == -1 { - return "", io.EOF - } - // emit newline as separate token - return "\n", nil - } - - // else we found something - break +func (s *byteScanner) scan() string { + // Note Offset > len, not >=, so we can scan last character. + if s.lastChunk && s.pos.Offset > len(s.buf) { + return "" } - /* - if s.state == "start" { - s.state = "key" - } - */ + s.skipSpace() - var tok bytes.Buffer + if s.ch == -1 { + return "" + } + + // EOL + if s.isEol() { + s.keyTokenFound = false + // skip subsequent newline chars + for s.ch != -1 && s.isEol() { + s.nextChar() + } + // emit newline as separate token + return tokEOL + } + + // skip comments + if s.ch == '#' { + s.keyTokenFound = false + s.skipUntilEol() + if s.ch == -1 { + return "" + } + // emit newline as separate token + return tokEOL + } + + // else we found something + tok := tokBuffers.Get().(*bytes.Buffer) + defer tokBuffers.Put(tok) + tok.Reset() tok.WriteRune(s.ch) s.nextChar() for s.ch != -1 && !s.isSpace() && !s.isEol() { @@ -111,7 +100,6 @@ func (s *byteScanner) Scan() (string, error) { // has already been found on this line (avoid cutting an absolute URL // after the "http:") if s.ch == ':' && !s.keyTokenFound { - // s.state = "pre-value" s.nextChar() s.keyTokenFound = true break @@ -120,24 +108,20 @@ func (s *byteScanner) Scan() (string, error) { tok.WriteRune(s.ch) s.nextChar() } - return tok.String(), nil + return tok.String() } -func (s *byteScanner) ScanAll() ([]string, error) { - var results []string +func (s *byteScanner) scanAll() []string { + results := make([]string, 0, 64) // random guess of average tokens length for { - t, err := s.Scan() - if t != "" { - results = append(results, t) - } - if err == io.EOF { + token := s.scan() + if token != "" { + results = append(results, token) + } else { break } - if err != nil { - return results, err - } } - return results, nil + return results } func (s *byteScanner) error(pos token.Position, msg string) { @@ -161,14 +145,12 @@ func (s *byteScanner) isSpace() bool { } func (s *byteScanner) skipSpace() { - //println("--- string(ch): ", s.ch, ".") for s.ch != -1 && s.isSpace() { s.nextChar() } } func (s *byteScanner) skipUntilEol() { - //println("--- string(ch): ", s.ch, ".") for s.ch != -1 && !s.isEol() { s.nextChar() } @@ -179,12 +161,10 @@ func (s *byteScanner) skipUntilEol() { } // Reads next Unicode char. -func (s *byteScanner) nextChar() error { - //println("--- nextChar(). Offset / len(s.buf): ", s.pos.Offset, len(s.buf)) - +func (s *byteScanner) nextChar() bool { if s.pos.Offset >= len(s.buf) { s.ch = -1 - return io.EOF + return false } s.pos.Column++ if s.ch == '\n' { @@ -201,5 +181,5 @@ func (s *byteScanner) nextChar() error { s.pos.Column++ s.pos.Offset += w s.ch = r - return nil + return true } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go index 48bc5bcb5..92b2d7175 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go @@ -1,8 +1,13 @@ package common import ( + "encoding/hex" + "encoding/json" + "fmt" "log" "net/http" + "strconv" + "strings" "time" tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" @@ -10,12 +15,13 @@ import ( ) type Client struct { - region string - httpClient *http.Client - httpProfile *profile.HttpProfile - credential *Credential - signMethod string - debug bool + region string + httpClient *http.Client + httpProfile *profile.HttpProfile + credential *Credential + signMethod string + unsignedPayload bool + debug bool } func (c *Client) Send(request tchttp.Request, response tchttp.Response) (err error) { @@ -31,18 +37,27 @@ func (c *Client) Send(request tchttp.Request, response tchttp.Response) (err err request.SetHttpMethod(c.httpProfile.ReqMethod) } + tchttp.CompleteCommonParams(request, c.GetRegion()) + + if c.signMethod == "HmacSHA1" || c.signMethod == "HmacSHA256" { + return c.sendWithSignatureV1(request, response) + } else { + return c.sendWithSignatureV3(request, response) + } +} + +func (c *Client) sendWithSignatureV1(request tchttp.Request, response tchttp.Response) (err error) { err = tchttp.ConstructParams(request) if err != nil { - return + return err } - tchttp.CompleteCommonParams(request, c.GetRegion()) err = signRequest(request, c.credential, c.signMethod) if err != nil { - return + return err } httpRequest, err := http.NewRequest(request.GetHttpMethod(), request.GetUrl(), request.GetBodyReader()) if err != nil { - return + return err } if request.GetHttpMethod() == "POST" { httpRequest.Header["Content-Type"] = []string{"application/x-www-form-urlencoded"} @@ -53,7 +68,129 @@ func (c *Client) Send(request tchttp.Request, response tchttp.Response) (err err return err } err = tchttp.ParseFromHttpResponse(httpResponse, response) - return + return err +} + +func (c *Client) sendWithSignatureV3(request tchttp.Request, response tchttp.Response) (err error) { + headers := map[string]string{ + "Host": request.GetDomain(), + "X-TC-Action": request.GetAction(), + "X-TC-Version": request.GetVersion(), + "X-TC-Timestamp": request.GetParams()["Timestamp"], + "X-TC-RequestClient": request.GetParams()["RequestClient"], + } + if c.region != "" { + headers["X-TC-Region"] = c.region + } + if c.credential.Token != "" { + headers["X-TC-Token"] = c.credential.Token + } + if request.GetHttpMethod() == "GET" { + headers["Content-Type"] = "application/x-www-form-urlencoded" + } else { + headers["Content-Type"] = "application/json" + } + + // start signature v3 process + + // build canonical request string + httpRequestMethod := request.GetHttpMethod() + canonicalURI := "/" + canonicalQueryString := "" + if httpRequestMethod == "GET" { + err = tchttp.ConstructParams(request) + if err != nil { + return err + } + params := make(map[string]string) + for key, value := range request.GetParams() { + params[key] = value + } + delete(params, "Action") + delete(params, "Version") + delete(params, "Nonce") + delete(params, "Region") + delete(params, "RequestClient") + delete(params, "Timestamp") + canonicalQueryString = tchttp.GetUrlQueriesEncoded(params) + } + canonicalHeaders := fmt.Sprintf("content-type:%s\nhost:%s\n", headers["Content-Type"], headers["Host"]) + signedHeaders := "content-type;host" + requestPayload := "" + if httpRequestMethod == "POST" { + b, err := json.Marshal(request) + if err != nil { + return err + } + requestPayload = string(b) + } + hashedRequestPayload := "" + if c.unsignedPayload { + hashedRequestPayload = sha256hex("UNSIGNED-PAYLOAD") + headers["X-TC-Content-SHA256"] = "UNSIGNED-PAYLOAD" + } else { + hashedRequestPayload = sha256hex(requestPayload) + } + canonicalRequest := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s", + httpRequestMethod, + canonicalURI, + canonicalQueryString, + canonicalHeaders, + signedHeaders, + hashedRequestPayload) + //log.Println("canonicalRequest:", canonicalRequest) + + // build string to sign + algorithm := "TC3-HMAC-SHA256" + requestTimestamp := headers["X-TC-Timestamp"] + timestamp, _ := strconv.ParseInt(requestTimestamp, 10, 64) + t := time.Unix(timestamp, 0).UTC() + // must be the format 2006-01-02, ref to package time for more info + date := t.Format("2006-01-02") + credentialScope := fmt.Sprintf("%s/%s/tc3_request", date, request.GetService()) + hashedCanonicalRequest := sha256hex(canonicalRequest) + string2sign := fmt.Sprintf("%s\n%s\n%s\n%s", + algorithm, + requestTimestamp, + credentialScope, + hashedCanonicalRequest) + //log.Println("string2sign", string2sign) + + // sign string + secretDate := hmacsha256(date, "TC3"+c.credential.SecretKey) + secretService := hmacsha256(request.GetService(), secretDate) + secretKey := hmacsha256("tc3_request", secretService) + signature := hex.EncodeToString([]byte(hmacsha256(string2sign, secretKey))) + //log.Println("signature", signature) + + // build authorization + authorization := fmt.Sprintf("%s Credential=%s/%s, SignedHeaders=%s, Signature=%s", + algorithm, + c.credential.SecretId, + credentialScope, + signedHeaders, + signature) + //log.Println("authorization", authorization) + + headers["Authorization"] = authorization + url := "https://" + request.GetDomain() + request.GetPath() + if canonicalQueryString != "" { + url = url + "?" + canonicalQueryString + } + httpRequest, err := http.NewRequest(httpRequestMethod, url, strings.NewReader(requestPayload)) + if err != nil { + return err + } + for k, v := range headers { + httpRequest.Header[k] = []string{v} + } + //log.Printf("[DEBUG] http request=%v, body=%v", httpRequest, requestPayload) + httpResponse, err := c.httpClient.Do(httpRequest) + if err != nil { + return err + } + err = tchttp.ParseFromHttpResponse(httpResponse, response) + return err } func (c *Client) GetRegion() string { @@ -81,6 +218,7 @@ func (c *Client) WithCredential(cred *Credential) *Client { func (c *Client) WithProfile(clientProfile *profile.ClientProfile) *Client { c.signMethod = clientProfile.SignMethod + c.unsignedPayload = clientProfile.UnsignedPayload c.httpProfile = clientProfile.HttpProfile c.httpClient.Timeout = time.Duration(c.httpProfile.ReqTimeout) * time.Second return c @@ -91,6 +229,11 @@ func (c *Client) WithSignatureMethod(method string) *Client { return c } +func (c *Client) WithHttpTransport (transport http.RoundTripper) *Client { + c.httpClient.Transport = transport + return c +} + func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) { client = &Client{} client.Init(region).WithSecretId(secretId, secretKey) diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go index 160cfe162..4774013fa 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go @@ -92,7 +92,7 @@ func (r *BaseRequest) GetService() string { func (r *BaseRequest) GetUrl() string { if r.httpMethod == GET { - return "https://" + r.domain + r.path + "?" + getUrlQueriesEncoded(r.params) + return "https://" + r.domain + r.path + "?" + GetUrlQueriesEncoded(r.params) } else if r.httpMethod == POST { return "https://" + r.domain + r.path } else { @@ -104,7 +104,7 @@ func (r *BaseRequest) GetVersion() string { return r.version } -func getUrlQueriesEncoded(params map[string]string) string { +func GetUrlQueriesEncoded(params map[string]string) string { values := url.Values{} for key, value := range params { if value != "" { @@ -116,8 +116,7 @@ func getUrlQueriesEncoded(params map[string]string) string { func (r *BaseRequest) GetBodyReader() io.Reader { if r.httpMethod == POST { - s := getUrlQueriesEncoded(r.params) - //log.Printf("[DEBUG] body: %s", s) + s := GetUrlQueriesEncoded(r.params) return strings.NewReader(s) } else { return strings.NewReader("") @@ -153,7 +152,7 @@ func CompleteCommonParams(request Request, region string) { params["Action"] = request.GetAction() params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10) params["Nonce"] = strconv.Itoa(rand.Int()) - params["RequestClient"] = "SDK_GO_3.0.42" + params["RequestClient"] = "SDK_GO_3.0.71" } func ConstructParams(req Request) (err error) { @@ -196,9 +195,8 @@ func flatStructure(value reflect.Value, request Request, prefix string) (err err } else if kind == reflect.Float64 { request.GetParams()[key] = strconv.FormatFloat(field.Float(), 'f', -1, 64) } else if kind == reflect.Slice { - list := value.Field(i) - for j := 0; j < list.Len(); j++ { - vj := list.Index(j) + for j := 0; j < field.Len(); j++ { + vj := field.Index(j) key := prefix + nameTag + "." + strconv.Itoa(j) kind = vj.Kind() if kind == reflect.Ptr && vj.IsNil() { @@ -219,11 +217,11 @@ func flatStructure(value reflect.Value, request Request, prefix string) (err err } else if kind == reflect.Float64 { request.GetParams()[key] = strconv.FormatFloat(vj.Float(), 'f', -1, 64) } else { - flatStructure(vj, request, key+".") + return flatStructure(vj, request, key+".") } } } else { - flatStructure(reflect.ValueOf(field.Interface()), request, prefix+nameTag+".") + return flatStructure(reflect.ValueOf(field.Interface()), request, prefix+nameTag+".") } } return diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go index 8b9282a10..c8e27f7f5 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" "io/ioutil" - //"log" + "log" "net/http" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" @@ -69,5 +69,8 @@ func ParseFromHttpResponse(hr *http.Response, response Response) (err error) { return } err = json.Unmarshal(body, &response) + if err != nil { + log.Printf("Unexpected Error occurs when parsing API response\n%s\n", string(body[:])) + } return } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go index 94c63b2f0..0fc71750b 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go @@ -1,13 +1,15 @@ package profile type ClientProfile struct { - HttpProfile *HttpProfile - SignMethod string + HttpProfile *HttpProfile + SignMethod string + UnsignedPayload bool } func NewClientProfile() *ClientProfile { return &ClientProfile{ - HttpProfile: NewHttpProfile(), - SignMethod: "HmacSHA256", + HttpProfile: NewHttpProfile(), + SignMethod: "TC3-HMAC-SHA256", + UnsignedPayload: false, } } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go index 450fe2ccd..63efd9227 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go @@ -5,6 +5,7 @@ import ( "crypto/sha1" "crypto/sha256" "encoding/base64" + "encoding/hex" "fmt" "sort" "strings" @@ -27,6 +28,17 @@ func Sign(s, secretKey, method string) string { return base64.StdEncoding.EncodeToString(hashed.Sum(nil)) } +func sha256hex(s string) string { + b := sha256.Sum256([]byte(s)) + return hex.EncodeToString(b[:]) +} + +func hmacsha256(s, key string) string { + hashed := hmac.New(sha256.New, []byte(key)) + hashed.Write([]byte(s)) + return string(hashed.Sum(nil)) +} + func signRequest(request tchttp.Request, credential *Credential, method string) (err error) { if method != SHA256 { method = SHA1 diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/client.go index 8ec7096b1..3305127e1 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/client.go @@ -611,6 +611,33 @@ func (c *Client) DescribeInstances(request *DescribeInstancesRequest) (response return } +func NewDescribeInstancesOperationLimitRequest() (request *DescribeInstancesOperationLimitRequest) { + request = &DescribeInstancesOperationLimitRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("cvm", APIVersion, "DescribeInstancesOperationLimit") + return +} + +func NewDescribeInstancesOperationLimitResponse() (response *DescribeInstancesOperationLimitResponse) { + response = &DescribeInstancesOperationLimitResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(DescribeInstancesOperationLimit)用于查询实例操作限制。 +// +// * 目前支持调整配置操作限制次数查询。 +func (c *Client) DescribeInstancesOperationLimit(request *DescribeInstancesOperationLimitRequest) (response *DescribeInstancesOperationLimitResponse, err error) { + if request == nil { + request = NewDescribeInstancesOperationLimitRequest() + } + response = NewDescribeInstancesOperationLimitResponse() + err = c.Send(request, response) + return +} + func NewDescribeInstancesStatusRequest() (request *DescribeInstancesStatusRequest) { request = &DescribeInstancesStatusRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -785,7 +812,7 @@ func NewDisassociateInstancesKeyPairsResponse() (response *DisassociateInstances // // * 只支持[`STOPPED`](https://cloud.tencent.com/document/api/213/9452#INSTANCE_STATE)状态的`Linux`操作系统的实例。 // * 解绑密钥后,实例可以通过原来设置的密码登录。 -// * 如果原来没有设置密码,解绑后将无法使用 `SSH` 登录。可以调用 [ResetInstancesPassword](https://cloud.tencent.com/document/api/213/9397) 接口来设置登陆密码。 +// * 如果原来没有设置密码,解绑后将无法使用 `SSH` 登录。可以调用 [ResetInstancesPassword](https://cloud.tencent.com/document/api/213/15736) 接口来设置登录密码。 // * 支持批量操作。每次请求批量实例的上限为100。如果批量实例存在不允许操作的实例,操作会以特定错误码返回。 func (c *Client) DisassociateInstancesKeyPairs(request *DisassociateInstancesKeyPairsRequest) (response *DisassociateInstancesKeyPairsResponse, err error) { if request == nil { @@ -1006,7 +1033,6 @@ func NewInquiryPriceResetInstancesTypeResponse() (response *InquiryPriceResetIns // // * 目前只支持[系统盘类型](https://cloud.tencent.com/document/api/213/9452#block_device)是`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`类型的实例使用该接口进行调整机型询价。 // * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口调整机型询价。 -// * 目前不支持跨机型系统来调整机型,即使用该接口时指定的`InstanceType`和实例原来的机型需要属于同一系列。 // * 对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。 func (c *Client) InquiryPriceResetInstancesType(request *InquiryPriceResetInstancesTypeRequest) (response *InquiryPriceResetInstancesTypeResponse, err error) { if request == nil { @@ -1034,7 +1060,7 @@ func NewInquiryPriceResizeInstanceDisksResponse() (response *InquiryPriceResizeI // 本接口 (InquiryPriceResizeInstanceDisks) 用于扩容实例的数据盘询价。 // -// * 目前只支持扩容随实例购买的数据盘询价,且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。 +// * 目前只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性)询价,且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。 // * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口扩容数据盘询价。* 仅支持包年包月实例随机器购买的数据盘。* 目前只支持扩容一块数据盘询价。 func (c *Client) InquiryPriceResizeInstanceDisks(request *InquiryPriceResizeInstanceDisksRequest) (response *InquiryPriceResizeInstanceDisksResponse, err error) { if request == nil { @@ -1544,7 +1570,7 @@ func NewResetInstancesTypeResponse() (response *ResetInstancesTypeResponse) { // 本接口 (ResetInstancesType) 用于调整实例的机型。 // * 目前只支持[系统盘类型](/document/api/213/9452#block_device)是`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`类型的实例使用该接口进行机型调整。 -// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口调整机型。* 目前不支持跨机型系统来调整机型,即使用该接口时指定的`InstanceType`和实例原来的机型需要属于同一系列。* 对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。 +// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口调整机型。对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。 func (c *Client) ResetInstancesType(request *ResetInstancesTypeRequest) (response *ResetInstancesTypeResponse, err error) { if request == nil { request = NewResetInstancesTypeRequest() @@ -1571,7 +1597,8 @@ func NewResizeInstanceDisksResponse() (response *ResizeInstanceDisksResponse) { // 本接口 (ResizeInstanceDisks) 用于扩容实例的数据盘。 // -// * 目前只支持扩容随实例购买的数据盘,且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。* 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口扩容数据盘。 +// * 目前只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性),且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。 +// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口扩容数据盘。 // * 对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。 // * 目前只支持扩容一块数据盘。 func (c *Client) ResizeInstanceDisks(request *ResizeInstanceDisksRequest) (response *ResizeInstanceDisksResponse, err error) { diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/models.go index 5c0b9e030..aef3f7b30 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/models.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/models.go @@ -23,35 +23,38 @@ import ( type ActionTimer struct { // 扩展数据 - Externals *Externals `json:"Externals" name:"Externals"` + Externals *Externals `json:"Externals,omitempty" name:"Externals"` // 定时器名称,目前仅支持销毁一个值:TerminateInstances。 - TimerAction *string `json:"TimerAction" name:"TimerAction"` + TimerAction *string `json:"TimerAction,omitempty" name:"TimerAction"` // 执行时间,格式形如:2018-5-29 11:26:40,执行时间必须大于当前时间5分钟。 - ActionTime *string `json:"ActionTime" name:"ActionTime"` + ActionTime *string `json:"ActionTime,omitempty" name:"ActionTime"` } type AllocateHostsRequest struct { *tchttp.BaseRequest // 实例所在的位置。通过该参数可以指定实例所属可用区,所属项目等属性。 - Placement *Placement `json:"Placement" name:"Placement"` + Placement *Placement `json:"Placement,omitempty" name:"Placement"` // 用于保证请求幂等性的字符串。 - ClientToken *string `json:"ClientToken" name:"ClientToken"` + ClientToken *string `json:"ClientToken,omitempty" name:"ClientToken"` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。 - HostChargePrepaid *ChargePrepaid `json:"HostChargePrepaid" name:"HostChargePrepaid"` + HostChargePrepaid *ChargePrepaid `json:"HostChargePrepaid,omitempty" name:"HostChargePrepaid"` // 实例计费类型。目前仅支持:PREPAID(预付费,即包年包月模式)。 - HostChargeType *string `json:"HostChargeType" name:"HostChargeType"` + HostChargeType *string `json:"HostChargeType,omitempty" name:"HostChargeType"` // CDH实例机型,默认为:'HS1'。 - HostType *string `json:"HostType" name:"HostType"` + HostType *string `json:"HostType,omitempty" name:"HostType"` // 购买CDH实例数量。 - HostCount *uint64 `json:"HostCount" name:"HostCount"` + HostCount *uint64 `json:"HostCount,omitempty" name:"HostCount"` + + // 标签描述列表。通过指定该参数可以同时绑定标签到相应的资源实例。 + TagSpecification []*TagSpecification `json:"TagSpecification,omitempty" name:"TagSpecification" list` } func (r *AllocateHostsRequest) ToJsonString() string { @@ -68,10 +71,10 @@ type AllocateHostsResponse struct { Response *struct { // 新创建云子机的实例id列表。 - HostIdSet []*string `json:"HostIdSet" name:"HostIdSet" list` + HostIdSet []*string `json:"HostIdSet,omitempty" name:"HostIdSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -88,13 +91,13 @@ type AssociateInstancesKeyPairsRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID,每次请求批量实例的上限为100。
    可以通过以下方式获取可用的实例ID:
  • 通过登录[控制台](https://console.cloud.tencent.com/cvm/index)查询实例ID。
  • 通过调用接口 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) ,取返回信息中的`InstanceId`获取实例ID。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 一个或多个待操作的密钥对ID,每次请求批量密钥对的上限为100。密钥对ID形如:`skey-3glfot13`。
    可以通过以下方式获取可用的密钥ID:
  • 通过登录[控制台](https://console.cloud.tencent.com/cvm/sshkey)查询密钥ID。
  • 通过调用接口 [DescribeKeyPairs](https://cloud.tencent.com/document/api/213/15699) ,取返回信息中的`KeyId`获取密钥对ID。 - KeyIds []*string `json:"KeyIds" name:"KeyIds" list` + KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list` // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再绑定密钥。取值范围:
  • TRUE:表示在正常关机失败后进行强制关机。
  • FALSE:表示在正常关机失败后不进行强制关机。
    默认取值:FALSE。 - ForceStop *bool `json:"ForceStop" name:"ForceStop"` + ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"` } func (r *AssociateInstancesKeyPairsRequest) ToJsonString() string { @@ -111,7 +114,7 @@ type AssociateInstancesKeyPairsResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -128,10 +131,10 @@ type AssociateSecurityGroupsRequest struct { *tchttp.BaseRequest // 要绑定的`安全组ID`,类似sg-efil73jd,只支持绑定单个安全组。 - SecurityGroupIds []*string `json:"SecurityGroupIds" name:"SecurityGroupIds" list` + SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list` // 被绑定的`实例ID`,类似ins-lesecurk,支持指定多个实例。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` } func (r *AssociateSecurityGroupsRequest) ToJsonString() string { @@ -148,7 +151,7 @@ type AssociateSecurityGroupsResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -164,23 +167,23 @@ func (r *AssociateSecurityGroupsResponse) FromJsonString(s string) error { type ChargePrepaid struct { // 购买实例的时长,单位:月。取值范围:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36。 - Period *uint64 `json:"Period" name:"Period"` + Period *uint64 `json:"Period,omitempty" name:"Period"` // 自动续费标识。取值范围:
  • NOTIFY_AND_AUTO_RENEW:通知过期且自动续费
  • NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费
  • DISABLE_NOTIFY_AND_MANUAL_RENEW:不通知过期不自动续费

    默认取值:NOTIFY_AND_AUTO_RENEW。若该参数指定为NOTIFY_AND_AUTO_RENEW,在账户余额充足的情况下,实例到期后将按月自动续费。 - RenewFlag *string `json:"RenewFlag" name:"RenewFlag"` + RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"` } type CreateDisasterRecoverGroupRequest struct { *tchttp.BaseRequest // 分散置放群组名称,长度1-60个字符,支持中、英文。 - Name *string `json:"Name" name:"Name"` + Name *string `json:"Name,omitempty" name:"Name"` // 分散置放群组类型,取值范围:
  • HOST:物理机
  • SW:交换机
  • RACK:机架 - Type *string `json:"Type" name:"Type"` + Type *string `json:"Type,omitempty" name:"Type"` // 用于保证请求幂等性的字符串。该字符串由客户生成,需保证不同请求之间唯一,最大值不超过64个ASCII字符。若不指定该参数,则无法保证请求的幂等性。
    更多详细信息请参阅:如何保证幂等性。 - ClientToken *string `json:"ClientToken" name:"ClientToken"` + ClientToken *string `json:"ClientToken,omitempty" name:"ClientToken"` } func (r *CreateDisasterRecoverGroupRequest) ToJsonString() string { @@ -197,25 +200,25 @@ type CreateDisasterRecoverGroupResponse struct { Response *struct { // 分散置放群组ID列表。 - DisasterRecoverGroupId *string `json:"DisasterRecoverGroupId" name:"DisasterRecoverGroupId"` + DisasterRecoverGroupId *string `json:"DisasterRecoverGroupId,omitempty" name:"DisasterRecoverGroupId"` // 分散置放群组类型,取值范围:
  • HOST:物理机
  • SW:交换机
  • RACK:机架 - Type *string `json:"Type" name:"Type"` + Type *string `json:"Type,omitempty" name:"Type"` // 分散置放群组名称,长度1-60个字符,支持中、英文。 - Name *string `json:"Name" name:"Name"` + Name *string `json:"Name,omitempty" name:"Name"` // 置放群组内可容纳的云主机数量。 - CvmQuotaTotal *int64 `json:"CvmQuotaTotal" name:"CvmQuotaTotal"` + CvmQuotaTotal *int64 `json:"CvmQuotaTotal,omitempty" name:"CvmQuotaTotal"` // 置放群组内已有的云主机数量。 - CurrentNum *int64 `json:"CurrentNum" name:"CurrentNum"` + CurrentNum *int64 `json:"CurrentNum,omitempty" name:"CurrentNum"` // 置放群组创建时间。 - CreateTime *string `json:"CreateTime" name:"CreateTime"` + CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -232,31 +235,31 @@ type CreateImageRequest struct { *tchttp.BaseRequest // 镜像名称 - ImageName *string `json:"ImageName" name:"ImageName"` + ImageName *string `json:"ImageName,omitempty" name:"ImageName"` // 需要制作镜像的实例ID - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 镜像描述 - ImageDescription *string `json:"ImageDescription" name:"ImageDescription"` + ImageDescription *string `json:"ImageDescription,omitempty" name:"ImageDescription"` // 软关机失败时是否执行强制关机以制作镜像 - ForcePoweroff *string `json:"ForcePoweroff" name:"ForcePoweroff"` + ForcePoweroff *string `json:"ForcePoweroff,omitempty" name:"ForcePoweroff"` // 创建Windows镜像时是否启用Sysprep - Sysprep *string `json:"Sysprep" name:"Sysprep"` + Sysprep *string `json:"Sysprep,omitempty" name:"Sysprep"` // 实例处于运行中时,是否允许关机执行制作镜像任务。 - Reboot *string `json:"Reboot" name:"Reboot"` + Reboot *string `json:"Reboot,omitempty" name:"Reboot"` // 实例需要制作镜像的数据盘Id - DataDiskIds []*string `json:"DataDiskIds" name:"DataDiskIds" list` + DataDiskIds []*string `json:"DataDiskIds,omitempty" name:"DataDiskIds" list` // 需要制作镜像的快照Id,必须包含一个系统盘快照 - SnapshotIds []*string `json:"SnapshotIds" name:"SnapshotIds" list` + SnapshotIds []*string `json:"SnapshotIds,omitempty" name:"SnapshotIds" list` - // DryRun - DryRun *bool `json:"DryRun" name:"DryRun"` + // 检测请求的合法性,但不会对操作的资源产生任何影响 + DryRun *bool `json:"DryRun,omitempty" name:"DryRun"` } func (r *CreateImageRequest) ToJsonString() string { @@ -273,7 +276,7 @@ type CreateImageResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -290,13 +293,13 @@ type CreateKeyPairRequest struct { *tchttp.BaseRequest // 密钥对名称,可由数字,字母和下划线组成,长度不超过25个字符。 - KeyName *string `json:"KeyName" name:"KeyName"` + KeyName *string `json:"KeyName,omitempty" name:"KeyName"` // 密钥对创建后所属的项目ID。 // 可以通过以下方式获取项目ID: //
  • 通过项目列表查询项目ID。 //
  • 通过调用接口DescribeProject,取返回信息中的`projectId `获取项目ID。 - ProjectId *int64 `json:"ProjectId" name:"ProjectId"` + ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"` } func (r *CreateKeyPairRequest) ToJsonString() string { @@ -313,10 +316,10 @@ type CreateKeyPairResponse struct { Response *struct { // 密钥对信息。 - KeyPair *KeyPair `json:"KeyPair" name:"KeyPair"` + KeyPair *KeyPair `json:"KeyPair,omitempty" name:"KeyPair"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -332,27 +335,32 @@ func (r *CreateKeyPairResponse) FromJsonString(s string) error { type DataDisk struct { // 数据盘大小,单位:GB。最小调整步长为10G,不同数据盘类型取值范围不同,具体限制详见:[CVM实例配置](/document/product/213/2177)。默认值为0,表示不购买数据盘。更多限制详见产品文档。 - DiskSize *int64 `json:"DiskSize" name:"DiskSize"` + DiskSize *int64 `json:"DiskSize,omitempty" name:"DiskSize"` // 数据盘类型。数据盘类型限制详见[CVM实例配置](/document/product/213/2177)。取值范围:
  • LOCAL_BASIC:本地硬盘
  • LOCAL_SSD:本地SSD硬盘
  • CLOUD_BASIC:普通云硬盘
  • CLOUD_PREMIUM:高性能云硬盘
  • CLOUD_SSD:SSD云硬盘

    默认取值:LOCAL_BASIC。

    该参数对`ResizeInstanceDisk`接口无效。 - DiskType *string `json:"DiskType" name:"DiskType"` + DiskType *string `json:"DiskType,omitempty" name:"DiskType"` // 数据盘ID。LOCAL_BASIC 和 LOCAL_SSD 类型没有ID。暂时不支持该参数。 - DiskId *string `json:"DiskId" name:"DiskId"` + DiskId *string `json:"DiskId,omitempty" name:"DiskId"` // 数据盘是否随子机销毁。取值范围: - //
  • TRUE:子机销毁时,销毁数据盘 + //
  • TRUE:子机销毁时,销毁数据盘,只支持按小时后付费云盘 //
  • FALSE:子机销毁时,保留数据盘
    // 默认取值:TRUE
    // 该参数目前仅用于 `RunInstances` 接口。 - DeleteWithInstance *bool `json:"DeleteWithInstance" name:"DeleteWithInstance"` + // 注意:此字段可能返回 null,表示取不到有效值。 + DeleteWithInstance *bool `json:"DeleteWithInstance,omitempty" name:"DeleteWithInstance"` + + // 数据盘快照ID。选择的数据盘快照大小需小于数据盘大小。 + // 注意:此字段可能返回 null,表示取不到有效值。 + SnapshotId *string `json:"SnapshotId,omitempty" name:"SnapshotId"` } type DeleteDisasterRecoverGroupsRequest struct { *tchttp.BaseRequest // 分散置放群组ID列表,可通过[DescribeDisasterRecoverGroups](https://cloud.tencent.com/document/api/213/17810)接口获取。 - DisasterRecoverGroupIds []*string `json:"DisasterRecoverGroupIds" name:"DisasterRecoverGroupIds" list` + DisasterRecoverGroupIds []*string `json:"DisasterRecoverGroupIds,omitempty" name:"DisasterRecoverGroupIds" list` } func (r *DeleteDisasterRecoverGroupsRequest) ToJsonString() string { @@ -369,7 +377,7 @@ type DeleteDisasterRecoverGroupsResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -386,7 +394,7 @@ type DeleteImagesRequest struct { *tchttp.BaseRequest // 准备删除的镜像Id列表 - ImageIds []*string `json:"ImageIds" name:"ImageIds" list` + ImageIds []*string `json:"ImageIds,omitempty" name:"ImageIds" list` } func (r *DeleteImagesRequest) ToJsonString() string { @@ -403,7 +411,7 @@ type DeleteImagesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -420,7 +428,7 @@ type DeleteKeyPairsRequest struct { *tchttp.BaseRequest // 一个或多个待操作的密钥对ID。每次请求批量密钥对的上限为100。
    可以通过以下方式获取可用的密钥ID:
  • 通过登录[控制台](https://console.cloud.tencent.com/cvm/sshkey)查询密钥ID。
  • 通过调用接口 [DescribeKeyPairs](https://cloud.tencent.com/document/api/213/15699) ,取返回信息中的 `KeyId` 获取密钥对ID。 - KeyIds []*string `json:"KeyIds" name:"KeyIds" list` + KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list` } func (r *DeleteKeyPairsRequest) ToJsonString() string { @@ -437,7 +445,7 @@ type DeleteKeyPairsResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -468,22 +476,22 @@ type DescribeDisasterRecoverGroupQuotaResponse struct { Response *struct { // 可创建置放群组数量的上限。 - GroupQuota *int64 `json:"GroupQuota" name:"GroupQuota"` + GroupQuota *int64 `json:"GroupQuota,omitempty" name:"GroupQuota"` // 当前用户已经创建的置放群组数量。 - CurrentNum *int64 `json:"CurrentNum" name:"CurrentNum"` + CurrentNum *int64 `json:"CurrentNum,omitempty" name:"CurrentNum"` // 物理机类型容灾组内实例的配额数。 - CvmInHostGroupQuota *int64 `json:"CvmInHostGroupQuota" name:"CvmInHostGroupQuota"` + CvmInHostGroupQuota *int64 `json:"CvmInHostGroupQuota,omitempty" name:"CvmInHostGroupQuota"` // 交换机类型容灾组内实例的配额数。 - CvmInSwGroupQuota *int64 `json:"CvmInSwGroupQuota" name:"CvmInSwGroupQuota"` + CvmInSwGroupQuota *int64 `json:"CvmInSwGroupQuota,omitempty" name:"CvmInSwGroupQuota"` // 机架类型容灾组内实例的配额数。 - CvmInRackGroupQuota *int64 `json:"CvmInRackGroupQuota" name:"CvmInRackGroupQuota"` + CvmInRackGroupQuota *int64 `json:"CvmInRackGroupQuota,omitempty" name:"CvmInRackGroupQuota"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -500,16 +508,16 @@ type DescribeDisasterRecoverGroupsRequest struct { *tchttp.BaseRequest // 分散置放群组ID列表。 - DisasterRecoverGroupIds []*string `json:"DisasterRecoverGroupIds" name:"DisasterRecoverGroupIds" list` + DisasterRecoverGroupIds []*string `json:"DisasterRecoverGroupIds,omitempty" name:"DisasterRecoverGroupIds" list` // 分散置放群组名称,支持模糊匹配。 - Name *string `json:"Name" name:"Name"` + Name *string `json:"Name,omitempty" name:"Name"` // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。 - Offset *int64 `json:"Offset" name:"Offset"` + Offset *int64 `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。 - Limit *int64 `json:"Limit" name:"Limit"` + Limit *int64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeDisasterRecoverGroupsRequest) ToJsonString() string { @@ -526,13 +534,13 @@ type DescribeDisasterRecoverGroupsResponse struct { Response *struct { // 分散置放群组信息列表。 - DisasterRecoverGroupSet []*DisasterRecoverGroup `json:"DisasterRecoverGroupSet" name:"DisasterRecoverGroupSet" list` + DisasterRecoverGroupSet []*DisasterRecoverGroup `json:"DisasterRecoverGroupSet,omitempty" name:"DisasterRecoverGroupSet" list` // 用户置放群组总量。 - TotalCount *int64 `json:"TotalCount" name:"TotalCount"` + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -554,13 +562,13 @@ type DescribeHostsRequest struct { //
  • host-id - String - 是否必填:否 - (过滤条件)按照CDH ID过滤。CDH ID形如:host-11112222。
  • //
  • host-name - String - 是否必填:否 - (过滤条件)按照CDH实例名称过滤。
  • //
  • host-state - String - 是否必填:否 - (过滤条件)按照CDH实例状态进行过滤。(PENDING:创建中|LAUNCH_FAILURE:创建失败|RUNNING:运行中|EXPIRED:已过期)
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeHostsRequest) ToJsonString() string { @@ -577,13 +585,13 @@ type DescribeHostsResponse struct { Response *struct { // 符合查询条件的cdh实例总数 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // cdh实例详细信息列表 - HostSet []*HostItem `json:"HostSet" name:"HostSet" list` + HostSet []*HostItem `json:"HostSet,omitempty" name:"HostSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -614,10 +622,10 @@ type DescribeImageQuotaResponse struct { Response *struct { // 账户的镜像配额 - ImageNumQuota *int64 `json:"ImageNumQuota" name:"ImageNumQuota"` + ImageNumQuota *int64 `json:"ImageNumQuota,omitempty" name:"ImageNumQuota"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -634,7 +642,7 @@ type DescribeImageSharePermissionRequest struct { *tchttp.BaseRequest // 需要共享的镜像Id - ImageId *string `json:"ImageId" name:"ImageId"` + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` } func (r *DescribeImageSharePermissionRequest) ToJsonString() string { @@ -651,10 +659,10 @@ type DescribeImageSharePermissionResponse struct { Response *struct { // 镜像共享信息 - SharePermissionSet []*SharePermission `json:"SharePermissionSet" name:"SharePermissionSet" list` + SharePermissionSet []*SharePermission `json:"SharePermissionSet,omitempty" name:"SharePermissionSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -671,22 +679,22 @@ type DescribeImagesRequest struct { *tchttp.BaseRequest // 镜像ID列表 。镜像ID如:`img-gvbnzy6f`。array型参数的格式可以参考[API简介](https://cloud.tencent.com/document/api/213/15688)。镜像ID可以通过如下方式获取:
  • 通过[DescribeImages](https://cloud.tencent.com/document/api/213/15715)接口返回的`ImageId`获取。
  • 通过[镜像控制台](https://console.cloud.tencent.com/cvm/image)获取。 - ImageIds []*string `json:"ImageIds" name:"ImageIds" list` + ImageIds []*string `json:"ImageIds,omitempty" name:"ImageIds" list` // 过滤条件,每次请求的`Filters`的上限为0,`Filters.Values`的上限为5。参数不可以同时指定`ImageIds`和`Filters`。详细的过滤条件如下: //
  • image-id - String - 是否必填: 否 - (过滤条件)按照镜像ID进行过滤
  • //
  • image-type - String - 是否必填: 否 - (过滤条件)按照镜像类型进行过滤。取值范围:详见[镜像类型](https://cloud.tencent.com/document/product/213/9452#image_type)。
  • //
  • image-state - String - 是否必填: 否 - (过滤条件)按照镜像状态进行过滤。取值范围:详见[镜像状态](https://cloud.tencent.com/document/product/213/9452#image_state)。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。关于Offset详见[API简介](/document/api/213/568#.E8.BE.93.E5.85.A5.E5.8F.82.E6.95.B0.E4.B8.8E.E8.BF.94.E5.9B.9E.E5.8F.82.E6.95.B0.E9.87.8A.E4.B9.89)。 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 数量限制,默认为20,最大值为100。关于Limit详见[API简介](/document/api/213/568#.E8.BE.93.E5.85.A5.E5.8F.82.E6.95.B0.E4.B8.8E.E8.BF.94.E5.9B.9E.E5.8F.82.E6.95.B0.E9.87.8A.E4.B9.89)。 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` // 实例类型,如 `S1.SMALL1` - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` } func (r *DescribeImagesRequest) ToJsonString() string { @@ -703,13 +711,13 @@ type DescribeImagesResponse struct { Response *struct { // 一个关于镜像详细信息的结构体,主要包括镜像的主要状态与属性。 - ImageSet []*Image `json:"ImageSet" name:"ImageSet" list` + ImageSet []*Image `json:"ImageSet,omitempty" name:"ImageSet" list` // 符合要求的镜像数量。 - TotalCount *int64 `json:"TotalCount" name:"TotalCount"` + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -740,13 +748,13 @@ type DescribeImportImageOsResponse struct { Response *struct { // 支持的导入镜像的操作系统类型。 - ImportImageOsListSupported *ImageOsList `json:"ImportImageOsListSupported" name:"ImportImageOsListSupported"` + ImportImageOsListSupported *ImageOsList `json:"ImportImageOsListSupported,omitempty" name:"ImportImageOsListSupported"` // 支持的导入镜像的操作系统版本。 - ImportImageOsVersionSet []*OsVersion `json:"ImportImageOsVersionSet" name:"ImportImageOsVersionSet" list` + ImportImageOsVersionSet []*OsVersion `json:"ImportImageOsVersionSet,omitempty" name:"ImportImageOsVersionSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -777,10 +785,10 @@ type DescribeInstanceFamilyConfigsResponse struct { Response *struct { // 实例机型组配置的列表信息 - InstanceFamilyConfigSet []*InstanceFamilyConfig `json:"InstanceFamilyConfigSet" name:"InstanceFamilyConfigSet" list` + InstanceFamilyConfigSet []*InstanceFamilyConfig `json:"InstanceFamilyConfigSet,omitempty" name:"InstanceFamilyConfigSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -797,7 +805,7 @@ type DescribeInstanceInternetBandwidthConfigsRequest struct { *tchttp.BaseRequest // 待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` } func (r *DescribeInstanceInternetBandwidthConfigsRequest) ToJsonString() string { @@ -814,10 +822,10 @@ type DescribeInstanceInternetBandwidthConfigsResponse struct { Response *struct { // 带宽配置信息列表。 - InternetBandwidthConfigSet []*InternetBandwidthConfig `json:"InternetBandwidthConfigSet" name:"InternetBandwidthConfigSet" list` + InternetBandwidthConfigSet []*InternetBandwidthConfig `json:"InternetBandwidthConfigSet,omitempty" name:"InternetBandwidthConfigSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -837,7 +845,7 @@ type DescribeInstanceTypeConfigsRequest struct { //
  • zone - String - 是否必填:否 -(过滤条件)按照[可用区](https://cloud.tencent.com/document/api/213/9452#zone)过滤。
  • //
  • instance-family - String - 是否必填:否 -(过滤条件)按照实例机型系列过滤。实例机型系列形如:S1、I1、M1等。
  • // 每次请求的`Filters`的上限为10,`Filter.Values`的上限为1。 - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` } func (r *DescribeInstanceTypeConfigsRequest) ToJsonString() string { @@ -854,10 +862,10 @@ type DescribeInstanceTypeConfigsResponse struct { Response *struct { // 实例机型配置列表。 - InstanceTypeConfigSet []*InstanceTypeConfig `json:"InstanceTypeConfigSet" name:"InstanceTypeConfigSet" list` + InstanceTypeConfigSet []*InstanceTypeConfig `json:"InstanceTypeConfigSet,omitempty" name:"InstanceTypeConfigSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -874,7 +882,7 @@ type DescribeInstanceVncUrlRequest struct { *tchttp.BaseRequest // 一个操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728) API返回值中的`InstanceId`获取。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` } func (r *DescribeInstanceVncUrlRequest) ToJsonString() string { @@ -891,10 +899,10 @@ type DescribeInstanceVncUrlResponse struct { Response *struct { // 实例的管理终端地址。 - InstanceVncUrl *string `json:"InstanceVncUrl" name:"InstanceVncUrl"` + InstanceVncUrl *string `json:"InstanceVncUrl,omitempty" name:"InstanceVncUrl"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -907,11 +915,52 @@ func (r *DescribeInstanceVncUrlResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DescribeInstancesOperationLimitRequest struct { + *tchttp.BaseRequest + + // 按照一个或者多个实例ID查询,可通过[DescribeInstances](https://cloud.tencent.com/document/api/213/9388)API返回值中的InstanceId获取。实例ID形如:ins-xxxxxxxx。(此参数的具体格式可参考API[简介](https://cloud.tencent.com/document/api/213/15688)的id.N一节)。每次请求的实例的上限为100。 + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` + + // 实例操作。 + //
  • INSTANCE_DEGRADE:实例降配操作
  • + Operation *string `json:"Operation,omitempty" name:"Operation"` +} + +func (r *DescribeInstancesOperationLimitRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeInstancesOperationLimitRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeInstancesOperationLimitResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 该参数表示调整配置操作(降配)限制次数查询。 + InstanceOperationLimitSet []*OperationCountLimit `json:"InstanceOperationLimitSet,omitempty" name:"InstanceOperationLimitSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeInstancesOperationLimitResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeInstancesOperationLimitResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DescribeInstancesRequest struct { *tchttp.BaseRequest // 按照一个或者多个实例ID查询。实例ID形如:`ins-xxxxxxxx`。(此参数的具体格式可参考API[简介](https://cloud.tencent.com/document/api/213/15688)的`id.N`一节)。每次请求的实例的上限为100。参数不支持同时指定`InstanceIds`和`Filters`。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 过滤条件。 //
  • zone - String - 是否必填:否 -(过滤条件)按照可用区过滤。
  • @@ -929,13 +978,13 @@ type DescribeInstancesRequest struct { //
  • tag-value - String - 是否必填:否 - (过滤条件)按照标签值进行过滤。
  • //
  • tag:tag-key - String - 是否必填:否 - (过滤条件)按照标签键值对进行过滤。 tag-key使用具体的标签键进行替换。使用请参考示例2。
  • // 每次请求的`Filters`的上限为10,`Filter.Values`的上限为5。参数不支持同时指定`InstanceIds`和`Filters`。 - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。 - Offset *int64 `json:"Offset" name:"Offset"` + Offset *int64 `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。 - Limit *int64 `json:"Limit" name:"Limit"` + Limit *int64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeInstancesRequest) ToJsonString() string { @@ -952,13 +1001,13 @@ type DescribeInstancesResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *int64 `json:"TotalCount" name:"TotalCount"` + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` // 实例详细信息列表。 - InstanceSet []*Instance `json:"InstanceSet" name:"InstanceSet" list` + InstanceSet []*Instance `json:"InstanceSet,omitempty" name:"InstanceSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -975,13 +1024,13 @@ type DescribeInstancesStatusRequest struct { *tchttp.BaseRequest // 按照一个或者多个实例ID查询。实例ID形如:`ins-11112222`。此参数的具体格式可参考API[简介](https://cloud.tencent.com/document/api/213/15688)的`id.N`一节)。每次请求的实例的上限为100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。 - Offset *int64 `json:"Offset" name:"Offset"` + Offset *int64 `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。 - Limit *int64 `json:"Limit" name:"Limit"` + Limit *int64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeInstancesStatusRequest) ToJsonString() string { @@ -998,13 +1047,13 @@ type DescribeInstancesStatusResponse struct { Response *struct { // 符合条件的实例状态数量。 - TotalCount *int64 `json:"TotalCount" name:"TotalCount"` + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` // [实例状态](https://cloud.tencent.com/document/api/213/15738) 列表。 - InstanceStatusSet []*InstanceStatus `json:"InstanceStatusSet" name:"InstanceStatusSet" list` + InstanceStatusSet []*InstanceStatus `json:"InstanceStatusSet,omitempty" name:"InstanceStatusSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1035,10 +1084,10 @@ type DescribeInternetChargeTypeConfigsResponse struct { Response *struct { // 网络计费类型配置。 - InternetChargeTypeConfigSet []*InternetChargeTypeConfig `json:"InternetChargeTypeConfigSet" name:"InternetChargeTypeConfigSet" list` + InternetChargeTypeConfigSet []*InternetChargeTypeConfig `json:"InternetChargeTypeConfigSet,omitempty" name:"InternetChargeTypeConfigSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1055,18 +1104,18 @@ type DescribeKeyPairsRequest struct { *tchttp.BaseRequest // 密钥对ID,密钥对ID形如:`skey-11112222`(此接口支持同时传入多个ID进行过滤。此参数的具体格式可参考 API [简介](https://cloud.tencent.com/document/api/213/15688)的 `id.N` 一节)。参数不支持同时指定 `KeyIds` 和 `Filters`。密钥对ID可以通过登录[控制台](https://console.cloud.tencent.com/cvm/index)查询。 - KeyIds []*string `json:"KeyIds" name:"KeyIds" list` + KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list` // 过滤条件。 //
  • project-id - Integer - 是否必填:否 -(过滤条件)按照项目ID过滤。可以通过[项目列表](https://console.cloud.tencent.com/project)查询项目ID,或者调用接口 [DescribeProject](https://cloud.tencent.com/document/api/378/4400),取返回信息中的projectId获取项目ID。
  • //
  • key-name - String - 是否必填:否 -(过滤条件)按照密钥对名称过滤。
  • 参数不支持同时指定 `KeyIds` 和 `Filters`。 - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。关于 `Offset` 的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。返回数量,默认为20,最大值为100。关于 `Limit` 的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。 - Offset *int64 `json:"Offset" name:"Offset"` + Offset *int64 `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。关于 `Limit` 的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。 - Limit *int64 `json:"Limit" name:"Limit"` + Limit *int64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeKeyPairsRequest) ToJsonString() string { @@ -1083,13 +1132,13 @@ type DescribeKeyPairsResponse struct { Response *struct { // 符合条件的密钥对数量。 - TotalCount *int64 `json:"TotalCount" name:"TotalCount"` + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` // 密钥对详细信息列表。 - KeyPairSet []*KeyPair `json:"KeyPairSet" name:"KeyPairSet" list` + KeyPairSet []*KeyPair `json:"KeyPairSet,omitempty" name:"KeyPairSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1120,13 +1169,13 @@ type DescribeRegionsResponse struct { Response *struct { // 地域数量 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 地域列表信息 - RegionSet []*RegionInfo `json:"RegionSet" name:"RegionSet" list` + RegionSet []*RegionInfo `json:"RegionSet,omitempty" name:"RegionSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1151,7 +1200,7 @@ type DescribeZoneInstanceConfigInfosRequest struct { //
  • instance-type - String - 是否必填:否 - (过滤条件)按照机型过滤。按照实例机型过滤。不同实例机型指定了不同的资源规格,具体取值可通过调用接口 DescribeInstanceTypeConfigs 来获得最新的规格表或参见实例类型描述。若不指定该参数,则默认机型为S1.SMALL1。
  • // //
  • instance-charge-type - String - 是否必填:否 -(过滤条件)按照实例计费模式过滤。 (PREPAID:表示预付费,即包年包月 | POSTPAID_BY_HOUR:表示后付费,即按量计费 | CDHPAID:表示CDH付费,即只对CDH计费,不对CDH上的实例计费。 )
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` } func (r *DescribeZoneInstanceConfigInfosRequest) ToJsonString() string { @@ -1168,10 +1217,10 @@ type DescribeZoneInstanceConfigInfosResponse struct { Response *struct { // 可用区机型配置列表。 - InstanceTypeQuotaSet []*InstanceTypeQuotaItem `json:"InstanceTypeQuotaSet" name:"InstanceTypeQuotaSet" list` + InstanceTypeQuotaSet []*InstanceTypeQuotaItem `json:"InstanceTypeQuotaSet,omitempty" name:"InstanceTypeQuotaSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1202,13 +1251,13 @@ type DescribeZonesResponse struct { Response *struct { // 可用区数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 可用区列表信息。 - ZoneSet []*ZoneInfo `json:"ZoneSet" name:"ZoneSet" list` + ZoneSet []*ZoneInfo `json:"ZoneSet,omitempty" name:"ZoneSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1225,13 +1274,13 @@ type DisassociateInstancesKeyPairsRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID,每次请求批量实例的上限为100。

    可以通过以下方式获取可用的实例ID:
  • 通过登录[控制台](https://console.cloud.tencent.com/cvm/index)查询实例ID。
  • 通过调用接口 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) ,取返回信息中的 `InstanceId` 获取实例ID。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 密钥对ID列表,每次请求批量密钥对的上限为100。密钥对ID形如:`skey-11112222`。

    可以通过以下方式获取可用的密钥ID:
  • 通过登录[控制台](https://console.cloud.tencent.com/cvm/sshkey)查询密钥ID。
  • 通过调用接口 [DescribeKeyPairs](https://cloud.tencent.com/document/api/213/15699) ,取返回信息中的 `KeyId` 获取密钥对ID。 - KeyIds []*string `json:"KeyIds" name:"KeyIds" list` + KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list` // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再解绑密钥。取值范围:
  • TRUE:表示在正常关机失败后进行强制关机。
  • FALSE:表示在正常关机失败后不进行强制关机。

    默认取值:FALSE。 - ForceStop *bool `json:"ForceStop" name:"ForceStop"` + ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"` } func (r *DisassociateInstancesKeyPairsRequest) ToJsonString() string { @@ -1248,7 +1297,7 @@ type DisassociateInstancesKeyPairsResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1265,10 +1314,10 @@ type DisassociateSecurityGroupsRequest struct { *tchttp.BaseRequest // 要解绑的`安全组ID`,类似sg-efil73jd,只支持解绑单个安全组。 - SecurityGroupIds []*string `json:"SecurityGroupIds" name:"SecurityGroupIds" list` + SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list` // 被解绑的`实例ID`,类似ins-lesecurk,支持指定多个实例 。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` } func (r *DisassociateSecurityGroupsRequest) ToJsonString() string { @@ -1285,7 +1334,7 @@ type DisassociateSecurityGroupsResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1301,197 +1350,214 @@ func (r *DisassociateSecurityGroupsResponse) FromJsonString(s string) error { type DisasterRecoverGroup struct { // 分散置放群组id。 - DisasterRecoverGroupId *string `json:"DisasterRecoverGroupId" name:"DisasterRecoverGroupId"` + DisasterRecoverGroupId *string `json:"DisasterRecoverGroupId,omitempty" name:"DisasterRecoverGroupId"` // 分散置放群组名称,长度1-60个字符。 - Name *string `json:"Name" name:"Name"` + Name *string `json:"Name,omitempty" name:"Name"` // 分散置放群组类型,取值范围:
  • HOST:物理机
  • SW:交换机
  • RACK:机架 - Type *string `json:"Type" name:"Type"` + Type *string `json:"Type,omitempty" name:"Type"` // 分散置放群组内最大容纳云主机数量。 - CvmQuotaTotal *int64 `json:"CvmQuotaTotal" name:"CvmQuotaTotal"` + CvmQuotaTotal *int64 `json:"CvmQuotaTotal,omitempty" name:"CvmQuotaTotal"` // 分散置放群组内云主机当前数量。 - CurrentNum *int64 `json:"CurrentNum" name:"CurrentNum"` + CurrentNum *int64 `json:"CurrentNum,omitempty" name:"CurrentNum"` // 分散置放群组内,云主机id列表。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + // 注意:此字段可能返回 null,表示取不到有效值。 + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 分散置放群组创建时间。 - CreateTime *string `json:"CreateTime" name:"CreateTime"` + // 注意:此字段可能返回 null,表示取不到有效值。 + CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"` } type EnhancedService struct { // 开启云安全服务。若不指定该参数,则默认开启云安全服务。 - SecurityService *RunSecurityServiceEnabled `json:"SecurityService" name:"SecurityService"` + SecurityService *RunSecurityServiceEnabled `json:"SecurityService,omitempty" name:"SecurityService"` // 开启云监控服务。若不指定该参数,则默认开启云监控服务。 - MonitorService *RunMonitorServiceEnabled `json:"MonitorService" name:"MonitorService"` + MonitorService *RunMonitorServiceEnabled `json:"MonitorService,omitempty" name:"MonitorService"` } type Externals struct { // 释放地址 - ReleaseAddress *bool `json:"ReleaseAddress" name:"ReleaseAddress"` + // 注意:此字段可能返回 null,表示取不到有效值。 + ReleaseAddress *bool `json:"ReleaseAddress,omitempty" name:"ReleaseAddress"` // 不支持的网络类型 - UnsupportNetworks []*string `json:"UnsupportNetworks" name:"UnsupportNetworks" list` + // 注意:此字段可能返回 null,表示取不到有效值。 + UnsupportNetworks []*string `json:"UnsupportNetworks,omitempty" name:"UnsupportNetworks" list` // HDD本地存储属性 - StorageBlockAttr *StorageBlock `json:"StorageBlockAttr" name:"StorageBlockAttr"` + // 注意:此字段可能返回 null,表示取不到有效值。 + StorageBlockAttr *StorageBlock `json:"StorageBlockAttr,omitempty" name:"StorageBlockAttr"` } type Filter struct { // 需要过滤的字段。 - Name *string `json:"Name" name:"Name"` + Name *string `json:"Name,omitempty" name:"Name"` // 字段的过滤值。 - Values []*string `json:"Values" name:"Values" list` + Values []*string `json:"Values,omitempty" name:"Values" list` } type HostItem struct { // cdh实例所在的位置。通过该参数可以指定实例所属可用区,所属项目等属性。 - Placement *Placement `json:"Placement" name:"Placement"` + Placement *Placement `json:"Placement,omitempty" name:"Placement"` // cdh实例id - HostId *string `json:"HostId" name:"HostId"` + HostId *string `json:"HostId,omitempty" name:"HostId"` // cdh实例类型 - HostType *string `json:"HostType" name:"HostType"` + HostType *string `json:"HostType,omitempty" name:"HostType"` // cdh实例名称 - HostName *string `json:"HostName" name:"HostName"` + HostName *string `json:"HostName,omitempty" name:"HostName"` // cdh实例付费模式 - HostChargeType *string `json:"HostChargeType" name:"HostChargeType"` + HostChargeType *string `json:"HostChargeType,omitempty" name:"HostChargeType"` // cdh实例自动续费标记 - RenewFlag *string `json:"RenewFlag" name:"RenewFlag"` + RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"` // cdh实例创建时间 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` // cdh实例过期时间 - ExpiredTime *string `json:"ExpiredTime" name:"ExpiredTime"` + ExpiredTime *string `json:"ExpiredTime,omitempty" name:"ExpiredTime"` // cdh实例上已创建云子机的实例id列表 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // cdh实例状态 - HostState *string `json:"HostState" name:"HostState"` + HostState *string `json:"HostState,omitempty" name:"HostState"` // cdh实例ip - HostIp *string `json:"HostIp" name:"HostIp"` + HostIp *string `json:"HostIp,omitempty" name:"HostIp"` // cdh实例资源信息 - HostResource *HostResource `json:"HostResource" name:"HostResource"` + HostResource *HostResource `json:"HostResource,omitempty" name:"HostResource"` + + // 专用宿主机所属的围笼ID。该字段仅对金融专区围笼内的专用宿主机有效。 + // 注意:此字段可能返回 null,表示取不到有效值。 + CageId *string `json:"CageId,omitempty" name:"CageId"` } type HostResource struct { // cdh实例总cpu核数 - CpuTotal *uint64 `json:"CpuTotal" name:"CpuTotal"` + CpuTotal *uint64 `json:"CpuTotal,omitempty" name:"CpuTotal"` // cdh实例可用cpu核数 - CpuAvailable *uint64 `json:"CpuAvailable" name:"CpuAvailable"` + CpuAvailable *uint64 `json:"CpuAvailable,omitempty" name:"CpuAvailable"` // cdh实例总内存大小(单位为:GiB) - MemTotal *float64 `json:"MemTotal" name:"MemTotal"` + MemTotal *float64 `json:"MemTotal,omitempty" name:"MemTotal"` // cdh实例可用内存大小(单位为:GiB) - MemAvailable *float64 `json:"MemAvailable" name:"MemAvailable"` + MemAvailable *float64 `json:"MemAvailable,omitempty" name:"MemAvailable"` // cdh实例总磁盘大小(单位为:GiB) - DiskTotal *uint64 `json:"DiskTotal" name:"DiskTotal"` + DiskTotal *uint64 `json:"DiskTotal,omitempty" name:"DiskTotal"` // cdh实例可用磁盘大小(单位为:GiB) - DiskAvailable *uint64 `json:"DiskAvailable" name:"DiskAvailable"` + DiskAvailable *uint64 `json:"DiskAvailable,omitempty" name:"DiskAvailable"` } type Image struct { // 镜像ID - ImageId *string `json:"ImageId" name:"ImageId"` + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` // 镜像操作系统 - OsName *string `json:"OsName" name:"OsName"` + OsName *string `json:"OsName,omitempty" name:"OsName"` // 镜像类型 - ImageType *string `json:"ImageType" name:"ImageType"` + ImageType *string `json:"ImageType,omitempty" name:"ImageType"` // 镜像创建时间 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` // 镜像名称 - ImageName *string `json:"ImageName" name:"ImageName"` + ImageName *string `json:"ImageName,omitempty" name:"ImageName"` // 镜像描述 - ImageDescription *string `json:"ImageDescription" name:"ImageDescription"` + ImageDescription *string `json:"ImageDescription,omitempty" name:"ImageDescription"` // 镜像大小 - ImageSize *int64 `json:"ImageSize" name:"ImageSize"` + ImageSize *int64 `json:"ImageSize,omitempty" name:"ImageSize"` // 镜像架构 - Architecture *string `json:"Architecture" name:"Architecture"` + Architecture *string `json:"Architecture,omitempty" name:"Architecture"` // 镜像状态 - ImageState *string `json:"ImageState" name:"ImageState"` + ImageState *string `json:"ImageState,omitempty" name:"ImageState"` // 镜像来源平台 - Platform *string `json:"Platform" name:"Platform"` + Platform *string `json:"Platform,omitempty" name:"Platform"` // 镜像创建者 - ImageCreator *string `json:"ImageCreator" name:"ImageCreator"` + ImageCreator *string `json:"ImageCreator,omitempty" name:"ImageCreator"` // 镜像来源 - ImageSource *string `json:"ImageSource" name:"ImageSource"` + ImageSource *string `json:"ImageSource,omitempty" name:"ImageSource"` // 同步百分比 - SyncPercent *int64 `json:"SyncPercent" name:"SyncPercent"` + // 注意:此字段可能返回 null,表示取不到有效值。 + SyncPercent *int64 `json:"SyncPercent,omitempty" name:"SyncPercent"` // 镜像是否支持cloud-init - IsSupportCloudinit *bool `json:"IsSupportCloudinit" name:"IsSupportCloudinit"` + // 注意:此字段可能返回 null,表示取不到有效值。 + IsSupportCloudinit *bool `json:"IsSupportCloudinit,omitempty" name:"IsSupportCloudinit"` + + // 镜像关联的快照信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + SnapshotSet []*Snapshot `json:"SnapshotSet,omitempty" name:"SnapshotSet" list` } type ImageOsList struct { // 支持的windows操作系统。 - Windows []*string `json:"Windows" name:"Windows" list` + // 注意:此字段可能返回 null,表示取不到有效值。 + Windows []*string `json:"Windows,omitempty" name:"Windows" list` // 支持的linux操作系统 - Linux []*string `json:"Linux" name:"Linux" list` + // 注意:此字段可能返回 null,表示取不到有效值。 + Linux []*string `json:"Linux,omitempty" name:"Linux" list` } type ImportImageRequest struct { *tchttp.BaseRequest // 导入镜像的操作系统架构,`x86_64` 或 `i386` - Architecture *string `json:"Architecture" name:"Architecture"` + Architecture *string `json:"Architecture,omitempty" name:"Architecture"` // 导入镜像的操作系统类型,通过`DescribeImportImageOs`获取 - OsType *string `json:"OsType" name:"OsType"` + OsType *string `json:"OsType,omitempty" name:"OsType"` // 导入镜像的操作系统版本,通过`DescribeImportImageOs`获取 - OsVersion *string `json:"OsVersion" name:"OsVersion"` + OsVersion *string `json:"OsVersion,omitempty" name:"OsVersion"` // 导入镜像存放的cos地址 - ImageUrl *string `json:"ImageUrl" name:"ImageUrl"` + ImageUrl *string `json:"ImageUrl,omitempty" name:"ImageUrl"` // 镜像名称 - ImageName *string `json:"ImageName" name:"ImageName"` + ImageName *string `json:"ImageName,omitempty" name:"ImageName"` // 镜像描述 - ImageDescription *string `json:"ImageDescription" name:"ImageDescription"` + ImageDescription *string `json:"ImageDescription,omitempty" name:"ImageDescription"` // 只检查参数,不执行任务 - DryRun *bool `json:"DryRun" name:"DryRun"` + DryRun *bool `json:"DryRun,omitempty" name:"DryRun"` // 是否强制导入,参考[强制导入镜像](https://cloud.tencent.com/document/product/213/12849) - Force *bool `json:"Force" name:"Force"` + Force *bool `json:"Force,omitempty" name:"Force"` } func (r *ImportImageRequest) ToJsonString() string { @@ -1508,7 +1574,7 @@ type ImportImageResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1525,15 +1591,15 @@ type ImportKeyPairRequest struct { *tchttp.BaseRequest // 密钥对名称,可由数字,字母和下划线组成,长度不超过25个字符。 - KeyName *string `json:"KeyName" name:"KeyName"` + KeyName *string `json:"KeyName,omitempty" name:"KeyName"` // 密钥对创建后所属的[项目](/document/product/378/10863)ID。

    可以通过以下方式获取项目ID:
  • 通过[项目列表](https://console.cloud.tencent.com/project)查询项目ID。
  • 通过调用接口 [DescribeProject](https://cloud.tencent.com/document/api/378/4400),取返回信息中的 `projectId ` 获取项目ID。 // // 如果是默认项目,直接填0就可以。 - ProjectId *int64 `json:"ProjectId" name:"ProjectId"` + ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"` // 密钥对的公钥内容,`OpenSSH RSA` 格式。 - PublicKey *string `json:"PublicKey" name:"PublicKey"` + PublicKey *string `json:"PublicKey,omitempty" name:"PublicKey"` } func (r *ImportKeyPairRequest) ToJsonString() string { @@ -1550,10 +1616,10 @@ type ImportKeyPairResponse struct { Response *struct { // 密钥对ID。 - KeyId *string `json:"KeyId" name:"KeyId"` + KeyId *string `json:"KeyId,omitempty" name:"KeyId"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1570,13 +1636,13 @@ type InquiryPriceModifyInstancesChargeTypeRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 实例[计费类型](https://cloud.tencent.com/document/product/213/2180)。
  • PREPAID:预付费,即包年包月。 - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的续费时长、是否设置自动续费等属性。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` } func (r *InquiryPriceModifyInstancesChargeTypeRequest) ToJsonString() string { @@ -1593,10 +1659,10 @@ type InquiryPriceModifyInstancesChargeTypeResponse struct { Response *struct { // 该参数表示对应配置实例转换计费模式的价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1613,16 +1679,16 @@ type InquiryPriceRenewInstancesRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的续费时长、是否设置自动续费等属性。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` // 试运行。 - DryRun *bool `json:"DryRun" name:"DryRun"` + DryRun *bool `json:"DryRun,omitempty" name:"DryRun"` // 是否续费弹性数据盘。取值范围:
  • TRUE:表示续费包年包月实例同时续费其挂载的弹性数据盘
  • FALSE:表示续费包年包月实例同时不再续费其挂载的弹性数据盘

    默认取值:TRUE。 - RenewPortableDataDisk *bool `json:"RenewPortableDataDisk" name:"RenewPortableDataDisk"` + RenewPortableDataDisk *bool `json:"RenewPortableDataDisk,omitempty" name:"RenewPortableDataDisk"` } func (r *InquiryPriceRenewInstancesRequest) ToJsonString() string { @@ -1639,10 +1705,10 @@ type InquiryPriceRenewInstancesResponse struct { Response *struct { // 该参数表示对应配置实例的价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1659,19 +1725,19 @@ type InquiryPriceResetInstanceRequest struct { *tchttp.BaseRequest // 实例ID。可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) API返回值中的`InstanceId`获取。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 指定有效的[镜像](/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:
  • 公共镜像
  • 自定义镜像
  • 共享镜像
  • 服务市场镜像

  • 可通过以下方式获取可用的镜像ID:
  • `公共镜像`、`自定义镜像`、`共享镜像`的镜像ID可通过登录[控制台](https://console.cloud.tencent.com/cvm/image?rid=1&imageType=PUBLIC_IMAGE)查询;`服务镜像市场`的镜像ID可通过[云市场](https://market.cloud.tencent.com/list)查询。
  • 通过调用接口 [DescribeImages](https://cloud.tencent.com/document/api/213/15715) ,取返回信息中的`ImageId`字段。
  • - ImageId *string `json:"ImageId" name:"ImageId"` + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` // 实例系统盘配置信息。系统盘为云盘的实例可以通过该参数指定重装后的系统盘大小来实现对系统盘的扩容操作,若不指定则默认系统盘大小保持不变。系统盘大小只支持扩容不支持缩容;重装只支持修改系统盘的大小,不能修改系统盘的类型。 - SystemDisk *SystemDisk `json:"SystemDisk" name:"SystemDisk"` + SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"` // 实例登录设置。通过该参数可以设置实例的登录方式密码、密钥或保持镜像的原始登录设置。默认情况下会随机生成密码,并以站内信方式知会到用户。 - LoginSettings *LoginSettings `json:"LoginSettings" name:"LoginSettings"` + LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"` // 增强服务。通过该参数可以指定是否开启云安全、云监控等服务。若不指定该参数,则默认开启云监控、云安全服务。 - EnhancedService *EnhancedService `json:"EnhancedService" name:"EnhancedService"` + EnhancedService *EnhancedService `json:"EnhancedService,omitempty" name:"EnhancedService"` } func (r *InquiryPriceResetInstanceRequest) ToJsonString() string { @@ -1688,10 +1754,10 @@ type InquiryPriceResetInstanceResponse struct { Response *struct { // 该参数表示重装成对应配置实例的价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1708,16 +1774,16 @@ type InquiryPriceResetInstancesInternetMaxBandwidthRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。当调整 `BANDWIDTH_PREPAID` 和 `BANDWIDTH_POSTPAID_BY_HOUR` 计费方式的带宽时,只支持一个实例。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 公网出带宽配置。不同机型带宽上限范围不一致,具体限制详见带宽限制对账表。暂时只支持`InternetMaxBandwidthOut`参数。 - InternetAccessible *InternetAccessible `json:"InternetAccessible" name:"InternetAccessible"` + InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"` // 带宽生效的起始时间。格式:`YYYY-MM-DD`,例如:`2016-10-30`。起始时间不能早于当前时间。如果起始时间是今天则新设置的带宽立即生效。该参数只对包年包月带宽有效,其他模式带宽不支持该参数,否则接口会以相应错误码返回。 - StartTime *string `json:"StartTime" name:"StartTime"` + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` // 带宽生效的终止时间。格式:`YYYY-MM-DD`,例如:`2016-10-30`。新设置的带宽的有效期包含终止时间此日期。终止时间不能晚于包年包月实例的到期时间。实例的到期时间可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`ExpiredTime`获取。该参数只对包年包月带宽有效,其他模式带宽不支持该参数,否则接口会以相应错误码返回。 - EndTime *string `json:"EndTime" name:"EndTime"` + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` } func (r *InquiryPriceResetInstancesInternetMaxBandwidthRequest) ToJsonString() string { @@ -1734,10 +1800,10 @@ type InquiryPriceResetInstancesInternetMaxBandwidthResponse struct { Response *struct { // 该参数表示带宽调整为对应大小之后的价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1754,13 +1820,10 @@ type InquiryPriceResetInstancesTypeRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为1。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 实例机型。不同实例机型指定了不同的资源规格,具体取值可参见附表实例资源规格对照表,也可以调用查询实例资源规格列表接口获得最新的规格表。 - InstanceType *string `json:"InstanceType" name:"InstanceType"` - - // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再重置用户密码。取值范围:
  • TRUE:表示在正常关机失败后进行强制关机
  • FALSE:表示在正常关机失败后不进行强制关机

    默认取值:FALSE。

    强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。 - ForceStop *bool `json:"ForceStop" name:"ForceStop"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` } func (r *InquiryPriceResetInstancesTypeRequest) ToJsonString() string { @@ -1777,10 +1840,10 @@ type InquiryPriceResetInstancesTypeResponse struct { Response *struct { // 该参数表示调整成对应机型实例的价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1797,13 +1860,13 @@ type InquiryPriceResizeInstanceDisksRequest struct { *tchttp.BaseRequest // 待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` - // 待扩容的数据盘配置信息。只支持扩容随实例购买的数据盘,且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。数据盘容量单位:GB。最小扩容步长:10G。关于数据盘类型的选择请参考硬盘产品简介。可选数据盘类型受到实例类型`InstanceType`限制。另外允许扩容的最大容量也因数据盘类型的不同而有所差异。 - DataDisks []*DataDisk `json:"DataDisks" name:"DataDisks" list` + // 待扩容的数据盘配置信息。只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性),且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。数据盘容量单位:GB。最小扩容步长:10G。关于数据盘类型的选择请参考硬盘产品简介。可选数据盘类型受到实例类型`InstanceType`限制。另外允许扩容的最大容量也因数据盘类型的不同而有所差异。 + DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list` // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再重置用户密码。取值范围:
  • TRUE:表示在正常关机失败后进行强制关机
  • FALSE:表示在正常关机失败后不进行强制关机

    默认取值:FALSE。

    强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。 - ForceStop *bool `json:"ForceStop" name:"ForceStop"` + ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"` } func (r *InquiryPriceResizeInstanceDisksRequest) ToJsonString() string { @@ -1820,10 +1883,10 @@ type InquiryPriceResizeInstanceDisksResponse struct { Response *struct { // 该参数表示磁盘扩容成对应配置的价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1840,58 +1903,58 @@ type InquiryPriceRunInstancesRequest struct { *tchttp.BaseRequest // 实例所在的位置。通过该参数可以指定实例所属可用区,所属项目等属性。 - Placement *Placement `json:"Placement" name:"Placement"` + Placement *Placement `json:"Placement,omitempty" name:"Placement"` // 指定有效的[镜像](https://cloud.tencent.com/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:
  • 公共镜像
  • 自定义镜像
  • 共享镜像
  • 服务市场镜像

  • 可通过以下方式获取可用的镜像ID:
  • `公共镜像`、`自定义镜像`、`共享镜像`的镜像ID可通过登录[控制台](https://console.cloud.tencent.com/cvm/image?rid=1&imageType=PUBLIC_IMAGE)查询;`服务镜像市场`的镜像ID可通过[云市场](https://market.cloud.tencent.com/list)查询。
  • 通过调用接口 [DescribeImages](https://cloud.tencent.com/document/api/213/15715) ,取返回信息中的`ImageId`字段。
  • - ImageId *string `json:"ImageId" name:"ImageId"` + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` // 实例[计费类型](https://cloud.tencent.com/document/product/213/2180)。
  • PREPAID:预付费,即包年包月
  • POSTPAID_BY_HOUR:按小时后付费
    默认值:POSTPAID_BY_HOUR。 - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` // 实例机型。不同实例机型指定了不同的资源规格,具体取值可通过调用接口[DescribeInstanceTypeConfigs](https://cloud.tencent.com/document/api/213/15749)来获得最新的规格表或参见[CVM实例配置](https://cloud.tencent.com/document/product/213/2177)描述。若不指定该参数,则默认机型为S1.SMALL1。 - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` // 实例系统盘配置信息。若不指定该参数,则按照系统默认值进行分配。 - SystemDisk *SystemDisk `json:"SystemDisk" name:"SystemDisk"` + SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"` // 实例数据盘配置信息。若不指定该参数,则默认不购买数据盘。支持购买的时候指定11块数据盘,其中最多包含1块LOCAL_BASIC数据盘或者LOCAL_SSD数据盘,最多包含10块CLOUD_BASIC数据盘、CLOUD_PREMIUM数据盘或者CLOUD_SSD数据盘。 - DataDisks []*DataDisk `json:"DataDisks" name:"DataDisks" list` + DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list` // 私有网络相关信息配置。通过该参数可以指定私有网络的ID,子网ID等信息。若不指定该参数,则默认使用基础网络。若在此参数中指定了私有网络ip,那么InstanceCount参数只能为1。 - VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud" name:"VirtualPrivateCloud"` + VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud,omitempty" name:"VirtualPrivateCloud"` // 公网带宽相关信息设置。若不指定该参数,则默认公网带宽为0Mbps。 - InternetAccessible *InternetAccessible `json:"InternetAccessible" name:"InternetAccessible"` + InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"` // 购买实例数量。取值范围:[1,100]。默认取值:1。指定购买实例的数量不能超过用户所能购买的剩余配额数量,具体配额相关限制详见[CVM实例购买限制](https://cloud.tencent.com/document/product/213/2664)。 - InstanceCount *int64 `json:"InstanceCount" name:"InstanceCount"` + InstanceCount *int64 `json:"InstanceCount,omitempty" name:"InstanceCount"` // 实例显示名称。
  • 不指定实例显示名称则默认显示‘未命名’。
  • 购买多台实例,如果指定模式串`{R:x}`,表示生成数字`[x, x+n-1]`,其中`n`表示购买实例的数量,例如`server_{R:3}`,购买1台时,实例显示名称为`server_3`;购买2台时,实例显示名称分别为`server_3`,`server_4`。支持指定多个模式串`{R:x}`。
  • 购买多台实例,如果不指定模式串,则在实例显示名称添加后缀`1、2...n`,其中`n`表示购买实例的数量,例如`server_`,购买2台时,实例显示名称分别为`server_1`,`server_2`。 - InstanceName *string `json:"InstanceName" name:"InstanceName"` + InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"` // 实例登录设置。通过该参数可以设置实例的登录方式密码、密钥或保持镜像的原始登录设置。默认情况下会随机生成密码,并以站内信方式知会到用户。 - LoginSettings *LoginSettings `json:"LoginSettings" name:"LoginSettings"` + LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"` // 实例所属安全组。该参数可以通过调用 [DescribeSecurityGroups](https://cloud.tencent.com/document/api/215/15808) 的返回值中的sgId字段来获取。若不指定该参数,则默认不绑定安全组。 - SecurityGroupIds []*string `json:"SecurityGroupIds" name:"SecurityGroupIds" list` + SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list` // 增强服务。通过该参数可以指定是否开启云安全、云监控等服务。若不指定该参数,则默认开启云监控、云安全服务。 - EnhancedService *EnhancedService `json:"EnhancedService" name:"EnhancedService"` + EnhancedService *EnhancedService `json:"EnhancedService,omitempty" name:"EnhancedService"` // 用于保证请求幂等性的字符串。该字符串由客户生成,需保证不同请求之间唯一,最大值不超过64个ASCII字符。若不指定该参数,则无法保证请求的幂等性。
    更多详细信息请参阅:如何保证幂等性。 - ClientToken *string `json:"ClientToken" name:"ClientToken"` + ClientToken *string `json:"ClientToken,omitempty" name:"ClientToken"` // 云服务器的主机名。
  • 点号(.)和短横线(-)不能作为 HostName 的首尾字符,不能连续使用。
  • Windows 实例:名字符长度为[2, 15],允许字母(不限制大小写)、数字和短横线(-)组成,不支持点号(.),不能全是数字。
  • 其他类型(Linux 等)实例:字符长度为[2, 30],允许支持多个点号,点之间为一段,每段允许字母(不限制大小写)、数字和短横线(-)组成。 - HostName *string `json:"HostName" name:"HostName"` + HostName *string `json:"HostName,omitempty" name:"HostName"` // 标签描述列表。通过指定该参数可以同时绑定标签到相应的资源实例,当前仅支持绑定标签到云主机实例。 - TagSpecification []*TagSpecification `json:"TagSpecification" name:"TagSpecification" list` + TagSpecification []*TagSpecification `json:"TagSpecification,omitempty" name:"TagSpecification" list` // 实例的市场相关选项,如竞价实例相关参数 - InstanceMarketOptions *InstanceMarketOptionsRequest `json:"InstanceMarketOptions" name:"InstanceMarketOptions"` + InstanceMarketOptions *InstanceMarketOptionsRequest `json:"InstanceMarketOptions,omitempty" name:"InstanceMarketOptions"` } func (r *InquiryPriceRunInstancesRequest) ToJsonString() string { @@ -1908,10 +1971,10 @@ type InquiryPriceRunInstancesResponse struct { Response *struct { // 该参数表示对应配置实例的价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1927,105 +1990,106 @@ func (r *InquiryPriceRunInstancesResponse) FromJsonString(s string) error { type Instance struct { // 实例所在的位置。 - Placement *Placement `json:"Placement" name:"Placement"` + Placement *Placement `json:"Placement,omitempty" name:"Placement"` // 实例`ID`。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 实例机型。 - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` // 实例的CPU核数,单位:核。 - CPU *int64 `json:"CPU" name:"CPU"` + CPU *int64 `json:"CPU,omitempty" name:"CPU"` // 实例内存容量,单位:`GB`。 - Memory *int64 `json:"Memory" name:"Memory"` + Memory *int64 `json:"Memory,omitempty" name:"Memory"` // 实例业务状态。取值范围:
  • NORMAL:表示正常状态的实例
  • EXPIRED:表示过期的实例
  • PROTECTIVELY_ISOLATED:表示被安全隔离的实例。 - RestrictState *string `json:"RestrictState" name:"RestrictState"` + RestrictState *string `json:"RestrictState,omitempty" name:"RestrictState"` // 实例名称。 - InstanceName *string `json:"InstanceName" name:"InstanceName"` + InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"` // 实例计费模式。取值范围:
  • `PREPAID`:表示预付费,即包年包月
  • `POSTPAID_BY_HOUR`:表示后付费,即按量计费
  • `CDHPAID`:`CDH`付费,即只对`CDH`计费,不对`CDH`上的实例计费。 - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` // 实例系统盘信息。 - SystemDisk *SystemDisk `json:"SystemDisk" name:"SystemDisk"` + SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"` // 实例数据盘信息。只包含随实例购买的数据盘。 - DataDisks []*DataDisk `json:"DataDisks" name:"DataDisks" list` + DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list` // 实例主网卡的内网`IP`列表。 - PrivateIpAddresses []*string `json:"PrivateIpAddresses" name:"PrivateIpAddresses" list` + PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list` // 实例主网卡的公网`IP`列表。 - PublicIpAddresses []*string `json:"PublicIpAddresses" name:"PublicIpAddresses" list` + // 注意:此字段可能返回 null,表示取不到有效值。 + PublicIpAddresses []*string `json:"PublicIpAddresses,omitempty" name:"PublicIpAddresses" list` // 实例带宽信息。 - InternetAccessible *InternetAccessible `json:"InternetAccessible" name:"InternetAccessible"` + InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"` // 实例所属虚拟私有网络信息。 - VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud" name:"VirtualPrivateCloud"` + VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud,omitempty" name:"VirtualPrivateCloud"` // 生产实例所使用的镜像`ID`。 - ImageId *string `json:"ImageId" name:"ImageId"` + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` // 自动续费标识。取值范围:
  • `NOTIFY_AND_MANUAL_RENEW`:表示通知即将过期,但不自动续费
  • `NOTIFY_AND_AUTO_RENEW`:表示通知即将过期,而且自动续费
  • `DISABLE_NOTIFY_AND_MANUAL_RENEW`:表示不通知即将过期,也不自动续费。 - RenewFlag *string `json:"RenewFlag" name:"RenewFlag"` + RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"` // 创建时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` // 到期时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。 - ExpiredTime *string `json:"ExpiredTime" name:"ExpiredTime"` + ExpiredTime *string `json:"ExpiredTime,omitempty" name:"ExpiredTime"` // 操作系统名称。 - OsName *string `json:"OsName" name:"OsName"` + OsName *string `json:"OsName,omitempty" name:"OsName"` // 实例所属安全组。该参数可以通过调用 [DescribeSecurityGroups](https://cloud.tencent.com/document/api/215/15808) 的返回值中的sgId字段来获取。 - SecurityGroupIds []*string `json:"SecurityGroupIds" name:"SecurityGroupIds" list` + SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list` // 实例登录设置。目前只返回实例所关联的密钥。 - LoginSettings *LoginSettings `json:"LoginSettings" name:"LoginSettings"` + LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"` // 实例状态。取值范围:
  • PENDING:表示创建中
  • LAUNCH_FAILED:表示创建失败
  • RUNNING:表示运行中
  • STOPPED:表示关机
  • STARTING:表示开机中
  • STOPPING:表示关机中
  • REBOOTING:表示重启中
  • SHUTDOWN:表示停止待销毁
  • TERMINATING:表示销毁中。
  • - InstanceState *string `json:"InstanceState" name:"InstanceState"` + InstanceState *string `json:"InstanceState,omitempty" name:"InstanceState"` // 实例关联的标签列表。 - Tags []*Tag `json:"Tags" name:"Tags" list` + Tags []*Tag `json:"Tags,omitempty" name:"Tags" list` // 实例的关机计费模式。 // 取值范围:
  • KEEP_CHARGING:关机继续收费
  • STOP_CHARGING:关机停止收费
  • NOT_APPLICABLE:实例处于非关机状态或者不适用关机停止计费的条件
    - StopChargingMode *string `json:"StopChargingMode" name:"StopChargingMode"` + StopChargingMode *string `json:"StopChargingMode,omitempty" name:"StopChargingMode"` } type InstanceChargePrepaid struct { // 购买实例的时长,单位:月。取值范围:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36。 - Period *int64 `json:"Period" name:"Period"` + Period *int64 `json:"Period,omitempty" name:"Period"` // 自动续费标识。取值范围:
  • NOTIFY_AND_AUTO_RENEW:通知过期且自动续费
  • NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费
  • DISABLE_NOTIFY_AND_MANUAL_RENEW:不通知过期不自动续费

    默认取值:NOTIFY_AND_MANUAL_RENEW。若该参数指定为NOTIFY_AND_AUTO_RENEW,在账户余额充足的情况下,实例到期后将按月自动续费。 - RenewFlag *string `json:"RenewFlag" name:"RenewFlag"` + RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"` } type InstanceFamilyConfig struct { // 机型族名称的中文全称。 - InstanceFamilyName *string `json:"InstanceFamilyName" name:"InstanceFamilyName"` + InstanceFamilyName *string `json:"InstanceFamilyName,omitempty" name:"InstanceFamilyName"` // 机型族名称的英文简称。 - InstanceFamily *string `json:"InstanceFamily" name:"InstanceFamily"` + InstanceFamily *string `json:"InstanceFamily,omitempty" name:"InstanceFamily"` } type InstanceMarketOptionsRequest struct { *tchttp.BaseRequest - // 市场选项类型,当前只支持取值:spot - MarketType *string `json:"MarketType" name:"MarketType"` - // 竞价相关选项 - SpotOptions *SpotMarketOptions `json:"SpotOptions" name:"SpotOptions"` + SpotOptions *SpotMarketOptions `json:"SpotOptions,omitempty" name:"SpotOptions"` + + // 市场选项类型,当前只支持取值:spot + MarketType *string `json:"MarketType,omitempty" name:"MarketType"` } func (r *InstanceMarketOptionsRequest) ToJsonString() string { @@ -2040,182 +2104,193 @@ func (r *InstanceMarketOptionsRequest) FromJsonString(s string) error { type InstanceStatus struct { // 实例`ID`。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // [实例状态](/document/api/213/9452#INSTANCE_STATE)。 - InstanceState *string `json:"InstanceState" name:"InstanceState"` + InstanceState *string `json:"InstanceState,omitempty" name:"InstanceState"` } type InstanceTypeConfig struct { // 可用区。 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` // 实例机型。 - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` // 实例机型系列。 - InstanceFamily *string `json:"InstanceFamily" name:"InstanceFamily"` + InstanceFamily *string `json:"InstanceFamily,omitempty" name:"InstanceFamily"` // GPU核数,单位:核。 - GPU *int64 `json:"GPU" name:"GPU"` + GPU *int64 `json:"GPU,omitempty" name:"GPU"` // CPU核数,单位:核。 - CPU *int64 `json:"CPU" name:"CPU"` + CPU *int64 `json:"CPU,omitempty" name:"CPU"` // 内存容量,单位:`GB`。 - Memory *int64 `json:"Memory" name:"Memory"` + Memory *int64 `json:"Memory,omitempty" name:"Memory"` } type InstanceTypeQuotaItem struct { // 可用区。 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` // 实例机型。 - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` // 实例计费模式。取值范围:
  • PREPAID:表示预付费,即包年包月
  • POSTPAID_BY_HOUR:表示后付费,即按量计费
  • CDHPAID:表示[CDH](https://cloud.tencent.com/document/product/416)付费,即只对CDH计费,不对CDH上的实例计费。 - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` // 网卡类型,例如:25代表25G网卡 - NetworkCard *int64 `json:"NetworkCard" name:"NetworkCard"` + NetworkCard *int64 `json:"NetworkCard,omitempty" name:"NetworkCard"` // 扩展属性。 - Externals *Externals `json:"Externals" name:"Externals"` + // 注意:此字段可能返回 null,表示取不到有效值。 + Externals *Externals `json:"Externals,omitempty" name:"Externals"` // 实例的CPU核数,单位:核。 - Cpu *int64 `json:"Cpu" name:"Cpu"` + Cpu *int64 `json:"Cpu,omitempty" name:"Cpu"` // 实例内存容量,单位:`GB`。 - Memory *int64 `json:"Memory" name:"Memory"` + Memory *int64 `json:"Memory,omitempty" name:"Memory"` // 实例机型系列。 - InstanceFamily *string `json:"InstanceFamily" name:"InstanceFamily"` + InstanceFamily *string `json:"InstanceFamily,omitempty" name:"InstanceFamily"` // 机型名称。 - TypeName *string `json:"TypeName" name:"TypeName"` + TypeName *string `json:"TypeName,omitempty" name:"TypeName"` - // 本地磁盘规格列表。 - LocalDiskTypeList []*LocalDiskType `json:"LocalDiskTypeList" name:"LocalDiskTypeList" list` + // 本地磁盘规格列表。当该参数返回为空值时,表示当前情况下无法创建本地盘。 + LocalDiskTypeList []*LocalDiskType `json:"LocalDiskTypeList,omitempty" name:"LocalDiskTypeList" list` // 实例是否售卖。取值范围:
  • SELL:表示实例可购买
  • SOLD_OUT:表示实例已售罄。 - Status *string `json:"Status" name:"Status"` + Status *string `json:"Status,omitempty" name:"Status"` // 实例的售卖价格。 - Price *ItemPrice `json:"Price" name:"Price"` + Price *ItemPrice `json:"Price,omitempty" name:"Price"` } type InternetAccessible struct { // 网络计费类型。取值范围:
  • BANDWIDTH_PREPAID:预付费按带宽结算
  • TRAFFIC_POSTPAID_BY_HOUR:流量按小时后付费
  • BANDWIDTH_POSTPAID_BY_HOUR:带宽按小时后付费
  • BANDWIDTH_PACKAGE:带宽包用户
    默认取值:非带宽包用户默认与子机付费类型保持一致。 - InternetChargeType *string `json:"InternetChargeType" name:"InternetChargeType"` + InternetChargeType *string `json:"InternetChargeType,omitempty" name:"InternetChargeType"` // 公网出带宽上限,单位:Mbps。默认值:0Mbps。不同机型带宽上限范围不一致,具体限制详见[购买网络带宽](/document/product/213/509)。 - InternetMaxBandwidthOut *int64 `json:"InternetMaxBandwidthOut" name:"InternetMaxBandwidthOut"` + InternetMaxBandwidthOut *int64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"` // 是否分配公网IP。取值范围:
  • TRUE:表示分配公网IP
  • FALSE:表示不分配公网IP

    当公网带宽大于0Mbps时,可自由选择开通与否,默认开通公网IP;当公网带宽为0,则不允许分配公网IP。 - PublicIpAssigned *bool `json:"PublicIpAssigned" name:"PublicIpAssigned"` + PublicIpAssigned *bool `json:"PublicIpAssigned,omitempty" name:"PublicIpAssigned"` + + // 带宽包ID。可通过[`DescribeBandwidthPackages`](https://cloud.tencent.com/document/api/215/19209)接口返回值中的`BandwidthPackageId`获取。 + BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"` } type InternetBandwidthConfig struct { // 开始时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。 - StartTime *string `json:"StartTime" name:"StartTime"` + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` // 结束时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。 - EndTime *string `json:"EndTime" name:"EndTime"` + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` // 实例带宽信息。 - InternetAccessible *InternetAccessible `json:"InternetAccessible" name:"InternetAccessible"` + InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"` } type InternetChargeTypeConfig struct { // 网络计费模式。 - InternetChargeType *string `json:"InternetChargeType" name:"InternetChargeType"` + InternetChargeType *string `json:"InternetChargeType,omitempty" name:"InternetChargeType"` // 网络计费模式描述信息。 - Description *string `json:"Description" name:"Description"` + Description *string `json:"Description,omitempty" name:"Description"` } type ItemPrice struct { // 后续单价,单位:元。 - UnitPrice *float64 `json:"UnitPrice" name:"UnitPrice"` + // 注意:此字段可能返回 null,表示取不到有效值。 + UnitPrice *float64 `json:"UnitPrice,omitempty" name:"UnitPrice"` // 后续计价单元,可取值范围:
  • HOUR:表示计价单元是按每小时来计算。当前涉及该计价单元的场景有:实例按小时后付费(POSTPAID_BY_HOUR)、带宽按小时后付费(BANDWIDTH_POSTPAID_BY_HOUR):
  • GB:表示计价单元是按每GB来计算。当前涉及该计价单元的场景有:流量按小时后付费(TRAFFIC_POSTPAID_BY_HOUR)。 - ChargeUnit *string `json:"ChargeUnit" name:"ChargeUnit"` + // 注意:此字段可能返回 null,表示取不到有效值。 + ChargeUnit *string `json:"ChargeUnit,omitempty" name:"ChargeUnit"` // 预支费用的原价,单位:元。 - OriginalPrice *float64 `json:"OriginalPrice" name:"OriginalPrice"` + // 注意:此字段可能返回 null,表示取不到有效值。 + OriginalPrice *float64 `json:"OriginalPrice,omitempty" name:"OriginalPrice"` // 预支费用的折扣价,单位:元。 - DiscountPrice *float64 `json:"DiscountPrice" name:"DiscountPrice"` + // 注意:此字段可能返回 null,表示取不到有效值。 + DiscountPrice *float64 `json:"DiscountPrice,omitempty" name:"DiscountPrice"` } type KeyPair struct { // 密钥对的`ID`,是密钥对的唯一标识。 - KeyId *string `json:"KeyId" name:"KeyId"` + KeyId *string `json:"KeyId,omitempty" name:"KeyId"` // 密钥对名称。 - KeyName *string `json:"KeyName" name:"KeyName"` + KeyName *string `json:"KeyName,omitempty" name:"KeyName"` // 密钥对所属的项目`ID`。 - ProjectId *int64 `json:"ProjectId" name:"ProjectId"` + ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"` // 密钥对描述信息。 - Description *string `json:"Description" name:"Description"` + Description *string `json:"Description,omitempty" name:"Description"` // 密钥对的纯文本公钥。 - PublicKey *string `json:"PublicKey" name:"PublicKey"` + PublicKey *string `json:"PublicKey,omitempty" name:"PublicKey"` // 密钥对的纯文本私钥。腾讯云不会保管私钥,请用户自行妥善保存。 - PrivateKey *string `json:"PrivateKey" name:"PrivateKey"` + PrivateKey *string `json:"PrivateKey,omitempty" name:"PrivateKey"` // 密钥关联的实例`ID`列表。 - AssociatedInstanceIds []*string `json:"AssociatedInstanceIds" name:"AssociatedInstanceIds" list` + AssociatedInstanceIds []*string `json:"AssociatedInstanceIds,omitempty" name:"AssociatedInstanceIds" list` // 创建时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type LocalDiskType struct { // 本地磁盘类型。 - Type *string `json:"Type" name:"Type"` + Type *string `json:"Type,omitempty" name:"Type"` // 本地磁盘属性。 - PartitionType *string `json:"PartitionType" name:"PartitionType"` + PartitionType *string `json:"PartitionType,omitempty" name:"PartitionType"` // 本地磁盘最小值。 - MinSize *int64 `json:"MinSize" name:"MinSize"` + MinSize *int64 `json:"MinSize,omitempty" name:"MinSize"` // 本地磁盘最大值。 - MaxSize *int64 `json:"MaxSize" name:"MaxSize"` + MaxSize *int64 `json:"MaxSize,omitempty" name:"MaxSize"` } type LoginSettings struct { // 实例登录密码。不同操作系统类型密码复杂度限制不一样,具体如下:
  • Linux实例密码必须8到16位,至少包括两项[a-z,A-Z]、[0-9] 和 [( ) ` ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ' , . ? / ]中的特殊符号。
  • Windows实例密码必须12到16位,至少包括三项[a-z],[A-Z],[0-9] 和 [( ) ` ~ ! @ # $ % ^ & * - + = { } [ ] : ; ' , . ? /]中的特殊符号。

    若不指定该参数,则由系统随机生成密码,并通过站内信方式通知到用户。 - Password *string `json:"Password" name:"Password"` + // 注意:此字段可能返回 null,表示取不到有效值。 + Password *string `json:"Password,omitempty" name:"Password"` // 密钥ID列表。关联密钥后,就可以通过对应的私钥来访问实例;KeyId可通过接口DescribeKeyPairs获取,密钥与密码不能同时指定,同时Windows操作系统不支持指定密钥。当前仅支持购买的时候指定一个密钥。 - KeyIds []*string `json:"KeyIds" name:"KeyIds" list` + // 注意:此字段可能返回 null,表示取不到有效值。 + KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list` // 保持镜像的原始设置。该参数与Password或KeyIds.N不能同时指定。只有使用自定义镜像、共享镜像或外部导入镜像创建实例时才能指定该参数为TRUE。取值范围:
  • TRUE:表示保持镜像的登录设置
  • FALSE:表示不保持镜像的登录设置

    默认取值:FALSE。 - KeepImageLogin *string `json:"KeepImageLogin" name:"KeepImageLogin"` + // 注意:此字段可能返回 null,表示取不到有效值。 + KeepImageLogin *string `json:"KeepImageLogin,omitempty" name:"KeepImageLogin"` } type ModifyDisasterRecoverGroupAttributeRequest struct { *tchttp.BaseRequest // 分散置放群组ID,可使用[DescribeDisasterRecoverGroups](https://cloud.tencent.com/document/api/213/17810)接口获取。 - DisasterRecoverGroupId *string `json:"DisasterRecoverGroupId" name:"DisasterRecoverGroupId"` + DisasterRecoverGroupId *string `json:"DisasterRecoverGroupId,omitempty" name:"DisasterRecoverGroupId"` // 分散置放群组名称,长度1-60个字符,支持中、英文。 - Name *string `json:"Name" name:"Name"` + Name *string `json:"Name,omitempty" name:"Name"` } func (r *ModifyDisasterRecoverGroupAttributeRequest) ToJsonString() string { @@ -2232,7 +2307,7 @@ type ModifyDisasterRecoverGroupAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2249,13 +2324,13 @@ type ModifyHostsAttributeRequest struct { *tchttp.BaseRequest // 一个或多个待操作的CDH实例ID。 - HostIds []*string `json:"HostIds" name:"HostIds" list` + HostIds []*string `json:"HostIds,omitempty" name:"HostIds" list` // CDH实例显示名称。可任意命名,但不得超过60个字符。 - HostName *string `json:"HostName" name:"HostName"` + HostName *string `json:"HostName,omitempty" name:"HostName"` // 自动续费标识。取值范围:
  • NOTIFY_AND_AUTO_RENEW:通知过期且自动续费
  • NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费
  • DISABLE_NOTIFY_AND_MANUAL_RENEW:不通知过期不自动续费

    若该参数指定为NOTIFY_AND_AUTO_RENEW,在账户余额充足的情况下,实例到期后将按月自动续费。 - RenewFlag *string `json:"RenewFlag" name:"RenewFlag"` + RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"` } func (r *ModifyHostsAttributeRequest) ToJsonString() string { @@ -2272,7 +2347,7 @@ type ModifyHostsAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2289,13 +2364,13 @@ type ModifyImageAttributeRequest struct { *tchttp.BaseRequest // 镜像ID,形如`img-gvbnzy6f`。镜像ID可以通过如下方式获取:
  • 通过[DescribeImages](https://cloud.tencent.com/document/api/213/15715)接口返回的`ImageId`获取。
  • 通过[镜像控制台](https://console.cloud.tencent.com/cvm/image)获取。 - ImageId *string `json:"ImageId" name:"ImageId"` + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` // 设置新的镜像名称;必须满足下列限制:
  • 不得超过20个字符。
  • 镜像名称不能与已有镜像重复。 - ImageName *string `json:"ImageName" name:"ImageName"` + ImageName *string `json:"ImageName,omitempty" name:"ImageName"` // 设置新的镜像描述;必须满足下列限制:
  • 不得超过60个字符。 - ImageDescription *string `json:"ImageDescription" name:"ImageDescription"` + ImageDescription *string `json:"ImageDescription,omitempty" name:"ImageDescription"` } func (r *ModifyImageAttributeRequest) ToJsonString() string { @@ -2312,7 +2387,7 @@ type ModifyImageAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2329,13 +2404,13 @@ type ModifyImageSharePermissionRequest struct { *tchttp.BaseRequest // 镜像ID,形如`img-gvbnzy6f`。镜像Id可以通过如下方式获取:
  • 通过[DescribeImages](https://cloud.tencent.com/document/api/213/15715)接口返回的`ImageId`获取。
  • 通过[镜像控制台](https://console.cloud.tencent.com/cvm/image)获取。
    镜像ID必须指定为状态为`NORMAL`的镜像。镜像状态请参考[镜像数据表](/document/api/213/9452#image_state)。 - ImageId *string `json:"ImageId" name:"ImageId"` + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` // 接收分享镜像的账号Id列表,array型参数的格式可以参考[API简介](/document/api/213/568)。帐号ID不同于QQ号,查询用户帐号ID请查看[帐号信息](https://console.cloud.tencent.com/developer)中的帐号ID栏。 - AccountIds []*string `json:"AccountIds" name:"AccountIds" list` + AccountIds []*string `json:"AccountIds,omitempty" name:"AccountIds" list` // 操作,包括 `SHARE`,`CANCEL`。其中`SHARE`代表分享操作,`CANCEL`代表取消分享操作。 - Permission *string `json:"Permission" name:"Permission"` + Permission *string `json:"Permission,omitempty" name:"Permission"` } func (r *ModifyImageSharePermissionRequest) ToJsonString() string { @@ -2352,7 +2427,7 @@ type ModifyImageSharePermissionResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2369,13 +2444,13 @@ type ModifyInstancesAttributeRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388) API返回值中的`InstanceId`获取。每次请求允许操作的实例数量上限是100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 实例名称。可任意命名,但不得超过60个字符。 - InstanceName *string `json:"InstanceName" name:"InstanceName"` + InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"` // 指定实例的安全组Id列表,子机将重新关联指定列表的安全组,原本关联的安全组会被解绑。 - SecurityGroups []*string `json:"SecurityGroups" name:"SecurityGroups" list` + SecurityGroups []*string `json:"SecurityGroups,omitempty" name:"SecurityGroups" list` } func (r *ModifyInstancesAttributeRequest) ToJsonString() string { @@ -2392,7 +2467,7 @@ type ModifyInstancesAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2409,13 +2484,13 @@ type ModifyInstancesChargeTypeRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 实例[计费类型](https://cloud.tencent.com/document/product/213/2180)。
  • PREPAID:预付费,即包年包月。 - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` } func (r *ModifyInstancesChargeTypeRequest) ToJsonString() string { @@ -2432,7 +2507,7 @@ type ModifyInstancesChargeTypeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2449,10 +2524,10 @@ type ModifyInstancesProjectRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388) API返回值中的`InstanceId`获取。每次请求允许操作的实例数量上限是100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 项目ID。项目可以使用[AddProject](https://cloud.tencent.com/doc/api/403/4398)接口创建。后续使用[DescribeInstances](https://cloud.tencent.com/document/api/213/9388)接口查询实例时,项目ID可用于过滤结果。 - ProjectId *int64 `json:"ProjectId" name:"ProjectId"` + ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"` } func (r *ModifyInstancesProjectRequest) ToJsonString() string { @@ -2469,7 +2544,7 @@ type ModifyInstancesProjectResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2486,10 +2561,10 @@ type ModifyInstancesRenewFlagRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388) API返回值中的`InstanceId`获取。每次请求允许操作的实例数量上限是100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 自动续费标识。取值范围:
  • NOTIFY_AND_AUTO_RENEW:通知过期且自动续费
  • NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费
  • DISABLE_NOTIFY_AND_MANUAL_RENEW:不通知过期不自动续费

    若该参数指定为NOTIFY_AND_AUTO_RENEW,在账户余额充足的情况下,实例到期后将按月自动续费。 - RenewFlag *string `json:"RenewFlag" name:"RenewFlag"` + RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"` } func (r *ModifyInstancesRenewFlagRequest) ToJsonString() string { @@ -2506,7 +2581,7 @@ type ModifyInstancesRenewFlagResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2522,14 +2597,17 @@ func (r *ModifyInstancesRenewFlagResponse) FromJsonString(s string) error { type ModifyInstancesVpcAttributeRequest struct { *tchttp.BaseRequest - // 待操作的实例ID数组。可通过[`DescribeInstances`](document/api/213/15728)接口返回值中的`InstanceId`获取。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + // 待操作的实例ID数组。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。 + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 私有网络相关信息配置。通过该参数指定私有网络的ID,子网ID,私有网络ip等信息。当指定私有网络ID和子网ID(子网必须在实例所在的可用区)与指定实例所在私有网络不一致时,会将实例迁移至指定的私有网络的子网下。可通过`PrivateIpAddresses`指定私有网络子网IP,若需指定则所有已指定的实例均需要指定子网IP,此时`InstanceIds`与`PrivateIpAddresses`一一对应。不指定`PrivateIpAddresses`时随机分配私有网络子网IP。 - VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud" name:"VirtualPrivateCloud"` + VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud,omitempty" name:"VirtualPrivateCloud"` // 是否对运行中的实例选择强制关机。默认为TRUE。 - ForceStop *bool `json:"ForceStop" name:"ForceStop"` + ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"` + + // 是否保留主机名。默认为FALSE。 + ReserveHostName *bool `json:"ReserveHostName,omitempty" name:"ReserveHostName"` } func (r *ModifyInstancesVpcAttributeRequest) ToJsonString() string { @@ -2546,7 +2624,7 @@ type ModifyInstancesVpcAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2563,13 +2641,13 @@ type ModifyKeyPairAttributeRequest struct { *tchttp.BaseRequest // 密钥对ID,密钥对ID形如:`skey-xxxxxxxx`。

    可以通过以下方式获取可用的密钥 ID:
  • 通过登录[控制台](https://console.cloud.tencent.com/cvm/sshkey)查询密钥 ID。
  • 通过调用接口 [DescribeKeyPairs](https://cloud.tencent.com/document/api/213/9403) ,取返回信息中的 `KeyId` 获取密钥对 ID。 - KeyId *string `json:"KeyId" name:"KeyId"` + KeyId *string `json:"KeyId,omitempty" name:"KeyId"` // 修改后的密钥对名称,可由数字,字母和下划线组成,长度不超过25个字符。 - KeyName *string `json:"KeyName" name:"KeyName"` + KeyName *string `json:"KeyName,omitempty" name:"KeyName"` // 修改后的密钥对描述信息。可任意命名,但不得超过60个字符。 - Description *string `json:"Description" name:"Description"` + Description *string `json:"Description,omitempty" name:"Description"` } func (r *ModifyKeyPairAttributeRequest) ToJsonString() string { @@ -2586,7 +2664,7 @@ type ModifyKeyPairAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2599,47 +2677,62 @@ func (r *ModifyKeyPairAttributeResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type OperationCountLimit struct { + + // 实例操作。 + Operation *string `json:"Operation,omitempty" name:"Operation"` + + // 实例ID。 + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` + + // 当前已使用次数,如果返回值为-1表示该操作无次数限制。 + CurrentCount *int64 `json:"CurrentCount,omitempty" name:"CurrentCount"` + + // 操作次数最高额度,如果返回值为-1表示该操作无次数限制,如果返回值为0表示不支持调整配置。 + LimitCount *int64 `json:"LimitCount,omitempty" name:"LimitCount"` +} + type OsVersion struct { // 操作系统类型 - OsName *string `json:"OsName" name:"OsName"` + OsName *string `json:"OsName,omitempty" name:"OsName"` // 支持的操作系统版本 - OsVersions []*string `json:"OsVersions" name:"OsVersions" list` + OsVersions []*string `json:"OsVersions,omitempty" name:"OsVersions" list` // 支持的操作系统架构 - Architecture []*string `json:"Architecture" name:"Architecture" list` + Architecture []*string `json:"Architecture,omitempty" name:"Architecture" list` } type Placement struct { // 实例所属的[可用区](/document/product/213/9452#zone)ID。该参数也可以通过调用 [DescribeZones](/document/api/213/9455) 的返回值中的Zone字段来获取。 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` // 实例所属项目ID。该参数可以通过调用 [DescribeProject](/document/api/378/4400) 的返回值中的 projectId 字段来获取。不填为默认项目。 - ProjectId *int64 `json:"ProjectId" name:"ProjectId"` + ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"` // 实例所属的专用宿主机ID列表。如果您有购买专用宿主机并且指定了该参数,则您购买的实例就会随机的部署在这些专用宿主机上。 - HostIds []*string `json:"HostIds" name:"HostIds" list` + HostIds []*string `json:"HostIds,omitempty" name:"HostIds" list` } type Price struct { // 描述了实例价格。 - InstancePrice *ItemPrice `json:"InstancePrice" name:"InstancePrice"` + InstancePrice *ItemPrice `json:"InstancePrice,omitempty" name:"InstancePrice"` // 描述了网络价格。 - BandwidthPrice *ItemPrice `json:"BandwidthPrice" name:"BandwidthPrice"` + BandwidthPrice *ItemPrice `json:"BandwidthPrice,omitempty" name:"BandwidthPrice"` } type RebootInstancesRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 是否在正常重启失败后选择强制重启实例。取值范围:
  • TRUE:表示在正常重启失败后进行强制重启
  • FALSE:表示在正常重启失败后不进行强制重启

    默认取值:FALSE。 - ForceReboot *bool `json:"ForceReboot" name:"ForceReboot"` + ForceReboot *bool `json:"ForceReboot,omitempty" name:"ForceReboot"` } func (r *RebootInstancesRequest) ToJsonString() string { @@ -2656,7 +2749,7 @@ type RebootInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2672,23 +2765,23 @@ func (r *RebootInstancesResponse) FromJsonString(s string) error { type RegionInfo struct { // 地域名称,例如,ap-guangzhou - Region *string `json:"Region" name:"Region"` + Region *string `json:"Region,omitempty" name:"Region"` // 地域描述,例如,华南地区(广州) - RegionName *string `json:"RegionName" name:"RegionName"` + RegionName *string `json:"RegionName,omitempty" name:"RegionName"` // 地域是否可用状态 - RegionState *string `json:"RegionState" name:"RegionState"` + RegionState *string `json:"RegionState,omitempty" name:"RegionState"` } type RenewHostsRequest struct { *tchttp.BaseRequest // 一个或多个待操作的CDH实例ID。 - HostIds []*string `json:"HostIds" name:"HostIds" list` + HostIds []*string `json:"HostIds,omitempty" name:"HostIds" list` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。 - HostChargePrepaid *ChargePrepaid `json:"HostChargePrepaid" name:"HostChargePrepaid"` + HostChargePrepaid *ChargePrepaid `json:"HostChargePrepaid,omitempty" name:"HostChargePrepaid"` } func (r *RenewHostsRequest) ToJsonString() string { @@ -2705,7 +2798,7 @@ type RenewHostsResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2722,13 +2815,13 @@ type RenewInstancesRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` - // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的续费时长、是否设置自动续费等属性。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的续费时长、是否设置自动续费等属性。包年包月实例该参数为必传参数。 + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` // 是否续费弹性数据盘。取值范围:
  • TRUE:表示续费包年包月实例同时续费其挂载的弹性数据盘
  • FALSE:表示续费包年包月实例同时不再续费其挂载的弹性数据盘

    默认取值:TRUE。 - RenewPortableDataDisk *bool `json:"RenewPortableDataDisk" name:"RenewPortableDataDisk"` + RenewPortableDataDisk *bool `json:"RenewPortableDataDisk,omitempty" name:"RenewPortableDataDisk"` } func (r *RenewInstancesRequest) ToJsonString() string { @@ -2745,7 +2838,7 @@ type RenewInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2762,19 +2855,23 @@ type ResetInstanceRequest struct { *tchttp.BaseRequest // 实例ID。可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/9388) API返回值中的`InstanceId`获取。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 指定有效的[镜像](https://cloud.tencent.com/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:
  • 公共镜像
  • 自定义镜像
  • 共享镜像
  • 服务市场镜像

  • 可通过以下方式获取可用的镜像ID:
  • `公共镜像`、`自定义镜像`、`共享镜像`的镜像ID可通过登录[控制台](https://console.cloud.tencent.com/cvm/image?rid=1&imageType=PUBLIC_IMAGE)查询;`服务镜像市场`的镜像ID可通过[云市场](https://market.cloud.tencent.com/list)查询。
  • 通过调用接口 [DescribeImages](https://cloud.tencent.com/document/api/213/9418) ,取返回信息中的`ImageId`字段。
  • - ImageId *string `json:"ImageId" name:"ImageId"` + //
    默认取值:默认使用当前镜像。 + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` // 实例系统盘配置信息。系统盘为云盘的实例可以通过该参数指定重装后的系统盘大小来实现对系统盘的扩容操作,若不指定则默认系统盘大小保持不变。系统盘大小只支持扩容不支持缩容;重装只支持修改系统盘的大小,不能修改系统盘的类型。 - SystemDisk *SystemDisk `json:"SystemDisk" name:"SystemDisk"` + SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"` // 实例登录设置。通过该参数可以设置实例的登录方式密码、密钥或保持镜像的原始登录设置。默认情况下会随机生成密码,并以站内信方式知会到用户。 - LoginSettings *LoginSettings `json:"LoginSettings" name:"LoginSettings"` + LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"` // 增强服务。通过该参数可以指定是否开启云安全、云监控等服务。若不指定该参数,则默认开启云监控、云安全服务。 - EnhancedService *EnhancedService `json:"EnhancedService" name:"EnhancedService"` + EnhancedService *EnhancedService `json:"EnhancedService,omitempty" name:"EnhancedService"` + + // 重装系统时,可以指定修改实例的HostName。 + HostName *string `json:"HostName,omitempty" name:"HostName"` } func (r *ResetInstanceRequest) ToJsonString() string { @@ -2791,7 +2888,7 @@ type ResetInstanceResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2808,16 +2905,16 @@ type ResetInstancesInternetMaxBandwidthRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的 `InstanceId` 获取。 每次请求批量实例的上限为100。当调整 `BANDWIDTH_PREPAID` 和 `BANDWIDTH_POSTPAID_BY_HOUR` 计费方式的带宽时,只支持一个实例。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 公网出带宽配置。不同机型带宽上限范围不一致,具体限制详见带宽限制对账表。暂时只支持 `InternetMaxBandwidthOut` 参数。 - InternetAccessible *InternetAccessible `json:"InternetAccessible" name:"InternetAccessible"` + InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"` // 带宽生效的起始时间。格式:`YYYY-MM-DD`,例如:`2016-10-30`。起始时间不能早于当前时间。如果起始时间是今天则新设置的带宽立即生效。该参数只对包年包月带宽有效,其他模式带宽不支持该参数,否则接口会以相应错误码返回。 - StartTime *string `json:"StartTime" name:"StartTime"` + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` // 带宽生效的终止时间。格式: `YYYY-MM-DD` ,例如:`2016-10-30` 。新设置的带宽的有效期包含终止时间此日期。终止时间不能晚于包年包月实例的到期时间。实例的到期时间可通过 [`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的`ExpiredTime`获取。该参数只对包年包月带宽有效,其他模式带宽不支持该参数,否则接口会以相应错误码返回。 - EndTime *string `json:"EndTime" name:"EndTime"` + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` } func (r *ResetInstancesInternetMaxBandwidthRequest) ToJsonString() string { @@ -2834,7 +2931,7 @@ type ResetInstancesInternetMaxBandwidthResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2851,16 +2948,16 @@ type ResetInstancesPasswordRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728) API返回值中的`InstanceId`获取。每次请求允许操作的实例数量上限是100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 实例登录密码。不同操作系统类型密码复杂度限制不一样,具体如下:
  • `Linux`实例密码必须8到16位,至少包括两项`[a-z,A-Z]、[0-9]`和`[( ) ~ ~ ! @ # $ % ^ & * - + = _ | { } [ ] : ; ' < > , . ? /]`中的符号。密码不允许以`/`符号开头。
  • `Windows`实例密码必须12到16位,至少包括三项`[a-z],[A-Z],[0-9]`和`[( ) ~ ~ ! @ # $ % ^ & * - + = _ | { } [ ] : ; ' < > , . ? /]`中的符号。密码不允许以`/`符号开头。
  • 如果实例即包含`Linux`实例又包含`Windows`实例,则密码复杂度限制按照`Windows`实例的限制。 - Password *string `json:"Password" name:"Password"` + Password *string `json:"Password,omitempty" name:"Password"` // 待重置密码的实例操作系统用户名。不得超过64个字符。 - UserName *string `json:"UserName" name:"UserName"` + UserName *string `json:"UserName,omitempty" name:"UserName"` // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再重置用户密码。取值范围:
  • TRUE:表示在正常关机失败后进行强制关机
  • FALSE:表示在正常关机失败后不进行强制关机

    默认取值:FALSE。

    强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。 - ForceStop *bool `json:"ForceStop" name:"ForceStop"` + ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"` } func (r *ResetInstancesPasswordRequest) ToJsonString() string { @@ -2877,7 +2974,7 @@ type ResetInstancesPasswordResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2894,13 +2991,13 @@ type ResetInstancesTypeRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为1。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 实例机型。不同实例机型指定了不同的资源规格,具体取值可通过调用接口[`DescribeInstanceTypeConfigs`](https://cloud.tencent.com/document/api/213/15749)来获得最新的规格表或参见[实例类型](https://cloud.tencent.com/document/product/213/11518)描述。 - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再重置用户密码。取值范围:
  • TRUE:表示在正常关机失败后进行强制关机
  • FALSE:表示在正常关机失败后不进行强制关机

    默认取值:FALSE。

    强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。 - ForceStop *bool `json:"ForceStop" name:"ForceStop"` + ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"` } func (r *ResetInstancesTypeRequest) ToJsonString() string { @@ -2917,7 +3014,7 @@ type ResetInstancesTypeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2934,13 +3031,13 @@ type ResizeInstanceDisksRequest struct { *tchttp.BaseRequest // 待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` - // 待扩容的数据盘配置信息。只支持扩容随实例购买的数据盘,且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。数据盘容量单位:GB。最小扩容步长:10G。关于数据盘类型的选择请参考硬盘产品简介。可选数据盘类型受到实例类型`InstanceType`限制。另外允许扩容的最大容量也因数据盘类型的不同而有所差异。 - DataDisks []*DataDisk `json:"DataDisks" name:"DataDisks" list` + // 待扩容的数据盘配置信息。只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性),且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。数据盘容量单位:GB。最小扩容步长:10G。关于数据盘类型的选择请参考硬盘产品简介。可选数据盘类型受到实例类型`InstanceType`限制。另外允许扩容的最大容量也因数据盘类型的不同而有所差异。 + DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list` // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再重置用户密码。取值范围:
  • TRUE:表示在正常关机失败后进行强制关机
  • FALSE:表示在正常关机失败后不进行强制关机

    默认取值:FALSE。

    强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。 - ForceStop *bool `json:"ForceStop" name:"ForceStop"` + ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"` } func (r *ResizeInstanceDisksRequest) ToJsonString() string { @@ -2957,7 +3054,7 @@ type ResizeInstanceDisksResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2974,68 +3071,68 @@ type RunInstancesRequest struct { *tchttp.BaseRequest // 实例所在的位置。通过该参数可以指定实例所属可用区,所属项目,所属宿主机(在专用宿主机上创建子机时指定)等属性。 - Placement *Placement `json:"Placement" name:"Placement"` + Placement *Placement `json:"Placement,omitempty" name:"Placement"` // 指定有效的[镜像](https://cloud.tencent.com/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:
  • 公共镜像
  • 自定义镜像
  • 共享镜像
  • 服务市场镜像

  • 可通过以下方式获取可用的镜像ID:
  • `公共镜像`、`自定义镜像`、`共享镜像`的镜像ID可通过登录[控制台](https://console.cloud.tencent.com/cvm/image?rid=1&imageType=PUBLIC_IMAGE)查询;`服务镜像市场`的镜像ID可通过[云市场](https://market.cloud.tencent.com/list)查询。
  • 通过调用接口 [DescribeImages](https://cloud.tencent.com/document/api/213/15715) ,取返回信息中的`ImageId`字段。
  • - ImageId *string `json:"ImageId" name:"ImageId"` + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` // 实例[计费类型](https://cloud.tencent.com/document/product/213/2180)。
  • PREPAID:预付费,即包年包月
  • POSTPAID_BY_HOUR:按小时后付费
  • CDHPAID:独享子机(基于专用宿主机创建,宿主机部分的资源不收费)
  • SPOTPAID:竞价付费
    默认值:POSTPAID_BY_HOUR。 - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` // 实例机型。不同实例机型指定了不同的资源规格。 //
  • 对于付费模式为PREPAID或POSTPAID\_BY\_HOUR的实例创建,具体取值可通过调用接口[DescribeInstanceTypeConfigs](https://cloud.tencent.com/document/api/213/15749)来获得最新的规格表或参见[实例类型](https://cloud.tencent.com/document/product/213/11518)描述。若不指定该参数,则默认机型为S1.SMALL1。
  • 对于付费模式为CDHPAID的实例创建,该参数以"CDH_"为前缀,根据cpu和内存配置生成,具体形式为:CDH_XCXG,例如对于创建cpu为1核,内存为1G大小的专用宿主机的实例,该参数应该为CDH_1C1G。 - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` // 实例系统盘配置信息。若不指定该参数,则按照系统默认值进行分配。 - SystemDisk *SystemDisk `json:"SystemDisk" name:"SystemDisk"` + SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"` // 实例数据盘配置信息。若不指定该参数,则默认不购买数据盘。支持购买的时候指定11块数据盘,其中最多包含1块LOCAL_BASIC数据盘或者LOCAL_SSD数据盘,最多包含10块CLOUD_BASIC数据盘、CLOUD_PREMIUM数据盘或者CLOUD_SSD数据盘。 - DataDisks []*DataDisk `json:"DataDisks" name:"DataDisks" list` + DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list` // 私有网络相关信息配置。通过该参数可以指定私有网络的ID,子网ID等信息。若不指定该参数,则默认使用基础网络。若在此参数中指定了私有网络ip,表示每个实例的主网卡ip,而且InstanceCount参数必须与私有网络ip的个数一致。 - VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud" name:"VirtualPrivateCloud"` + VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud,omitempty" name:"VirtualPrivateCloud"` // 公网带宽相关信息设置。若不指定该参数,则默认公网带宽为0Mbps。 - InternetAccessible *InternetAccessible `json:"InternetAccessible" name:"InternetAccessible"` + InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"` // 购买实例数量。包年包月实例取值范围:[1,300],按量计费实例取值范围:[1,100]。默认取值:1。指定购买实例的数量不能超过用户所能购买的剩余配额数量,具体配额相关限制详见[CVM实例购买限制](https://cloud.tencent.com/document/product/213/2664)。 - InstanceCount *int64 `json:"InstanceCount" name:"InstanceCount"` + InstanceCount *int64 `json:"InstanceCount,omitempty" name:"InstanceCount"` // 实例显示名称。
  • 不指定实例显示名称则默认显示‘未命名’。
  • 购买多台实例,如果指定模式串`{R:x}`,表示生成数字`[x, x+n-1]`,其中`n`表示购买实例的数量,例如`server_{R:3}`,购买1台时,实例显示名称为`server_3`;购买2台时,实例显示名称分别为`server_3`,`server_4`。支持指定多个模式串`{R:x}`。
  • 购买多台实例,如果不指定模式串,则在实例显示名称添加后缀`1、2...n`,其中`n`表示购买实例的数量,例如`server_`,购买2台时,实例显示名称分别为`server_1`,`server_2`。 - InstanceName *string `json:"InstanceName" name:"InstanceName"` + InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"` // 实例登录设置。通过该参数可以设置实例的登录方式密码、密钥或保持镜像的原始登录设置。默认情况下会随机生成密码,并以站内信方式知会到用户。 - LoginSettings *LoginSettings `json:"LoginSettings" name:"LoginSettings"` + LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"` // 实例所属安全组。该参数可以通过调用 [DescribeSecurityGroups](https://cloud.tencent.com/document/api/215/15808) 的返回值中的sgId字段来获取。若不指定该参数,则绑定默认安全组。 - SecurityGroupIds []*string `json:"SecurityGroupIds" name:"SecurityGroupIds" list` + SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list` // 增强服务。通过该参数可以指定是否开启云安全、云监控等服务。若不指定该参数,则默认开启云监控、云安全服务。 - EnhancedService *EnhancedService `json:"EnhancedService" name:"EnhancedService"` + EnhancedService *EnhancedService `json:"EnhancedService,omitempty" name:"EnhancedService"` // 用于保证请求幂等性的字符串。该字符串由客户生成,需保证不同请求之间唯一,最大值不超过64个ASCII字符。若不指定该参数,则无法保证请求的幂等性。
    更多详细信息请参阅:如何保证幂等性。 - ClientToken *string `json:"ClientToken" name:"ClientToken"` + ClientToken *string `json:"ClientToken,omitempty" name:"ClientToken"` // 云服务器的主机名。
  • 点号(.)和短横线(-)不能作为 HostName 的首尾字符,不能连续使用。
  • Windows 实例:名字符长度为[2, 15],允许字母(不限制大小写)、数字和短横线(-)组成,不支持点号(.),不能全是数字。
  • 其他类型(Linux 等)实例:字符长度为[2, 60],允许支持多个点号,点之间为一段,每段允许字母(不限制大小写)、数字和短横线(-)组成。 - HostName *string `json:"HostName" name:"HostName"` + HostName *string `json:"HostName,omitempty" name:"HostName"` // 定时任务。通过该参数可以为实例指定定时任务,目前仅支持定时销毁。 - ActionTimer *ActionTimer `json:"ActionTimer" name:"ActionTimer"` + ActionTimer *ActionTimer `json:"ActionTimer,omitempty" name:"ActionTimer"` - // 容灾组id,仅支持指定一个。 - DisasterRecoverGroupIds []*string `json:"DisasterRecoverGroupIds" name:"DisasterRecoverGroupIds" list` + // 置放群组id,仅支持指定一个。 + DisasterRecoverGroupIds []*string `json:"DisasterRecoverGroupIds,omitempty" name:"DisasterRecoverGroupIds" list` // 标签描述列表。通过指定该参数可以同时绑定标签到相应的资源实例,当前仅支持绑定标签到云主机实例。 - TagSpecification []*TagSpecification `json:"TagSpecification" name:"TagSpecification" list` + TagSpecification []*TagSpecification `json:"TagSpecification,omitempty" name:"TagSpecification" list` // 实例的市场相关选项,如竞价实例相关参数,若指定实例的付费模式为竞价付费则该参数必传。 - InstanceMarketOptions *InstanceMarketOptionsRequest `json:"InstanceMarketOptions" name:"InstanceMarketOptions"` + InstanceMarketOptions *InstanceMarketOptionsRequest `json:"InstanceMarketOptions,omitempty" name:"InstanceMarketOptions"` // 提供给实例使用的用户数据,需要以 base64 方式编码,支持的最大数据大小为 16KB。关于获取此参数的详细介绍,请参阅[Windows](https://cloud.tencent.com/document/product/213/17526)和[Linux](https://cloud.tencent.com/document/product/213/17525)启动时运行命令。 - UserData *string `json:"UserData" name:"UserData"` + UserData *string `json:"UserData,omitempty" name:"UserData"` } func (r *RunInstancesRequest) ToJsonString() string { @@ -3052,10 +3149,10 @@ type RunInstancesResponse struct { Response *struct { // 当通过本接口来创建实例时会返回该参数,表示一个或多个实例`ID`。返回实例`ID`列表并不代表实例创建成功,可根据 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) 接口查询返回的InstancesSet中对应实例的`ID`的状态来判断创建是否完成;如果实例状态由“准备中”变为“正在运行”,则为创建成功。 - InstanceIdSet []*string `json:"InstanceIdSet" name:"InstanceIdSet" list` + InstanceIdSet []*string `json:"InstanceIdSet,omitempty" name:"InstanceIdSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3071,38 +3168,52 @@ func (r *RunInstancesResponse) FromJsonString(s string) error { type RunMonitorServiceEnabled struct { // 是否开启[云监控](/document/product/248)服务。取值范围:
  • TRUE:表示开启云监控服务
  • FALSE:表示不开启云监控服务

    默认取值:TRUE。 - Enabled *bool `json:"Enabled" name:"Enabled"` + Enabled *bool `json:"Enabled,omitempty" name:"Enabled"` } type RunSecurityServiceEnabled struct { // 是否开启[云安全](/document/product/296)服务。取值范围:
  • TRUE:表示开启云安全服务
  • FALSE:表示不开启云安全服务

    默认取值:TRUE。 - Enabled *bool `json:"Enabled" name:"Enabled"` + Enabled *bool `json:"Enabled,omitempty" name:"Enabled"` } type SharePermission struct { // 镜像分享时间 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` // 镜像分享的账户ID - AccountId *string `json:"AccountId" name:"AccountId"` + AccountId *string `json:"AccountId,omitempty" name:"AccountId"` +} + +type Snapshot struct { + + // 快照Id。 + SnapshotId *string `json:"SnapshotId,omitempty" name:"SnapshotId"` + + // 创建此快照的云硬盘类型。取值范围: + // SYSTEM_DISK:系统盘 + // DATA_DISK:数据盘。 + DiskUsage *string `json:"DiskUsage,omitempty" name:"DiskUsage"` + + // 创建此快照的云硬盘大小,单位GB。 + DiskSize *int64 `json:"DiskSize,omitempty" name:"DiskSize"` } type SpotMarketOptions struct { // 竞价出价 - MaxPrice *string `json:"MaxPrice" name:"MaxPrice"` + MaxPrice *string `json:"MaxPrice,omitempty" name:"MaxPrice"` // 竞价请求类型,当前仅支持类型:one-time - SpotInstanceType *string `json:"SpotInstanceType" name:"SpotInstanceType"` + SpotInstanceType *string `json:"SpotInstanceType,omitempty" name:"SpotInstanceType"` } type StartInstancesRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` } func (r *StartInstancesRequest) ToJsonString() string { @@ -3119,7 +3230,7 @@ type StartInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3136,18 +3247,18 @@ type StopInstancesRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` // 是否在正常关闭失败后选择强制关闭实例。取值范围:
  • TRUE:表示在正常关闭失败后进行强制关闭
  • FALSE:表示在正常关闭失败后不进行强制关闭

    默认取值:FALSE。 - ForceStop *bool `json:"ForceStop" name:"ForceStop"` + ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"` // 实例的关闭模式。取值范围:
  • SOFT_FIRST:表示在正常关闭失败后进行强制关闭
  • HARD:直接强制关闭
  • SOFT:仅软关机
    默认取值:SOFT。 - StopType *string `json:"StopType" name:"StopType"` + StopType *string `json:"StopType,omitempty" name:"StopType"` // 按量计费实例关机收费模式。 // 取值范围:
  • KEEP_CHARGING:关机继续收费
  • STOP_CHARGING:关机停止收费
    默认取值:KEEP_CHARGING。 // 该参数只针对部分按量计费云硬盘实例生效,详情参考[按量计费实例关机不收费说明](https://cloud.tencent.com/document/product/213/19918) - StoppedMode *string `json:"StoppedMode" name:"StoppedMode"` + StoppedMode *string `json:"StoppedMode,omitempty" name:"StoppedMode"` } func (r *StopInstancesRequest) ToJsonString() string { @@ -3164,7 +3275,7 @@ type StopInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3180,23 +3291,26 @@ func (r *StopInstancesResponse) FromJsonString(s string) error { type StorageBlock struct { // HDD本地存储类型,值为:LOCAL_PRO. - Type *string `json:"Type" name:"Type"` + // 注意:此字段可能返回 null,表示取不到有效值。 + Type *string `json:"Type,omitempty" name:"Type"` // HDD本地存储的最小容量 - MinSize *int64 `json:"MinSize" name:"MinSize"` + // 注意:此字段可能返回 null,表示取不到有效值。 + MinSize *int64 `json:"MinSize,omitempty" name:"MinSize"` // HDD本地存储的最大容量 - MaxSize *int64 `json:"MaxSize" name:"MaxSize"` + // 注意:此字段可能返回 null,表示取不到有效值。 + MaxSize *int64 `json:"MaxSize,omitempty" name:"MaxSize"` } type SyncImagesRequest struct { *tchttp.BaseRequest // 镜像ID列表 ,镜像ID可以通过如下方式获取:
  • 通过[DescribeImages](https://cloud.tencent.com/document/api/213/15715)接口返回的`ImageId`获取。
  • 通过[镜像控制台](https://console.cloud.tencent.com/cvm/image)获取。
    镜像ID必须满足限制:
  • 镜像ID对应的镜像状态必须为`NORMAL`。
  • 镜像大小小于50GB。
    镜像状态请参考[镜像数据表](/document/api/213/9452#image_state)。 - ImageIds []*string `json:"ImageIds" name:"ImageIds" list` + ImageIds []*string `json:"ImageIds,omitempty" name:"ImageIds" list` // 目的同步地域列表;必须满足限制:
  • 不能为源地域,
  • 必须是一个合法的Region。
  • 暂不支持部分地域同步。
    具体地域参数请参考[Region](https://cloud.tencent.com/document/product/213/6091)。 - DestinationRegions []*string `json:"DestinationRegions" name:"DestinationRegions" list` + DestinationRegions []*string `json:"DestinationRegions,omitempty" name:"DestinationRegions" list` } func (r *SyncImagesRequest) ToJsonString() string { @@ -3213,7 +3327,7 @@ type SyncImagesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3229,38 +3343,38 @@ func (r *SyncImagesResponse) FromJsonString(s string) error { type SystemDisk struct { // 系统盘类型。系统盘类型限制详见[CVM实例配置](/document/product/213/2177)。取值范围:
  • LOCAL_BASIC:本地硬盘
  • LOCAL_SSD:本地SSD硬盘
  • CLOUD_BASIC:普通云硬盘
  • CLOUD_SSD:SSD云硬盘
  • CLOUD_PREMIUM:高性能云硬盘

    默认取值:CLOUD_BASIC。 - DiskType *string `json:"DiskType" name:"DiskType"` + DiskType *string `json:"DiskType,omitempty" name:"DiskType"` // 系统盘ID。LOCAL_BASIC 和 LOCAL_SSD 类型没有ID。暂时不支持该参数。 - DiskId *string `json:"DiskId" name:"DiskId"` + DiskId *string `json:"DiskId,omitempty" name:"DiskId"` // 系统盘大小,单位:GB。默认值为 50 - DiskSize *int64 `json:"DiskSize" name:"DiskSize"` + DiskSize *int64 `json:"DiskSize,omitempty" name:"DiskSize"` } type Tag struct { // 标签键 - Key *string `json:"Key" name:"Key"` + Key *string `json:"Key,omitempty" name:"Key"` // 标签值 - Value *string `json:"Value" name:"Value"` + Value *string `json:"Value,omitempty" name:"Value"` } type TagSpecification struct { - // 标签绑定的资源类型,当前仅支持类型:"instance" - ResourceType *string `json:"ResourceType" name:"ResourceType"` + // 标签绑定的资源类型,当前支持类型:"instance"和"host" + ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"` // 标签对列表 - Tags []*Tag `json:"Tags" name:"Tags" list` + Tags []*Tag `json:"Tags,omitempty" name:"Tags" list` } type TerminateInstancesRequest struct { *tchttp.BaseRequest // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` } func (r *TerminateInstancesRequest) ToJsonString() string { @@ -3277,7 +3391,7 @@ type TerminateInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3293,29 +3407,29 @@ func (r *TerminateInstancesResponse) FromJsonString(s string) error { type VirtualPrivateCloud struct { // 私有网络ID,形如`vpc-xxx`。有效的VpcId可通过登录[控制台](https://console.cloud.tencent.com/vpc/vpc?rid=1)查询;也可以调用接口 [DescribeVpcEx](/document/api/215/1372) ,从接口返回中的`unVpcId`字段获取。若在创建子机时VpcId与SubnetId同时传入`DEFAULT`,则强制使用默认vpc网络。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 私有网络子网ID,形如`subnet-xxx`。有效的私有网络子网ID可通过登录[控制台](https://console.cloud.tencent.com/vpc/subnet?rid=1)查询;也可以调用接口 [DescribeSubnets](/document/api/215/15784) ,从接口返回中的`unSubnetId`字段获取。若在创建子机时SubnetId与VpcId同时传入`DEFAULT`,则强制使用默认vpc网络。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` // 是否用作公网网关。公网网关只有在实例拥有公网IP以及处于私有网络下时才能正常使用。取值范围:
  • TRUE:表示用作公网网关
  • FALSE:表示不用作公网网关

    默认取值:FALSE。 - AsVpcGateway *bool `json:"AsVpcGateway" name:"AsVpcGateway"` + AsVpcGateway *bool `json:"AsVpcGateway,omitempty" name:"AsVpcGateway"` // 私有网络子网 IP 数组,在创建实例、修改实例vpc属性操作中可使用此参数。当前仅批量创建多台实例时支持传入相同子网的多个 IP。 - PrivateIpAddresses []*string `json:"PrivateIpAddresses" name:"PrivateIpAddresses" list` + PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list` } type ZoneInfo struct { // 可用区名称,例如,ap-guangzhou-3 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` // 可用区描述,例如,广州三区 - ZoneName *string `json:"ZoneName" name:"ZoneName"` + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` // 可用区ID - ZoneId *string `json:"ZoneId" name:"ZoneId"` + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` - // 可用区状态 - ZoneState *string `json:"ZoneState" name:"ZoneState"` + // 可用区状态,包含AVAILABLE和UNAVAILABLE。AVAILABLE代表可用,UNAVAILABLE代表不可用。 + ZoneState *string `json:"ZoneState,omitempty" name:"ZoneState"` } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/client.go index 1d31c3d95..6924ff091 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/client.go @@ -93,6 +93,33 @@ func (c *Client) AddBandwidthPackageResources(request *AddBandwidthPackageResour return } +func NewAddIp6RulesRequest() (request *AddIp6RulesRequest) { + request = &AddIp6RulesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "AddIp6Rules") + return +} + +func NewAddIp6RulesResponse() (response *AddIp6RulesResponse) { + response = &AddIp6RulesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 1. 该接口用于在转换实例下添加IPV6转换规则。 +// 2. 支持在同一个转换实例下批量添加转换规则,一个账户在一个地域最多50个。 +// 3. 一个完整的转换规则包括vip6:vport6:protocol:vip:vport,其中vip6:vport6:protocol必须是唯一。 +func (c *Client) AddIp6Rules(request *AddIp6RulesRequest) (response *AddIp6RulesResponse, err error) { + if request == nil { + request = NewAddIp6RulesRequest() + } + response = NewAddIp6RulesResponse() + err = c.Send(request, response) + return +} + func NewAllocateAddressesRequest() (request *AllocateAddressesRequest) { request = &AllocateAddressesRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -121,6 +148,90 @@ func (c *Client) AllocateAddresses(request *AllocateAddressesRequest) (response return } +func NewAssignIpv6AddressesRequest() (request *AssignIpv6AddressesRequest) { + request = &AssignIpv6AddressesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "AssignIpv6Addresses") + return +} + +func NewAssignIpv6AddressesResponse() (response *AssignIpv6AddressesResponse) { + response = &AssignIpv6AddressesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(AssignIpv6Addresses)用于弹性网卡申请`IPv6`地址。
    +// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口。 +// * 一个弹性网卡支持绑定的IP地址是有限制的,更多资源限制信息详见弹性网卡使用限制。 +// * 可以指定`IPv6`地址申请,地址类型不能为主`IP`,`IPv6`地址暂时只支持作为辅助`IP`。 +// * 地址必须要在弹性网卡所在子网内,而且不能被占用。 +// * 在弹性网卡上申请一个到多个辅助`IPv6`地址,接口会在弹性网卡所在子网段内返回指定数量的辅助`IPv6`地址。 +func (c *Client) AssignIpv6Addresses(request *AssignIpv6AddressesRequest) (response *AssignIpv6AddressesResponse, err error) { + if request == nil { + request = NewAssignIpv6AddressesRequest() + } + response = NewAssignIpv6AddressesResponse() + err = c.Send(request, response) + return +} + +func NewAssignIpv6CidrBlockRequest() (request *AssignIpv6CidrBlockRequest) { + request = &AssignIpv6CidrBlockRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "AssignIpv6CidrBlock") + return +} + +func NewAssignIpv6CidrBlockResponse() (response *AssignIpv6CidrBlockResponse) { + response = &AssignIpv6CidrBlockResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(AssignIpv6CidrBlock)用于分配IPv6网段。 +// * 使用本接口前,你需要已有VPC实例,如果没有可通过接口CreateVpc创建。 +// * 每个VPC只能申请一个IPv6网段 +func (c *Client) AssignIpv6CidrBlock(request *AssignIpv6CidrBlockRequest) (response *AssignIpv6CidrBlockResponse, err error) { + if request == nil { + request = NewAssignIpv6CidrBlockRequest() + } + response = NewAssignIpv6CidrBlockResponse() + err = c.Send(request, response) + return +} + +func NewAssignIpv6SubnetCidrBlockRequest() (request *AssignIpv6SubnetCidrBlockRequest) { + request = &AssignIpv6SubnetCidrBlockRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "AssignIpv6SubnetCidrBlock") + return +} + +func NewAssignIpv6SubnetCidrBlockResponse() (response *AssignIpv6SubnetCidrBlockResponse) { + response = &AssignIpv6SubnetCidrBlockResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(AssignIpv6SubnetCidrBlock)用于分配IPv6子网段。 +// * 给子网分配 `IPv6` 网段,要求子网所属 `VPC` 已获得 `IPv6` 网段。如果尚未分配,请先通过接口 `AssignIpv6CidrBlock` 给子网所属 `VPC` 分配一个 `IPv6` 网段。否则无法分配 `IPv6` 子网段。 +// * 每个子网只能分配一个IPv6网段。 +func (c *Client) AssignIpv6SubnetCidrBlock(request *AssignIpv6SubnetCidrBlockRequest) (response *AssignIpv6SubnetCidrBlockResponse, err error) { + if request == nil { + request = NewAssignIpv6SubnetCidrBlockRequest() + } + response = NewAssignIpv6SubnetCidrBlockResponse() + err = c.Send(request, response) + return +} + func NewAssignPrivateIpAddressesRequest() (request *AssignPrivateIpAddressesRequest) { request = &AssignPrivateIpAddressesRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -165,9 +276,10 @@ func NewAssociateAddressResponse() (response *AssociateAddressResponse) { } // 本接口 (AssociateAddress) 用于将[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)绑定到实例或弹性网卡的指定内网 IP 上。 -// * 将 EIP 绑定到实例上,其本质是将 EIP 绑定到实例上主网卡的主内网 IP 上。 +// * 将 EIP 绑定到实例(CVM)上,其本质是将 EIP 绑定到实例上主网卡的主内网 IP 上。 // * 将 EIP 绑定到主网卡的主内网IP上,绑定过程会把其上绑定的普通公网 IP 自动解绑并释放。 -// * 如果指定网卡的内网 IP 已经绑定了 EIP,则必须先解绑该 EIP,才能再绑定新的。 +// * 将 EIP 绑定到指定网卡的内网 IP上(非主网卡的主内网IP),则必须先解绑该 EIP,才能再绑定新的。 +// * 将 EIP 绑定到NAT网关,请使用接口[EipBindNatGateway](https://cloud.tencent.com/document/product/215/4093) // * EIP 如果欠费或被封堵,则不能被绑定。 // * 只有状态为 UNBIND 的 EIP 才能够被绑定。 func (c *Client) AssociateAddress(request *AssociateAddressRequest) (response *AssociateAddressResponse, err error) { @@ -276,7 +388,7 @@ func NewCreateAddressTemplateResponse() (response *CreateAddressTemplateResponse return } -// 创建IP地址模版 +// 本接口(CreateAddressTemplate)用于创建IP地址模版 func (c *Client) CreateAddressTemplate(request *CreateAddressTemplateRequest) (response *CreateAddressTemplateResponse, err error) { if request == nil { request = NewCreateAddressTemplateRequest() @@ -301,7 +413,7 @@ func NewCreateAddressTemplateGroupResponse() (response *CreateAddressTemplateGro return } -// 创建IP地址模版集合 +// 本接口(CreateAddressTemplateGroup)用于创建IP地址模版集合 func (c *Client) CreateAddressTemplateGroup(request *CreateAddressTemplateGroupRequest) (response *CreateAddressTemplateGroupResponse, err error) { if request == nil { request = NewCreateAddressTemplateGroupRequest() @@ -470,6 +582,31 @@ func (c *Client) CreateDirectConnectGatewayCcnRoutes(request *CreateDirectConnec return } +func NewCreateFlowLogRequest() (request *CreateFlowLogRequest) { + request = &CreateFlowLogRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "CreateFlowLog") + return +} + +func NewCreateFlowLogResponse() (response *CreateFlowLogResponse) { + response = &CreateFlowLogResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(CreateFlowLog)用于创建流日志 +func (c *Client) CreateFlowLog(request *CreateFlowLogRequest) (response *CreateFlowLogResponse, err error) { + if request == nil { + request = NewCreateFlowLogRequest() + } + response = NewCreateFlowLogResponse() + err = c.Send(request, response) + return +} + func NewCreateHaVipRequest() (request *CreateHaVipRequest) { request = &CreateHaVipRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -495,6 +632,32 @@ func (c *Client) CreateHaVip(request *CreateHaVipRequest) (response *CreateHaVip return } +func NewCreateIp6TranslatorsRequest() (request *CreateIp6TranslatorsRequest) { + request = &CreateIp6TranslatorsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "CreateIp6Translators") + return +} + +func NewCreateIp6TranslatorsResponse() (response *CreateIp6TranslatorsResponse) { + response = &CreateIp6TranslatorsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 1. 该接口用于创建IPV6转换IPV4实例,支持批量 +// 2. 同一个账户在在一个地域最多允许创建10个转换实例 +func (c *Client) CreateIp6Translators(request *CreateIp6TranslatorsRequest) (response *CreateIp6TranslatorsResponse, err error) { + if request == nil { + request = NewCreateIp6TranslatorsRequest() + } + response = NewCreateIp6TranslatorsResponse() + err = c.Send(request, response) + return +} + func NewCreateNetworkInterfaceRequest() (request *CreateNetworkInterfaceRequest) { request = &CreateNetworkInterfaceRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -624,7 +787,7 @@ func NewCreateSecurityGroupPoliciesResponse() (response *CreateSecurityGroupPoli // * Protocol字段支持输入TCP, UDP, ICMP, GRE, ALL。 // * CidrBlock字段允许输入符合cidr格式标准的任意字符串。(展开)在基础网络中,如果CidrBlock包含您的账户内的云服务器之外的设备在腾讯云的内网IP,并不代表此规则允许您访问这些设备,租户之间网络隔离规则优先于安全组中的内网规则。 // * SecurityGroupId字段允许输入与待修改的安全组位于相同项目中的安全组ID,包括这个安全组ID本身,代表安全组下所有云服务器的内网IP。使用这个字段时,这条规则用来匹配网络报文的过程中会随着被使用的这个ID所关联的云服务器变化而变化,不需要重新修改。 -// * Port字段允许输入一个单独端口号,或者用减号分隔的两个端口号代表端口范围,例如80或8000-8010。只有当Protocol字段是TCP或UDP时,Port字段才被接受。 +// * Port字段允许输入一个单独端口号,或者用减号分隔的两个端口号代表端口范围,例如80或8000-8010。只有当Protocol字段是TCP或UDP时,Port字段才被接受,即Protocol字段不是TCP或UDP时,Protocol和Port排他关系,不允许同时输入,否则会接口报错。 // * Action字段只允许输入ACCEPT或DROP。 // * CidrBlock, SecurityGroupId, AddressTemplate三者是排他关系,不允许同时输入,Protocol + Port和ServiceTemplate二者是排他关系,不允许同时输入。 // * 一次请求中只能创建单个方向的规则, 如果需要指定索引(PolicyIndex)参数, 多条规则的索引必须一致。 @@ -652,7 +815,7 @@ func NewCreateServiceTemplateResponse() (response *CreateServiceTemplateResponse return } -// 创建协议端口模板 +// 本接口(CreateServiceTemplate)用于创建协议端口模板 func (c *Client) CreateServiceTemplate(request *CreateServiceTemplateRequest) (response *CreateServiceTemplateResponse, err error) { if request == nil { request = NewCreateServiceTemplateRequest() @@ -677,7 +840,7 @@ func NewCreateServiceTemplateGroupResponse() (response *CreateServiceTemplateGro return } -// 创建协议端口模板集合 +// 本接口(CreateServiceTemplateGroup)用于创建协议端口模板集合 func (c *Client) CreateServiceTemplateGroup(request *CreateServiceTemplateGroupRequest) (response *CreateServiceTemplateGroupResponse, err error) { if request == nil { request = NewCreateServiceTemplateGroupRequest() @@ -717,6 +880,36 @@ func (c *Client) CreateSubnet(request *CreateSubnetRequest) (response *CreateSub return } +func NewCreateSubnetsRequest() (request *CreateSubnetsRequest) { + request = &CreateSubnetsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "CreateSubnets") + return +} + +func NewCreateSubnetsResponse() (response *CreateSubnetsResponse) { + response = &CreateSubnetsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(CreateSubnets)用于批量创建子网。 +// * 创建子网前必须创建好 VPC。 +// * 子网创建成功后,子网网段不能修改。子网网段必须在VPC网段内,可以和VPC网段相同(VPC有且只有一个子网时),建议子网网段在VPC网段内,预留网段给其他子网使用。 +// * 你可以创建的最小网段子网掩码为28(有16个IP地址),最大网段子网掩码为16(65,536个IP地址)。 +// * 同一个VPC内,多个子网的网段不能重叠。 +// * 子网创建后会自动关联到默认路由表。 +func (c *Client) CreateSubnets(request *CreateSubnetsRequest) (response *CreateSubnetsResponse, err error) { + if request == nil { + request = NewCreateSubnetsRequest() + } + response = NewCreateSubnetsResponse() + err = c.Send(request, response) + return +} + func NewCreateVpcRequest() (request *CreateVpcRequest) { request = &CreateVpcRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -784,7 +977,7 @@ func NewCreateVpnGatewayResponse() (response *CreateVpnGatewayResponse) { return } -// 本接口(CreateVpnGateways)用于创建VPN网关。 +// 本接口(CreateVpnGateway)用于创建VPN网关。 func (c *Client) CreateVpnGateway(request *CreateVpnGatewayRequest) (response *CreateVpnGatewayResponse, err error) { if request == nil { request = NewCreateVpnGatewayRequest() @@ -809,7 +1002,7 @@ func NewDeleteAddressTemplateResponse() (response *DeleteAddressTemplateResponse return } -// 删除IP地址模板 +// 本接口(DeleteAddressTemplate)用于删除IP地址模板 func (c *Client) DeleteAddressTemplate(request *DeleteAddressTemplateRequest) (response *DeleteAddressTemplateResponse, err error) { if request == nil { request = NewDeleteAddressTemplateRequest() @@ -834,7 +1027,7 @@ func NewDeleteAddressTemplateGroupResponse() (response *DeleteAddressTemplateGro return } -// 删除IP地址模板集合 +// 本接口(DeleteAddressTemplateGroup)用于删除IP地址模板集合 func (c *Client) DeleteAddressTemplateGroup(request *DeleteAddressTemplateGroupRequest) (response *DeleteAddressTemplateGroupResponse, err error) { if request == nil { request = NewDeleteAddressTemplateGroupRequest() @@ -974,6 +1167,31 @@ func (c *Client) DeleteDirectConnectGatewayCcnRoutes(request *DeleteDirectConnec return } +func NewDeleteFlowLogRequest() (request *DeleteFlowLogRequest) { + request = &DeleteFlowLogRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "DeleteFlowLog") + return +} + +func NewDeleteFlowLogResponse() (response *DeleteFlowLogResponse) { + response = &DeleteFlowLogResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(DeleteFlowLog)用于删除流日志 +func (c *Client) DeleteFlowLog(request *DeleteFlowLogRequest) (response *DeleteFlowLogResponse, err error) { + if request == nil { + request = NewDeleteFlowLogRequest() + } + response = NewDeleteFlowLogResponse() + err = c.Send(request, response) + return +} + func NewDeleteHaVipRequest() (request *DeleteHaVipRequest) { request = &DeleteHaVipRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -1000,6 +1218,32 @@ func (c *Client) DeleteHaVip(request *DeleteHaVipRequest) (response *DeleteHaVip return } +func NewDeleteIp6TranslatorsRequest() (request *DeleteIp6TranslatorsRequest) { + request = &DeleteIp6TranslatorsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "DeleteIp6Translators") + return +} + +func NewDeleteIp6TranslatorsResponse() (response *DeleteIp6TranslatorsResponse) { + response = &DeleteIp6TranslatorsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 1. 该接口用于释放IPV6转换实例,支持批量。 +// 2. 如果IPV6转换实例建立有转换规则,会一并删除。 +func (c *Client) DeleteIp6Translators(request *DeleteIp6TranslatorsRequest) (response *DeleteIp6TranslatorsResponse, err error) { + if request == nil { + request = NewDeleteIp6TranslatorsRequest() + } + response = NewDeleteIp6TranslatorsResponse() + err = c.Send(request, response) + return +} + func NewDeleteNetworkInterfaceRequest() (request *DeleteNetworkInterfaceRequest) { request = &DeleteNetworkInterfaceRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -1146,7 +1390,7 @@ func NewDeleteServiceTemplateResponse() (response *DeleteServiceTemplateResponse return } -// 删除协议端口模板 +// 本接口(DeleteServiceTemplate)用于删除协议端口模板 func (c *Client) DeleteServiceTemplate(request *DeleteServiceTemplateRequest) (response *DeleteServiceTemplateResponse, err error) { if request == nil { request = NewDeleteServiceTemplateRequest() @@ -1171,7 +1415,7 @@ func NewDeleteServiceTemplateGroupResponse() (response *DeleteServiceTemplateGro return } -// 删除协议端口模板集合 +// 本接口(DeleteServiceTemplateGroup)用于删除协议端口模板集合 func (c *Client) DeleteServiceTemplateGroup(request *DeleteServiceTemplateGroupRequest) (response *DeleteServiceTemplateGroupResponse, err error) { if request == nil { request = NewDeleteServiceTemplateGroupRequest() @@ -1349,7 +1593,7 @@ func NewDescribeAddressTemplateGroupsResponse() (response *DescribeAddressTempla return } -// 查询IP地址模板集合 +// 本接口(DescribeAddressTemplateGroups)用于查询IP地址模板集合 func (c *Client) DescribeAddressTemplateGroups(request *DescribeAddressTemplateGroupsRequest) (response *DescribeAddressTemplateGroupsResponse, err error) { if request == nil { request = NewDescribeAddressTemplateGroupsRequest() @@ -1374,7 +1618,7 @@ func NewDescribeAddressTemplatesResponse() (response *DescribeAddressTemplatesRe return } -// 查询IP地址模板 +// 本接口(DescribeAddressTemplates)用于查询IP地址模板 func (c *Client) DescribeAddressTemplates(request *DescribeAddressTemplatesRequest) (response *DescribeAddressTemplatesResponse, err error) { if request == nil { request = NewDescribeAddressTemplatesRequest() @@ -1685,6 +1929,83 @@ func (c *Client) DescribeDirectConnectGateways(request *DescribeDirectConnectGat return } +func NewDescribeFlowLogRequest() (request *DescribeFlowLogRequest) { + request = &DescribeFlowLogRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "DescribeFlowLog") + return +} + +func NewDescribeFlowLogResponse() (response *DescribeFlowLogResponse) { + response = &DescribeFlowLogResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(DescribeFlowLog)用于查询流日志实例信息 +func (c *Client) DescribeFlowLog(request *DescribeFlowLogRequest) (response *DescribeFlowLogResponse, err error) { + if request == nil { + request = NewDescribeFlowLogRequest() + } + response = NewDescribeFlowLogResponse() + err = c.Send(request, response) + return +} + +func NewDescribeFlowLogsRequest() (request *DescribeFlowLogsRequest) { + request = &DescribeFlowLogsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "DescribeFlowLogs") + return +} + +func NewDescribeFlowLogsResponse() (response *DescribeFlowLogsResponse) { + response = &DescribeFlowLogsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(DescribeFlowLogs)用于查询获取流日志集合 +func (c *Client) DescribeFlowLogs(request *DescribeFlowLogsRequest) (response *DescribeFlowLogsResponse, err error) { + if request == nil { + request = NewDescribeFlowLogsRequest() + } + response = NewDescribeFlowLogsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeGatewayFlowMonitorDetailRequest() (request *DescribeGatewayFlowMonitorDetailRequest) { + request = &DescribeGatewayFlowMonitorDetailRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "DescribeGatewayFlowMonitorDetail") + return +} + +func NewDescribeGatewayFlowMonitorDetailResponse() (response *DescribeGatewayFlowMonitorDetailResponse) { + response = &DescribeGatewayFlowMonitorDetailResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(DescribeGatewayFlowMonitorDetail)用于查询网关流量监控明细。 +// * 只支持单个网关实例查询。即入参 `VpnId` `DirectConnectGatewayId` `PeeringConnectionId` `NatId` 最多只支持传一个,且必须传一个。 +// * 如果网关有流量,但调用本接口没有返回数据,请在控制台对应网关详情页确认是否开启网关流量监控。 +func (c *Client) DescribeGatewayFlowMonitorDetail(request *DescribeGatewayFlowMonitorDetailRequest) (response *DescribeGatewayFlowMonitorDetailResponse, err error) { + if request == nil { + request = NewDescribeGatewayFlowMonitorDetailRequest() + } + response = NewDescribeGatewayFlowMonitorDetailResponse() + err = c.Send(request, response) + return +} + func NewDescribeHaVipsRequest() (request *DescribeHaVipsRequest) { request = &DescribeHaVipsRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -1710,6 +2031,57 @@ func (c *Client) DescribeHaVips(request *DescribeHaVipsRequest) (response *Descr return } +func NewDescribeIp6TranslatorQuotaRequest() (request *DescribeIp6TranslatorQuotaRequest) { + request = &DescribeIp6TranslatorQuotaRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "DescribeIp6TranslatorQuota") + return +} + +func NewDescribeIp6TranslatorQuotaResponse() (response *DescribeIp6TranslatorQuotaResponse) { + response = &DescribeIp6TranslatorQuotaResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询账户在指定地域IPV6转换实例和规则的配额 +func (c *Client) DescribeIp6TranslatorQuota(request *DescribeIp6TranslatorQuotaRequest) (response *DescribeIp6TranslatorQuotaResponse, err error) { + if request == nil { + request = NewDescribeIp6TranslatorQuotaRequest() + } + response = NewDescribeIp6TranslatorQuotaResponse() + err = c.Send(request, response) + return +} + +func NewDescribeIp6TranslatorsRequest() (request *DescribeIp6TranslatorsRequest) { + request = &DescribeIp6TranslatorsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "DescribeIp6Translators") + return +} + +func NewDescribeIp6TranslatorsResponse() (response *DescribeIp6TranslatorsResponse) { + response = &DescribeIp6TranslatorsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 1. 该接口用于查询账户下的IPV6转换实例及其绑定的转换规则信息 +// 2. 支持过滤查询 +func (c *Client) DescribeIp6Translators(request *DescribeIp6TranslatorsRequest) (response *DescribeIp6TranslatorsResponse, err error) { + if request == nil { + request = NewDescribeIp6TranslatorsRequest() + } + response = NewDescribeIp6TranslatorsResponse() + err = c.Send(request, response) + return +} + func NewDescribeNetworkInterfacesRequest() (request *DescribeNetworkInterfacesRequest) { request = &DescribeNetworkInterfacesRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -1875,7 +2247,7 @@ func NewDescribeServiceTemplateGroupsResponse() (response *DescribeServiceTempla return } -// 查询协议端口模板集合 +// 本接口(DescribeServiceTemplateGroups)用于查询协议端口模板集合 func (c *Client) DescribeServiceTemplateGroups(request *DescribeServiceTemplateGroupsRequest) (response *DescribeServiceTemplateGroupsResponse, err error) { if request == nil { request = NewDescribeServiceTemplateGroupsRequest() @@ -1900,7 +2272,7 @@ func NewDescribeServiceTemplatesResponse() (response *DescribeServiceTemplatesRe return } -// 查询协议端口模板 +// 本接口(DescribeServiceTemplates)用于查询协议端口模板 func (c *Client) DescribeServiceTemplates(request *DescribeServiceTemplatesRequest) (response *DescribeServiceTemplatesResponse, err error) { if request == nil { request = NewDescribeServiceTemplatesRequest() @@ -1935,6 +2307,58 @@ func (c *Client) DescribeSubnets(request *DescribeSubnetsRequest) (response *Des return } +func NewDescribeVpcIpv6AddressesRequest() (request *DescribeVpcIpv6AddressesRequest) { + request = &DescribeVpcIpv6AddressesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "DescribeVpcIpv6Addresses") + return +} + +func NewDescribeVpcIpv6AddressesResponse() (response *DescribeVpcIpv6AddressesResponse) { + response = &DescribeVpcIpv6AddressesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(DescribeVpcIpv6Addresses)用于查询 `VPC` `IPv6` 信息。 +// 只能查询已使用的`IPv6`信息,当查询未使用的IP时,本接口不会报错,但不会出现在返回结果里。 +func (c *Client) DescribeVpcIpv6Addresses(request *DescribeVpcIpv6AddressesRequest) (response *DescribeVpcIpv6AddressesResponse, err error) { + if request == nil { + request = NewDescribeVpcIpv6AddressesRequest() + } + response = NewDescribeVpcIpv6AddressesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeVpcPrivateIpAddressesRequest() (request *DescribeVpcPrivateIpAddressesRequest) { + request = &DescribeVpcPrivateIpAddressesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "DescribeVpcPrivateIpAddresses") + return +} + +func NewDescribeVpcPrivateIpAddressesResponse() (response *DescribeVpcPrivateIpAddressesResponse) { + response = &DescribeVpcPrivateIpAddressesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(DescribeVpcPrivateIpAddresses)用于查询VPC内网IP信息。
    +// 只能查询已使用的IP信息,当查询未使用的IP时,本接口不会报错,但不会出现在返回结果里。 +func (c *Client) DescribeVpcPrivateIpAddresses(request *DescribeVpcPrivateIpAddressesRequest) (response *DescribeVpcPrivateIpAddressesResponse, err error) { + if request == nil { + request = NewDescribeVpcPrivateIpAddressesRequest() + } + response = NewDescribeVpcPrivateIpAddressesResponse() + err = c.Send(request, response) + return +} + func NewDescribeVpcsRequest() (request *DescribeVpcsRequest) { request = &DescribeVpcsRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -2152,6 +2576,8 @@ func NewDisassociateAddressResponse() (response *DisassociateAddressResponse) { } // 本接口 (DisassociateAddress) 用于解绑[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)。 +// * 支持CVM实例,弹性网卡上的EIP解绑 +// * 不支持NAT上的EIP解绑。NAT上的EIP解绑请参考[EipUnBindNatGateway](https://cloud.tencent.com/document/product/215/4092) // * 只有状态为 BIND 和 BIND_ENI 的 EIP 才能进行解绑定操作。 // * EIP 如果被封堵,则不能进行解绑定操作。 func (c *Client) DisassociateAddress(request *DisassociateAddressRequest) (response *DisassociateAddressResponse, err error) { @@ -2460,7 +2886,7 @@ func NewModifyAddressTemplateAttributeResponse() (response *ModifyAddressTemplat return } -// 修改IP地址模板 +// 本接口(ModifyAddressTemplateAttribute)用于修改IP地址模板 func (c *Client) ModifyAddressTemplateAttribute(request *ModifyAddressTemplateAttributeRequest) (response *ModifyAddressTemplateAttributeResponse, err error) { if request == nil { request = NewModifyAddressTemplateAttributeRequest() @@ -2485,7 +2911,7 @@ func NewModifyAddressTemplateGroupAttributeResponse() (response *ModifyAddressTe return } -// 修改IP地址模板集合 +// 本接口(ModifyAddressTemplateGroupAttribute)用于修改IP地址模板集合 func (c *Client) ModifyAddressTemplateGroupAttribute(request *ModifyAddressTemplateGroupAttributeRequest) (response *ModifyAddressTemplateGroupAttributeResponse, err error) { if request == nil { request = NewModifyAddressTemplateGroupAttributeRequest() @@ -2510,7 +2936,7 @@ func NewModifyAddressesBandwidthResponse() (response *ModifyAddressesBandwidthRe return } -// 接口用于调整[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称EIP)带宽,包括后付费EIP, 预付费EIP和带宽包EIP +// 本接口(ModifyAddressesBandwidth)用于调整[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称EIP)带宽,包括后付费EIP, 预付费EIP和带宽包EIP func (c *Client) ModifyAddressesBandwidth(request *ModifyAddressesBandwidthRequest) (response *ModifyAddressesBandwidthResponse, err error) { if request == nil { request = NewModifyAddressesBandwidthRequest() @@ -2620,6 +3046,31 @@ func (c *Client) ModifyDirectConnectGatewayAttribute(request *ModifyDirectConnec return } +func NewModifyFlowLogAttributeRequest() (request *ModifyFlowLogAttributeRequest) { + request = &ModifyFlowLogAttributeRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "ModifyFlowLogAttribute") + return +} + +func NewModifyFlowLogAttributeResponse() (response *ModifyFlowLogAttributeResponse) { + response = &ModifyFlowLogAttributeResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(ModifyFlowLogAttribute)用于修改流日志属性 +func (c *Client) ModifyFlowLogAttribute(request *ModifyFlowLogAttributeRequest) (response *ModifyFlowLogAttributeResponse, err error) { + if request == nil { + request = NewModifyFlowLogAttributeRequest() + } + response = NewModifyFlowLogAttributeResponse() + err = c.Send(request, response) + return +} + func NewModifyHaVipAttributeRequest() (request *ModifyHaVipAttributeRequest) { request = &ModifyHaVipAttributeRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -2645,6 +3096,81 @@ func (c *Client) ModifyHaVipAttribute(request *ModifyHaVipAttributeRequest) (res return } +func NewModifyIp6RuleRequest() (request *ModifyIp6RuleRequest) { + request = &ModifyIp6RuleRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "ModifyIp6Rule") + return +} + +func NewModifyIp6RuleResponse() (response *ModifyIp6RuleResponse) { + response = &ModifyIp6RuleResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 该接口用于修改IPV6转换规则,当前仅支持修改转换规则名称,IPV4地址和IPV4端口号 +func (c *Client) ModifyIp6Rule(request *ModifyIp6RuleRequest) (response *ModifyIp6RuleResponse, err error) { + if request == nil { + request = NewModifyIp6RuleRequest() + } + response = NewModifyIp6RuleResponse() + err = c.Send(request, response) + return +} + +func NewModifyIp6TranslatorRequest() (request *ModifyIp6TranslatorRequest) { + request = &ModifyIp6TranslatorRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "ModifyIp6Translator") + return +} + +func NewModifyIp6TranslatorResponse() (response *ModifyIp6TranslatorResponse) { + response = &ModifyIp6TranslatorResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 该接口用于修改IP6转换实例属性,当前仅支持修改实例名称。 +func (c *Client) ModifyIp6Translator(request *ModifyIp6TranslatorRequest) (response *ModifyIp6TranslatorResponse, err error) { + if request == nil { + request = NewModifyIp6TranslatorRequest() + } + response = NewModifyIp6TranslatorResponse() + err = c.Send(request, response) + return +} + +func NewModifyIpv6AddressesAttributeRequest() (request *ModifyIpv6AddressesAttributeRequest) { + request = &ModifyIpv6AddressesAttributeRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "ModifyIpv6AddressesAttribute") + return +} + +func NewModifyIpv6AddressesAttributeResponse() (response *ModifyIpv6AddressesAttributeResponse) { + response = &ModifyIpv6AddressesAttributeResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(ModifyIpv6AddressesAttribute)用于修改弹性网卡内网IPv6地址属性。 +func (c *Client) ModifyIpv6AddressesAttribute(request *ModifyIpv6AddressesAttributeRequest) (response *ModifyIpv6AddressesAttributeResponse, err error) { + if request == nil { + request = NewModifyIpv6AddressesAttributeRequest() + } + response = NewModifyIpv6AddressesAttributeResponse() + err = c.Send(request, response) + return +} + func NewModifyNetworkInterfaceAttributeRequest() (request *ModifyNetworkInterfaceAttributeRequest) { request = &ModifyNetworkInterfaceAttributeRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -2794,7 +3320,7 @@ func NewModifyServiceTemplateAttributeResponse() (response *ModifyServiceTemplat return } -// 修改协议端口模板 +// 本接口(ModifyServiceTemplateAttribute)用于修改协议端口模板 func (c *Client) ModifyServiceTemplateAttribute(request *ModifyServiceTemplateAttributeRequest) (response *ModifyServiceTemplateAttributeResponse, err error) { if request == nil { request = NewModifyServiceTemplateAttributeRequest() @@ -3006,6 +3532,32 @@ func (c *Client) RemoveBandwidthPackageResources(request *RemoveBandwidthPackage return } +func NewRemoveIp6RulesRequest() (request *RemoveIp6RulesRequest) { + request = &RemoveIp6RulesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "RemoveIp6Rules") + return +} + +func NewRemoveIp6RulesResponse() (response *RemoveIp6RulesResponse) { + response = &RemoveIp6RulesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 1. 该接口用于删除IPV6转换规则 +// 2. 支持批量删除同一个转换实例下的多个转换规则 +func (c *Client) RemoveIp6Rules(request *RemoveIp6RulesRequest) (response *RemoveIp6RulesResponse, err error) { + if request == nil { + request = NewRemoveIp6RulesRequest() + } + response = NewRemoveIp6RulesResponse() + err = c.Send(request, response) + return +} + func NewRenewVpnGatewayRequest() (request *RenewVpnGatewayRequest) { request = &RenewVpnGatewayRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -3285,6 +3837,84 @@ func (c *Client) TransformAddress(request *TransformAddressRequest) (response *T return } +func NewUnassignIpv6AddressesRequest() (request *UnassignIpv6AddressesRequest) { + request = &UnassignIpv6AddressesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "UnassignIpv6Addresses") + return +} + +func NewUnassignIpv6AddressesResponse() (response *UnassignIpv6AddressesResponse) { + response = &UnassignIpv6AddressesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(UnassignIpv6Addresses)用于释放弹性网卡`IPv6`地址。
    +// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口。 +func (c *Client) UnassignIpv6Addresses(request *UnassignIpv6AddressesRequest) (response *UnassignIpv6AddressesResponse, err error) { + if request == nil { + request = NewUnassignIpv6AddressesRequest() + } + response = NewUnassignIpv6AddressesResponse() + err = c.Send(request, response) + return +} + +func NewUnassignIpv6CidrBlockRequest() (request *UnassignIpv6CidrBlockRequest) { + request = &UnassignIpv6CidrBlockRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "UnassignIpv6CidrBlock") + return +} + +func NewUnassignIpv6CidrBlockResponse() (response *UnassignIpv6CidrBlockResponse) { + response = &UnassignIpv6CidrBlockResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(UnassignIpv6CidrBlock)用于释放IPv6网段。
    +// 网段如果还有IP占用且未回收,则网段无法释放。 +func (c *Client) UnassignIpv6CidrBlock(request *UnassignIpv6CidrBlockRequest) (response *UnassignIpv6CidrBlockResponse, err error) { + if request == nil { + request = NewUnassignIpv6CidrBlockRequest() + } + response = NewUnassignIpv6CidrBlockResponse() + err = c.Send(request, response) + return +} + +func NewUnassignIpv6SubnetCidrBlockRequest() (request *UnassignIpv6SubnetCidrBlockRequest) { + request = &UnassignIpv6SubnetCidrBlockRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("vpc", APIVersion, "UnassignIpv6SubnetCidrBlock") + return +} + +func NewUnassignIpv6SubnetCidrBlockResponse() (response *UnassignIpv6SubnetCidrBlockResponse) { + response = &UnassignIpv6SubnetCidrBlockResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 本接口(UnassignIpv6SubnetCidrBlock)用于释放IPv6子网段。
    +// 子网段如果还有IP占用且未回收,则子网段无法释放。 +func (c *Client) UnassignIpv6SubnetCidrBlock(request *UnassignIpv6SubnetCidrBlockRequest) (response *UnassignIpv6SubnetCidrBlockResponse, err error) { + if request == nil { + request = NewUnassignIpv6SubnetCidrBlockRequest() + } + response = NewUnassignIpv6SubnetCidrBlockResponse() + err = c.Send(request, response) + return +} + func NewUnassignPrivateIpAddressesRequest() (request *UnassignPrivateIpAddressesRequest) { request = &UnassignPrivateIpAddressesRequest{ BaseRequest: &tchttp.BaseRequest{}, diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/models.go index b1428ff58..f12064b1b 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/models.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/models.go @@ -24,10 +24,10 @@ type AcceptAttachCcnInstancesRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // 接受关联实例列表。 - Instances []*CcnInstance `json:"Instances" name:"Instances" list` + Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list` } func (r *AcceptAttachCcnInstancesRequest) ToJsonString() string { @@ -44,7 +44,7 @@ type AcceptAttachCcnInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -60,26 +60,26 @@ func (r *AcceptAttachCcnInstancesResponse) FromJsonString(s string) error { type AccountAttribute struct { // 属性名 - AttributeName *string `json:"AttributeName" name:"AttributeName"` + AttributeName *string `json:"AttributeName,omitempty" name:"AttributeName"` // 属性值 - AttributeValues []*string `json:"AttributeValues" name:"AttributeValues" list` + AttributeValues []*string `json:"AttributeValues,omitempty" name:"AttributeValues" list` } type AddBandwidthPackageResourcesRequest struct { *tchttp.BaseRequest // 资源Id,形如'eip-xxxx', 'lb-xxxx' - ResourceIds []*string `json:"ResourceIds" name:"ResourceIds" list` + ResourceIds []*string `json:"ResourceIds,omitempty" name:"ResourceIds" list` // 带宽包唯一标识ID,形如'bwp-xxxx' - BandwidthPackageId *string `json:"BandwidthPackageId" name:"BandwidthPackageId"` + BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"` // 带宽包类型,包括'BGP', 'SINGLEISP', 'ANYCAST' - NetworkType *string `json:"NetworkType" name:"NetworkType"` + NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"` // 资源类型,包括'Address', 'LoadBalance' - ResourceType *string `json:"ResourceType" name:"ResourceType"` + ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"` } func (r *AddBandwidthPackageResourcesRequest) ToJsonString() string { @@ -96,7 +96,7 @@ type AddBandwidthPackageResourcesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -109,92 +109,135 @@ func (r *AddBandwidthPackageResourcesResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type AddIp6RulesRequest struct { + *tchttp.BaseRequest + + // IPV6转换实例唯一ID,形如ip6-xxxxxxxx + Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"` + + // IPV6转换规则信息 + Ip6RuleInfos []*Ip6RuleInfo `json:"Ip6RuleInfos,omitempty" name:"Ip6RuleInfos" list` + + // IPV6转换规则名称 + Ip6RuleName *string `json:"Ip6RuleName,omitempty" name:"Ip6RuleName"` +} + +func (r *AddIp6RulesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *AddIp6RulesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type AddIp6RulesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // IPV6转换规则唯一ID数组,形如rule6-xxxxxxxx + Ip6RuleSet []*string `json:"Ip6RuleSet,omitempty" name:"Ip6RuleSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *AddIp6RulesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *AddIp6RulesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type Address struct { // `EIP`的`ID`,是`EIP`的唯一标识。 - AddressId *string `json:"AddressId" name:"AddressId"` + AddressId *string `json:"AddressId,omitempty" name:"AddressId"` // `EIP`名称。 - AddressName *string `json:"AddressName" name:"AddressName"` + AddressName *string `json:"AddressName,omitempty" name:"AddressName"` // `EIP`状态。 - AddressStatus *string `json:"AddressStatus" name:"AddressStatus"` + AddressStatus *string `json:"AddressStatus,omitempty" name:"AddressStatus"` // 外网IP地址 - AddressIp *string `json:"AddressIp" name:"AddressIp"` + AddressIp *string `json:"AddressIp,omitempty" name:"AddressIp"` // 绑定的资源实例`ID`。可能是一个`CVM`,`NAT`。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 创建时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` // 绑定的弹性网卡ID - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // 绑定的资源内网ip - PrivateAddressIp *string `json:"PrivateAddressIp" name:"PrivateAddressIp"` + PrivateAddressIp *string `json:"PrivateAddressIp,omitempty" name:"PrivateAddressIp"` - // 资源隔离状态。true表示eip处于隔离状态,false表示资源处于未隔离装填 - IsArrears *bool `json:"IsArrears" name:"IsArrears"` + // 资源隔离状态。true表示eip处于隔离状态,false表示资源处于未隔离状态 + IsArrears *bool `json:"IsArrears,omitempty" name:"IsArrears"` // 资源封堵状态。true表示eip处于封堵状态,false表示eip处于未封堵状态 - IsBlocked *bool `json:"IsBlocked" name:"IsBlocked"` + IsBlocked *bool `json:"IsBlocked,omitempty" name:"IsBlocked"` // eip是否支持直通模式。true表示eip支持直通模式,false表示资源不支持直通模式 - IsEipDirectConnection *bool `json:"IsEipDirectConnection" name:"IsEipDirectConnection"` + IsEipDirectConnection *bool `json:"IsEipDirectConnection,omitempty" name:"IsEipDirectConnection"` // eip资源类型,包括"CalcIP","WanIP","EIP","AnycastEIP"。其中"CalcIP"表示设备ip,“WanIP”表示普通公网ip,“EIP”表示弹性公网ip,“AnycastEip”表示加速EIP - AddressType *string `json:"AddressType" name:"AddressType"` + AddressType *string `json:"AddressType,omitempty" name:"AddressType"` // eip是否在解绑后自动释放。true表示eip将会在解绑后自动释放,false表示eip在解绑后不会自动释放 - CascadeRelease *bool `json:"CascadeRelease" name:"CascadeRelease"` + CascadeRelease *bool `json:"CascadeRelease,omitempty" name:"CascadeRelease"` } type AddressTemplate struct { // IP地址模板名称。 - AddressTemplateName *string `json:"AddressTemplateName" name:"AddressTemplateName"` + AddressTemplateName *string `json:"AddressTemplateName,omitempty" name:"AddressTemplateName"` // IP地址模板实例唯一ID。 - AddressTemplateId *string `json:"AddressTemplateId" name:"AddressTemplateId"` + AddressTemplateId *string `json:"AddressTemplateId,omitempty" name:"AddressTemplateId"` // IP地址信息。 - AddressSet []*string `json:"AddressSet" name:"AddressSet" list` + AddressSet []*string `json:"AddressSet,omitempty" name:"AddressSet" list` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type AddressTemplateGroup struct { // IP地址模板集合名称。 - AddressTemplateGroupName *string `json:"AddressTemplateGroupName" name:"AddressTemplateGroupName"` + AddressTemplateGroupName *string `json:"AddressTemplateGroupName,omitempty" name:"AddressTemplateGroupName"` // IP地址模板集合实例ID,例如:ipmg-dih8xdbq。 - AddressTemplateGroupId *string `json:"AddressTemplateGroupId" name:"AddressTemplateGroupId"` + AddressTemplateGroupId *string `json:"AddressTemplateGroupId,omitempty" name:"AddressTemplateGroupId"` // IP地址模板ID。 - AddressTemplateIdSet []*string `json:"AddressTemplateIdSet" name:"AddressTemplateIdSet" list` + AddressTemplateIdSet []*string `json:"AddressTemplateIdSet,omitempty" name:"AddressTemplateIdSet" list` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type AddressTemplateSpecification struct { // IP地址ID,例如:ipm-2uw6ujo6。 - AddressId *string `json:"AddressId" name:"AddressId"` + AddressId *string `json:"AddressId,omitempty" name:"AddressId"` // IP地址组ID,例如:ipmg-2uw6ujo6。 - AddressGroupId *string `json:"AddressGroupId" name:"AddressGroupId"` + AddressGroupId *string `json:"AddressGroupId,omitempty" name:"AddressGroupId"` } type AllocateAddressesRequest struct { *tchttp.BaseRequest // 申请 EIP 数量,默认值为1。 - AddressCount *int64 `json:"AddressCount" name:"AddressCount"` + AddressCount *int64 `json:"AddressCount,omitempty" name:"AddressCount"` } func (r *AllocateAddressesRequest) ToJsonString() string { @@ -211,10 +254,10 @@ type AllocateAddressesResponse struct { Response *struct { // 申请到的 EIP 的唯一 ID 列表。 - AddressSet []*string `json:"AddressSet" name:"AddressSet" list` + AddressSet []*string `json:"AddressSet,omitempty" name:"AddressSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -227,17 +270,137 @@ func (r *AllocateAddressesResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type AssignIpv6AddressesRequest struct { + *tchttp.BaseRequest + + // 弹性网卡实例`ID`,形如:`eni-m6dyj72l`。 + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` + + // 指定的`IPv6`地址列表,单次最多指定10个。与入参`Ipv6AddressCount`合并计算配额。 + Ipv6Addresses []*Ipv6Address `json:"Ipv6Addresses,omitempty" name:"Ipv6Addresses" list` + + // 自动分配`IPv6`地址个数,内网IP地址个数总和不能超过配数。与入参`Ipv6Addresses`合并计算配额。 + Ipv6AddressCount *uint64 `json:"Ipv6AddressCount,omitempty" name:"Ipv6AddressCount"` +} + +func (r *AssignIpv6AddressesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *AssignIpv6AddressesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type AssignIpv6AddressesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 分配给弹性网卡的`IPv6`地址列表。 + Ipv6AddressSet []*Ipv6Address `json:"Ipv6AddressSet,omitempty" name:"Ipv6AddressSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *AssignIpv6AddressesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *AssignIpv6AddressesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type AssignIpv6CidrBlockRequest struct { + *tchttp.BaseRequest + + // `VPC`实例`ID`,形如:`vpc-f49l6u0z`。 + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` +} + +func (r *AssignIpv6CidrBlockRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *AssignIpv6CidrBlockRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type AssignIpv6CidrBlockResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 分配的 `IPv6` 网段。形如:`3402:4e00:20:1000::/56` + Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *AssignIpv6CidrBlockResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *AssignIpv6CidrBlockResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type AssignIpv6SubnetCidrBlockRequest struct { + *tchttp.BaseRequest + + // 子网所在私有网络`ID`。形如:`vpc-f49l6u0z`。 + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // 分配 `IPv6` 子网段列表。 + Ipv6SubnetCidrBlocks []*Ipv6SubnetCidrBlock `json:"Ipv6SubnetCidrBlocks,omitempty" name:"Ipv6SubnetCidrBlocks" list` +} + +func (r *AssignIpv6SubnetCidrBlockRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *AssignIpv6SubnetCidrBlockRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type AssignIpv6SubnetCidrBlockResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 分配 `IPv6` 子网段列表。 + Ipv6SubnetCidrBlockSet []*Ipv6SubnetCidrBlock `json:"Ipv6SubnetCidrBlockSet,omitempty" name:"Ipv6SubnetCidrBlockSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *AssignIpv6SubnetCidrBlockResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *AssignIpv6SubnetCidrBlockResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type AssignPrivateIpAddressesRequest struct { *tchttp.BaseRequest // 弹性网卡实例ID,例如:eni-m6dyj72l。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // 指定的内网IP信息,单次最多指定10个。 - PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses" name:"PrivateIpAddresses" list` + PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list` // 新申请的内网IP地址个数,内网IP地址个数总和不能超过配数。 - SecondaryPrivateIpAddressCount *uint64 `json:"SecondaryPrivateIpAddressCount" name:"SecondaryPrivateIpAddressCount"` + SecondaryPrivateIpAddressCount *uint64 `json:"SecondaryPrivateIpAddressCount,omitempty" name:"SecondaryPrivateIpAddressCount"` } func (r *AssignPrivateIpAddressesRequest) ToJsonString() string { @@ -254,10 +417,10 @@ type AssignPrivateIpAddressesResponse struct { Response *struct { // 内网IP详细信息。 - PrivateIpAddressSet []*PrivateIpAddressSpecification `json:"PrivateIpAddressSet" name:"PrivateIpAddressSet" list` + PrivateIpAddressSet []*PrivateIpAddressSpecification `json:"PrivateIpAddressSet,omitempty" name:"PrivateIpAddressSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -274,16 +437,16 @@ type AssociateAddressRequest struct { *tchttp.BaseRequest // 标识 EIP 的唯一 ID。EIP 唯一 ID 形如:`eip-11112222`。 - AddressId *string `json:"AddressId" name:"AddressId"` + AddressId *string `json:"AddressId,omitempty" name:"AddressId"` // 要绑定的实例 ID。实例 ID 形如:`ins-11112222`。可通过登录[控制台](https://console.cloud.tencent.com/cvm)查询,也可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) 接口返回值中的`InstanceId`获取。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 要绑定的弹性网卡 ID。 弹性网卡 ID 形如:`eni-11112222`。`NetworkInterfaceId` 与 `InstanceId` 不可同时指定。弹性网卡 ID 可通过登录[控制台](https://console.cloud.tencent.com/vpc/eni)查询,也可通过[DescribeNetworkInterfaces](https://cloud.tencent.com/document/api/215/15817)接口返回值中的`networkInterfaceId`获取。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // 要绑定的内网 IP。如果指定了 `NetworkInterfaceId` 则也必须指定 `PrivateIpAddress` ,表示将 EIP 绑定到指定弹性网卡的指定内网 IP 上。同时要确保指定的 `PrivateIpAddress` 是指定的 `NetworkInterfaceId` 上的一个内网 IP。指定弹性网卡的内网 IP 可通过登录[控制台](https://console.cloud.tencent.com/vpc/eni)查询,也可通过[DescribeNetworkInterfaces](https://cloud.tencent.com/document/api/215/15817)接口返回值中的`privateIpAddress`获取。 - PrivateIpAddress *string `json:"PrivateIpAddress" name:"PrivateIpAddress"` + PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"` } func (r *AssociateAddressRequest) ToJsonString() string { @@ -300,7 +463,7 @@ type AssociateAddressResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -317,13 +480,13 @@ type AttachCcnInstancesRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // 关联网络实例列表 - Instances []*CcnInstance `json:"Instances" name:"Instances" list` + Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list` // CCN所属UIN(根账号),默认当前账号所属UIN - CcnUin *string `json:"CcnUin" name:"CcnUin"` + CcnUin *string `json:"CcnUin,omitempty" name:"CcnUin"` } func (r *AttachCcnInstancesRequest) ToJsonString() string { @@ -340,7 +503,7 @@ type AttachCcnInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -357,10 +520,10 @@ type AttachClassicLinkVpcRequest struct { *tchttp.BaseRequest // VPC实例ID - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // CVM实例ID - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` } func (r *AttachClassicLinkVpcRequest) ToJsonString() string { @@ -377,7 +540,7 @@ type AttachClassicLinkVpcResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -394,10 +557,10 @@ type AttachNetworkInterfaceRequest struct { *tchttp.BaseRequest // 弹性网卡实例ID,例如:eni-m6dyj72l。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // CVM实例ID。形如:ins-r8hr2upy。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` } func (r *AttachNetworkInterfaceRequest) ToJsonString() string { @@ -414,7 +577,7 @@ type AttachNetworkInterfaceResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -430,79 +593,87 @@ func (r *AttachNetworkInterfaceResponse) FromJsonString(s string) error { type BandwidthPackage struct { // 带宽包唯一标识Id - BandwidthPackageId *string `json:"BandwidthPackageId" name:"BandwidthPackageId"` + BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"` // 带宽包类型,包括'BGP','SINGLEISP','ANYCAST' - NetworkType *string `json:"NetworkType" name:"NetworkType"` + NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"` // 带宽包计费类型,包括'TOP5_POSTPAID_BY_MONTH'和'PERCENT95_POSTPAID_BY_MONTH' - ChargeType *string `json:"ChargeType" name:"ChargeType"` + ChargeType *string `json:"ChargeType,omitempty" name:"ChargeType"` // 带宽包名称 - BandwidthPackageName *string `json:"BandwidthPackageName" name:"BandwidthPackageName"` + BandwidthPackageName *string `json:"BandwidthPackageName,omitempty" name:"BandwidthPackageName"` // 带宽包创建时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` // 带宽包状态,包括'CREATING','CREATED','DELETING','DELETED' - Status *string `json:"Status" name:"Status"` + Status *string `json:"Status,omitempty" name:"Status"` // 带宽包资源信息 - ResourceSet []*Resource `json:"ResourceSet" name:"ResourceSet" list` + ResourceSet []*Resource `json:"ResourceSet,omitempty" name:"ResourceSet" list` // 带宽包限速大小。单位:Mbps,-1表示不限速。 - Bandwidth *int64 `json:"Bandwidth" name:"Bandwidth"` + Bandwidth *int64 `json:"Bandwidth,omitempty" name:"Bandwidth"` } type CCN struct { // 云联网唯一ID - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // 云联网名称 - CcnName *string `json:"CcnName" name:"CcnName"` + CcnName *string `json:"CcnName,omitempty" name:"CcnName"` // 云联网描述信息 - CcnDescription *string `json:"CcnDescription" name:"CcnDescription"` + CcnDescription *string `json:"CcnDescription,omitempty" name:"CcnDescription"` // 关联实例数量 - InstanceCount *uint64 `json:"InstanceCount" name:"InstanceCount"` + InstanceCount *uint64 `json:"InstanceCount,omitempty" name:"InstanceCount"` // 创建时间 - CreateTime *string `json:"CreateTime" name:"CreateTime"` + CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"` // 实例状态, 'ISOLATED': 隔离中(欠费停服),'AVAILABLE':运行中。 - State *string `json:"State" name:"State"` + State *string `json:"State,omitempty" name:"State"` // 实例服务质量,’PT’:白金,'AU':金,'AG':银。 - QosLevel *string `json:"QosLevel" name:"QosLevel"` + QosLevel *string `json:"QosLevel,omitempty" name:"QosLevel"` + + // 付费类型,PREPAID为预付费,POSTPAID为后付费。 + // 注意:此字段可能返回 null,表示取不到有效值。 + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` + + // 限速类型,INTER_REGION_LIMIT为地域间限速;OUTER_REGION_LIMIT为地域出口限速。 + // 注意:此字段可能返回 null,表示取不到有效值。 + BandwidthLimitType *string `json:"BandwidthLimitType,omitempty" name:"BandwidthLimitType"` } type CcnAttachedInstance struct { // 云联网实例ID。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // 关联实例类型: //
  • `VPC`:私有网络
  • //
  • `DIRECTCONNECT`:专线网关
  • //
  • `BMVPC`:黑石私有网络
  • - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` // 关联实例ID。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 关联实例名称。 - InstanceName *string `json:"InstanceName" name:"InstanceName"` + InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"` // 关联实例所属大区,例如:ap-guangzhou。 - InstanceRegion *string `json:"InstanceRegion" name:"InstanceRegion"` + InstanceRegion *string `json:"InstanceRegion,omitempty" name:"InstanceRegion"` // 关联实例所属UIN(根账号)。 - InstanceUin *string `json:"InstanceUin" name:"InstanceUin"` + InstanceUin *string `json:"InstanceUin,omitempty" name:"InstanceUin"` // 关联实例CIDR。 - CidrBlock []*string `json:"CidrBlock" name:"CidrBlock" list` + CidrBlock []*string `json:"CidrBlock,omitempty" name:"CidrBlock" list` // 关联实例状态: //
  • `PENDING`:申请中
  • @@ -510,88 +681,100 @@ type CcnAttachedInstance struct { //
  • `EXPIRED`:已过期
  • //
  • `REJECTED`:已拒绝
  • //
  • `DELETED`:已删除
  • + //
  • `FAILED`:失败的(2小时后将异步强制解关联)
  • //
  • `ATTACHING`:关联中
  • //
  • `DETACHING`:解关联中
  • - State *string `json:"State" name:"State"` + //
  • `DETACHFAILED`:解关联失败(2小时后将异步强制解关联)
  • + State *string `json:"State,omitempty" name:"State"` // 关联时间。 - AttachedTime *string `json:"AttachedTime" name:"AttachedTime"` + AttachedTime *string `json:"AttachedTime,omitempty" name:"AttachedTime"` // 云联网所属UIN(根账号)。 - CcnUin *string `json:"CcnUin" name:"CcnUin"` + CcnUin *string `json:"CcnUin,omitempty" name:"CcnUin"` } type CcnInstance struct { // 关联实例ID。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 关联实例ID所属大区,例如:ap-guangzhou。 - InstanceRegion *string `json:"InstanceRegion" name:"InstanceRegion"` + InstanceRegion *string `json:"InstanceRegion,omitempty" name:"InstanceRegion"` // 关联实例类型,可选值: //
  • `VPC`:私有网络
  • //
  • `DIRECTCONNECT`:专线网关
  • //
  • `BMVPC`:黑石私有网络
  • - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` } type CcnRegionBandwidthLimit struct { // 地域,例如:ap-guangzhou - Region *string `json:"Region" name:"Region"` + Region *string `json:"Region,omitempty" name:"Region"` // 出带宽上限,单位:Mbps - BandwidthLimit *uint64 `json:"BandwidthLimit" name:"BandwidthLimit"` + BandwidthLimit *uint64 `json:"BandwidthLimit,omitempty" name:"BandwidthLimit"` + + // 是否黑石地域,默认`false`。 + IsBm *bool `json:"IsBm,omitempty" name:"IsBm"` + + // 目的地域,例如:ap-shanghai + // 注意:此字段可能返回 null,表示取不到有效值。 + DstRegion *string `json:"DstRegion,omitempty" name:"DstRegion"` + + // 目的地域是否为黑石地域,默认`false`。 + DstIsBm *bool `json:"DstIsBm,omitempty" name:"DstIsBm"` } type CcnRoute struct { // 路由策略ID - RouteId *string `json:"RouteId" name:"RouteId"` + RouteId *string `json:"RouteId,omitempty" name:"RouteId"` // 目的端 - DestinationCidrBlock *string `json:"DestinationCidrBlock" name:"DestinationCidrBlock"` + DestinationCidrBlock *string `json:"DestinationCidrBlock,omitempty" name:"DestinationCidrBlock"` // 下一跳类型(关联实例类型),所有类型:VPC、DIRECTCONNECT - InstanceType *string `json:"InstanceType" name:"InstanceType"` + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` // 下一跳(关联实例) - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 下一跳名称(关联实例名称) - InstanceName *string `json:"InstanceName" name:"InstanceName"` + InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"` // 下一跳所属地域(关联实例所属地域) - InstanceRegion *string `json:"InstanceRegion" name:"InstanceRegion"` + InstanceRegion *string `json:"InstanceRegion,omitempty" name:"InstanceRegion"` // 更新时间 - UpdateTime *string `json:"UpdateTime" name:"UpdateTime"` + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` // 路由是否启用 - Enabled *bool `json:"Enabled" name:"Enabled"` + Enabled *bool `json:"Enabled,omitempty" name:"Enabled"` // 关联实例所属UIN(根账号) - InstanceUin *string `json:"InstanceUin" name:"InstanceUin"` + InstanceUin *string `json:"InstanceUin,omitempty" name:"InstanceUin"` } type ClassicLinkInstance struct { // VPC实例ID - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 云服务器实例唯一ID - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` } type CreateAddressTemplateGroupRequest struct { *tchttp.BaseRequest // IP地址模版集合名称。 - AddressTemplateGroupName *string `json:"AddressTemplateGroupName" name:"AddressTemplateGroupName"` + AddressTemplateGroupName *string `json:"AddressTemplateGroupName,omitempty" name:"AddressTemplateGroupName"` // IP地址模版实例ID,例如:ipm-mdunqeb6。 - AddressTemplateIds []*string `json:"AddressTemplateIds" name:"AddressTemplateIds" list` + AddressTemplateIds []*string `json:"AddressTemplateIds,omitempty" name:"AddressTemplateIds" list` } func (r *CreateAddressTemplateGroupRequest) ToJsonString() string { @@ -608,10 +791,10 @@ type CreateAddressTemplateGroupResponse struct { Response *struct { // IP地址模板集合对象。 - AddressTemplateGroup *AddressTemplateGroup `json:"AddressTemplateGroup" name:"AddressTemplateGroup"` + AddressTemplateGroup *AddressTemplateGroup `json:"AddressTemplateGroup,omitempty" name:"AddressTemplateGroup"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -628,10 +811,10 @@ type CreateAddressTemplateRequest struct { *tchttp.BaseRequest // IP地址模版名称 - AddressTemplateName *string `json:"AddressTemplateName" name:"AddressTemplateName"` + AddressTemplateName *string `json:"AddressTemplateName,omitempty" name:"AddressTemplateName"` // 地址信息,支持 IP、CIDR、IP 范围。 - Addresses []*string `json:"Addresses" name:"Addresses" list` + Addresses []*string `json:"Addresses,omitempty" name:"Addresses" list` } func (r *CreateAddressTemplateRequest) ToJsonString() string { @@ -648,10 +831,10 @@ type CreateAddressTemplateResponse struct { Response *struct { // IP地址模板对象。 - AddressTemplate *AddressTemplate `json:"AddressTemplate" name:"AddressTemplate"` + AddressTemplate *AddressTemplate `json:"AddressTemplate,omitempty" name:"AddressTemplate"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -668,19 +851,19 @@ type CreateBandwidthPackageRequest struct { *tchttp.BaseRequest // 带宽包类型,包括'BGP','SINGLEISP','ANYCAST' - NetworkType *string `json:"NetworkType" name:"NetworkType"` + NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"` // 带宽包计费类型,包括‘TOP5_POSTPAID_BY_MONTH’,‘PERCENT95_POSTPAID_BY_MONTH’ - ChargeType *string `json:"ChargeType" name:"ChargeType"` + ChargeType *string `json:"ChargeType,omitempty" name:"ChargeType"` // 带宽包名字 - BandwidthPackageName *string `json:"BandwidthPackageName" name:"BandwidthPackageName"` + BandwidthPackageName *string `json:"BandwidthPackageName,omitempty" name:"BandwidthPackageName"` // 带宽包数量(非上移账户只能填1) - BandwidthPackageCount *uint64 `json:"BandwidthPackageCount" name:"BandwidthPackageCount"` + BandwidthPackageCount *uint64 `json:"BandwidthPackageCount,omitempty" name:"BandwidthPackageCount"` // 带宽包限速大小。单位:Mbps,-1表示不限速。 - InternetMaxBandwidth *int64 `json:"InternetMaxBandwidth" name:"InternetMaxBandwidth"` + InternetMaxBandwidth *int64 `json:"InternetMaxBandwidth,omitempty" name:"InternetMaxBandwidth"` } func (r *CreateBandwidthPackageRequest) ToJsonString() string { @@ -697,13 +880,13 @@ type CreateBandwidthPackageResponse struct { Response *struct { // 带宽包Id - BandwidthPackageId *string `json:"BandwidthPackageId" name:"BandwidthPackageId"` + BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"` // 带宽包Ids(申请数量大于1时有效) - BandwidthPackageIds []*string `json:"BandwidthPackageIds" name:"BandwidthPackageIds" list` + BandwidthPackageIds []*string `json:"BandwidthPackageIds,omitempty" name:"BandwidthPackageIds" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -720,10 +903,13 @@ type CreateCcnRequest struct { *tchttp.BaseRequest // CCN名称,最大长度不能超过60个字节。 - CcnName *string `json:"CcnName" name:"CcnName"` + CcnName *string `json:"CcnName,omitempty" name:"CcnName"` // CCN描述信息,最大长度不能超过100个字节。 - CcnDescription *string `json:"CcnDescription" name:"CcnDescription"` + CcnDescription *string `json:"CcnDescription,omitempty" name:"CcnDescription"` + + // CCN服务质量,'PT':白金,'AU':金,'AG':银,默认为‘AU’。 + QosLevel *string `json:"QosLevel,omitempty" name:"QosLevel"` } func (r *CreateCcnRequest) ToJsonString() string { @@ -740,10 +926,10 @@ type CreateCcnResponse struct { Response *struct { // 云联网(CCN)对象。 - Ccn *CCN `json:"Ccn" name:"Ccn"` + Ccn *CCN `json:"Ccn,omitempty" name:"Ccn"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -760,10 +946,10 @@ type CreateCustomerGatewayRequest struct { *tchttp.BaseRequest // 对端网关名称,可任意命名,但不得超过60个字符。 - CustomerGatewayName *string `json:"CustomerGatewayName" name:"CustomerGatewayName"` + CustomerGatewayName *string `json:"CustomerGatewayName,omitempty" name:"CustomerGatewayName"` // 对端网关公网IP。 - IpAddress *string `json:"IpAddress" name:"IpAddress"` + IpAddress *string `json:"IpAddress,omitempty" name:"IpAddress"` } func (r *CreateCustomerGatewayRequest) ToJsonString() string { @@ -780,10 +966,10 @@ type CreateCustomerGatewayResponse struct { Response *struct { // 对端网关对象 - CustomerGateway *CustomerGateway `json:"CustomerGateway" name:"CustomerGateway"` + CustomerGateway *CustomerGateway `json:"CustomerGateway,omitempty" name:"CustomerGateway"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -800,10 +986,10 @@ type CreateDefaultVpcRequest struct { *tchttp.BaseRequest // 子网所在的可用区ID,不指定将随机选择可用区 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` // 是否强制返回默认VPC - Force *bool `json:"Force" name:"Force"` + Force *bool `json:"Force,omitempty" name:"Force"` } func (r *CreateDefaultVpcRequest) ToJsonString() string { @@ -820,10 +1006,10 @@ type CreateDefaultVpcResponse struct { Response *struct { // 默认VPC和子网ID - Vpc *DefaultVpcSubnet `json:"Vpc" name:"Vpc"` + Vpc *DefaultVpcSubnet `json:"Vpc,omitempty" name:"Vpc"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -840,10 +1026,10 @@ type CreateDirectConnectGatewayCcnRoutesRequest struct { *tchttp.BaseRequest // 专线网关ID,形如:dcg-prpqlmg1 - DirectConnectGatewayId *string `json:"DirectConnectGatewayId" name:"DirectConnectGatewayId"` + DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"` // 需要连通的IDC网段列表 - Routes []*DirectConnectGatewayCcnRoute `json:"Routes" name:"Routes" list` + Routes []*DirectConnectGatewayCcnRoute `json:"Routes,omitempty" name:"Routes" list` } func (r *CreateDirectConnectGatewayCcnRoutesRequest) ToJsonString() string { @@ -860,7 +1046,7 @@ type CreateDirectConnectGatewayCcnRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -877,21 +1063,21 @@ type CreateDirectConnectGatewayRequest struct { *tchttp.BaseRequest // 专线网关名称 - DirectConnectGatewayName *string `json:"DirectConnectGatewayName" name:"DirectConnectGatewayName"` + DirectConnectGatewayName *string `json:"DirectConnectGatewayName,omitempty" name:"DirectConnectGatewayName"` // 关联网络类型,可选值: //
  • VPC - 私有网络
  • //
  • CCN - 云联网
  • - NetworkType *string `json:"NetworkType" name:"NetworkType"` + NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"` //
  • NetworkType 为 VPC 时,这里传值为私有网络实例ID
  • - //
  • NetworkType 为 NAT 时,这里传值为云联网实例ID
  • - NetworkInstanceId *string `json:"NetworkInstanceId" name:"NetworkInstanceId"` + //
  • NetworkType 为 CCN 时,这里传值为云联网实例ID
  • + NetworkInstanceId *string `json:"NetworkInstanceId,omitempty" name:"NetworkInstanceId"` // 网关类型,可选值: //
  • NORMAL - (默认)标准型,注:云联网只支持标准型
  • //
  • NAT - NAT型
  • NAT类型支持网络地址转换配置,类型确定后不能修改;一个私有网络可以创建一个NAT类型的专线网关和一个非NAT类型的专线网关 - GatewayType *string `json:"GatewayType" name:"GatewayType"` + GatewayType *string `json:"GatewayType,omitempty" name:"GatewayType"` } func (r *CreateDirectConnectGatewayRequest) ToJsonString() string { @@ -908,10 +1094,10 @@ type CreateDirectConnectGatewayResponse struct { Response *struct { // 专线网关对象。 - DirectConnectGateway *DirectConnectGateway `json:"DirectConnectGateway" name:"DirectConnectGateway"` + DirectConnectGateway *DirectConnectGateway `json:"DirectConnectGateway,omitempty" name:"DirectConnectGateway"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -924,20 +1110,75 @@ func (r *CreateDirectConnectGatewayResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type CreateFlowLogRequest struct { + *tchttp.BaseRequest + + // 私用网络ID或者统一ID,建议使用统一ID + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // 流日志实例名字 + FlowLogName *string `json:"FlowLogName,omitempty" name:"FlowLogName"` + + // 流日志所属资源类型,VPC|SUBNET|NETWORKINTERFACE + ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"` + + // 资源唯一ID + ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"` + + // 流日志采集类型,ACCEPT|REJECT|ALL + TrafficType *string `json:"TrafficType,omitempty" name:"TrafficType"` + + // 流日志存储ID + CloudLogId *string `json:"CloudLogId,omitempty" name:"CloudLogId"` + + // 流日志实例描述 + FlowLogDescription *string `json:"FlowLogDescription,omitempty" name:"FlowLogDescription"` +} + +func (r *CreateFlowLogRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateFlowLogRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateFlowLogResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 创建的流日志信息 + FlowLog []*FlowLog `json:"FlowLog,omitempty" name:"FlowLog" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateFlowLogResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateFlowLogResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type CreateHaVipRequest struct { *tchttp.BaseRequest // `HAVIP`所在私有网络`ID`。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // `HAVIP`所在子网`ID`。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` // `HAVIP`名称。 - HaVipName *string `json:"HaVipName" name:"HaVipName"` + HaVipName *string `json:"HaVipName,omitempty" name:"HaVipName"` // 指定虚拟IP地址,必须在`VPC`网段内且未被占用。不指定则自动分配。 - Vip *string `json:"Vip" name:"Vip"` + Vip *string `json:"Vip,omitempty" name:"Vip"` } func (r *CreateHaVipRequest) ToJsonString() string { @@ -954,10 +1195,10 @@ type CreateHaVipResponse struct { Response *struct { // `HAVIP`对象。 - HaVip *HaVip `json:"HaVip" name:"HaVip"` + HaVip *HaVip `json:"HaVip,omitempty" name:"HaVip"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -970,29 +1211,72 @@ func (r *CreateHaVipResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type CreateIp6TranslatorsRequest struct { + *tchttp.BaseRequest + + // 转换实例名称 + Ip6TranslatorName *string `json:"Ip6TranslatorName,omitempty" name:"Ip6TranslatorName"` + + // 创建转换实例数量,默认是1个 + Ip6TranslatorCount *int64 `json:"Ip6TranslatorCount,omitempty" name:"Ip6TranslatorCount"` + + // 转换实例运营商属性,可取"CMCC","CTCC","CUCC","BGP" + Ip6InternetServiceProvider *string `json:"Ip6InternetServiceProvider,omitempty" name:"Ip6InternetServiceProvider"` +} + +func (r *CreateIp6TranslatorsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateIp6TranslatorsRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateIp6TranslatorsResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 转换实例的唯一ID数组,形如"ip6-xxxxxxxx" + Ip6TranslatorSet []*string `json:"Ip6TranslatorSet,omitempty" name:"Ip6TranslatorSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateIp6TranslatorsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateIp6TranslatorsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type CreateNetworkInterfaceRequest struct { *tchttp.BaseRequest // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 弹性网卡名称,最大长度不能超过60个字节。 - NetworkInterfaceName *string `json:"NetworkInterfaceName" name:"NetworkInterfaceName"` + NetworkInterfaceName *string `json:"NetworkInterfaceName,omitempty" name:"NetworkInterfaceName"` // 弹性网卡所在的子网实例ID,例如:subnet-0ap8nwca。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` // 弹性网卡描述,可任意命名,但不得超过60个字符。 - NetworkInterfaceDescription *string `json:"NetworkInterfaceDescription" name:"NetworkInterfaceDescription"` + NetworkInterfaceDescription *string `json:"NetworkInterfaceDescription,omitempty" name:"NetworkInterfaceDescription"` // 新申请的内网IP地址个数,内网IP地址个数总和不能超过配数。 - SecondaryPrivateIpAddressCount *uint64 `json:"SecondaryPrivateIpAddressCount" name:"SecondaryPrivateIpAddressCount"` + SecondaryPrivateIpAddressCount *uint64 `json:"SecondaryPrivateIpAddressCount,omitempty" name:"SecondaryPrivateIpAddressCount"` // 指定绑定的安全组,例如:['sg-1dd51d']。 - SecurityGroupIds []*string `json:"SecurityGroupIds" name:"SecurityGroupIds" list` + SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list` // 指定的内网IP信息,单次最多指定10个。 - PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses" name:"PrivateIpAddresses" list` + PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list` } func (r *CreateNetworkInterfaceRequest) ToJsonString() string { @@ -1009,10 +1293,10 @@ type CreateNetworkInterfaceResponse struct { Response *struct { // 弹性网卡实例。 - NetworkInterface *NetworkInterface `json:"NetworkInterface" name:"NetworkInterface"` + NetworkInterface *NetworkInterface `json:"NetworkInterface,omitempty" name:"NetworkInterface"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1029,10 +1313,10 @@ type CreateRouteTableRequest struct { *tchttp.BaseRequest // 待操作的VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 路由表名称,最大长度不能超过60个字节。 - RouteTableName *string `json:"RouteTableName" name:"RouteTableName"` + RouteTableName *string `json:"RouteTableName,omitempty" name:"RouteTableName"` } func (r *CreateRouteTableRequest) ToJsonString() string { @@ -1049,10 +1333,10 @@ type CreateRouteTableResponse struct { Response *struct { // 路由表对象。 - RouteTable *RouteTable `json:"RouteTable" name:"RouteTable"` + RouteTable *RouteTable `json:"RouteTable,omitempty" name:"RouteTable"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1069,10 +1353,10 @@ type CreateRoutesRequest struct { *tchttp.BaseRequest // 路由表实例ID。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 路由策略对象。 - Routes []*Route `json:"Routes" name:"Routes" list` + Routes []*Route `json:"Routes,omitempty" name:"Routes" list` } func (r *CreateRoutesRequest) ToJsonString() string { @@ -1088,8 +1372,14 @@ type CreateRoutesResponse struct { *tchttp.BaseResponse Response *struct { + // 新增的实例个数。 + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 路由表对象。 + RouteTableSet []*RouteTable `json:"RouteTableSet,omitempty" name:"RouteTableSet" list` + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1106,10 +1396,10 @@ type CreateSecurityGroupPoliciesRequest struct { *tchttp.BaseRequest // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` // 安全组规则集合。 - SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet" name:"SecurityGroupPolicySet"` + SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"` } func (r *CreateSecurityGroupPoliciesRequest) ToJsonString() string { @@ -1126,7 +1416,7 @@ type CreateSecurityGroupPoliciesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1143,13 +1433,13 @@ type CreateSecurityGroupRequest struct { *tchttp.BaseRequest // 安全组名称,可任意命名,但不得超过60个字符。 - GroupName *string `json:"GroupName" name:"GroupName"` + GroupName *string `json:"GroupName,omitempty" name:"GroupName"` // 安全组备注,最多100个字符。 - GroupDescription *string `json:"GroupDescription" name:"GroupDescription"` + GroupDescription *string `json:"GroupDescription,omitempty" name:"GroupDescription"` // 项目id,默认0。可在qcloud控制台项目管理页面查询到。 - ProjectId *string `json:"ProjectId" name:"ProjectId"` + ProjectId *string `json:"ProjectId,omitempty" name:"ProjectId"` } func (r *CreateSecurityGroupRequest) ToJsonString() string { @@ -1166,10 +1456,10 @@ type CreateSecurityGroupResponse struct { Response *struct { // 安全组对象。 - SecurityGroup *SecurityGroup `json:"SecurityGroup" name:"SecurityGroup"` + SecurityGroup *SecurityGroup `json:"SecurityGroup,omitempty" name:"SecurityGroup"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1186,10 +1476,10 @@ type CreateServiceTemplateGroupRequest struct { *tchttp.BaseRequest // 协议端口模板集合名称 - ServiceTemplateGroupName *string `json:"ServiceTemplateGroupName" name:"ServiceTemplateGroupName"` + ServiceTemplateGroupName *string `json:"ServiceTemplateGroupName,omitempty" name:"ServiceTemplateGroupName"` // 协议端口模板实例ID,例如:ppm-4dw6agho。 - ServiceTemplateIds []*string `json:"ServiceTemplateIds" name:"ServiceTemplateIds" list` + ServiceTemplateIds []*string `json:"ServiceTemplateIds,omitempty" name:"ServiceTemplateIds" list` } func (r *CreateServiceTemplateGroupRequest) ToJsonString() string { @@ -1206,10 +1496,10 @@ type CreateServiceTemplateGroupResponse struct { Response *struct { // 协议端口模板集合对象。 - ServiceTemplateGroup *ServiceTemplateGroup `json:"ServiceTemplateGroup" name:"ServiceTemplateGroup"` + ServiceTemplateGroup *ServiceTemplateGroup `json:"ServiceTemplateGroup,omitempty" name:"ServiceTemplateGroup"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1226,10 +1516,10 @@ type CreateServiceTemplateRequest struct { *tchttp.BaseRequest // 协议端口模板名称 - ServiceTemplateName *string `json:"ServiceTemplateName" name:"ServiceTemplateName"` + ServiceTemplateName *string `json:"ServiceTemplateName,omitempty" name:"ServiceTemplateName"` // 支持单个端口、多个端口、连续端口及所有端口,协议支持:TCP、UDP、ICMP、GRE 协议。 - Services []*string `json:"Services" name:"Services" list` + Services []*string `json:"Services,omitempty" name:"Services" list` } func (r *CreateServiceTemplateRequest) ToJsonString() string { @@ -1246,10 +1536,10 @@ type CreateServiceTemplateResponse struct { Response *struct { // 协议端口模板对象。 - ServiceTemplate *ServiceTemplate `json:"ServiceTemplate" name:"ServiceTemplate"` + ServiceTemplate *ServiceTemplate `json:"ServiceTemplate,omitempty" name:"ServiceTemplate"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1266,16 +1556,16 @@ type CreateSubnetRequest struct { *tchttp.BaseRequest // 待操作的VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 子网名称,最大长度不能超过60个字节。 - SubnetName *string `json:"SubnetName" name:"SubnetName"` + SubnetName *string `json:"SubnetName,omitempty" name:"SubnetName"` // 子网网段,子网网段必须在VPC网段内,相同VPC内子网网段不能重叠。 - CidrBlock *string `json:"CidrBlock" name:"CidrBlock"` + CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"` // 子网所在的可用区ID,不同子网选择不同可用区可以做跨可用区灾备。 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` } func (r *CreateSubnetRequest) ToJsonString() string { @@ -1292,10 +1582,10 @@ type CreateSubnetResponse struct { Response *struct { // 子网对象。 - Subnet *Subnet `json:"Subnet" name:"Subnet"` + Subnet *Subnet `json:"Subnet,omitempty" name:"Subnet"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1308,23 +1598,63 @@ func (r *CreateSubnetResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type CreateSubnetsRequest struct { + *tchttp.BaseRequest + + // `VPC`实例`ID`。形如:`vpc-6v2ht8q5` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // 子网对象列表。 + Subnets []*SubnetInput `json:"Subnets,omitempty" name:"Subnets" list` +} + +func (r *CreateSubnetsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateSubnetsRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateSubnetsResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 新创建的子网列表。 + SubnetSet []*Subnet `json:"SubnetSet,omitempty" name:"SubnetSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateSubnetsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateSubnetsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type CreateVpcRequest struct { *tchttp.BaseRequest // vpc名称,最大长度不能超过60个字节。 - VpcName *string `json:"VpcName" name:"VpcName"` + VpcName *string `json:"VpcName,omitempty" name:"VpcName"` // vpc的cidr,只能为10.0.0.0/16,172.16.0.0/12,192.168.0.0/16这三个内网网段内。 - CidrBlock *string `json:"CidrBlock" name:"CidrBlock"` + CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"` // 是否开启组播。true: 开启, false: 不开启。 - EnableMulticast *string `json:"EnableMulticast" name:"EnableMulticast"` + EnableMulticast *string `json:"EnableMulticast,omitempty" name:"EnableMulticast"` // DNS地址,最多支持4个 - DnsServers []*string `json:"DnsServers" name:"DnsServers" list` + DnsServers []*string `json:"DnsServers,omitempty" name:"DnsServers" list` // 域名 - DomainName *string `json:"DomainName" name:"DomainName"` + DomainName *string `json:"DomainName,omitempty" name:"DomainName"` } func (r *CreateVpcRequest) ToJsonString() string { @@ -1341,10 +1671,10 @@ type CreateVpcResponse struct { Response *struct { // Vpc对象。 - Vpc *Vpc `json:"Vpc" name:"Vpc"` + Vpc *Vpc `json:"Vpc,omitempty" name:"Vpc"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1361,28 +1691,28 @@ type CreateVpnConnectionRequest struct { *tchttp.BaseRequest // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // 对端网关ID,例如:cgw-2wqq41m9,可通过DescribeCustomerGateways接口查询对端网关。 - CustomerGatewayId *string `json:"CustomerGatewayId" name:"CustomerGatewayId"` + CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"` // 通道名称,可任意命名,但不得超过60个字符。 - VpnConnectionName *string `json:"VpnConnectionName" name:"VpnConnectionName"` + VpnConnectionName *string `json:"VpnConnectionName,omitempty" name:"VpnConnectionName"` // 预共享密钥。 - PreShareKey *string `json:"PreShareKey" name:"PreShareKey"` + PreShareKey *string `json:"PreShareKey,omitempty" name:"PreShareKey"` // SPD策略组,例如:{"10.0.0.5/24":["172.123.10.5/16"]},10.0.0.5/24是vpc内网段172.123.10.5/16是IDC网段。用户指定VPC内哪些网段可以和您IDC中哪些网段通信。 - SecurityPolicyDatabases []*SecurityPolicyDatabase `json:"SecurityPolicyDatabases" name:"SecurityPolicyDatabases" list` + SecurityPolicyDatabases []*SecurityPolicyDatabase `json:"SecurityPolicyDatabases,omitempty" name:"SecurityPolicyDatabases" list` - // IKE配置(Internet Key Exchange,因特网密钥交换),IKE具有一套自保护机制,用户配置网络安全协议 - IKEOptionsSpecification *IKEOptionsSpecification `json:"IKEOptionsSpecification" name:"IKEOptionsSpecification"` + // IKE配置(Internet Key Exchange,因特网密钥交换),IKE具有一套自我保护机制,用户配置网络安全协议 + IKEOptionsSpecification *IKEOptionsSpecification `json:"IKEOptionsSpecification,omitempty" name:"IKEOptionsSpecification"` // IPSec配置,腾讯云提供IPSec安全会话设置 - IPSECOptionsSpecification *IPSECOptionsSpecification `json:"IPSECOptionsSpecification" name:"IPSECOptionsSpecification"` + IPSECOptionsSpecification *IPSECOptionsSpecification `json:"IPSECOptionsSpecification,omitempty" name:"IPSECOptionsSpecification"` } func (r *CreateVpnConnectionRequest) ToJsonString() string { @@ -1399,10 +1729,10 @@ type CreateVpnConnectionResponse struct { Response *struct { // 通道实例对象。 - VpnConnection *VpnConnection `json:"VpnConnection" name:"VpnConnection"` + VpnConnection *VpnConnection `json:"VpnConnection,omitempty" name:"VpnConnection"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1419,22 +1749,22 @@ type CreateVpnGatewayRequest struct { *tchttp.BaseRequest // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // VPN网关名称,最大长度不能超过60个字节。 - VpnGatewayName *string `json:"VpnGatewayName" name:"VpnGatewayName"` + VpnGatewayName *string `json:"VpnGatewayName,omitempty" name:"VpnGatewayName"` // 公网带宽设置。可选带宽规格:5, 10, 20, 50, 100;单位:Mbps - InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut" name:"InternetMaxBandwidthOut"` + InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"` // VPN网关计费模式,PREPAID:表示预付费,即包年包月,POSTPAID_BY_HOUR:表示后付费,即按量计费。默认:POSTPAID_BY_HOUR,如果指定预付费模式,参数InstanceChargePrepaid必填。 - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` // 可用区,如:ap-guangzhou-2。 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` } func (r *CreateVpnGatewayRequest) ToJsonString() string { @@ -1451,10 +1781,10 @@ type CreateVpnGatewayResponse struct { Response *struct { // VPN网关对象 - VpnGateway *VpnGateway `json:"VpnGateway" name:"VpnGateway"` + VpnGateway *VpnGateway `json:"VpnGateway,omitempty" name:"VpnGateway"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1470,44 +1800,44 @@ func (r *CreateVpnGatewayResponse) FromJsonString(s string) error { type CustomerGateway struct { // 用户网关唯一ID - CustomerGatewayId *string `json:"CustomerGatewayId" name:"CustomerGatewayId"` + CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"` // 网关名称 - CustomerGatewayName *string `json:"CustomerGatewayName" name:"CustomerGatewayName"` + CustomerGatewayName *string `json:"CustomerGatewayName,omitempty" name:"CustomerGatewayName"` // 公网地址 - IpAddress *string `json:"IpAddress" name:"IpAddress"` + IpAddress *string `json:"IpAddress,omitempty" name:"IpAddress"` // 创建时间 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type CustomerGatewayVendor struct { // 平台。 - Platform *string `json:"Platform" name:"Platform"` + Platform *string `json:"Platform,omitempty" name:"Platform"` // 软件版本。 - SoftwareVersion *string `json:"SoftwareVersion" name:"SoftwareVersion"` + SoftwareVersion *string `json:"SoftwareVersion,omitempty" name:"SoftwareVersion"` // 供应商名称。 - VendorName *string `json:"VendorName" name:"VendorName"` + VendorName *string `json:"VendorName,omitempty" name:"VendorName"` } type DefaultVpcSubnet struct { // 默认VpcId - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 默认SubnetId - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` } type DeleteAddressTemplateGroupRequest struct { *tchttp.BaseRequest // IP地址模板集合实例ID,例如:ipmg-90cex8mq。 - AddressTemplateGroupId *string `json:"AddressTemplateGroupId" name:"AddressTemplateGroupId"` + AddressTemplateGroupId *string `json:"AddressTemplateGroupId,omitempty" name:"AddressTemplateGroupId"` } func (r *DeleteAddressTemplateGroupRequest) ToJsonString() string { @@ -1524,7 +1854,7 @@ type DeleteAddressTemplateGroupResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1541,7 +1871,7 @@ type DeleteAddressTemplateRequest struct { *tchttp.BaseRequest // IP地址模板实例ID,例如:ipm-09o5m8kc。 - AddressTemplateId *string `json:"AddressTemplateId" name:"AddressTemplateId"` + AddressTemplateId *string `json:"AddressTemplateId,omitempty" name:"AddressTemplateId"` } func (r *DeleteAddressTemplateRequest) ToJsonString() string { @@ -1558,7 +1888,7 @@ type DeleteAddressTemplateResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1575,7 +1905,7 @@ type DeleteBandwidthPackageRequest struct { *tchttp.BaseRequest // 待删除带宽包bwpId - BandwidthPackageId *string `json:"BandwidthPackageId" name:"BandwidthPackageId"` + BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"` } func (r *DeleteBandwidthPackageRequest) ToJsonString() string { @@ -1592,7 +1922,7 @@ type DeleteBandwidthPackageResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1609,7 +1939,7 @@ type DeleteCcnRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` } func (r *DeleteCcnRequest) ToJsonString() string { @@ -1626,7 +1956,7 @@ type DeleteCcnResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1643,7 +1973,7 @@ type DeleteCustomerGatewayRequest struct { *tchttp.BaseRequest // 对端网关ID,例如:cgw-2wqq41m9,可通过DescribeCustomerGateways接口查询对端网关。 - CustomerGatewayId *string `json:"CustomerGatewayId" name:"CustomerGatewayId"` + CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"` } func (r *DeleteCustomerGatewayRequest) ToJsonString() string { @@ -1660,7 +1990,7 @@ type DeleteCustomerGatewayResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1677,10 +2007,10 @@ type DeleteDirectConnectGatewayCcnRoutesRequest struct { *tchttp.BaseRequest // 专线网关ID,形如:dcg-prpqlmg1 - DirectConnectGatewayId *string `json:"DirectConnectGatewayId" name:"DirectConnectGatewayId"` + DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"` // 路由ID。形如:ccnr-f49l6u0z。 - RouteIds []*string `json:"RouteIds" name:"RouteIds" list` + RouteIds []*string `json:"RouteIds,omitempty" name:"RouteIds" list` } func (r *DeleteDirectConnectGatewayCcnRoutesRequest) ToJsonString() string { @@ -1697,7 +2027,7 @@ type DeleteDirectConnectGatewayCcnRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1714,7 +2044,7 @@ type DeleteDirectConnectGatewayRequest struct { *tchttp.BaseRequest // 专线网关唯一`ID`,形如:`dcg-9o233uri`。 - DirectConnectGatewayId *string `json:"DirectConnectGatewayId" name:"DirectConnectGatewayId"` + DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"` } func (r *DeleteDirectConnectGatewayRequest) ToJsonString() string { @@ -1731,7 +2061,7 @@ type DeleteDirectConnectGatewayResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1744,11 +2074,48 @@ func (r *DeleteDirectConnectGatewayResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DeleteFlowLogRequest struct { + *tchttp.BaseRequest + + // 私用网络ID或者统一ID,建议使用统一ID + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // 流日志唯一ID + FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"` +} + +func (r *DeleteFlowLogRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteFlowLogRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteFlowLogResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteFlowLogResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteFlowLogResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DeleteHaVipRequest struct { *tchttp.BaseRequest // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。 - HaVipId *string `json:"HaVipId" name:"HaVipId"` + HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"` } func (r *DeleteHaVipRequest) ToJsonString() string { @@ -1765,7 +2132,7 @@ type DeleteHaVipResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1778,11 +2145,45 @@ func (r *DeleteHaVipResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DeleteIp6TranslatorsRequest struct { + *tchttp.BaseRequest + + // 待释放的IPV6转换实例的唯一ID,形如‘ip6-xxxxxxxx’ + Ip6TranslatorIds []*string `json:"Ip6TranslatorIds,omitempty" name:"Ip6TranslatorIds" list` +} + +func (r *DeleteIp6TranslatorsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteIp6TranslatorsRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteIp6TranslatorsResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteIp6TranslatorsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteIp6TranslatorsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DeleteNetworkInterfaceRequest struct { *tchttp.BaseRequest // 弹性网卡实例ID,例如:eni-m6dyj72l。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` } func (r *DeleteNetworkInterfaceRequest) ToJsonString() string { @@ -1799,7 +2200,7 @@ type DeleteNetworkInterfaceResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1816,7 +2217,7 @@ type DeleteRouteTableRequest struct { *tchttp.BaseRequest // 路由表实例ID,例如:rtb-azd4dt1c。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` } func (r *DeleteRouteTableRequest) ToJsonString() string { @@ -1833,7 +2234,7 @@ type DeleteRouteTableResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1850,10 +2251,10 @@ type DeleteRoutesRequest struct { *tchttp.BaseRequest // 路由表实例ID。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 路由策略对象。 - Routes []*Route `json:"Routes" name:"Routes" list` + Routes []*Route `json:"Routes,omitempty" name:"Routes" list` } func (r *DeleteRoutesRequest) ToJsonString() string { @@ -1870,7 +2271,7 @@ type DeleteRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1887,10 +2288,10 @@ type DeleteSecurityGroupPoliciesRequest struct { *tchttp.BaseRequest // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` // 安全组规则集合。一个请求中只能删除单个方向的一条或多条规则。支持指定索引(PolicyIndex) 匹配删除和安全组规则匹配删除两种方式,一个请求中只能使用一种匹配方式。 - SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet" name:"SecurityGroupPolicySet"` + SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"` } func (r *DeleteSecurityGroupPoliciesRequest) ToJsonString() string { @@ -1907,7 +2308,7 @@ type DeleteSecurityGroupPoliciesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1924,7 +2325,7 @@ type DeleteSecurityGroupRequest struct { *tchttp.BaseRequest // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` } func (r *DeleteSecurityGroupRequest) ToJsonString() string { @@ -1941,7 +2342,7 @@ type DeleteSecurityGroupResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1958,7 +2359,7 @@ type DeleteServiceTemplateGroupRequest struct { *tchttp.BaseRequest // 协议端口模板集合实例ID,例如:ppmg-n17uxvve。 - ServiceTemplateGroupId *string `json:"ServiceTemplateGroupId" name:"ServiceTemplateGroupId"` + ServiceTemplateGroupId *string `json:"ServiceTemplateGroupId,omitempty" name:"ServiceTemplateGroupId"` } func (r *DeleteServiceTemplateGroupRequest) ToJsonString() string { @@ -1975,7 +2376,7 @@ type DeleteServiceTemplateGroupResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -1992,7 +2393,7 @@ type DeleteServiceTemplateRequest struct { *tchttp.BaseRequest // 协议端口模板实例ID,例如:ppm-e6dy460g。 - ServiceTemplateId *string `json:"ServiceTemplateId" name:"ServiceTemplateId"` + ServiceTemplateId *string `json:"ServiceTemplateId,omitempty" name:"ServiceTemplateId"` } func (r *DeleteServiceTemplateRequest) ToJsonString() string { @@ -2009,7 +2410,7 @@ type DeleteServiceTemplateResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2026,7 +2427,7 @@ type DeleteSubnetRequest struct { *tchttp.BaseRequest // 子网实例ID。可通过DescribeSubnets接口返回值中的SubnetId获取。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` } func (r *DeleteSubnetRequest) ToJsonString() string { @@ -2043,7 +2444,7 @@ type DeleteSubnetResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2060,7 +2461,7 @@ type DeleteVpcRequest struct { *tchttp.BaseRequest // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` } func (r *DeleteVpcRequest) ToJsonString() string { @@ -2077,7 +2478,7 @@ type DeleteVpcResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2094,10 +2495,10 @@ type DeleteVpnConnectionRequest struct { *tchttp.BaseRequest // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // VPN通道实例ID。形如:vpnx-f49l6u0z。 - VpnConnectionId *string `json:"VpnConnectionId" name:"VpnConnectionId"` + VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"` } func (r *DeleteVpnConnectionRequest) ToJsonString() string { @@ -2114,7 +2515,7 @@ type DeleteVpnConnectionResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2131,7 +2532,7 @@ type DeleteVpnGatewayRequest struct { *tchttp.BaseRequest // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` } func (r *DeleteVpnGatewayRequest) ToJsonString() string { @@ -2148,7 +2549,7 @@ type DeleteVpnGatewayResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2179,10 +2580,10 @@ type DescribeAccountAttributesResponse struct { Response *struct { // 用户账号属性对象 - AccountAttributeSet []*AccountAttribute `json:"AccountAttributeSet" name:"AccountAttributeSet" list` + AccountAttributeSet []*AccountAttribute `json:"AccountAttributeSet,omitempty" name:"AccountAttributeSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2213,10 +2614,10 @@ type DescribeAddressQuotaResponse struct { Response *struct { // 账户 EIP 配额信息。 - QuotaSet []*Quota `json:"QuotaSet" name:"QuotaSet" list` + QuotaSet []*Quota `json:"QuotaSet,omitempty" name:"QuotaSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2235,13 +2636,13 @@ type DescribeAddressTemplateGroupsRequest struct { // 过滤条件。 //
  • address-template-group-name - String - (过滤条件)IP地址模板集合名称。
  • //
  • address-template-group-id - String - (过滤条件)IP地址模板实集合例ID,例如:ipmg-mdunqeb6。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。 - Offset *string `json:"Offset" name:"Offset"` + Offset *string `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。 - Limit *string `json:"Limit" name:"Limit"` + Limit *string `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeAddressTemplateGroupsRequest) ToJsonString() string { @@ -2258,13 +2659,13 @@ type DescribeAddressTemplateGroupsResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // IP地址模板。 - AddressTemplateGroupSet []*AddressTemplateGroup `json:"AddressTemplateGroupSet" name:"AddressTemplateGroupSet" list` + AddressTemplateGroupSet []*AddressTemplateGroup `json:"AddressTemplateGroupSet,omitempty" name:"AddressTemplateGroupSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2283,13 +2684,13 @@ type DescribeAddressTemplatesRequest struct { // 过滤条件。 //
  • address-template-name - String - (过滤条件)IP地址模板名称。
  • //
  • address-template-id - String - (过滤条件)IP地址模板实例ID,例如:ipm-mdunqeb6。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。 - Offset *string `json:"Offset" name:"Offset"` + Offset *string `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。 - Limit *string `json:"Limit" name:"Limit"` + Limit *string `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeAddressTemplatesRequest) ToJsonString() string { @@ -2306,13 +2707,13 @@ type DescribeAddressTemplatesResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // IP地址模版。 - AddressTemplateSet []*AddressTemplate `json:"AddressTemplateSet" name:"AddressTemplateSet" list` + AddressTemplateSet []*AddressTemplate `json:"AddressTemplateSet,omitempty" name:"AddressTemplateSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2329,7 +2730,7 @@ type DescribeAddressesRequest struct { *tchttp.BaseRequest // 标识 EIP 的唯一 ID 列表。EIP 唯一 ID 形如:`eip-11112222`。参数不支持同时指定`AddressIds`和`Filters`。 - AddressIds []*string `json:"AddressIds" name:"AddressIds" list` + AddressIds []*string `json:"AddressIds,omitempty" name:"AddressIds" list` // 每次请求的`Filters`的上限为10,`Filter.Values`的上限为5。参数不支持同时指定`AddressIds`和`Filters`。详细的过滤条件如下: //
  • address-id - String - 是否必填:否 - (过滤条件)按照 EIP 的唯一 ID 过滤。EIP 唯一 ID 形如:eip-11112222。
  • @@ -2340,13 +2741,13 @@ type DescribeAddressesRequest struct { //
  • private-ip-address - String - 是否必填:否 - (过滤条件)按照 EIP 绑定的内网 IP 过滤。
  • //
  • network-interface-id - String - 是否必填:否 - (过滤条件)按照 EIP 绑定的弹性网卡 ID 过滤。弹性网卡 ID 形如:eni-11112222。
  • //
  • is-arrears - String - 是否必填:否 - (过滤条件)按照 EIP 是否欠费进行过滤。(TRUE:EIP 处于欠费状态|FALSE:EIP 费用状态正常)
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/11646)中的相关小节。 - Offset *int64 `json:"Offset" name:"Offset"` + Offset *int64 `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/11646)中的相关小节。 - Limit *int64 `json:"Limit" name:"Limit"` + Limit *int64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeAddressesRequest) ToJsonString() string { @@ -2363,13 +2764,13 @@ type DescribeAddressesResponse struct { Response *struct { // 符合条件的 EIP 数量。 - TotalCount *int64 `json:"TotalCount" name:"TotalCount"` + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` // EIP 详细信息列表。 - AddressSet []*Address `json:"AddressSet" name:"AddressSet" list` + AddressSet []*Address `json:"AddressSet,omitempty" name:"AddressSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2400,10 +2801,10 @@ type DescribeBandwidthPackageQuotaResponse struct { Response *struct { // 带宽包配额数据结构 - QuotaSet []*Quota `json:"QuotaSet" name:"QuotaSet" list` + QuotaSet []*Quota `json:"QuotaSet,omitempty" name:"QuotaSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2420,7 +2821,7 @@ type DescribeBandwidthPackagesRequest struct { *tchttp.BaseRequest // 带宽包Id,支持批量 - BandwidthPackageIds []*string `json:"BandwidthPackageIds" name:"BandwidthPackageIds" list` + BandwidthPackageIds []*string `json:"BandwidthPackageIds,omitempty" name:"BandwidthPackageIds" list` // 每次请求的`Filters`的上限为10。参数不支持同时指定`BandwidthPackageIds`和`Filters`。详细的过滤条件如下: //
  • bandwidth-package_id - String - 是否必填:否 - (过滤条件)按照带宽包的唯一标识ID过滤。
  • @@ -2430,13 +2831,13 @@ type DescribeBandwidthPackagesRequest struct { //
  • resource.resource-type - String - 是否必填:否 - (过滤条件)按照带宽包资源类型过滤。资源类型包括'Address'和'LoadBalance'
  • //
  • resource.resource-id - String - 是否必填:否 - (过滤条件)按照带宽包资源Id过滤。资源Id形如'eip-xxxx','lb-xxxx'
  • //
  • resource.address-ip - String - 是否必填:否 - (过滤条件)按照带宽包资源Ip过滤。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 查询带宽包偏移量 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 查询带宽包数量限制 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeBandwidthPackagesRequest) ToJsonString() string { @@ -2453,13 +2854,13 @@ type DescribeBandwidthPackagesResponse struct { Response *struct { // 符合条件的带宽包数量 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 描述带宽包详细信息 - BandwidthPackageSet []*BandwidthPackage `json:"BandwidthPackageSet" name:"BandwidthPackageSet" list` + BandwidthPackageSet []*BandwidthPackage `json:"BandwidthPackageSet,omitempty" name:"BandwidthPackageSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2476,20 +2877,26 @@ type DescribeCcnAttachedInstancesRequest struct { *tchttp.BaseRequest // 偏移量 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` // 过滤条件: //
  • ccn-id - String -(过滤条件)CCN实例ID。
  • //
  • instance-type - String -(过滤条件)关联实例类型。
  • //
  • instance-region - String -(过滤条件)关联实例所属地域。
  • //
  • instance-id - String -(过滤条件)关联实例实例ID。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 云联网实例ID - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` + + // 排序字段。支持:`CcnId` `InstanceType` `InstanceId` `InstanceName` `InstanceRegion` `AttachedTime` `State`。 + OrderField *string `json:"OrderField,omitempty" name:"OrderField"` + + // 排序方法。顺序:`ASC`,倒序:`DESC`。 + OrderDirection *string `json:"OrderDirection,omitempty" name:"OrderDirection"` } func (r *DescribeCcnAttachedInstancesRequest) ToJsonString() string { @@ -2506,13 +2913,13 @@ type DescribeCcnAttachedInstancesResponse struct { Response *struct { // 符合条件的对象数。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 关联实例列表。 - InstanceSet []*CcnAttachedInstance `json:"InstanceSet" name:"InstanceSet" list` + InstanceSet []*CcnAttachedInstance `json:"InstanceSet,omitempty" name:"InstanceSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2529,7 +2936,7 @@ type DescribeCcnRegionBandwidthLimitsRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` } func (r *DescribeCcnRegionBandwidthLimitsRequest) ToJsonString() string { @@ -2546,10 +2953,10 @@ type DescribeCcnRegionBandwidthLimitsResponse struct { Response *struct { // 云联网(CCN)各地域出带宽上限 - CcnRegionBandwidthLimitSet []*CcnRegionBandwidthLimit `json:"CcnRegionBandwidthLimitSet" name:"CcnRegionBandwidthLimitSet" list` + CcnRegionBandwidthLimitSet []*CcnRegionBandwidthLimit `json:"CcnRegionBandwidthLimitSet,omitempty" name:"CcnRegionBandwidthLimitSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2566,25 +2973,24 @@ type DescribeCcnRoutesRequest struct { *tchttp.BaseRequest // CCN实例ID,形如:ccn-gree226l。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // CCN路由策略唯一ID。形如:ccnr-f49l6u0z。 - RouteIds []*string `json:"RouteIds" name:"RouteIds" list` + RouteIds []*string `json:"RouteIds,omitempty" name:"RouteIds" list` // 过滤条件,参数不支持同时指定RouteIds和Filters。 - //
  • ccn-id - String -(过滤条件)CCN实例ID。
  • //
  • route-id - String -(过滤条件)路由策略ID。
  • //
  • cidr-block - String -(过滤条件)目的端。
  • //
  • instance-type - String -(过滤条件)下一跳类型。
  • //
  • instance-region - String -(过滤条件)下一跳所属地域。
  • //
  • instance-id - String -(过滤条件)下一跳实例ID。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeCcnRoutesRequest) ToJsonString() string { @@ -2601,13 +3007,13 @@ type DescribeCcnRoutesResponse struct { Response *struct { // 符合条件的对象数。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // CCN路由策略对象。 - RouteSet []*CcnRoute `json:"RouteSet" name:"RouteSet" list` + RouteSet []*CcnRoute `json:"RouteSet,omitempty" name:"RouteSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2624,20 +3030,26 @@ type DescribeCcnsRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定CcnIds和Filters。 - CcnIds []*string `json:"CcnIds" name:"CcnIds" list` + CcnIds []*string `json:"CcnIds,omitempty" name:"CcnIds" list` // 过滤条件,参数不支持同时指定CcnIds和Filters。 //
  • ccn-id - String - (过滤条件)CCN唯一ID,形如:vpc-f49l6u0z。
  • //
  • ccn-name - String - (过滤条件)CCN名称。
  • //
  • ccn-description - String - (过滤条件)CCN描述。
  • //
  • state - String - (过滤条件)实例状态, 'ISOLATED': 隔离中(欠费停服),'AVAILABLE':运行中。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` + + // 排序字段。支持:`CcnId` `CcnName` `CreateTime` `State` `QosLevel` + OrderField *string `json:"OrderField,omitempty" name:"OrderField"` + + // 排序方法。顺序:`ASC`,倒序:`DESC`。 + OrderDirection *string `json:"OrderDirection,omitempty" name:"OrderDirection"` } func (r *DescribeCcnsRequest) ToJsonString() string { @@ -2654,13 +3066,13 @@ type DescribeCcnsResponse struct { Response *struct { // 符合条件的对象数。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // CCN对象。 - CcnSet []*CCN `json:"CcnSet" name:"CcnSet" list` + CcnSet []*CCN `json:"CcnSet,omitempty" name:"CcnSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2679,13 +3091,13 @@ type DescribeClassicLinkInstancesRequest struct { // 过滤条件。 //
  • vpc-id - String - (过滤条件)VPC实例ID。
  • //
  • vm-ip - String - (过滤条件)基础网络云主机IP。
  • - Filters []*FilterObject `json:"Filters" name:"Filters" list` + Filters []*FilterObject `json:"Filters,omitempty" name:"Filters" list` // 偏移量 - Offset *string `json:"Offset" name:"Offset"` + Offset *string `json:"Offset,omitempty" name:"Offset"` // 返回数量 - Limit *string `json:"Limit" name:"Limit"` + Limit *string `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeClassicLinkInstancesRequest) ToJsonString() string { @@ -2702,13 +3114,13 @@ type DescribeClassicLinkInstancesResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 私有网络和基础网络互通设备。 - ClassicLinkInstanceSet []*ClassicLinkInstance `json:"ClassicLinkInstanceSet" name:"ClassicLinkInstanceSet" list` + ClassicLinkInstanceSet []*ClassicLinkInstance `json:"ClassicLinkInstanceSet,omitempty" name:"ClassicLinkInstanceSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2739,10 +3151,10 @@ type DescribeCustomerGatewayVendorsResponse struct { Response *struct { // 对端网关厂商信息对象。 - CustomerGatewayVendorSet []*CustomerGatewayVendor `json:"CustomerGatewayVendorSet" name:"CustomerGatewayVendorSet" list` + CustomerGatewayVendorSet []*CustomerGatewayVendor `json:"CustomerGatewayVendorSet,omitempty" name:"CustomerGatewayVendorSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2759,16 +3171,19 @@ type DescribeCustomerGatewaysRequest struct { *tchttp.BaseRequest // 对端网关ID,例如:cgw-2wqq41m9。每次请求的实例的上限为100。参数不支持同时指定CustomerGatewayIds和Filters。 - CustomerGatewayIds []*string `json:"CustomerGatewayIds" name:"CustomerGatewayIds" list` + CustomerGatewayIds []*string `json:"CustomerGatewayIds,omitempty" name:"CustomerGatewayIds" list` // 过滤条件,详见下表:实例过滤条件表。每次请求的Filters的上限为10,Filter.Values的上限为5。参数不支持同时指定CustomerGatewayIds和Filters。 - Filters []*Filter `json:"Filters" name:"Filters" list` + //
  • customer-gateway-id - String - (过滤条件)用户网关唯一ID形如:`cgw-mgp33pll`。
  • + //
  • customer-gateway-name - String - (过滤条件)用户网关名称形如:`test-cgw`。
  • + //
  • ip-address - String - (过滤条件)公网地址形如:`58.211.1.12`。
  • + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。关于Offset的更进一步介绍请参考 API 简介中的相关小节。 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeCustomerGatewaysRequest) ToJsonString() string { @@ -2785,13 +3200,13 @@ type DescribeCustomerGatewaysResponse struct { Response *struct { // 对端网关对象列表 - CustomerGatewaySet []*CustomerGateway `json:"CustomerGatewaySet" name:"CustomerGatewaySet" list` + CustomerGatewaySet []*CustomerGateway `json:"CustomerGatewaySet,omitempty" name:"CustomerGatewaySet" list` // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2808,18 +3223,18 @@ type DescribeDirectConnectGatewayCcnRoutesRequest struct { *tchttp.BaseRequest // 专线网关ID,形如:`dcg-prpqlmg1`。 - DirectConnectGatewayId *string `json:"DirectConnectGatewayId" name:"DirectConnectGatewayId"` + DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"` // 云联网路由学习类型,可选值: //
  • `BGP` - 自动学习。
  • //
  • `STATIC` - 静态,即用户配置,默认值。
  • - CcnRouteType *string `json:"CcnRouteType" name:"CcnRouteType"` + CcnRouteType *string `json:"CcnRouteType,omitempty" name:"CcnRouteType"` // 偏移量。 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量。 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeDirectConnectGatewayCcnRoutesRequest) ToJsonString() string { @@ -2836,13 +3251,13 @@ type DescribeDirectConnectGatewayCcnRoutesResponse struct { Response *struct { // 符合条件的对象数。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 云联网路由(IDC网段)列表。 - RouteSet []*DirectConnectGatewayCcnRoute `json:"RouteSet" name:"RouteSet" list` + RouteSet []*DirectConnectGatewayCcnRoute `json:"RouteSet,omitempty" name:"RouteSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2859,7 +3274,7 @@ type DescribeDirectConnectGatewaysRequest struct { *tchttp.BaseRequest // 专线网关唯一`ID`,形如:`dcg-9o233uri`。 - DirectConnectGatewayIds []*string `json:"DirectConnectGatewayIds" name:"DirectConnectGatewayIds" list` + DirectConnectGatewayIds []*string `json:"DirectConnectGatewayIds,omitempty" name:"DirectConnectGatewayIds" list` // 过滤条件,参数不支持同时指定`DirectConnectGatewayIds`和`Filters`。 //
  • direct-connect-gateway-id - String - 专线网关唯一`ID`,形如:`dcg-9o233uri`。
  • @@ -2867,15 +3282,15 @@ type DescribeDirectConnectGatewaysRequest struct { //
  • direct-connect-gateway-ip - String - 专线网关`IP`。
  • //
  • gateway-type - String - 网关类型,可选值:`NORMAL`(普通型)、`NAT`(NAT型)。
  • //
  • network-type- String - 网络类型,可选值:`VPC`(私有网络类型)、`CCN`(云联网类型)。
  • - //
  • ccn-id - String - 专线网关所在私有网络`ID`。
  • - //
  • vpc-id - String - 专线网关所在云联网`ID`。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + //
  • ccn-id - String - 专线网关所在云联网`ID`。
  • + //
  • vpc-id - String - 专线网关所在私有网络`ID`。
  • + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量。 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量。 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeDirectConnectGatewaysRequest) ToJsonString() string { @@ -2892,13 +3307,13 @@ type DescribeDirectConnectGatewaysResponse struct { Response *struct { // 符合条件的对象数。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 专线网关对象数组。 - DirectConnectGatewaySet []*DirectConnectGateway `json:"DirectConnectGatewaySet" name:"DirectConnectGatewaySet" list` + DirectConnectGatewaySet []*DirectConnectGateway `json:"DirectConnectGatewaySet,omitempty" name:"DirectConnectGatewaySet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2911,11 +3326,188 @@ func (r *DescribeDirectConnectGatewaysResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DescribeFlowLogRequest struct { + *tchttp.BaseRequest + + // 私用网络ID或者统一ID,建议使用统一ID + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // 流日志唯一ID + FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"` +} + +func (r *DescribeFlowLogRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeFlowLogRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeFlowLogResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 流日志信息 + FlowLog []*FlowLog `json:"FlowLog,omitempty" name:"FlowLog" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeFlowLogResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeFlowLogResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeFlowLogsRequest struct { + *tchttp.BaseRequest + + // 私用网络ID或者统一ID,建议使用统一ID + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // 流日志唯一ID + FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"` + + // 流日志实例名字 + FlowLogName *string `json:"FlowLogName,omitempty" name:"FlowLogName"` + + // 流日志所属资源类型,VPC|SUBNET|NETWORKINTERFACE + ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"` + + // 资源唯一ID + ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"` + + // 流日志采集类型,ACCEPT|REJECT|ALL + TrafficType *string `json:"TrafficType,omitempty" name:"TrafficType"` + + // 流日志存储ID + CloudLogId *string `json:"CloudLogId,omitempty" name:"CloudLogId"` + + // 流日志存储ID状态 + CloudLogState *string `json:"CloudLogState,omitempty" name:"CloudLogState"` + + // 按某个字段排序,支持字段:flowLogName,createTime,默认按createTime + OrderField *string `json:"OrderField,omitempty" name:"OrderField"` + + // 升序(asc)还是降序(desc),默认:desc + OrderDirection *string `json:"OrderDirection,omitempty" name:"OrderDirection"` + + // 偏移量,默认为0。 + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 每页行数,默认为10 + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` +} + +func (r *DescribeFlowLogsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeFlowLogsRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeFlowLogsResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 流日志实例集合 + FlowLog []*FlowLog `json:"FlowLog,omitempty" name:"FlowLog" list` + + // 流日志总数目 + TotalNum *uint64 `json:"TotalNum,omitempty" name:"TotalNum"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeFlowLogsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeFlowLogsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeGatewayFlowMonitorDetailRequest struct { + *tchttp.BaseRequest + + // 时间点。表示要查询这分钟内的明细。如:`2019-02-28 18:15:20`,将查询 `18:15` 这一分钟内的明细。 + TimePoint *string `json:"TimePoint,omitempty" name:"TimePoint"` + + // VPN网关实例ID,形如:`vpn-ltjahce6`。 + VpnId *string `json:"VpnId,omitempty" name:"VpnId"` + + // 专线网关实例ID,形如:`dcg-ltjahce6`。 + DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"` + + // 对等连接实例ID,形如:`pcx-ltjahce6`。 + PeeringConnectionId *string `json:"PeeringConnectionId,omitempty" name:"PeeringConnectionId"` + + // NAT网关实例ID,形如:`nat-ltjahce6`。 + NatId *string `json:"NatId,omitempty" name:"NatId"` + + // 偏移量。 + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 返回数量。 + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` + + // 排序字段。支持 `InPkg` `OutPkg` `InTraffic` `OutTraffic`。 + OrderField *string `json:"OrderField,omitempty" name:"OrderField"` + + // 排序方法。顺序:`ASC`,倒序:`DESC`。 + OrderDirection *string `json:"OrderDirection,omitempty" name:"OrderDirection"` +} + +func (r *DescribeGatewayFlowMonitorDetailRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeGatewayFlowMonitorDetailRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeGatewayFlowMonitorDetailResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 符合条件的对象数。 + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 网关流量监控明细。 + GatewayFlowMonitorDetailSet []*GatewayFlowMonitorDetail `json:"GatewayFlowMonitorDetailSet,omitempty" name:"GatewayFlowMonitorDetailSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeGatewayFlowMonitorDetailResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeGatewayFlowMonitorDetailResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DescribeHaVipsRequest struct { *tchttp.BaseRequest // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。 - HaVipIds []*string `json:"HaVipIds" name:"HaVipIds" list` + HaVipIds []*string `json:"HaVipIds,omitempty" name:"HaVipIds" list` // 过滤条件,参数不支持同时指定`HaVipIds`和`Filters`。 //
  • havip-id - String - `HAVIP`唯一`ID`,形如:`havip-9o233uri`。
  • @@ -2923,13 +3515,13 @@ type DescribeHaVipsRequest struct { //
  • vpc-id - String - `HAVIP`所在私有网络`ID`。
  • //
  • subnet-id - String - `HAVIP`所在子网`ID`。
  • //
  • address-ip - String - `HAVIP`绑定的弹性公网`IP`。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeHaVipsRequest) ToJsonString() string { @@ -2946,13 +3538,13 @@ type DescribeHaVipsResponse struct { Response *struct { // 符合条件的对象数。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // `HAVIP`对象数组。 - HaVipSet []*HaVip `json:"HaVipSet" name:"HaVipSet" list` + HaVipSet []*HaVip `json:"HaVipSet,omitempty" name:"HaVipSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -2965,11 +3557,102 @@ func (r *DescribeHaVipsResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DescribeIp6TranslatorQuotaRequest struct { + *tchttp.BaseRequest + + // 待查询IPV6转换实例的唯一ID列表,形如ip6-xxxxxxxx + Ip6TranslatorIds []*string `json:"Ip6TranslatorIds,omitempty" name:"Ip6TranslatorIds" list` +} + +func (r *DescribeIp6TranslatorQuotaRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeIp6TranslatorQuotaRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeIp6TranslatorQuotaResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 账户在指定地域的IPV6转换实例及规则配额信息 + // QUOTAID属性是TOTAL_TRANSLATOR_QUOTA,表示账户在指定地域的IPV6转换实例配额信息;QUOTAID属性是IPV6转转换实例唯一ID(形如ip6-xxxxxxxx),表示账户在该转换实例允许创建的转换规则配额 + QuotaSet []*Quota `json:"QuotaSet,omitempty" name:"QuotaSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeIp6TranslatorQuotaResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeIp6TranslatorQuotaResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeIp6TranslatorsRequest struct { + *tchttp.BaseRequest + + // IPV6转换实例唯一ID数组,形如ip6-xxxxxxxx + Ip6TranslatorIds []*string `json:"Ip6TranslatorIds,omitempty" name:"Ip6TranslatorIds" list` + + // 每次请求的`Filters`的上限为10,`Filter.Values`的上限为5。参数不支持同时指定`Ip6TranslatorIds`和`Filters`。详细的过滤条件如下: + //
  • ip6-translator-id - String - 是否必填:否 - (过滤条件)按照IPV6转换实例的唯一ID过滤,形如ip6-xxxxxxx。
  • + //
  • ip6-translator-vip6 - String - 是否必填:否 - (过滤条件)按照IPV6地址过滤。不支持模糊过滤。
  • + //
  • ip6-translator-name - String - 是否必填:否 - (过滤条件)按照IPV6转换实例名称过滤。不支持模糊过滤。
  • + //
  • ip6-translator-status - String - 是否必填:否 - (过滤条件)按照IPV6转换实例的状态过滤。状态取值范围为"CREATING","RUNNING","DELETING","MODIFYING" + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` + + // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/11646)中的相关小节。 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/11646)中的相关小节。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` +} + +func (r *DescribeIp6TranslatorsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeIp6TranslatorsRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeIp6TranslatorsResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 符合过滤条件的IPV6转换实例数量。 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 符合过滤条件的IPV6转换实例详细信息 + Ip6TranslatorSet []*Ip6Translator `json:"Ip6TranslatorSet,omitempty" name:"Ip6TranslatorSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeIp6TranslatorsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeIp6TranslatorsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DescribeNetworkInterfacesRequest struct { *tchttp.BaseRequest // 弹性网卡实例ID查询。形如:eni-pxir56ns。每次请求的实例的上限为100。参数不支持同时指定NetworkInterfaceIds和Filters。 - NetworkInterfaceIds []*string `json:"NetworkInterfaceIds" name:"NetworkInterfaceIds" list` + NetworkInterfaceIds []*string `json:"NetworkInterfaceIds,omitempty" name:"NetworkInterfaceIds" list` // 过滤条件,参数不支持同时指定NetworkInterfaceIds和Filters。 //
  • vpc-id - String - (过滤条件)VPC实例ID,形如:vpc-f49l6u0z。
  • @@ -2979,13 +3662,13 @@ type DescribeNetworkInterfacesRequest struct { //
  • groups.security-group-id - String - (过滤条件)绑定的安全组实例ID,例如:sg-f9ekbxeq。
  • //
  • network-interface-name - String - (过滤条件)网卡实例名称。
  • //
  • network-interface-description - String - (过滤条件)网卡实例描述。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeNetworkInterfacesRequest) ToJsonString() string { @@ -3002,13 +3685,13 @@ type DescribeNetworkInterfacesResponse struct { Response *struct { // 实例详细信息列表。 - NetworkInterfaceSet []*NetworkInterface `json:"NetworkInterfaceSet" name:"NetworkInterfaceSet" list` + NetworkInterfaceSet []*NetworkInterface `json:"NetworkInterfaceSet,omitempty" name:"NetworkInterfaceSet" list` // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3025,10 +3708,10 @@ type DescribeRouteConflictsRequest struct { *tchttp.BaseRequest // 路由表实例ID,例如:rtb-azd4dt1c。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 要检查的与之冲突的目的端列表 - DestinationCidrBlocks []*string `json:"DestinationCidrBlocks" name:"DestinationCidrBlocks" list` + DestinationCidrBlocks []*string `json:"DestinationCidrBlocks,omitempty" name:"DestinationCidrBlocks" list` } func (r *DescribeRouteConflictsRequest) ToJsonString() string { @@ -3045,10 +3728,10 @@ type DescribeRouteConflictsResponse struct { Response *struct { // 路由策略冲突列表 - RouteConflictSet []*RouteConflict `json:"RouteConflictSet" name:"RouteConflictSet" list` + RouteConflictSet []*RouteConflict `json:"RouteConflictSet,omitempty" name:"RouteConflictSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3065,20 +3748,20 @@ type DescribeRouteTablesRequest struct { *tchttp.BaseRequest // 路由表实例ID,例如:rtb-azd4dt1c。 - RouteTableIds []*string `json:"RouteTableIds" name:"RouteTableIds" list` + RouteTableIds []*string `json:"RouteTableIds,omitempty" name:"RouteTableIds" list` // 过滤条件,参数不支持同时指定RouteTableIds和Filters。 //
  • route-table-id - String - (过滤条件)路由表实例ID。
  • //
  • route-table-name - String - (过滤条件)路由表名称。
  • //
  • vpc-id - String - (过滤条件)VPC实例ID,形如:vpc-f49l6u0z。
  • //
  • association.main - String - (过滤条件)是否主路由表。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量。 - Offset *string `json:"Offset" name:"Offset"` + Offset *string `json:"Offset,omitempty" name:"Offset"` // 请求对象个数。 - Limit *string `json:"Limit" name:"Limit"` + Limit *string `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeRouteTablesRequest) ToJsonString() string { @@ -3095,13 +3778,13 @@ type DescribeRouteTablesResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 路由表对象。 - RouteTableSet []*RouteTable `json:"RouteTableSet" name:"RouteTableSet" list` + RouteTableSet []*RouteTable `json:"RouteTableSet,omitempty" name:"RouteTableSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3118,7 +3801,7 @@ type DescribeSecurityGroupAssociationStatisticsRequest struct { *tchttp.BaseRequest // 安全实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。 - SecurityGroupIds []*string `json:"SecurityGroupIds" name:"SecurityGroupIds" list` + SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list` } func (r *DescribeSecurityGroupAssociationStatisticsRequest) ToJsonString() string { @@ -3135,10 +3818,10 @@ type DescribeSecurityGroupAssociationStatisticsResponse struct { Response *struct { // 安全组关联实例统计。 - SecurityGroupAssociationStatisticsSet []*SecurityGroupAssociationStatistics `json:"SecurityGroupAssociationStatisticsSet" name:"SecurityGroupAssociationStatisticsSet" list` + SecurityGroupAssociationStatisticsSet []*SecurityGroupAssociationStatistics `json:"SecurityGroupAssociationStatisticsSet,omitempty" name:"SecurityGroupAssociationStatisticsSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3155,7 +3838,7 @@ type DescribeSecurityGroupPoliciesRequest struct { *tchttp.BaseRequest // 安全组实例ID,例如:sg-33ocnj9n,可通过DescribeSecurityGroups获取。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` } func (r *DescribeSecurityGroupPoliciesRequest) ToJsonString() string { @@ -3172,10 +3855,10 @@ type DescribeSecurityGroupPoliciesResponse struct { Response *struct { // 安全组规则集合。 - SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet" name:"SecurityGroupPolicySet"` + SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3192,18 +3875,18 @@ type DescribeSecurityGroupsRequest struct { *tchttp.BaseRequest // 安全组实例ID,例如:sg-33ocnj9n,可通过DescribeSecurityGroups获取。每次请求的实例的上限为100。参数不支持同时指定SecurityGroupIds和Filters。 - SecurityGroupIds []*string `json:"SecurityGroupIds" name:"SecurityGroupIds" list` + SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list` // 过滤条件,参数不支持同时指定SecurityGroupIds和Filters。 //
  • project-id - Integer - (过滤条件)项目id。
  • //
  • security-group-name - String - (过滤条件)安全组名称。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量。 - Offset *string `json:"Offset" name:"Offset"` + Offset *string `json:"Offset,omitempty" name:"Offset"` // 返回数量。 - Limit *string `json:"Limit" name:"Limit"` + Limit *string `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeSecurityGroupsRequest) ToJsonString() string { @@ -3220,13 +3903,13 @@ type DescribeSecurityGroupsResponse struct { Response *struct { // 安全组对象。 - SecurityGroupSet []*SecurityGroup `json:"SecurityGroupSet" name:"SecurityGroupSet" list` + SecurityGroupSet []*SecurityGroup `json:"SecurityGroupSet,omitempty" name:"SecurityGroupSet" list` // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3245,13 +3928,13 @@ type DescribeServiceTemplateGroupsRequest struct { // 过滤条件。 //
  • service-template-group-name - String - (过滤条件)协议端口模板集合名称。
  • //
  • service-template-group-id - String - (过滤条件)协议端口模板集合实例ID,例如:ppmg-e6dy460g。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。 - Offset *string `json:"Offset" name:"Offset"` + Offset *string `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。 - Limit *string `json:"Limit" name:"Limit"` + Limit *string `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeServiceTemplateGroupsRequest) ToJsonString() string { @@ -3268,13 +3951,13 @@ type DescribeServiceTemplateGroupsResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 协议端口模板集合。 - ServiceTemplateGroupSet []*ServiceTemplateGroup `json:"ServiceTemplateGroupSet" name:"ServiceTemplateGroupSet" list` + ServiceTemplateGroupSet []*ServiceTemplateGroup `json:"ServiceTemplateGroupSet,omitempty" name:"ServiceTemplateGroupSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3293,13 +3976,13 @@ type DescribeServiceTemplatesRequest struct { // 过滤条件。 //
  • service-template-name - String - (过滤条件)协议端口模板名称。
  • //
  • service-template-id - String - (过滤条件)协议端口模板实例ID,例如:ppm-e6dy460g。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。 - Offset *string `json:"Offset" name:"Offset"` + Offset *string `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。 - Limit *string `json:"Limit" name:"Limit"` + Limit *string `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeServiceTemplatesRequest) ToJsonString() string { @@ -3316,13 +3999,13 @@ type DescribeServiceTemplatesResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 协议端口模板对象。 - ServiceTemplateSet []*ServiceTemplate `json:"ServiceTemplateSet" name:"ServiceTemplateSet" list` + ServiceTemplateSet []*ServiceTemplate `json:"ServiceTemplateSet,omitempty" name:"ServiceTemplateSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3339,22 +4022,23 @@ type DescribeSubnetsRequest struct { *tchttp.BaseRequest // 子网实例ID查询。形如:subnet-pxir56ns。每次请求的实例的上限为100。参数不支持同时指定SubnetIds和Filters。 - SubnetIds []*string `json:"SubnetIds" name:"SubnetIds" list` + SubnetIds []*string `json:"SubnetIds,omitempty" name:"SubnetIds" list` // 过滤条件,参数不支持同时指定SubnetIds和Filters。 //
  • subnet-id - String - (过滤条件)Subnet实例名称。
  • //
  • vpc-id - String - (过滤条件)VPC实例ID,形如:vpc-f49l6u0z。
  • - //
  • cidr-block - String - (过滤条件)vpc的cidr。
  • + //
  • cidr-block - String - (过滤条件)子网网段,形如: 192.168.1.0 。
  • //
  • is-default - Boolean - (过滤条件)是否是默认子网。
  • + //
  • is-remote-vpc-snat - Boolean - (过滤条件)是否为VPC SNAT地址池子网。
  • //
  • subnet-name - String - (过滤条件)子网名称。
  • //
  • zone - String - (过滤条件)可用区。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量 - Offset *string `json:"Offset" name:"Offset"` + Offset *string `json:"Offset,omitempty" name:"Offset"` // 返回数量 - Limit *string `json:"Limit" name:"Limit"` + Limit *string `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeSubnetsRequest) ToJsonString() string { @@ -3371,13 +4055,13 @@ type DescribeSubnetsResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // 子网对象。 - SubnetSet []*Subnet `json:"SubnetSet" name:"SubnetSet" list` + SubnetSet []*Subnet `json:"SubnetSet,omitempty" name:"SubnetSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3390,24 +4074,113 @@ func (r *DescribeSubnetsResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DescribeVpcIpv6AddressesRequest struct { + *tchttp.BaseRequest + + // `VPC`实例`ID`,形如:`vpc-f49l6u0z`。 + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // `IP`地址列表,批量查询单次请求最多支持`10`个。 + Ipv6Addresses []*string `json:"Ipv6Addresses,omitempty" name:"Ipv6Addresses" list` + + // 偏移量。 + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 返回数量。 + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` +} + +func (r *DescribeVpcIpv6AddressesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeVpcIpv6AddressesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeVpcIpv6AddressesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // `IPv6`地址列表。 + Ipv6AddressSet []*VpcIpv6Address `json:"Ipv6AddressSet,omitempty" name:"Ipv6AddressSet" list` + + // `IPv6`地址总数。 + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeVpcIpv6AddressesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeVpcIpv6AddressesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeVpcPrivateIpAddressesRequest struct { + *tchttp.BaseRequest + + // `VPC`实例`ID`,形如:`vpc-f49l6u0z`。 + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // 内网`IP`地址列表,批量查询单次请求最多支持`10`个。 + PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list` +} + +func (r *DescribeVpcPrivateIpAddressesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeVpcPrivateIpAddressesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeVpcPrivateIpAddressesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 内网`IP`地址信息列表。 + VpcPrivateIpAddressSet []*VpcPrivateIpAddress `json:"VpcPrivateIpAddressSet,omitempty" name:"VpcPrivateIpAddressSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeVpcPrivateIpAddressesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeVpcPrivateIpAddressesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DescribeVpcsRequest struct { *tchttp.BaseRequest // VPC实例ID。形如:vpc-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定VpcIds和Filters。 - VpcIds []*string `json:"VpcIds" name:"VpcIds" list` + VpcIds []*string `json:"VpcIds,omitempty" name:"VpcIds" list` // 过滤条件,参数不支持同时指定VpcIds和Filters。 //
  • vpc-name - String - (过滤条件)VPC实例名称。
  • //
  • is-default - String - (过滤条件)是否默认VPC。
  • //
  • vpc-id - String - (过滤条件)VPC实例ID形如:vpc-f49l6u0z。
  • //
  • cidr-block - String - (过滤条件)vpc的cidr。
  • - Filters []*Filter `json:"Filters" name:"Filters" list` + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量 - Offset *string `json:"Offset" name:"Offset"` + Offset *string `json:"Offset,omitempty" name:"Offset"` // 返回数量 - Limit *string `json:"Limit" name:"Limit"` + Limit *string `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeVpcsRequest) ToJsonString() string { @@ -3424,13 +4197,13 @@ type DescribeVpcsResponse struct { Response *struct { // 符合条件的对象数。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // VPC对象。 - VpcSet []*Vpc `json:"VpcSet" name:"VpcSet" list` + VpcSet []*Vpc `json:"VpcSet,omitempty" name:"VpcSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3447,16 +4220,21 @@ type DescribeVpnConnectionsRequest struct { *tchttp.BaseRequest // VPN通道实例ID。形如:vpnx-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定VpnConnectionIds和Filters。 - VpnConnectionIds []*string `json:"VpnConnectionIds" name:"VpnConnectionIds" list` + VpnConnectionIds []*string `json:"VpnConnectionIds,omitempty" name:"VpnConnectionIds" list` // 过滤条件,详见下表:实例过滤条件表。每次请求的Filters的上限为10,Filter.Values的上限为5。参数不支持同时指定VpnConnectionIds和Filters。 - Filters []*Filter `json:"Filters" name:"Filters" list` + //
  • vpc-id - String - VPC实例ID,形如:`vpc-0a36uwkr`。
  • + //
  • vpn-gateway-id - String - VPN网关实例ID,形如:`vpngw-p4lmqawn`。
  • + //
  • customer-gateway-id - String - 对端网关实例ID,形如:`cgw-l4rblw63`。
  • + //
  • vpn-connection-name - String - 通道名称,形如:`test-vpn`。
  • + //
  • vpn-connection-id - String - 通道实例ID,形如:`vpnx-5p7vkch8"`。
  • + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` // 偏移量,默认为0。关于Offset的更进一步介绍请参考 API 简介中的相关小节。 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 返回数量,默认为20,最大值为100。 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeVpnConnectionsRequest) ToJsonString() string { @@ -3473,13 +4251,13 @@ type DescribeVpnConnectionsResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // VPN通道实例。 - VpnConnectionSet []*VpnConnection `json:"VpnConnectionSet" name:"VpnConnectionSet" list` + VpnConnectionSet []*VpnConnection `json:"VpnConnectionSet,omitempty" name:"VpnConnectionSet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3496,7 +4274,7 @@ type DescribeVpnGatewaysRequest struct { *tchttp.BaseRequest // VPN网关实例ID。形如:vpngw-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定VpnGatewayIds和Filters。 - VpnGatewayIds []*string `json:"VpnGatewayIds" name:"VpnGatewayIds" list` + VpnGatewayIds []*string `json:"VpnGatewayIds,omitempty" name:"VpnGatewayIds" list` // 过滤条件,参数不支持同时指定VpnGatewayIds和Filters。 //
  • vpc-id - String - (过滤条件)VPC实例ID形如:vpc-f49l6u0z。
  • @@ -3506,13 +4284,13 @@ type DescribeVpnGatewaysRequest struct { //
  • public-ip-address- String - (过滤条件)公网IP。
  • //
  • renew-flag - String - (过滤条件)网关续费类型,手动续费:'NOTIFY_AND_MANUAL_RENEW'、自动续费:'NOTIFY_AND_AUTO_RENEW'。
  • //
  • zone - String - (过滤条件)VPN所在可用区,形如:ap-guangzhou-2。
  • - Filters []*FilterObject `json:"Filters" name:"Filters" list` + Filters []*FilterObject `json:"Filters,omitempty" name:"Filters" list` // 偏移量 - Offset *uint64 `json:"Offset" name:"Offset"` + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` // 请求对象个数 - Limit *uint64 `json:"Limit" name:"Limit"` + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` } func (r *DescribeVpnGatewaysRequest) ToJsonString() string { @@ -3529,13 +4307,13 @@ type DescribeVpnGatewaysResponse struct { Response *struct { // 符合条件的实例数量。 - TotalCount *uint64 `json:"TotalCount" name:"TotalCount"` + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` // VPN网关实例详细信息列表。 - VpnGatewaySet []*VpnGateway `json:"VpnGatewaySet" name:"VpnGatewaySet" list` + VpnGatewaySet []*VpnGateway `json:"VpnGatewaySet,omitempty" name:"VpnGatewaySet" list` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3552,10 +4330,10 @@ type DetachCcnInstancesRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // 要解关联网络实例列表 - Instances []*CcnInstance `json:"Instances" name:"Instances" list` + Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list` } func (r *DetachCcnInstancesRequest) ToJsonString() string { @@ -3572,7 +4350,7 @@ type DetachCcnInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3589,10 +4367,10 @@ type DetachClassicLinkVpcRequest struct { *tchttp.BaseRequest // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // CVM实例ID查询。形如:ins-r8hr2upy。 - InstanceIds []*string `json:"InstanceIds" name:"InstanceIds" list` + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list` } func (r *DetachClassicLinkVpcRequest) ToJsonString() string { @@ -3609,7 +4387,7 @@ type DetachClassicLinkVpcResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3626,10 +4404,10 @@ type DetachNetworkInterfaceRequest struct { *tchttp.BaseRequest // 弹性网卡实例ID,例如:eni-m6dyj72l。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // CVM实例ID。形如:ins-r8hr2upy。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` } func (r *DetachNetworkInterfaceRequest) ToJsonString() string { @@ -3646,7 +4424,7 @@ type DetachNetworkInterfaceResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3662,68 +4440,68 @@ func (r *DetachNetworkInterfaceResponse) FromJsonString(s string) error { type DirectConnectGateway struct { // 专线网关`ID`。 - DirectConnectGatewayId *string `json:"DirectConnectGatewayId" name:"DirectConnectGatewayId"` + DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"` // 专线网关名称。 - DirectConnectGatewayName *string `json:"DirectConnectGatewayName" name:"DirectConnectGatewayName"` + DirectConnectGatewayName *string `json:"DirectConnectGatewayName,omitempty" name:"DirectConnectGatewayName"` // 专线网关关联`VPC`实例`ID`。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 关联网络类型: //
  • `VPC` - 私有网络
  • //
  • `CCN` - 云联网
  • - NetworkType *string `json:"NetworkType" name:"NetworkType"` + NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"` // 关联网络实例`ID`: //
  • `NetworkType`为`VPC`时,这里为私有网络实例`ID`
  • //
  • `NetworkType`为`CCN`时,这里为云联网实例`ID`
  • - NetworkInstanceId *string `json:"NetworkInstanceId" name:"NetworkInstanceId"` + NetworkInstanceId *string `json:"NetworkInstanceId,omitempty" name:"NetworkInstanceId"` // 网关类型: //
  • NORMAL - 标准型,注:云联网只支持标准型
  • //
  • NAT - NAT型
  • // NAT类型支持网络地址转换配置,类型确定后不能修改;一个私有网络可以创建一个NAT类型的专线网关和一个非NAT类型的专线网关 - GatewayType *string `json:"GatewayType" name:"GatewayType"` + GatewayType *string `json:"GatewayType,omitempty" name:"GatewayType"` // 创建时间。 - CreateTime *string `json:"CreateTime" name:"CreateTime"` + CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"` // 专线网关IP。 - DirectConnectGatewayIp *string `json:"DirectConnectGatewayIp" name:"DirectConnectGatewayIp"` + DirectConnectGatewayIp *string `json:"DirectConnectGatewayIp,omitempty" name:"DirectConnectGatewayIp"` // 专线网关关联`CCN`实例`ID`。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // 云联网路由学习类型: //
  • `BGP` - 自动学习。
  • //
  • `STATIC` - 静态,即用户配置。
  • - CcnRouteType *string `json:"CcnRouteType" name:"CcnRouteType"` + CcnRouteType *string `json:"CcnRouteType,omitempty" name:"CcnRouteType"` // 是否启用BGP。 - EnableBGP *bool `json:"EnableBGP" name:"EnableBGP"` + EnableBGP *bool `json:"EnableBGP,omitempty" name:"EnableBGP"` } type DirectConnectGatewayCcnRoute struct { // 路由ID。 - RouteId *string `json:"RouteId" name:"RouteId"` + RouteId *string `json:"RouteId,omitempty" name:"RouteId"` // IDC网段。 - DestinationCidrBlock *string `json:"DestinationCidrBlock" name:"DestinationCidrBlock"` + DestinationCidrBlock *string `json:"DestinationCidrBlock,omitempty" name:"DestinationCidrBlock"` // `BGP`的`AS-Path`属性。 - ASPath []*string `json:"ASPath" name:"ASPath" list` + ASPath []*string `json:"ASPath,omitempty" name:"ASPath" list` } type DisableCcnRoutesRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // CCN路由策略唯一ID。形如:ccnr-f49l6u0z。 - RouteIds []*string `json:"RouteIds" name:"RouteIds" list` + RouteIds []*string `json:"RouteIds,omitempty" name:"RouteIds" list` } func (r *DisableCcnRoutesRequest) ToJsonString() string { @@ -3740,7 +4518,7 @@ type DisableCcnRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3757,10 +4535,10 @@ type DisableRoutesRequest struct { *tchttp.BaseRequest // 路由表唯一ID。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 路由策略唯一ID。 - RouteIds []*uint64 `json:"RouteIds" name:"RouteIds" list` + RouteIds []*uint64 `json:"RouteIds,omitempty" name:"RouteIds" list` } func (r *DisableRoutesRequest) ToJsonString() string { @@ -3777,7 +4555,7 @@ type DisableRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3794,10 +4572,10 @@ type DisassociateAddressRequest struct { *tchttp.BaseRequest // 标识 EIP 的唯一 ID。EIP 唯一 ID 形如:`eip-11112222`。 - AddressId *string `json:"AddressId" name:"AddressId"` + AddressId *string `json:"AddressId,omitempty" name:"AddressId"` // 表示解绑 EIP 之后是否分配普通公网 IP。取值范围:
  • TRUE:表示解绑 EIP 之后分配普通公网 IP。
  • FALSE:表示解绑 EIP 之后不分配普通公网 IP。
    默认取值:FALSE。

    只有满足以下条件时才能指定该参数:
  • 只有在解绑主网卡的主内网 IP 上的 EIP 时才能指定该参数。
  • 解绑 EIP 后重新分配普通公网 IP 操作一个账号每天最多操作 10 次;详情可通过 [DescribeAddressQuota](https://cloud.tencent.com/document/api/213/1378) 接口获取。 - ReallocateNormalPublicIp *bool `json:"ReallocateNormalPublicIp" name:"ReallocateNormalPublicIp"` + ReallocateNormalPublicIp *bool `json:"ReallocateNormalPublicIp,omitempty" name:"ReallocateNormalPublicIp"` } func (r *DisassociateAddressRequest) ToJsonString() string { @@ -3814,7 +4592,7 @@ type DisassociateAddressResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3831,16 +4609,16 @@ type DownloadCustomerGatewayConfigurationRequest struct { *tchttp.BaseRequest // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // VPN通道实例ID。形如:vpnx-f49l6u0z。 - VpnConnectionId *string `json:"VpnConnectionId" name:"VpnConnectionId"` + VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"` // 对端网关厂商信息对象,可通过DescribeCustomerGatewayVendors获取。 - CustomerGatewayVendor *CustomerGatewayVendor `json:"CustomerGatewayVendor" name:"CustomerGatewayVendor"` + CustomerGatewayVendor *CustomerGatewayVendor `json:"CustomerGatewayVendor,omitempty" name:"CustomerGatewayVendor"` // 通道接入设备物理接口名称。 - InterfaceName *string `json:"InterfaceName" name:"InterfaceName"` + InterfaceName *string `json:"InterfaceName,omitempty" name:"InterfaceName"` } func (r *DownloadCustomerGatewayConfigurationRequest) ToJsonString() string { @@ -3857,10 +4635,10 @@ type DownloadCustomerGatewayConfigurationResponse struct { Response *struct { // XML格式配置信息。 - CustomerGatewayConfiguration *string `json:"CustomerGatewayConfiguration" name:"CustomerGatewayConfiguration"` + CustomerGatewayConfiguration *string `json:"CustomerGatewayConfiguration,omitempty" name:"CustomerGatewayConfiguration"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3877,10 +4655,10 @@ type EnableCcnRoutesRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // CCN路由策略唯一ID。形如:ccnr-f49l6u0z。 - RouteIds []*string `json:"RouteIds" name:"RouteIds" list` + RouteIds []*string `json:"RouteIds,omitempty" name:"RouteIds" list` } func (r *EnableCcnRoutesRequest) ToJsonString() string { @@ -3897,7 +4675,7 @@ type EnableCcnRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3914,10 +4692,10 @@ type EnableRoutesRequest struct { *tchttp.BaseRequest // 路由表唯一ID。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 路由策略唯一ID。 - RouteIds []*uint64 `json:"RouteIds" name:"RouteIds" list` + RouteIds []*uint64 `json:"RouteIds,omitempty" name:"RouteIds" list` } func (r *EnableRoutesRequest) ToJsonString() string { @@ -3934,7 +4712,7 @@ type EnableRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -3950,64 +4728,115 @@ func (r *EnableRoutesResponse) FromJsonString(s string) error { type Filter struct { // 属性名称, 若存在多个Filter时,Filter间的关系为逻辑与(AND)关系。 - Name *string `json:"Name" name:"Name"` + Name *string `json:"Name,omitempty" name:"Name"` // 属性值, 若同一个Filter存在多个Values,同一Filter下Values间的关系为逻辑或(OR)关系。 - Values []*string `json:"Values" name:"Values" list` + Values []*string `json:"Values,omitempty" name:"Values" list` } type FilterObject struct { // 属性名称, 若存在多个Filter时,Filter间的关系为逻辑与(AND)关系。 - Name *string `json:"Name" name:"Name"` + Name *string `json:"Name,omitempty" name:"Name"` // 属性值, 若同一个Filter存在多个Values,同一Filter下Values间的关系为逻辑或(OR)关系。 - Values []*string `json:"Values" name:"Values" list` + Values []*string `json:"Values,omitempty" name:"Values" list` +} + +type FlowLog struct { + + // 私用网络ID或者统一ID,建议使用统一ID + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // 流日志唯一ID + FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"` + + // 流日志实例名字 + FlowLogName *string `json:"FlowLogName,omitempty" name:"FlowLogName"` + + // 流日志所属资源类型,VPC|SUBNET|NETWORKINTERFACE + ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"` + + // 资源唯一ID + ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"` + + // 流日志采集类型,ACCEPT|REJECT|ALL + TrafficType *string `json:"TrafficType,omitempty" name:"TrafficType"` + + // 流日志存储ID + CloudLogId *string `json:"CloudLogId,omitempty" name:"CloudLogId"` + + // 流日志存储ID状态 + CloudLogState *string `json:"CloudLogState,omitempty" name:"CloudLogState"` + + // 流日志描述信息 + FlowLogDescription *string `json:"FlowLogDescription,omitempty" name:"FlowLogDescription"` + + // 流日志创建时间 + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` +} + +type GatewayFlowMonitorDetail struct { + + // 来源`IP`。 + PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"` + + // 入包量。 + InPkg *uint64 `json:"InPkg,omitempty" name:"InPkg"` + + // 出包量。 + OutPkg *uint64 `json:"OutPkg,omitempty" name:"OutPkg"` + + // 入带宽,单位:`Byte`。 + InTraffic *uint64 `json:"InTraffic,omitempty" name:"InTraffic"` + + // 出带宽,单位:`Byte`。 + OutTraffic *uint64 `json:"OutTraffic,omitempty" name:"OutTraffic"` } type HaVip struct { // `HAVIP`的`ID`,是`HAVIP`的唯一标识。 - HaVipId *string `json:"HaVipId" name:"HaVipId"` + HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"` // `HAVIP`名称。 - HaVipName *string `json:"HaVipName" name:"HaVipName"` + HaVipName *string `json:"HaVipName,omitempty" name:"HaVipName"` // 虚拟IP地址。 - Vip *string `json:"Vip" name:"Vip"` + Vip *string `json:"Vip,omitempty" name:"Vip"` // `HAVIP`所在私有网络`ID`。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // `HAVIP`所在子网`ID`。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` // `HAVIP`关联弹性网卡`ID`。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // 被绑定的实例`ID`。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 绑定`EIP`。 - AddressIp *string `json:"AddressIp" name:"AddressIp"` + AddressIp *string `json:"AddressIp,omitempty" name:"AddressIp"` // 状态: //
  • `AVAILABLE`:运行中
  • //
  • `UNBIND`:未绑定
  • - State *string `json:"State" name:"State"` + State *string `json:"State,omitempty" name:"State"` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type HaVipAssociateAddressIpRequest struct { *tchttp.BaseRequest // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。必须是没有绑定`EIP`的`HAVIP` - HaVipId *string `json:"HaVipId" name:"HaVipId"` + HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"` // 弹性公网`IP`。必须是没有绑定`HAVIP`的`EIP` - AddressIp *string `json:"AddressIp" name:"AddressIp"` + AddressIp *string `json:"AddressIp,omitempty" name:"AddressIp"` } func (r *HaVipAssociateAddressIpRequest) ToJsonString() string { @@ -4024,7 +4853,7 @@ type HaVipAssociateAddressIpResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4041,7 +4870,7 @@ type HaVipDisassociateAddressIpRequest struct { *tchttp.BaseRequest // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。必须是已绑定`EIP`的`HAVIP`。 - HaVipId *string `json:"HaVipId" name:"HaVipId"` + HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"` } func (r *HaVipDisassociateAddressIpRequest) ToJsonString() string { @@ -4058,7 +4887,7 @@ type HaVipDisassociateAddressIpResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4074,71 +4903,71 @@ func (r *HaVipDisassociateAddressIpResponse) FromJsonString(s string) error { type IKEOptionsSpecification struct { // 加密算法,可选值:'3DES-CBC', 'AES-CBC-128', 'AES-CBS-192', 'AES-CBC-256', 'DES-CBC',默认为3DES-CBC - PropoEncryAlgorithm *string `json:"PropoEncryAlgorithm" name:"PropoEncryAlgorithm"` + PropoEncryAlgorithm *string `json:"PropoEncryAlgorithm,omitempty" name:"PropoEncryAlgorithm"` // 认证算法:可选值:'MD5', 'SHA1',默认为MD5 - PropoAuthenAlgorithm *string `json:"PropoAuthenAlgorithm" name:"PropoAuthenAlgorithm"` + PropoAuthenAlgorithm *string `json:"PropoAuthenAlgorithm,omitempty" name:"PropoAuthenAlgorithm"` // 协商模式:可选值:'AGGRESSIVE', 'MAIN',默认为MAIN - ExchangeMode *string `json:"ExchangeMode" name:"ExchangeMode"` + ExchangeMode *string `json:"ExchangeMode,omitempty" name:"ExchangeMode"` // 本端标识类型:可选值:'ADDRESS', 'FQDN',默认为ADDRESS - LocalIdentity *string `json:"LocalIdentity" name:"LocalIdentity"` + LocalIdentity *string `json:"LocalIdentity,omitempty" name:"LocalIdentity"` // 对端标识类型:可选值:'ADDRESS', 'FQDN',默认为ADDRESS - RemoteIdentity *string `json:"RemoteIdentity" name:"RemoteIdentity"` + RemoteIdentity *string `json:"RemoteIdentity,omitempty" name:"RemoteIdentity"` // 本端标识,当LocalIdentity选为ADDRESS时,LocalAddress必填。localAddress默认为vpn网关公网IP - LocalAddress *string `json:"LocalAddress" name:"LocalAddress"` + LocalAddress *string `json:"LocalAddress,omitempty" name:"LocalAddress"` // 对端标识,当RemoteIdentity选为ADDRESS时,RemoteAddress必填 - RemoteAddress *string `json:"RemoteAddress" name:"RemoteAddress"` + RemoteAddress *string `json:"RemoteAddress,omitempty" name:"RemoteAddress"` // 本端标识,当LocalIdentity选为FQDN时,LocalFqdnName必填 - LocalFqdnName *string `json:"LocalFqdnName" name:"LocalFqdnName"` + LocalFqdnName *string `json:"LocalFqdnName,omitempty" name:"LocalFqdnName"` // 对端标识,当remoteIdentity选为FQDN时,RemoteFqdnName必填 - RemoteFqdnName *string `json:"RemoteFqdnName" name:"RemoteFqdnName"` + RemoteFqdnName *string `json:"RemoteFqdnName,omitempty" name:"RemoteFqdnName"` // DH group,指定IKE交换密钥时使用的DH组,可选值:'GROUP1', 'GROUP2', 'GROUP5', 'GROUP14', 'GROUP24', - DhGroupName *string `json:"DhGroupName" name:"DhGroupName"` + DhGroupName *string `json:"DhGroupName,omitempty" name:"DhGroupName"` // IKE SA Lifetime,单位:秒,设置IKE SA的生存周期,取值范围:60-604800 - IKESaLifetimeSeconds *uint64 `json:"IKESaLifetimeSeconds" name:"IKESaLifetimeSeconds"` + IKESaLifetimeSeconds *uint64 `json:"IKESaLifetimeSeconds,omitempty" name:"IKESaLifetimeSeconds"` // IKE版本 - IKEVersion *string `json:"IKEVersion" name:"IKEVersion"` + IKEVersion *string `json:"IKEVersion,omitempty" name:"IKEVersion"` } type IPSECOptionsSpecification struct { // 加密算法,可选值:'3DES-CBC', 'AES-CBC-128', 'AES-CBC-192', 'AES-CBC-256', 'DES-CBC', 'NULL', 默认为AES-CBC-128 - EncryptAlgorithm *string `json:"EncryptAlgorithm" name:"EncryptAlgorithm"` + EncryptAlgorithm *string `json:"EncryptAlgorithm,omitempty" name:"EncryptAlgorithm"` // 认证算法:可选值:'MD5', 'SHA1',默认为 - IntegrityAlgorith *string `json:"IntegrityAlgorith" name:"IntegrityAlgorith"` + IntegrityAlgorith *string `json:"IntegrityAlgorith,omitempty" name:"IntegrityAlgorith"` // IPsec SA lifetime(s):单位秒,取值范围:180-604800 - IPSECSaLifetimeSeconds *uint64 `json:"IPSECSaLifetimeSeconds" name:"IPSECSaLifetimeSeconds"` + IPSECSaLifetimeSeconds *uint64 `json:"IPSECSaLifetimeSeconds,omitempty" name:"IPSECSaLifetimeSeconds"` // PFS:可选值:'NULL', 'DH-GROUP1', 'DH-GROUP2', 'DH-GROUP5', 'DH-GROUP14', 'DH-GROUP24',默认为NULL - PfsDhGroup *string `json:"PfsDhGroup" name:"PfsDhGroup"` + PfsDhGroup *string `json:"PfsDhGroup,omitempty" name:"PfsDhGroup"` // IPsec SA lifetime(KB):单位KB,取值范围:2560-604800 - IPSECSaLifetimeTraffic *uint64 `json:"IPSECSaLifetimeTraffic" name:"IPSECSaLifetimeTraffic"` + IPSECSaLifetimeTraffic *uint64 `json:"IPSECSaLifetimeTraffic,omitempty" name:"IPSECSaLifetimeTraffic"` } type InquiryPriceCreateVpnGatewayRequest struct { *tchttp.BaseRequest // 公网带宽设置。可选带宽规格:5, 10, 20, 50, 100;单位:Mbps。 - InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut" name:"InternetMaxBandwidthOut"` + InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"` // VPN网关计费模式,PREPAID:表示预付费,即包年包月,POSTPAID_BY_HOUR:表示后付费,即按量计费。默认:POSTPAID_BY_HOUR,如果指定预付费模式,参数InstanceChargePrepaid必填。 - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` } func (r *InquiryPriceCreateVpnGatewayRequest) ToJsonString() string { @@ -4155,10 +4984,10 @@ type InquiryPriceCreateVpnGatewayResponse struct { Response *struct { // 商品价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4175,10 +5004,10 @@ type InquiryPriceRenewVpnGatewayRequest struct { *tchttp.BaseRequest // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` } func (r *InquiryPriceRenewVpnGatewayRequest) ToJsonString() string { @@ -4195,10 +5024,10 @@ type InquiryPriceRenewVpnGatewayResponse struct { Response *struct { // 商品价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4215,10 +5044,10 @@ type InquiryPriceResetVpnGatewayInternetMaxBandwidthRequest struct { *tchttp.BaseRequest // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // 公网带宽设置。可选带宽规格:5, 10, 20, 50, 100;单位:Mbps。 - InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut" name:"InternetMaxBandwidthOut"` + InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"` } func (r *InquiryPriceResetVpnGatewayInternetMaxBandwidthRequest) ToJsonString() string { @@ -4235,10 +5064,10 @@ type InquiryPriceResetVpnGatewayInternetMaxBandwidthResponse struct { Response *struct { // 商品价格。 - Price *Price `json:"Price" name:"Price"` + Price *Price `json:"Price,omitempty" name:"Price"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4253,39 +5082,154 @@ func (r *InquiryPriceResetVpnGatewayInternetMaxBandwidthResponse) FromJsonString type InstanceChargePrepaid struct { - // 购买实例的时长,单位:月。取值范围:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36。 - Period *uint64 `json:"Period" name:"Period"` + // 购买实例的时长,单位:月。取值范围:1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36。 + Period *uint64 `json:"Period,omitempty" name:"Period"` // 自动续费标识。取值范围: NOTIFY_AND_AUTO_RENEW:通知过期且自动续费, NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费。默认:NOTIFY_AND_MANUAL_RENEW - RenewFlag *string `json:"RenewFlag" name:"RenewFlag"` + RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"` +} + +type InstanceStatistic struct { + + // 实例的类型 + InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"` + + // 实例的个数 + InstanceCount *uint64 `json:"InstanceCount,omitempty" name:"InstanceCount"` +} + +type Ip6Rule struct { + + // IPV6转换规则唯一ID,形如rule6-xxxxxxxx + Ip6RuleId *string `json:"Ip6RuleId,omitempty" name:"Ip6RuleId"` + + // IPV6转换规则名称 + Ip6RuleName *string `json:"Ip6RuleName,omitempty" name:"Ip6RuleName"` + + // IPV6地址 + Vip6 *string `json:"Vip6,omitempty" name:"Vip6"` + + // IPV6端口号 + Vport6 *int64 `json:"Vport6,omitempty" name:"Vport6"` + + // 协议类型,支持TCP/UDP + Protocol *string `json:"Protocol,omitempty" name:"Protocol"` + + // IPV4地址 + Vip *string `json:"Vip,omitempty" name:"Vip"` + + // IPV4端口号 + Vport *int64 `json:"Vport,omitempty" name:"Vport"` + + // 转换规则状态,限于CREATING,RUNNING,DELETING,MODIFYING + RuleStatus *string `json:"RuleStatus,omitempty" name:"RuleStatus"` + + // 转换规则创建时间 + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` +} + +type Ip6RuleInfo struct { + + // IPV6端口号,可在0~65535范围取值 + Vport6 *int64 `json:"Vport6,omitempty" name:"Vport6"` + + // 协议类型,支持TCP/UDP + Protocol *string `json:"Protocol,omitempty" name:"Protocol"` + + // IPV4地址 + Vip *string `json:"Vip,omitempty" name:"Vip"` + + // IPV4端口号,可在0~65535范围取值 + Vport *int64 `json:"Vport,omitempty" name:"Vport"` +} + +type Ip6Translator struct { + + // IPV6转换实例唯一ID,形如ip6-xxxxxxxx + Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"` + + // IPV6转换实例名称 + Ip6TranslatorName *string `json:"Ip6TranslatorName,omitempty" name:"Ip6TranslatorName"` + + // IPV6地址 + Vip6 *string `json:"Vip6,omitempty" name:"Vip6"` + + // IPV6转换地址所属运营商 + IspName *string `json:"IspName,omitempty" name:"IspName"` + + // 转换实例状态,限于CREATING,RUNNING,DELETING,MODIFYING + TranslatorStatus *string `json:"TranslatorStatus,omitempty" name:"TranslatorStatus"` + + // IPV6转换实例创建时间 + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` + + // 绑定的IPV6转换规则数量 + Ip6RuleCount *int64 `json:"Ip6RuleCount,omitempty" name:"Ip6RuleCount"` + + // IPV6转换规则信息 + IP6RuleSet []*Ip6Rule `json:"IP6RuleSet,omitempty" name:"IP6RuleSet" list` +} + +type Ipv6Address struct { + + // `IPv6`地址,形如:`3402:4e00:20:100:0:8cd9:2a67:71f3` + Address *string `json:"Address,omitempty" name:"Address"` + + // 是否是主`IP`。 + Primary *bool `json:"Primary,omitempty" name:"Primary"` + + // `EIP`实例`ID`,形如:`eip-hxlqja90`。 + AddressId *string `json:"AddressId,omitempty" name:"AddressId"` + + // 描述信息。 + Description *string `json:"Description,omitempty" name:"Description"` + + // 公网IP是否被封堵。 + IsWanIpBlocked *bool `json:"IsWanIpBlocked,omitempty" name:"IsWanIpBlocked"` + + // `IPv6`地址状态: + //
  • `PENDING`:生产中
  • + //
  • `MIGRATING`:迁移中
  • + //
  • `DELETING`:删除中
  • + //
  • `AVAILABLE`:可用的
  • + State *string `json:"State,omitempty" name:"State"` +} + +type Ipv6SubnetCidrBlock struct { + + // 子网实例`ID`。形如:`subnet-pxir56ns`。 + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` + + // `IPv6`子网段。形如:`3402:4e00:20:1001::/64` + Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"` } type ItemPrice struct { // 按量计费后付费单价,单位:元。 - UnitPrice *float64 `json:"UnitPrice" name:"UnitPrice"` + UnitPrice *float64 `json:"UnitPrice,omitempty" name:"UnitPrice"` // 按量计费后付费计价单元,可取值范围: HOUR:表示计价单元是按每小时来计算。当前涉及该计价单元的场景有:实例按小时后付费(POSTPAID_BY_HOUR)、带宽按小时后付费(BANDWIDTH_POSTPAID_BY_HOUR): GB:表示计价单元是按每GB来计算。当前涉及该计价单元的场景有:流量按小时后付费(TRAFFIC_POSTPAID_BY_HOUR)。 - ChargeUnit *string `json:"ChargeUnit" name:"ChargeUnit"` + ChargeUnit *string `json:"ChargeUnit,omitempty" name:"ChargeUnit"` // 预付费商品的原价,单位:元。 - OriginalPrice *float64 `json:"OriginalPrice" name:"OriginalPrice"` + OriginalPrice *float64 `json:"OriginalPrice,omitempty" name:"OriginalPrice"` // 预付费商品的折扣价,单位:元。 - DiscountPrice *float64 `json:"DiscountPrice" name:"DiscountPrice"` + DiscountPrice *float64 `json:"DiscountPrice,omitempty" name:"DiscountPrice"` } type MigrateNetworkInterfaceRequest struct { *tchttp.BaseRequest // 弹性网卡实例ID,例如:eni-m6dyj72l。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // 弹性网卡当前绑定的CVM实例ID。形如:ins-r8hr2upy。 - SourceInstanceId *string `json:"SourceInstanceId" name:"SourceInstanceId"` + SourceInstanceId *string `json:"SourceInstanceId,omitempty" name:"SourceInstanceId"` // 待迁移的目的CVM实例ID。 - DestinationInstanceId *string `json:"DestinationInstanceId" name:"DestinationInstanceId"` + DestinationInstanceId *string `json:"DestinationInstanceId,omitempty" name:"DestinationInstanceId"` } func (r *MigrateNetworkInterfaceRequest) ToJsonString() string { @@ -4302,7 +5246,7 @@ type MigrateNetworkInterfaceResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4319,13 +5263,13 @@ type MigratePrivateIpAddressRequest struct { *tchttp.BaseRequest // 当内网IP绑定的弹性网卡实例ID,例如:eni-m6dyj72l。 - SourceNetworkInterfaceId *string `json:"SourceNetworkInterfaceId" name:"SourceNetworkInterfaceId"` + SourceNetworkInterfaceId *string `json:"SourceNetworkInterfaceId,omitempty" name:"SourceNetworkInterfaceId"` // 待迁移的目的弹性网卡实例ID。 - DestinationNetworkInterfaceId *string `json:"DestinationNetworkInterfaceId" name:"DestinationNetworkInterfaceId"` + DestinationNetworkInterfaceId *string `json:"DestinationNetworkInterfaceId,omitempty" name:"DestinationNetworkInterfaceId"` // 迁移的内网IP地址,例如:10.0.0.6。 - PrivateIpAddress *string `json:"PrivateIpAddress" name:"PrivateIpAddress"` + PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"` } func (r *MigratePrivateIpAddressRequest) ToJsonString() string { @@ -4342,7 +5286,7 @@ type MigratePrivateIpAddressResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4359,10 +5303,10 @@ type ModifyAddressAttributeRequest struct { *tchttp.BaseRequest // 标识 EIP 的唯一 ID。EIP 唯一 ID 形如:`eip-11112222`。 - AddressId *string `json:"AddressId" name:"AddressId"` + AddressId *string `json:"AddressId,omitempty" name:"AddressId"` // 修改后的 EIP 名称。长度上限为20个字符。 - AddressName *string `json:"AddressName" name:"AddressName"` + AddressName *string `json:"AddressName,omitempty" name:"AddressName"` } func (r *ModifyAddressAttributeRequest) ToJsonString() string { @@ -4379,7 +5323,7 @@ type ModifyAddressAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4396,13 +5340,13 @@ type ModifyAddressTemplateAttributeRequest struct { *tchttp.BaseRequest // IP地址模板实例ID,例如:ipm-mdunqeb6。 - AddressTemplateId *string `json:"AddressTemplateId" name:"AddressTemplateId"` + AddressTemplateId *string `json:"AddressTemplateId,omitempty" name:"AddressTemplateId"` // IP地址模板名称。 - AddressTemplateName *string `json:"AddressTemplateName" name:"AddressTemplateName"` + AddressTemplateName *string `json:"AddressTemplateName,omitempty" name:"AddressTemplateName"` // 地址信息,支持 IP、CIDR、IP 范围。 - Addresses []*string `json:"Addresses" name:"Addresses" list` + Addresses []*string `json:"Addresses,omitempty" name:"Addresses" list` } func (r *ModifyAddressTemplateAttributeRequest) ToJsonString() string { @@ -4419,7 +5363,7 @@ type ModifyAddressTemplateAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4436,13 +5380,13 @@ type ModifyAddressTemplateGroupAttributeRequest struct { *tchttp.BaseRequest // IP地址模板集合实例ID,例如:ipmg-2uw6ujo6。 - AddressTemplateGroupId *string `json:"AddressTemplateGroupId" name:"AddressTemplateGroupId"` + AddressTemplateGroupId *string `json:"AddressTemplateGroupId,omitempty" name:"AddressTemplateGroupId"` // IP地址模板集合名称。 - AddressTemplateGroupName *string `json:"AddressTemplateGroupName" name:"AddressTemplateGroupName"` + AddressTemplateGroupName *string `json:"AddressTemplateGroupName,omitempty" name:"AddressTemplateGroupName"` // IP地址模板实例ID, 例如:ipm-mdunqeb6。 - AddressTemplateIds []*string `json:"AddressTemplateIds" name:"AddressTemplateIds" list` + AddressTemplateIds []*string `json:"AddressTemplateIds,omitempty" name:"AddressTemplateIds" list` } func (r *ModifyAddressTemplateGroupAttributeRequest) ToJsonString() string { @@ -4459,7 +5403,7 @@ type ModifyAddressTemplateGroupAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4476,16 +5420,16 @@ type ModifyAddressesBandwidthRequest struct { *tchttp.BaseRequest // EIP唯一标识id,形如'eip-xxxx' - AddressIds []*string `json:"AddressIds" name:"AddressIds" list` + AddressIds []*string `json:"AddressIds,omitempty" name:"AddressIds" list` // 调整带宽目标值 - InternetMaxBandwidthOut *int64 `json:"InternetMaxBandwidthOut" name:"InternetMaxBandwidthOut"` + InternetMaxBandwidthOut *int64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"` // 包月带宽起始时间 - StartTime *string `json:"StartTime" name:"StartTime"` + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` // 包月带宽结束时间 - EndTime *string `json:"EndTime" name:"EndTime"` + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` } func (r *ModifyAddressesBandwidthRequest) ToJsonString() string { @@ -4502,7 +5446,7 @@ type ModifyAddressesBandwidthResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4519,10 +5463,10 @@ type ModifyBandwidthPackageAttributeRequest struct { *tchttp.BaseRequest // 带宽包唯一标识ID - BandwidthPackageId *string `json:"BandwidthPackageId" name:"BandwidthPackageId"` + BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"` // 带宽包名称 - BandwidthPackageName *string `json:"BandwidthPackageName" name:"BandwidthPackageName"` + BandwidthPackageName *string `json:"BandwidthPackageName,omitempty" name:"BandwidthPackageName"` } func (r *ModifyBandwidthPackageAttributeRequest) ToJsonString() string { @@ -4539,7 +5483,7 @@ type ModifyBandwidthPackageAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4556,13 +5500,13 @@ type ModifyCcnAttributeRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // CCN名称,最大长度不能超过60个字节。 - CcnName *string `json:"CcnName" name:"CcnName"` + CcnName *string `json:"CcnName,omitempty" name:"CcnName"` // CCN描述信息,最大长度不能超过100个字节。 - CcnDescription *string `json:"CcnDescription" name:"CcnDescription"` + CcnDescription *string `json:"CcnDescription,omitempty" name:"CcnDescription"` } func (r *ModifyCcnAttributeRequest) ToJsonString() string { @@ -4579,7 +5523,7 @@ type ModifyCcnAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4596,10 +5540,10 @@ type ModifyCustomerGatewayAttributeRequest struct { *tchttp.BaseRequest // 对端网关ID,例如:cgw-2wqq41m9,可通过DescribeCustomerGateways接口查询对端网关。 - CustomerGatewayId *string `json:"CustomerGatewayId" name:"CustomerGatewayId"` + CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"` // 对端网关名称,可任意命名,但不得超过60个字符。 - CustomerGatewayName *string `json:"CustomerGatewayName" name:"CustomerGatewayName"` + CustomerGatewayName *string `json:"CustomerGatewayName,omitempty" name:"CustomerGatewayName"` } func (r *ModifyCustomerGatewayAttributeRequest) ToJsonString() string { @@ -4616,7 +5560,7 @@ type ModifyCustomerGatewayAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4633,13 +5577,13 @@ type ModifyDirectConnectGatewayAttributeRequest struct { *tchttp.BaseRequest // 专线网关唯一`ID`,形如:`dcg-9o233uri`。 - DirectConnectGatewayId *string `json:"DirectConnectGatewayId" name:"DirectConnectGatewayId"` + DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"` // 专线网关名称,可任意命名,但不得超过60个字符。 - DirectConnectGatewayName *string `json:"DirectConnectGatewayName" name:"DirectConnectGatewayName"` + DirectConnectGatewayName *string `json:"DirectConnectGatewayName,omitempty" name:"DirectConnectGatewayName"` // 云联网路由学习类型,可选值:`BGP`(自动学习)、`STATIC`(静态,即用户配置)。只有云联网类型专线网关且开启了BGP功能才支持修改`CcnRouteType`。 - CcnRouteType *string `json:"CcnRouteType" name:"CcnRouteType"` + CcnRouteType *string `json:"CcnRouteType,omitempty" name:"CcnRouteType"` } func (r *ModifyDirectConnectGatewayAttributeRequest) ToJsonString() string { @@ -4656,7 +5600,7 @@ type ModifyDirectConnectGatewayAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4669,14 +5613,57 @@ func (r *ModifyDirectConnectGatewayAttributeResponse) FromJsonString(s string) e return json.Unmarshal([]byte(s), &r) } +type ModifyFlowLogAttributeRequest struct { + *tchttp.BaseRequest + + // 私用网络ID或者统一ID,建议使用统一ID + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // 流日志唯一ID + FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"` + + // 流日志实例名字 + FlowLogName *string `json:"FlowLogName,omitempty" name:"FlowLogName"` + + // 流日志实例描述 + FlowLogDescription *string `json:"FlowLogDescription,omitempty" name:"FlowLogDescription"` +} + +func (r *ModifyFlowLogAttributeRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyFlowLogAttributeRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyFlowLogAttributeResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyFlowLogAttributeResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyFlowLogAttributeResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type ModifyHaVipAttributeRequest struct { *tchttp.BaseRequest // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。 - HaVipId *string `json:"HaVipId" name:"HaVipId"` + HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"` // `HAVIP`名称,可任意命名,但不得超过60个字符。 - HaVipName *string `json:"HaVipName" name:"HaVipName"` + HaVipName *string `json:"HaVipName,omitempty" name:"HaVipName"` } func (r *ModifyHaVipAttributeRequest) ToJsonString() string { @@ -4693,7 +5680,7 @@ type ModifyHaVipAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4706,20 +5693,140 @@ func (r *ModifyHaVipAttributeResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type ModifyIp6RuleRequest struct { + *tchttp.BaseRequest + + // IPV6转换实例唯一ID,形如ip6-xxxxxxxx + Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"` + + // IPV6转换规则唯一ID,形如rule6-xxxxxxxx + Ip6RuleId *string `json:"Ip6RuleId,omitempty" name:"Ip6RuleId"` + + // IPV6转换规则修改后的名称 + Ip6RuleName *string `json:"Ip6RuleName,omitempty" name:"Ip6RuleName"` + + // IPV6转换规则修改后的IPV4地址 + Vip *string `json:"Vip,omitempty" name:"Vip"` + + // IPV6转换规则修改后的IPV4端口号 + Vport *int64 `json:"Vport,omitempty" name:"Vport"` +} + +func (r *ModifyIp6RuleRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyIp6RuleRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyIp6RuleResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyIp6RuleResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyIp6RuleResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyIp6TranslatorRequest struct { + *tchttp.BaseRequest + + // IPV6转换实例唯一ID,形如ip6-xxxxxxxxx + Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"` + + // IPV6转换实例修改名称 + Ip6TranslatorName *string `json:"Ip6TranslatorName,omitempty" name:"Ip6TranslatorName"` +} + +func (r *ModifyIp6TranslatorRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyIp6TranslatorRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyIp6TranslatorResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyIp6TranslatorResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyIp6TranslatorResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyIpv6AddressesAttributeRequest struct { + *tchttp.BaseRequest + + // 弹性网卡实例`ID`,形如:`eni-m6dyj72l`。 + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` + + // 指定的内网IPv6`地址信息。 + Ipv6Addresses []*Ipv6Address `json:"Ipv6Addresses,omitempty" name:"Ipv6Addresses" list` +} + +func (r *ModifyIpv6AddressesAttributeRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyIpv6AddressesAttributeRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyIpv6AddressesAttributeResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyIpv6AddressesAttributeResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyIpv6AddressesAttributeResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type ModifyNetworkInterfaceAttributeRequest struct { *tchttp.BaseRequest // 弹性网卡实例ID,例如:eni-pxir56ns。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // 弹性网卡名称,最大长度不能超过60个字节。 - NetworkInterfaceName *string `json:"NetworkInterfaceName" name:"NetworkInterfaceName"` + NetworkInterfaceName *string `json:"NetworkInterfaceName,omitempty" name:"NetworkInterfaceName"` // 弹性网卡描述,可任意命名,但不得超过60个字符。 - NetworkInterfaceDescription *string `json:"NetworkInterfaceDescription" name:"NetworkInterfaceDescription"` + NetworkInterfaceDescription *string `json:"NetworkInterfaceDescription,omitempty" name:"NetworkInterfaceDescription"` // 指定绑定的安全组,例如:['sg-1dd51d']。 - SecurityGroupIds []*string `json:"SecurityGroupIds" name:"SecurityGroupIds" list` + SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list` } func (r *ModifyNetworkInterfaceAttributeRequest) ToJsonString() string { @@ -4736,7 +5843,7 @@ type ModifyNetworkInterfaceAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4753,10 +5860,10 @@ type ModifyPrivateIpAddressesAttributeRequest struct { *tchttp.BaseRequest // 弹性网卡实例ID,例如:eni-m6dyj72l。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // 指定的内网IP信息。 - PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses" name:"PrivateIpAddresses" list` + PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list` } func (r *ModifyPrivateIpAddressesAttributeRequest) ToJsonString() string { @@ -4773,7 +5880,7 @@ type ModifyPrivateIpAddressesAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4790,10 +5897,10 @@ type ModifyRouteTableAttributeRequest struct { *tchttp.BaseRequest // 路由表实例ID,例如:rtb-azd4dt1c。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 路由表名称。 - RouteTableName *string `json:"RouteTableName" name:"RouteTableName"` + RouteTableName *string `json:"RouteTableName,omitempty" name:"RouteTableName"` } func (r *ModifyRouteTableAttributeRequest) ToJsonString() string { @@ -4810,7 +5917,7 @@ type ModifyRouteTableAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4827,13 +5934,13 @@ type ModifySecurityGroupAttributeRequest struct { *tchttp.BaseRequest // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` // 安全组名称,可任意命名,但不得超过60个字符。 - GroupName *string `json:"GroupName" name:"GroupName"` + GroupName *string `json:"GroupName,omitempty" name:"GroupName"` // 安全组备注,最多100个字符。 - GroupDescription *string `json:"GroupDescription" name:"GroupDescription"` + GroupDescription *string `json:"GroupDescription,omitempty" name:"GroupDescription"` } func (r *ModifySecurityGroupAttributeRequest) ToJsonString() string { @@ -4850,7 +5957,7 @@ type ModifySecurityGroupAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4867,10 +5974,10 @@ type ModifySecurityGroupPoliciesRequest struct { *tchttp.BaseRequest // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` // 安全组规则集合。 SecurityGroupPolicySet对象必须同时指定新的出(Egress)入(Ingress)站规则。 SecurityGroupPolicy对象不支持自定义索引(PolicyIndex)。 - SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet" name:"SecurityGroupPolicySet"` + SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"` } func (r *ModifySecurityGroupPoliciesRequest) ToJsonString() string { @@ -4887,7 +5994,7 @@ type ModifySecurityGroupPoliciesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4904,13 +6011,13 @@ type ModifyServiceTemplateAttributeRequest struct { *tchttp.BaseRequest // 协议端口模板实例ID,例如:ppm-529nwwj8。 - ServiceTemplateId *string `json:"ServiceTemplateId" name:"ServiceTemplateId"` + ServiceTemplateId *string `json:"ServiceTemplateId,omitempty" name:"ServiceTemplateId"` // 协议端口模板名称。 - ServiceTemplateName *string `json:"ServiceTemplateName" name:"ServiceTemplateName"` + ServiceTemplateName *string `json:"ServiceTemplateName,omitempty" name:"ServiceTemplateName"` // 支持单个端口、多个端口、连续端口及所有端口,协议支持:TCP、UDP、ICMP、GRE 协议。 - Services []*string `json:"Services" name:"Services" list` + Services []*string `json:"Services,omitempty" name:"Services" list` } func (r *ModifyServiceTemplateAttributeRequest) ToJsonString() string { @@ -4927,7 +6034,7 @@ type ModifyServiceTemplateAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4944,13 +6051,13 @@ type ModifyServiceTemplateGroupAttributeRequest struct { *tchttp.BaseRequest // 协议端口模板集合实例ID,例如:ppmg-ei8hfd9a。 - ServiceTemplateGroupId *string `json:"ServiceTemplateGroupId" name:"ServiceTemplateGroupId"` + ServiceTemplateGroupId *string `json:"ServiceTemplateGroupId,omitempty" name:"ServiceTemplateGroupId"` // 协议端口模板集合名称。 - ServiceTemplateGroupName *string `json:"ServiceTemplateGroupName" name:"ServiceTemplateGroupName"` + ServiceTemplateGroupName *string `json:"ServiceTemplateGroupName,omitempty" name:"ServiceTemplateGroupName"` // 协议端口模板实例ID,例如:ppm-4dw6agho。 - ServiceTemplateIds []*string `json:"ServiceTemplateIds" name:"ServiceTemplateIds" list` + ServiceTemplateIds []*string `json:"ServiceTemplateIds,omitempty" name:"ServiceTemplateIds" list` } func (r *ModifyServiceTemplateGroupAttributeRequest) ToJsonString() string { @@ -4967,7 +6074,7 @@ type ModifyServiceTemplateGroupAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -4984,13 +6091,13 @@ type ModifySubnetAttributeRequest struct { *tchttp.BaseRequest // 子网实例ID。形如:subnet-pxir56ns。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` // 子网名称,最大长度不能超过60个字节。 - SubnetName *string `json:"SubnetName" name:"SubnetName"` + SubnetName *string `json:"SubnetName,omitempty" name:"SubnetName"` // 子网是否开启广播。 - EnableBroadcast *string `json:"EnableBroadcast" name:"EnableBroadcast"` + EnableBroadcast *string `json:"EnableBroadcast,omitempty" name:"EnableBroadcast"` } func (r *ModifySubnetAttributeRequest) ToJsonString() string { @@ -5007,7 +6114,7 @@ type ModifySubnetAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5024,19 +6131,19 @@ type ModifyVpcAttributeRequest struct { *tchttp.BaseRequest // VPC实例ID。形如:vpc-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定VpcIds和Filters。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 私有网络名称,可任意命名,但不得超过60个字符。 - VpcName *string `json:"VpcName" name:"VpcName"` + VpcName *string `json:"VpcName,omitempty" name:"VpcName"` // 是否开启组播。true: 开启, false: 关闭。 - EnableMulticast *string `json:"EnableMulticast" name:"EnableMulticast"` + EnableMulticast *string `json:"EnableMulticast,omitempty" name:"EnableMulticast"` // DNS地址,最多支持4个,第1个默认为主,其余为备 - DnsServers []*string `json:"DnsServers" name:"DnsServers" list` + DnsServers []*string `json:"DnsServers,omitempty" name:"DnsServers" list` // 域名 - DomainName *string `json:"DomainName" name:"DomainName"` + DomainName *string `json:"DomainName,omitempty" name:"DomainName"` } func (r *ModifyVpcAttributeRequest) ToJsonString() string { @@ -5053,7 +6160,7 @@ type ModifyVpcAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5070,22 +6177,22 @@ type ModifyVpnConnectionAttributeRequest struct { *tchttp.BaseRequest // VPN通道实例ID。形如:vpnx-f49l6u0z。 - VpnConnectionId *string `json:"VpnConnectionId" name:"VpnConnectionId"` + VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"` // VPN通道名称,可任意命名,但不得超过60个字符。 - VpnConnectionName *string `json:"VpnConnectionName" name:"VpnConnectionName"` + VpnConnectionName *string `json:"VpnConnectionName,omitempty" name:"VpnConnectionName"` // 预共享密钥。 - PreShareKey *string `json:"PreShareKey" name:"PreShareKey"` + PreShareKey *string `json:"PreShareKey,omitempty" name:"PreShareKey"` // SPD策略组,例如:{"10.0.0.5/24":["172.123.10.5/16"]},10.0.0.5/24是vpc内网段172.123.10.5/16是IDC网段。用户指定VPC内哪些网段可以和您IDC中哪些网段通信。 - SecurityPolicyDatabases []*SecurityPolicyDatabase `json:"SecurityPolicyDatabases" name:"SecurityPolicyDatabases" list` + SecurityPolicyDatabases []*SecurityPolicyDatabase `json:"SecurityPolicyDatabases,omitempty" name:"SecurityPolicyDatabases" list` - // IKE配置(Internet Key Exchange,因特网密钥交换),IKE具有一套自保护机制,用户配置网络安全协议。 - IKEOptionsSpecification *IKEOptionsSpecification `json:"IKEOptionsSpecification" name:"IKEOptionsSpecification"` + // IKE配置(Internet Key Exchange,因特网密钥交换),IKE具有一套自我保护机制,用户配置网络安全协议。 + IKEOptionsSpecification *IKEOptionsSpecification `json:"IKEOptionsSpecification,omitempty" name:"IKEOptionsSpecification"` // IPSec配置,腾讯云提供IPSec安全会话设置。 - IPSECOptionsSpecification *IPSECOptionsSpecification `json:"IPSECOptionsSpecification" name:"IPSECOptionsSpecification"` + IPSECOptionsSpecification *IPSECOptionsSpecification `json:"IPSECOptionsSpecification,omitempty" name:"IPSECOptionsSpecification"` } func (r *ModifyVpnConnectionAttributeRequest) ToJsonString() string { @@ -5102,7 +6209,7 @@ type ModifyVpnConnectionAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5119,13 +6226,13 @@ type ModifyVpnGatewayAttributeRequest struct { *tchttp.BaseRequest // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // VPN网关名称,最大长度不能超过60个字节。 - VpnGatewayName *string `json:"VpnGatewayName" name:"VpnGatewayName"` + VpnGatewayName *string `json:"VpnGatewayName,omitempty" name:"VpnGatewayName"` // VPN网关计费模式,目前只支持预付费(即包年包月)到后付费(即按量计费)的转换。即参数只支持:POSTPAID_BY_HOUR。 - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` } func (r *ModifyVpnGatewayAttributeRequest) ToJsonString() string { @@ -5142,7 +6249,7 @@ type ModifyVpnGatewayAttributeResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5158,28 +6265,28 @@ func (r *ModifyVpnGatewayAttributeResponse) FromJsonString(s string) error { type NetworkInterface struct { // 弹性网卡实例ID,例如:eni-f1xjkw1b。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // 弹性网卡名称。 - NetworkInterfaceName *string `json:"NetworkInterfaceName" name:"NetworkInterfaceName"` + NetworkInterfaceName *string `json:"NetworkInterfaceName,omitempty" name:"NetworkInterfaceName"` // 弹性网卡描述。 - NetworkInterfaceDescription *string `json:"NetworkInterfaceDescription" name:"NetworkInterfaceDescription"` + NetworkInterfaceDescription *string `json:"NetworkInterfaceDescription,omitempty" name:"NetworkInterfaceDescription"` // 子网实例ID。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` // VPC实例ID。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 绑定的安全组。 - GroupSet []*string `json:"GroupSet" name:"GroupSet" list` + GroupSet []*string `json:"GroupSet,omitempty" name:"GroupSet" list` // 是否是主网卡。 - Primary *bool `json:"Primary" name:"Primary"` + Primary *bool `json:"Primary,omitempty" name:"Primary"` // MAC地址。 - MacAddress *string `json:"MacAddress" name:"MacAddress"` + MacAddress *string `json:"MacAddress,omitempty" name:"MacAddress"` // 弹性网卡状态: //
  • `PENDING`:创建中
  • @@ -5187,93 +6294,97 @@ type NetworkInterface struct { //
  • `ATTACHING`:绑定中
  • //
  • `DETACHING`:解绑中
  • //
  • `DELETING`:删除中
  • - State *string `json:"State" name:"State"` + State *string `json:"State,omitempty" name:"State"` // 内网IP信息。 - PrivateIpAddressSet []*PrivateIpAddressSpecification `json:"PrivateIpAddressSet" name:"PrivateIpAddressSet" list` + PrivateIpAddressSet []*PrivateIpAddressSpecification `json:"PrivateIpAddressSet,omitempty" name:"PrivateIpAddressSet" list` // 绑定的云服务器对象。 - Attachment *NetworkInterfaceAttachment `json:"Attachment" name:"Attachment"` + // 注意:此字段可能返回 null,表示取不到有效值。 + Attachment *NetworkInterfaceAttachment `json:"Attachment,omitempty" name:"Attachment"` // 可用区。 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` + + // `IPv6`地址列表。 + Ipv6AddressSet []*Ipv6Address `json:"Ipv6AddressSet,omitempty" name:"Ipv6AddressSet" list` } type NetworkInterfaceAttachment struct { // 云主机实例ID。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` // 网卡在云主机实例内的序号。 - DeviceIndex *uint64 `json:"DeviceIndex" name:"DeviceIndex"` + DeviceIndex *uint64 `json:"DeviceIndex,omitempty" name:"DeviceIndex"` // 云主机所有者账户信息。 - InstanceAccountId *string `json:"InstanceAccountId" name:"InstanceAccountId"` + InstanceAccountId *string `json:"InstanceAccountId,omitempty" name:"InstanceAccountId"` // 绑定时间。 - AttachTime *string `json:"AttachTime" name:"AttachTime"` + AttachTime *string `json:"AttachTime,omitempty" name:"AttachTime"` } type Price struct { // 实例价格。 - InstancePrice *ItemPrice `json:"InstancePrice" name:"InstancePrice"` + InstancePrice *ItemPrice `json:"InstancePrice,omitempty" name:"InstancePrice"` // 网络价格。 - BandwidthPrice *ItemPrice `json:"BandwidthPrice" name:"BandwidthPrice"` + BandwidthPrice *ItemPrice `json:"BandwidthPrice,omitempty" name:"BandwidthPrice"` } type PrivateIpAddressSpecification struct { // 内网IP地址。 - PrivateIpAddress *string `json:"PrivateIpAddress" name:"PrivateIpAddress"` + PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"` // 是否是主IP。 - Primary *bool `json:"Primary" name:"Primary"` + Primary *bool `json:"Primary,omitempty" name:"Primary"` // 公网IP地址。 - PublicIpAddress *string `json:"PublicIpAddress" name:"PublicIpAddress"` + PublicIpAddress *string `json:"PublicIpAddress,omitempty" name:"PublicIpAddress"` // EIP实例ID,例如:eip-11112222。 - AddressId *string `json:"AddressId" name:"AddressId"` + AddressId *string `json:"AddressId,omitempty" name:"AddressId"` // 内网IP描述信息。 - Description *string `json:"Description" name:"Description"` + Description *string `json:"Description,omitempty" name:"Description"` // 公网IP是否被封堵。 - IsWanIpBlocked *bool `json:"IsWanIpBlocked" name:"IsWanIpBlocked"` + IsWanIpBlocked *bool `json:"IsWanIpBlocked,omitempty" name:"IsWanIpBlocked"` // IP状态: // PENDING:生产中 // MIGRATING:迁移中 // DELETING:删除中 // AVAILABLE:可用的 - State *string `json:"State" name:"State"` + State *string `json:"State,omitempty" name:"State"` } type Quota struct { // 配额名称,取值范围:
  • `TOTAL_EIP_QUOTA`:用户当前地域下EIP的配额数;
  • `DAILY_EIP_APPLY`:用户当前地域下今日申购次数;
  • `DAILY_PUBLIC_IP_ASSIGN`:用户当前地域下,重新分配公网 IP次数。 - QuotaId *string `json:"QuotaId" name:"QuotaId"` + QuotaId *string `json:"QuotaId,omitempty" name:"QuotaId"` // 当前数量 - QuotaCurrent *int64 `json:"QuotaCurrent" name:"QuotaCurrent"` + QuotaCurrent *int64 `json:"QuotaCurrent,omitempty" name:"QuotaCurrent"` // 配额数量 - QuotaLimit *int64 `json:"QuotaLimit" name:"QuotaLimit"` + QuotaLimit *int64 `json:"QuotaLimit,omitempty" name:"QuotaLimit"` } type RejectAttachCcnInstancesRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // 拒绝关联实例列表。 - Instances []*CcnInstance `json:"Instances" name:"Instances" list` + Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list` } func (r *RejectAttachCcnInstancesRequest) ToJsonString() string { @@ -5290,7 +6401,7 @@ type RejectAttachCcnInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5307,7 +6418,7 @@ type ReleaseAddressesRequest struct { *tchttp.BaseRequest // 标识 EIP 的唯一 ID 列表。EIP 唯一 ID 形如:`eip-11112222`。 - AddressIds []*string `json:"AddressIds" name:"AddressIds" list` + AddressIds []*string `json:"AddressIds,omitempty" name:"AddressIds" list` } func (r *ReleaseAddressesRequest) ToJsonString() string { @@ -5324,7 +6435,7 @@ type ReleaseAddressesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5341,13 +6452,13 @@ type RemoveBandwidthPackageResourcesRequest struct { *tchttp.BaseRequest // 带宽包唯一标识ID,形如'bwp-xxxx' - BandwidthPackageId *string `json:"BandwidthPackageId" name:"BandwidthPackageId"` + BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"` // 资源类型,包括‘Address’, ‘LoadBalance’ - ResourceType *string `json:"ResourceType" name:"ResourceType"` + ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"` // 资源Id,形如'eip-xxxx', 'lb-xxxx' - ResourceIds []*string `json:"ResourceIds" name:"ResourceIds" list` + ResourceIds []*string `json:"ResourceIds,omitempty" name:"ResourceIds" list` } func (r *RemoveBandwidthPackageResourcesRequest) ToJsonString() string { @@ -5364,7 +6475,7 @@ type RemoveBandwidthPackageResourcesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5377,14 +6488,51 @@ func (r *RemoveBandwidthPackageResourcesResponse) FromJsonString(s string) error return json.Unmarshal([]byte(s), &r) } +type RemoveIp6RulesRequest struct { + *tchttp.BaseRequest + + // IPV6转换规则所属的转换实例唯一ID,形如ip6-xxxxxxxx + Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"` + + // 待删除IPV6转换规则,形如rule6-xxxxxxxx + Ip6RuleIds []*string `json:"Ip6RuleIds,omitempty" name:"Ip6RuleIds" list` +} + +func (r *RemoveIp6RulesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *RemoveIp6RulesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type RemoveIp6RulesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *RemoveIp6RulesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *RemoveIp6RulesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type RenewVpnGatewayRequest struct { *tchttp.BaseRequest // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // 预付费计费模式。 - InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid" name:"InstanceChargePrepaid"` + InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"` } func (r *RenewVpnGatewayRequest) ToJsonString() string { @@ -5401,7 +6549,7 @@ type RenewVpnGatewayResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5418,10 +6566,10 @@ type ReplaceDirectConnectGatewayCcnRoutesRequest struct { *tchttp.BaseRequest // 专线网关ID,形如:dcg-prpqlmg1 - DirectConnectGatewayId *string `json:"DirectConnectGatewayId" name:"DirectConnectGatewayId"` + DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"` // 需要连通的IDC网段列表 - Routes []*DirectConnectGatewayCcnRoute `json:"Routes" name:"Routes" list` + Routes []*DirectConnectGatewayCcnRoute `json:"Routes,omitempty" name:"Routes" list` } func (r *ReplaceDirectConnectGatewayCcnRoutesRequest) ToJsonString() string { @@ -5438,7 +6586,7 @@ type ReplaceDirectConnectGatewayCcnRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5455,10 +6603,10 @@ type ReplaceRouteTableAssociationRequest struct { *tchttp.BaseRequest // 子网实例ID,例如:subnet-3x5lf5q0。可通过DescribeSubnets接口查询。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` // 路由表实例ID,例如:rtb-azd4dt1c。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` } func (r *ReplaceRouteTableAssociationRequest) ToJsonString() string { @@ -5475,7 +6623,7 @@ type ReplaceRouteTableAssociationResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5492,10 +6640,10 @@ type ReplaceRoutesRequest struct { *tchttp.BaseRequest // 路由表实例ID,例如:rtb-azd4dt1c。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` - // 路由策略对象。只需要指定路由策略ID(RouteId)。 - Routes []*Route `json:"Routes" name:"Routes" list` + // 路由策略对象。需要指定路由策略ID(RouteId)。 + Routes []*Route `json:"Routes,omitempty" name:"Routes" list` } func (r *ReplaceRoutesRequest) ToJsonString() string { @@ -5512,7 +6660,7 @@ type ReplaceRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5529,10 +6677,10 @@ type ReplaceSecurityGroupPolicyRequest struct { *tchttp.BaseRequest // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` // 安全组规则集合对象。 - SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet" name:"SecurityGroupPolicySet"` + SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"` } func (r *ReplaceSecurityGroupPolicyRequest) ToJsonString() string { @@ -5549,7 +6697,7 @@ type ReplaceSecurityGroupPolicyResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5566,13 +6714,13 @@ type ResetAttachCcnInstancesRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // CCN所属UIN(根账号)。 - CcnUin *string `json:"CcnUin" name:"CcnUin"` + CcnUin *string `json:"CcnUin,omitempty" name:"CcnUin"` // 重新申请关联网络实例列表。 - Instances []*CcnInstance `json:"Instances" name:"Instances" list` + Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list` } func (r *ResetAttachCcnInstancesRequest) ToJsonString() string { @@ -5589,7 +6737,7 @@ type ResetAttachCcnInstancesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5606,13 +6754,13 @@ type ResetRoutesRequest struct { *tchttp.BaseRequest // 路由表实例ID,例如:rtb-azd4dt1c。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 路由表名称,最大长度不能超过60个字节。 - RouteTableName *string `json:"RouteTableName" name:"RouteTableName"` + RouteTableName *string `json:"RouteTableName,omitempty" name:"RouteTableName"` // 路由策略。 - Routes []*Route `json:"Routes" name:"Routes" list` + Routes []*Route `json:"Routes,omitempty" name:"Routes" list` } func (r *ResetRoutesRequest) ToJsonString() string { @@ -5629,7 +6777,7 @@ type ResetRoutesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5646,10 +6794,10 @@ type ResetVpnConnectionRequest struct { *tchttp.BaseRequest // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // VPN通道实例ID。形如:vpnx-f49l6u0z。 - VpnConnectionId *string `json:"VpnConnectionId" name:"VpnConnectionId"` + VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"` } func (r *ResetVpnConnectionRequest) ToJsonString() string { @@ -5666,7 +6814,7 @@ type ResetVpnConnectionResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5683,10 +6831,10 @@ type ResetVpnGatewayInternetMaxBandwidthRequest struct { *tchttp.BaseRequest // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // 公网带宽设置。可选带宽规格:5, 10, 20, 50, 100;单位:Mbps。 - InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut" name:"InternetMaxBandwidthOut"` + InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"` } func (r *ResetVpnGatewayInternetMaxBandwidthRequest) ToJsonString() string { @@ -5703,7 +6851,7 @@ type ResetVpnGatewayInternetMaxBandwidthResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5719,19 +6867,19 @@ func (r *ResetVpnGatewayInternetMaxBandwidthResponse) FromJsonString(s string) e type Resource struct { // 带宽包资源类型,包括'Address'和'LoadBalance' - ResourceType *string `json:"ResourceType" name:"ResourceType"` + ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"` // 带宽包资源Id,形如'eip-xxxx', 'lb-xxxx' - ResourceId *string `json:"ResourceId" name:"ResourceId"` + ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"` // 带宽包资源Ip - AddressIp *string `json:"AddressIp" name:"AddressIp"` + AddressIp *string `json:"AddressIp,omitempty" name:"AddressIp"` } type Route struct { // 目的网段,取值不能在私有网络网段内,例如:112.20.51.0/24。 - DestinationCidrBlock *string `json:"DestinationCidrBlock" name:"DestinationCidrBlock"` + DestinationCidrBlock *string `json:"DestinationCidrBlock,omitempty" name:"DestinationCidrBlock"` // 下一跳类型,目前我们支持的类型有: // CVM:公网网关类型的云主机; @@ -5743,214 +6891,217 @@ type Route struct { // NORMAL_CVM:普通云主机; // EIP:云主机的公网IP; // CCN:云联网。 - GatewayType *string `json:"GatewayType" name:"GatewayType"` + GatewayType *string `json:"GatewayType,omitempty" name:"GatewayType"` // 下一跳地址,这里只需要指定不同下一跳类型的网关ID,系统会自动匹配到下一跳地址。 // 特别注意:当 GatewayType 为 EIP 时,GatewayId 固定值 '0' - GatewayId *string `json:"GatewayId" name:"GatewayId"` + GatewayId *string `json:"GatewayId,omitempty" name:"GatewayId"` // 路由策略ID。 - RouteId *uint64 `json:"RouteId" name:"RouteId"` + RouteId *uint64 `json:"RouteId,omitempty" name:"RouteId"` // 路由策略描述。 - RouteDescription *string `json:"RouteDescription" name:"RouteDescription"` + RouteDescription *string `json:"RouteDescription,omitempty" name:"RouteDescription"` // 是否启用 - Enabled *bool `json:"Enabled" name:"Enabled"` + Enabled *bool `json:"Enabled,omitempty" name:"Enabled"` // 路由类型,目前我们支持的类型有: // USER:用户路由; // NETD:网络探测路由,创建网络探测实例时,系统默认下发,不可编辑与删除; // CCN:云联网路由,系统默认下发,不可编辑与删除。 // 用户只能添加和操作 USER 类型的路由。 - RouteType *string `json:"RouteType" name:"RouteType"` + RouteType *string `json:"RouteType,omitempty" name:"RouteType"` } type RouteConflict struct { // 路由表实例ID,例如:rtb-azd4dt1c。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 要检查的与之冲突的目的端 - DestinationCidrBlock *string `json:"DestinationCidrBlock" name:"DestinationCidrBlock"` + DestinationCidrBlock *string `json:"DestinationCidrBlock,omitempty" name:"DestinationCidrBlock"` // 冲突的路由策略列表 - ConflictSet []*Route `json:"ConflictSet" name:"ConflictSet" list` + ConflictSet []*Route `json:"ConflictSet,omitempty" name:"ConflictSet" list` } type RouteTable struct { // VPC实例ID。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 路由表实例ID,例如:rtb-azd4dt1c。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 路由表名称。 - RouteTableName *string `json:"RouteTableName" name:"RouteTableName"` + RouteTableName *string `json:"RouteTableName,omitempty" name:"RouteTableName"` // 路由表关联关系。 - AssociationSet []*RouteTableAssociation `json:"AssociationSet" name:"AssociationSet" list` + AssociationSet []*RouteTableAssociation `json:"AssociationSet,omitempty" name:"AssociationSet" list` // 路由表策略集合。 - RouteSet []*Route `json:"RouteSet" name:"RouteSet" list` + RouteSet []*Route `json:"RouteSet,omitempty" name:"RouteSet" list` // 是否默认路由表。 - Main *bool `json:"Main" name:"Main"` + Main *bool `json:"Main,omitempty" name:"Main"` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type RouteTableAssociation struct { // 子网实例ID。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` // 路由表实例ID。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` } type SecurityGroup struct { // 安全组实例ID,例如:sg-ohuuioma。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` // 安全组名称,可任意命名,但不得超过60个字符。 - SecurityGroupName *string `json:"SecurityGroupName" name:"SecurityGroupName"` + SecurityGroupName *string `json:"SecurityGroupName,omitempty" name:"SecurityGroupName"` // 安全组备注,最多100个字符。 - SecurityGroupDesc *string `json:"SecurityGroupDesc" name:"SecurityGroupDesc"` + SecurityGroupDesc *string `json:"SecurityGroupDesc,omitempty" name:"SecurityGroupDesc"` // 项目id,默认0。可在qcloud控制台项目管理页面查询到。 - ProjectId *string `json:"ProjectId" name:"ProjectId"` + ProjectId *string `json:"ProjectId,omitempty" name:"ProjectId"` // 是否是默认安全组,默认安全组不支持删除。 - IsDefault *bool `json:"IsDefault" name:"IsDefault"` + IsDefault *bool `json:"IsDefault,omitempty" name:"IsDefault"` // 安全组创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type SecurityGroupAssociationStatistics struct { // 安全组实例ID。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` // 云主机实例数。 - CVM *uint64 `json:"CVM" name:"CVM"` + CVM *uint64 `json:"CVM,omitempty" name:"CVM"` // 数据库实例数。 - CDB *uint64 `json:"CDB" name:"CDB"` + CDB *uint64 `json:"CDB,omitempty" name:"CDB"` // 弹性网卡实例数。 - ENI *uint64 `json:"ENI" name:"ENI"` + ENI *uint64 `json:"ENI,omitempty" name:"ENI"` // 被安全组引用数。 - SG *uint64 `json:"SG" name:"SG"` + SG *uint64 `json:"SG,omitempty" name:"SG"` // 负载均衡实例数。 - CLB *uint64 `json:"CLB" name:"CLB"` + CLB *uint64 `json:"CLB,omitempty" name:"CLB"` + + // 全量实例的绑定统计。 + InstanceStatistics []*InstanceStatistic `json:"InstanceStatistics,omitempty" name:"InstanceStatistics" list` } type SecurityGroupPolicy struct { // 安全组规则索引号。 - PolicyIndex *int64 `json:"PolicyIndex" name:"PolicyIndex"` + PolicyIndex *int64 `json:"PolicyIndex,omitempty" name:"PolicyIndex"` // 协议, 取值: TCP,UDP, ICMP。 - Protocol *string `json:"Protocol" name:"Protocol"` + Protocol *string `json:"Protocol,omitempty" name:"Protocol"` // 端口(all, 离散port, range)。 - Port *string `json:"Port" name:"Port"` + Port *string `json:"Port,omitempty" name:"Port"` // 协议端口ID或者协议端口组ID。ServiceTemplate和Protocol+Port互斥。 - ServiceTemplate *ServiceTemplateSpecification `json:"ServiceTemplate" name:"ServiceTemplate"` + ServiceTemplate *ServiceTemplateSpecification `json:"ServiceTemplate,omitempty" name:"ServiceTemplate"` // 网段或IP(互斥)。 - CidrBlock *string `json:"CidrBlock" name:"CidrBlock"` + CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"` // 安全组实例ID,例如:sg-ohuuioma。 - SecurityGroupId *string `json:"SecurityGroupId" name:"SecurityGroupId"` + SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"` // IP地址ID或者ID地址组ID。 - AddressTemplate *AddressTemplateSpecification `json:"AddressTemplate" name:"AddressTemplate"` + AddressTemplate *AddressTemplateSpecification `json:"AddressTemplate,omitempty" name:"AddressTemplate"` // ACCEPT 或 DROP。 - Action *string `json:"Action" name:"Action"` + Action *string `json:"Action,omitempty" name:"Action"` // 安全组规则描述。 - PolicyDescription *string `json:"PolicyDescription" name:"PolicyDescription"` + PolicyDescription *string `json:"PolicyDescription,omitempty" name:"PolicyDescription"` } type SecurityGroupPolicySet struct { // 安全组规则当前版本。用户每次更新安全规则版本会自动加1,防止更新的路由规则已过期,不填不考虑冲突。 - Version *string `json:"Version" name:"Version"` + Version *string `json:"Version,omitempty" name:"Version"` // 出站规则。 - Egress []*SecurityGroupPolicy `json:"Egress" name:"Egress" list` + Egress []*SecurityGroupPolicy `json:"Egress,omitempty" name:"Egress" list` // 入站规则。 - Ingress []*SecurityGroupPolicy `json:"Ingress" name:"Ingress" list` + Ingress []*SecurityGroupPolicy `json:"Ingress,omitempty" name:"Ingress" list` } type SecurityPolicyDatabase struct { // 本端网段 - LocalCidrBlock *string `json:"LocalCidrBlock" name:"LocalCidrBlock"` + LocalCidrBlock *string `json:"LocalCidrBlock,omitempty" name:"LocalCidrBlock"` // 对端网段 - RemoteCidrBlock []*string `json:"RemoteCidrBlock" name:"RemoteCidrBlock" list` + RemoteCidrBlock []*string `json:"RemoteCidrBlock,omitempty" name:"RemoteCidrBlock" list` } type ServiceTemplate struct { // 协议端口实例ID,例如:ppm-f5n1f8da。 - ServiceTemplateId *string `json:"ServiceTemplateId" name:"ServiceTemplateId"` + ServiceTemplateId *string `json:"ServiceTemplateId,omitempty" name:"ServiceTemplateId"` // 模板名称。 - ServiceTemplateName *string `json:"ServiceTemplateName" name:"ServiceTemplateName"` + ServiceTemplateName *string `json:"ServiceTemplateName,omitempty" name:"ServiceTemplateName"` // 协议端口信息。 - ServiceSet []*string `json:"ServiceSet" name:"ServiceSet" list` + ServiceSet []*string `json:"ServiceSet,omitempty" name:"ServiceSet" list` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type ServiceTemplateGroup struct { // 协议端口模板集合实例ID,例如:ppmg-2klmrefu。 - ServiceTemplateGroupId *string `json:"ServiceTemplateGroupId" name:"ServiceTemplateGroupId"` + ServiceTemplateGroupId *string `json:"ServiceTemplateGroupId,omitempty" name:"ServiceTemplateGroupId"` // 协议端口模板集合名称。 - ServiceTemplateGroupName *string `json:"ServiceTemplateGroupName" name:"ServiceTemplateGroupName"` + ServiceTemplateGroupName *string `json:"ServiceTemplateGroupName,omitempty" name:"ServiceTemplateGroupName"` // 协议端口模板实例ID。 - ServiceTemplateIdSet []*string `json:"ServiceTemplateIdSet" name:"ServiceTemplateIdSet" list` + ServiceTemplateIdSet []*string `json:"ServiceTemplateIdSet,omitempty" name:"ServiceTemplateIdSet" list` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type ServiceTemplateSpecification struct { // 协议端口ID,例如:ppm-f5n1f8da。 - ServiceId *string `json:"ServiceId" name:"ServiceId"` + ServiceId *string `json:"ServiceId,omitempty" name:"ServiceId"` // 协议端口组ID,例如:ppmg-f5n1f8da。 - ServiceGroupId *string `json:"ServiceGroupId" name:"ServiceGroupId"` + ServiceGroupId *string `json:"ServiceGroupId,omitempty" name:"ServiceGroupId"` } type SetCcnRegionBandwidthLimitsRequest struct { *tchttp.BaseRequest // CCN实例ID。形如:ccn-f49l6u0z。 - CcnId *string `json:"CcnId" name:"CcnId"` + CcnId *string `json:"CcnId,omitempty" name:"CcnId"` // 云联网(CCN)各地域出带宽上限。 - CcnRegionBandwidthLimits []*CcnRegionBandwidthLimit `json:"CcnRegionBandwidthLimits" name:"CcnRegionBandwidthLimits" list` + CcnRegionBandwidthLimits []*CcnRegionBandwidthLimit `json:"CcnRegionBandwidthLimits,omitempty" name:"CcnRegionBandwidthLimits" list` } func (r *SetCcnRegionBandwidthLimitsRequest) ToJsonString() string { @@ -5967,7 +7118,7 @@ type SetCcnRegionBandwidthLimitsResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -5982,42 +7133,77 @@ func (r *SetCcnRegionBandwidthLimitsResponse) FromJsonString(s string) error { type Subnet struct { - // VPC实例ID。 - VpcId *string `json:"VpcId" name:"VpcId"` + // `VPC`实例`ID`。 + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` - // 子网实例ID,例如:subnet-bthucmmy。 - SubnetId *string `json:"SubnetId" name:"SubnetId"` + // 子网实例`ID`,例如:subnet-bthucmmy。 + SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` // 子网名称。 - SubnetName *string `json:"SubnetName" name:"SubnetName"` + SubnetName *string `json:"SubnetName,omitempty" name:"SubnetName"` - // 子网的CIDR。 - CidrBlock *string `json:"CidrBlock" name:"CidrBlock"` + // 子网的 `IPv4` `CIDR`。 + CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"` // 是否默认子网。 - IsDefault *bool `json:"IsDefault" name:"IsDefault"` + IsDefault *bool `json:"IsDefault,omitempty" name:"IsDefault"` // 是否开启广播。 - EnableBroadcast *bool `json:"EnableBroadcast" name:"EnableBroadcast"` + EnableBroadcast *bool `json:"EnableBroadcast,omitempty" name:"EnableBroadcast"` // 可用区。 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` // 路由表实例ID,例如:rtb-l2h8d7c2。 - RouteTableId *string `json:"RouteTableId" name:"RouteTableId"` + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` - // 可用IP数。 - AvailableIpAddressCount *uint64 `json:"AvailableIpAddressCount" name:"AvailableIpAddressCount"` + // 可用`IP`数。 + AvailableIpAddressCount *uint64 `json:"AvailableIpAddressCount,omitempty" name:"AvailableIpAddressCount"` + + // 子网的 `IPv6` `CIDR`。 + Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"` + + // 关联`ACL`ID + NetworkAclId *string `json:"NetworkAclId,omitempty" name:"NetworkAclId"` + + // 是否为 `SNAT` 地址池子网。 + IsRemoteVpcSnat *bool `json:"IsRemoteVpcSnat,omitempty" name:"IsRemoteVpcSnat"` +} + +type SubnetInput struct { + + // 子网的`CIDR`。 + CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"` + + // 子网名称。 + SubnetName *string `json:"SubnetName,omitempty" name:"SubnetName"` + + // 可用区。形如:`ap-guangzhou-2`。 + Zone *string `json:"Zone,omitempty" name:"Zone"` + + // 指定关联路由表,形如:`rtb-3ryrwzuu`。 + RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"` +} + +type Tag struct { + + // 标签键 + // 注意:此字段可能返回 null,表示取不到有效值。 + Key *string `json:"Key,omitempty" name:"Key"` + + // 标签值 + // 注意:此字段可能返回 null,表示取不到有效值。 + Value *string `json:"Value,omitempty" name:"Value"` } type TransformAddressRequest struct { *tchttp.BaseRequest // 待操作有普通公网 IP 的实例 ID。实例 ID 形如:`ins-11112222`。可通过登录[控制台](https://console.cloud.tencent.com/cvm)查询,也可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/9389) 接口返回值中的`InstanceId`获取。 - InstanceId *string `json:"InstanceId" name:"InstanceId"` + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` } func (r *TransformAddressRequest) ToJsonString() string { @@ -6034,7 +7220,7 @@ type TransformAddressResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -6047,14 +7233,125 @@ func (r *TransformAddressResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type UnassignIpv6AddressesRequest struct { + *tchttp.BaseRequest + + // 弹性网卡实例`ID`,形如:`eni-m6dyj72l`。 + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` + + // 指定的`IPv6`地址列表,单次最多指定10个。 + Ipv6Addresses []*Ipv6Address `json:"Ipv6Addresses,omitempty" name:"Ipv6Addresses" list` +} + +func (r *UnassignIpv6AddressesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *UnassignIpv6AddressesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type UnassignIpv6AddressesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *UnassignIpv6AddressesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *UnassignIpv6AddressesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type UnassignIpv6CidrBlockRequest struct { + *tchttp.BaseRequest + + // `VPC`实例`ID`,形如:`vpc-f49l6u0z`。 + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // `IPv6`网段。形如:`3402:4e00:20:1000::/56` + Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"` +} + +func (r *UnassignIpv6CidrBlockRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *UnassignIpv6CidrBlockRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type UnassignIpv6CidrBlockResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *UnassignIpv6CidrBlockResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *UnassignIpv6CidrBlockResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type UnassignIpv6SubnetCidrBlockRequest struct { + *tchttp.BaseRequest + + // 子网所在私有网络`ID`。形如:`vpc-f49l6u0z`。 + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` + + // `IPv6` 子网段列表。 + Ipv6SubnetCidrBlocks []*Ipv6SubnetCidrBlock `json:"Ipv6SubnetCidrBlocks,omitempty" name:"Ipv6SubnetCidrBlocks" list` +} + +func (r *UnassignIpv6SubnetCidrBlockRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *UnassignIpv6SubnetCidrBlockRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type UnassignIpv6SubnetCidrBlockResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *UnassignIpv6SubnetCidrBlockResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *UnassignIpv6SubnetCidrBlockResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type UnassignPrivateIpAddressesRequest struct { *tchttp.BaseRequest // 弹性网卡实例ID,例如:eni-m6dyj72l。 - NetworkInterfaceId *string `json:"NetworkInterfaceId" name:"NetworkInterfaceId"` + NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"` // 指定的内网IP信息,单次最多指定10个。 - PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses" name:"PrivateIpAddresses" list` + PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list` } func (r *UnassignPrivateIpAddressesRequest) ToJsonString() string { @@ -6071,7 +7368,7 @@ type UnassignPrivateIpAddressesResponse struct { Response *struct { // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 - RequestId *string `json:"RequestId" name:"RequestId"` + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -6086,126 +7383,165 @@ func (r *UnassignPrivateIpAddressesResponse) FromJsonString(s string) error { type Vpc struct { - // Vpc名称。 - VpcName *string `json:"VpcName" name:"VpcName"` + // `VPC`名称。 + VpcName *string `json:"VpcName,omitempty" name:"VpcName"` - // VPC实例ID,例如:vpc-azd4dt1c。 - VpcId *string `json:"VpcId" name:"VpcId"` + // `VPC`实例`ID`,例如:vpc-azd4dt1c。 + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` - // VPC的cidr,只能为10.0.0.0/16,172.16.0.0/12,192.168.0.0/16这三个内网网段内。 - CidrBlock *string `json:"CidrBlock" name:"CidrBlock"` + // `VPC`的`IPv4` `CIDR`。 + CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"` - // 是否默认VPC。 - IsDefault *bool `json:"IsDefault" name:"IsDefault"` + // 是否默认`VPC`。 + IsDefault *bool `json:"IsDefault,omitempty" name:"IsDefault"` // 是否开启组播。 - EnableMulticast *bool `json:"EnableMulticast" name:"EnableMulticast"` + EnableMulticast *bool `json:"EnableMulticast,omitempty" name:"EnableMulticast"` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` - // DNS列表 - DnsServerSet []*string `json:"DnsServerSet" name:"DnsServerSet" list` + // `DNS`列表。 + DnsServerSet []*string `json:"DnsServerSet,omitempty" name:"DnsServerSet" list` - // DHCP域名选项值 - DomainName *string `json:"DomainName" name:"DomainName"` + // `DHCP`域名选项值。 + DomainName *string `json:"DomainName,omitempty" name:"DomainName"` - // DHCP选项集ID - DhcpOptionsId *string `json:"DhcpOptionsId" name:"DhcpOptionsId"` + // `DHCP`选项集`ID`。 + DhcpOptionsId *string `json:"DhcpOptionsId,omitempty" name:"DhcpOptionsId"` + + // 是否开启`DHCP`。 + EnableDhcp *bool `json:"EnableDhcp,omitempty" name:"EnableDhcp"` + + // `VPC`的`IPv6` `CIDR`。 + Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"` + + // 标签键值对 + TagSet []*Tag `json:"TagSet,omitempty" name:"TagSet" list` +} + +type VpcIpv6Address struct { + + // `VPC`内`IPv6`地址。 + Ipv6Address *string `json:"Ipv6Address,omitempty" name:"Ipv6Address"` + + // 所属子网 `IPv6` `CIDR`。 + CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"` + + // `IPv6`类型。 + Ipv6AddressType *string `json:"Ipv6AddressType,omitempty" name:"Ipv6AddressType"` + + // `IPv6`申请时间。 + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` +} + +type VpcPrivateIpAddress struct { + + // `VPC`内网`IP`。 + PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"` + + // 所属子网`CIDR`。 + CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"` + + // 内网`IP`类型。 + PrivateIpAddressType *string `json:"PrivateIpAddressType,omitempty" name:"PrivateIpAddressType"` + + // `IP`申请时间。 + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` } type VpnConnection struct { // 通道实例ID。 - VpnConnectionId *string `json:"VpnConnectionId" name:"VpnConnectionId"` + VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"` // 通道名称。 - VpnConnectionName *string `json:"VpnConnectionName" name:"VpnConnectionName"` + VpnConnectionName *string `json:"VpnConnectionName,omitempty" name:"VpnConnectionName"` // VPC实例ID。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // VPN网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // 对端网关实例ID。 - CustomerGatewayId *string `json:"CustomerGatewayId" name:"CustomerGatewayId"` + CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"` // 预共享密钥。 - PreShareKey *string `json:"PreShareKey" name:"PreShareKey"` + PreShareKey *string `json:"PreShareKey,omitempty" name:"PreShareKey"` // 通道传输协议。 - VpnProto *string `json:"VpnProto" name:"VpnProto"` + VpnProto *string `json:"VpnProto,omitempty" name:"VpnProto"` // 通道加密协议。 - EncryptProto *string `json:"EncryptProto" name:"EncryptProto"` + EncryptProto *string `json:"EncryptProto,omitempty" name:"EncryptProto"` // 路由类型。 - RouteType *string `json:"RouteType" name:"RouteType"` + RouteType *string `json:"RouteType,omitempty" name:"RouteType"` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` // 通道的生产状态,PENDING:生产中,AVAILABLE:运行中,DELETING:删除中。 - State *string `json:"State" name:"State"` + State *string `json:"State,omitempty" name:"State"` // 通道连接状态,AVAILABLE:已连接。 - NetStatus *string `json:"NetStatus" name:"NetStatus"` + NetStatus *string `json:"NetStatus,omitempty" name:"NetStatus"` // SPD。 - SecurityPolicyDatabaseSet []*SecurityPolicyDatabase `json:"SecurityPolicyDatabaseSet" name:"SecurityPolicyDatabaseSet" list` + SecurityPolicyDatabaseSet []*SecurityPolicyDatabase `json:"SecurityPolicyDatabaseSet,omitempty" name:"SecurityPolicyDatabaseSet" list` // IKE选项。 - IKEOptionsSpecification *IKEOptionsSpecification `json:"IKEOptionsSpecification" name:"IKEOptionsSpecification"` + IKEOptionsSpecification *IKEOptionsSpecification `json:"IKEOptionsSpecification,omitempty" name:"IKEOptionsSpecification"` // IPSEC选择。 - IPSECOptionsSpecification *IPSECOptionsSpecification `json:"IPSECOptionsSpecification" name:"IPSECOptionsSpecification"` + IPSECOptionsSpecification *IPSECOptionsSpecification `json:"IPSECOptionsSpecification,omitempty" name:"IPSECOptionsSpecification"` } type VpnGateway struct { // 网关实例ID。 - VpnGatewayId *string `json:"VpnGatewayId" name:"VpnGatewayId"` + VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"` // VPC实例ID。 - VpcId *string `json:"VpcId" name:"VpcId"` + VpcId *string `json:"VpcId,omitempty" name:"VpcId"` // 网关实例名称。 - VpnGatewayName *string `json:"VpnGatewayName" name:"VpnGatewayName"` + VpnGatewayName *string `json:"VpnGatewayName,omitempty" name:"VpnGatewayName"` // 网关实例类型:'IPSEC', 'SSL'。 - Type *string `json:"Type" name:"Type"` + Type *string `json:"Type,omitempty" name:"Type"` // 网关实例状态, 'PENDING':生产中,'DELETING':删除中,'AVAILABLE':运行中。 - State *string `json:"State" name:"State"` + State *string `json:"State,omitempty" name:"State"` // 网关公网IP。 - PublicIpAddress *string `json:"PublicIpAddress" name:"PublicIpAddress"` + PublicIpAddress *string `json:"PublicIpAddress,omitempty" name:"PublicIpAddress"` - // 网关续费类型:'NOTIFY_AND_MANUAL_RENEW':手动续费,'NOTIFY_AND_AUTO_RENEW':自动续费 - RenewFlag *string `json:"RenewFlag" name:"RenewFlag"` + // 网关续费类型:'NOTIFY_AND_MANUAL_RENEW':手动续费,'NOTIFY_AND_AUTO_RENEW':自动续费,'NOT_NOTIFY_AND_NOT_RENEW':到期不续费。 + RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"` // 网关付费类型:POSTPAID_BY_HOUR:按小时后付费,PREPAID:包年包月预付费, - InstanceChargeType *string `json:"InstanceChargeType" name:"InstanceChargeType"` + InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"` // 网关出带宽。 - InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut" name:"InternetMaxBandwidthOut"` + InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"` // 创建时间。 - CreatedTime *string `json:"CreatedTime" name:"CreatedTime"` + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` // 预付费网关过期时间。 - ExpiredTime *string `json:"ExpiredTime" name:"ExpiredTime"` + ExpiredTime *string `json:"ExpiredTime,omitempty" name:"ExpiredTime"` // 公网IP是否被封堵。 - IsAddressBlocked *bool `json:"IsAddressBlocked" name:"IsAddressBlocked"` + IsAddressBlocked *bool `json:"IsAddressBlocked,omitempty" name:"IsAddressBlocked"` // 计费模式变更,PREPAID_TO_POSTPAID:包年包月预付费到期转按小时后付费。 - NewPurchasePlan *string `json:"NewPurchasePlan" name:"NewPurchasePlan"` + NewPurchasePlan *string `json:"NewPurchasePlan,omitempty" name:"NewPurchasePlan"` // 网关计费装,PROTECTIVELY_ISOLATED:被安全隔离的实例,NORMAL:正常。 - RestrictState *string `json:"RestrictState" name:"RestrictState"` + RestrictState *string `json:"RestrictState,omitempty" name:"RestrictState"` // 可用区,如:ap-guangzhou-2 - Zone *string `json:"Zone" name:"Zone"` + Zone *string `json:"Zone,omitempty" name:"Zone"` } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/LICENSE b/vendor/github.com/ucloud/ucloud-sdk-go/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/client.go new file mode 100644 index 000000000..33f1c66f7 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/client.go @@ -0,0 +1,80 @@ +/* +Package http is an implementation of http protocol +*/ +package http + +import ( + "io/ioutil" + "net/http" + "time" +) + +// Client is the interface of http client +type Client interface { + Send(*HttpRequest) (*HttpResponse, error) +} + +// HttpClient used to send a real request via http to server +type HttpClient struct { +} + +// NewHttpClient will create a new HttpClient instance +func NewHttpClient() HttpClient { + return HttpClient{} +} + +// Send will send a real http request to remote server +func (c *HttpClient) Send(req *HttpRequest) (*HttpResponse, error) { + // build http.Client with timeout settings + httpClient, err := c.buildHTTPClient(req.GetTimeout()) + if err != nil { + return nil, err + } + + // convert sdk http request to origin http.Request + httpReq, err := req.buildHTTPRequest() + if err != nil { + return nil, err + } + + // TODO: enable tracer via `httptrace` package + resp, err := c.doHTTPRequest(httpClient, httpReq) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *HttpClient) buildHTTPClient(timeout time.Duration) (*http.Client, error) { + httpClient := http.Client{} + if timeout != 0 { + httpClient = http.Client{Timeout: timeout} + } + return &httpClient, nil +} + +func (c *HttpClient) doHTTPRequest(client *http.Client, req *http.Request) (*HttpResponse, error) { + // send request + httpResp, err := client.Do(req) + if err != nil { + return nil, err + } + defer httpResp.Body.Close() + + // raise status error + if httpResp.StatusCode >= 400 { + return nil, NewStatusError(httpResp.StatusCode, httpResp.Status) + } + + // read content + body, err := ioutil.ReadAll(httpResp.Body) + if err != nil { + return nil, err + } + + // build response wrapper + resp := NewHttpResponse() + resp.setHttpResponse(httpResp) + resp.SetBody(body) + return resp, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/defaults.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/defaults.go new file mode 100644 index 000000000..c8440bcc5 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/defaults.go @@ -0,0 +1,21 @@ +package http + +import ( + "time" +) + +type mimeType string + +const ( + mimeFormURLEncoded mimeType = "application/x-www-form-urlencoded" + mimeJSON mimeType = "application/json" +) + +// DefaultHeaders defined default http headers +var DefaultHeaders = map[string]string{ + "Content-Type": string(mimeFormURLEncoded), + // "X-SDK-VERSION": VERSION, +} + +// DefaultTimeout is the default timeout of each request +var DefaultTimeout = 30 * time.Second diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/error.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/error.go new file mode 100644 index 000000000..6e10b957c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/error.go @@ -0,0 +1,23 @@ +package http + +import ( + "fmt" +) + +// StatusError is the error for http status code >= 400 +type StatusError struct { + StatusCode int + Message string +} + +func (e StatusError) Error() string { + return fmt.Sprintf("http status %v error", e.StatusCode) +} + +// NewStatusError will create a new status error +func NewStatusError(code int, message string) StatusError { + return StatusError{ + StatusCode: code, + Message: message, + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/request.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/request.go new file mode 100644 index 000000000..a771ff1fa --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/request.go @@ -0,0 +1,223 @@ +package http + +import ( + "bytes" + "fmt" + "net/http" + "net/url" + "strings" + "time" + + "github.com/pkg/errors" + "github.com/ucloud/ucloud-sdk-go/private/utils" +) + +var availableHTTPMethods = []string{"GET", "POST", "PUT", "DELETE", "OPTION", "HEAD", "PATCH"} + +// HttpRequest is the internal http request of sdk, don't use it at your code +type HttpRequest struct { + url string + method string + queryMap map[string]string + queryString string + headers map[string]string + requestBody []byte + timeout time.Duration +} + +// NewHttpRequest will create a http request +func NewHttpRequest() *HttpRequest { + r := &HttpRequest{ + queryMap: make(map[string]string), + headers: make(map[string]string), + timeout: DefaultTimeout, + } + + for k, v := range DefaultHeaders { + r.headers[k] = v + } + return r +} + +// SetURL will set url into request +func (h *HttpRequest) SetURL(val string) error { + // check url is valid + uri, err := url.ParseRequestURI(val) + if err != nil { + return errors.Errorf("url is invalid, got %s", val) + } + + err = h.SetQueryString(uri.RawQuery) + if err != nil { + return err + } + + h.url = fmt.Sprintf("%s://%s%s", uri.Scheme, uri.Host, uri.Path) + return nil +} + +// GetURL will get request url value +func (h *HttpRequest) GetURL() string { + return h.url +} + +// SetMethod will set method of current request +func (h *HttpRequest) SetMethod(val string) error { + err := utils.CheckStringIn(val, availableHTTPMethods) + if err != nil { + return errors.Errorf("method is invalid, %s", err) + } + + h.method = strings.ToUpper(val) + return nil +} + +// GetMethod will get request url value +func (h *HttpRequest) GetMethod() string { + return h.method +} + +// SetQueryString will set query map by query string, +// it also save as query string attribute to keep query ordered. +func (h *HttpRequest) SetQueryString(val string) error { + // check url query is valid + values, err := url.ParseQuery(val) + if err != nil { + return errors.Errorf("url query is invalid, got %s", val) + } + + // copy url query into request query map, it will overwrite current query + for k, v := range values { + if len(v) > 0 { + h.SetQuery(k, v[0]) + } + } + + h.queryString = val + return nil +} + +// BuildQueryString will return the query string of this request, +// it will also append key-value of query map after existed query string +func (h *HttpRequest) BuildQueryString() (string, error) { + values := url.Values{} + for k, v := range h.queryMap { + values.Add(k, v) + } + + // if query string is not set by user, + // otherwise needn't keep them ordered, encode immediately. + if h.queryString == "" { + return values.Encode(), nil + } + + // exclude query that existed in query string pass by user, + // to keep ordered from user definition + existsValues, _ := url.ParseQuery(h.queryString) + for k := range existsValues { + values.Del(k) + } + + // append query map after existed query string + qs := h.queryString + if len(values) > 0 { + qs += "&" + values.Encode() + } + + return qs, nil +} + +// SetQuery will store key-value data into query map +func (h *HttpRequest) SetQuery(k, v string) error { + if h.queryMap == nil { + h.queryMap = make(map[string]string) + } + h.queryMap[k] = v + return nil +} + +// GetQuery will get value by key from map +func (h *HttpRequest) GetQuery(k string) string { + if v, ok := h.queryMap[k]; ok { + return v + } + return "" +} + +// GetQueryMap will get all of query as a map +func (h *HttpRequest) GetQueryMap() map[string]string { + return h.queryMap +} + +// SetTimeout will set timeout of current request +func (h *HttpRequest) SetTimeout(val time.Duration) error { + h.timeout = val + return nil +} + +// GetTimeout will get timeout of current request +func (h *HttpRequest) GetTimeout() time.Duration { + return h.timeout +} + +// SetHeader will set http header of current request +func (h *HttpRequest) SetHeader(k, v string) error { + if h.headers == nil { + h.headers = make(map[string]string) + } + h.headers[k] = v + return nil +} + +// GetHeaderMap wiil get all of header as a map +func (h *HttpRequest) GetHeaderMap() map[string]string { + return h.headers +} + +// SetRequestBody will set http body of current request +func (h *HttpRequest) SetRequestBody(val []byte) error { + h.requestBody = val + return nil +} + +// GetRequestBody will get origin http request ("net/http") +func (h *HttpRequest) GetRequestBody() []byte { + return h.requestBody +} + +func (h *HttpRequest) String() string { + if qs, err := h.BuildQueryString(); err == nil { + return fmt.Sprintf("%s?%s", h.GetURL(), qs) + } + return h.GetURL() +} + +func (h *HttpRequest) getContentType() string { + if v, ok := h.headers["Content-Type"]; ok { + return v + } + return string(mimeFormURLEncoded) +} + +func (h *HttpRequest) buildHTTPRequest() (*http.Request, error) { + qs, err := h.BuildQueryString() + if err != nil { + return nil, errors.Errorf("cannot build query string, %s", err) + } + + var httpReq *http.Request + if h.getContentType() == string(mimeFormURLEncoded) && len(h.GetRequestBody()) == 0 { + httpReq, err = http.NewRequest(h.GetMethod(), h.GetURL(), strings.NewReader(qs)) + } else { + httpReq, err = http.NewRequest(h.GetMethod(), h.String(), bytes.NewReader(h.GetRequestBody())) + } + + if err != nil { + return nil, errors.Errorf("cannot build request, %s", err) + } + + for k, v := range utils.MergeMap(DefaultHeaders, h.GetHeaderMap()) { + httpReq.Header.Set(k, v) + } + return httpReq, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/response.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/response.go new file mode 100644 index 000000000..c5c863d3a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/protocol/http/response.go @@ -0,0 +1,52 @@ +package http + +import ( + "net/http" +) + +// HttpResponse is a simple wrapper of "net/http" response +type HttpResponse struct { + body []byte + statusCode int + originHttpResponse *http.Response // origin "net/http" response +} + +// NewHttpResponse will create a new response of http request +func NewHttpResponse() *HttpResponse { + return &HttpResponse{} +} + +// GetBody will get body from from sdk http request +func (h *HttpResponse) GetBody() []byte { + return h.body +} + +func (h *HttpResponse) GetHeaders() http.Header { + if h.originHttpResponse == nil { + return http.Header{} + } + return h.originHttpResponse.Header +} + +// SetBody will set body into http response +// it usually used for restore the body already read from an stream +// it will also cause extra memory usage +func (h *HttpResponse) SetBody(body []byte) error { + h.body = body + return nil +} + +// GetStatusCode will return status code of origin http response +func (h *HttpResponse) GetStatusCode() int { + return h.statusCode +} + +// SetStatusCode will return status code of origin http response +func (h *HttpResponse) SetStatusCode(code int) { + h.statusCode = code +} + +func (h *HttpResponse) setHttpResponse(resp *http.Response) { + h.statusCode = resp.StatusCode + h.originHttpResponse = resp +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/accessor.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/accessor.go new file mode 100644 index 000000000..efe834c6b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/accessor.go @@ -0,0 +1,73 @@ +package utils + +import ( + "reflect" + "strconv" + "strings" + + "github.com/pkg/errors" +) + +// ValueAtPath will get struct attribute value by recursive +func ValueAtPath(v interface{}, path string) (interface{}, error) { + components := strings.Split(path, ".") + + rv := reflect.ValueOf(v) + for rv.Kind() == reflect.Ptr { + if rv.IsNil() { + return nil, errors.Errorf("object %#v is nil", v) + } + rv = rv.Elem() + } + + if rv.Kind() == reflect.Slice || rv.Kind() == reflect.Array { + i, err := strconv.Atoi(components[0]) + if err != nil { + return nil, errors.Errorf("path %s is invalid at index of array", path) + } + + length := rv.Len() + if i >= length { + return nil, errors.Errorf("path %s is invalid, array has length %v, but got %v", path, length, i) + } + + itemV := rv.Index(i) + if !itemV.IsValid() { + return nil, errors.Errorf("path %s is invalid for map", path) + } + + if len(components) > 1 { + return ValueAtPath(itemV.Interface(), strings.Join(components[1:], ".")) + } + + return itemV.Interface(), nil + } + + if rv.Kind() == reflect.Map && !rv.IsNil() { + itemV := rv.MapIndex(reflect.ValueOf(components[0])) + if !itemV.IsValid() { + return nil, errors.Errorf("path %s is invalid for map", path) + } + + if len(components) > 1 { + return ValueAtPath(itemV.Interface(), strings.Join(components[1:], ".")) + } + + return itemV.Interface(), nil + } + + if rv.Kind() == reflect.Struct { + itemV := rv.FieldByName(components[0]) + if !itemV.IsValid() { + return nil, errors.Errorf("path %s is invalid for struct", path) + } + + if len(components) > 1 { + return ValueAtPath(itemV.Interface(), strings.Join(components[1:], ".")) + } + + return itemV.Interface(), nil + } + + return nil, errors.Errorf("object %#v is invalid, need map or struct", v) +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/collection.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/collection.go new file mode 100644 index 000000000..0d5d8ab7d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/collection.go @@ -0,0 +1,43 @@ +package utils + +import ( + "fmt" + "strings" +) + +// MergeMap will merge two map and return a new map +func MergeMap(args ...map[string]string) map[string]string { + m := map[string]string{} + for _, kv := range args { + for k, v := range kv { + m[k] = v + } + } + return m +} + +// SetMapIfNotExists will set a key-value of the map if the key is not exists +func SetMapIfNotExists(m map[string]string, k string, v string) { + if _, ok := m[k]; !ok && v != "" { + m[k] = v + } +} + +// IsStringIn will return if the value is contains by an array +func IsStringIn(val string, availables []string) bool { + for _, choice := range availables { + if val == choice { + return true + } + } + + return false +} + +// CheckStringIn will check if the value is contains by an array +func CheckStringIn(val string, availables []string) error { + if IsStringIn(val, availables) { + return nil + } + return fmt.Errorf("got %s, should be one of %s", val, strings.Join(availables, ",")) +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/doc.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/doc.go new file mode 100644 index 000000000..621a54c3c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/doc.go @@ -0,0 +1,4 @@ +/* +Package utils is the utilities to process internal data of sdk +*/ +package utils diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/patch.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/patch.go new file mode 100644 index 000000000..e38140086 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/patch.go @@ -0,0 +1,44 @@ +package utils + +import ( + "regexp" +) + +// Patch is the patch object to provider a converter function +type Patch interface { + Patch([]byte) []byte +} + +// RegexpPatcher a patch object to provider a converter function from regular expression +type RegexpPatcher struct { + pattern *regexp.Regexp + replacement string +} + +// NewRegexpPatcher will return a patch object to provider a converter function from regular expression +func NewRegexpPatcher(regex string, repl string) *RegexpPatcher { + return &RegexpPatcher{ + pattern: regexp.MustCompile(regex), + replacement: repl, + } +} + +// Patch will convert a bytes to another bytes with patch rules +func (p *RegexpPatcher) Patch(body []byte) []byte { + // TODO: ensure why the pattern will be disabled when there are multiple goroutines for bytes replacement + return []byte(p.PatchString(string(body))) +} + +// PatchString will convert a string to another string with patch rules +func (p *RegexpPatcher) PatchString(body string) string { + return p.pattern.ReplaceAllString(body, p.replacement) +} + +// RetCodePatcher will convert `RetCode` as integer +var RetCodePatcher = NewRegexpPatcher(`"RetCode":\s?"(\d+)"`, `"RetCode": $1`) + +// PortPatcher will convert `Port` as integer +var PortPatcher = NewRegexpPatcher(`"Port":\s?"(\d+)"`, `"Port": $1`) + +// FrequencePatcher will convert `Frequence` as float64 +var FrequencePatcher = NewRegexpPatcher(`"Frequence":\s?"([\d.]+)"`, `"Frequence": $1`) diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/waiter.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/waiter.go new file mode 100644 index 000000000..7433a9139 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/waiter.go @@ -0,0 +1,53 @@ +package utils + +import ( + "errors" + "time" + + "github.com/ucloud/ucloud-sdk-go/ucloud/log" +) + +// Waiter to wait sth until it completed. +type Waiter interface { + WaitForCompletion() error + Cancel() error +} + +// FuncWaiter used for waiting any condition function. +type FuncWaiter struct { + Interval time.Duration + MaxAttempts int + Checker func() (bool, error) + IgnoreError bool + + cancel chan struct{} +} + +// WaitForCompletion will wait until the state of consdition is available. +// It will call the condition function to ensure state with interval. +func (w *FuncWaiter) WaitForCompletion() error { + for i := 0; ; i++ { + log.Infof("Waiting for completion ... attempted %v times, %v total", i, w.MaxAttempts) + + if i >= w.MaxAttempts { + return errors.New("maximum attempts are reached") + } + + if ok, err := w.Checker(); ok || (!w.IgnoreError && err != nil) { + return err + } + + select { + case <-time.After(w.Interval): + continue + case <-w.cancel: + break + } + } +} + +// Cancel will stop all of WaitForCompletion function call. +func (w *FuncWaiter) Cancel() error { + w.cancel <- struct{}{} + return nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/client.go new file mode 100644 index 000000000..26c8f390c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/client.go @@ -0,0 +1,19 @@ +package uaccount + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" +) + +// UAccountClient is the client of UAccount +type UAccountClient struct { + *ucloud.Client +} + +// NewClient will return a instance of UAccountClient +func NewClient(config *ucloud.Config, credential *auth.Credential) *UAccountClient { + client := ucloud.NewClient(config, credential) + return &UAccountClient{ + client, + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/create_project.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/create_project.go new file mode 100644 index 000000000..a71bbadea --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/create_project.go @@ -0,0 +1,53 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UAccount CreateProject + +package uaccount + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateProjectRequest is request schema for CreateProject action +type CreateProjectRequest struct { + request.CommonBase + + // 项目名称 + ProjectName *string `required:"true"` + + // 项目父节点Id, 不填写创建顶层项目 + ParentId *string `required:"false"` +} + +// CreateProjectResponse is response schema for CreateProject action +type CreateProjectResponse struct { + response.CommonBase + + // 所创建项目的Id + ProjectId string +} + +// NewCreateProjectRequest will create request of CreateProject action. +func (c *UAccountClient) NewCreateProjectRequest() *CreateProjectRequest { + req := &CreateProjectRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateProject - 创建项目 +func (c *UAccountClient) CreateProject(req *CreateProjectRequest) (*CreateProjectResponse, error) { + var err error + var res CreateProjectResponse + + err = c.Client.InvokeAction("CreateProject", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/doc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/doc.go new file mode 100644 index 000000000..1f28c926f --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/doc.go @@ -0,0 +1,11 @@ +/* +Package uaccount include resources of ucloud uaccount product + +See also + + - API: https://docs.ucloud.cn/api/uaccount-api/index + - Product: https://www.ucloud.cn/site/product/uaccount.html + +for detail. +*/ +package uaccount diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/get_project_list.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/get_project_list.go new file mode 100644 index 000000000..0a5971b04 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/get_project_list.go @@ -0,0 +1,53 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UAccount GetProjectList + +package uaccount + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetProjectListRequest is request schema for GetProjectList action +type GetProjectListRequest struct { + request.CommonBase + + // 是否是财务账号(Yes: 是, No: 否) + IsFinance *string `required:"false"` +} + +// GetProjectListResponse is response schema for GetProjectList action +type GetProjectListResponse struct { + response.CommonBase + + // 项目总数 + ProjectCount int + + // JSON格式的项目列表实例 + ProjectSet []ProjectListInfo +} + +// NewGetProjectListRequest will create request of GetProjectList action. +func (c *UAccountClient) NewGetProjectListRequest() *GetProjectListRequest { + req := &GetProjectListRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetProjectList - 获取项目列表 +func (c *UAccountClient) GetProjectList(req *GetProjectListRequest) (*GetProjectListResponse, error) { + var err error + var res GetProjectListResponse + + err = c.Client.InvokeAction("GetProjectList", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/get_region.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/get_region.go new file mode 100644 index 000000000..6eb6c7e3b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/get_region.go @@ -0,0 +1,47 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UAccount GetRegion + +package uaccount + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetRegionRequest is request schema for GetRegion action +type GetRegionRequest struct { + request.CommonBase +} + +// GetRegionResponse is response schema for GetRegion action +type GetRegionResponse struct { + response.CommonBase + + // 各数据中心信息 + Regions []RegionInfo +} + +// NewGetRegionRequest will create request of GetRegion action. +func (c *UAccountClient) NewGetRegionRequest() *GetRegionRequest { + req := &GetRegionRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetRegion - 获取用户在各数据中心的权限等信息 +func (c *UAccountClient) GetRegion(req *GetRegionRequest) (*GetRegionResponse, error) { + var err error + var res GetRegionResponse + + err = c.Client.InvokeAction("GetRegion", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/get_user_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/get_user_info.go new file mode 100644 index 000000000..bec6d57e9 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/get_user_info.go @@ -0,0 +1,47 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UAccount GetUserInfo + +package uaccount + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetUserInfoRequest is request schema for GetUserInfo action +type GetUserInfoRequest struct { + request.CommonBase +} + +// GetUserInfoResponse is response schema for GetUserInfo action +type GetUserInfoResponse struct { + response.CommonBase + + // 用户信息返回数组 + DataSet []UserInfo +} + +// NewGetUserInfoRequest will create request of GetUserInfo action. +func (c *UAccountClient) NewGetUserInfoRequest() *GetUserInfoRequest { + req := &GetUserInfoRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetUserInfo - 获取用户信息 +func (c *UAccountClient) GetUserInfo(req *GetUserInfoRequest) (*GetUserInfoResponse, error) { + var err error + var res GetUserInfoResponse + + err = c.Client.InvokeAction("GetUserInfo", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/modify_project.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/modify_project.go new file mode 100644 index 000000000..ef5cef587 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/modify_project.go @@ -0,0 +1,50 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UAccount ModifyProject + +package uaccount + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ModifyProjectRequest is request schema for ModifyProject action +type ModifyProjectRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // 新的项目名称 + ProjectName *string `required:"true"` +} + +// ModifyProjectResponse is response schema for ModifyProject action +type ModifyProjectResponse struct { + response.CommonBase +} + +// NewModifyProjectRequest will create request of ModifyProject action. +func (c *UAccountClient) NewModifyProjectRequest() *ModifyProjectRequest { + req := &ModifyProjectRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ModifyProject - 修改项目 +func (c *UAccountClient) ModifyProject(req *ModifyProjectRequest) (*ModifyProjectResponse, error) { + var err error + var res ModifyProjectResponse + + err = c.Client.InvokeAction("ModifyProject", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/terminate_project.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/terminate_project.go new file mode 100644 index 000000000..d39b0dc3c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/terminate_project.go @@ -0,0 +1,48 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UAccount TerminateProject + +package uaccount + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// TerminateProjectRequest is request schema for TerminateProject action +type TerminateProjectRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + +} + +// TerminateProjectResponse is response schema for TerminateProject action +type TerminateProjectResponse struct { + response.CommonBase +} + +// NewTerminateProjectRequest will create request of TerminateProject action. +func (c *UAccountClient) NewTerminateProjectRequest() *TerminateProjectRequest { + req := &TerminateProjectRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// TerminateProject - 删除项目 +func (c *UAccountClient) TerminateProject(req *TerminateProjectRequest) (*TerminateProjectResponse, error) { + var err error + var res TerminateProjectResponse + + err = c.Client.InvokeAction("TerminateProject", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/types_project_list_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/types_project_list_info.go new file mode 100644 index 000000000..c0daa5707 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/types_project_list_info.go @@ -0,0 +1,34 @@ +package uaccount + +/* +ProjectListInfo - 项目信息 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type ProjectListInfo struct { + + // 项目ID + ProjectId string + + // 项目名称 + ProjectName string + + // 父项目ID + ParentId string + + // 父项目名称 + ParentName string + + // 创建时间(Unix时间戳) + CreateTime int + + // 是否为默认项目 + IsDefault bool + + // 项目下资源数量 + ResourceCount int + + // 项目下成员数量 + MemberCount int +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/types_region_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/types_region_info.go new file mode 100644 index 000000000..4a8510eac --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/types_region_info.go @@ -0,0 +1,28 @@ +package uaccount + +/* +RegionInfo - 数据中心信息 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type RegionInfo struct { + + // 数据中心ID + RegionId int + + // 数据中心名称 + RegionName string + + // 是否用户当前默认数据中心 + IsDefault bool + + // 用户在此数据中心的权限位 + BitMaps string + + // 地域名字,如cn-bj + Region string + + // 可用区名字,如cn-bj-01 + Zone string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/types_user_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/types_user_info.go new file mode 100644 index 000000000..e933f9b0e --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/types_user_info.go @@ -0,0 +1,58 @@ +package uaccount + +/* +UserInfo - 用户信息 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UserInfo struct { + + // 用户Id + UserId int + + // 用户邮箱 + UserEmail string + + // 用户手机 + UserPhone string + + // 国际号码前缀 + PhonePrefix string + + // 会员类型 + UserType int + + // 称呼 + UserName string + + // 公司名称 + CompanyName string + + // 所属行业 + IndustryType int + + // 省份 + Province string + + // 城市 + City string + + // 公司地址 + UserAddress string + + // 是否超级管理员 0:否 1:是 + Admin int + + // 是否子帐户(大于100为子帐户) + UserVersion int + + // 是否有财务权限 0:否 1:是 + Finance int + + // 管理员 + Administrator string + + // 实名认证状态 + AuthState string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/client.go new file mode 100644 index 000000000..85b57089a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/client.go @@ -0,0 +1,19 @@ +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" +) + +// UHostClient is the client of UHost +type UHostClient struct { + *ucloud.Client +} + +// NewClient will return a instance of UHostClient +func NewClient(config *ucloud.Config, credential *auth.Credential) *UHostClient { + client := ucloud.NewClient(config, credential) + return &UHostClient{ + client, + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/copy_custom_image.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/copy_custom_image.go new file mode 100644 index 000000000..1857ca4eb --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/copy_custom_image.go @@ -0,0 +1,71 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost CopyCustomImage + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CopyCustomImageRequest is request schema for CopyCustomImage action +type CopyCustomImageRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 源镜像Id, 参见 DescribeImage + SourceImageId *string `required:"true"` + + // 目标项目Id, 参见 GetProjectList + TargetProjectId *string `required:"true"` + + // 目标地域,不跨地域不用填 + TargetRegion *string `required:"false"` + + // 目标镜像名称 + TargetImageName *string `required:"false"` + + // 目标镜像描述 + TargetImageDescription *string `required:"false"` +} + +// CopyCustomImageResponse is response schema for CopyCustomImage action +type CopyCustomImageResponse struct { + response.CommonBase + + // 目标镜像Id + TargetImageId string +} + +// NewCopyCustomImageRequest will create request of CopyCustomImage action. +func (c *UHostClient) NewCopyCustomImageRequest() *CopyCustomImageRequest { + req := &CopyCustomImageRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CopyCustomImage - 复制自制镜像 +func (c *UHostClient) CopyCustomImage(req *CopyCustomImageRequest) (*CopyCustomImageResponse, error) { + var err error + var res CopyCustomImageResponse + + err = c.Client.InvokeAction("CopyCustomImage", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_custom_image.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_custom_image.go new file mode 100644 index 000000000..b65300559 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_custom_image.go @@ -0,0 +1,65 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost CreateCustomImage + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateCustomImageRequest is request schema for CreateCustomImage action +type CreateCustomImageRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` + + // 镜像名称 + ImageName *string `required:"true"` + + // 镜像描述 + ImageDescription *string `required:"false"` +} + +// CreateCustomImageResponse is response schema for CreateCustomImage action +type CreateCustomImageResponse struct { + response.CommonBase + + // 镜像Id + ImageId string +} + +// NewCreateCustomImageRequest will create request of CreateCustomImage action. +func (c *UHostClient) NewCreateCustomImageRequest() *CreateCustomImageRequest { + req := &CreateCustomImageRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateCustomImage - 从指定UHost实例,生成自定义镜像。 +func (c *UHostClient) CreateCustomImage(req *CreateCustomImageRequest) (*CreateCustomImageResponse, error) { + var err error + var res CreateCustomImageResponse + + err = c.Client.InvokeAction("CreateCustomImage", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_uhost_instance.go new file mode 100644 index 000000000..805211729 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_uhost_instance.go @@ -0,0 +1,202 @@ +package uhost + +import ( + "encoding/base64" + + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateUHostInstanceRequest is request schema for CreateUHostInstance action +type CreateUHostInstanceRequest struct { + request.CommonBase + + // 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"true"` + + // 镜像ID。 请通过 [DescribeImage](describe_image.html)获取 + ImageId *string `required:"true"` + + // UHost密码,LoginMode为Password时此项必须(密码需使用base64进行编码) + Password *string `required:"true"` + + // 磁盘列表 + Disks []UHostDisk `required:"true"` + + // UHost实例名称。默认:UHost。请遵照[[api:uhost-api:specification|字段规范]]设定实例名称。 + Name *string `required:"false"` + + // 业务组。默认:Default(Default即为未分组) + Tag *string `required:"false"` + + // 计费模式。枚举值为: Year,按年付费; Month,按月付费; Dynamic,按小时付费(需开启权限)。默认为月付 + ChargeType *string `required:"false"` + + // 购买时长。默认: 1。按小时购买(Dynamic)时无需此参数。 月付时,此参数传0,代表了购买至月末。 + Quantity *int `required:"false"` + + // 云主机机型。枚举值:N1:系列1标准型;N2:系列2标准型;I1: 系列1高IO型;I2,系列2高IO型; D1: 系列1大数据机型;G1: 系列1GPU型,型号为K80;G2:系列2GPU型,型号为P40;G3:系列2GPU型,型号为V100;北京A、北京C、上海二A、香港A可用区默认N1,其他机房默认N2。参考[[api:uhost-api:uhost_type|云主机机型说明]]。 + UHostType *string `required:"false"` + + // 虚拟CPU核数。可选参数:1-32(可选范围与UHostType相关)。默认值: 4 + CPU *int `required:"false"` + + // 内存大小。单位:MB。范围 :[1024, 262144],取值为1024的倍数(可选范围与UHostType相关)。默认值:8192 + Memory *int `required:"false"` + + // GPU卡核心数。仅GPU机型支持此字段;系列1可选1,2;系列2可选1,2,3,4。GPU可选数量与CPU有关联,详情请参考控制台。 + GPU *int `required:"false"` + + // 主机登陆模式。密码(默认选项): Password,key: KeyPair(此项暂不支持) + LoginMode *string `required:"false"` + + // 【暂不支持】Keypair公钥,LoginMode为KeyPair时此项必须 + KeyPair *string `required:"false"` + + // 【待废弃,不建议调用】磁盘类型,同时设定系统盘和数据盘的磁盘类型。枚举值为:LocalDisk,本地磁盘; UDisk,云硬盘;默认为LocalDisk。仅部分可用区支持云硬盘方式的主机存储方式,具体请查询控制台。 + StorageType *string `required:"false"` + + // 【待废弃,不建议调用】系统盘大小。 单位:GB, 范围[20,100], 步长:10 + BootDiskSpace *int `required:"false"` + + // 【待废弃,不建议调用】数据盘大小。 单位:GB, 范围[0,8000], 步长:10, 默认值:20,云盘支持0-8000;本地普通盘支持0-2000;本地SSD盘(包括所有GPU机型)支持100-1000 + DiskSpace *int `required:"false"` + + // 网络增强。目前仅Normal(不开启) 和Super(开启)可用。默认Normal。 不同机房的网络增强支持情况不同。详情请参考控制台。 + NetCapability *string `required:"false"` + + // 是否开启方舟特性。Yes为开启方舟,No为关闭方舟。目前仅选择普通本地盘+普通本地盘 或 SSD云盘+普通云盘的组合支持开启方舟。 + TimemachineFeature *string `required:"false"` + + // 是否开启热升级特性。True为开启,False为未开启,默认False。仅系列1云主机需要使用此字段,系列2云主机根据镜像是否支持云主机。 + HotplugFeature *bool `required:"false"` + + // 网络ID(VPC2.0情况下无需填写)。VPC1.0情况下,若不填写,代表选择基础网络; 若填写,代表选择子网。参见DescribeSubnet。 + NetworkId *string `required:"false"` + + // VPC ID。VPC2.0下需要填写此字段。 + VPCId *string `required:"false"` + + // 子网ID。VPC2.0下需要填写此字段。 + SubnetId *string `required:"false"` + + // 【数组】创建云主机时指定内网IP。当前只支持一个内网IP。调用方式举例:PrivateIp.0=x.x.x.x。 + PrivateIp []string `required:"false"` + + // 创建云主机时指定Mac。调用方式举例:PrivateMac="xx:xx:xx:xx:xx:xx"。 + PrivateMac *string `required:"false"` + + // 防火墙Id,默认:Web推荐防火墙。如何查询SecurityGroupId请参见 [DescribeSecurityGroup](../unet-api/describe_security_group.html) + SecurityGroupId *string `required:"false"` + + // 【暂不支持】cloudinit方式下,用户初始化脚本 + UserDataScript *string `required:"false"` + + // 【已废弃】宿主机类型,N2,N1 + HostType *string `required:"false"` + + // 【暂不支持】是否安装UGA。'yes': 安装;其他或者不填:不安装。 + InstallAgent *string `required:"false"` + + // 【内部参数】资源类型 + ResourceType *int `required:"false"` + + // 代金券ID。请通过DescribeCoupon接口查询,或登录用户中心查看 + CouponId *string `required:"false"` + + // 云主机类型,枚举值["N", "C", "G", "O"] + MachineType *string `required:"false"` + + // 最低cpu平台,枚举值["Intel/Auto", "Intel/LvyBridge", "Intel/Haswell", "Intel/Broadwell", "Intel/Skylake", "Intel/Cascadelake"(只有O型云主机可选)] + MinimalCpuPlatform *string `required:"false"` + + // NetworkInterface + NetworkInterface []CreateUHostInstanceParamNetworkInterface +} + +/* +CreateUHostInstanceParamNetworkInterface is request schema for complex param +*/ +type CreateUHostInstanceParamNetworkInterface struct { + + // EIP + EIP *CreateUHostInstanceParamNetworkInterfaceEIP +} + +/* +CreateUHostInstanceParamNetworkInterfaceEIP is request schema for complex param +*/ +type CreateUHostInstanceParamNetworkInterfaceEIP struct { + + // 弹性IP的计费模式. 枚举值: "Traffic", 流量计费; "Bandwidth", 带宽计费; "ShareBandwidth",共享带宽模式. "Free":免费带宽模式.默认为 "Bandwidth". + PayMode *string + + // 当前EIP代金券id。请通过DescribeCoupon接口查询,或登录用户中心查看 + CouponId *string + + // 【如果绑定EIP这个参数必填】弹性IP的外网带宽, 单位为Mbps. 共享带宽模式必须指定0M带宽, 非共享带宽模式必须指定非0Mbps带宽. 各地域非共享带宽的带宽范围如下: 流量计费[1-300],带宽计费[1-800] + Bandwidth *int + + // 绑定的共享带宽Id,仅当PayMode为ShareBandwidth时有效 + ShareBandwidthId *string + + // GlobalSSH + GlobalSSH *CreateUHostInstanceParamNetworkInterfaceEIPGlobalSSH + + // 【如果绑定EIP这个参数必填】弹性IP的线路如下: 国际: International BGP: Bgp 各地域允许的线路参数如下: cn-sh1: Bgp cn-sh2: Bgp cn-gd: Bgp cn-bj1: Bgp cn-bj2: Bgp hk: International us-ca: International th-bkk: International kr-seoul:International us-ws:International ge-fra:International sg:International tw-kh:International.其他海外线路均为 International + OperatorName *string +} + +/* +CreateUHostInstanceParamNetworkInterfaceEIPGlobalSSH is request schema for complex param +*/ +type CreateUHostInstanceParamNetworkInterfaceEIPGlobalSSH struct { + + // 填写支持SSH访问IP的地区名称,如“洛杉矶”,“新加坡”,“香港”,“东京”,“华盛顿”,“法兰克福”。Area和AreaCode两者必填一个 + Area *string + + // AreaCode, 区域航空港国际通用代码。Area和AreaCode两者必填一个 + AreaCode *string + + // SSH端口,1-65535且不能使用80,443端口 + Port *int +} + +// CreateUHostInstanceResponse is response schema for CreateUHostInstance action +type CreateUHostInstanceResponse struct { + response.CommonBase + + // UHost实例Id集合 + UHostIds []string + + // IP信息 + IPs []string +} + +// NewCreateUHostInstanceRequest will create request of CreateUHostInstance action. +func (c *UHostClient) NewCreateUHostInstanceRequest() *CreateUHostInstanceRequest { + req := &CreateUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateUHostInstance - 指定数据中心,根据资源使用量创建指定数量的UHost实例。 +func (c *UHostClient) CreateUHostInstance(req *CreateUHostInstanceRequest) (*CreateUHostInstanceResponse, error) { + var err error + var res CreateUHostInstanceResponse + var reqImmutable = *req + reqImmutable.Password = ucloud.String(base64.StdEncoding.EncodeToString([]byte(ucloud.StringValue(req.Password)))) + + err = c.Client.InvokeAction("CreateUHostInstance", &reqImmutable, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/describe_image.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/describe_image.go new file mode 100644 index 000000000..030e5b508 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/describe_image.go @@ -0,0 +1,77 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost DescribeImage + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeImageRequest is request schema for DescribeImage action +type DescribeImageRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 镜像类型。标准镜像:Base,镜像市场:Business, 自定义镜像:Custom,默认返回所有类型 + ImageType *string `required:"false"` + + // 操作系统类型:Linux, Windows 默认返回所有类型 + OsType *string `required:"false"` + + // 镜像Id + ImageId *string `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` + + // 返回数据长度,默认为20 + Limit *int `required:"false"` + + // 是否返回价格:1返回,0不返回;默认不返回 + PriceSet *int `required:"false"` +} + +// DescribeImageResponse is response schema for DescribeImage action +type DescribeImageResponse struct { + response.CommonBase + + // 满足条件的镜像总数 + TotalCount int + + // 镜像列表详见 UHostImageSet + ImageSet []UHostImageSet +} + +// NewDescribeImageRequest will create request of DescribeImage action. +func (c *UHostClient) NewDescribeImageRequest() *DescribeImageRequest { + req := &DescribeImageRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeImage - 获取指定数据中心镜像列表,用户可通过指定操作系统类型,镜像Id进行过滤。 +func (c *UHostClient) DescribeImage(req *DescribeImageRequest) (*DescribeImageResponse, error) { + var err error + var res DescribeImageResponse + + err = c.Client.InvokeAction("DescribeImage", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/describe_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/describe_uhost_instance.go new file mode 100644 index 000000000..bcf1da925 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/describe_uhost_instance.go @@ -0,0 +1,83 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost DescribeUHostInstance + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeUHostInstanceRequest is request schema for DescribeUHostInstance action +type DescribeUHostInstanceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 【数组】UHost主机的资源ID,例如UHostIds.0代表希望获取信息 的主机1,UHostIds.1代表主机2。 如果不传入,则返回当前Region 所有符合条件的UHost实例。 + UHostIds []string `required:"false"` + + // 要查询的业务组名称 + Tag *string `required:"false"` + + // 1:普通云主机;2:抢占型云主机;如不传此参数,默认全部获取 + LifeCycle *int `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` + + // 返回数据长度,默认为20,最大100 + Limit *int `required:"false"` + + // 硬件隔离组id。通过硬件隔离组筛选主机。 + IsolationGroup *string `required:"false"` + + // vpc id。通过VPC筛选主机。 + VPCId *string `required:"false"` + + // 子网id。通过子网筛选主机。 + SubnetId *string `required:"false"` +} + +// DescribeUHostInstanceResponse is response schema for DescribeUHostInstance action +type DescribeUHostInstanceResponse struct { + response.CommonBase + + // UHostInstance总数 + TotalCount int + + // 云主机实例列表,每项参数可见下面 UHostInstanceSet + UHostSet []UHostInstanceSet +} + +// NewDescribeUHostInstanceRequest will create request of DescribeUHostInstance action. +func (c *UHostClient) NewDescribeUHostInstanceRequest() *DescribeUHostInstanceRequest { + req := &DescribeUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeUHostInstance - 获取主机或主机列表信息,并可根据数据中心,主机ID等参数进行过滤。 +func (c *UHostClient) DescribeUHostInstance(req *DescribeUHostInstanceRequest) (*DescribeUHostInstanceResponse, error) { + var err error + var res DescribeUHostInstanceResponse + + err = c.Client.InvokeAction("DescribeUHostInstance", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/describe_uhost_tags.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/describe_uhost_tags.go new file mode 100644 index 000000000..230688d30 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/describe_uhost_tags.go @@ -0,0 +1,60 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost DescribeUHostTags + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeUHostTagsRequest is request schema for DescribeUHostTags action +type DescribeUHostTagsRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + +} + +// DescribeUHostTagsResponse is response schema for DescribeUHostTags action +type DescribeUHostTagsResponse struct { + response.CommonBase + + // 已有主机的业务组总个数 + TotalCount int + + // 业务组集合见 UHostTagSet + TagSet []UHostTagSet +} + +// NewDescribeUHostTagsRequest will create request of DescribeUHostTags action. +func (c *UHostClient) NewDescribeUHostTagsRequest() *DescribeUHostTagsRequest { + req := &DescribeUHostTagsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeUHostTags - 获取指定数据中心的业务组列表。 +func (c *UHostClient) DescribeUHostTags(req *DescribeUHostTagsRequest) (*DescribeUHostTagsResponse, error) { + var err error + var res DescribeUHostTagsResponse + + err = c.Client.InvokeAction("DescribeUHostTags", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/doc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/doc.go new file mode 100644 index 000000000..88c303ffe --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/doc.go @@ -0,0 +1,11 @@ +/* +Package uhost include resources of ucloud host product + +See also + + - API: https://docs.ucloud.cn/api/uhost-api/index + - Product: https://www.ucloud.cn/site/product/uhost.html + +for detail. +*/ +package uhost diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/enums.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/enums.go new file mode 100644 index 000000000..7b7614f34 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/enums.go @@ -0,0 +1,20 @@ +package uhost + +// State is the state of UHost instance +type State string + +// Enum values for State +const ( + StateInitializing State = "Initializing" + StateStarting State = "Starting" + StateRunning State = "Running" + StateStopping State = "Stopping" + StateStopped State = "Stopped" + StateInstallFail State = "InstallFail" + StateRebooting State = "Rebooting" +) + +// MarshalValue will marshal state value to string +func (enum State) MarshalValue() (string, error) { + return string(enum), nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/get_uhost_instance_price.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/get_uhost_instance_price.go new file mode 100644 index 000000000..aba9009e9 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/get_uhost_instance_price.go @@ -0,0 +1,94 @@ +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetUHostInstancePriceRequest is request schema for GetUHostInstancePrice action +type GetUHostInstancePriceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 镜像Id,可通过 [DescribeImage](describe_image.html) 获取镜像ID + ImageId *string `required:"true"` + + // 虚拟CPU核数。可选参数:1-32(可选范围与UHostType相关)。默认值: 4 + CPU *int `required:"true"` + + // 内存大小。单位:MB。范围 :[1024, 262144],取值为1024的倍数(可选范围与UHostType相关)。默认值:8192 + Memory *int `required:"true"` + + // 【未启用】购买台数,范围[1,5] + Count *int `required:"false"` + + // 磁盘列表 + Disks []UHostDisk + + // GPU卡核心数。仅GPU机型支持此字段(可选范围与UHostType相关)。 + GPU *int `required:"false"` + + // 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Dynamic,按小时付费 \\ 默认为月付。 + ChargeType *string `required:"false"` + + // 【待废弃】磁盘类型,同时设定系统盘和数据盘, 枚举值为:LocalDisk,本地磁盘; UDisk,云硬盘; 默认为LocalDisk 仅部分可用区支持云硬盘方式的主机存储方式,具体请查询控制台。 + StorageType *string `required:"false"` + + // 【待废弃】数据盘大小,单位: GB,范围[0,1000],步长: 10,默认值: 0 + DiskSpace *int `required:"false"` + + // 网络增强。枚举值:\\ > Normal,不开启 \\ > Super,开启 \\ 默认值未为Normal。 + NetCapability *string `required:"false"` + + // 【待废弃】方舟机型。No,Yes。默认是No。 + TimemachineFeature *string `required:"false"` + + // 主机类型 Normal: 标准机型 SSD:SSD机型 BigData:大数据 GPU:GPU型G1(原GPU型) GPU_G2:GPU型G2 GPU_G3:GPU型G3 不同机房的主机类型支持情况不同。详情请参考控制台。 + UHostType *string `required:"false"` + // 【未支持】1:普通云主机;2:抢占性云主机;默认普通 + LifeCycle *int `required:"false"` + + // 购买时长。默认: 1。按小时购买(Dynamic)时无需此参数。 月付时,此参数传0,代表了购买至月末。 + Quantity *int `required:"false"` +} + +// GetUHostInstancePriceResponse is response schema for GetUHostInstancePrice action +type GetUHostInstancePriceResponse struct { + response.CommonBase + + // 价格列表 UHostPriceSet + PriceSet []UHostPriceSet +} + +// NewGetUHostInstancePriceRequest will create request of GetUHostInstancePrice action. +func (c *UHostClient) NewGetUHostInstancePriceRequest() *GetUHostInstancePriceRequest { + req := &GetUHostInstancePriceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetUHostInstancePrice - 根据UHost实例配置,获取UHost实例的价格。 +func (c *UHostClient) GetUHostInstancePrice(req *GetUHostInstancePriceRequest) (*GetUHostInstancePriceResponse, error) { + var err error + var res GetUHostInstancePriceResponse + + err = c.Client.InvokeAction("GetUHostInstancePrice", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/get_uhost_instance_vnc_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/get_uhost_instance_vnc_info.go new file mode 100644 index 000000000..c7a081a46 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/get_uhost_instance_vnc_info.go @@ -0,0 +1,68 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost GetUHostInstanceVncInfo + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetUHostInstanceVncInfoRequest is request schema for GetUHostInstanceVncInfo action +type GetUHostInstanceVncInfoRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](./describe_uhost_instance.html) + UHostId *string `required:"true"` +} + +// GetUHostInstanceVncInfoResponse is response schema for GetUHostInstanceVncInfo action +type GetUHostInstanceVncInfoResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string + + // Vnc登录IP + VncIP string + + // Vnc登录端口 + VncPort int + + // Vnc 登录密码 + VncPassword string +} + +// NewGetUHostInstanceVncInfoRequest will create request of GetUHostInstanceVncInfo action. +func (c *UHostClient) NewGetUHostInstanceVncInfoRequest() *GetUHostInstanceVncInfoRequest { + req := &GetUHostInstanceVncInfoRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetUHostInstanceVncInfo - 获取指定UHost实例的管理VNC配置详细信息。 +func (c *UHostClient) GetUHostInstanceVncInfo(req *GetUHostInstanceVncInfoRequest) (*GetUHostInstanceVncInfoResponse, error) { + var err error + var res GetUHostInstanceVncInfoResponse + + err = c.Client.InvokeAction("GetUHostInstanceVncInfo", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/get_uhost_upgrade_price.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/get_uhost_upgrade_price.go new file mode 100644 index 000000000..695ea27ee --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/get_uhost_upgrade_price.go @@ -0,0 +1,80 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost GetUHostUpgradePrice + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetUHostUpgradePriceRequest is request schema for GetUHostUpgradePrice action +type GetUHostUpgradePriceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID。 参见 [DescribeUHostInstance](describe_uhost_instance.html)。 + UHostId *string `required:"true"` + + // 虚拟CPU核数。可选参数:1-32(可选范围与UHostType相关)。默认值为当前实例的CPU核数。 + CPU *int `required:"false"` + + // 内存大小。单位:MB。范围 :[1024, 262144],取值为1024的倍数(可选范围与UHostType相关)。默认值为当前实例的内存大小。 + Memory *int `required:"false"` + + // 【待废弃】数据盘大小,单位: GB,范围[0,1000],步长: 10, 默认值是该主机当前数据盘大小。 + DiskSpace *int `required:"false"` + + // 【待废弃】系统大小,单位: GB,范围[20,100],步长: 10。 + BootDiskSpace *int `required:"false"` + + // 方舟机型。No,Yes。默认是No。 + TimemachineFeature *string `required:"false"` + + // 网卡升降级(1,表示升级,2表示降级,0表示不变) + NetCapValue *int `required:"false"` + + // 【待废弃】主机系列,目前支持N1,N2 + HostType *string `required:"false"` +} + +// GetUHostUpgradePriceResponse is response schema for GetUHostUpgradePrice action +type GetUHostUpgradePriceResponse struct { + response.CommonBase + + // 规格调整差价。精确到小数点后2位。 + Price float64 +} + +// NewGetUHostUpgradePriceRequest will create request of GetUHostUpgradePrice action. +func (c *UHostClient) NewGetUHostUpgradePriceRequest() *GetUHostUpgradePriceRequest { + req := &GetUHostUpgradePriceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetUHostUpgradePrice - 获取UHost实例升级配置的价格。可选配置范围请参考[[api:uhost-api:uhost_type|云主机机型说明]]。 +func (c *UHostClient) GetUHostUpgradePrice(req *GetUHostUpgradePriceRequest) (*GetUHostUpgradePriceResponse, error) { + var err error + var res GetUHostUpgradePriceResponse + + err = c.Client.InvokeAction("GetUHostUpgradePrice", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/import_custom_image.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/import_custom_image.go new file mode 100644 index 000000000..a2bd320cb --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/import_custom_image.go @@ -0,0 +1,74 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost ImportCustomImage + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ImportCustomImageRequest is request schema for ImportCustomImage action +type ImportCustomImageRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 镜像名称 + ImageName *string `required:"true"` + + // UFile私有空间地址 + UFileUrl *string `required:"true"` + + // 操作系统平台,比如CentOS、Ubuntu、Windows、RedHat等,请参考控制台的镜像版本;若导入控制台上没有的操作系统,参数为Other + OsType *string `required:"true"` + + // 操作系统详细版本,请参考控制台的镜像版本;OsType为Other时,输入参数为Other + OsName *string `required:"true"` + + // 镜像格式,可选RAW、VHD、VMDK、qcow2 + Format *string `required:"true"` + + // 是否授权。必须填true + Auth *bool `required:"true"` + + // 镜像描述 + ImageDescription *string `required:"false"` +} + +// ImportCustomImageResponse is response schema for ImportCustomImage action +type ImportCustomImageResponse struct { + response.CommonBase + + // 镜像Id + ImageId string +} + +// NewImportCustomImageRequest will create request of ImportCustomImage action. +func (c *UHostClient) NewImportCustomImageRequest() *ImportCustomImageRequest { + req := &ImportCustomImageRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// ImportCustomImage - 把UFile的镜像文件导入到UHost,生成自定义镜像 +func (c *UHostClient) ImportCustomImage(req *ImportCustomImageRequest) (*ImportCustomImageResponse, error) { + var err error + var res ImportCustomImageResponse + + err = c.Client.InvokeAction("ImportCustomImage", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/modify_uhost_instance_name.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/modify_uhost_instance_name.go new file mode 100644 index 000000000..5e383a867 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/modify_uhost_instance_name.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost ModifyUHostInstanceName + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ModifyUHostInstanceNameRequest is request schema for ModifyUHostInstanceName action +type ModifyUHostInstanceNameRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` + + // UHost实例名称 + Name *string `required:"false"` +} + +// ModifyUHostInstanceNameResponse is response schema for ModifyUHostInstanceName action +type ModifyUHostInstanceNameResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string +} + +// NewModifyUHostInstanceNameRequest will create request of ModifyUHostInstanceName action. +func (c *UHostClient) NewModifyUHostInstanceNameRequest() *ModifyUHostInstanceNameRequest { + req := &ModifyUHostInstanceNameRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ModifyUHostInstanceName - 修改指定UHost实例名称,需要给出数据中心,UHostId,及新的实例名称。 +func (c *UHostClient) ModifyUHostInstanceName(req *ModifyUHostInstanceNameRequest) (*ModifyUHostInstanceNameResponse, error) { + var err error + var res ModifyUHostInstanceNameResponse + + err = c.Client.InvokeAction("ModifyUHostInstanceName", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/modify_uhost_instance_remark.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/modify_uhost_instance_remark.go new file mode 100644 index 000000000..5407bf6f3 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/modify_uhost_instance_remark.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost ModifyUHostInstanceRemark + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ModifyUHostInstanceRemarkRequest is request schema for ModifyUHostInstanceRemark action +type ModifyUHostInstanceRemarkRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` + + // 备注 + Remark *string `required:"false"` +} + +// ModifyUHostInstanceRemarkResponse is response schema for ModifyUHostInstanceRemark action +type ModifyUHostInstanceRemarkResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string +} + +// NewModifyUHostInstanceRemarkRequest will create request of ModifyUHostInstanceRemark action. +func (c *UHostClient) NewModifyUHostInstanceRemarkRequest() *ModifyUHostInstanceRemarkRequest { + req := &ModifyUHostInstanceRemarkRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ModifyUHostInstanceRemark - 修改指定UHost实例备注信息。 +func (c *UHostClient) ModifyUHostInstanceRemark(req *ModifyUHostInstanceRemarkRequest) (*ModifyUHostInstanceRemarkResponse, error) { + var err error + var res ModifyUHostInstanceRemarkResponse + + err = c.Client.InvokeAction("ModifyUHostInstanceRemark", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/modify_uhost_instance_tag.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/modify_uhost_instance_tag.go new file mode 100644 index 000000000..b06b7bd57 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/modify_uhost_instance_tag.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost ModifyUHostInstanceTag + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ModifyUHostInstanceTagRequest is request schema for ModifyUHostInstanceTag action +type ModifyUHostInstanceTagRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` + + // 业务组名称 + Tag *string `required:"false"` +} + +// ModifyUHostInstanceTagResponse is response schema for ModifyUHostInstanceTag action +type ModifyUHostInstanceTagResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string +} + +// NewModifyUHostInstanceTagRequest will create request of ModifyUHostInstanceTag action. +func (c *UHostClient) NewModifyUHostInstanceTagRequest() *ModifyUHostInstanceTagRequest { + req := &ModifyUHostInstanceTagRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ModifyUHostInstanceTag - 修改指定UHost实例业务组标识。 +func (c *UHostClient) ModifyUHostInstanceTag(req *ModifyUHostInstanceTagRequest) (*ModifyUHostInstanceTagResponse, error) { + var err error + var res ModifyUHostInstanceTagResponse + + err = c.Client.InvokeAction("ModifyUHostInstanceTag", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/poweroff_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/poweroff_uhost_instance.go new file mode 100644 index 000000000..3681e8519 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/poweroff_uhost_instance.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost PoweroffUHostInstance + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// PoweroffUHostInstanceRequest is request schema for PoweroffUHostInstance action +type PoweroffUHostInstanceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](./describe_uhost_instance.html) + UHostId *string `required:"true"` +} + +// PoweroffUHostInstanceResponse is response schema for PoweroffUHostInstance action +type PoweroffUHostInstanceResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string +} + +// NewPoweroffUHostInstanceRequest will create request of PoweroffUHostInstance action. +func (c *UHostClient) NewPoweroffUHostInstanceRequest() *PoweroffUHostInstanceRequest { + req := &PoweroffUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// PoweroffUHostInstance - 直接关闭UHost实例电源,无需等待实例正常关闭。 +func (c *UHostClient) PoweroffUHostInstance(req *PoweroffUHostInstanceRequest) (*PoweroffUHostInstanceResponse, error) { + var err error + var res PoweroffUHostInstanceResponse + + err = c.Client.InvokeAction("PoweroffUHostInstance", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/reboot_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/reboot_uhost_instance.go new file mode 100644 index 000000000..27c8d9118 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/reboot_uhost_instance.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost RebootUHostInstance + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// RebootUHostInstanceRequest is request schema for RebootUHostInstance action +type RebootUHostInstanceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` + + // 加密盘密码 + DiskPassword *string `required:"false"` +} + +// RebootUHostInstanceResponse is response schema for RebootUHostInstance action +type RebootUHostInstanceResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string +} + +// NewRebootUHostInstanceRequest will create request of RebootUHostInstance action. +func (c *UHostClient) NewRebootUHostInstanceRequest() *RebootUHostInstanceRequest { + req := &RebootUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// RebootUHostInstance - 重新启动UHost实例,需要指定数据中心及UHostID两个参数的值。 +func (c *UHostClient) RebootUHostInstance(req *RebootUHostInstanceRequest) (*RebootUHostInstanceResponse, error) { + var err error + var res RebootUHostInstanceResponse + + err = c.Client.InvokeAction("RebootUHostInstance", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/reinstall_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/reinstall_uhost_instance.go new file mode 100644 index 000000000..82406441a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/reinstall_uhost_instance.go @@ -0,0 +1,76 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost ReinstallUHostInstance + +package uhost + +import ( + "encoding/base64" + + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ReinstallUHostInstanceRequest is request schema for ReinstallUHostInstance action +type ReinstallUHostInstanceRequest struct { + request.CommonBase + + // 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // UHost实例资源ID 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` + + // 如果创建UHost实例时LoginMode为Password,则必须填写,如果LoginMode为KeyPair,不需要填写 (密码格式使用BASE64编码;LoginMode不可变更) + Password *string `required:"false"` + + // 镜像Id,默认使用原镜像 参见 [DescribeImage](describe_image.html) + ImageId *string `required:"false"` + + // 系统盘大小。 单位:GB, 范围[20,100], 步长:10 + BootDiskSpace *int `required:"false"` + + // 是否保留数据盘,保留:Yes,不报留:No, 默认:Yes;如果是从Windows重装为Linux或反之,则无法保留数据盘 + ReserveDisk *string `required:"false"` + + // 云灾备指明191 + ResourceType *int `required:"false"` + + // 针对非私有子网主机,可自定义DNS。n可为0-2 + DNSServers []string `required:"false"` +} + +// ReinstallUHostInstanceResponse is response schema for ReinstallUHostInstance action +type ReinstallUHostInstanceResponse struct { + response.CommonBase + + // UHost实例资源ID + UhostId string +} + +// NewReinstallUHostInstanceRequest will create request of ReinstallUHostInstance action. +func (c *UHostClient) NewReinstallUHostInstanceRequest() *ReinstallUHostInstanceRequest { + req := &ReinstallUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ReinstallUHostInstance - 重新安装指定UHost实例的操作系统 +func (c *UHostClient) ReinstallUHostInstance(req *ReinstallUHostInstanceRequest) (*ReinstallUHostInstanceResponse, error) { + var err error + var res ReinstallUHostInstanceResponse + var reqImmutable = *req + reqImmutable.Password = ucloud.String(base64.StdEncoding.EncodeToString([]byte(ucloud.StringValue(req.Password)))) + + err = c.Client.InvokeAction("ReinstallUHostInstance", &reqImmutable, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/reset_uhost_instance_password.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/reset_uhost_instance_password.go new file mode 100644 index 000000000..da419b7e0 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/reset_uhost_instance_password.go @@ -0,0 +1,67 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost ResetUHostInstancePassword + +package uhost + +import ( + "encoding/base64" + + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ResetUHostInstancePasswordRequest is request schema for ResetUHostInstancePassword action +type ResetUHostInstancePasswordRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID + UHostId *string `required:"true"` + + // UHost新密码(密码格式使用BASE64编码) + Password *string `required:"true"` +} + +// ResetUHostInstancePasswordResponse is response schema for ResetUHostInstancePassword action +type ResetUHostInstancePasswordResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string +} + +// NewResetUHostInstancePasswordRequest will create request of ResetUHostInstancePassword action. +func (c *UHostClient) NewResetUHostInstancePasswordRequest() *ResetUHostInstancePasswordRequest { + req := &ResetUHostInstancePasswordRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ResetUHostInstancePassword - 重置UHost实例的管理员密码。 +func (c *UHostClient) ResetUHostInstancePassword(req *ResetUHostInstancePasswordRequest) (*ResetUHostInstancePasswordResponse, error) { + var err error + var res ResetUHostInstancePasswordResponse + var reqImmutable = *req + reqImmutable.Password = ucloud.String(base64.StdEncoding.EncodeToString([]byte(ucloud.StringValue(req.Password)))) + + err = c.Client.InvokeAction("ResetUHostInstancePassword", &reqImmutable, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/resize_attached_disk.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/resize_attached_disk.go new file mode 100644 index 000000000..1b6bdd6eb --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/resize_attached_disk.go @@ -0,0 +1,65 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost ResizeAttachedDisk + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ResizeAttachedDiskRequest is request schema for ResizeAttachedDisk action +type ResizeAttachedDiskRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID。 参见 [DescribeUHostInstance](describe_uhost_instance.html)。 + UHostId *string `required:"true"` + + // 磁盘大小,单位GB,步长为10。取值范围需大于当前磁盘大小,最大值请参考[[api:uhost-api:disk_type|磁盘类型]]。 + DiskSpace *int `required:"true"` + + // 磁盘ID。参见 [DescribeUHostInstance](describe_uhost_instance.html)返回值中的DiskSet。 + DiskId *string `required:"true"` +} + +// ResizeAttachedDiskResponse is response schema for ResizeAttachedDisk action +type ResizeAttachedDiskResponse struct { + response.CommonBase + + // 改配成功的磁盘id + DiskId string +} + +// NewResizeAttachedDiskRequest will create request of ResizeAttachedDisk action. +func (c *UHostClient) NewResizeAttachedDiskRequest() *ResizeAttachedDiskRequest { + req := &ResizeAttachedDiskRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ResizeAttachedDisk - 修改挂载的磁盘大小,包含系统盘和数据盘 +func (c *UHostClient) ResizeAttachedDisk(req *ResizeAttachedDiskRequest) (*ResizeAttachedDiskResponse, error) { + var err error + var res ResizeAttachedDiskResponse + + err = c.Client.InvokeAction("ResizeAttachedDisk", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/resize_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/resize_uhost_instance.go new file mode 100644 index 000000000..628f3736d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/resize_uhost_instance.go @@ -0,0 +1,74 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost ResizeUHostInstance + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ResizeUHostInstanceRequest is request schema for ResizeUHostInstance action +type ResizeUHostInstanceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` + + // 虚拟CPU核数。可选参数:1-32(可选范围与UHostType相关)。默认值为当前实例的CPU核数 + CPU *int `required:"false"` + + // 内存大小。单位:MB。范围 :[1024, 262144],取值为1024的倍数(可选范围与UHostType相关)。默认值为当前实例的内存大小。 + Memory *int `required:"false"` + + // 【待废弃】数据盘大小,单位:GB,范围[10,1000]; SSD机型,单位:GB,范围[100,500];步长:10,默认值为当前实例的数据盘大小,数据盘不支持缩容,因此不允许输入比当前实例数据盘大小的值 + DiskSpace *int `required:"false"` + + // 【待废弃】系统盘大小,单位:GB,范围[20,100],步长:10,系统盘不支持缩容,因此不允许输入比当前实例系统盘小的值 + BootDiskSpace *int `required:"false"` + + // 网卡升降级(1,表示升级,2表示降级,0表示不变) + NetCapValue *int `required:"false"` +} + +// ResizeUHostInstanceResponse is response schema for ResizeUHostInstance action +type ResizeUHostInstanceResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string +} + +// NewResizeUHostInstanceRequest will create request of ResizeUHostInstance action. +func (c *UHostClient) NewResizeUHostInstanceRequest() *ResizeUHostInstanceRequest { + req := &ResizeUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ResizeUHostInstance - 修改指定UHost实例的资源配置,如CPU核心数,内存容量大小,网络增强等。可选配置范围请参考[[api:uhost-api:uhost_type|云主机机型说明]]。 +func (c *UHostClient) ResizeUHostInstance(req *ResizeUHostInstanceRequest) (*ResizeUHostInstanceResponse, error) { + var err error + var res ResizeUHostInstanceResponse + + err = c.Client.InvokeAction("ResizeUHostInstance", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/start_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/start_uhost_instance.go new file mode 100644 index 000000000..d60e30924 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/start_uhost_instance.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost StartUHostInstance + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// StartUHostInstanceRequest is request schema for StartUHostInstance action +type StartUHostInstanceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` + + // 加密盘密码 + DiskPassword *string `required:"false"` +} + +// StartUHostInstanceResponse is response schema for StartUHostInstance action +type StartUHostInstanceResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string +} + +// NewStartUHostInstanceRequest will create request of StartUHostInstance action. +func (c *UHostClient) NewStartUHostInstanceRequest() *StartUHostInstanceRequest { + req := &StartUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// StartUHostInstance - 启动处于关闭状态的UHost实例,需要指定数据中心及UHostID两个参数的值。 +func (c *UHostClient) StartUHostInstance(req *StartUHostInstanceRequest) (*StartUHostInstanceResponse, error) { + var err error + var res StartUHostInstanceResponse + + err = c.Client.InvokeAction("StartUHostInstance", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/stop_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/stop_uhost_instance.go new file mode 100644 index 000000000..b151e4754 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/stop_uhost_instance.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost StopUHostInstance + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// StopUHostInstanceRequest is request schema for StopUHostInstance action +type StopUHostInstanceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost实例ID 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` +} + +// StopUHostInstanceResponse is response schema for StopUHostInstance action +type StopUHostInstanceResponse struct { + response.CommonBase + + // UHost实例ID + UhostId string +} + +// NewStopUHostInstanceRequest will create request of StopUHostInstance action. +func (c *UHostClient) NewStopUHostInstanceRequest() *StopUHostInstanceRequest { + req := &StopUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// StopUHostInstance - 指停止处于运行状态的UHost实例,需指定数据中心及UhostID。 +func (c *UHostClient) StopUHostInstance(req *StopUHostInstanceRequest) (*StopUHostInstanceResponse, error) { + var err error + var res StopUHostInstanceResponse + + err = c.Client.InvokeAction("StopUHostInstance", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/terminate_custom_image.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/terminate_custom_image.go new file mode 100644 index 000000000..6a4edc500 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/terminate_custom_image.go @@ -0,0 +1,56 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost TerminateCustomImage + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// TerminateCustomImageRequest is request schema for TerminateCustomImage action +type TerminateCustomImageRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 自制镜像ID 参见 [DescribeImage](describe_image.html) + ImageId *string `required:"true"` +} + +// TerminateCustomImageResponse is response schema for TerminateCustomImage action +type TerminateCustomImageResponse struct { + response.CommonBase + + // 自制镜像Id + ImageId string +} + +// NewTerminateCustomImageRequest will create request of TerminateCustomImage action. +func (c *UHostClient) NewTerminateCustomImageRequest() *TerminateCustomImageRequest { + req := &TerminateCustomImageRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// TerminateCustomImage - 删除用户自定义镜像 +func (c *UHostClient) TerminateCustomImage(req *TerminateCustomImageRequest) (*TerminateCustomImageResponse, error) { + var err error + var res TerminateCustomImageResponse + + err = c.Client.InvokeAction("TerminateCustomImage", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/terminate_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/terminate_uhost_instance.go new file mode 100644 index 000000000..49f1f604c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/terminate_uhost_instance.go @@ -0,0 +1,71 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost TerminateUHostInstance + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// TerminateUHostInstanceRequest is request schema for TerminateUHostInstance action +type TerminateUHostInstanceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // UHost资源Id 参见 [DescribeUHostInstance](describe_uhost_instance.html) + UHostId *string `required:"true"` + + // 是否直接删除,0表示按照原来的逻辑(有回收站权限,则进入回收站),1表示直接删除 + Destroy *int `required:"false"` + + // 是否释放绑定的EIP。true: 解绑EIP后,并释放;其他值或不填:解绑EIP。 + ReleaseEIP *bool `required:"false"` + + // 是否删除挂载的数据盘。true删除,其他不删除。 + ReleaseUDisk *bool `required:"false"` +} + +// TerminateUHostInstanceResponse is response schema for TerminateUHostInstance action +type TerminateUHostInstanceResponse struct { + response.CommonBase + + // 放入回收站:"Yes", 彻底删除:“No” + InRecycle string + + // UHost 实例 Id + UHostId string +} + +// NewTerminateUHostInstanceRequest will create request of TerminateUHostInstance action. +func (c *UHostClient) NewTerminateUHostInstanceRequest() *TerminateUHostInstanceRequest { + req := &TerminateUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// TerminateUHostInstance - 删除指定数据中心的UHost实例。 +func (c *UHostClient) TerminateUHostInstance(req *TerminateUHostInstanceRequest) (*TerminateUHostInstanceResponse, error) { + var err error + var res TerminateUHostInstanceResponse + + err = c.Client.InvokeAction("TerminateUHostInstance", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_disk_query.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_disk_query.go new file mode 100644 index 000000000..630b8ddca --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_disk_query.go @@ -0,0 +1,18 @@ +package uhost + +/* +UHostDisk - the request query for disk of uhost +*/ +type UHostDisk struct { + // 磁盘大小,单位GB。请参考[[api:uhost-api:disk_type|磁盘类型]]。 + Size *int `required:"true"` + + // 磁盘类型。枚举值:LOCAL_NORMAL 普通本地盘 | CLOUD_NORMAL 普通云盘 |LOCAL_SSD SSD本地盘 | CLOUD_SSD SSD云盘,默认为LOCAL_NORMAL。请参考[[api:uhost-api:disk_type|磁盘类型]]。 + Type *string `required:"true"` + + // 是否是系统盘。枚举值:\\ > True,是系统盘 \\ > False,是数据盘(默认)。Disks数组中有且只能有一块盘是系统盘。 + IsBoot *string `required:"true"` + + // 磁盘备份方案。枚举值:\\ > NONE,无备份 \\ > DATAARK,数据方舟 \\ 当前磁盘支持的备份模式参考 [[api:uhost-api:disk_type|磁盘类型]] + BackupType *string `required:"false"` +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_disk_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_disk_set.go new file mode 100644 index 000000000..f0420fed2 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_disk_set.go @@ -0,0 +1,34 @@ +package uhost + +/* +UHostDiskSet - DescribeUHostInstance + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UHostDiskSet struct { + + // 磁盘类型。请参考[[api:uhost-api:disk_type|磁盘类型]]。 + DiskType string + + // 是否是系统盘。枚举值:\\ > True,是系统盘 \\ > False,是数据盘(默认)。Disks数组中有且只能有一块盘是系统盘。 + IsBoot string + + // 【建议不再使用】磁盘类型。系统盘: Boot,数据盘: Data,网络盘:Udisk + Type string + + // 磁盘ID + DiskId string + + // UDisk名字(仅当磁盘是UDisk时返回) + Name string + + // 磁盘盘符 + Drive string + + // 磁盘大小,单位: GB + Size int + + // 备份方案。若开通了数据方舟,则为DataArk + BackupType string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_image_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_image_set.go new file mode 100644 index 000000000..043b28e9b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_image_set.go @@ -0,0 +1,58 @@ +package uhost + +/* +UHostImageSet - DescribeImage + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UHostImageSet struct { + + // 可用区,参见 [可用区列表](../summary/regionlist.html) | + Zone string + + // 镜像ID + ImageId string + + // 镜像名称 + ImageName string + + // 操作系统类型:Liunx,Windows + OsType string + + // 操作系统名称 + OsName string + + // 镜像类型 标准镜像:Base, 行业镜像:Business,自定义镜像:Custom + ImageType string + + // 特殊状态标识, 目前包含NetEnhnced(网络增强1.0), NetEnhanced_Ultra](网络增强2.0) + Features []string + + // 行业镜像类型(仅行业镜像将返回这个值) + FuncType string + + // 集成软件名称(仅行业镜像将返回这个值) + IntegratedSoftware string + + // 供应商(仅行业镜像将返回这个值) + Vendor string + + // 介绍链接(仅行业镜像将返回这个值) + Links string + + // 镜像状态, 可用:Available,制作中:Making, 不可用:Unavailable + State string + + // 镜像描述 + ImageDescription string + + // 创建时间,格式为Unix时间戳 + CreateTime int + + // 镜像大小 + ImageSize int + + // 默认值为空'''。当CentOS 7.3/7.4/7.5等镜像会标记为“Broadwell” + MinimalCPU string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_instance_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_instance_set.go new file mode 100644 index 000000000..f93f5c2a0 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_instance_set.go @@ -0,0 +1,115 @@ +package uhost + +/* +UHostInstanceSet - DescribeUHostInstance + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UHostInstanceSet struct { + + // 可用区。参见 [可用区列表](../summary/regionlist.html) + Zone string + + // UHost实例ID + UHostId string + + // 【建议不再使用】云主机机型(旧)。参考[[api:uhost-api:uhost_type|云主机机型说明]]。 + UHostType string + + // 云主机机型(新)。参考[[api:uhost-api:uhost_type|云主机机型说明]]。 + MachineType string + + // 【建议不再使用】主机磁盘类型。 枚举值为:\\ > LocalDisk,本地磁盘; \\ > UDisk 云盘。\\只要有一块磁盘为本地盘,即返回LocalDisk。 + StorageType string + + // 【建议不再使用】主机的系统盘ID。 + ImageId string + + // 基础镜像ID(指当前自定义镜像的来源镜像) + BasicImageId string + + // 基础镜像名称(指当前自定义镜像的来源镜像) + BasicImageName string + + // 业务组名称 + Tag string + + // 备注 + Remark string + + // UHost实例名称 + Name string + + // 实例状态,枚举值:\\ >初始化: Initializing; \\ >启动中: Starting; \\> 运行中: Running; \\> 关机中: Stopping; \\ >关机: Stopped \\ >安装失败: Install Fail; \\ >重启中: Rebooting + State string + + // 创建时间,格式为Unix时间戳 + CreateTime int + + // 计费模式,枚举值为: Year,按年付费; Month,按月付费; Dynamic,按需付费(需开启权限); + ChargeType string + + // 到期时间,格式为Unix时间戳 + ExpireTime int + + // 虚拟CPU核数,单位: 个 + CPU int + + // 内存大小,单位: MB + Memory int + + // 是否自动续费,自动续费:“Yes”,不自动续费:“No” + AutoRenew string + + // 磁盘信息见 UHostDiskSet + DiskSet []UHostDiskSet + + // 详细信息见 UHostIPSet + IPSet []UHostIPSet + + // 网络增强。Normal: 无;Super: 网络增强1.0; Ultra: 网络增强2.0 + NetCapability string + + // 【建议不再使用】网络状态。 连接:Connected, 断开:NotConnected + NetworkState string + + // 【建议不再使用】数据方舟模式。枚举值:\\ > Yes: 开启方舟; \\ > no,未开启方舟 + TimemachineFeature string + + // true: 开启热升级; false,未开启热升级 + HotplugFeature bool + + // 【建议不再使用】仅北京A的云主机会返回此字段。基础网络模式:Default;子网模式:Private + SubnetType string + + // 内网的IP地址 + IPs []string + + // 创建主机的最初来源镜像的操作系统名称(若直接通过基础镜像创建,此处返回和BasicImageName一致) + OsName string + + // 操作系统类别。返回"Linux"或者"Windows" + OsType string + + // 删除时间,格式为Unix时间戳 + DeleteTime int + + // 主机系列:N2,表示系列2;N1,表示系列1 + HostType string + + // 主机的生命周期类型。目前仅支持Normal:普通; + LifeCycle string + + // GPU个数 + GPU int + + // 系统盘状态 Normal表示初始化完成;Initializing表示在初始化。仍在初始化的系统盘无法制作镜像。 + BootDiskState string + + // 总的数据盘存储空间。 + TotalDiskSpace int + + // 隔离组id,不在隔离组则返回"" + IsolationGroup string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_ipset.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_ipset.go new file mode 100644 index 000000000..eeffd3cd9 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_ipset.go @@ -0,0 +1,37 @@ +package uhost + +/* +UHostIPSet - DescribeUHostInstance + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UHostIPSet struct { + + // 【暂未支持】是否为默认网卡。True: 是默认网卡;其他值:不是。 + Default string + + // 当前网卡的Mac。 + Mac string + + // 当前EIP的权重。权重最大的为当前的出口IP。 + Weight int + + // 国际: Internation,BGP: Bgp,内网: Private + Type string + + // 外网IP资源ID 。(内网IP无对应的资源ID) + IPId string + + // IP地址 + IP string + + // IP对应的带宽, 单位: Mb (内网IP不显示带宽信息) + Bandwidth int + + // IP地址对应的VPC ID。(北京一不支持,字段返回为空) + VPCId string + + // IP地址对应的子网 ID。(北京一不支持,字段返回为空) + SubnetId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_price_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_price_set.go new file mode 100644 index 000000000..6ca352c14 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_price_set.go @@ -0,0 +1,16 @@ +package uhost + +/* +UHostPriceSet - 主机价格 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UHostPriceSet struct { + + // 计费类型。Year,Month,Dynamic + ChargeType string + + // 价格,单位: 元,保留小数点后两位有效数字 + Price float64 +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_tag_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_tag_set.go new file mode 100644 index 000000000..58ae88748 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/types_uhost_tag_set.go @@ -0,0 +1,19 @@ +package uhost + +/* +UHostTagSet - DescribeUHostTags + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UHostTagSet struct { + + // 业务组名称 + Tag string + + // 该业务组中包含的主机个数 + TotalCount int + + // 可用区 + Zone string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/upgrade_to_ark_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/upgrade_to_ark_uhost_instance.go new file mode 100644 index 000000000..9d7e61b22 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/upgrade_to_ark_uhost_instance.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UHost UpgradeToArkUHostInstance + +package uhost + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpgradeToArkUHostInstanceRequest is request schema for UpgradeToArkUHostInstance action +type UpgradeToArkUHostInstanceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"true"` + + // UHost主机的资源ID,例如UHostIds.0代表希望升级的主机1,UHostIds.1代表主机2。 + UHostIds []string `required:"true"` + + // 代金券ID 请参考DescribeCoupon接口 + CouponId *string `required:"false"` +} + +// UpgradeToArkUHostInstanceResponse is response schema for UpgradeToArkUHostInstance action +type UpgradeToArkUHostInstanceResponse struct { + response.CommonBase + + // UHost主机的资源ID数组 + UHostSet []string +} + +// NewUpgradeToArkUHostInstanceRequest will create request of UpgradeToArkUHostInstance action. +func (c *UHostClient) NewUpgradeToArkUHostInstanceRequest() *UpgradeToArkUHostInstanceRequest { + req := &UpgradeToArkUHostInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpgradeToArkUHostInstance - 普通升级为方舟机型 +func (c *UHostClient) UpgradeToArkUHostInstance(req *UpgradeToArkUHostInstanceRequest) (*UpgradeToArkUHostInstanceResponse, error) { + var err error + var res UpgradeToArkUHostInstanceResponse + + err = c.Client.InvokeAction("UpgradeToArkUHostInstance", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/wait_until_uhost_instance_state.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/wait_until_uhost_instance_state.go new file mode 100644 index 000000000..81c273e65 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/wait_until_uhost_instance_state.go @@ -0,0 +1,71 @@ +package uhost + +import ( + "time" + + "github.com/ucloud/ucloud-sdk-go/private/utils" + "github.com/ucloud/ucloud-sdk-go/ucloud" + uerr "github.com/ucloud/ucloud-sdk-go/ucloud/error" + "github.com/ucloud/ucloud-sdk-go/ucloud/log" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" +) + +// WaitUntilUHostInstanceStateRequest is the request of uhost instance state waiter +type WaitUntilUHostInstanceStateRequest struct { + request.CommonBase + + Interval *time.Duration + MaxAttempts *int + DescribeRequest *DescribeUHostInstanceRequest + State State + IgnoreError *bool +} + +// NewWaitUntilUHostInstanceStateRequest will create request of WaitUntilUHostInstanceState action. +func (c *UHostClient) NewWaitUntilUHostInstanceStateRequest() *WaitUntilUHostInstanceStateRequest { + cfg := c.Client.GetConfig() + + return &WaitUntilUHostInstanceStateRequest{ + CommonBase: request.CommonBase{ + Region: ucloud.String(cfg.Region), + ProjectId: ucloud.String(cfg.ProjectId), + }, + } +} + +// WaitUntilUHostInstanceState will pending current goroutine until the state has changed to expected state. +func (c *UHostClient) WaitUntilUHostInstanceState(req *WaitUntilUHostInstanceStateRequest) error { + waiter := utils.FuncWaiter{ + Interval: ucloud.TimeDurationValue(req.Interval), + MaxAttempts: ucloud.IntValue(req.MaxAttempts), + IgnoreError: ucloud.BoolValue(req.IgnoreError), + Checker: func() (bool, error) { + resp, err := c.DescribeUHostInstance(req.DescribeRequest) + + if err != nil { + skipErrors := []string{uerr.ErrNetwork, uerr.ErrHTTPStatus, uerr.ErrRetCode} + if uErr, ok := err.(uerr.Error); ok && utils.IsStringIn(uErr.Name(), skipErrors) { + log.Infof("skip error for wait resource state, %s", uErr) + return false, nil + } + log.Infof("wait for resource state is ready, %s", err) + return false, err + } + + // TODO: Ensure if it is any data consistency problem? + // Such as creating a new uhost, but cannot describe it's correct state immediately ... + for _, uhost := range resp.UHostSet { + if val, _ := req.State.MarshalValue(); uhost.State != val { + return false, nil + } + } + + if len(resp.UHostSet) > 0 { + return true, nil + } + + return false, nil + }, + } + return waiter.WaitForCompletion() +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/allocate_eip.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/allocate_eip.go new file mode 100644 index 000000000..661de6494 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/allocate_eip.go @@ -0,0 +1,83 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet AllocateEIP + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// AllocateEIPRequest is request schema for AllocateEIP action +type AllocateEIPRequest struct { + request.CommonBase + + // [公共参数] 地域。 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 + // ProjectId *string `required:"false"` + + // 弹性IP的线路如下: 国际: International BGP: Bgp 各地域允许的线路参数如下: cn-sh1: Bgp cn-sh2: Bgp cn-gd: Bgp cn-bj1: Bgp cn-bj2: Bgp hk: International us-ca: International th-bkk: International kr-seoul:International us-ws:International ge-fra:International sg:International tw-kh:International.其他海外线路均为 International + OperatorName *string `required:"true"` + + // 弹性IP的外网带宽, 单位为Mbps. 共享带宽模式必须指定0M带宽, 非共享带宽模式必须指定非0Mbps带宽. 各地域非共享带宽的带宽范围如下: 流量计费[1-200],带宽计费[1-800] + Bandwidth *int `required:"true"` + + // 业务组名称, 默认为 "Default" + Tag *string `required:"false"` + + // 付费方式, 枚举值为: Year, 按年付费; Month, 按月付费; Dynamic, 按需付费(需开启权限); Trial, 试用(需开启权限) 默认为按月付费 + ChargeType *string `required:"false"` + + // 购买时长, 默认: 1 + Quantity *int `required:"false"` + + // 弹性IP的计费模式. 枚举值: "Traffic", 流量计费; "Bandwidth", 带宽计费; "ShareBandwidth",共享带宽模式. 默认为 "Bandwidth". + PayMode *string `required:"false"` + + // 绑定的共享带宽Id,仅当PayMode为ShareBandwidth时有效 + ShareBandwidthId *string `required:"false"` + + // 弹性IP的名称, 默认为 "EIP" + Name *string `required:"false"` + + // 弹性IP的备注, 默认为空 + Remark *string `required:"false"` + + // 代金券ID, 默认不使用 + CouponId *string `required:"false"` +} + +// AllocateEIPResponse is response schema for AllocateEIP action +type AllocateEIPResponse struct { + response.CommonBase + + // 申请到的EIP资源详情 参见 UnetAllocateEIPSet + EIPSet []UnetAllocateEIPSet +} + +// NewAllocateEIPRequest will create request of AllocateEIP action. +func (c *UNetClient) NewAllocateEIPRequest() *AllocateEIPRequest { + req := &AllocateEIPRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// AllocateEIP - 根据提供信息, 申请弹性IP +func (c *UNetClient) AllocateEIP(req *AllocateEIPRequest) (*AllocateEIPResponse, error) { + var err error + var res AllocateEIPResponse + + err = c.Client.InvokeAction("AllocateEIP", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/allocate_share_bandwidth.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/allocate_share_bandwidth.go new file mode 100644 index 000000000..f79a18821 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/allocate_share_bandwidth.go @@ -0,0 +1,68 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet AllocateShareBandwidth + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// AllocateShareBandwidthRequest is request schema for AllocateShareBandwidth action +type AllocateShareBandwidthRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 + // ProjectId *string `required:"false"` + + // 共享带宽名字 + Name *string `required:"true"` + + // 付费方式:Year 按年,Month 按月,Dynamic 按时; + ChargeType *string `required:"true"` + + // 共享带宽值 + ShareBandwidth *int `required:"true"` + + // 购买时长 + Quantity *int `required:"false"` + + // 共享带宽保底值(后付费) + ShareBandwidthGuarantee *int `required:"false"` +} + +// AllocateShareBandwidthResponse is response schema for AllocateShareBandwidth action +type AllocateShareBandwidthResponse struct { + response.CommonBase + + // 共享带宽资源Id + ShareBandwidthId string +} + +// NewAllocateShareBandwidthRequest will create request of AllocateShareBandwidth action. +func (c *UNetClient) NewAllocateShareBandwidthRequest() *AllocateShareBandwidthRequest { + req := &AllocateShareBandwidthRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// AllocateShareBandwidth - 开通共享带宽 +func (c *UNetClient) AllocateShareBandwidth(req *AllocateShareBandwidthRequest) (*AllocateShareBandwidthResponse, error) { + var err error + var res AllocateShareBandwidthResponse + + err = c.Client.InvokeAction("AllocateShareBandwidth", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/allocate_vip.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/allocate_vip.go new file mode 100644 index 000000000..eab3b18bc --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/allocate_vip.go @@ -0,0 +1,80 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet AllocateVIP + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// AllocateVIPRequest is request schema for AllocateVIP action +type AllocateVIPRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 可用区 + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 指定vip所属的VPC + VPCId *string `required:"true"` + + // 子网id + SubnetId *string `required:"true"` + + // 申请数量,默认: 1 + Count *int `required:"false"` + + // vip名,默认为VIP + Name *string `required:"false"` + + // 业务组名称,默认为Default + Tag *string `required:"false"` + + // 备注 + Remark *string `required:"false"` + + // 业务组 + BusinessId *string `required:"false"` +} + +// AllocateVIPResponse is response schema for AllocateVIP action +type AllocateVIPResponse struct { + response.CommonBase + + // 申请到的VIP资源相关信息 + VIPSet []VIPSet + + // 申请到的VIP地址 + DataSet []string +} + +// NewAllocateVIPRequest will create request of AllocateVIP action. +func (c *UNetClient) NewAllocateVIPRequest() *AllocateVIPRequest { + req := &AllocateVIPRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// AllocateVIP - 根据提供信息,申请内网VIP(Virtual IP),多用于高可用程序作为漂移IP。 +func (c *UNetClient) AllocateVIP(req *AllocateVIPRequest) (*AllocateVIPResponse, error) { + var err error + var res AllocateVIPResponse + + err = c.Client.InvokeAction("AllocateVIP", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/associate_eipwith_share_bandwidth.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/associate_eipwith_share_bandwidth.go new file mode 100644 index 000000000..c92449f1a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/associate_eipwith_share_bandwidth.go @@ -0,0 +1,56 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet AssociateEIPWithShareBandwidth + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// AssociateEIPWithShareBandwidthRequest is request schema for AssociateEIPWithShareBandwidth action +type AssociateEIPWithShareBandwidthRequest struct { + request.CommonBase + + // [公共参数] 地域。 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 + // ProjectId *string `required:"false"` + + // 要加入共享带宽的EIP的资源Id + EIPIds []string `required:"true"` + + // 共享带宽ID + ShareBandwidthId *string `required:"true"` +} + +// AssociateEIPWithShareBandwidthResponse is response schema for AssociateEIPWithShareBandwidth action +type AssociateEIPWithShareBandwidthResponse struct { + response.CommonBase +} + +// NewAssociateEIPWithShareBandwidthRequest will create request of AssociateEIPWithShareBandwidth action. +func (c *UNetClient) NewAssociateEIPWithShareBandwidthRequest() *AssociateEIPWithShareBandwidthRequest { + req := &AssociateEIPWithShareBandwidthRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// AssociateEIPWithShareBandwidth - 将EIP加入共享带宽 +func (c *UNetClient) AssociateEIPWithShareBandwidth(req *AssociateEIPWithShareBandwidthRequest) (*AssociateEIPWithShareBandwidthResponse, error) { + var err error + var res AssociateEIPWithShareBandwidthResponse + + err = c.Client.InvokeAction("AssociateEIPWithShareBandwidth", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/bind_eip.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/bind_eip.go new file mode 100644 index 000000000..b4a7f66a5 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/bind_eip.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet BindEIP + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// BindEIPRequest is request schema for BindEIP action +type BindEIPRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写 + // ProjectId *string `required:"false"` + + // 弹性IP的资源Id + EIPId *string `required:"true"` + + // 弹性IP请求绑定的资源类型, 枚举值为: uhost: 云主机; ulb, 负载均衡器 upm: 物理机; hadoophost: 大数据集群;fortresshost:堡垒机;udockhost:容器;udhost:私有专区主机;natgw:natgw;udb:udb;vpngw:ipsec vpn;ucdr:云灾备;dbaudit:数据库审计; + ResourceType *string `required:"true"` + + // 弹性IP请求绑定的资源ID + ResourceId *string `required:"true"` +} + +// BindEIPResponse is response schema for BindEIP action +type BindEIPResponse struct { + response.CommonBase +} + +// NewBindEIPRequest will create request of BindEIP action. +func (c *UNetClient) NewBindEIPRequest() *BindEIPRequest { + req := &BindEIPRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// BindEIP - 将尚未使用的弹性IP绑定到指定的资源 +func (c *UNetClient) BindEIP(req *BindEIPRequest) (*BindEIPResponse, error) { + var err error + var res BindEIPResponse + + err = c.Client.InvokeAction("BindEIP", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/client.go new file mode 100644 index 000000000..745ad23ee --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/client.go @@ -0,0 +1,19 @@ +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" +) + +// UNetClient is the client of UNet +type UNetClient struct { + *ucloud.Client +} + +// NewClient will return a instance of UNetClient +func NewClient(config *ucloud.Config, credential *auth.Credential) *UNetClient { + client := ucloud.NewClient(config, credential) + return &UNetClient{ + client, + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/create_bandwidth_package.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/create_bandwidth_package.go new file mode 100644 index 000000000..8c3d824bc --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/create_bandwidth_package.go @@ -0,0 +1,68 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet CreateBandwidthPackage + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateBandwidthPackageRequest is request schema for CreateBandwidthPackage action +type CreateBandwidthPackageRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 + // ProjectId *string `required:"false"` + + // 带宽大小(单位Mbps), 取值范围[2,800] (最大值受地域限制) + Bandwidth *int `required:"true"` + + // 所绑定弹性IP的资源ID + EIPId *string `required:"true"` + + // 带宽包有效时长, 取值范围为大于0的整数, 即该带宽包在EnableTime到 EnableTime+TimeRange时间段内生效 + TimeRange *int `required:"true"` + + // 生效时间, 格式为 Unix timestamp, 默认为立即开通 + EnableTime *int `required:"false"` + + // 代金券ID + CouponId *string `required:"false"` +} + +// CreateBandwidthPackageResponse is response schema for CreateBandwidthPackage action +type CreateBandwidthPackageResponse struct { + response.CommonBase + + // 所创建带宽包的资源ID + BandwidthPackageId string +} + +// NewCreateBandwidthPackageRequest will create request of CreateBandwidthPackage action. +func (c *UNetClient) NewCreateBandwidthPackageRequest() *CreateBandwidthPackageRequest { + req := &CreateBandwidthPackageRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateBandwidthPackage - 为非共享带宽模式下, 已绑定资源实例的带宽计费弹性IP附加临时带宽包 +func (c *UNetClient) CreateBandwidthPackage(req *CreateBandwidthPackageRequest) (*CreateBandwidthPackageResponse, error) { + var err error + var res CreateBandwidthPackageResponse + + err = c.Client.InvokeAction("CreateBandwidthPackage", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/create_firewall.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/create_firewall.go new file mode 100644 index 000000000..bc54a66c9 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/create_firewall.go @@ -0,0 +1,65 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet CreateFirewall + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateFirewallRequest is request schema for CreateFirewall action +type CreateFirewallRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写 + // ProjectId *string `required:"false"` + + // 防火墙规则,例如:TCP|22|192.168.1.1/22|DROP|LOW|禁用22端口,第一个参数代表协议:第二个参数代表端口号,第三个参数为ip,第四个参数为ACCEPT(接受)和DROP(拒绝),第五个参数优先级:HIGH(高),MEDIUM(中),LOW(低),第六个参数为该条规则的自定义备注 + Rule []string `required:"true"` + + // 防火墙名称 + Name *string `required:"true"` + + // 防火墙业务组,默认为Default + Tag *string `required:"false"` + + // 防火墙描述,默认为空 + Remark *string `required:"false"` +} + +// CreateFirewallResponse is response schema for CreateFirewall action +type CreateFirewallResponse struct { + response.CommonBase + + // 防火墙ID + FWId string +} + +// NewCreateFirewallRequest will create request of CreateFirewall action. +func (c *UNetClient) NewCreateFirewallRequest() *CreateFirewallRequest { + req := &CreateFirewallRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateFirewall - 创建防火墙 +func (c *UNetClient) CreateFirewall(req *CreateFirewallRequest) (*CreateFirewallResponse, error) { + var err error + var res CreateFirewallResponse + + err = c.Client.InvokeAction("CreateFirewall", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/delete_bandwidth_package.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/delete_bandwidth_package.go new file mode 100644 index 000000000..b4c79497f --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/delete_bandwidth_package.go @@ -0,0 +1,53 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DeleteBandwidthPackage + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteBandwidthPackageRequest is request schema for DeleteBandwidthPackage action +type DeleteBandwidthPackageRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写 + // ProjectId *string `required:"false"` + + // 带宽包资源ID + BandwidthPackageId *string `required:"true"` +} + +// DeleteBandwidthPackageResponse is response schema for DeleteBandwidthPackage action +type DeleteBandwidthPackageResponse struct { + response.CommonBase +} + +// NewDeleteBandwidthPackageRequest will create request of DeleteBandwidthPackage action. +func (c *UNetClient) NewDeleteBandwidthPackageRequest() *DeleteBandwidthPackageRequest { + req := &DeleteBandwidthPackageRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteBandwidthPackage - 删除弹性IP上已附加带宽包 +func (c *UNetClient) DeleteBandwidthPackage(req *DeleteBandwidthPackageRequest) (*DeleteBandwidthPackageResponse, error) { + var err error + var res DeleteBandwidthPackageResponse + + err = c.Client.InvokeAction("DeleteBandwidthPackage", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/delete_firewall.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/delete_firewall.go new file mode 100644 index 000000000..6048c22ae --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/delete_firewall.go @@ -0,0 +1,53 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DeleteFirewall + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteFirewallRequest is request schema for DeleteFirewall action +type DeleteFirewallRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写 + // ProjectId *string `required:"false"` + + // 防火墙资源ID + FWId *string `required:"true"` +} + +// DeleteFirewallResponse is response schema for DeleteFirewall action +type DeleteFirewallResponse struct { + response.CommonBase +} + +// NewDeleteFirewallRequest will create request of DeleteFirewall action. +func (c *UNetClient) NewDeleteFirewallRequest() *DeleteFirewallRequest { + req := &DeleteFirewallRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteFirewall - 删除防火墙 +func (c *UNetClient) DeleteFirewall(req *DeleteFirewallRequest) (*DeleteFirewallResponse, error) { + var err error + var res DeleteFirewallResponse + + err = c.Client.InvokeAction("DeleteFirewall", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_bandwidth_package.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_bandwidth_package.go new file mode 100644 index 000000000..59d37825b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_bandwidth_package.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DescribeBandwidthPackage + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeBandwidthPackageRequest is request schema for DescribeBandwidthPackage action +type DescribeBandwidthPackageRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 返回数据分页值, 取值范围为 [0,10000000] 之间的整数, 默认为20 + Limit *int `required:"false"` + + // 返回数据偏移量, 默认为0 + Offset *int `required:"false"` +} + +// DescribeBandwidthPackageResponse is response schema for DescribeBandwidthPackage action +type DescribeBandwidthPackageResponse struct { + response.CommonBase + + // 满足条件的带宽包总数 + TotalCount int + + // 带宽包详细信息, 参见 UnetBandwidthPackageSet + DataSets []UnetBandwidthPackageSet +} + +// NewDescribeBandwidthPackageRequest will create request of DescribeBandwidthPackage action. +func (c *UNetClient) NewDescribeBandwidthPackageRequest() *DescribeBandwidthPackageRequest { + req := &DescribeBandwidthPackageRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeBandwidthPackage - 获取某地域下的带宽包信息 +func (c *UNetClient) DescribeBandwidthPackage(req *DescribeBandwidthPackageRequest) (*DescribeBandwidthPackageResponse, error) { + var err error + var res DescribeBandwidthPackageResponse + + err = c.Client.InvokeAction("DescribeBandwidthPackage", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_bandwidth_usage.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_bandwidth_usage.go new file mode 100644 index 000000000..b360bdeba --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_bandwidth_usage.go @@ -0,0 +1,65 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DescribeBandwidthUsage + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeBandwidthUsageRequest is request schema for DescribeBandwidthUsage action +type DescribeBandwidthUsageRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 返回数据分页值, 取值范围为 [0,10000000] 之间的整数, 默认为20 + Limit *int `required:"false"` + + // 返回数据偏移量, 默认为0 + OffSet *int `required:"false"` + + // 弹性IP的资源Id. 如果为空, 则返回当前 Region中符合条件的所有EIP的带宽用量, n为自然数 + EIPIds []string `required:"false"` +} + +// DescribeBandwidthUsageResponse is response schema for DescribeBandwidthUsage action +type DescribeBandwidthUsageResponse struct { + response.CommonBase + + // EIPSet中的元素个数 + TotalCount int + + // 单个弹性IP的带宽用量详细信息, 详见 UnetBandwidthUsageEIPSet, 如没有弹性IP资源则没有该返回值。 + EIPSet []UnetBandwidthUsageEIPSet +} + +// NewDescribeBandwidthUsageRequest will create request of DescribeBandwidthUsage action. +func (c *UNetClient) NewDescribeBandwidthUsageRequest() *DescribeBandwidthUsageRequest { + req := &DescribeBandwidthUsageRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeBandwidthUsage - 获取带宽用量信息 +func (c *UNetClient) DescribeBandwidthUsage(req *DescribeBandwidthUsageRequest) (*DescribeBandwidthUsageResponse, error) { + var err error + var res DescribeBandwidthUsageResponse + + err = c.Client.InvokeAction("DescribeBandwidthUsage", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_eip.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_eip.go new file mode 100644 index 000000000..33ca47a9e --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_eip.go @@ -0,0 +1,68 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DescribeEIP + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeEIPRequest is request schema for DescribeEIP action +type DescribeEIPRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写 + // ProjectId *string `required:"false"` + + // 弹性IP的资源ID如果为空, 则返回当前 Region中符合条件的的所有EIP + EIPIds []string `required:"false"` + + // 数据偏移量, 默认为0 + Offset *int `required:"false"` + + // 数据分页值, 默认为20 + Limit *int `required:"false"` +} + +// DescribeEIPResponse is response schema for DescribeEIP action +type DescribeEIPResponse struct { + response.CommonBase + + // 满足条件的弹性IP总数 + TotalCount int + + // 满足条件的弹性IP带宽总和, 单位Mbps + TotalBandwidth int + + // 弹性IP列表, 每项参数详见 UnetEIPSet + EIPSet []UnetEIPSet +} + +// NewDescribeEIPRequest will create request of DescribeEIP action. +func (c *UNetClient) NewDescribeEIPRequest() *DescribeEIPRequest { + req := &DescribeEIPRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeEIP - 获取弹性IP信息 +func (c *UNetClient) DescribeEIP(req *DescribeEIPRequest) (*DescribeEIPResponse, error) { + var err error + var res DescribeEIPResponse + + err = c.Client.InvokeAction("DescribeEIP", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_firewall.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_firewall.go new file mode 100644 index 000000000..1cfe05f4d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_firewall.go @@ -0,0 +1,71 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DescribeFirewall + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeFirewallRequest is request schema for DescribeFirewall action +type DescribeFirewallRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写 + // ProjectId *string `required:"false"` + + // 防火墙ID,默认为返回所有防火墙 + FWId *string `required:"false"` + + // 绑定防火墙组的资源类型,默认为全部资源类型。枚举值为:"unatgw",NAT网关; "uhost",云主机; "upm",物理云主机; "hadoophost",hadoop节点; "fortresshost",堡垒机; "udhost",私有专区主机;"udockhost",容器;"dbaudit",数据库审计. + ResourceType *string `required:"false"` + + // 绑定防火墙组的资源ID + ResourceId *string `required:"false"` + + // 返回数据长度,默认为20,最大10000000 + Limit *int `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` +} + +// DescribeFirewallResponse is response schema for DescribeFirewall action +type DescribeFirewallResponse struct { + response.CommonBase + + // 获取的防火墙组详细信息 参见 FirewallDataSet + DataSet []FirewallDataSet + + // 数量 + TotalCount int +} + +// NewDescribeFirewallRequest will create request of DescribeFirewall action. +func (c *UNetClient) NewDescribeFirewallRequest() *DescribeFirewallRequest { + req := &DescribeFirewallRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeFirewall - 获取防火墙组信息 +func (c *UNetClient) DescribeFirewall(req *DescribeFirewallRequest) (*DescribeFirewallResponse, error) { + var err error + var res DescribeFirewallResponse + + err = c.Client.InvokeAction("DescribeFirewall", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_firewall_resource.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_firewall_resource.go new file mode 100644 index 000000000..52e9f1a4d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_firewall_resource.go @@ -0,0 +1,65 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DescribeFirewallResource + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeFirewallResourceRequest is request schema for DescribeFirewallResource action +type DescribeFirewallResourceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 防火墙ID + FWId *string `required:"true"` + + // 返回数据长度,默认为20,最大10000000 + Limit *string `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *string `required:"false"` +} + +// DescribeFirewallResourceResponse is response schema for DescribeFirewallResource action +type DescribeFirewallResourceResponse struct { + response.CommonBase + + // 资源列表,见 ResourceSet + ResourceSet []ResourceSet + + // 绑定资源总数 + TotalCount int +} + +// NewDescribeFirewallResourceRequest will create request of DescribeFirewallResource action. +func (c *UNetClient) NewDescribeFirewallResourceRequest() *DescribeFirewallResourceRequest { + req := &DescribeFirewallResourceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeFirewallResource - 获取防火墙组所绑定资源的外网IP +func (c *UNetClient) DescribeFirewallResource(req *DescribeFirewallResourceRequest) (*DescribeFirewallResourceResponse, error) { + var err error + var res DescribeFirewallResourceResponse + + err = c.Client.InvokeAction("DescribeFirewallResource", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_share_bandwidth.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_share_bandwidth.go new file mode 100644 index 000000000..e1164349b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_share_bandwidth.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DescribeShareBandwidth + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeShareBandwidthRequest is request schema for DescribeShareBandwidth action +type DescribeShareBandwidthRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 需要返回的共享带宽Id + ShareBandwidthIds []string `required:"false"` +} + +// DescribeShareBandwidthResponse is response schema for DescribeShareBandwidth action +type DescribeShareBandwidthResponse struct { + response.CommonBase + + // 共享带宽信息组 参见 UnetShareBandwidthSet + DataSet []UnetShareBandwidthSet + + // 符合条件的共享带宽总数,大于等于返回DataSet长度 + TotalCount int +} + +// NewDescribeShareBandwidthRequest will create request of DescribeShareBandwidth action. +func (c *UNetClient) NewDescribeShareBandwidthRequest() *DescribeShareBandwidthRequest { + req := &DescribeShareBandwidthRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeShareBandwidth - 获取共享带宽信息 +func (c *UNetClient) DescribeShareBandwidth(req *DescribeShareBandwidthRequest) (*DescribeShareBandwidthResponse, error) { + var err error + var res DescribeShareBandwidthResponse + + err = c.Client.InvokeAction("DescribeShareBandwidth", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_vip.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_vip.go new file mode 100644 index 000000000..fd8c972f0 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_vip.go @@ -0,0 +1,74 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DescribeVIP + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeVIPRequest is request schema for DescribeVIP action +type DescribeVIPRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // vpc的id,指定SubnetId时必填 + VPCId *string `required:"false"` + + // 子网id,不指定则获取VPCId下的所有vip + SubnetId *string `required:"false"` + + // 业务组名称, 默认为 Default + Tag *string `required:"false"` + + // 业务组 + BusinessId *string `required:"false"` +} + +// DescribeVIPResponse is response schema for DescribeVIP action +type DescribeVIPResponse struct { + response.CommonBase + + // 内网VIP详情,请见VIPDetailSet + VIPSet []VIPDetailSet + + // 内网VIP地址列表 + DataSet []string + + // vip数量 + TotalCount int +} + +// NewDescribeVIPRequest will create request of DescribeVIP action. +func (c *UNetClient) NewDescribeVIPRequest() *DescribeVIPRequest { + req := &DescribeVIPRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeVIP - 获取内网VIP详细信息 +func (c *UNetClient) DescribeVIP(req *DescribeVIPRequest) (*DescribeVIPResponse, error) { + var err error + var res DescribeVIPResponse + + err = c.Client.InvokeAction("DescribeVIP", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/disassociate_eipwith_share_bandwidth.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/disassociate_eipwith_share_bandwidth.go new file mode 100644 index 000000000..3c92b6e6d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/disassociate_eipwith_share_bandwidth.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet DisassociateEIPWithShareBandwidth + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DisassociateEIPWithShareBandwidthRequest is request schema for DisassociateEIPWithShareBandwidth action +type DisassociateEIPWithShareBandwidthRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 共享带宽ID + ShareBandwidthId *string `required:"true"` + + // 移出共享带宽后,EIP的外网带宽, 单位为Mbps. 各地域带宽范围如下: 流量计费[1-200],带宽计费[1-800] + Bandwidth *int `required:"true"` + + // EIP的资源Id;默认移出该共享带宽下所有的EIP + EIPIds []string `required:"false"` + + // 移出共享带宽后,EIP的计费模式. 枚举值: "Traffic", 流量计费; "Bandwidth", 带宽计费; 默认为 "Bandwidth". + PayMode *string `required:"false"` +} + +// DisassociateEIPWithShareBandwidthResponse is response schema for DisassociateEIPWithShareBandwidth action +type DisassociateEIPWithShareBandwidthResponse struct { + response.CommonBase +} + +// NewDisassociateEIPWithShareBandwidthRequest will create request of DisassociateEIPWithShareBandwidth action. +func (c *UNetClient) NewDisassociateEIPWithShareBandwidthRequest() *DisassociateEIPWithShareBandwidthRequest { + req := &DisassociateEIPWithShareBandwidthRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DisassociateEIPWithShareBandwidth - 将EIP移出共享带宽 +func (c *UNetClient) DisassociateEIPWithShareBandwidth(req *DisassociateEIPWithShareBandwidthRequest) (*DisassociateEIPWithShareBandwidthResponse, error) { + var err error + var res DisassociateEIPWithShareBandwidthResponse + + err = c.Client.InvokeAction("DisassociateEIPWithShareBandwidth", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/doc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/doc.go new file mode 100644 index 000000000..ed751644e --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/doc.go @@ -0,0 +1,11 @@ +/* +Package unet include resources of ucloud unet product + +See also + + - API: https://docs.ucloud.cn/api/unet-api/index + - Product: https://www.ucloud.cn/site/product/unet.html + +for detail. +*/ +package unet diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/get_eippay_mode.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/get_eippay_mode.go new file mode 100644 index 000000000..0881a0d4b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/get_eippay_mode.go @@ -0,0 +1,56 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet GetEIPPayMode + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetEIPPayModeRequest is request schema for GetEIPPayMode action +type GetEIPPayModeRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写 + // ProjectId *string `required:"false"` + + // 弹性IP的资源Id + EIPId []string `required:"true"` +} + +// GetEIPPayModeResponse is response schema for GetEIPPayMode action +type GetEIPPayModeResponse struct { + response.CommonBase + + // EIP的计费模式, 参见 EIPPayModeSet + EIPPayMode []EIPPayModeSet +} + +// NewGetEIPPayModeRequest will create request of GetEIPPayMode action. +func (c *UNetClient) NewGetEIPPayModeRequest() *GetEIPPayModeRequest { + req := &GetEIPPayModeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetEIPPayMode - 获取弹性IP计费模式 +func (c *UNetClient) GetEIPPayMode(req *GetEIPPayModeRequest) (*GetEIPPayModeResponse, error) { + var err error + var res GetEIPPayModeResponse + + err = c.Client.InvokeAction("GetEIPPayMode", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/get_eipprice.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/get_eipprice.go new file mode 100644 index 000000000..7c4c5aeac --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/get_eipprice.go @@ -0,0 +1,65 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet GetEIPPrice + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetEIPPriceRequest is request schema for GetEIPPrice action +type GetEIPPriceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 弹性IP的线路如下: 国际: International BGP: Bgp 各地域允许的线路参数如下: cn-sh1: Bgp cn-sh2: Bgp cn-gd: Bgp cn-bj1: Bgp cn-bj2: Bgp hk: International us-ca: International th-bkk: International kr-seoul:International us-ws:International ge-fra:International sg:International tw-kh:International.其他海外线路均为 International + OperatorName *string `required:"true"` + + // 弹性IP的外网带宽, 单位为Mbps, 范围 [0-800] + Bandwidth *int `required:"true"` + + // 付费方式, 枚举值为: Year, 按年付费; Month, 按月付费; Dynamic, 按需付费(需开启权限); 默认为获取三种价格 + ChargeType *string `required:"false"` + + // 弹性IP计费方式r. 枚举值为: Traffic, 流量计费; Bandwidth, 带宽计费; "ShareBandwidth",共享带宽模式. 默认为Bandwidth + PayMode *string `required:"false"` +} + +// GetEIPPriceResponse is response schema for GetEIPPrice action +type GetEIPPriceResponse struct { + response.CommonBase + + // 弹性IP价格详情 详情见 EIPPriceDetailSet + PriceSet []EIPPriceDetailSet +} + +// NewGetEIPPriceRequest will create request of GetEIPPrice action. +func (c *UNetClient) NewGetEIPPriceRequest() *GetEIPPriceRequest { + req := &GetEIPPriceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetEIPPrice - 获取弹性IP价格 +func (c *UNetClient) GetEIPPrice(req *GetEIPPriceRequest) (*GetEIPPriceResponse, error) { + var err error + var res GetEIPPriceResponse + + err = c.Client.InvokeAction("GetEIPPrice", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/get_eipupgrade_price.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/get_eipupgrade_price.go new file mode 100644 index 000000000..b7e1801a8 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/get_eipupgrade_price.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet GetEIPUpgradePrice + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetEIPUpgradePriceRequest is request schema for GetEIPUpgradePrice action +type GetEIPUpgradePriceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 弹性IP的资源ID + EIPId *string `required:"true"` + + // 弹性IP的外网带宽, 单位为Mbps, 范围 [1-800] + Bandwidth *int `required:"true"` +} + +// GetEIPUpgradePriceResponse is response schema for GetEIPUpgradePrice action +type GetEIPUpgradePriceResponse struct { + response.CommonBase + + // 调整带宽后的EIP价格, 单位为"元", 如需退费此处为负值 + Price float64 +} + +// NewGetEIPUpgradePriceRequest will create request of GetEIPUpgradePrice action. +func (c *UNetClient) NewGetEIPUpgradePriceRequest() *GetEIPUpgradePriceRequest { + req := &GetEIPUpgradePriceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetEIPUpgradePrice - 获取弹性IP带宽改动价格 +func (c *UNetClient) GetEIPUpgradePrice(req *GetEIPUpgradePriceRequest) (*GetEIPUpgradePriceResponse, error) { + var err error + var res GetEIPUpgradePriceResponse + + err = c.Client.InvokeAction("GetEIPUpgradePrice", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/grant_firewall.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/grant_firewall.go new file mode 100644 index 000000000..87594b8c7 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/grant_firewall.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet GrantFirewall + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GrantFirewallRequest is request schema for GrantFirewall action +type GrantFirewallRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 防火墙资源ID + FWId *string `required:"true"` + + // 绑定防火墙组的资源类型,默认为全部资源类型。枚举值为:"unatgw",NAT网关; "uhost",云主机; "upm",物理云主机; "hadoophost",hadoop节点; "fortresshost",堡垒机; "udhost",私有专区主机;"udockhost",容器;"dbaudit",数据库审计. + ResourceType *string `required:"true"` + + // 所应用资源ID + ResourceId *string `required:"true"` +} + +// GrantFirewallResponse is response schema for GrantFirewall action +type GrantFirewallResponse struct { + response.CommonBase +} + +// NewGrantFirewallRequest will create request of GrantFirewall action. +func (c *UNetClient) NewGrantFirewallRequest() *GrantFirewallRequest { + req := &GrantFirewallRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GrantFirewall - 将防火墙应用到资源上 +func (c *UNetClient) GrantFirewall(req *GrantFirewallRequest) (*GrantFirewallResponse, error) { + var err error + var res GrantFirewallResponse + + err = c.Client.InvokeAction("GrantFirewall", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/modify_eipbandwidth.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/modify_eipbandwidth.go new file mode 100644 index 000000000..bdf99efde --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/modify_eipbandwidth.go @@ -0,0 +1,56 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet ModifyEIPBandwidth + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ModifyEIPBandwidthRequest is request schema for ModifyEIPBandwidth action +type ModifyEIPBandwidthRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 弹性IP的资源ID + EIPId *string `required:"true"` + + // 弹性IP的外网带宽, 单位为Mbps. 各地域的带宽值范围如下:流量计费[1-200],带宽计费[1-800] + Bandwidth *int `required:"true"` +} + +// ModifyEIPBandwidthResponse is response schema for ModifyEIPBandwidth action +type ModifyEIPBandwidthResponse struct { + response.CommonBase +} + +// NewModifyEIPBandwidthRequest will create request of ModifyEIPBandwidth action. +func (c *UNetClient) NewModifyEIPBandwidthRequest() *ModifyEIPBandwidthRequest { + req := &ModifyEIPBandwidthRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ModifyEIPBandwidth - 调整弹性IP的外网带宽 +func (c *UNetClient) ModifyEIPBandwidth(req *ModifyEIPBandwidthRequest) (*ModifyEIPBandwidthResponse, error) { + var err error + var res ModifyEIPBandwidthResponse + + err = c.Client.InvokeAction("ModifyEIPBandwidth", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/modify_eipweight.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/modify_eipweight.go new file mode 100644 index 000000000..b2fef96bb --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/modify_eipweight.go @@ -0,0 +1,56 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet ModifyEIPWeight + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ModifyEIPWeightRequest is request schema for ModifyEIPWeight action +type ModifyEIPWeightRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 弹性IP的资源ID + EIPId *string `required:"true"` + + // 外网出口权重, 范围[0-100] 取值为0时, 该弹性IP不会被使用. 取值为100时, 同主机下只会使用这个弹性IP,其他弹性IP不会被使用 请勿将多个绑定在同一资源的弹性IP设置为相同权重 + Weight *int `required:"true"` +} + +// ModifyEIPWeightResponse is response schema for ModifyEIPWeight action +type ModifyEIPWeightResponse struct { + response.CommonBase +} + +// NewModifyEIPWeightRequest will create request of ModifyEIPWeight action. +func (c *UNetClient) NewModifyEIPWeightRequest() *ModifyEIPWeightRequest { + req := &ModifyEIPWeightRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ModifyEIPWeight - 修改弹性IP的外网出口权重 +func (c *UNetClient) ModifyEIPWeight(req *ModifyEIPWeightRequest) (*ModifyEIPWeightResponse, error) { + var err error + var res ModifyEIPWeightResponse + + err = c.Client.InvokeAction("ModifyEIPWeight", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/release_eip.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/release_eip.go new file mode 100644 index 000000000..bc634d3ad --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/release_eip.go @@ -0,0 +1,53 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet ReleaseEIP + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ReleaseEIPRequest is request schema for ReleaseEIP action +type ReleaseEIPRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 弹性IP的资源ID + EIPId *string `required:"true"` +} + +// ReleaseEIPResponse is response schema for ReleaseEIP action +type ReleaseEIPResponse struct { + response.CommonBase +} + +// NewReleaseEIPRequest will create request of ReleaseEIP action. +func (c *UNetClient) NewReleaseEIPRequest() *ReleaseEIPRequest { + req := &ReleaseEIPRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ReleaseEIP - 释放弹性IP资源, 所释放弹性IP必须为非绑定状态. +func (c *UNetClient) ReleaseEIP(req *ReleaseEIPRequest) (*ReleaseEIPResponse, error) { + var err error + var res ReleaseEIPResponse + + err = c.Client.InvokeAction("ReleaseEIP", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/release_share_bandwidth.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/release_share_bandwidth.go new file mode 100644 index 000000000..f3421a453 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/release_share_bandwidth.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet ReleaseShareBandwidth + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ReleaseShareBandwidthRequest is request schema for ReleaseShareBandwidth action +type ReleaseShareBandwidthRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 共享带宽ID + ShareBandwidthId *string `required:"true"` + + // 关闭共享带宽后,各EIP恢复为的带宽值 + EIPBandwidth *int `required:"true"` + + // Bandwidth 带宽计费, Traffic 转流量计费 + PayMode *string `required:"false"` +} + +// ReleaseShareBandwidthResponse is response schema for ReleaseShareBandwidth action +type ReleaseShareBandwidthResponse struct { + response.CommonBase +} + +// NewReleaseShareBandwidthRequest will create request of ReleaseShareBandwidth action. +func (c *UNetClient) NewReleaseShareBandwidthRequest() *ReleaseShareBandwidthRequest { + req := &ReleaseShareBandwidthRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ReleaseShareBandwidth - 关闭共享带宽 +func (c *UNetClient) ReleaseShareBandwidth(req *ReleaseShareBandwidthRequest) (*ReleaseShareBandwidthResponse, error) { + var err error + var res ReleaseShareBandwidthResponse + + err = c.Client.InvokeAction("ReleaseShareBandwidth", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/release_vip.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/release_vip.go new file mode 100644 index 000000000..95c47c12c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/release_vip.go @@ -0,0 +1,56 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet ReleaseVIP + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ReleaseVIPRequest is request schema for ReleaseVIP action +type ReleaseVIPRequest struct { + request.CommonBase + + // [公共参数] 地域 + // Region *string `required:"true"` + + // [公共参数] 可用区 + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写 + // ProjectId *string `required:"false"` + + // 内网VIP的id + VIPId *string `required:"true"` +} + +// ReleaseVIPResponse is response schema for ReleaseVIP action +type ReleaseVIPResponse struct { + response.CommonBase +} + +// NewReleaseVIPRequest will create request of ReleaseVIP action. +func (c *UNetClient) NewReleaseVIPRequest() *ReleaseVIPRequest { + req := &ReleaseVIPRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ReleaseVIP - 释放VIP资源 +func (c *UNetClient) ReleaseVIP(req *ReleaseVIPRequest) (*ReleaseVIPResponse, error) { + var err error + var res ReleaseVIPResponse + + err = c.Client.InvokeAction("ReleaseVIP", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/resize_share_bandwidth.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/resize_share_bandwidth.go new file mode 100644 index 000000000..274a93784 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/resize_share_bandwidth.go @@ -0,0 +1,56 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet ResizeShareBandwidth + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ResizeShareBandwidthRequest is request schema for ResizeShareBandwidth action +type ResizeShareBandwidthRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 带宽值,单位为Mb,范围 [20-5000] (最大值受地域限制) + ShareBandwidth *int `required:"true"` + + // 共享带宽的Id + ShareBandwidthId *string `required:"true"` +} + +// ResizeShareBandwidthResponse is response schema for ResizeShareBandwidth action +type ResizeShareBandwidthResponse struct { + response.CommonBase +} + +// NewResizeShareBandwidthRequest will create request of ResizeShareBandwidth action. +func (c *UNetClient) NewResizeShareBandwidthRequest() *ResizeShareBandwidthRequest { + req := &ResizeShareBandwidthRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ResizeShareBandwidth - 调整共享带宽的带宽值 +func (c *UNetClient) ResizeShareBandwidth(req *ResizeShareBandwidthRequest) (*ResizeShareBandwidthResponse, error) { + var err error + var res ResizeShareBandwidthResponse + + err = c.Client.InvokeAction("ResizeShareBandwidth", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/set_eippay_mode.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/set_eippay_mode.go new file mode 100644 index 000000000..4544d3d33 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/set_eippay_mode.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet SetEIPPayMode + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// SetEIPPayModeRequest is request schema for SetEIPPayMode action +type SetEIPPayModeRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 弹性IP的资源Id + EIPId *string `required:"true"` + + // 计费模式. 枚举值:"Traffic", 流量计费模式; "Bandwidth", 带宽计费模式 + PayMode *string `required:"true"` + + // 调整的目标带宽值, 单位Mbps. 各地域的带宽值范围如下: 流量计费[1-200],其余情况[1-800] + Bandwidth *int `required:"true"` +} + +// SetEIPPayModeResponse is response schema for SetEIPPayMode action +type SetEIPPayModeResponse struct { + response.CommonBase +} + +// NewSetEIPPayModeRequest will create request of SetEIPPayMode action. +func (c *UNetClient) NewSetEIPPayModeRequest() *SetEIPPayModeRequest { + req := &SetEIPPayModeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// SetEIPPayMode - 设置弹性IP计费模式, 切换时会涉及付费/退费. +func (c *UNetClient) SetEIPPayMode(req *SetEIPPayModeRequest) (*SetEIPPayModeResponse, error) { + var err error + var res SetEIPPayModeResponse + + err = c.Client.InvokeAction("SetEIPPayMode", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eipaddr_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eipaddr_set.go new file mode 100644 index 000000000..78206f3f2 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eipaddr_set.go @@ -0,0 +1,16 @@ +package unet + +/* +EIPAddrSet - DescribeBandwidthPackage + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type EIPAddrSet struct { + + // 运营商信息, 枚举值为: BGP: BGP; International: 国际. + OperatorName string + + // 弹性IP地址 + IP string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eippay_mode_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eippay_mode_set.go new file mode 100644 index 000000000..801e52dea --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eippay_mode_set.go @@ -0,0 +1,16 @@ +package unet + +/* +EIPPayModeSet - GetEIPPayModeEIP + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type EIPPayModeSet struct { + + // EIP的资源ID + EIPId string + + // EIP的计费模式. 枚举值为:Bandwidth, 带宽计费;Traffic, 流量计费; "ShareBandwidth",共享带宽模式 + EIPPayMode string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eipprice_detail_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eipprice_detail_set.go new file mode 100644 index 000000000..55ce1a2ac --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eipprice_detail_set.go @@ -0,0 +1,19 @@ +package unet + +/* +EIPPriceDetailSet - GetEIPPrice + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type EIPPriceDetailSet struct { + + // 弹性IP付费方式 + ChargeType string + + // 弹性IP价格, 单位"元" + Price float64 + + // 资源有效期, 以Unix Timestamp表示 + PurchaseValue int +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eipset_data.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eipset_data.go new file mode 100644 index 000000000..136d8d952 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_eipset_data.go @@ -0,0 +1,19 @@ +package unet + +/* +EIPSetData - describeShareBandwidth + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type EIPSetData struct { + + // EIP带宽值 + Bandwidth int + + // EIP的IP信息,详情见EIPAddrSet + EIPAddr []EIPAddrSet + + // EIP资源Id + EIPId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_firewall_data_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_firewall_data_set.go new file mode 100644 index 000000000..887db5f06 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_firewall_data_set.go @@ -0,0 +1,37 @@ +package unet + +/* +FirewallDataSet - DescribeFirewall + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type FirewallDataSet struct { + + // 防火墙ID + FWId string + + // 安全组ID(即将废弃) + GroupId string + + // 防火墙名称 + Name string + + // 防火墙业务组 + Tag string + + // 防火墙备注 + Remark string + + // 防火墙绑定资源数量 + ResourceCount int + + // 防火墙组创建时间,格式为Unix Timestamp + CreateTime int + + // 防火墙组类型,枚举值为: "user defined", 用户自定义防火墙; "recommend web", 默认Web防火墙; "recommend non web", 默认非Web防火墙 + Type string + + // 防火墙组中的规则列表,参见 FirewallRuleSet + Rule []FirewallRuleSet +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_firewall_rule_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_firewall_rule_set.go new file mode 100644 index 000000000..9b1bcc152 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_firewall_rule_set.go @@ -0,0 +1,28 @@ +package unet + +/* +FirewallRuleSet - DescribeFirewall + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type FirewallRuleSet struct { + + // 源地址 + SrcIP string + + // 优先级 + Priority string + + // 协议类型 + ProtocolType string + + // 目标端口 + DstPort string + + // 防火墙动作 + RuleAction string + + // 防火墙规则备注 + Remark string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_resource_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_resource_set.go new file mode 100644 index 000000000..d039a7925 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_resource_set.go @@ -0,0 +1,34 @@ +package unet + +/* +ResourceSet - 资源信息 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type ResourceSet struct { + + // 可用区 + Zone int + + // 名称 + Name string + + // 内网IP + PrivateIP string + + // 备注 + Remark string + + // 绑定该防火墙的资源id + ResourceID string + + // 绑定防火墙组的资源类型。"unatgw",NAT网关; "uhost",云主机; "upm",物理云主机; "hadoophost",hadoop节点; "fortresshost",堡垒机; "udhost",私有专区主机;"udockhost",容器;"dbaudit",数据库审计. + ResourceType string + + // 状态 + Status int + + // 业务组 + Tag string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_share_bandwidth_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_share_bandwidth_set.go new file mode 100644 index 000000000..2e34097a7 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_share_bandwidth_set.go @@ -0,0 +1,19 @@ +package unet + +/* +ShareBandwidthSet - DescribeEIP + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type ShareBandwidthSet struct { + + // 共享带宽带宽值 + ShareBandwidth int + + // 共享带宽的资源名称 + ShareBandwidthName string + + // 共享带宽ID + ShareBandwidthId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_allocate_eipset.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_allocate_eipset.go new file mode 100644 index 000000000..7e8d70d23 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_allocate_eipset.go @@ -0,0 +1,16 @@ +package unet + +/* +UnetAllocateEIPSet - AllocateEIP + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UnetAllocateEIPSet struct { + + // 申请到的EIP资源ID + EIPId string + + // 申请到的IPv4地址. + EIPAddr []UnetEIPAddrSet +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_bandwidth_package_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_bandwidth_package_set.go new file mode 100644 index 000000000..7769f399b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_bandwidth_package_set.go @@ -0,0 +1,31 @@ +package unet + +/* +UnetBandwidthPackageSet - DescribeBandwidthPackage + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UnetBandwidthPackageSet struct { + + // 带宽包的资源ID + BandwidthPackageId string + + // 生效时间, 格式为 Unix Timestamp + EnableTime int + + // 失效时间, 格式为 Unix Timestamp + DisableTime int + + // 创建时间, 格式为 Unix Timestamp + CreateTime int + + // 带宽包的临时带宽值, 单位Mbps + Bandwidth int + + // 带宽包所绑定弹性IP的资源ID + EIPId string + + // 带宽包所绑定弹性IP的详细信息,只有当EIPId对应双线IP时, EIPAddr的长度为2, 其他情况, EIPAddr长度均为1.参见 EIPAddrSet + EIPAddr []EIPAddrSet +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_bandwidth_usage_eipset.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_bandwidth_usage_eipset.go new file mode 100644 index 000000000..3da7917e1 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_bandwidth_usage_eipset.go @@ -0,0 +1,16 @@ +package unet + +/* +UnetBandwidthUsageEIPSet - DescribeBandwidthUsage + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UnetBandwidthUsageEIPSet struct { + + // 最近5分钟带宽用量, 单位Mbps + CurBandwidth float64 + + // 弹性IP资源ID + EIPId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_eipaddr_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_eipaddr_set.go new file mode 100644 index 000000000..d3498072b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_eipaddr_set.go @@ -0,0 +1,16 @@ +package unet + +/* +UnetEIPAddrSet - AllocateEIP + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UnetEIPAddrSet struct { + + // 运营商信息如: 国际: International, BGP: BGP + OperatorName string + + // IP地址 + IP string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_eipresource_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_eipresource_set.go new file mode 100644 index 000000000..ac0c7fd58 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_eipresource_set.go @@ -0,0 +1,22 @@ +package unet + +/* +UnetEIPResourceSet - DescribeEIP + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UnetEIPResourceSet struct { + + // 已绑定的资源类型, 枚举值为: uhost, 云主机;natgw:NAT网关;ulb:负载均衡器;upm: 物理机; hadoophost: 大数据集群;fortresshost:堡垒机;udockhost:容器;udhost:私有专区主机;vpngw:IPSec VPN;ucdr:云灾备;dbaudit:数据库审计。 + ResourceType string + + // 已绑定的资源名称 + ResourceName string + + // 已绑定资源的资源ID + ResourceId string + + // 弹性IP的资源ID + EIPId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_eipset.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_eipset.go new file mode 100644 index 000000000..d3f94714d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_eipset.go @@ -0,0 +1,58 @@ +package unet + +/* +UnetEIPSet - DescribeEIP + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UnetEIPSet struct { + + // 弹性IP的资源ID + EIPId string + + // 外网出口权重, 默认为50, 范围[0-100] + Weight int + + // 带宽模式, 枚举值为: 0: 非共享带宽模式, 1: 共享带宽模式 + BandwidthType int + + // 弹性IP的带宽, 单位为Mbps, 当BandwidthType=1时, 该处显示为共享带宽值. 当BandwidthType=0时, 该处显示这个弹性IP的带宽. + Bandwidth int + + // 弹性IP的资源绑定状态, 枚举值为: used: 已绑定, free: 未绑定, freeze: 已冻结 + Status string + + // 付费方式, 枚举值为: Year, 按年付费; Month, 按月付费; Dynamic, 按小时付费; Trial, 试用. 按小时付费和试用这两种付费模式需要开通权限. + ChargeType string + + // 弹性IP的创建时间, 格式为Unix Timestamp + CreateTime int + + // 弹性IP的到期时间, 格式为Unix Timestamp + ExpireTime int + + // 弹性IP的详细信息列表, 具体结构见下方 UnetEIPResourceSet + Resource UnetEIPResourceSet + + // 弹性IP的详细信息列表, 具体结构见下方 UnetEIPAddrSet + EIPAddr []UnetEIPAddrSet + + // 弹性IP的名称,缺省值为 "EIP" + Name string + + // 弹性IP的业务组标识, 缺省值为 "Default" + Tag string + + // 弹性IP的备注, 缺省值为 "" + Remark string + + // 弹性IP的计费模式, 枚举值为: "Bandwidth", 带宽计费; "Traffic", 流量计费; "ShareBandwidth",共享带宽模式. 默认为 "Bandwidth". + PayMode string + + // 共享带宽信息 参见 ShareBandwidthSet + ShareBandwidthSet ShareBandwidthSet + + // 弹性IP是否到期 + Expire bool +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_share_bandwidth_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_share_bandwidth_set.go new file mode 100644 index 000000000..7b568115e --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_unet_share_bandwidth_set.go @@ -0,0 +1,37 @@ +package unet + +/* +UnetShareBandwidthSet - DescribeShareBandwidth + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type UnetShareBandwidthSet struct { + + // 共享带宽值(预付费)/共享带宽峰值(后付费), 单位Mbps + ShareBandwidth int + + // 共享带宽的资源ID + ShareBandwidthId string + + // 付费方式, 预付费:Year 按年,Month 按月,Dynamic 按需;后付费:PostPay(按月) + ChargeType string + + // 创建时间, 格式为Unix Timestamp + CreateTime int + + // 过期时间, 格式为Unix Timestamp + ExpireTime int + + // EIP信息,详情见 EIPSetData + EIPSet []EIPSetData + + // 共享带宽保底值(后付费) + BandwidthGuarantee int + + // 共享带宽后付费开始计费时间(后付费) + PostPayStartTime int + + // 共享带宽名称 + Name string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vipdetail_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vipdetail_set.go new file mode 100644 index 000000000..44bcbf41a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vipdetail_set.go @@ -0,0 +1,34 @@ +package unet + +/* +VIPDetailSet - VIPDetailSet + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type VIPDetailSet struct { + + // 地域 + Zone string + + // 虚拟ip id + VIPId string + + // 创建时间 + CreateTime int + + // 真实主机ip + RealIp string + + // 虚拟ip + VIP string + + // 子网id + SubnetId string + + // VPC id + VPCId string + + // Virtual IP 名称 + Name string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vipset.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vipset.go new file mode 100644 index 000000000..af95ff8b3 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vipset.go @@ -0,0 +1,19 @@ +package unet + +/* +VIPSet - VIPSet + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type VIPSet struct { + + // 虚拟ip + VIP string + + // 虚拟ip id + VIPId string + + // VPC id + VPCId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/un_bind_eip.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/un_bind_eip.go new file mode 100644 index 000000000..f29c2f37a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/un_bind_eip.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet UnBindEIP + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UnBindEIPRequest is request schema for UnBindEIP action +type UnBindEIPRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 弹性IP的资源Id + EIPId *string `required:"true"` + + // 弹性IP请求解绑的资源类型, 枚举值为: uhost: 云主机; ulb, 负载均衡器 upm: 物理机; hadoophost: 大数据集群;fortresshost:堡垒机;udockhost:容器;udhost:私有专区主机;natgw:NAT网关;udb:udb;vpngw:ipsec vpn;ucdr:云灾备;dbaudit:数据库审计; + ResourceType *string `required:"true"` + + // 弹性IP请求解绑的资源ID + ResourceId *string `required:"true"` +} + +// UnBindEIPResponse is response schema for UnBindEIP action +type UnBindEIPResponse struct { + response.CommonBase +} + +// NewUnBindEIPRequest will create request of UnBindEIP action. +func (c *UNetClient) NewUnBindEIPRequest() *UnBindEIPRequest { + req := &UnBindEIPRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UnBindEIP - 将弹性IP从资源上解绑 +func (c *UNetClient) UnBindEIP(req *UnBindEIPRequest) (*UnBindEIPResponse, error) { + var err error + var res UnBindEIPResponse + + err = c.Client.InvokeAction("UnBindEIP", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_eipattribute.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_eipattribute.go new file mode 100644 index 000000000..0ffae5655 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_eipattribute.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet UpdateEIPAttribute + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateEIPAttributeRequest is request schema for UpdateEIPAttribute action +type UpdateEIPAttributeRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // EIP资源ID + EIPId *string `required:"true"` + + // 名字(Name Tag Remark都为空则报错) + Name *string `required:"false"` + + // 业务 + Tag *string `required:"false"` + + // 备注 + Remark *string `required:"false"` +} + +// UpdateEIPAttributeResponse is response schema for UpdateEIPAttribute action +type UpdateEIPAttributeResponse struct { + response.CommonBase +} + +// NewUpdateEIPAttributeRequest will create request of UpdateEIPAttribute action. +func (c *UNetClient) NewUpdateEIPAttributeRequest() *UpdateEIPAttributeRequest { + req := &UpdateEIPAttributeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateEIPAttribute - 更新弹性IP名称,业务组,备注等属性字段 +func (c *UNetClient) UpdateEIPAttribute(req *UpdateEIPAttributeRequest) (*UpdateEIPAttributeResponse, error) { + var err error + var res UpdateEIPAttributeResponse + + err = c.Client.InvokeAction("UpdateEIPAttribute", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_firewall.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_firewall.go new file mode 100644 index 000000000..1110ab0f6 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_firewall.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet UpdateFirewall + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateFirewallRequest is request schema for UpdateFirewall action +type UpdateFirewallRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 防火墙资源ID + FWId *string `required:"true"` + + // 防火墙规则,例如:TCP|22|192.168.1.1/22|DROP|LOW|禁用22端口,第一个参数代表协议:第二个参数代表端口号,第三个参数为ip,第四个参数为ACCEPT(接受)和DROP(拒绝),第五个参数优先级:HIGH(高),MEDIUM(中),LOW(低),第六个参数为该条规则的自定义备注 + Rule []string `required:"true"` +} + +// UpdateFirewallResponse is response schema for UpdateFirewall action +type UpdateFirewallResponse struct { + response.CommonBase + + // 防火墙id + FWId string +} + +// NewUpdateFirewallRequest will create request of UpdateFirewall action. +func (c *UNetClient) NewUpdateFirewallRequest() *UpdateFirewallRequest { + req := &UpdateFirewallRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateFirewall - 更新防火墙规则 +func (c *UNetClient) UpdateFirewall(req *UpdateFirewallRequest) (*UpdateFirewallResponse, error) { + var err error + var res UpdateFirewallResponse + + err = c.Client.InvokeAction("UpdateFirewall", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_firewall_attribute.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_firewall_attribute.go new file mode 100644 index 000000000..b9c03341e --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_firewall_attribute.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api UNet UpdateFirewallAttribute + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateFirewallAttributeRequest is request schema for UpdateFirewallAttribute action +type UpdateFirewallAttributeRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 防火墙资源ID + FWId *string `required:"true"` + + // 防火墙名称,默认为空,为空则不做修改。Name,Tag,Remark必须填写1个及以上 + Name *string `required:"false"` + + // 防火墙业务组,默认为空,为空则不做修改。Name,Tag,Remark必须填写1个及以上 + Tag *string `required:"false"` + + // 防火墙备注,默认为空,为空则不做修改。Name,Tag,Remark必须填写1个及以上 + Remark *string `required:"false"` +} + +// UpdateFirewallAttributeResponse is response schema for UpdateFirewallAttribute action +type UpdateFirewallAttributeResponse struct { + response.CommonBase +} + +// NewUpdateFirewallAttributeRequest will create request of UpdateFirewallAttribute action. +func (c *UNetClient) NewUpdateFirewallAttributeRequest() *UpdateFirewallAttributeRequest { + req := &UpdateFirewallAttributeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateFirewallAttribute - 更新防火墙规则 +func (c *UNetClient) UpdateFirewallAttribute(req *UpdateFirewallAttributeRequest) (*UpdateFirewallAttributeResponse, error) { + var err error + var res UpdateFirewallAttributeResponse + + err = c.Client.InvokeAction("UpdateFirewallAttribute", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/add_vpcnetwork.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/add_vpcnetwork.go new file mode 100644 index 000000000..6bea2d75b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/add_vpcnetwork.go @@ -0,0 +1,56 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC AddVPCNetwork + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// AddVPCNetworkRequest is request schema for AddVPCNetwork action +type AddVPCNetworkRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 源VPC短ID + VPCId *string `required:"true"` + + // 增加网段 + Network []string `required:"true"` +} + +// AddVPCNetworkResponse is response schema for AddVPCNetwork action +type AddVPCNetworkResponse struct { + response.CommonBase +} + +// NewAddVPCNetworkRequest will create request of AddVPCNetwork action. +func (c *VPCClient) NewAddVPCNetworkRequest() *AddVPCNetworkRequest { + req := &AddVPCNetworkRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// AddVPCNetwork - 添加VPC网段 +func (c *VPCClient) AddVPCNetwork(req *AddVPCNetworkRequest) (*AddVPCNetworkResponse, error) { + var err error + var res AddVPCNetworkResponse + + err = c.Client.InvokeAction("AddVPCNetwork", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/client.go new file mode 100644 index 000000000..fe52e6c3d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/client.go @@ -0,0 +1,19 @@ +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" +) + +// VPCClient is the client of VPC2.0 +type VPCClient struct { + *ucloud.Client +} + +// NewClient will return a instance of VPCClient +func NewClient(config *ucloud.Config, credential *auth.Credential) *VPCClient { + client := ucloud.NewClient(config, credential) + return &VPCClient{ + client, + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_subnet.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_subnet.go new file mode 100644 index 000000000..c5b626eca --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_subnet.go @@ -0,0 +1,71 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC CreateSubnet + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateSubnetRequest is request schema for CreateSubnet action +type CreateSubnetRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // VPC资源ID + VPCId *string `required:"true"` + + // 子网网络地址,例如192.168.0.0 + Subnet *string `required:"true"` + + // 子网网络号位数,默认为24 + Netmask *int `required:"false"` + + // 子网名称,默认为Subnet + SubnetName *string `required:"false"` + + // 业务组名称,默认为Default + Tag *string `required:"false"` + + // 备注 + Remark *string `required:"false"` +} + +// CreateSubnetResponse is response schema for CreateSubnet action +type CreateSubnetResponse struct { + response.CommonBase + + // 子网ID + SubnetId string +} + +// NewCreateSubnetRequest will create request of CreateSubnet action. +func (c *VPCClient) NewCreateSubnetRequest() *CreateSubnetRequest { + req := &CreateSubnetRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateSubnet - 创建子网 +func (c *VPCClient) CreateSubnet(req *CreateSubnetRequest) (*CreateSubnetResponse, error) { + var err error + var res CreateSubnetResponse + + err = c.Client.InvokeAction("CreateSubnet", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_vpc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_vpc.go new file mode 100644 index 000000000..461c34702 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_vpc.go @@ -0,0 +1,68 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC CreateVPC + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateVPCRequest is request schema for CreateVPC action +type CreateVPCRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // VPC名称 + Name *string `required:"true"` + + // VPC网段 + Network []string `required:"true"` + + // 业务组名称 + Tag *string `required:"false"` + + // 备注 + Remark *string `required:"false"` + + // VPC类型 + Type *int `required:"false"` +} + +// CreateVPCResponse is response schema for CreateVPC action +type CreateVPCResponse struct { + response.CommonBase + + // VPC资源Id + VPCId string +} + +// NewCreateVPCRequest will create request of CreateVPC action. +func (c *VPCClient) NewCreateVPCRequest() *CreateVPCRequest { + req := &CreateVPCRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateVPC - 创建VPC +func (c *VPCClient) CreateVPC(req *CreateVPCRequest) (*CreateVPCResponse, error) { + var err error + var res CreateVPCResponse + + err = c.Client.InvokeAction("CreateVPC", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_vpcintercom.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_vpcintercom.go new file mode 100644 index 000000000..194f1d582 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_vpcintercom.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC CreateVPCIntercom + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateVPCIntercomRequest is request schema for CreateVPCIntercom action +type CreateVPCIntercomRequest struct { + request.CommonBase + + // [公共参数] 源VPC所在地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 源VPC所在项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 源VPC短ID + VPCId *string `required:"true"` + + // 目的VPC短ID + DstVPCId *string `required:"true"` + + // 目的VPC所在地域,默认与源VPC同地域。 + DstRegion *string `required:"false"` + + // 目的VPC项目ID。默认与源VPC同项目。 + DstProjectId *string `required:"false"` +} + +// CreateVPCIntercomResponse is response schema for CreateVPCIntercom action +type CreateVPCIntercomResponse struct { + response.CommonBase +} + +// NewCreateVPCIntercomRequest will create request of CreateVPCIntercom action. +func (c *VPCClient) NewCreateVPCIntercomRequest() *CreateVPCIntercomRequest { + req := &CreateVPCIntercomRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateVPCIntercom - 新建VPC互通关系 +func (c *VPCClient) CreateVPCIntercom(req *CreateVPCIntercomRequest) (*CreateVPCIntercomResponse, error) { + var err error + var res CreateVPCIntercomResponse + + err = c.Client.InvokeAction("CreateVPCIntercom", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_subnet.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_subnet.go new file mode 100644 index 000000000..063adc753 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_subnet.go @@ -0,0 +1,53 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC DeleteSubnet + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteSubnetRequest is request schema for DeleteSubnet action +type DeleteSubnetRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 子网ID + SubnetId *string `required:"true"` +} + +// DeleteSubnetResponse is response schema for DeleteSubnet action +type DeleteSubnetResponse struct { + response.CommonBase +} + +// NewDeleteSubnetRequest will create request of DeleteSubnet action. +func (c *VPCClient) NewDeleteSubnetRequest() *DeleteSubnetRequest { + req := &DeleteSubnetRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteSubnet - 删除子网 +func (c *VPCClient) DeleteSubnet(req *DeleteSubnetRequest) (*DeleteSubnetResponse, error) { + var err error + var res DeleteSubnetResponse + + err = c.Client.InvokeAction("DeleteSubnet", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_vpc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_vpc.go new file mode 100644 index 000000000..1a5c66eb9 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_vpc.go @@ -0,0 +1,53 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC DeleteVPC + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteVPCRequest is request schema for DeleteVPC action +type DeleteVPCRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // VPC资源Id + VPCId *string `required:"true"` +} + +// DeleteVPCResponse is response schema for DeleteVPC action +type DeleteVPCResponse struct { + response.CommonBase +} + +// NewDeleteVPCRequest will create request of DeleteVPC action. +func (c *VPCClient) NewDeleteVPCRequest() *DeleteVPCRequest { + req := &DeleteVPCRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteVPC - 删除VPC +func (c *VPCClient) DeleteVPC(req *DeleteVPCRequest) (*DeleteVPCResponse, error) { + var err error + var res DeleteVPCResponse + + err = c.Client.InvokeAction("DeleteVPC", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_vpcintercom.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_vpcintercom.go new file mode 100644 index 000000000..396d90456 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_vpcintercom.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC DeleteVPCIntercom + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteVPCIntercomRequest is request schema for DeleteVPCIntercom action +type DeleteVPCIntercomRequest struct { + request.CommonBase + + // [公共参数] 源VPC所在地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 源VPC所在项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 源VPC短ID + VPCId *string `required:"true"` + + // 目的VPC短ID + DstVPCId *string `required:"true"` + + // 目的VPC所在地域,默认为源VPC所在地域 + DstRegion *string `required:"false"` + + // 目的VPC所在项目ID,默认为源VPC所在项目ID + DstProjectId *string `required:"false"` +} + +// DeleteVPCIntercomResponse is response schema for DeleteVPCIntercom action +type DeleteVPCIntercomResponse struct { + response.CommonBase +} + +// NewDeleteVPCIntercomRequest will create request of DeleteVPCIntercom action. +func (c *VPCClient) NewDeleteVPCIntercomRequest() *DeleteVPCIntercomRequest { + req := &DeleteVPCIntercomRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteVPCIntercom - 删除VPC互通关系 +func (c *VPCClient) DeleteVPCIntercom(req *DeleteVPCIntercomRequest) (*DeleteVPCIntercomResponse, error) { + var err error + var res DeleteVPCIntercomResponse + + err = c.Client.InvokeAction("DeleteVPCIntercom", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_subnet.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_subnet.go new file mode 100644 index 000000000..c92fd0611 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_subnet.go @@ -0,0 +1,77 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC DescribeSubnet + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeSubnetRequest is request schema for DescribeSubnet action +type DescribeSubnetRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 子网id数组,适用于一次查询多个子网信息 + SubnetIds []string `required:"false"` + + // 子网id,适用于一次查询一个子网信息 + SubnetId *string `required:"false"` + + // VPC资源id + VPCId *string `required:"false"` + + // 业务组名称,默认为Default + Tag *string `required:"false"` + + // 业务组 + BusinessId *string `required:"false"` + + // 偏移量,默认为0 + Offset *int `required:"false"` + + // 列表长度,默认为20 + Limit *int `required:"false"` +} + +// DescribeSubnetResponse is response schema for DescribeSubnet action +type DescribeSubnetResponse struct { + response.CommonBase + + // 子网总数量 + TotalCount int + + // 子网信息数组 + DataSet []VPCSubnetInfoSet +} + +// NewDescribeSubnetRequest will create request of DescribeSubnet action. +func (c *VPCClient) NewDescribeSubnetRequest() *DescribeSubnetRequest { + req := &DescribeSubnetRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeSubnet - 获取子网信息 +func (c *VPCClient) DescribeSubnet(req *DescribeSubnetRequest) (*DescribeSubnetResponse, error) { + var err error + var res DescribeSubnetResponse + + err = c.Client.InvokeAction("DescribeSubnet", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_subnet_resource.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_subnet_resource.go new file mode 100644 index 000000000..e7c7d28c5 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_subnet_resource.go @@ -0,0 +1,68 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC DescribeSubnetResource + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeSubnetResourceRequest is request schema for DescribeSubnetResource action +type DescribeSubnetResourceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 子网id + SubnetId *string `required:"true"` + + // 资源类型,默认为全部资源类型。枚举值为:UHOST,云主机;PHOST,物理云主机;ULB,负载均衡;UHADOOP_HOST,hadoop节点;UFORTRESS_HOST,堡垒机;UNATGW,NAT网关;UKAFKA,Kafka消息队列;UMEM,内存存储;DOCKER,容器集群;UDB,数据库;UDW,数据仓库;VIP,内网VIP. + ResourceType *string `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` + + // 单页返回数据长度,默认为20 + Limit *int `required:"false"` +} + +// DescribeSubnetResourceResponse is response schema for DescribeSubnetResource action +type DescribeSubnetResourceResponse struct { + response.CommonBase + + // 总数 + TotalCount int + + // 返回数据集 + DataSet []ResourceInfo +} + +// NewDescribeSubnetResourceRequest will create request of DescribeSubnetResource action. +func (c *VPCClient) NewDescribeSubnetResourceRequest() *DescribeSubnetResourceRequest { + req := &DescribeSubnetResourceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeSubnetResource - 展示子网资源 +func (c *VPCClient) DescribeSubnetResource(req *DescribeSubnetResourceRequest) (*DescribeSubnetResourceResponse, error) { + var err error + var res DescribeSubnetResourceResponse + + err = c.Client.InvokeAction("DescribeSubnetResource", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_vpc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_vpc.go new file mode 100644 index 000000000..bf183b844 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_vpc.go @@ -0,0 +1,65 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC DescribeVPC + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeVPCRequest is request schema for DescribeVPC action +type DescribeVPCRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // VPCId + VPCIds []string `required:"false"` + + // 业务组名称 + Tag *string `required:"false"` + + // 偏移量 + Offset *int `required:"false"` + + // 列表长度 + Limit *int `required:"false"` +} + +// DescribeVPCResponse is response schema for DescribeVPC action +type DescribeVPCResponse struct { + response.CommonBase + + // vpc信息,具体结构见下方VPCInfo + DataSet []VPCInfo +} + +// NewDescribeVPCRequest will create request of DescribeVPC action. +func (c *VPCClient) NewDescribeVPCRequest() *DescribeVPCRequest { + req := &DescribeVPCRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeVPC - 获取VPC信息 +func (c *VPCClient) DescribeVPC(req *DescribeVPCRequest) (*DescribeVPCResponse, error) { + var err error + var res DescribeVPCResponse + + err = c.Client.InvokeAction("DescribeVPC", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_vpcintercom.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_vpcintercom.go new file mode 100644 index 000000000..9ff808e2e --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_vpcintercom.go @@ -0,0 +1,62 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC DescribeVPCIntercom + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeVPCIntercomRequest is request schema for DescribeVPCIntercom action +type DescribeVPCIntercomRequest struct { + request.CommonBase + + // [公共参数] 源VPC所在地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 源VPC所在项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // VPC短ID + VPCId *string `required:"true"` + + // 目的VPC所在地域,默认为全部地域 + DstRegion *string `required:"false"` + + // 目的项目ID,默认为全部项目 + DstProjectId *string `required:"false"` +} + +// DescribeVPCIntercomResponse is response schema for DescribeVPCIntercom action +type DescribeVPCIntercomResponse struct { + response.CommonBase + + // 联通VPC信息数组 + DataSet []VPCIntercomInfo +} + +// NewDescribeVPCIntercomRequest will create request of DescribeVPCIntercom action. +func (c *VPCClient) NewDescribeVPCIntercomRequest() *DescribeVPCIntercomRequest { + req := &DescribeVPCIntercomRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeVPCIntercom - 获取VPC互通信息 +func (c *VPCClient) DescribeVPCIntercom(req *DescribeVPCIntercomRequest) (*DescribeVPCIntercomResponse, error) { + var err error + var res DescribeVPCIntercomResponse + + err = c.Client.InvokeAction("DescribeVPCIntercom", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/doc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/doc.go new file mode 100644 index 000000000..8ab0f1da1 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/doc.go @@ -0,0 +1,4 @@ +/* +Package vpc include resources of ucloud vpc 2.0 product +*/ +package vpc diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_resource_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_resource_info.go new file mode 100644 index 000000000..69bfdad63 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_resource_info.go @@ -0,0 +1,22 @@ +package vpc + +/* +ResourceInfo - 资源信息 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type ResourceInfo struct { + + // 资源名称 + Name string + + // 资源id + ResourceId string + + // 资源类型 + ResourceType string + + // ip地址 + IP string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcinfo.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcinfo.go new file mode 100644 index 000000000..ec41d70ba --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcinfo.go @@ -0,0 +1,29 @@ +package vpc + +// VPCInfo - vpc信息 +type VPCInfo struct { + + // 业务组 + Tag string + + // 创建时间 + CreateTime int + + // vpc名称 + Name string + + // vpc地址空间 + Network []string + + // vpc地址空间信息 + NetworkInfo []VPCNetworkInfo + + // vpc中子网数量 + SubnetCount int + + // 更新时间 + UpdateTime int + + // vpc的资源ID + VPCId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcintercom_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcintercom_info.go new file mode 100644 index 000000000..600e4e899 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcintercom_info.go @@ -0,0 +1,28 @@ +package vpc + +/* +VPCIntercomInfo - + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type VPCIntercomInfo struct { + + // 项目Id + ProjectId string + + // VPC的地址空间 + Network []string + + // 所属地域 + DstRegion string + + // VPC名字 + Name string + + // VPCId + VPCId string + + // 业务组(未分组显示为 Default) + Tag string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcnetwork_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcnetwork_info.go new file mode 100644 index 000000000..f150a673a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcnetwork_info.go @@ -0,0 +1,11 @@ +package vpc + +// VPCNetworkInfo - vpc地址空间信息 +type VPCNetworkInfo struct { + + // 地址空间段 + Network string + + // 地址空间中子网数量 + SubnetCount int +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcsubnet_info_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcsubnet_info_set.go new file mode 100644 index 000000000..77bd78eed --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_vpcsubnet_info_set.go @@ -0,0 +1,55 @@ +package vpc + +/* +VPCSubnetInfoSet - DescribeSubnet + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn for detail. +*/ +type VPCSubnetInfoSet struct { + + // VPC id + VPCId string + + // VPC名称 + VPCName string + + // 子网id + SubnetId string + + // 子网名称 + SubnetName string + + // 地址 + Zone string + + // 名称 + Name string + + // 备注 + Remark string + + // Tag + Tag string + + // 子网类型 + SubnetType int + + // 子网网段 + Subnet string + + // 子网掩码 + Netmask string + + // 子网网关 + Gateway string + + // 创建时间 + CreateTime int + + // 虚拟路由 id + VRouterId string + + // 是否关联NATGW + HasNATGW bool +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_subnet_attribute.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_subnet_attribute.go new file mode 100644 index 000000000..fd99ed01b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_subnet_attribute.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC UpdateSubnetAttribute + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateSubnetAttributeRequest is request schema for UpdateSubnetAttribute action +type UpdateSubnetAttributeRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 子网ID + SubnetId *string `required:"true"` + + // 子网名称(如果Name不填写,Tag必须填写) + Name *string `required:"false"` + + // 业务组名称(如果Tag不填写,Name必须填写) + Tag *string `required:"false"` +} + +// UpdateSubnetAttributeResponse is response schema for UpdateSubnetAttribute action +type UpdateSubnetAttributeResponse struct { + response.CommonBase +} + +// NewUpdateSubnetAttributeRequest will create request of UpdateSubnetAttribute action. +func (c *VPCClient) NewUpdateSubnetAttributeRequest() *UpdateSubnetAttributeRequest { + req := &UpdateSubnetAttributeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateSubnetAttribute - 更新子网信息 +func (c *VPCClient) UpdateSubnetAttribute(req *UpdateSubnetAttributeRequest) (*UpdateSubnetAttributeResponse, error) { + var err error + var res UpdateSubnetAttributeResponse + + err = c.Client.InvokeAction("UpdateSubnetAttribute", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_vpcnetwork.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_vpcnetwork.go new file mode 100644 index 000000000..0ea1179db --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_vpcnetwork.go @@ -0,0 +1,59 @@ +//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. +//go:generate ucloud-gen-go-api VPC UpdateVPCNetwork + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateVPCNetworkRequest is request schema for UpdateVPCNetwork action +type UpdateVPCNetworkRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // VPC的ID + VPCId *string `required:"true"` + + // 更新的全量网段 + Network []string `required:"true"` +} + +// UpdateVPCNetworkResponse is response schema for UpdateVPCNetwork action +type UpdateVPCNetworkResponse struct { + response.CommonBase + + // 错误信息 + Message string +} + +// NewUpdateVPCNetworkRequest will create request of UpdateVPCNetwork action. +func (c *VPCClient) NewUpdateVPCNetworkRequest() *UpdateVPCNetworkRequest { + req := &UpdateVPCNetworkRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateVPCNetwork - 修改VPC地址空间,只支持删除地址空间 +func (c *VPCClient) UpdateVPCNetwork(req *UpdateVPCNetworkRequest) (*UpdateVPCNetworkResponse, error) { + var err error + var res UpdateVPCNetworkResponse + + err = c.Client.InvokeAction("UpdateVPCNetwork", req, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/auth/credential.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/auth/credential.go new file mode 100644 index 000000000..05ff2409c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/auth/credential.go @@ -0,0 +1,56 @@ +/* +Package auth is the credential utilities of sdk +*/ +package auth + +import ( + "crypto/sha1" + "encoding/hex" + "io" + "net/url" + "sort" + "strings" +) + +// Credential is the information of credential keys +type Credential struct { + PublicKey string + PrivateKey string +} + +// NewCredential will return credential config with default values +func NewCredential() Credential { + return Credential{} +} + +// CreateSign will encode query string to credential signature. +func (c *Credential) CreateSign(query string) string { + // replace "=" "&" + str := strings.Replace(query, "&", "", -1) + str = strings.Replace(str, "=", "", -1) + + // crypto by SHA1 + strUnescaped, _ := url.QueryUnescape(str) + h := sha1.New() + s := strUnescaped + c.PrivateKey + io.WriteString(h, s) + bs := h.Sum(nil) + result := hex.EncodeToString(bs) + + return result +} + +// BuildCredentialedQuery will build query string with signature query param. +func (c *Credential) BuildCredentialedQuery(query map[string]string) string { + var queryList []string + for k, v := range query { + queryList = append(queryList, k+"="+url.QueryEscape(v)) + } + queryList = append(queryList, "PublicKey="+url.QueryEscape(c.PublicKey)) + sort.Strings(queryList) + queryString := strings.Join(queryList, "&") + + sign := c.CreateSign(queryString) + queryString = queryString + "&Signature=" + sign + return queryString +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/client.go new file mode 100644 index 000000000..a2e2cc989 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/client.go @@ -0,0 +1,167 @@ +/* +Package ucloud is a package of utilities to setup ucloud sdk and improve using experience +*/ +package ucloud + +import ( + "time" + + "github.com/ucloud/ucloud-sdk-go/private/utils" + + "github.com/ucloud/ucloud-sdk-go/private/protocol/http" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" + uerr "github.com/ucloud/ucloud-sdk-go/ucloud/error" + "github.com/ucloud/ucloud-sdk-go/ucloud/log" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// Client 客户端 +type Client struct { + // configurations + credential *auth.Credential + config *Config + + // composited instances + httpClient http.Client + logger log.Logger + + // internal properties + requestHandlers []RequestHandler + httpRequestHandlers []HttpRequestHandler + responseHandlers []ResponseHandler + httpResponseHandlers []HttpResponseHandler +} + +// NewClient will create an client of ucloud sdk +func NewClient(config *Config, credential *auth.Credential) *Client { + client := Client{ + credential: credential, + config: config, + } + + client.requestHandlers = append(client.requestHandlers, defaultRequestHandlers...) + client.httpRequestHandlers = append(client.httpRequestHandlers, defaultHttpRequestHandlers...) + client.responseHandlers = append(client.responseHandlers, defaultResponseHandlers...) + client.httpResponseHandlers = append(client.httpResponseHandlers, defaultHttpResponseHandlers...) + + client.logger = log.New() + client.logger.SetLevel(config.LogLevel) + + return &client +} + +// SetHttpClient will setup a http client +func (c *Client) SetHttpClient(httpClient http.Client) error { + c.httpClient = httpClient + return nil +} + +// GetCredential will return the creadential config of client. +func (c *Client) GetCredential() *auth.Credential { + return c.credential +} + +// GetConfig will return the config of client. +func (c *Client) GetConfig() *Config { + return c.config +} + +// SetLogger will set the logger of client +func (c *Client) SetLogger(logger log.Logger) { + c.logger = logger +} + +// GetLogger will set the logger of client +func (c *Client) GetLogger() log.Logger { + return c.logger +} + +// InvokeAction will do an action request from a request struct and set response value into res struct pointer +func (c *Client) InvokeAction(action string, req request.Common, resp response.Common) error { + return c.InvokeActionWithPatcher(action, req, resp, utils.RetCodePatcher) +} + +// InvokeActionWithPatcher will invoke action by patchers +func (c *Client) InvokeActionWithPatcher(action string, req request.Common, resp response.Common, patches ...utils.Patch) error { + var err error + req.SetAction(action) + req.SetRequestTime(time.Now()) + resp.SetRequest(req) + + for _, handler := range c.requestHandlers { + req, err = handler(c, req) + if err != nil { + return uerr.NewClientError(uerr.ErrInvalidRequest, err) + } + } + + httpReq, err := c.buildHTTPRequest(req) + if err != nil { + return uerr.NewClientError(uerr.ErrInvalidRequest, err) + } + + for _, handler := range c.httpRequestHandlers { + httpReq, err = handler(c, httpReq) + if err != nil { + return uerr.NewClientError(uerr.ErrInvalidRequest, err) + } + } + + if c.httpClient == nil { + httpClient := http.NewHttpClient() + c.httpClient = &httpClient + } + + httpResp, err := c.httpClient.Send(httpReq) + + // use response middleware to handle http response + // such as convert some http status to error + for _, handler := range c.httpResponseHandlers { + httpResp, err = handler(c, httpReq, httpResp, err) + } + + if err == nil { + // use patch object to resolve the http response body + // in general, it will be fix common server error before server bugfix is released. + body := httpResp.GetBody() + + for _, patch := range patches { + body = patch.Patch(body) + } + + err = c.unmarshalHTTPResponse(body, resp) + } + + // use response middle to build and convert response when response has been created. + // such as retry, report traceback, print log and etc. + for _, handler := range c.responseHandlers { + resp, err = handler(c, req, resp, err) + } + + return err +} + +// AddHttpRequestHandler will append a response handler to client +func (c *Client) AddHttpRequestHandler(h HttpRequestHandler) error { + c.httpRequestHandlers = append([]HttpRequestHandler{h}, c.httpRequestHandlers...) + return nil +} + +// AddRequestHandler will append a response handler to client +func (c *Client) AddRequestHandler(h RequestHandler) error { + c.requestHandlers = append([]RequestHandler{h}, c.requestHandlers...) + return nil +} + +// AddHttpResponseHandler will append a http response handler to client +func (c *Client) AddHttpResponseHandler(h HttpResponseHandler) error { + c.httpResponseHandlers = append(c.httpResponseHandlers, h) + return nil +} + +// AddResponseHandler will append a response handler to client +func (c *Client) AddResponseHandler(h ResponseHandler) error { + c.responseHandlers = append(c.responseHandlers, h) + return nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/config.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/config.go new file mode 100644 index 000000000..2b79bc119 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/config.go @@ -0,0 +1,76 @@ +package ucloud + +import ( + "time" + + "github.com/ucloud/ucloud-sdk-go/ucloud/log" +) + +// Config is the config of ucloud sdk, use for setting up client +type Config struct { + // Region is the region of backend service + // See also ... + Region string `default:""` + + // Zone is the zone of backend service + // See also ... + Zone string `default:""` + + // ProjectId is the unique identify of project, used for organize resources, + // Most of resources should belong to a project. + // Sub-Account must have an project id. + // See also ... + ProjectId string `default:""` + + // BaseUrl is the url of backend api + // See also ... + BaseUrl string `default:"https://api.ucloud.cn"` + + // UserAgent is an attribute for sdk client, used for distinguish who is using sdk. + // See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent + // It will be appended to the end of sdk user-agent. + // eg. "Terraform/0.10.1" -> "GO/1.9.1 GO-SDK/0.1.0 Terraform/0.10.1" + // NOTE: it will conflict with the User-Agent of HTTPHeaders + UserAgent string `default:""` + + // Timeout is timeout for every request. + Timeout time.Duration `default:"30s"` + + // MaxRetries is the number of max retry times. + // Set MaxRetries more than 0 to enable auto-retry for network and service availability problem + // if auto-retry is enabled, it will enable default retry policy using exponential backoff. + MaxRetries int `default:"0"` + + // LogLevel is equal to logrus level, + // if logLevel not be set, use INFO level as default. + LogLevel log.Level `default:"log.InfoLevel"` + + // Logging level by action, used to filter logging messages by action + // use SetActionLevel() and GetActionLevel() to modify + actionLoggingLevels map[string]log.Level +} + +// NewConfig will return a new client config with default options. +func NewConfig() Config { + cfg := Config{ + BaseUrl: "https://api.ucloud.cn", + Timeout: 30 * time.Second, + MaxRetries: 0, + LogLevel: log.WarnLevel, + actionLoggingLevels: make(map[string]log.Level), + } + return cfg +} + +// GetActionLevel will return the log level of action +func (c *Config) GetActionLevel(action string) log.Level { + if level, ok := c.actionLoggingLevels[action]; ok { + return level + } + return c.LogLevel +} + +// SetActionLevel will return the log level of action +func (c *Config) SetActionLevel(action string, level log.Level) { + c.actionLoggingLevels[action] = level +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/error/client_error.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/error/client_error.go new file mode 100644 index 000000000..3f9b9db59 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/error/client_error.go @@ -0,0 +1,94 @@ +package uerr + +import ( + "fmt" + "net" + "strings" +) + +var ( + // ErrInvalidRequest is the error for invalid request took from user + ErrInvalidRequest = "client.InvalidRequestError" + + // ErrSendRequest is the error for sending request + ErrSendRequest = "client.SendRequestError" + + // ErrNetwork is the error for any network error caused by client or server network environment + // ErrNetwork can be caused by net errors of golang + // ErrNetwork is retryable + ErrNetwork = "client.NetworkError" + + // ErrUnexpected is the error for any unexpected error + ErrUnexpected = "client.UnexpectedError" +) + +// ClientError is the ucloud common errorfor server response +type ClientError struct { + err error + name string + retryable bool +} + +func (e ClientError) Error() string { + return fmt.Sprintf("sdk:\n[%s] %s", e.name, e.err.Error()) +} + +// NewClientError will return a new instance of ClientError +func NewClientError(name string, err error) ClientError { + return ClientError{ + name: name, + err: err, + retryable: isRetryableName(name), + } +} + +// Name will return error name +func (e ClientError) Name() string { + return e.name +} + +// Code will return server code +func (e ClientError) Code() int { + return -1 +} + +// StatusCode will return http status code +func (e ClientError) StatusCode() int { + return 0 +} + +// Message will return message +func (e ClientError) Message() string { + return e.err.Error() +} + +// OriginError will return the origin error that caused by +func (e ClientError) OriginError() error { + return e.err +} + +// Retryable will return if the error is retryable +func (e ClientError) Retryable() bool { + return e.name == ErrNetwork || e.retryable +} + +// IsNetworkError will check if the error raise from network problem +func IsNetworkError(err error) bool { + if err == nil { + return false + } + _, isNetError := err.(net.Error) + if isNetError { + return true + } + return strings.HasPrefix(err.Error(), "net/http: request canceled") +} + +func isRetryableName(name string) bool { + switch name { + case ErrNetwork: + return true + default: + return false + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/error/error.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/error/error.go new file mode 100644 index 000000000..5a2437ce4 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/error/error.go @@ -0,0 +1,61 @@ +/* +Package uerr is the error definition of service and sdk +*/ +package uerr + +// Error is the ucloud sdk error +type Error interface { + error + + // name, should be client.xxx or server.xxx + Name() string + + // retcode for server api error, retcode > 0 will cause an error + Code() int + + // http status code, code >= 400 will case an error + StatusCode() int + + // message for server api error + Message() string + + // the origin error that sdk error caused from + OriginError() error + + // if the error is retryable + Retryable() bool +} + +// NewRetryableError will wrap any error as a retryable error +func NewRetryableError(err error) Error { + if e, ok := err.(ClientError); ok { + e.retryable = true + return e + } + + if e, ok := err.(ServerError); ok { + e.retryable = true + return e + } + + e := NewClientError(ErrUnexpected, err) + e.retryable = true + return e +} + +// NewNonRetryableError will wrap any error as a non-retryable error +func NewNonRetryableError(err error) Error { + if e, ok := err.(ClientError); ok { + e.retryable = false + return e + } + + if e, ok := err.(ServerError); ok { + e.retryable = false + return e + } + + e := NewClientError(ErrUnexpected, err) + e.retryable = false + return e +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/error/server_error.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/error/server_error.go new file mode 100644 index 000000000..f2cdc9bd6 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/error/server_error.go @@ -0,0 +1,102 @@ +package uerr + +import ( + "fmt" + + "github.com/pkg/errors" +) + +var ( + // ErrHTTPStatus is error type of http status + ErrHTTPStatus = "server.HTTPStatusError" + // ErrRetCode is error type of server return code is larger than 0 + ErrRetCode = "server.RetCodeError" +) + +// ServerError is the ucloud common error for server response +type ServerError struct { + err error + name string + statusCode int + retCode int + message string + retryable bool +} + +func (e ServerError) Error() string { + if e.retCode > 0 { + return fmt.Sprintf("api:\n[%s] %v %s", e.name, e.retCode, e.message) + } + return fmt.Sprintf("api:\n[%s] %s", e.name, e.message) +} + +// NewServerStatusError will return a new instance of NewServerStatusError +func NewServerStatusError(statusCode int, message string) ServerError { + return ServerError{ + retCode: -1, + statusCode: statusCode, + message: message, + name: ErrHTTPStatus, + err: errors.Errorf("%s", message), + retryable: false, + } +} + +// NewServerCodeError will return a new instance of NewServerStatusError +func NewServerCodeError(retCode int, message string) ServerError { + return ServerError{ + retCode: retCode, + statusCode: 200, + message: message, + name: ErrRetCode, + err: errors.Errorf("%s", message), + retryable: retCode >= 2000, + } +} + +// Name will return error name +func (e ServerError) Name() string { + return e.name +} + +// Code will return server code +func (e ServerError) Code() int { + return e.retCode +} + +// StatusCode will return http status code +func (e ServerError) StatusCode() int { + return e.statusCode +} + +// Message will return message +func (e ServerError) Message() string { + return e.message +} + +// OriginError will return the origin error that caused by +func (e ServerError) OriginError() error { + return e.err +} + +// Retryable will return if the error is retryable +func (e ServerError) Retryable() bool { + return isIn(e.statusCode, []int{429, 502, 503, 504}) || e.retryable +} + +func isIn(i int, availables []int) bool { + for _, v := range availables { + if i == v { + return true + } + } + return false +} + +// IsCodeError will check if the error is the retuen code error +func IsCodeError(err error) bool { + if e, ok := err.(Error); ok && e.Name() == ErrRetCode { + return true + } + return false +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/handlers.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/handlers.go new file mode 100644 index 000000000..4223df98f --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/handlers.go @@ -0,0 +1,156 @@ +package ucloud + +import ( + "math/rand" + "time" + + "github.com/ucloud/ucloud-sdk-go/private/protocol/http" + uerr "github.com/ucloud/ucloud-sdk-go/ucloud/error" + "github.com/ucloud/ucloud-sdk-go/ucloud/log" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// RequestHandler receive request and write data into this request memory area +type RequestHandler func(c *Client, req request.Common) (request.Common, error) + +// HttpRequestHandler receive http request and return a new http request +type HttpRequestHandler func(c *Client, req *http.HttpRequest) (*http.HttpRequest, error) + +// ResponseHandler receive response and write data into this response memory area +type ResponseHandler func(c *Client, req request.Common, resp response.Common, err error) (response.Common, error) + +// HttpResponseHandler receive http response and return a new http response +type HttpResponseHandler func(c *Client, req *http.HttpRequest, resp *http.HttpResponse, err error) (*http.HttpResponse, error) + +var defaultRequestHandlers = []RequestHandler{} +var defaultHttpRequestHandlers = []HttpRequestHandler{} +var defaultResponseHandlers = []ResponseHandler{errorHandler, logHandler, retryHandler} +var defaultHttpResponseHandlers = []HttpResponseHandler{errorHTTPHandler, logDebugHTTPHandler} + +func retryHandler(c *Client, req request.Common, resp response.Common, err error) (response.Common, error) { + if !req.GetRetryable() || err == nil || !err.(uerr.Error).Retryable() { + return resp, err + } + + retryCount := req.GetRetryCount() + + // if max retries number is reached, stop and raise last error + if retryCount >= req.GetMaxretries() { + return resp, err + } + + req.SetRetryCount(retryCount + 1) + + // use exponential backoff constant as retry delay + delay := getExpBackoffDelay(retryCount) + <-time.After(delay) + + // the resp will be changed after invoke + err = c.InvokeAction(req.GetAction(), req, resp) + + return resp, err +} + +func getExpBackoffDelay(retryCount int) time.Duration { + minTime := 100 + if retryCount > 7 { + retryCount = 7 + } + + delay := (1 << (uint(retryCount) * 2)) * (rand.Intn(minTime) + minTime) + return time.Duration(delay) * time.Millisecond +} + +// errorHandler will normalize error to several specific error +func errorHandler(c *Client, req request.Common, resp response.Common, err error) (response.Common, error) { + if err != nil { + if _, ok := err.(uerr.Error); ok { + return resp, err + } + if uerr.IsNetworkError(err) { + return resp, uerr.NewClientError(uerr.ErrNetwork, err) + } + return resp, uerr.NewClientError(uerr.ErrSendRequest, err) + } + + if resp.GetRetCode() != 0 { + return resp, uerr.NewServerCodeError(resp.GetRetCode(), resp.GetMessage()) + } + + return resp, err +} + +func errorHTTPHandler(c *Client, req *http.HttpRequest, resp *http.HttpResponse, err error) (*http.HttpResponse, error) { + if err == nil { + return resp, err + } + + if statusErr, ok := err.(http.StatusError); ok { + return resp, uerr.NewServerStatusError(statusErr.StatusCode, statusErr.Message) + } + + return resp, err +} + +func logHandler(c *Client, req request.Common, resp response.Common, err error) (response.Common, error) { + action := req.GetAction() + + // get strictest logging level + level := c.config.GetActionLevel(action) + + if err != nil && level >= log.WarnLevel { + c.logger.Warnf("do %s failed, %s", action, err) + } else if level >= log.InfoLevel { + c.logger.Infof("do %s successful!", action) + } + return resp, err +} + +func logDebugHTTPHandler(c *Client, req *http.HttpRequest, resp *http.HttpResponse, err error) (*http.HttpResponse, error) { + action := req.GetQuery("Action") + + // logging request + c.logActionDebugf(action, "%s", req) + + // logging error + if err != nil { + c.logActionErrorf(action, "%s", err) + } + + // logging response code text + if resp != nil && resp.GetStatusCode() >= 400 { + c.logActionWarnf(action, "%s", resp.GetStatusCode()) + } + + // logging response body + if resp != nil && resp.GetStatusCode() < 400 { + c.logActionDebugf(action, "%s - %v", resp.GetBody(), resp.GetStatusCode()) + } + + return resp, err +} + +func (c *Client) logActionErrorf(action, format string, args ...interface{}) { + level := c.config.GetActionLevel(action) + + if log.ErrorLevel <= level { + c.logger.Errorf(format, args...) + } +} + +func (c *Client) logActionWarnf(action, format string, args ...interface{}) { + level := c.config.GetActionLevel(action) + + if log.WarnLevel <= level { + c.logger.Warnf(format, args...) + } +} + +func (c *Client) logActionDebugf(action, format string, args ...interface{}) { + level := c.config.GetActionLevel(action) + + if log.DebugLevel <= level { + c.logger.Debugf(format, args...) + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/log/logger.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/log/logger.go new file mode 100644 index 000000000..5bee2db44 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/log/logger.go @@ -0,0 +1,125 @@ +/* +Package log is the log utilities of sdk +*/ +package log + +import ( + "io" + "os" + + "github.com/sirupsen/logrus" +) + +// Logger is the interface of SDK +type Logger interface { + Debug(...interface{}) + Print(...interface{}) + Info(...interface{}) + Warn(...interface{}) + Warning(...interface{}) + Error(...interface{}) + Panic(...interface{}) + Fatal(...interface{}) + + Debugf(string, ...interface{}) + Printf(string, ...interface{}) + Infof(string, ...interface{}) + Warnf(string, ...interface{}) + Warningf(string, ...interface{}) + Errorf(string, ...interface{}) + Panicf(string, ...interface{}) + Fatalf(string, ...interface{}) + + SetOutput(io.Writer) + SetFormatter(Formatter) + SetLevel(Level) + GetLevel() Level +} + +// BasicLogger is the logger (wrapper for logrus) +type BasicLogger struct { + *logrus.Logger +} + +// Level is the log level of logger (wrapper for logrus) +type Level logrus.Level + +// Formatter is the formatter of logger (wrapper for logrus) +type Formatter logrus.Formatter + +// New will return a logger pointer +func New() *BasicLogger { + logger := &BasicLogger{logrus.New()} + logger.Out = os.Stdout + logger.Level = logrus.Level(DebugLevel) + logger.Formatter = &logrus.TextFormatter{ + DisableColors: false, + FullTimestamp: true, + } + return logger +} + +// SetOutput sets the logger output. +func (logger *BasicLogger) SetOutput(out io.Writer) { + logger.Out = out +} + +// SetFormatter sets the logger formatter. +func (logger *BasicLogger) SetFormatter(formatter Formatter) { + logger.Formatter = logrus.Formatter(formatter) +} + +// SetLevel sets the logger level. +func (logger *BasicLogger) SetLevel(level Level) { + logger.Level = logrus.Level(level) +} + +// GetLevel returns the logger level. +func (logger *BasicLogger) GetLevel() Level { + return Level(logger.Level) +} + +var ( + PanicLevel = Level(logrus.PanicLevel) + FatalLevel = Level(logrus.FatalLevel) + ErrorLevel = Level(logrus.ErrorLevel) + WarnLevel = Level(logrus.WarnLevel) + InfoLevel = Level(logrus.InfoLevel) + DebugLevel = Level(logrus.DebugLevel) + + SetLevel = func(level Level) { logrus.SetLevel(logrus.Level(level)) } + GetLevel = func() Level { return Level(logrus.GetLevel()) } + SetOutput = logrus.SetOutput + SetFormatter = logrus.SetFormatter + + WithError = logrus.WithError + WithField = logrus.WithField + + Debug = logrus.Debug + Print = logrus.Print + Info = logrus.Info + Warn = logrus.Warn + Warning = logrus.Warning + Error = logrus.Error + Panic = logrus.Panic + Fatal = logrus.Fatal + + Debugf = logrus.Debugf + Printf = logrus.Printf + Infof = logrus.Infof + Warnf = logrus.Warnf + Warningf = logrus.Warningf + Errorf = logrus.Errorf + Panicf = logrus.Panicf + Fatalf = logrus.Fatalf +) + +// Init (Deprecated) will init with level and default output (stdout) and formatter (text without color) to global logger +func Init(level Level) { + logrus.SetLevel(logrus.Level(level)) + logrus.SetOutput(os.Stdout) + logrus.SetFormatter(&logrus.TextFormatter{ + DisableColors: false, + FullTimestamp: true, + }) +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/marshaler.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/marshaler.go new file mode 100644 index 000000000..cf07e0d20 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/marshaler.go @@ -0,0 +1,84 @@ +package ucloud + +import ( + "encoding/json" + "fmt" + "runtime" + "strings" + + "github.com/pkg/errors" + + "github.com/ucloud/ucloud-sdk-go/private/protocol/http" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" + "github.com/ucloud/ucloud-sdk-go/ucloud/version" +) + +// SetupRequest will init request by client configuration +func (c *Client) SetupRequest(req request.Common) request.Common { + cfg := c.GetConfig() + + req.SetRetryable(true) + + // set optional client level variables + if len(req.GetRegion()) == 0 && len(cfg.Region) > 0 { + req.SetRegion(cfg.Region) + } + + if len(req.GetZone()) == 0 && len(cfg.Zone) > 0 { + req.SetZone(cfg.Zone) + } + + if len(req.GetProjectId()) == 0 && len(cfg.ProjectId) > 0 { + req.SetProjectId(cfg.ProjectId) + } + + if req.GetTimeout() == 0 && cfg.Timeout != 0 { + req.WithTimeout(cfg.Timeout) + } + + if req.GetMaxretries() == 0 && cfg.MaxRetries != 0 { + req.WithRetry(cfg.MaxRetries) + } + + return req +} + +func (c *Client) buildHTTPRequest(req request.Common) (*http.HttpRequest, error) { + // convert request struct to query map + query, err := request.ToQueryMap(req) + if err != nil { + return nil, errors.Errorf("convert request to map failed, %s", err) + } + + // check credential information is available + credential := c.GetCredential() + if credential == nil { + return nil, errors.Errorf("invalid credential information, please set it before request.") + } + + config := c.GetConfig() + httpReq := http.NewHttpRequest() + httpReq.SetURL(config.BaseUrl) + httpReq.SetMethod("POST") + + // set timeout with client configuration + httpReq.SetTimeout(config.Timeout) + + // keep query stirng is ordered and append credential signiture as the last query param + httpReq.SetQueryString(credential.BuildCredentialedQuery(query)) + + ua := fmt.Sprintf("GO/%s GO-SDK/%s %s", runtime.Version(), version.Version, config.UserAgent) + httpReq.SetHeader("User-Agent", strings.TrimSpace(ua)) + + return httpReq, nil +} + +// unmarshalHTTPResponse will get body from http response and unmarshal it's data into response struct +func (c *Client) unmarshalHTTPResponse(body []byte, resp response.Common) error { + if len(body) == 0 { + return nil + } + + return json.Unmarshal(body, &resp) +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/common.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/common.go new file mode 100644 index 000000000..62bddd859 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/common.go @@ -0,0 +1,214 @@ +/* +Package request is the request of service +*/ +package request + +import "time" + +// Common is the common request +type Common interface { + GetAction() string + SetAction(string) error + + GetActionRef() *string + SetActionRef(*string) error + + GetRegion() string + SetRegion(string) error + + GetRegionRef() *string + SetRegionRef(*string) error + + GetProjectId() string + SetProjectId(string) error + + GetProjectIdRef() *string + SetProjectIdRef(*string) error + + GetZone() string + SetZone(string) error + + GetZoneRef() *string + SetZoneRef(*string) error + + SetRetryCount(int) + GetRetryCount() int + + WithRetry(int) + GetMaxretries() int + + WithTimeout(time.Duration) + GetTimeout() time.Duration + + SetRequestTime(time.Time) + GetRequestTime() time.Time + + SetRetryable(retryable bool) + GetRetryable() bool +} + +// CommonBase is the base struct of common request +type CommonBase struct { + Action *string + Region *string + Zone *string + ProjectId *string + + maxRetries int + retryable bool + retryCount int + timeout time.Duration + requestTime time.Time + requestUUID string +} + +// SetRetryCount will set retry count of request +func (c *CommonBase) SetRetryCount(retryCount int) { + c.retryCount = retryCount +} + +// GetRetryCount will return retry count of request +func (c *CommonBase) GetRetryCount() int { + return c.retryCount +} + +// WithRetry will set max retry count of request +func (c *CommonBase) WithRetry(maxRetries int) { + c.maxRetries = maxRetries + c.retryable = true +} + +// GetMaxretries will return max retry count of request +func (c *CommonBase) GetMaxretries() int { + return c.maxRetries +} + +// SetRetryable will set if the request is retryable +func (c *CommonBase) SetRetryable(retryable bool) { + c.retryable = retryable +} + +// GetRetryable will return if the request is retryable +func (c *CommonBase) GetRetryable() bool { + return c.retryable +} + +// WithTimeout will set timeout of request +func (c *CommonBase) WithTimeout(timeout time.Duration) { + c.timeout = timeout +} + +// GetTimeout will get timeout of request +func (c *CommonBase) GetTimeout() time.Duration { + return c.timeout +} + +// SetRequestTime will set timeout of request +func (c *CommonBase) SetRequestTime(requestTime time.Time) { + c.requestTime = requestTime +} + +// GetRequestTime will get timeout of request +func (c *CommonBase) GetRequestTime() time.Time { + return c.requestTime +} + +// GetAction will return action of request +func (c *CommonBase) GetAction() string { + if c.Action == nil { + return "" + } + return *c.Action +} + +// SetAction will set action of request +func (c *CommonBase) SetAction(val string) error { + c.Action = &val + return nil +} + +// GetActionRef will return a pointer to action of request +func (c *CommonBase) GetActionRef() *string { + return c.Action +} + +// SetActionRef will set a pointer to action of request +func (c *CommonBase) SetActionRef(val *string) error { + c.Action = val + return nil +} + +// GetRegion will return region of request +func (c *CommonBase) GetRegion() string { + if c.Region == nil { + return "" + } + return *c.Region +} + +// SetRegion will set region of request +func (c *CommonBase) SetRegion(val string) error { + c.Region = &val + return nil +} + +// GetRegionRef will return a pointer to region of request +func (c *CommonBase) GetRegionRef() *string { + return c.Region +} + +// SetRegionRef will set a pointer to region of request +func (c *CommonBase) SetRegionRef(val *string) error { + c.Region = val + return nil +} + +// GetZone will return zone of request +func (c *CommonBase) GetZone() string { + if c.Zone == nil { + return "" + } + return *c.Zone +} + +// SetZone will set zone of request +func (c *CommonBase) SetZone(val string) error { + c.Zone = &val + return nil +} + +// GetZoneRef will return a pointer to zone of request +func (c *CommonBase) GetZoneRef() *string { + return c.Zone +} + +// SetZoneRef will set a pointer to zone of request +func (c *CommonBase) SetZoneRef(val *string) error { + c.Zone = val + return nil +} + +// GetProjectId will get project id of request +func (c *CommonBase) GetProjectId() string { + if c.ProjectId == nil { + return "" + } + return *c.ProjectId +} + +// SetProjectId will set project id of request +func (c *CommonBase) SetProjectId(val string) error { + c.ProjectId = &val + return nil +} + +// GetProjectIdRef will get a pointer to project id of request +func (c *CommonBase) GetProjectIdRef() *string { + return c.ProjectId +} + +// SetProjectIdRef will set a pointer to project id of request +func (c *CommonBase) SetProjectIdRef(val *string) error { + c.ProjectId = val + return nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/encoder.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/encoder.go new file mode 100644 index 000000000..f6c78f39d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/encoder.go @@ -0,0 +1,130 @@ +package request + +import ( + "errors" + "fmt" + "reflect" + "strconv" +) + +// ToQueryMap will convert a request to string map +func ToQueryMap(req Common) (map[string]string, error) { + v := reflect.ValueOf(req) + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + + return encode(&v, "") +} + +func encodeOne(v *reflect.Value) (string, error) { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return strconv.FormatInt(v.Int(), 10), nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32: + return strconv.FormatUint(v.Uint(), 10), nil + case reflect.Float32, reflect.Float64: + return strconv.FormatFloat(v.Float(), 'f', -1, 64), nil + case reflect.Bool: + return strconv.FormatBool(v.Bool()), nil + case reflect.String: + return v.String(), nil + case reflect.Ptr: + ptrValue := v.Elem() + return encodeOne(&ptrValue) + default: + message := fmt.Sprintf( + "Invalid variable type, type must be one of int-, uint-,"+ + " float-, bool, string and ptr, got %s", + v.Kind().String(), + ) + return "", errors.New(message) + } +} + +func encode(v *reflect.Value, prefix string) (map[string]string, error) { + result := make(map[string]string) + + for i := 0; i < v.NumField(); i++ { + f := v.Field(i) + name := v.Type().Field(i).Name + if prefix != "" && prefix != "CommonBase" { + name = fmt.Sprintf("%s.%s", prefix, name) + } + + // skip unexported field + if !f.CanSet() { + continue + } + + // find the real value of pointer + // such as **struct to struct + for f.Kind() == reflect.Ptr { + if f.IsNil() { + break + } + f = f.Elem() + } + + // check if non-pointer + if f.Kind() == reflect.Ptr && f.IsNil() { + continue + } + + switch f.Kind() { + case reflect.Slice, reflect.Array: + for i := 0; i < f.Len(); i++ { + item := f.Index(i) + if item.Kind() == reflect.Ptr && item.IsNil() { + continue + } + + keyPrefix := fmt.Sprintf("%s.%v", name, i) + + if item.Kind() == reflect.Struct { + kv, err := encode(&item, keyPrefix) + if err != nil { + return result, err + } + + for k, v := range kv { + if v != "" { + result[k] = v + } + } + } else { + s, err := encodeOne(&item) + if err != nil { + return result, err + } + + if s != "" { + result[keyPrefix] = s + } + } + } + case reflect.Struct: + m, err := encode(&f, name) + if err != nil { + return result, err + } + + // flatten composited struct into result map + for k, v := range m { + result[k] = v + } + default: + s, err := encodeOne(&f) + if err != nil { + return result, err + } + + // set field value into result + if s != "" { + result[name] = s + } + } + } + + return result, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/response/common.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/response/common.go new file mode 100644 index 000000000..1677a785c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/response/common.go @@ -0,0 +1,55 @@ +/* +Package response is the response of service +*/ +package response + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" +) + +// Common describe a response of action, +// it is only used for ucloud open api v1 via HTTP GET and action parameters. +type Common interface { + GetRetCode() int + GetMessage() string + GetAction() string + + GetRequest() request.Common + SetRequest(request.Common) +} + +// CommonBase has common attribute and method, +// it also implement ActionResponse interface. +type CommonBase struct { + Action string + RetCode int + Message string + + request request.Common +} + +// GetRetCode will return the error code of ucloud api +// Error is non-zero and success is zero +func (c *CommonBase) GetRetCode() int { + return c.RetCode +} + +// GetMessage will return the error message of ucloud api +func (c *CommonBase) GetMessage() string { + return c.Message +} + +// GetAction will return the request action of ucloud api +func (c *CommonBase) GetAction() string { + return c.Action +} + +// GetRequest will return the latest retried request of current action +func (c *CommonBase) GetRequest() request.Common { + return c.request +} + +// GetRequest will return the latest retried request of current action +func (c *CommonBase) SetRequest(req request.Common) { + c.request = req +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/schema.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/schema.go new file mode 100644 index 000000000..26ffec2de --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/schema.go @@ -0,0 +1,75 @@ +package ucloud + +import ( + "time" + + "github.com/ucloud/ucloud-sdk-go/ucloud/version" +) + +// Version is the version of sdk +const Version = version.Version + +// String will return a pointer to string +func String(val string) *string { + return &val +} + +// StringValue will return a string from string pointer +func StringValue(ptr *string) string { + if ptr != nil { + return *ptr + } + return "" +} + +// Int will return a pointer to int +func Int(val int) *int { + return &val +} + +// IntValue will return a int from int pointer +func IntValue(ptr *int) int { + if ptr != nil { + return *ptr + } + return 0 +} + +// Bool will return a pointer to bool +func Bool(val bool) *bool { + return &val +} + +// BoolValue will return a bool from bool pointer +func BoolValue(ptr *bool) bool { + if ptr != nil { + return *ptr + } + return false +} + +// Float64 will return a pointer to float64 +func Float64(val float64) *float64 { + return &val +} + +// Float64Value will return a float64 from float64 pointer +func Float64Value(ptr *float64) float64 { + if ptr != nil { + return *ptr + } + return 0.0 +} + +// TimeDuration will return a pointer to time.Duration +func TimeDuration(val time.Duration) *time.Duration { + return &val +} + +// TimeDurationValue will return a time.Duration from a time.Duration pointer +func TimeDurationValue(ptr *time.Duration) time.Duration { + if ptr != nil { + return *ptr + } + return 0 +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go new file mode 100644 index 000000000..c067977df --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go @@ -0,0 +1,7 @@ +/* +Package version is the version of sdk +*/ +package version + +// Version see also semantic version: https://semver.org/ +const Version = "0.8.7" diff --git a/vendor/modules.txt b/vendor/modules.txt index dd4d51609..a2ac4f6db 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -12,6 +12,7 @@ contrib.go.opencensus.io/exporter/ocagent github.com/1and1/oneandone-cloudserver-sdk-go # github.com/Azure/azure-sdk-for-go v30.0.0+incompatible github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute +github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage @@ -88,7 +89,7 @@ github.com/approvals/go-approval-tests/utils github.com/armon/go-metrics # github.com/armon/go-radix v1.0.0 github.com/armon/go-radix -# github.com/aws/aws-sdk-go v1.16.24 +# github.com/aws/aws-sdk-go v1.22.2 github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/ec2metadata github.com/aws/aws-sdk-go/aws/session @@ -126,10 +127,11 @@ github.com/aws/aws-sdk-go/private/protocol/eventstream github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi github.com/aws/aws-sdk-go/private/protocol/rest github.com/aws/aws-sdk-go/private/protocol/restxml +github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil github.com/aws/aws-sdk-go/service/s3/s3iface +github.com/aws/aws-sdk-go/service/sts/stsiface github.com/aws/aws-sdk-go/aws/credentials/endpointcreds github.com/aws/aws-sdk-go/private/protocol/query/queryutil -github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil github.com/aws/aws-sdk-go/private/protocol/json/jsonutil # github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d github.com/bgentry/go-netrc/netrc @@ -156,6 +158,12 @@ github.com/creack/goselect github.com/davecgh/go-spew/spew # github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/dgrijalva/jwt-go +# github.com/digitalocean/go-libvirt v0.0.0-20190626172931-4d226dd6c437 +github.com/digitalocean/go-libvirt +github.com/digitalocean/go-libvirt/internal/constants +github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2 +# github.com/digitalocean/go-qemu v0.0.0-20181112162955-dd7bb9c771b8 +github.com/digitalocean/go-qemu/qmp # github.com/digitalocean/godo v1.11.1 github.com/digitalocean/godo # github.com/docker/docker v0.0.0-20180422163414-57142e89befe @@ -166,6 +174,8 @@ github.com/dustin/go-humanize github.com/dylanmei/iso8601 # github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 github.com/dylanmei/winrmtest +# github.com/exoscale/egoscale v0.18.1 +github.com/exoscale/egoscale # github.com/fatih/camelcase v1.0.0 github.com/fatih/camelcase # github.com/fatih/color v1.7.0 @@ -191,6 +201,10 @@ github.com/gocolly/colly/debug github.com/gocolly/colly/storage # github.com/gofrs/flock v0.7.1 github.com/gofrs/flock +# github.com/gofrs/uuid v3.2.0+incompatible +github.com/gofrs/uuid +# github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 +github.com/golang-collections/collections/stack # github.com/golang/protobuf v1.3.1 github.com/golang/protobuf/proto github.com/golang/protobuf/ptypes/timestamp @@ -220,7 +234,7 @@ github.com/google/shlex github.com/google/uuid # github.com/googleapis/gax-go/v2 v2.0.3 github.com/googleapis/gax-go/v2 -# github.com/gophercloud/gophercloud v0.0.0-20180903124057-ea7289ebdf06 +# github.com/gophercloud/gophercloud v0.2.0 github.com/gophercloud/gophercloud github.com/gophercloud/gophercloud/openstack github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions @@ -259,7 +273,7 @@ github.com/hashicorp/errwrap github.com/hashicorp/go-checkpoint # github.com/hashicorp/go-cleanhttp v0.5.0 github.com/hashicorp/go-cleanhttp -# github.com/hashicorp/go-getter v1.2.0 +# github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e github.com/hashicorp/go-getter github.com/hashicorp/go-getter/helper/url # github.com/hashicorp/go-immutable-radix v1.0.0 @@ -306,11 +320,22 @@ github.com/hashicorp/vault/helper/compressutil github.com/hashicorp/vault/helper/strutil # github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d github.com/hashicorp/yamux -# github.com/hetznercloud/hcloud-go v1.12.0 +# github.com/hetznercloud/hcloud-go v1.15.1 github.com/hetznercloud/hcloud-go/hcloud github.com/hetznercloud/hcloud-go/hcloud/schema # github.com/hyperonecom/h1-client-go v0.0.0-20190122232013-cf38e8387775 github.com/hyperonecom/h1-client-go +# github.com/jdcloud-api/jdcloud-sdk-go v1.9.1-0.20190605102154-3d81a50ca961 +github.com/jdcloud-api/jdcloud-sdk-go/core +github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis +github.com/jdcloud-api/jdcloud-sdk-go/services/vm/client +github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models +github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis +github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/client +github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/models +github.com/jdcloud-api/jdcloud-sdk-go/services/common/models +github.com/jdcloud-api/jdcloud-sdk-go/services/charge/models +github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models # github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af github.com/jmespath/go-jmespath # github.com/joyent/triton-go v0.0.0-20180116165742-545edbe0d564 @@ -392,6 +417,9 @@ github.com/olekukonko/tablewriter # github.com/oracle/oci-go-sdk v1.8.0 github.com/oracle/oci-go-sdk/common github.com/oracle/oci-go-sdk/core +# github.com/outscale/osc-go v0.0.1 +github.com/outscale/osc-go/oapi +github.com/outscale/osc-go/utils # github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a github.com/packer-community/winrmcp/winrmcp # github.com/pierrec/lz4 v2.0.5+incompatible @@ -424,20 +452,34 @@ github.com/satori/go.uuid github.com/scaleway/scaleway-cli/pkg/api github.com/scaleway/scaleway-cli/pkg/utils github.com/scaleway/scaleway-cli/pkg/sshcommand -# github.com/sirupsen/logrus v1.2.0 +# github.com/sirupsen/logrus v1.3.0 github.com/sirupsen/logrus # github.com/stretchr/testify v1.3.0 github.com/stretchr/testify/assert github.com/stretchr/testify/require -# github.com/temoto/robotstxt v0.0.0-20180810133444-97ee4a9ee6ea +# github.com/temoto/robotstxt v1.1.1 github.com/temoto/robotstxt -# github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346 +# github.com/tencentcloud/tencentcloud-sdk-go v3.0.71+incompatible github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors +# github.com/ucloud/ucloud-sdk-go v0.8.7 +github.com/ucloud/ucloud-sdk-go/services/uaccount +github.com/ucloud/ucloud-sdk-go/services/uhost +github.com/ucloud/ucloud-sdk-go/services/unet +github.com/ucloud/ucloud-sdk-go/services/vpc +github.com/ucloud/ucloud-sdk-go/ucloud +github.com/ucloud/ucloud-sdk-go/ucloud/auth +github.com/ucloud/ucloud-sdk-go/ucloud/error +github.com/ucloud/ucloud-sdk-go/ucloud/request +github.com/ucloud/ucloud-sdk-go/ucloud/response +github.com/ucloud/ucloud-sdk-go/private/utils +github.com/ucloud/ucloud-sdk-go/ucloud/log +github.com/ucloud/ucloud-sdk-go/private/protocol/http +github.com/ucloud/ucloud-sdk-go/ucloud/version # github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1 github.com/ugorji/go/codec # github.com/ulikunitz/xz v0.5.5 diff --git a/version/version.go b/version/version.go index 410c3ad8f..79d338a57 100644 --- a/version/version.go +++ b/version/version.go @@ -9,7 +9,7 @@ import ( var GitCommit string // The main version number that is being run at the moment. -const Version = "1.4.2" +const Version = "1.4.4" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release diff --git a/website/config.rb b/website/config.rb index 3e39a9af1..0f15ee30e 100644 --- a/website/config.rb +++ b/website/config.rb @@ -2,7 +2,7 @@ set :base_url, "https://www.packer.io/" activate :hashicorp do |h| h.name = "packer" - h.version = "1.4.1" + h.version = "1.4.3" h.github_slug = "hashicorp/packer" h.website_root = "website" end diff --git a/website/source/docs/builders/amazon.html.md b/website/source/docs/builders/amazon.html.md index bbab565e8..0cfa0d98b 100644 --- a/website/source/docs/builders/amazon.html.md +++ b/website/source/docs/builders/amazon.html.md @@ -175,9 +175,9 @@ for Packer to work: Note that if you'd like to create a spot instance, you must also add: - ec2:RequestSpotInstances, - ec2:CancelSpotInstanceRequests, - ec2:DescribeSpotInstanceRequests + ec2:CreateLaunchTemplate, + ec2:DeleteLaunchTemplate, + ec2:CreateFleet If you have the `spot_price` parameter set to `auto`, you must also add: diff --git a/website/source/docs/builders/azure.html.md.erb b/website/source/docs/builders/azure.html.md.erb index 782f8a974..39168f003 100644 --- a/website/source/docs/builders/azure.html.md.erb +++ b/website/source/docs/builders/azure.html.md.erb @@ -104,20 +104,19 @@ When creating a managed image the following options are required. `managed_image_name` must also be set. See [documentation](https://docs.microsoft.com/en-us/azure/storage/storage-managed-disks-overview#images) to learn more about managed images. - - + + Managed images can optionally be published to [Shared Image Gallery](https://azure.microsoft.com/en-us/blog/announcing-the-public-preview-of-shared-image-gallery/) as Shared Gallery Image version. Shared Image Gallery **only** works with Managed Images. **A VHD cannot be published to a Shared Image Gallery**. When publishing to a Shared Image Gallery the following options are required. - + - `shared_image_gallery_destination` (object) The name of the Shared Image Gallery under which the managed image will be published as Shared Gallery Image version. - + Following is an example. - + "shared_image_gallery_destination": { - "subscription": "00000000-0000-0000-0000-00000000000", "resource_group": "ResourceGroup", "gallery_name": "GalleryName", "image_name": "ImageName", diff --git a/website/source/docs/builders/digitalocean.html.md b/website/source/docs/builders/digitalocean.html.md index 1d382869d..8df5c9df0 100644 --- a/website/source/docs/builders/digitalocean.html.md +++ b/website/source/docs/builders/digitalocean.html.md @@ -83,6 +83,10 @@ builder. droplet to enter a desired state (such as "active") before timing out. The default state timeout is "6m". +- `snapshot_timeout` (string) - The time to wait, as a duration string, for a + snapshot action to complete (e.g snapshot creation) before timing out. The + default snapshot timeout is "60m". + - `user_data` (string) - User data to launch with the Droplet. Packer will not automatically wait for a user script to finish before shutting down the instance this must be handled in a provisioner. diff --git a/website/source/docs/builders/hetzner-cloud.html.md b/website/source/docs/builders/hetzner-cloud.html.md index 71b710b1b..54c9e1ffb 100644 --- a/website/source/docs/builders/hetzner-cloud.html.md +++ b/website/source/docs/builders/hetzner-cloud.html.md @@ -38,7 +38,8 @@ builder. - `token` (string) - The client TOKEN to use to access your account. It can also be specified via environment variable `HCLOUD_TOKEN`, if set. -- `image` (string) - ID or name of image to launch server from. +- `image` (string) - ID or name of image to launch server from. Alternatively + you can use `image_filter`. - `location` (string) - The name of the location to launch the server in. @@ -51,6 +52,34 @@ builder. using a Hetzner Cloud API compatible service. It can also be specified via environment variable `HCLOUD_ENDPOINT`. +- `image_filter` (object) - Filters used to populate the `filter` + field. Example: + + ``` json + { + "image_filter": { + "with_selector": [ + "name==my-image" + ], + "most_recent": true + } + ``` + + This selects the most recent image with the label `name==my-image`. NOTE: + This will fail unless *exactly* one AMI is returned. In the above example, + `most_recent` will cause this to succeed by selecting the newest image. + + - `with_selector` (list of strings) - label selectors used to select an + `image`. NOTE: This will fail unless *exactly* one image is returned. + Check the official hcloud docs on + [Label Selectors](https://docs.hetzner.cloud/#overview-label-selector) + for more info. + + - `most_recent` (boolean) - Selects the newest created image when true. + This is most useful if you base your image on another packer build image. + + You may set this in place of `image`, but not both. + - `server_name` (string) - The name assigned to the server. The Hetzner Cloud sets the hostname of the machine to this value. diff --git a/website/source/docs/builders/hyperv-vmcx.html.md.erb b/website/source/docs/builders/hyperv-vmcx.html.md.erb index c1301d01b..19a1f441b 100644 --- a/website/source/docs/builders/hyperv-vmcx.html.md.erb +++ b/website/source/docs/builders/hyperv-vmcx.html.md.erb @@ -33,7 +33,7 @@ Import from folder: ``` json { "type": "hyperv-vmcx", - "clone_from_vmcx_path": "c:/virtual machines/ubuntu-12.04.5-server-amd64", + "clone_from_vmcx_path": "c:/path/to/ubuntu-12.04.5-server-amd64", "ssh_username": "packer", "ssh_password": "packer", "shutdown_command": "echo 'packer' | sudo -S shutdown -P now" @@ -87,6 +87,10 @@ builder. previously exported virtual machine. The exported machine will be used as the source for new VM. + note: You should provide the named directory that contains the + "Virtual Machines", "Snapshots", and/or "Virtual Hard Disks" subdirectories, + not the .vmcx file itself. + ### Required for virtual machine clone: @@ -140,7 +144,7 @@ builder. - `configuration_version` (string) - This allows you to set the vm version when calling New-VM to generate the vm. -- `cpu` (number) - The number of CPUs the virtual machine should use. If +- `cpus` (number) - The number of CPUs the virtual machine should use. If this isn't specified, the default is 1 CPU. - `enable_dynamic_memory` (boolean) - If `true` enable dynamic memory for @@ -407,7 +411,7 @@ Packer config: "winrm_timeout" : "4h", "shutdown_command": "f:\\run-sysprep.cmd", "memory": 4096, - "cpu": 4, + "cpus": 4, "generation": 2, "switch_name":"LAN", "enable_secure_boot":true diff --git a/website/source/docs/builders/jdcloud.html.md b/website/source/docs/builders/jdcloud.html.md new file mode 100644 index 000000000..313da268c --- /dev/null +++ b/website/source/docs/builders/jdcloud.html.md @@ -0,0 +1,80 @@ +--- +description: | + The `jdcloud` Packer builder helps you to build instance images + based on an existing image +layout: docs +page_title: 'JDCloud Image Builder' +sidebar_current: 'docs-builders-jdcloud' +--- + +# JDCloud Image Builder + +Type: `jdcloud` + +The `jdcloud` Packer builder helps you to build instance images +based on an existing image + +## Configuration Reference + +In order to build a JDCloud instance image, full-fill your configuration file. Necessary attributes +are given below: + +### Required-Parameters: + +- `type` (string) - This parameter tells which cloud-service-provider you are using, in our case, use 'jdcloud' +- `image_id` (string) - New image is generated based on an old one, specify the base-image-id here. +- `access_key` (string) - Your JD Cloud access key. You may set this as an env-variable:`export JDCLOUD_ACCESS_KEY=xxx` +- `secret_key` (string) - Your JD Cloud secret key. You may also set this via env-variable:`export JDCLOUD_SECRET_KEY=xxx` +- `region_id` (string) - Region of your instance, candidates are {"cn-north-1","cn-south-1","cn-east-1","cn-east-2"} +- `az` (string) - Exact availability zone of instance, 'cn-north-1c' for example +- `instance_name` (string) - Name your instance +- `instance_type` (string) - Class of your expected instance +- `image_name` (string) - Name the image you would like to create +- `communicator` (string) - Currently only `ssh` is supported. `winrm` will be added if required + +### Optional-Parameters + +- `subnet_id` (string) - An instance is supposed to exists in an subnet, if not specified , we will create new one for you + + +## Examples + +Here is a basic example for JDCloud. + +``` json +{ + "builders": [ + { + "type": "jdcloud", + "image_id": "img-h8ly274zg9", + "access_key": "", + "secret_key": "", + "region_id": "cn-north-1", + "az": "cn-north-1c", + "instance_name": "created_by_packer", + "instance_type": "g.n2.medium", + "ssh_password":"/Users/mac/.ssh/id_rsa", + "ssh_keypair_name":"created_by_xiaohan", + "image_name": "packerImage", + "subnet_id": "subnet-jo6e38sdli", + "communicator":"ssh", + "ssh_username": "root", + } + ], + + "provisioners": [ + { + "type": "shell", + "inline": [ + "sleep 3", + "echo 123", + "pwd" + ] + } + ] +} + + +``` + +[Find more examples](https://github.com/hashicorp/packer/tree/master/examples/jdcloud) diff --git a/website/source/docs/builders/osc-bsu.html.md b/website/source/docs/builders/osc-bsu.html.md new file mode 100644 index 000000000..bdccee342 --- /dev/null +++ b/website/source/docs/builders/osc-bsu.html.md @@ -0,0 +1,355 @@ +--- +description: | + The osc-bsu Packer builder is able to create Outscale OMIs backed by BSU volumes for use in Outscale. For more information on the difference between + BSU-backed VMs and VM-store backed VMs, see the storage for + the root device section in the Outscale documentation. +layout: docs +page_title: 'Outscale BSU - Builders' +sidebar_current: 'docs-builders-osc-bsubacked' +--- + +# OMI Builder (BSU backed) + +Type: `osc-bsu` + +The `osc-bsu` Packer builder is able to create Outscale OMIs backed by BSU +volumes for use in [Flexible Compute Unit](https://wiki.outscale.net/pages/viewpage.action?pageId=43060893). For more information on +the difference between BSU-backed VMs and VM-store backed +VMs, see the ["storage for the root device" section in the Outscale +documentation](https://wiki.outscale.net/display/EN/Defining+Block+Device+Mappings). + +This builder builds an OMI by launching an Outscale VM from a source OMI, +provisioning that running machine, and then creating an OMI from that machine. +This is all done in your own Outscale account. The builder will create temporary +keypairs, security group rules, etc. that provide it temporary access to the +VM while the image is being created. This simplifies configuration quite +a bit. + +The builder does *not* manage OMIs. Once it creates an OMI and stores it in +your account, it is up to you to use, delete, etc. the OMI. + +-> **Note:** Temporary resources are, by default, all created with the +prefix `packer`. This can be useful if you want to restrict the security groups +and key pairs Packer is able to operate on. + +## Configuration Reference + +There are many configuration options available for the builder. They are +segmented below into two categories: required and optional parameters. Within +each category, the available configuration keys are alphabetized. + +In addition to the options listed here, a +[communicator](../templates/communicator.html) can be configured for this +builder. + +### Required: + +- `access_key` (string) - The access key used to communicate with OUTSCALE. [Learn how to set this](outscale.html#authentication) + +- `omi_name` (string) - The name of the resulting OMIS that will appear when managing OMIs in the Outscale console or via APIs. This must be unique. To help make this unique, use a function like `timestamp` (see [template engine](../templates/engine.html) for more info). + +- `vm_type` (string) - The Outscale VM type to use while building the OMI, such as `t2.small`. + +- `region` (string) - The name of the region, such as `us-east-1`, in which to launch the Outscale VM to create the OMI. + +- `secret_key` (string) - The secret key used to communicate with Outscale. [Learn how to set this](outscale.html#authentication) + +- `source_omi` (string) - The initial OMI used as a base for the newly created machine. `source_omi_filter` may be used instead to populate this automatically. + +### Optional: + +- `omi_block_device_mappings` (array of block device mappings) - Add one or more [block device mappings](https://wiki.outscale.net/display/EN/Defining+Block+Device+Mappings) to the OMI. These will be attached when booting a new VM from your OMI. To add a block device during the Packer build see `launch_block_device_mappings` below. Your options here may vary depending on the type of VM you use. The block device mappings allow for the following configuration: + + - `delete_on_vm_deletion` (boolean) - Indicates whether the BSU volume is deleted on VM termination. Default `false`. **NOTE**: If this value is not explicitly set to `true` and volumes are not cleaned up by an alternative method, additional volumes will accumulate after every build. + + - `device_name` (string) - The device name exposed to the VM (for example, `/dev/sdh` or `xvdh`). Required for every device in the block device mapping. + + - `iops` (number) - The number of I/O operations per second (IOPS) that the volume supports. See the documentation on + [IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS) + for more information + + - `no_device` (boolean) - Suppresses the specified device included in the + block device mapping of the OMI + + - `snapshot_id` (string) - The ID of the snapshot + + - `virtual_name` (string) - The virtual device name. See the documentation on [Block Device Mapping](https://wiki.outscale.net/display/EN/Defining+Block+Device+Mappings) for more information + + - `volume_size` (number) - The size of the volume, in GiB. Required if not specifying a `snapshot_id` + + - `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes + +- `omi_description` (string) - The description to set for the resulting OMI(s). By default this description is empty. This is a [template engine](../templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `omi_account_ids` (array of strings) - A list of account IDs that have access to launch the resulting OMI(s). By default no additional users other than the user creating the OMIS has permissions to launch it. + +- `omi_virtualization_type` (string) - The type of virtualization for the OMI you are building. This option must match the supported virtualization type of `source_omi`. Can be `paravirtual` or `hvm`. + +- `associate_public_ip_address` (boolean) - If using a non-default Net, public IP addresses are not provided by default. If this is toggled, your new VM will get a Public IP. + +- `subregion_name` (string) - Destination subregion to launch VM in. Leave this empty to allow Outscale to auto-assign. + +- `custom_endpoint_oapi` (string) - This option is useful if you use a cloud + provider whose API is compatible with Outscale OAPI. Specify another endpoint + like this `outscale.com/oapi/latest`. + +- `disable_stop_vm` (boolean) - Packer normally stops the build + VM after all provisioners have run. For Windows VMs, it is + sometimes desirable to [run Sysprep](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc721940(v=ws.10)) which will stop the VM for you. If this is set to `true`, Packer + *will not* stop the VM but will assume that you will send the stop + signal yourself through your final provisioner. You can do this with a + [windows-shell provisioner](https://www.packer.io/docs/provisioners/windows-shell.html). + + Note that Packer will still wait for the VM to be stopped, and + failing to send the stop signal yourself, when you have set this flag to + `true`, will cause a timeout. + +- `bsu_optimized` (boolean) - If true, the VM is created with optimized BSU I/O. + +- `force_delete_snapshot` (boolean) - Force Packer to delete snapshots + associated with OMIs, which have been deregistered by `force_deregister`. + Default `false`. + +- `force_deregister` (boolean) - Force Packer to first deregister an existing + OMIS if one with the same name already exists. Default `false`. + +- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS + verification of the OAPI endpoint. The default is `false`. + +- `launch_block_device_mappings` (array of block device mappings) - Add one + or more block devices before the Packer build starts. If you add VM + store volumes or BSU volumes in addition to the root device volume, the + created OMIS will contain block device mapping information for those + volumes. Outscale creates snapshots of the source VM's root volume and + any other BSU volumes described here. When you launch an VM from this + new OMI, the VM automatically launches with these additional volumes, + and will restore them from snapshots taken from the source VM. + +- `run_tags` (object of key/value strings) - Tags to apply to the VM + that is *launched* to create the OMI. These tags are *not* applied to the + resulting OMIS unless they're duplicated in `tags`. This is a [template + engine](../templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `run_volume_tags` (object of key/value strings) - Tags to apply to the + volumes that are *launched* to create the OMI. These tags are *not* applied + to the resulting OMIS unless they're duplicated in `tags`. This is a + [template engine](../templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `security_group_id` (string) - The ID (*not* the name) of the security + group to assign to the VM. By default this is not set and Packer will + automatically create a new temporary security group to allow SSH access. + Note that if this is specified, you must be sure the security group allows + access to the `ssh_port` given below. + +- `security_group_ids` (array of strings) - A list of security groups as + described above. Note that if this is specified, you must omit the + `security_group_id`. + +- `shutdown_behavior` (string) - Automatically terminate VMs on + shutdown in case Packer exits ungracefully. Possible values are "stop" and + "terminate", default is `stop`. + +- `skip_region_validation` (boolean) - Set to true if you want to skip + validation of the region configuration option. Default `false`. + +- `snapshot_groups` (array of strings) - A list of groups that have access to + create volumes from the snapshot(s). By default no groups have permission + to create volumes from the snapshot(s). `all` will make the snapshot + publicly accessible. + +- `snapshot_users` (array of strings) - A list of account IDs that have + access to create volumes from the snapshot(s). By default no additional + users other than the user creating the OMIS has permissions to create + volumes from the backing snapshot(s). + +- `snapshot_tags` (object of key/value strings) - Tags to apply to snapshot. + They will override OMIS tags if already applied to snapshot. This is a + [template engine](../templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `source_omi_filter` (object) - Filters used to populate the `source_omi` field. + - `filters` (map of strings) - filters used to select a `source_omi`. + - `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons. + + Example: + + ``` json + { + "source_omi_filter": { + "filters": { + "virtualization-type": "hvm", + "image-name": "image-name-in-account", + "root-device-type": "ebs" + }, + "owners": ["099720109477"], + } + } + ``` + + This selects an Ubuntu 16.04 HVM BSU OMIS from Canonical. NOTE: + This will fail unless *exactly* one OMIS is returned. In the above example, + `most_recent` will cause this to succeed by selecting the newest image. + +- `ssh_keypair_name` (string) - If specified, this is the key that will be used for SSH with the machine. The key must match a key pair name loaded up into Outscale. By default, this is blank, and Packer will generate a temporary keypair unless [`ssh_password`](../templates/communicator.html#ssh_password) is used. [`ssh_private_key_file`](../templates/communicator.html#ssh_private_key_file) or `ssh_agent_auth` must be specified when `ssh_keypair_name` is utilized. + +- `ssh_agent_auth` (boolean) - If true, the local SSH agent will be used to authenticate connections to the source VM. No temporary keypair will be created, and the values of `ssh_password` and `ssh_private_key_file` will be ignored. To use this option with a key pair already configured in the source OMI, leave the `ssh_keypair_name` blank. To associate an existing key pair in Outscale with the source VM, set the `ssh_keypair_name` field to the name of the key pair. + +- `ssh_interface` (string) - One of `public_ip`, `private_ip`, `public_dns`, or `private_dns`. If set, either the public IP address, private IP address, public DNS name or private DNS name will used as the host for SSH. The default behaviour if inside a Net is to use the public IP address if available, otherwise the private IP address will be used. If not in a Net the public DNS name will be used. Also works for WinRM. + + Where Packer is configured for an outbound proxy but WinRM traffic should be direct, `ssh_interface` must be set to `private_dns` and `.compute.internal` included in the `NO_PROXY` environment variable. + +- `subnet_id` (string) - If using Net, the ID of the subnet, such as `subnet-12345def`, where Packer will launch the VM. This field is required if you are using an non-default Net. + +- `tags` (object of key/value strings) - Tags applied to the OMIS and relevant snapshots. This is a [template engine](../templates/engine.html), see [Build template data](#build-template-data) for more information. + +- `temporary_key_pair_name` (string) - The name of the temporary key pair to generate. By default, Packer generates a name that looks like `packer_`, where <UUID> is a 36 character unique identifier. + +- `temporary_security_group_source_cidr` (string) - An IPv4 CIDR block to be authorized access to the VM, when packer is creating a temporary security group. The default is `0.0.0.0/0` (i.e., allow any IPv4 source). This is only used when `security_group_id` or `security_group_ids` is not specified. + +- `user_data` (string) - User data to apply when launching the VM. Note that you need to be careful about escaping characters due to the templates being JSON. It is often more convenient to use `user_data_file`, instead. Packer will not automatically wait for a user script to finish before shutting down the VM this must be handled in a provisioner. + +- `user_data_file` (string) - Path to a file that will be used for the user data when launching the VM. + +- `net_id` (string) - If launching into a Net subnet, Packer needs the Net ID in order to create a temporary security group within the Net. Requires `subnet_id` to be set. If this field is left blank, Packer will try to get the Net ID from the `subnet_id`. + +- `net_filter` (object) - Filters used to populate the `net_id` field. + Example: + + ``` json + { + "net_filter": { + "filters": { + "is-default": "false", + "ip-range": "/24" + } + } + } + ``` + + This selects the Net with a IPv4 CIDR block of `/24`. NOTE: This will fail unless *exactly* one Net is returned. + + - `filters` (map of strings) - filters used to select a `vpc_id`. NOTE: This will fail unless *exactly* one Net is returned. + + `net_id` take precedence over this. + +- `windows_password_timeout` (string) - The timeout for waiting for a Windows password for Windows VMs. Defaults to 20 minutes. Example value: `10m` + +## Basic Example + +Here is a basic example. You will need to provide access keys, and may need to change the OMIS IDs according to what images exist at the time the template is run: + +```json +{ + "variables": { + "access_key": "{{env `OUTSCALE_ACCESSKEYID`}}", + "secret_key": "{{env `OUTSCALE_SECRETKEYID`}}" + }, + "builders": [ + { + "type": "osc-bsu", + "access_key": "{{user `access_key`}}", + "secret_key": "{{user `secret_key`}}", + "region": "us-east-1", + "source_omi": "ami-abcfd0283", + "vm_type": "t2.micro", + "ssh_username": "outscale", + "omi_name": "packer_osc {{timestamp}}" + } + ] +} +``` + +-> **Note:** Packer can also read the access key and secret access key from +environmental variables. See the configuration reference in the section above +for more information on what environmental variables Packer will look for. + +Further information on locating OMIS IDs and their relationship to VM +types and regions can be found in the Outscale Documentation [reference](https://wiki.outscale.net/display/EN/Official+OMIs+Reference). + +## Accessing the Instance to Debug + +If you need to access the VM to debug for some reason, run the builder +with the `-debug` flag. In debug mode, the Outscale builder will save the private key in the current directory and will output the DNS or IP information as well. +You can use this information to access the VM as it is running. + +## OMIS Block Device Mappings Example + +Here is an example using the optional OMIS block device mappings. Our +configuration of `launch_block_device_mappings` will expand the root volume +(`/dev/sda`) to 40gb during the build (up from the default of 8gb). With +`ami_block_device_mappings` Outscale will attach additional volumes `/dev/sdb` and +`/dev/sdc` when we boot a new VM of our OMI. + +``` json +{ + "type": "osc-bsu", + "access_key": "YOUR KEY HERE", + "secret_key": "YOUR SECRET KEY HERE", + "region": "us-east-1", + "source_omi": "ami-fce3c696", + "vm_type": "t2.micro", + "ssh_username": "ubuntu", + "omi_name": "packer-quick-start {{timestamp}}", + "launch_block_device_mappings": [ + { + "device_name": "/dev/sda1", + "volume_size": 40, + "volume_type": "gp2", + "delete_on_vm_deletion": true + } + ], + "omi_block_device_mappings": [ + { + "device_name": "/dev/sdb", + "virtual_name": "ephemeral0" + }, + { + "device_name": "/dev/sdc", + "virtual_name": "ephemeral1" + } + ] +} +``` + +## Build template data + +In configuration directives marked as a template engine above, the following variables are available: + +- `BuildRegion` - The region (for example `eu-west-2`) where Packer is building the OMI. +- `SourceOMI` - The source OMIS ID (for example `ami-a2412fcd`) used to build the OMI. +- `SourceOMIName` - The source OMIS Name (for example `ubutu-390`) used to build the OMI. +- `SourceOMITags` - The source OMIS Tags, as a `map[string]string` object. + +## Tag Example + +Here is an example using the optional OMIS tags. This will add the tags `OS_Version` and `Release` to the finished OMI. As before, you will need to provide your access keys, and may need to change the source OMIS ID based on what images exist when this template is run: + +``` json +{ + "type": "osc-bsu", + "access_key": "YOUR KEY HERE", + "secret_key": "YOUR SECRET KEY HERE", + "region": "us-east-1", + "source_omi": "ami-fce3c696", + "vm_type": "t2.micro", + "ssh_username": "ubuntu", + "omi_name": "packer-quick-start {{timestamp}}", + "tags": { + "OS_Version": "Ubuntu", + "Release": "Latest", + "Base_OMI_Name": "{{ .SourceOMIName }}", + "Extra": "{{ .SourceOMITags.TagName }}" + } +} +``` + +-> **Note:** Packer uses pre-built OMIs as the source for building images. +These source OMIs may include volumes that are not flagged to be destroyed on +termination of the VM building the new image. Packer will attempt to +clean up all residual volumes that are not designated by the user to remain +after termination. If you need to preserve those source volumes, you can +overwrite the termination setting by specifying `delete_on_vm_deletion=false` +in the `launch_block_device_mappings` block for the device. diff --git a/website/source/docs/builders/osc-bsusurrogate.html.md b/website/source/docs/builders/osc-bsusurrogate.html.md new file mode 100644 index 000000000..b9d6a7a2f --- /dev/null +++ b/website/source/docs/builders/osc-bsusurrogate.html.md @@ -0,0 +1,309 @@ +--- +description: | + The osc-bsusurrogate Packer builder is like the chroot builder, but does not + require running inside an Outscale virtual machine. +layout: docs +page_title: 'Outacale BSU Surrogate - Builders' +sidebar_current: 'docs-builders-osc-bsusurrogate' +--- + +# BSU Surrogate Builder + +Type: `osc-bsusurrogate` + +The `osc-bsusurrogate` Packer builder is able to create Outscale OMIs by +running a source virtual machine with an attached volume, provisioning the attached +volume in such a way that it can be used as the root volume for the OMI, and +then snapshotting and creating the OMI from that volume. + +This builder can therefore be used to bootstrap scratch-build images - for +example FreeBSD or Ubuntu using ZFS as the root file system. + +This is all done in your own Outscale account. This builder will create temporary +key pairs, security group rules, etc., that provide it temporary access to the +virtual machine while the image is being created. + +## Configuration Reference + +There are many configuration options available for this builder. They are +segmented below into two categories: required and optional parameters. Within +each category, the available configuration keys are alphabetized. + +In addition to the options listed here, a +[communicator](/docs/templates/communicator.html) can be configured for this +builder. + +### Required: + +- `access_key` (string) - The access key used to communicate with OUTSCALE. [Learn how to set this](outscale.html#authentication) + +- `omi_name` (string) - The name of the resulting OMIS that will appear when managing OMIs in the Outscale console or via APIs. This must be unique. To help make this unique, use a function like `timestamp` (see [template engine](../templates/engine.html) for more info). + +- `vm_type` (string) - The Outscale VM type to use while building the OMI, such as `t2.small`. + +- `region` (string) - The name of the region, such as `us-east-1`, in which to launch the Outscale VM to create the OMI. + +- `secret_key` (string) - The secret key used to communicate with Outscale. [Learn how to set this](outscale.html#authentication) + +- `source_omi` (string) - The initial OMI used as a base for the newly created machine. `source_omi_filter` may be used instead to populate this automatically. + +- `omi_root_device` (block device mapping) - A block device mapping + describing the root device of the OMI. This looks like the mappings in + `omi_block_device_mapping`, except with an additional field: + + - `source_device_name` (string) - The device name of the block device on + the source virtual machine to be used as the root device for the OMI. This + must correspond to a block device in `launch_block_device_mapping`. + +### Optional: + +- `omi_block_device_mappings` (array of block device mappings) - Add one or more [block device mappings](https://wiki.outscale.net/display/EN/Defining+Block+Device+Mappings) to the OMI. These will be attached when booting a new VM from your OMI. To add a block device during the Packer build see `launch_block_device_mappings` below. Your options here may vary depending on the type of VM you use. The block device mappings allow for the following configuration: + + - `delete_on_vm_deletion` (boolean) - Indicates whether the BSU volume is deleted on VM termination. Default `false`. **NOTE**: If this value is not explicitly set to `true` and volumes are not cleaned up by an alternative method, additional volumes will accumulate after every build. + + - `device_name` (string) - The device name exposed to the VM (for example, `/dev/sdh` or `xvdh`). Required for every device in the block device mapping. + + - `iops` (number) - The number of I/O operations per second (IOPS) that the volume supports. See the documentation on + [IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS) + for more information. + + - `no_device` (boolean) - Suppresses the specified device included in the + block device mapping of the OMI. + + - `snapshot_id` (string) - The ID of the snapshot + + - `virtual_name` (string) - The virtual device name. See the documentation on [Block Device Mapping](https://wiki.outscale.net/display/EN/Defining+Block+Device+Mappings) for more information. + + - `volume_size` (number) - The size of the volume, in GiB. Required if not specifying a `snapshot_id` + + - `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes + +- `omi_description` (string) - The description to set for the resulting OMI(s). By default this description is empty. This is a [template engine](../templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `omi_account_ids` (array of strings) - A list of account IDs that have access to launch the resulting OMI(s). By default no additional users other than the user creating the OMIS has permissions to launch it. + +- `omi_virtualization_type` (string) - The type of virtualization for the OMI you are building. This option must match the supported virtualization type of `source_omi`. Can be `paravirtual` or `hvm`. + +- `associate_public_ip_address` (boolean) - If using a non-default Net, public IP addresses are not provided by default. If this is toggled, your new VM will get a Public IP. + +- `subregion_name` (string) - Destination subregion to launch VM in. Leave this empty to allow Outscale to auto-assign. + +- `custom_endpoint_oapi` (string) - This option is useful if you use a cloud + provider whose API is compatible with Outscale OAPI. Specify another endpoint + like this `outscale.com/oapi/latest`. + +- `disable_stop_vm` (boolean) - Packer normally stops the build + VM after all provisioners have run. For Windows VMs, it is + sometimes desirable to [run Sysprep](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc721940(v=ws.10)) which will stop the VM for you. If this is set to `true`, Packer + *will not* stop the VM but will assume that you will send the stop + signal yourself through your final provisioner. You can do this with a + [windows-shell provisioner](https://www.packer.io/docs/provisioners/windows-shell.html). + + Note that Packer will still wait for the VM to be stopped, and + failing to send the stop signal yourself, when you have set this flag to + `true`, will cause a timeout. + +- `bsu_optimized` (boolean) - If true, the VM is created with optimized BSU I/O. + +- `force_deregister` (boolean) - Force Packer to first deregister an existing + OMI if one with the same name already exists. Default `false`. + +- `force_delete_snapshot` (boolean) - Force Packer to delete snapshots + associated with OMIs, which have been deregistered by `force_deregister`. + Default `false`. + +- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS + verification of the OAPI endpoint. The default is `false`. + +- `launch_block_device_mappings` (array of block device mappings) - Add one + or more block devices before the Packer build starts. If you add VM + store volumes or BSU volumes in addition to the root device volume, the + created OMIS will contain block device mapping information for those + volumes. Outscale creates snapshots of the source VM's root volume and + any other BSU volumes described here. When you launch an VM from this + new OMI, the VM automatically launches with these additional volumes, + and will restore them from snapshots taken from the source VM. + + - `delete_on_vm_deletion` (boolean) - Indicates whether the BSU volume is deleted on VM termination. Default `false`. **NOTE**: If this value is not explicitly set to `true` and volumes are not cleaned up by an alternative method, additional volumes will accumulate after every build. + + - `device_name` (string) - The device name exposed to the VM (for example, `/dev/sdh` or `xvdh`). Required for every device in the block device mapping. + + - `iops` (number) - The number of I/O operations per second (IOPS) that the volume supports. See the documentation on + [IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS) + for more information. + + - `volume_size` (number) - The size of the volume, in GiB. Required if not specifying a `snapshot_id` + + - `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes + +- `run_tags` (object of key/value strings) - Tags to apply to the VM + that is *launched* to create the OMI. These tags are *not* applied to the + resulting OMIS unless they're duplicated in `tags`. This is a [template + engine](../templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `run_volume_tags` (object of key/value strings) - Tags to apply to the + volumes that are *launched* to create the OMI. These tags are *not* applied + to the resulting OMIS unless they're duplicated in `tags`. This is a + [template engine](../templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `security_group_id` (string) - The ID (*not* the name) of the security + group to assign to the VM. By default this is not set and Packer will + automatically create a new temporary security group to allow SSH access. + Note that if this is specified, you must be sure the security group allows + access to the `ssh_port` given below. + +- `security_group_ids` (array of strings) - A list of security groups as + described above. Note that if this is specified, you must omit the + `security_group_id`. + +- `shutdown_behavior` (string) - Automatically terminate VMs on + shutdown in case Packer exits ungracefully. Possible values are "stop" and + "terminate", default is `stop`. + +- `skip_region_validation` (boolean) - Set to true if you want to skip + validation of the region configuration option. Default `false`. + +- `snapshot_groups` (array of strings) - A list of groups that have access to + create volumes from the snapshot(s). By default no groups have permission + to create volumes from the snapshot(s). `all` will make the snapshot + publicly accessible. + +- `snapshot_users` (array of strings) - A list of account IDs that have + access to create volumes from the snapshot(s). By default no additional + users other than the user creating the OMIS has permissions to create + volumes from the backing snapshot(s). + +- `snapshot_tags` (object of key/value strings) - Tags to apply to snapshot. + They will override OMIS tags if already applied to snapshot. This is a + [template engine](../templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `source_omi_filter` (object) - Filters used to populate the `source_omi` field. + - `filters` (map of strings) - filters used to select a `source_omi`. + - `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons. + + Example: + + ``` json + { + "source_omi_filter": { + "filters": { + "virtualization-type": "hvm", + "image-name": "image-name", + "root-device-type": "ebs" + }, + "owners": ["099720109477"], + } + } + ``` + + This selects an Ubuntu 16.04 HVM BSU OMIS from Canonical. NOTE: + This will fail unless *exactly* one OMIS is returned. In the above example, + `most_recent` will cause this to succeed by selecting the newest image. + +- `ssh_keypair_name` (string) - If specified, this is the key that will be used for SSH with the machine. The key must match a key pair name loaded up into Outscale. By default, this is blank, and Packer will generate a temporary keypair unless [`ssh_password`](../templates/communicator.html#ssh_password) is used. [`ssh_private_key_file`](../templates/communicator.html#ssh_private_key_file) or `ssh_agent_auth` must be specified when `ssh_keypair_name` is utilized. + +- `ssh_agent_auth` (boolean) - If true, the local SSH agent will be used to authenticate connections to the source VM. No temporary keypair will be created, and the values of `ssh_password` and `ssh_private_key_file` will be ignored. To use this option with a key pair already configured in the source OMI, leave the `ssh_keypair_name` blank. To associate an existing key pair in Outscale with the source VM, set the `ssh_keypair_name` field to the name of the key pair. + +- `ssh_interface` (string) - One of `public_ip`, `private_ip`, `public_dns`, or `private_dns`. If set, either the public IP address, private IP address, public DNS name or private DNS name will used as the host for SSH. The default behaviour if inside a Net is to use the public IP address if available, otherwise the private IP address will be used. If not in a Net the public DNS name will be used. Also works for WinRM. + + Where Packer is configured for an outbound proxy but WinRM traffic should be direct, `ssh_interface` must be set to `private_dns` and `.compute.internal` included in the `NO_PROXY` environment variable. + +- `subnet_id` (string) - If using Net, the ID of the subnet, such as `subnet-12345def`, where Packer will launch the VM. This field is required if you are using an non-default Net. + +- `tags` (object of key/value strings) - Tags applied to the OMIS and relevant snapshots. This is a [template engine](../templates/engine.html), see [Build template data](#build-template-data) for more information. + +- `temporary_key_pair_name` (string) - The name of the temporary key pair to generate. By default, Packer generates a name that looks like `packer_`, where <UUID> is a 36 character unique identifier. + +- `temporary_security_group_source_cidr` (string) - An IPv4 CIDR block to be authorized access to the VM, when packer is creating a temporary security group. The default is `0.0.0.0/0` (i.e., allow any IPv4 source). This is only used when `security_group_id` or `security_group_ids` is not specified. + +- `user_data` (string) - User data to apply when launching the VM. Note that you need to be careful about escaping characters due to the templates being JSON. It is often more convenient to use `user_data_file`, instead. Packer will not automatically wait for a user script to finish before shutting down the VM this must be handled in a provisioner. + +- `user_data_file` (string) - Path to a file that will be used for the user data when launching the VM. + +- `net_id` (string) - If launching into a Net subnet, Packer needs the Net ID in order to create a temporary security group within the Net. Requires `subnet_id` to be set. If this field is left blank, Packer will try to get the Net ID from the `subnet_id`. + +- `net_filter` (object) - Filters used to populate the `net_id` field. + Example: + + ``` json + { + "net_filter": { + "filters": { + "is-default": "false", + "ip-range": "/24" + } + } + } + ``` + + This selects the Net with a IPv4 CIDR block of `/24`. NOTE: This will fail unless *exactly* one Net is returned. + + - `filters` (map of strings) - filters used to select a `vpc_id`. NOTE: This will fail unless *exactly* one Net is returned. + + `net_id` take precedence over this. + +- `windows_password_timeout` (string) - The timeout for waiting for a Windows password for Windows VMs. Defaults to 20 minutes. Example value: `10m` + +## Basic Example + +``` json +{ + "type" : "osc-bsusurrogate", + "secret_key" : "YOUR SECRET KEY HERE", + "access_key" : "YOUR KEY HERE", + "region" : "eu-west-2", + "ssh_username" : "outscale", + "vm_type" : "t2.medium", + "source_omi" : "ami-bcfc34e0", + "subregion_name": "eu-west-2a", + "launch_block_device_mappings" : [ + { + "volume_type" : "io1", + "device_name" : "/dev/xvdf", + "delete_on_vm_deletion" : false, + "volume_size" : 10, + "iops": 300 + } + ], + "omi_root_device":{ + "source_device_name": "/dev/xvdf", + "device_name": "/dev/sda1", + "delete_on_vm_deletion": true, + "volume_size": 10, + "volume_type": "standard" + } +} +``` + +-> **Note:** Packer can also read the access key and secret access key from +environmental variables. See the configuration reference in the section above +for more information on what environmental variables Packer will look for. + +Further information on locating OMIS IDs and their relationship to VM +types and regions can be found in the Outscale Documentation [reference](https://wiki.outscale.net/display/EN/Official+OMIs+Reference). + +## Accessing the Virtual Machine to Debug + +If you need to access the virtual machine to debug for some reason, run this builder +with the `-debug` flag. In debug mode, the Outscale builder will save the private +key in the current directory and will output the DNS or IP information as well. +You can use this information to access the virtual machine as it is running. + +## Build template data + +In configuration directives marked as a template engine above, the following variables are available: + +- `BuildRegion` - The region (for example `eu-west-2`) where Packer is building the OMI. +- `SourceOMI` - The source OMIS ID (for example ami-a2412fcd`) used to build the OMI. +- `SourceOMIName` - The source OMIS Name (for example `ubutu-390`) used to build the OMI. +- `SourceOMITags` - The source OMIS Tags, as a `map[string]string` object. + +-> **Note:** Packer uses pre-built OMIs as the source for building images. +These source OMIs may include volumes that are not flagged to be destroyed on +termination of the virtual machine building the new image. In addition to those +volumes created by this builder, any volumes inn the source OMI which are not +marked for deletion on termination will remain in your account. diff --git a/website/source/docs/builders/osc-bsuvolume.html.md b/website/source/docs/builders/osc-bsuvolume.html.md new file mode 100644 index 000000000..bd491aba5 --- /dev/null +++ b/website/source/docs/builders/osc-bsuvolume.html.md @@ -0,0 +1,282 @@ +--- +description: | + The osc-bsuvolume Packer builder is like the BSU builder, but is intended to + create BSU volumes rather than a machine image. +layout: docs +page_title: 'Amazon BSU Volume - Builders' +sidebar_current: 'docs-builders-osc-bsuvolume' +--- + +# BSU Volume Builder + +Type: `osc-bsuvolume` + +The `osc-bsuvolume` Packer builder is able to create Ouscale Block Stogate Unit + volumes which are prepopulated with filesystems or data. + +This builder builds BSU volumes by launching an Outscale VM from a source OMI, +provisioning that running machine, and then destroying the source machine, +keeping the volumes intact. + +This is all done in your own Outscale account. The builder will create temporary key +pairs, security group rules, etc. that provide it temporary access to the +instance while the image is being created. + +The builder does *not* manage BSU Volumes. Once it creates volumes and stores +it in your account, it is up to you to use, delete, etc. the volumes. + +-> **Note:** Temporary resources are, by default, all created with the +prefix `packer`. This can be useful if you want to restrict the security groups +and key pairs Packer is able to operate on. + +## Configuration Reference + +There are many configuration options available for the builder. They are +segmented below into two categories: required and optional parameters. Within +each category, the available configuration keys are alphabetized. + +In addition to the options listed here, a +[communicator](/docs/templates/communicator.html) can be configured for this +builder. + +### Required: + +- `access_key` (string) - The access key used to communicate with OUTSCALE. [Learn how to set this](outscale.html#authentication) + +- `vm_type` (string) - The Outscale VM type to use while building the OMI, such as `t2.small`. + +- `region` (string) - The name of the region, such as `us-east-1`, in which to launch the Outscale VM to create the OMI. + +- `secret_key` (string) - The secret key used to communicate with Outscale. [Learn how to set this](outscale.html#authentication) + +- `source_omi` (string) - The initial OMI used as a base for the newly created machine. `source_omi_filter` may be used instead to populate this automatically. + +### Optional: + +- `ebs_volumes` (array of block device mappings) - Add the block device + mappings to the OMI. The block device mappings allow for keys: + + - `device_name` (string) - The device name exposed to the VM (for example, `/dev/sdh` or `xvdh`). Required for every device in the block device mapping. + + - `delete_on_vm_deletion` (boolean) - Indicates whether the BSU volume is deleted on instance termination. + - `iops` (number) - The number of I/O operations per second (IOPS) that the volume supports. See the documentation on + [IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS) + for more information. + + - `no_device` (boolean) - Suppresses the specified device included in the block device mapping of the OMI. + + - `snapshot_id` (string) - The ID of the snapshot + + - `virtual_name` (string) - The virtual device name. See the documentation on [Block Device Mapping](https://wiki.outscale.net/display/EN/Defining+Block+Device+Mappings) for more information + + - `volume_size` (number) - The size of the volume, in GiB. Required if not specifying a `snapshot_id` + + - `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes + + - `tags` (map) - Tags to apply to the volume. These are retained after + the builder completes. This is a [template + engine](/docs/templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `associate_public_ip_address` (boolean) - If using a non-default Net, public IP addresses are not provided by default. If this is toggled, your new VM will get a Public IP. + +- `subregion_name` (string) - Destination subregion to launch VM in. Leave this empty to allow Outscale to auto-assign. + +- `custom_endpoint_oapi` (string) - This option is useful if you use a cloud + provider whose API is compatible with Outscale OAPI. Specify another endpoint + like this `outscale.com/oapi/latest`. + +- `disable_stop_vm` (boolean) - Packer normally stops the build + VM after all provisioners have run. For Windows VMs, it is + sometimes desirable to [run Sysprep](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc721940(v=ws.10)) which will stop the VM for you. If this is set to `true`, Packer + *will not* stop the VM but will assume that you will send the stop + signal yourself through your final provisioner. You can do this with a + [windows-shell provisioner](https://www.packer.io/docs/provisioners/windows-shell.html). + + Note that Packer will still wait for the VM to be stopped, and + failing to send the stop signal yourself, when you have set this flag to + `true`, will cause a timeout. + +- `bsu_optimized` (boolean) - If true, the VM is created with optimized BSU I/O. + +- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS + verification of the OAPI endpoint. The default is `false`. + +- `run_tags` (object of key/value strings) - Tags to apply to the instance + that is *launched* to create the OMI. These tags are *not* applied to the + resulting OMI unless they're duplicated in `tags`. This is a [template + engine](/docs/templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `security_group_id` (string) - The ID (*not* the name) of the security + group to assign to the VM. By default this is not set and Packer will + automatically create a new temporary security group to allow SSH access. + Note that if this is specified, you must be sure the security group allows + access to the `ssh_port` given below. + +- `security_group_ids` (array of strings) - A list of security groups as + described above. Note that if this is specified, you must omit the + `security_group_id`. + +- `shutdown_behavior` (string) - Automatically terminate instances on + shutdown in case Packer exits ungracefully. Possible values are `stop` and + `terminate`. Defaults to `stop`. + +- `shutdown_behavior` (string) - Automatically terminate VMs on + shutdown in case Packer exits ungracefully. Possible values are "stop" and + "terminate", default is `stop`. + +- `snapshot_groups` (array of strings) - A list of groups that have access to + create volumes from the snapshot(s). By default no groups have permission + to create volumes from the snapshot(s). `all` will make the snapshot + publicly accessible. + +- `snapshot_users` (array of strings) - A list of account IDs that have + access to create volumes from the snapshot(s). By default no additional + users other than the user creating the OMIS has permissions to create + volumes from the backing snapshot(s). + +- `source_omi_filter` (object) - Filters used to populate the `source_omi` field. + - `filters` (map of strings) - filters used to select a `source_omi`. + - `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons. + + Example: + + ``` json + { + "source_omi_filter": { + "filters": { + "virtualization-type": "hvm", + "image-name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", + "root-device-type": "ebs" + }, + "owners": ["099720109477"], + } + } + ``` + + This selects an Ubuntu 16.04 HVM BSU OMIS from Canonical. NOTE: + This will fail unless *exactly* one OMIS is returned. In the above example, + `most_recent` will cause this to succeed by selecting the newest image. + +- `ssh_keypair_name` (string) - If specified, this is the key that will be used for SSH with the machine. The key must match a key pair name loaded up into Outscale. By default, this is blank, and Packer will generate a temporary keypair unless [`ssh_password`](../templates/communicator.html#ssh_password) is used. [`ssh_private_key_file`](../templates/communicator.html#ssh_private_key_file) or `ssh_agent_auth` must be specified when `ssh_keypair_name` is utilized. + +- `ssh_interface` (string) - One of `public_ip`, `private_ip`, `public_dns`, or `private_dns`. If set, either the public IP address, private IP address, public DNS name or private DNS name will used as the host for SSH. The default behaviour if inside a Net is to use the public IP address if available, otherwise the private IP address will be used. If not in a Net the public DNS name will be used. Also works for WinRM. + + Where Packer is configured for an outbound proxy but WinRM traffic should be direct, `ssh_interface` must be set to `private_dns` and `.compute.internal` included in the `NO_PROXY` environment variable. + +- `subnet_id` (string) - If using Net, the ID of the subnet, such as `subnet-12345def`, where Packer will launch the VM. This field is required if you are using an non-default Net. + +- `temporary_key_pair_name` (string) - The name of the temporary key pair to generate. By default, Packer generates a name that looks like `packer_`, where <UUID> is a 36 character unique identifier. + +- `temporary_security_group_source_cidr` (string) - An IPv4 CIDR block to be authorized access to the VM, when packer is creating a temporary security group. The default is `0.0.0.0/0` (i.e., allow any IPv4 source). This is only used when `security_group_id` or `security_group_ids` is not specified. + +- `user_data` (string) - User data to apply when launching the VM. Note that you need to be careful about escaping characters due to the templates being JSON. It is often more convenient to use `user_data_file`, instead. Packer will not automatically wait for a user script to finish before shutting down the VM this must be handled in a provisioner. + +- `user_data_file` (string) - Path to a file that will be used for the user data when launching the VM. + +- `net_id` (string) - If launching into a Net subnet, Packer needs the Net ID in order to create a temporary security group within the Net. Requires `subnet_id` to be set. If this field is left blank, Packer will try to get the Net ID from the `subnet_id`. + +- `net_filter` (object) - Filters used to populate the `net_id` field. + Example: + + ``` json + { + "net_filter": { + "filters": { + "is-default": "false", + "ip-range": "/24" + } + } + } + ``` + + This selects the Net with a IPv4 CIDR block of `/24`. NOTE: This will fail unless *exactly* one Net is returned. + + - `filters` (map of strings) - filters used to select a `vpc_id`. NOTE: This will fail unless *exactly* one Net is returned. + + `net_id` take precedence over this. + +- `windows_password_timeout` (string) - The timeout for waiting for a Windows password for Windows VMs. Defaults to 20 minutes. Example value: `10m` + +## Basic Example + +``` json +{ + "builders": [ + { + "type": "osc-bsuvolume", + "region": "eu-west-2", + "vm_type": "t2.micro", + "source_omi": "ami-65efcc11", + "ssh_username": "outscale", + "ebs_volumes": [ + { + "volume_type": "gp2", + "device_name": "/dev/xvdf", + "delete_on_vm_deletion": false, + "tags": { + "zpool": "data", + "Name": "Data1" + }, + "volume_size": 10 + }, + { + "volume_type": "gp2", + "device_name": "/dev/xvdg", + "tags": { + "zpool": "data", + "Name": "Data2" + }, + "delete_on_vm_deletion": false, + "volume_size": 10 + }, + { + "volume_size": 10, + "tags": { + "Name": "Data3", + "zpool": "data" + }, + "delete_on_vm_deletion": false, + "device_name": "/dev/xvdh", + "volume_type": "gp2" + } + ] + } + ] +} +``` + +-> **Note:** Packer can also read the access key and secret access key from +environmental variables. See the configuration reference in the section above +for more information on what environmental variables Packer will look for. + +Further information on locating OMIS IDs and their relationship to VM +types and regions can be found in the Outscale Documentation [reference](https://wiki.outscale.net/display/EN/Official+OMIs+Reference). + +## Accessing the Instance to Debug + +If you need to access the instance to debug for some reason, run the builder +with the `-debug` flag. In debug mode, the Amazon builder will save the private +key in the current directory and will output the DNS or IP information as well. +You can use this information to access the instance as it is running. + +## Build template data + +In configuration directives marked as a template engine above, the following +variables are available: + +- `BuildRegion` - The region (for example `eu-west-2`) where Packer is + building the OMI. +- `SourceOMI` - The source OMI ID (for example `ami-a2412fcd`) used to build + the OMI. +- `SourceOMIName` - The source OMI Name (for example + `ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to + build the OMI. +- `SourceOMITags` - The source OMI Tags, as a `map[string]string` object. + +-> **Note:** Packer uses pre-built OMIs as the source for building images. +These source OMIs may include volumes that are not flagged to be destroyed on +termination of the instance building the new image. In addition to those +volumes created by this builder, any volumes inn the source OMI which are not +marked for deletion on termination will remain in your account. diff --git a/website/source/docs/builders/osc-chroot.html.md b/website/source/docs/builders/osc-chroot.html.md new file mode 100644 index 000000000..31e1ced2b --- /dev/null +++ b/website/source/docs/builders/osc-chroot.html.md @@ -0,0 +1,383 @@ +--- +description: | + The amazon-chroot Packer builder is able to create Outscale OMIs backed by an BSU + volume as the root device. For more information on the difference between + instance storage and BSU-backed instances, storage for the root device section + in the Outscale documentation. +layout: docs +page_title: 'Outscale chroot - Builders' +sidebar_current: 'docs-builders-osc-chroot' +--- + +# OMI Builder (chroot) + +Type: `osc-chroot` + +The `osc-chroot` Packer builder is able to create Outscale Machine Images (OMIs) backed by an +BSU volume as the root device. For more information on the difference between +instance storage and BSU-backed instances, see the ["storage for the root +device" section in the Outscale +documentation](https://wiki.outscale.net/display/EN/Home). + +The difference between this builder and the `osc-bsu` builder is that this +builder is able to build an BSU-backed OMI without launching a new Outscale +VM. This can dramatically speed up OMI builds for organizations who need +the extra fast build. + +~> **This is an advanced builder** If you're just getting started with +Packer, we recommend starting with the [osc-bsu +builder](/docs/builders/osc-bsu.html), which is much easier to use. + +The builder does *not* manage OMIs. Once it creates an OMI and stores it in +your account, it is up to you to use, delete, etc., the OMI. + +## How Does it Work? + +This builder works by creating a new BSU volume from an existing source OMI and +attaching it into an already-running Outscale VM. Once attached, a +[chroot](https://en.wikipedia.org/wiki/Chroot) is used to provision the system +within that volume. After provisioning, the volume is detached, snapshotted, +and an OMI is made. + +Using this process, minutes can be shaved off the OMI creation process because +a new Outscale VM doesn't need to be launched. + +There are some restrictions, however. The host Outscale instance where the volume is +attached to must be a similar system (generally the same OS version, kernel +versions, etc.) as the OMI being built. Additionally, this process is much more +expensive because the Outscale VM must be kept running persistently in order +to build OMIs, whereas the other OMI builders start VMs on-demand to +build OMIs as needed. + +## Configuration Reference + +There are many configuration options available for the builder. They are +segmented below into two categories: required and optional parameters. Within +each category, the available configuration keys are alphabetized. + +### Required: + +- `access_key` (string) - The access key used to communicate with OUTSCALE. [Learn how to set this](outscale.html#authentication) + +- `omi_name` (string) - The name of the resulting OMIS that will appear when managing OMIs in the Outscale console or via APIs. This must be unique. To help make this unique, use a function like `timestamp` (see [template engine](../templates/engine.html) for more info). + +- `secret_key` (string) - The secret key used to communicate with Outscale. [Learn how to set this](outscale.html#authentication) + +- `source_omi` (string) - The initial OMI used as a base for the newly created machine. `source_omi_filter` may be used instead to populate this automatically. + +### Optional: + +- `omi_description` (string) - The description to set for the resulting OMI(s). + By default this description is empty. This is a [template engine](../templates/engine.html), + see [Build template data](#build-template-data) for more information. + +- `omi_account_ids` (array of strings) - A list of account IDs that have access to launch the resulting OMI(s). By default no additional users other than the user creating the OMIS has permissions to launch it. + +- `omi_virtualization_type` (string) - The type of virtualization for the OMI you are building. This option must match the supported virtualization type of `source_omi`. Can be `paravirtual` or `hvm`. + +- `chroot_mounts` (array of array of strings) - This is a list of devices to + mount into the chroot environment. This configuration parameter requires + some additional documentation which is in the [Chroot + Mounts](#chroot-mounts) section. Please read that section for more + information on how to use this. + +- `command_wrapper` (string) - How to run shell commands. This defaults to + `{{.Command}}`. This may be useful to set if you want to set environmental + variables or perhaps run it with `sudo` or so on. This is a configuration + template where the `.Command` variable is replaced with the command to be + run. Defaults to `{{.Command}}`. + +- `copy_files` (array of strings) - Paths to files on the running Outscale + VM that will be copied into the chroot environment prior to + provisioning. Defaults to `/etc/resolv.conf` so that DNS lookups work. Pass + an empty list to skip copying `/etc/resolv.conf`. You may need to do this + if you're building an image that uses systemd. + +- `custom_endpoint_oapi` (string) - This option is useful if you use a cloud + provider whose API is compatible with Outscale OAPI. Specify another endpoint + like this `outscale.com/oapi/latest`. + +- `device_path` (string) - The path to the device where the root volume of + the source OMI will be attached. This defaults to "" (empty string), which + forces Packer to find an open device automatically. + +- `force_deregister` (boolean) - Force Packer to first deregister an existing + OMIS if one with the same name already exists. Default `false`. + +- `force_delete_snapshot` (boolean) - Force Packer to delete snapshots + associated with OMIs, which have been deregistered by `force_deregister`. + Default `false`. + +- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS + verification of the OAPI endpoint. The default is `false`. + +- `from_scratch` (boolean) - Build a new volume instead of starting from an + existing OMI root volume snapshot. Default `false`. If `true`, `source_omi` + is no longer used and the following options become required: + `omi_virtualization_type`, `pre_mount_commands` and `root_volume_size`. The + below options are also required in this mode only: + +- `omi_block_device_mappings` (array of block device mappings) - Add one or more [block device mappings](https://wiki.outscale.net/display/EN/Defining+Block+Device+Mappings) to the OMI. These will be attached when booting a new VM from your OMI. To add a block device during the Packer build see `launch_block_device_mappings` below. Your options here may vary depending on the type of VM you use. The block device mappings allow for the following configuration: + + - `delete_on_vm_deletion` (boolean) - Indicates whether the BSU volume is deleted on VM termination. Default `false`. **NOTE**: If this value is not explicitly set to `true` and volumes are not cleaned up by an alternative method, additional volumes will accumulate after every build. + + - `device_name` (string) - The device name exposed to the VM (for example, `/dev/sdh` or `xvdh`). Required for every device in the block device mapping. + + - `iops` (number) - The number of I/O operations per second (IOPS) that the volume supports. See the documentation on + [IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS) + for more information + + - `no_device` (boolean) - Suppresses the specified device included in the + block device mapping of the OMI + + - `snapshot_id` (string) - The ID of the snapshot + + - `virtual_name` (string) - The virtual device name. See the documentation on [Block Device Mapping](https://wiki.outscale.net/display/EN/Defining+Block+Device+Mappings) for more information + + - `volume_size` (number) - The size of the volume, in GiB. Required if not specifying a `snapshot_id` + + - `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes + +- `root_device_name` (string) - The root device name. For example, `xvda`. + +- `mount_path` (string) - The path where the volume will be mounted. This is + where the chroot environment will be. This defaults to + `/mnt/packer-amazon-chroot-volumes/{{.Device}}`. This is a configuration + template where the `.Device` variable is replaced with the name of the + device where the volume is attached. + +- `mount_partition` (string) - The partition number containing the / + partition. By default this is the first partition of the volume, (for + example, `xvdf1`) but you can designate the entire block device by setting + `"mount_partition": "0"` in your config, which will mount `xvdf` instead. + +- `mount_options` (array of strings) - Options to supply the `mount` command + when mounting devices. Each option will be prefixed with `-o` and supplied + to the `mount` command ran by Packer. Because this command is ran in a + shell, user discretion is advised. See [this manual page for the mount + command](http://linuxcommand.org/man_pages/mount8.html) for valid file + system specific options. + +- `nvme_device_path` (string) - When we call the mount command (by default + `mount -o device dir`), the string provided in `nvme_mount_path` will + replace `device` in that command. When this option is not set, `device` in + that command will be something like `/dev/sdf1`, mirroring the attached + device name. This assumption works for most instances but will fail with c5 + and m5 instances. In order to use the chroot builder with c5 and m5 + instances, you must manually set `nvme_device_path` and `device_path`. + +- `pre_mount_commands` (array of strings) - A series of commands to execute + after attaching the root volume and before mounting the chroot. This is not + required unless using `from_scratch`. If so, this should include any + partitioning and filesystem creation commands. The path to the device is + provided by `{{.Device}}`. + +- `post_mount_commands` (array of strings) - As `pre_mount_commands`, but the + commands are executed after mounting the root device and before the extra + mount and copy steps. The device and mount path are provided by + `{{.Device}}` and `{{.MountPath}}`. + +- `root_volume_size` (number) - The size of the root volume in GB for the + chroot environment and the resulting OMI. Default size is the snapshot size + of the `source_omi` unless `from_scratch` is `true`, in which case this + field must be defined. + +- `root_volume_type` (string) - The type of BSU volume for the chroot + environment and resulting OMI. The default value is the type of the + `source_omi`, unless `from_scratch` is `true`, in which case the default + value is `gp2`. You can only specify `io1` if building based on top of a + `source_omi` which is also `io1`. + +- `root_volume_tags` (object of key/value strings) - Tags to apply to the + volumes that are *launched*. This is a [template + engine](/docs/templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `skip_region_validation` (boolean) - Set to true if you want to skip + validation of the region configuration option. Default `false`. + +- `snapshot_tags` (object of key/value strings) - Tags to apply to snapshot. + They will override OMI tags if already applied to snapshot. This is a + [template engine](/docs/templates/engine.html), see [Build template + data](#build-template-data) for more information. + +- `snapshot_groups` (array of strings) - A list of groups that have access to + create volumes from the snapshot(s). By default no groups have permission + to create volumes from the snapshot(s). `all` will make the snapshot + publicly accessible. + +- `snapshot_users` (array of strings) - A list of account IDs that have + access to create volumes from the snapshot(s). By default no additional + users other than the user creating the OMIS has permissions to create + volumes from the backing snapshot(s). + +- `source_omi_filter` (object) - Filters used to populate the `source_omi` field. + - `filters` (map of strings) - filters used to select a `source_omi`. + - `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons. + + Example: + + ``` json + { + "source_omi_filter": { + "filters": { + "virtualization-type": "hvm", + "image-name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", + "root-device-type": "ebs" + }, + "owners": ["099720109477"], + } + } + ``` + + This selects an Ubuntu 16.04 HVM BSU OMIS from Canonical. NOTE: + This will fail unless *exactly* one OMIS is returned. In the above example, + `most_recent` will cause this to succeed by selecting the newest image. + + You may set this in place of `source_omi` or in conjunction with it. If you + set this in conjunction with `source_omi`, the `source_omi` will be added + to the filter. The provided `source_omi` must meet all of the filtering + criteria provided in `source_omi_filter`; this pins the OMI returned by the + filter, but will cause Packer to fail if the `source_omi` does not exist. + +- `tags` (object of key/value strings) - Tags applied to the OMI. This is a + [template engine](/docs/templates/engine.html), see [Build template + data](#build-template-data) for more information. + +## Basic Example + +Here is a basic example. It is completely valid except for the access keys: + +``` json +{ + "type": "osc-chroot", + "access_key": "YOUR KEY HERE", + "secret_key": "YOUR SECRET KEY HERE", + "source_omi": "ami-3e158364", + "omi_name": "packer-outscale-chroot {{timestamp}}" +} +``` + +## Chroot Mounts + +The `chroot_mounts` configuration can be used to mount specific devices within +the chroot. By default, the following additional mounts are added into the +chroot by Packer: + +- `/proc` (proc) +- `/sys` (sysfs) +- `/dev` (bind to real `/dev`) +- `/dev/pts` (devpts) +- `/proc/sys/fs/binfmt_misc` (binfmt\_misc) + +These default mounts are usually good enough for anyone and are sane defaults. +However, if you want to change or add the mount points, you may using the +`chroot_mounts` configuration. Here is an example configuration which only +mounts `/proc` and `/dev`: + +``` json +{ + "chroot_mounts": [ + ["proc", "proc", "/proc"], + ["bind", "/dev", "/dev"] + ] +} +``` + +`chroot_mounts` is a list of a 3-tuples of strings. The three components of the +3-tuple, in order, are: + +- The filesystem type. If this is "bind", then Packer will properly bind the + filesystem to another mount point. + +- The source device. + +- The mount directory. + +## Parallelism + +A quick note on parallelism: it is perfectly safe to run multiple *separate* +Packer processes with the `osc-chroot` builder on the same Outscale VM. In +fact, this is recommended as a way to push the most performance out of your OMI +builds. + +Packer properly obtains a process lock for the parallelism-sensitive parts of +its internals such as finding an available device. + +## Gotchas + +### Unmounting the Filesystem + +One of the difficulties with using the chroot builder is that your provisioning +scripts must not leave any processes running or packer will be unable to +unmount the filesystem. + +For debian based distributions you can setup a +[policy-rc.d](http://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt) +file which will prevent packages installed by your provisioners from starting +services: + +``` json +{ + "type": "shell", + "inline": [ + "echo '#!/bin/sh' > /usr/sbin/policy-rc.d", + "echo 'exit 101' >> /usr/sbin/policy-rc.d", + "chmod a+x /usr/sbin/policy-rc.d" + ] +}, + +// ... + +{ + "type": "shell", + "inline": [ + "rm -f /usr/sbin/policy-rc.d" + ] +} +``` + +### Ansible provisioner + +Running ansible against `osc-chroot` requires changing the Ansible connection +to chroot and running Ansible as root/sudo. + +## Building From Scratch + +This example demonstrates the essentials of building an image from scratch. A +15G gp2 (SSD) device is created (overriding the default of standard/magnetic). +The device setup commands partition the device with one partition for use as an +HVM image and format it ext4. This builder block should be followed by +provisioning commands to install the os and bootloader. + +``` json +{ + "type": "osc-chroot", + "ami_name": "packer-from-scratch {{timestamp}}", + "from_scratch": true, + "ami_virtualization_type": "hvm", + "pre_mount_commands": [ + "parted {{.Device}} mklabel msdos mkpart primary 1M 100% set 1 boot on print", + "mkfs.ext4 {{.Device}}1" + ], + "root_volume_size": 15, + "root_device_name": "xvdf", + "ami_block_device_mappings": [ + { + "device_name": "xvdf", + "delete_on_termination": true, + "volume_type": "gp2" + } + ] +} +``` + +## Build template data + +In configuration directives marked as a template engine above, the following +variables are available: + +- `BuildRegion` - The region (for example `eu-west-2`) where Packer is building the OMI. +- `SourceOMI` - The source OMIS ID (for example `ami-a2412fcd`) used to build the OMI. +- `SourceOMIName` - The source OMIS Name (for example `ubuntu-390`) used to build the OMI. +- `SourceOMITags` - The source OMIS Tags, as a `map[string]string` object diff --git a/website/source/docs/builders/outscale.html.md b/website/source/docs/builders/outscale.html.md new file mode 100644 index 000000000..ce22be8d8 --- /dev/null +++ b/website/source/docs/builders/outscale.html.md @@ -0,0 +1,91 @@ +--- +description: | + Packer is able to create Outscale Machine Images (OMIs). To achieve this, Packer comes with + multiple builders depending on the strategy you want to use to build the OMI. +layout: docs +page_title: 'Outscale OMI - Builders' +sidebar_current: 'docs-builders-osc' +--- + +# Outscale OMI Builder + +Packer is able to create Outscale OMIs. To achieve this, Packer comes with +multiple builders depending on the strategy you want to use to build the OMI. +Packer supports the following builders at the moment: + +- [osc-bsu](/docs/builders/osc-bsu.html) - Create BSU-backed OMIs by + launching a source OMI and re-packaging it into a new OMI after + provisioning. If in doubt, use this builder, which is the easiest to get + started with. + +- [osc-chroot](/docs/builders/osc-chroot.html) - Create EBS-backed OMIs + from an existing OUTSCALE VM by mounting the root device and using a + [Chroot](https://en.wikipedia.org/wiki/Chroot) environment to provision + that device. This is an **advanced builder and should not be used by + newcomers**. However, it is also the fastest way to build an EBS-backed OMI + since no new OUTSCALE VM needs to be launched. + +- [osc-bsusurrogate](/docs/builders/osc-bsusurrogate.html) - Create BSU-backed OMIs from scratch. Works similarly to the `chroot` builder but does + not require running in Outscale VM. This is an **advanced builder and should not be + used by newcomers**. + +-> **Don't know which builder to use?** If in doubt, use the [osc-bsu +builder](/docs/builders/osc-bsu.html). It is much easier to use and Outscale generally recommends BSU-backed images nowadays. + +# Outscale BSU Volume Builder + +Packer is able to create Outscale BSU Volumes which are preinitialized with a filesystem and data. + +- [osc-bsuvolume](/docs/builders/osc-bsuvolume.html) - Create EBS volumes by launching a source OMI with block devices mapped. Provision the VM, then destroy it, retaining the EBS volumes. + +## Authentication + +The OUTSCALE provider offers a flexible means of providing credentials for authentication. The following methods are supported, in this order, and explained below: + +- Static credentials +- Environment variables +- Shared credentials file +- Outscale Role + +### Static Credentials + +Static credentials can be provided in the form of an access key id and secret. +These look like: + +``` json +{ + "access_key": "AKIAIOSFODNN7EXAMPLE", + "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "region": "us-east-1", + "type": "osc-bsu", + "oapi_custom_endpoint": "outscale.com/oapi/latest" +} +``` + +### Environment variables + +You can provide your credentials via the `OUTSCALE_ACCESSKEYID` and +`OUTSCALE_SECRETKEYID`, environment variables, representing your Outscale Access +Key and Outscale Secret Key, respectively. The `OUTSCALE_REGION` and +`OUTSCALE_OAPI_URL` environment variables are also used, if applicable: + +Usage: + + $ export OUTSCALE_ACCESSKEYID="anaccesskey" + $ export OUTSCALE_SECRETKEYID="asecretkey" + $ export OUTSCALE_REGION="eu-west-2" + $ packer build packer.json + +### Checking that system time is current + +Outscale uses the current time as part of the [request signing +process](http://docs.aws.osc.com/general/latest/gr/sigv4_signing.html). If +your system clock is too skewed from the current time, your requests might +fail. If that's the case, you might see an error like this: + + ==> osc-bsu: Error querying OMI: AuthFailure: OUTSCALE was not able to validate the provided access credentials + +If you suspect your system's date is wrong, you can compare it against +. On Linux/OS X, you can run the `date` command to get +the current time. If you're on Linux, you can try setting the time with ntp by +running `sudo ntpd -q`. diff --git a/website/source/docs/builders/scaleway.html.md b/website/source/docs/builders/scaleway.html.md index cdf975bc7..a97d3154a 100644 --- a/website/source/docs/builders/scaleway.html.md +++ b/website/source/docs/builders/scaleway.html.md @@ -74,11 +74,14 @@ builder. appear in your account. Default `packer-TIMESTAMP` - `boottype` (string) - The type of boot, can be either `local` or - `bootscript`, Default `bootscript` + `bootscript`. Default `bootscript` - `bootscript` (string) - The id of an existing bootscript to use when booting the server. +- `remove_volume` (boolean) - Force Packer to delete volume associated with + the resulting snapshot after the build. Default `false`. + ## Basic Example Here is a basic example. It is completely valid as soon as you enter your own diff --git a/website/source/docs/builders/tencentcloud-cvm.html.md b/website/source/docs/builders/tencentcloud-cvm.html.md index 544dee29e..dc48cebef 100644 --- a/website/source/docs/builders/tencentcloud-cvm.html.md +++ b/website/source/docs/builders/tencentcloud-cvm.html.md @@ -88,6 +88,16 @@ builder. - LOCAL_BASIC: 50 - Other: 50 ~ 1000 (need whitelist if > 50) +- `data_disks` (array of data disks) - Add one or more data disks to the instance before creating the + image. Note that if the source image has data disk snapshots, this argument will be ignored, and + the running instance will use source image data disk settings, in such case, `disk_type` + argument will be used as disk type for all data disks, and each data disk size will use the + origin value in source image. + The data disks allow for the following argument: + - `disk_type` - Type of the data disk. Valid choices: `CLOUD_BASIC`, `CLOUD_PREMIUM` and `CLOUD_SSD`. + - `disk_size` - Size of the data disk. + - `disk_snapshot_id` - Id of the snapshot for a data disk. + - `vpc_id` (string) - Specify vpc your cvm will be launched by. - `vpc_name` (string) - Specify vpc name you will create. if `vpc_id` is not set, packer will @@ -116,6 +126,9 @@ builder. - `host_name` (string) - host name. +- `run_tags` (map of strings) - Tags to apply to the instance that is *launched* to create the image. + These tags are *not* applied to the resulting image. + ## Basic Example Here is a basic example for Tencentcloud. @@ -137,7 +150,10 @@ Here is a basic example for Tencentcloud. "ssh_username" : "root", "image_name": "packerTest2", "packer_debug": true, - "associate_public_ip_address": true + "associate_public_ip_address": true, + "run_tags": { + "good": "luck" + } }], "provisioners": [{ "type": "shell", diff --git a/website/source/docs/builders/ucloud-uhost.html.md b/website/source/docs/builders/ucloud-uhost.html.md new file mode 100644 index 000000000..0bdce3f72 --- /dev/null +++ b/website/source/docs/builders/ucloud-uhost.html.md @@ -0,0 +1,155 @@ +--- +description: | + The `ucloud-uhost` Packer builder plugin provides the capability to build + customized images based on an existing base images. +layout: docs +page_title: 'UCloud Image Builder' +sidebar_current: 'docs-builders-ucloud-uhost' +--- + +# UCloud Image Builder + +Type: `ucloud-uhost` + +The `ucloud-uhost` Packer builder plugin provides the capability to build +customized images based on an existing base images. + +This builder builds an UCloud image by launching an UHost instance from a source image, +provisioning that running machine, and then creating an image from that machine. + +## Configuration Reference + +The following configuration options are available for building UCloud images. They are +segmented below into two categories: required and optional parameters. + +In addition to the options listed here, a +[communicator](../templates/communicator.html) can be configured for this +builder. + +\~> **Note:** The bulider doesn't support Windows images for now and only supports CentOS and Ubuntu images via SSH anthentication with `ssh_username` (Required) and `ssh_password` (Optional). The `ssh_username` must be `root` for CentOS images and `ubuntu` for Ubuntu images. The `ssh_password` may contain 8-30 characters, and must consist of at least 2 items out of the capital letters, lower case letters, numbers and special characters. The special characters include `()~!@#$%^&*-+=_|{}\[]:;'<>,.?/. + +### Required: + +- `public_key` - (string) This is the UCloud public key. It must be provided, but it can also be sourced from the `UCLOUD_PUBLIC_KEY` environment variable. + +- `private_key` - (string) This is the UCloud private key. It must be provided, but it can also be sourced from the `UCLOUD_PRIVATE_KEY` environment variable. + +- `project_id` - (string) This is the UCloud project id. It must be provided, but it can also be sourced from the `UCLOUD_PROJECT_ID` environment variables. + +- `region` - (string) This is the UCloud region. It must be provided, but it can also be sourced from the `UCLOUD_REGION` environment variables. + +- `availability_zone` - (string) This is the UCloud availability zone where UHost instance is located. such as: `cn-bj2-02`. You may refer to [list of availability_zone](https://docs.ucloud.cn/api/summary/regionlist) + +- `instance_type` - (string) The type of UHost instance. You may refer to [list of instance type](https://docs.ucloud.cn/compute/terraform/specification/instance) + +- `image_name` - (string) The name of the user-defined image, which contains 1-63 characters and only support Chinese, English, numbers, '-_,.:[]'. + +- `source_image_id` (string) - This is the ID of base image which you want to create your customized images with. + +### Optional: + +- `use_ssh_private_ip` - (boolean) - If this value is true, packer will connect to the created UHost instance via a private ip instead of allocating an EIP (elastic public ip).(Default: `false`). + +\~> **Note:** By default (`use_ssh_private_ip` is `false`), the launched uhost instance will be connecting with extranet by bounding with an EIP (elastic public ip) automatically, which bandwidth is 30 Mb by default and paid by traffic. + +- `internet_bandwidth` - (string) Maximum bandwidth to the EIP (elastic public ip), measured in Mbps (Mega bit per second). + The ranges for bandwidth are: 1-200 to pay by traffic, 1-800 to pay by bandwith. (Default: `1`). + +- `internet_charge_mode` -(Optional) The EIP (elastic public ip) charge mode associated to UHost instance. Possible values are: `traffic` as pay by traffic, `bandwidth` as pay by bandwidth. (Default: `traffic`). + +- `vpc_id` - (string) The ID of VPC linked to the UHost instance. If not defined `vpc_id`, the instance will use the default VPC in the current region. + +- `subnet_id` - (string) The ID of subnet under VPC. If `vpc_id` is defined, the `subnet_id` is mandatory required. If `vpc_id` and `subnet_id` are not defined, the instance will use the default subnet in the current region. + +- `security_group` - (string) The ID of the fire wall associated to UHost instance. If `security_group` is not defined, + the instance will use the non-recommended web fire wall, and open port include 22, 3389 by default. It is supported by ICMP fire wall protocols. + You may refer to [security group](https://docs.ucloud.cn/network/firewall/firewall.html). + +- `image_description` (string) - The description of the image. + +- `instance_name` (string) - The name of instance, which contains 1-63 characters and only support Chinese, English, numbers, '-', '_', '.'. + +- `boot_disk_type` - (string) The type of boot disk associated to UHost instance. + Possible values are: `cloud_ssd` for cloud boot disk, `local_normal` and `local_ssd` for local boot disk. (Default: `cloud_ssd`). + The `cloud_ssd` and `local_ssd` are not fully supported by all regions as boot disk type, please proceed to UCloud console for more details. + +\~> **Note:** It takes around 10 mins for boot disk initialization when `boot_disk_type` is `local_normal` or `local_ssd`. + +- `image_copy_to_mappings` (array of copied image mappings) - The array of mappings regarding the copied images to the destination regions and projects. + - `project_id` (string) - The destination project id, where copying image in. + + - `region` (string) - The destination region, where copying image in. + + - `name` (string) - The copied image name. If not defined, builder will use `image_name` as default name. + + - `description` (number) - The copied image description. + +## Examples + +Here is a basic example for build UCloud CentOS image: + +``` json +{ + "variables": { + "ucloud_public_key": "{{env `UCLOUD_PUBLIC_KEY`}}", + "ucloud_private_key": "{{env `UCLOUD_PRIVATE_KEY`}}", + "ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}" + }, + + "builders": [{ + "type":"ucloud-uhost", + "public_key":"{{user `ucloud_public_key`}}", + "private_key":"{{user `ucloud_private_key`}}", + "project_id": "{{user `ucloud_project_id`}}", + "region":"cn-bj2", + "availability_zone": "cn-bj2-02", + "instance_type":"n-basic-2", + "source_image_id":"uimage-f1chxn", + "ssh_username":"root", + "image_name":"packer_test_{{timestamp}}" + }] +} +``` + +Here is a example for build UCloud Ubuntu image: + +``` json +{ + "variables": { + "ucloud_public_key": "{{env `UCLOUD_PUBLIC_KEY`}}", + "ucloud_private_key": "{{env `UCLOUD_PRIVATE_KEY`}}", + "ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}", + "password": "ucloud_2019" + }, + + "builders": [{ + "type": "ucloud-uhost", + "public_key": "{{user `ucloud_public_key`}}", + "private_key": "{{user `ucloud_private_key`}}", + "project_id": "{{user `ucloud_project_id`}}", + "region": "cn-bj2", + "availability_zone": "cn-bj2-02", + "instance_type": "n-basic-2", + "source_image_id": "uimage-irofn4", + "ssh_password": "{{user `password`}}", + "ssh_username": "ubuntu", + "image_name": "packer-test-ubuntu-bj" + }], + + "provisioners": [{ + "type": "shell", + "execute_command": "echo '{{user `password`}}' | sudo -S '{{.Path}}'", + "inline": [ + "sleep 30", + "sudo apt update", + "sudo apt install nginx -y" + ] + }] +} +``` + +-> **Note:** Packer can also read the public key and private key from +environmental variables. See the configuration reference in the section above +for more information on what environmental variables Packer will look for. + +\~> **Note:** Source image may be deprecated after a while, you can use the tools like `UCloud CLI` to run `ucloud image list` to find one that exists. diff --git a/website/source/docs/builders/vagrant.html.md b/website/source/docs/builders/vagrant.html.md index 257908fe1..01e4add2b 100644 --- a/website/source/docs/builders/vagrant.html.md +++ b/website/source/docs/builders/vagrant.html.md @@ -62,7 +62,7 @@ one, by using `global_id` instead of `source_box`. "packer_" plus your buildname. - `provider` (string) - The vagrant [provider](docs/post-processors/vagrant.html). - This parameter is required when `source_path` have more than one provider, + This parameter is required when `source_path` have more than one provider, or when using `vagrant-cloud` post-processor. Defaults to unset. - `checksum` (string) - The checksum for the .box file. The type of the @@ -127,11 +127,11 @@ one, by using `global_id` instead of `source_box`. package your base box into its own standalone .box file. - `output_vagrantfile` (string) - Equivalent to setting the - [`--vagrantfile`](https://www.vagrantup.com/docs/cli/package.html#vagrantfile-file) option + [`--vagrantfile`](https://www.vagrantup.com/docs/cli/package.html#vagrantfile-file) option in `vagrant package`; defaults to unset - `package_include` (string) - Equivalent to setting the - [`--include`](https://www.vagrantup.com/docs/cli/package.html#include-x-y-z) option + [`--include`](https://www.vagrantup.com/docs/cli/package.html#include-x-y-z) option in `vagrant package`; defaults to unset ## Example @@ -151,3 +151,19 @@ Sample for `hashicorp/precise64` with virtualbox provider. ] } ``` + + +## A note on SSH connections + +Currently this builder only works for SSH connections, and automatically fills +in all information needed for the ssh communicator using vagrant's ssh-config. + +If you would like to connect via a different username or authentication method +than is produced when you call `vagrant ssh-config`, then you must provide the + +`ssh_username` and all other relevant authentication information (e.g. +`ssh_password` or `ssh_private_key_file`) + +By providing the `ssh_username`, you're telling Packer not to use the vagrant +ssh config, except for determining the host and port for the virtual machine to +connect to. \ No newline at end of file diff --git a/website/source/docs/builders/virtualbox-iso.html.md.erb b/website/source/docs/builders/virtualbox-iso.html.md.erb index 5c71e4f60..d8dec477c 100644 --- a/website/source/docs/builders/virtualbox-iso.html.md.erb +++ b/website/source/docs/builders/virtualbox-iso.html.md.erb @@ -195,6 +195,11 @@ Ubuntu 12.04 installer: ] ``` +Please note that for the Virtuabox builder, the IP address of the HTTP server +Packer launches for you to access files like the preseed file in the example +above (`{{ .HTTPIP }}`) is hardcoded to 10.0.2.2. If you change the network +of your VM you must guarantee that you can still access this HTTP server. + For more examples of various boot commands, see the sample projects from our [community templates page](/community-tools.html#templates). diff --git a/website/source/docs/builders/virtualbox-vm.html.md.erb b/website/source/docs/builders/virtualbox-vm.html.md.erb new file mode 100644 index 000000000..155b0c054 --- /dev/null +++ b/website/source/docs/builders/virtualbox-vm.html.md.erb @@ -0,0 +1,395 @@ +--- +modeline: | + vim: set ft=pandoc: +description: | + The VirtualBox Packer builder is able to create VirtualBox virtual machines snapshots + and export them in the OVF format, starting from an ISO image. +layout: docs +page_title: 'VirtualBox Snapshot - Builders' +sidebar_current: 'docs-builders-virtualbox-vm' +--- + +# VirtualBox Builder (from an existing VM) + +Type: `virtualbox-vm` + +The VirtualBox Packer builder is able to create +[VirtualBox](https://www.virtualbox.org/) virtual machines snapshots and +(optionally) export them in the OVF format, starting from an **existing** +virtual machine. + +The builder builds a virtual machine snapshot by using an existing virtual +machine, booting it, provisioning software within the OS, then shutting it down. +The result of the VirtualBox builder is a new snapshot persisting all changes +from the applied provisioners. + +## Basic Example + +Here is a basic example. which serves to show the basic configuration: + +``` json +{ + "type" : "virtualbox-vm", + "communicator" : "winrm", + "headless" : "{{user `headless`}}", + "winrm_username" : "vagrant", + "winrm_password" : "vagrant", + "winrm_timeout" : "2h", + "shutdown_command" : "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", + "guest_additions_mode" : "disable", + "output_directory" : "./builds-vm", + "vm_name" : "target-vm", + "attach_snapshot" : "Snapshot", + "target_snapshot" : "Target-Snapshot", + "force_delete_snapshot" : "true", + "keep_registered" : "false", + "skip_export" : "false" +} +``` + +It is important to add a `shutdown_command`. By default Packer halts the virtual +machine and the file system may not be sync'd. Thus, changes made in a +provisioner might not be saved. + +## Configuration Reference + +There are many configuration options available for the VirtualBox builder. They +are organized below into two categories: required and optional. Within each +category, the available options are alphabetized and described. + +In addition to the options listed here, a +[communicator](/docs/templates/communicator.html) can be configured for this +builder. + +### Required: + +- `vm_name` (string) - This is the name of the virtual machine to which the + builder shall attach. + +### Optional: + +- `attach_snapshot` (string) - Default to `null/empty`. The name of an + **existing** snapshot to which the builder shall attach the VM before + starting it. If no snapshot is specified the builder will simply start the + VM from it's current state i.e. snapshot. + +- `boot_command` (array of strings) - This is an array of commands to type + when the virtual machine is first booted. The goal of these commands should + be to type just enough to initialize the operating system installer. Special + keys can be typed as well, and are covered in the section below on the + boot command. If this is not specified, it is assumed the installer will + start itself. + +- `boot_wait` (string) - The time to wait after booting the initial virtual + machine before typing the `boot_command`. The value of this should be + a duration. Examples are `5s` and `1m30s` which will cause Packer to wait + five seconds and one minute 30 seconds, respectively. If this isn't + specified, the default is `10s` or 10 seconds. + +- `export_opts` (array of strings) - Additional options to pass to the + [VBoxManage + export](https://www.virtualbox.org/manual/ch09.html#vboxmanage-export). This + can be useful for passing product information to include in the resulting + appliance file. Packer JSON configuration file example: + + ``` json + { + "type": "virtualbox-vm", + "export_opts": + [ + "--manifest", + "--vsys", "0", + "--description", "{{user `vm_description`}}", + "--version", "{{user `vm_version`}}" + ], + "format": "ova", + } + ``` + + A VirtualBox [VM + description](https://www.virtualbox.org/manual/ch09.html#vboxmanage-export-ovf) + may contain arbitrary strings; the GUI interprets HTML formatting. However, + the JSON format does not allow arbitrary newlines within a value. Add a + multi-line description by preparing the string in the shell before the + packer call like this (shell `>` continuation character snipped for easier + copy & paste): + + ``` {.shell} + + vm_description='some + multiline + description' + + vm_version='0.2.0' + + packer build \ + -var "vm_description=${vm_description}" \ + -var "vm_version=${vm_version}" \ + "packer_conf.json" + ``` + +- `floppy_dirs` (array of strings) - A list of directories to place onto + the floppy disk recursively. This is similar to the `floppy_files` option + except that the directory structure is preserved. This is useful for when + your floppy disk includes drivers or if you just want to organize it's + contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed. + +- `floppy_files` (array of strings) - A list of files to place onto a floppy + disk that is attached when the VM is booted. This is most useful for + unattended Windows installs, which look for an `Autounattend.xml` file on + removable media. By default, no floppy will be attached. All files listed in + this setting get placed into the root directory of the floppy and the floppy + is attached as the first floppy device. Currently, no support exists for + creating sub-directories on the floppy. Wildcard characters (\*, ?, + and \[\]) are allowed. Directory names are also allowed, which will add all + the files found in the directory to the floppy. + +- `force_delete_snapshot` (boolean) - Defaults to `false`. If set to `true`, + overwrite an existing `target_snapshot`. Otherwise the builder will yield an + error if the specified target snapshot already exists. + +- `format` (string) - Either `ovf` or `ova`, this specifies the output format + of the exported virtual machine. This defaults to `ovf`. + +- `guest_additions_interface` (string) - The interface type to use to mount + guest additions when `guest_additions_mode` is set to `attach`. Will + default to the value set in `iso_interface`, if `iso_interface` is set. + Will default to "ide", if `iso_interface` is not set. Options are "ide" and + "sata". + +- `guest_additions_mode` (string) - The method by which guest additions are + made available to the guest for installation. Valid options are `upload`, + `attach`, or `disable`. If the mode is `attach` the guest additions ISO will + be attached as a CD device to the virtual machine. If the mode is `upload` + the guest additions ISO will be uploaded to the path specified by + `guest_additions_path`. The default value is `upload`. If `disable` is used, + guest additions won't be downloaded, either. + +- `guest_additions_path` (string) - The path on the guest virtual machine + where the VirtualBox guest additions ISO will be uploaded. By default this + is `VBoxGuestAdditions.iso` which should upload into the login directory of + the user. This is a [configuration + template](/docs/templates/engine.html) where the `Version` + variable is replaced with the VirtualBox version. + +- `guest_additions_sha256` (string) - The SHA256 checksum of the guest + additions ISO that will be uploaded to the guest VM. By default the + checksums will be downloaded from the VirtualBox website, so this only needs + to be set if you want to be explicit about the checksum. + +- `guest_additions_url` (string) - The URL to the guest additions ISO + to upload. This can also be a file URL if the ISO is at a local path. By + default, the VirtualBox builder will attempt to find the guest additions ISO + on the local file system. If it is not available locally, the builder will + download the proper guest additions ISO from the internet. + +- `guest_os_type` (string) - The guest OS type being installed. By default + this is `other`, but you can get *dramatic* performance improvements by + setting this to the proper value. To view all available values for this run + `VBoxManage list ostypes`. Setting the correct value hints to VirtualBox how + to optimize the virtual hardware to work best with that operating system. + +- `headless` (boolean) - Packer defaults to building VirtualBox virtual + machines by launching a GUI that shows the console of the machine + being built. When this value is set to `true`, the machine will start + without a console. + +- `http_directory` (string) - Path to a directory to serve using an + HTTP server. The files in this directory will be available over HTTP that + will be requestable from the virtual machine. This is useful for hosting + kickstart files and so on. By default this is an empty string, which means + no HTTP server will be started. The address and port of the HTTP server will + be available as variables in `boot_command`. This is covered in more detail + below. + +- `http_port_min` and `http_port_max` (number) - These are the minimum and + maximum port to use for the HTTP server started to serve the + `http_directory`. Because Packer often runs in parallel, Packer will choose + a randomly available port in this range to run the HTTP server. If you want + to force the HTTP server to be on one port, make this minimum and maximum + port the same. By default the values are `8000` and `9000`, respectively. + +- `keep_registered` (boolean) - Set this to `true` if you would like to keep + the VM attached to the snapshot specified by `attach_snapshot`. Otherwise + the builder will reset the VM to the snapshot to which the VM was attached + before the builder started. Defaults to `false`. + +- `output_directory` (string) - This is the path to the directory where the + resulting virtual machine will be created. This may be relative or absolute. + If relative, the path is relative to the working directory when `packer` + is executed. This directory must not exist or be empty prior to running + the builder. By default this is `output-BUILDNAME` where "BUILDNAME" is the + name of the build. + +- `post_shutdown_delay` (string) - The amount of time to wait after shutting + down the virtual machine. Defaults to `2s`. **Hint:** Don't specify a value + smaller than `2s` because otherwise the creation of a target snapshot might + corrupt the VM because not all locks has been released by VirtualBox. + +- `shutdown_command` (string) - The command to use to gracefully shut down the + machine once all the provisioning is done. By default this is an empty + string, which tells Packer to just forcefully shut down the machine unless a + shutdown command takes place inside script so this may safely be omitted. If + one or more scripts require a reboot it is suggested to leave this blank + since reboots may fail and specify the final shutdown command in your + last script. + +- `shutdown_timeout` (string) - The amount of time to wait after executing the + `shutdown_command` for the virtual machine to actually shut down. If it + doesn't shut down in this time, it is an error. By default, the timeout is + `5m` or five minutes. + +- `skip_export` (boolean) - Defaults to `false`. When enabled, Packer will + not export the VM. Useful if the builder should be applied again on the created + target snapshot. + +- `ssh_host_port_min` and `ssh_host_port_max` (number) - The minimum and + maximum port to use for the SSH port on the host machine which is forwarded + to the SSH port on the guest machine. Because Packer often runs in parallel, + Packer will choose a randomly available port in this range to use as the + host port. By default this is `2222` to `4444`. + +- `ssh_skip_nat_mapping` (boolean) - Defaults to `false`. When enabled, Packer + does not setup forwarded port mapping for SSH requests and uses `ssh_port` + on the host to communicate to the virtual machine. + +- `target_snapshot` (string) - Default to `null/empty`. The name of the + snapshot which shall be created after all provisioners has been run by the + builder. If no target snapshot is specified and `keep_registered` is set to + `false` the builder will revert to the snapshot to which the VM was attached + before the builder has been executed, which will revert all changes applied + by the provisioners. This is handy if only an export shall be created and no + further snapshot is required. + +- `vboxmanage` (array of array of strings) - Custom `VBoxManage` commands to + execute in order to further customize the virtual machine being created. The + value of this is an array of commands to execute. The commands are executed + in the order defined in the template. For each command, the command is + defined itself as an array of strings, where each string represents a single + argument on the command-line to `VBoxManage` (but excluding + `VBoxManage` itself). Each arg is treated as a [configuration + template](/docs/templates/engine.html), where the `Name` + variable is replaced with the VM name. More details on how to use + `VBoxManage` are below. + +- `vboxmanage_post` (array of array of strings) - Identical to `vboxmanage`, + except that it is run after the virtual machine is shutdown, and before the + virtual machine is exported. + +- `virtualbox_version_file` (string) - The path within the virtual machine to + upload a file that contains the VirtualBox version that was used to create + the machine. This information can be useful for provisioning. By default + this is `.vbox_version`, which will generally be uploaded into the home + directory. Set to an empty string to skip uploading this file, which can be + useful when using the `none` communicator. + +- `vrdp_bind_address` (string / IP address) - The IP address that should be + binded to for VRDP. By default packer will use `127.0.0.1` for this. If you + wish to bind to all interfaces use `0.0.0.0`. + +- `vrdp_port_min` and `vrdp_port_max` (number) - The minimum and maximum port + to use for VRDP access to the virtual machine. Packer uses a randomly chosen + port in this range that appears available. By default this is `5900` to + `6000`. The minimum and maximum ports are inclusive. + +## Boot Command + +The `boot_command` configuration is very important: it specifies the keys to +type when the virtual machine is first booted in order to start the OS +installer. This command is typed after `boot_wait`, which gives the virtual +machine some time to actually load the ISO. + +As documented above, the `boot_command` is an array of strings. The strings are +all typed in sequence. It is an array only to improve readability within the +template. + +The boot command is sent to the VM through the `VBoxManage` utility in as few +invocations as possible. We send each character in groups of 25, with a default +delay of 100ms between groups. The delay alleviates issues with latency and CPU +contention. If you notice missing keys, you can tune this delay by specifying +"boot_keygroup_interval" in your Packer template, for example: + +``` +{ + "builders": [ + { + "type": "virtualbox", + "boot_keygroup_interval": "500ms" + ... + } + ] +} +``` + +<%= partial "partials/builders/boot-command" %> + +<%= partial "partials/builders/virtualbox-ssh-key-pair" %> + +Example boot command. This is actually a working boot command used to start an +Ubuntu 12.04 installer: + +``` text +[ + "", + "/install/vmlinuz noapic ", + "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", + "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", + "hostname={{ .Name }} ", + "fb=false debconf/frontend=noninteractive ", + "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", + "keyboard-configuration/variant=USA console-setup/ask_detect=false ", + "initrd=/install/initrd.gz -- " +] +``` + +Please note that for the Virtuabox builder, the IP address of the HTTP server +Packer launches for you to access files like the preseed file in the example +above (`{{ .HTTPIP }}`) is hardcoded to 10.0.2.2. If you change the network +of your VM you must guarantee that you can still access this HTTP server. + +For more examples of various boot commands, see the sample projects from our +[community templates page](/community-tools.html#templates). + +## Guest Additions + +Packer will automatically download the proper guest additions for the version of +VirtualBox that is running and upload those guest additions into the virtual +machine so that provisioners can easily install them. + +Packer downloads the guest additions from the official VirtualBox website, and +verifies the file with the official checksums released by VirtualBox. + +After the virtual machine is up and the operating system is installed, Packer +uploads the guest additions into the virtual machine. The path where they are +uploaded is controllable by `guest_additions_path`, and defaults to +"VBoxGuestAdditions.iso". Without an absolute path, it is uploaded to the home +directory of the SSH user. + +## VBoxManage Commands + +In order to perform extra customization of the virtual machine, a template can +define extra calls to `VBoxManage` to perform. +[VBoxManage](https://www.virtualbox.org/manual/ch09.html) is the command-line +interface to VirtualBox where you can completely control VirtualBox. It can be +used to do things such as set RAM, CPUs, etc. + +Extra VBoxManage commands are defined in the template in the `vboxmanage` +section. An example is shown below that sets the VRAM within the virtual machine: + +``` json +{ + "vboxmanage": [ + ["modifyvm", "{{.Name}}", "--vram", "64"] + ] +} +``` + +The value of `vboxmanage` is an array of commands to execute. These commands are +executed in the order defined. So in the above example, the memory will be set +followed by the CPUs. + +Each command itself is an array of strings, where each string is an argument to +`VBoxManage`. Each argument is treated as a [configuration +template](/docs/templates/engine.html). The only available +variable is `Name` which is replaced with the unique name of the VM, which is +required for many VBoxManage calls. diff --git a/website/source/docs/builders/virtualbox.html.md b/website/source/docs/builders/virtualbox.html.md index 4aafd82d5..1de794329 100644 --- a/website/source/docs/builders/virtualbox.html.md +++ b/website/source/docs/builders/virtualbox.html.md @@ -28,3 +28,10 @@ supports the following VirtualBox builders: VirtualBox VM export you want to use as the source. As an additional benefit, you can feed the artifact of this builder back into itself to iterate on a machine. + +- [virtualbox-vm](/docs/builders/virtualbox-vm.html) - This builder uses an + existing VM to run defined provisioners on top of that VM, and optionally + creates a snapshot to save the changes applied from the provisioners. In + addition the builder is able to export that machine to create an image. The + builder is able to attach to a defined snapshot as a starting point, which + could be defined statically or dynamically via a variable. diff --git a/website/source/docs/commands/console.html.md b/website/source/docs/commands/console.html.md index 7b99d4024..fc05e0e3c 100644 --- a/website/source/docs/commands/console.html.md +++ b/website/source/docs/commands/console.html.md @@ -14,9 +14,9 @@ interpolations. You may access variables in the Packer config you called the console with, or provide variables when you call console using the -var or -var-file command line options. -Type in the interpolation to test and hit to see the result. +Type in the interpolation to test and hit \ to see the result. -To exit the console, type "exit" and hit , or use Control-C. +To exit the console, type "exit" and hit \, or use Control-C. ``` shell $ packer console my_template.json @@ -99,4 +99,4 @@ command: ``` $ echo {{timestamp}} | packer console 1559855090 -``` \ No newline at end of file +``` diff --git a/website/source/docs/extending/plugins.html.md b/website/source/docs/extending/plugins.html.md index b375a7e86..4f927e159 100644 --- a/website/source/docs/extending/plugins.html.md +++ b/website/source/docs/extending/plugins.html.md @@ -52,7 +52,7 @@ later, it will take precedence over one found earlier. 1. The directory where `packer` is, or the executable directory. -2. The `$HOME/packer.d/plugins` directory, if `$HOME` is defined (unix) +2. The `$HOME/.packer.d/plugins` directory, if `$HOME` is defined (unix) 3. The `%APPDATA%/packer.d/plugins` if `%APPDATA%` is defined (windows) @@ -130,8 +130,7 @@ There are two steps involved in creating a plugin: plugin, implement the `packer.Builder` interface. 2. Serve the interface by calling the appropriate plugin serving method in - your main method. In the case of a builder, this is - `plugin.RegisterBuilder`. + your main method. A basic example is shown below. In this example, assume the `Builder` struct implements the `packer.Builder` interface: @@ -145,11 +144,16 @@ import ( type Builder struct{} func main() { - plugin.RegisterBuilder(new(Builder)) + server, err := plugin.Server() + if err != nil { + panic(err) + } + server.RegisterBuilder(new(Builder)) + server.Serve() } ``` -**That's it!** `plugin.RegisterBuilder` handles all the nitty gritty of +**That's it!** `plugin.Server` handles all the nitty gritty of communicating with Packer core and serving your builder over RPC. It can't get much easier than that. diff --git a/website/source/docs/other/environment-variables.html.md b/website/source/docs/other/environment-variables.html.md index a9becdcf1..257336482 100644 --- a/website/source/docs/other/environment-variables.html.md +++ b/website/source/docs/other/environment-variables.html.md @@ -16,6 +16,8 @@ each can be found below: of the configuration file is basic JSON. See the [core configuration page](/docs/other/core-configuration.html). +- `PACKER_CONFIG_DIR` - The location of the `.packer.d` config directory + - `PACKER_LOG` - Setting this to any value other than "" (empty string) or "0" will enable the logger. See the [debugging page](/docs/other/debugging.html). diff --git a/website/source/docs/post-processors/exoscale-import.html.md b/website/source/docs/post-processors/exoscale-import.html.md new file mode 100644 index 000000000..1f8260382 --- /dev/null +++ b/website/source/docs/post-processors/exoscale-import.html.md @@ -0,0 +1,89 @@ +--- +description: | + The Packer Exoscale Import post-processor takes an image artifact + from various builders and imports it to Exoscale. +layout: docs +page_title: 'Exoscale Import - Post-Processors' +sidebar_current: 'docs-post-processors-exoscale-import' +--- + +# Exoscale Import Post-Processor + +Type: `exoscale-import` + +The Packer Exoscale Import post-processor takes an image artifact from +the QEMU, Artifice, or File builders and imports it to Exoscale. + +## How Does it Work? + +The import process operates uploading a temporary copy of the image to +Exoscale's [Object Storage](https://www.exoscale.com/object-storage/) (SOS) +and then importing it as a Custom Template via the Exoscale API. The +temporary copy in SOS can be discarded after the import is complete. + +For more information about Exoscale Custom Templates, see the +[documentation](https://community.exoscale.com/documentation/compute/custom-templates/). + +## Configuration + +There are some configuration options available for the post-processor. + +Required: + +- `api_key` (string) - The API key used to communicate with Exoscale + services. This may also be set using the `EXOSCALE_API_KEY` environmental + variable. + +- `api_secret` (string) - The API secret used to communicate with Exoscale + services. This may also be set using the `EXOSCALE_API_SECRET` + environmental variable. + +- `image_bucket` (string) - The name of the bucket in which to upload the + template image to SOS. The bucket must exist when the post-processor is + run. + +- `template_name` (string) - The name to be used for registering the template. + +- `template_description` (string) - The description for the registered template. + +Optional: + +- `api_endpoint` (string) - The API endpoint used to communicate with the + Exoscale API. Defaults to `https://api.exoscale.com/compute`. + +- `sos_endpoint` (string) - The endpoint used to communicate with SOS. + Defaults to `https://sos-ch-gva-2.exo.io`. + +- `template_zone` (string) - The Exoscale [zone](https://www.exoscale.com/datacenters/) + in which to register the template. Defaults to `ch-gva-2`. + +- `template_username` (string) - An optional username to be used to log into + Compute instances using this template. + +- `template_disable_password` (boolean) - Whether the registered template + should disable Compute instance password reset. Defaults to `false`. + +- `template_disable_sshkey` (boolean) - Whether the registered template + should disable SSH key installation during Compute instance creation. + Defaults to `false`. + +- `skip_clean` (boolean) - Whether we should skip removing the image file + uploaded to SOS after the import process has completed. "true" means that + we should leave it in the bucket, "false" means deleting it. + Defaults to `false`. + +## Basic Example + +Here is a basic example: + +``` json +{ + "type": "exoscale-import", + "api_key": "{{user `exoscale_api_key`}}", + "api_secret": "{{user `exoscale_api_secret`}}", + "image_bucket": "my-templates", + "template_name": "myapp", + "template_description": "myapp v1.2.3", + "template_username": "admin" +} +``` diff --git a/website/source/docs/post-processors/shell-local.html.md b/website/source/docs/post-processors/shell-local.html.md index 0d7c1f4ee..c24d00463 100644 --- a/website/source/docs/post-processors/shell-local.html.md +++ b/website/source/docs/post-processors/shell-local.html.md @@ -68,18 +68,29 @@ Optional parameters: it is necessary below. - `execute_command` (array of strings) - The command used to execute the - script. By default this is `["/bin/sh", "-c", "{{.Vars}}", "{{.Script}}"]` - on unix and `["cmd", "/c", "{{.Vars}}", "{{.Script}}"]` on windows. This is - treated as a [template engine](/docs/templates/engine.html). There are two - available variables: `Script`, which is the path to the script to run, and - `Vars`, which is the list of `environment_vars`, if configured. If you - choose to set this option, make sure that the first element in the array is - the shell program you want to use (for example, "sh" or - "/usr/local/bin/zsh" or even "powershell.exe" although anything other than - a flavor of the shell command language is not explicitly supported and may - be broken by assumptions made within Packer). It's worth noting that if you - choose to try to use shell-local for Powershell or other Windows commands, - the environment variables will not be set properly for your environment. + script. By default, on *nix systems this is: + + ``` + ["/bin/sh", "-c", "{{.Vars}} {{.Script}}"] + ``` + + While on Windows, `execute_command` defaults to: + + ``` + ["cmd", "/V", "/C", "{{.Vars}}", "call", "{{.Script}}"] + ``` + + This is treated as a [template engine](/docs/templates/engine.html). + There are two available variables: `Script`, which is the path to the + script to run, and `Vars`, which is the list of `environment_vars`, if + configured. If you choose to set this option, make sure that the first + element in the array is the shell program you want to use (for example, + "sh" or "/usr/local/bin/zsh" or even "powershell.exe" although anything + other than a flavor of the shell command language is not explicitly + supported and may be broken by assumptions made within Packer). It's + worth noting that if you choose to try to use shell-local for + Powershell or other Windows commands, the environment variables will + not be set properly for your environment. For backwards compatibility, `execute_command` will accept a string instead of an array of strings. If a single string or an array of strings with only diff --git a/website/source/docs/post-processors/vagrant-cloud.html.md b/website/source/docs/post-processors/vagrant-cloud.html.md index 1edac0f8a..d0b490fc1 100644 --- a/website/source/docs/post-processors/vagrant-cloud.html.md +++ b/website/source/docs/post-processors/vagrant-cloud.html.md @@ -104,7 +104,7 @@ post-processor. ``` json { "variables": { - "cloud_token": "{{ env `ATLAS_TOKEN` }}", + "cloud_token": "{{ env `VAGRANT_CLOUD_TOKEN` }}", "version": "1.0.{{timestamp}}" }, "post-processors": [ diff --git a/website/source/docs/post-processors/vagrant.html.md b/website/source/docs/post-processors/vagrant.html.md index f62ff5afd..d9168cfce 100644 --- a/website/source/docs/post-processors/vagrant.html.md +++ b/website/source/docs/post-processors/vagrant.html.md @@ -83,6 +83,15 @@ more details about certain options in following sections. - `vagrantfile_template` (string) - Path to a template to use for the Vagrantfile that is packaged with the box. +- `vagrantfile_template_generated` (boolean) - By default, Packer will + exit with an error if the file specified using the + `vagrantfile_template` variable is not found. However, under certain + circumstances, it may be desirable to dynamically generate the + Vagrantfile during the course of the build. Setting this variable to + `true` skips the start up check and allows the user to script the + creation of the Vagrantfile at some previous point in the build. + Defaults to `false`. + ## Provider-Specific Overrides If you have a Packer template with multiple builder types within it, you may diff --git a/website/source/docs/provisioners/ansible.html.md.erb b/website/source/docs/provisioners/ansible.html.md.erb index 0e98a7601..0d8c011a2 100644 --- a/website/source/docs/provisioners/ansible.html.md.erb +++ b/website/source/docs/provisioners/ansible.html.md.erb @@ -60,8 +60,8 @@ Optional Parameters: "ansible_env_vars": [ "ANSIBLE_HOST_KEY_CHECKING=False", "ANSIBLE_SSH_ARGS='-o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s'", "ANSIBLE_NOCOLOR=True" ] ``` - If you are running a Windows build on AWS, Azure or Google Compute and - would like to access the auto-generated password that Packer uses to + If you are running a Windows build on AWS, Azure, Google Compute, or OpenStack + and would like to access the auto-generated password that Packer uses to connect to a Windows instance via WinRM, you can use the template variable {{.WinRMPassword}} in this option. For example: @@ -85,8 +85,8 @@ Optional Parameters: "extra_arguments": [ "--extra-vars", "Region={{user `Region`}} Stage={{user `Stage`}}" ] ``` - If you are running a Windows build on AWS, Azure or Google Compute and - would like to access the auto-generated password that Packer uses to + If you are running a Windows build on AWS, Azure, Google Compute, or OpenStack + and would like to access the auto-generated password that Packer uses to connect to a Windows instance via WinRM, you can use the template variable {{.WinRMPassword}} in this option. For example: @@ -96,6 +96,17 @@ Optional Parameters: ] ``` +- `galaxy_file` (string) - A requirements file which provides a way to + install roles with the [ansible-galaxy + cli](http://docs.ansible.com/ansible/galaxy.html#the-ansible-galaxy-command-line-tool) + on the local machine before executing `ansible-playbook`. By default, this is empty. + +- `galaxy_command` (string) - The command to invoke ansible-galaxy. By + default, this is `ansible-galaxy`. + +- `galaxy_force_install` (string) - Force overwriting an existing role. + Adds `--force` option to `ansible-galaxy` command. By default, this is empty. + - `groups` (array of strings) - The groups into which the Ansible host should be placed. When unspecified, the host is not associated with any groups. @@ -121,6 +132,11 @@ Optional Parameters: `local_port`. A system-chosen port is used when `local_port` is missing or empty. +- `roles_path` (string) - The path to the directory on your local system to + install the roles in. Adds `--roles-path /path/to/your/roles` to + `ansible-galaxy` command. By default, this is empty, and thus `--roles-path` + option is not added to the command. + - `sftp_command` (string) - The command to run on the machine being provisioned by Packer to handle the SFTP protocol that Ansible will use to transfer files. The command should read and write on stdin and stdout, diff --git a/website/source/docs/provisioners/inspec.html.md.erb b/website/source/docs/provisioners/inspec.html.md.erb index e315529ac..5c184b718 100644 --- a/website/source/docs/provisioners/inspec.html.md.erb +++ b/website/source/docs/provisioners/inspec.html.md.erb @@ -67,15 +67,15 @@ Optional Parameters: ``` - `attributes` (array of strings) - Attribute Files used by InSpec which will - be passed to the `--attrs` argument of the `inspec` command when this + be passed to the `--input-file` argument of the `inspec` command when this provisioner runs InSpec. Specify this if you want a different location. - Note using also `"--attrs"` in `extra_arguments` will override this + Note using also `"--input-file"` in `extra_arguments` will override this setting. - `attributes_directory` (string) - The directory in which to place the temporary generated InSpec Attributes file. By default, this is the system-specific temporary file location. The fully-qualified name of this - temporary file will be passed to the `--attrs` argument of the `inspec` + temporary file will be passed to the `--input-file` argument of the `inspec` command when this provisioner runs InSpec. Specify this if you want a different location. diff --git a/website/source/docs/provisioners/powershell.html.md.erb b/website/source/docs/provisioners/powershell.html.md.erb index 074f4f8f3..60a715ca5 100644 --- a/website/source/docs/provisioners/powershell.html.md.erb +++ b/website/source/docs/provisioners/powershell.html.md.erb @@ -50,8 +50,8 @@ The example below is fully functional. inject prior to the execute\_command. The format should be `key=value`. Packer injects some environmental variables by default into the environment, as well, which are covered in the section below. If you are - running on AWS, Azure or Google Compute and would like to access the - generated password that Packer uses to connect to the instance via WinRM, + running on AWS, Azure, Google Compute, or OpenStack and would like to access + the generated password that Packer uses to connect to the instance via WinRM, you can use the template variable `{{.WinRMPassword}}` to set this as an environment variable. For example: @@ -84,9 +84,9 @@ The example below is fully functional. - `elevated_user` and `elevated_password` (string) - If specified, the PowerShell script will be run with elevated privileges using the given - Windows user. If you are running a build on AWS, Azure or Google Compute - and would like to run using the generated password that Packer uses to - connect to the instance via WinRM, you may do so by using the template + Windows user. If you are running a build on AWS, Azure, Google Compute, + or OpenStack and would like to run using the generated password that Packer + uses to connect to the instance via WinRM, you may do so by using the template variable {{.WinRMPassword}}. For example: ``` json diff --git a/website/source/docs/provisioners/shell-local.html.md.erb b/website/source/docs/provisioners/shell-local.html.md.erb index 5625d611c..8fd4ba210 100644 --- a/website/source/docs/provisioners/shell-local.html.md.erb +++ b/website/source/docs/provisioners/shell-local.html.md.erb @@ -41,9 +41,9 @@ Exactly *one* of the following is required: - `command` (string) - This is a single command to execute. It will be written to a temporary file and run using the `execute_command` call below. - If you are building a windows vm on AWS, Azure or Google Compute and would - like to access the generated password that Packer uses to connect to the - instance via WinRM, you can use the template variable `{{.WinRMPassword}}` + If you are building a windows vm on AWS, Azure, Google Compute, or OpenStack + and would like to access the generated password that Packer uses to connect + to the instance via WinRM, you can use the template variable `{{.WinRMPassword}}` to set this as an environment variable. - `inline` (array of strings) - This is an array of commands to execute. The @@ -68,10 +68,10 @@ Optional parameters: inject prior to the `execute_command`. The format should be `key=value`. Packer injects some environmental variables by default into the environment, as well, which are covered in the section below. If you are - building a windows vm on AWS, Azure or Google Compute and would like to - access the generated password that Packer uses to connect to the instance - via WinRM, you can use the template variable `{{.WinRMPassword}}` to set - this as an environment variable. For example: + building a windows vm on AWS, Azure, Google Compute, or OpenStack and would + like to access the generated password that Packer uses to connect to the + instance via WinRM, you can use the template variable `{{.WinRMPassword}}` + to set this as an environment variable. For example: `"environment_vars": "WINRMPASS={{.WinRMPassword}}"` - `env_var_format` (string) - When we parse the environment\_vars that you @@ -103,9 +103,9 @@ Optional parameters: sake of clarity, as even when you set only a single `command` to run, Packer writes it to a temporary file and then runs it as a script. - If you are building a windows vm on AWS, Azure or Google Compute and would - like to access the generated password that Packer uses to connect to the - instance via WinRM, you can use the template variable `{{.WinRMPassword}}` + If you are building a windows vm on AWS, Azure, Google Compute, or OpenStack + and would like to access the generated password that Packer uses to connect + to the instance via WinRM, you can use the template variable `{{.WinRMPassword}}` to set this as an environment variable. - `inline_shebang` (string) - The diff --git a/website/source/docs/provisioners/shell.html.md.erb b/website/source/docs/provisioners/shell.html.md.erb index d94849696..a9eed5300 100644 --- a/website/source/docs/provisioners/shell.html.md.erb +++ b/website/source/docs/provisioners/shell.html.md.erb @@ -46,7 +46,7 @@ The example below is fully functional. `execute_command` will be `chmod +x {{.Path}}; . {{.EnvVarFile}} && {{.Path}}`. This option is unnecessary for most cases, but if you have extra quoting in your custom - `execute_command`, then this may be unnecessary for proper script + `execute_command`, then this may be required for proper script execution. Default: false. - `execute_command` (string) - The command to use to execute the script. By diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index 7aa2da186..26fd0ab85 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -151,6 +151,23 @@
  • + > + Outscale + + > Parallels > @@ -299,6 +325,9 @@ > Docker Tag + > + Exoscale Import + > Google Compute Export diff --git a/website/source/partials/builder/amazon/common/_AMIConfig-not-required.html.md b/website/source/partials/builder/amazon/common/_AMIConfig-not-required.html.md index 8c1d75f7e..8031a650c 100644 --- a/website/source/partials/builder/amazon/common/_AMIConfig-not-required.html.md +++ b/website/source/partials/builder/amazon/common/_AMIConfig-not-required.html.md @@ -80,6 +80,17 @@ custom keys. For valid formats see *KmsKeyId* in the [AWS API docs - CopyImage](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopyImage.html). + This option supercedes the `kms_key_id` option -- if you set both, and + they are different, Packer will respect the value in + `region_kms_key_ids` for your build region and silently disregard the + value provided in `kms_key_id`. + +- `skip_save_build_region` (bool) - If true, Packer will not check whether an AMI with the `ami_name` exists + in the region it is building in. It will use an intermediary AMI name, + which it will not convert to an AMI in the build region. It will copy + the intermediary AMI into any regions provided in `ami_regions`, then + delete the intermediary AMI. Default `false`. + - `snapshot_tags` (TagMap) - Tags to apply to snapshot. They will override AMI tags if already applied to snapshot. This is a [template engine](../templates/engine.html), see [Build template diff --git a/website/source/partials/builder/amazon/common/_BlockDevice-not-required.html.md b/website/source/partials/builder/amazon/common/_BlockDevice-not-required.html.md index e8c1616ec..d12d91efd 100644 --- a/website/source/partials/builder/amazon/common/_BlockDevice-not-required.html.md +++ b/website/source/partials/builder/amazon/common/_BlockDevice-not-required.html.md @@ -30,4 +30,12 @@ - `volume_size` (int64) - The size of the volume, in GiB. Required if not specifying a snapshot_id. + +- `kms_key_id` (string) - ID, alias or ARN of the KMS key to use for boot volume encryption. This + only applies to the main region, other regions where the AMI will be + copied will be encrypted by the default EBS KMS key. For valid formats + see KmsKeyId in the [AWS API docs - + CopyImage](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopyImage.html) + This field is validated by Packer, when using an alias, you will have to + prefix kms_key_id with alias/. \ No newline at end of file diff --git a/website/source/partials/builder/amazon/common/_RunConfig-not-required.html.md b/website/source/partials/builder/amazon/common/_RunConfig-not-required.html.md index 7fbb68c95..cfecb6d76 100644 --- a/website/source/partials/builder/amazon/common/_RunConfig-not-required.html.md +++ b/website/source/partials/builder/amazon/common/_RunConfig-not-required.html.md @@ -243,4 +243,5 @@ - `windows_password_timeout` (time.Duration) - The timeout for waiting for a Windows password for Windows instances. Defaults to 20 minutes. Example value: 10m - \ No newline at end of file + +- `ssh_interface` (string) - SSH Interface \ No newline at end of file diff --git a/website/source/partials/builder/azure/arm/_Config-not-required.html.md b/website/source/partials/builder/azure/arm/_Config-not-required.html.md index 2f34f6237..6e449c9f5 100644 --- a/website/source/partials/builder/azure/arm/_Config-not-required.html.md +++ b/website/source/partials/builder/azure/arm/_Config-not-required.html.md @@ -18,6 +18,30 @@ "managed_image_name": "TargetImageName", "managed_image_resource_group_name": "TargetResourceGroup" +- `shared_image_gallery_destination` (SharedImageGalleryDestination) - The name of the Shared Image Gallery under which the managed image will be published as Shared Gallery Image version. + + Following is an example. + + + + "shared_image_gallery_destination": { + "resource_group": "ResourceGroup", + "gallery_name": "GalleryName", + "image_name": "ImageName", + "image_version": "1.0.0", + "replication_regions": ["regionA", "regionB", "regionC"] + } + "managed_image_name": "TargetImageName", + "managed_image_resource_group_name": "TargetResourceGroup" + +- `shared_image_gallery_timeout` (time.Duration) - How long to wait for an image to be published to the shared image + gallery before timing out. If your Packer build is failing on the + Publishing to Shared Image Gallery step with the error `Original Error: + context deadline exceeded`, but the image is present when you check your + Azure dashboard, then you probably need to increase this timeout from + its default of "60m" (valid time units include `s` for seconds, `m` for + minutes, and `h` for hours.) + - `image_version` (string) - Specify a specific version of an OS to boot from. Defaults to `latest`. There may be a difference in versions available across regions due to image synchronization latency. To ensure a consistent diff --git a/website/source/partials/builder/azure/arm/_SharedImageGalleryDestination-not-required.html.md b/website/source/partials/builder/azure/arm/_SharedImageGalleryDestination-not-required.html.md new file mode 100644 index 000000000..07793ec80 --- /dev/null +++ b/website/source/partials/builder/azure/arm/_SharedImageGalleryDestination-not-required.html.md @@ -0,0 +1,7 @@ + + +- `resource_group` (string) - Sig Destination Resource Group +- `gallery_name` (string) - Sig Destination Gallery Name +- `image_name` (string) - Sig Destination Image Name +- `image_version` (string) - Sig Destination Image Version +- `replication_regions` ([]string) - Sig Destination Replication Regions \ No newline at end of file diff --git a/website/source/partials/builder/digitalocean/_Config-not-required.html.md b/website/source/partials/builder/digitalocean/_Config-not-required.html.md index f80d2a215..fe4917ba9 100644 --- a/website/source/partials/builder/digitalocean/_Config-not-required.html.md +++ b/website/source/partials/builder/digitalocean/_Config-not-required.html.md @@ -24,6 +24,14 @@ droplet to enter a desired state (such as "active") before timing out. The default state timeout is "6m". +- `snapshot_timeout` (time.Duration) - How long to wait for an image to be published to the shared image + gallery before timing out. If your Packer build is failing on the + Publishing to Shared Image Gallery step with the error `Original Error: + context deadline exceeded`, but the image is present when you check your + Azure dashboard, then you probably need to increase this timeout from + its default of "60m" (valid time units include `s` for seconds, `m` for + minutes, and `h` for hours.) + - `droplet_name` (string) - The name assigned to the droplet. DigitalOcean sets the hostname of the machine to this value. diff --git a/website/source/partials/builder/openstack/_ImageConfig-not-required.html.md b/website/source/partials/builder/openstack/_ImageConfig-not-required.html.md index e7a0b17c3..8c962fa1f 100644 --- a/website/source/partials/builder/openstack/_ImageConfig-not-required.html.md +++ b/website/source/partials/builder/openstack/_ImageConfig-not-required.html.md @@ -12,4 +12,6 @@ use_blockstorage_volume is true. - `image_tags` ([]string) - List of tags to add to the image after creation. + +- `image_min_disk` (int) - Minimum disk size needed to boot image, in gigabytes. \ No newline at end of file diff --git a/website/source/partials/builder/openstack/_RunConfig-not-required.html.md b/website/source/partials/builder/openstack/_RunConfig-not-required.html.md index 4d467ac60..d037ed872 100644 --- a/website/source/partials/builder/openstack/_RunConfig-not-required.html.md +++ b/website/source/partials/builder/openstack/_RunConfig-not-required.html.md @@ -1,5 +1,14 @@ +- `ssh_interface` (string) - The type of interface to connect via SSH. Values useful for Rackspace + are "public" or "private", and the default behavior is to connect via + whichever is returned first from the OpenStack API. + +- `ssh_ip_version` (string) - The IP version to use for SSH connections, valid values are `4` and `6`. + Useful on dual stacked instances where the default behavior is to + connect via whichever IP address is returned first from the OpenStack + API. + - `availability_zone` (string) - The availability zone to launch the server in. If this isn't specified, the default enforced by your OpenStack cluster will be used. This may be required for some OpenStack clusters. @@ -10,6 +19,13 @@ - `floating_ip_network` (string) - The ID or name of an external network that can be used for creation of a new floating IP. +- `instance_floating_ip_net` (string) - The ID of the network to which the instance is attached and which should + be used to associate with the floating IP. This provides control over + the floating ip association on multi-homed instances. The association + otherwise depends on a first-returned-interface policy which could fail + if the network to which it is connected is unreachable from the floating + IP network. + - `floating_ip` (string) - A specific floating IP to assign to this instance. - `reuse_ips` (bool) - Whether or not to attempt to reuse existing unassigned floating ips in diff --git a/website/source/partials/builder/qemu/_Config-not-required.html.md b/website/source/partials/builder/qemu/_Config-not-required.html.md index edec786a0..a0e6d8724 100644 --- a/website/source/partials/builder/qemu/_Config-not-required.html.md +++ b/website/source/partials/builder/qemu/_Config-not-required.html.md @@ -23,6 +23,15 @@ does not include WHPX support and users may need to compile or source a build of QEMU for Windows themselves with WHPX support. +- `disk_additional_size` ([]string) - Additional disks to create. Uses `vm_name` as the disk name template and + appends `-#` where `#` is the position in the array. `#` starts at 1 since 0 + is the default disk. Each string represents the disk image size in bytes. + Optional suffixes 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' + (gigabyte, 1024M), 'T' (terabyte, 1024G), 'P' (petabyte, 1024T) and 'E' + (exabyte, 1024P) are supported. 'b' is ignored. Per qemu-img documentation. + Each additional disk uses the same disk parameters as the default disk. + Unset by default. + - `cpus` (int) - The number of cpus to use when building the VM. The default is `1` CPU. @@ -171,11 +180,16 @@ some platforms. For example qemu-kvm, or qemu-system-i386 may be a better choice for some systems. -- `ssh_host_port_min` (int) - The minimum and - maximum port to use for the SSH port on the host machine which is forwarded - to the SSH port on the guest machine. Because Packer often runs in parallel, - Packer will choose a randomly available port in this range to use as the - host port. By default this is 2222 to 4444. +- `qmp_enable` (bool) - Enable QMP socket. Location is specified by `qmp_socket_path`. Defaults + to false. + +- `qmp_socket_path` (string) - QMP Socket Path when `qmp_enable` is true. Defaults to + `output_directory`/`vm_name`.monitor. + +- `ssh_host_port_min` (int) - The minimum and maximum port to use for the SSH port on the host machine + which is forwarded to the SSH port on the guest machine. Because Packer + often runs in parallel, Packer will choose a randomly available port in + this range to use as the host port. By default this is 2222 to 4444. - `ssh_host_port_max` (int) - SSH Host Port Max - `use_default_display` (bool) - If true, do not pass a -display option @@ -186,6 +200,10 @@ binded to for VNC. By default packer will use 127.0.0.1 for this. If you wish to bind to all interfaces use 0.0.0.0. +- `vnc_use_password` (bool) - Whether or not to set a password on the VNC server. This option + automatically enables the QMP socket. See `qmp_socket_path`. Defaults to + `false`. + - `vnc_port_min` (int) - The minimum and maximum port to use for VNC access to the virtual machine. The builder uses VNC to type the initial boot_command. Because Packer generally runs in parallel, diff --git a/website/source/partials/builder/scaleway/_Config-not-required.html.md b/website/source/partials/builder/scaleway/_Config-not-required.html.md index 251639fdd..ae0146e28 100644 --- a/website/source/partials/builder/scaleway/_Config-not-required.html.md +++ b/website/source/partials/builder/scaleway/_Config-not-required.html.md @@ -14,4 +14,5 @@ - `boottype` (string) - The type of boot, can be either local or bootscript, Default bootscript - \ No newline at end of file + +- `remove_volume` (bool) - Remove Volume \ No newline at end of file diff --git a/website/source/partials/builder/tencentcloud/cvm/_TencentCloudRunConfig-not-required.html.md b/website/source/partials/builder/tencentcloud/cvm/_TencentCloudRunConfig-not-required.html.md index d07449f6c..41ed4918f 100644 --- a/website/source/partials/builder/tencentcloud/cvm/_TencentCloudRunConfig-not-required.html.md +++ b/website/source/partials/builder/tencentcloud/cvm/_TencentCloudRunConfig-not-required.html.md @@ -11,6 +11,17 @@ - `disk_size` (int64) - Root disk size your cvm will be launched by. values range(in GB): +- `data_disks` ([]tencentCloudDataDisk) - Add one or more data disks to the instance before creating the image. + Note that if the source image has data disk snapshots, this argument + will be ignored, and the running instance will use source image data + disk settings, in such case, `disk_type` argument will be used as disk + type for all data disks, and each data disk size will use the origin + value in source image. + The data disks allow for the following argument: + - `disk_type` - Type of the data disk. Valid choices: `CLOUD_BASIC`, `CLOUD_PREMIUM` and `CLOUD_SSD`. + - `disk_size` - Size of the data disk. + - `disk_snapshot_id` - Id of the snapshot for a data disk. + - `vpc_id` (string) - Specify vpc your cvm will be launched by. - `vpc_name` (string) - Specify vpc name you will create. if vpc_id is not set, packer will @@ -41,4 +52,7 @@ - `host_name` (string) - host name. +- `run_tags` (map[string]string) - Tags to apply to the instance that is *launched* to create the image. + These tags are *not* applied to the resulting image. + - `ssh_private_ip` (bool) - SSH Private Ip \ No newline at end of file diff --git a/website/source/partials/builder/tencentcloud/cvm/_tencentCloudDataDisk-not-required.html.md b/website/source/partials/builder/tencentcloud/cvm/_tencentCloudDataDisk-not-required.html.md new file mode 100644 index 000000000..d68f0bf2a --- /dev/null +++ b/website/source/partials/builder/tencentcloud/cvm/_tencentCloudDataDisk-not-required.html.md @@ -0,0 +1,5 @@ + + +- `disk_type` (string) - Disk Type +- `disk_size` (int64) - Disk Size +- `disk_snapshot_id` (string) - Snapshot Id \ No newline at end of file diff --git a/website/source/partials/builders/_aws-spot-docs.html.md b/website/source/partials/builders/_aws-spot-docs.html.md index c68731230..e4bfdc44f 100644 --- a/website/source/partials/builders/_aws-spot-docs.html.md +++ b/website/source/partials/builders/_aws-spot-docs.html.md @@ -16,9 +16,15 @@ this to `auto` for Packer to automatically discover the best spot price or to "0" to use an on demand instance (default). -- `spot_price_auto_product` (string) - Required if `spot_price` is set to - `auto`. This tells Packer what sort of AMI you're launching to find the - best spot price. This must be one of: `Linux/UNIX`, `SUSE Linux`, +- `spot_price_auto_product` (string) - Deprecated. Prior to v1.4.3, was + required if `spot_price` is set to `auto`. + + If you are using Packer v1.4.3 or later, simply remove this from your + template; it is no longer necessary based on recent changes to how Amazon + calculates spot prices. + + Prior to version 1.4.3, This told Packer what sort of AMI you're launching + to find the best spot price. This must be one of: `Linux/UNIX`, `SUSE Linux`, `Windows`, `Linux/UNIX (Amazon VPC)`, `SUSE Linux (Amazon VPC)`, `Windows (Amazon VPC)` diff --git a/website/source/partials/helper/communicator/_SSH-not-required.html.md b/website/source/partials/helper/communicator/_SSH-not-required.html.md index aa63682f1..b7241d620 100644 --- a/website/source/partials/helper/communicator/_SSH-not-required.html.md +++ b/website/source/partials/helper/communicator/_SSH-not-required.html.md @@ -30,19 +30,6 @@ The `~` can be used in path and will be expanded to the home directory of current user. -- `ssh_interface` (string) - One of `public_ip`, `private_ip`, `public_dns`, or `private_dns`. If - set, either the public IP address, private IP address, public DNS name - or private DNS name will used as the host for SSH. The default behaviour - if inside a VPC is to use the public IP address if available, otherwise - the private IP address will be used. If not in a VPC the public DNS name - will be used. Also works for WinRM. - - Where Packer is configured for an outbound proxy but WinRM traffic - should be direct, `ssh_interface` must be set to `private_dns` and - `.compute.internal` included in the `NO_PROXY` environment - variable. - -- `ssh_ip_version` (string) - SSHIP Version - `ssh_pty` (bool) - If `true`, a PTY will be requested for the SSH connection. This defaults to `false`. diff --git a/website/source/partials/helper/communicator/_SSHInterface-not-required.html.md b/website/source/partials/helper/communicator/_SSHInterface-not-required.html.md new file mode 100644 index 000000000..64502023b --- /dev/null +++ b/website/source/partials/helper/communicator/_SSHInterface-not-required.html.md @@ -0,0 +1,19 @@ + + +- `ssh_interface` (string) - One of `public_ip`, `private_ip`, `public_dns`, or `private_dns`. If + set, either the public IP address, private IP address, public DNS name + or private DNS name will used as the host for SSH. The default behaviour + if inside a VPC is to use the public IP address if available, otherwise + the private IP address will be used. If not in a VPC the public DNS name + will be used. Also works for WinRM. + + Where Packer is configured for an outbound proxy but WinRM traffic + should be direct, `ssh_interface` must be set to `private_dns` and + `.compute.internal` included in the `NO_PROXY` environment + variable. + +- `ssh_ip_version` (string) - The IP version to use for SSH connections, valid values are `4` and `6`. + Useful on dual stacked instances where the default behavior is to + connect via whichever IP address is returned first from the OpenStack + API. + \ No newline at end of file diff --git a/website/source/partials/provisioners/_common-config.html.md b/website/source/partials/provisioners/_common-config.html.md index 6d4d48c35..c1b74a39d 100644 --- a/website/source/partials/provisioners/_common-config.html.md +++ b/website/source/partials/provisioners/_common-config.html.md @@ -15,11 +15,11 @@ Parameters common to all provisioners: "script": "script.sh", "override": { "vmware-iso": { - "execute_command": "echo 'password' | sudo -S bash {{.Path}}" + "execute_command": "echo 'password' | sudo -S bash {{.Path}}" } } } ``` - `timeout` (duration) - If the provisioner takes more than for example - `1h10m1s` or `10m` to finish, the provisioner will timeout and fail. \ No newline at end of file + `1h10m1s` or `10m` to finish, the provisioner will timeout and fail.